calamity
calamity copied to clipboard
`CreateWebhookData` has field `username` instead of `name`.
Relevant file: https://github.com/simmsb/calamity/blob/master/calamity/Calamity/HTTP/Webhook.hs#L36
This code snippet
invoke $
CreateWebhook ctx' $
CreateWebhookData
{ username = Just "test-webhook",
avatar = Just "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA ...
}
yield an error
"Left (HTTPError {status = 400, response = Just (Object (fromList [(\"code\",Number 50035.0),(\"errors\",Object (fromList [(\"name\",Object (fromList [(\"_errors\",Array [Object (fromList [(\"code\",String \"BASE_TYPE_REQUIRED\"),(\"message\",String \"This field is required\")])])]))])),(\"message\",String \"Invalid Form Body\")]))})"
which to me looks like it might be caused by the fact that Create Webhook has a name field and not a username field. The question is then whether to rename the actual record selector as well. I think it wouldn't be a bad idea considering that it's been broken until now, so breakage from renaming is minimal.
There're also other types that need to be fixed, like ModifyWebhookData.
Thanks for finding this, I've published 0.12.0.0 with a fix for this: https://hackage.haskell.org/package/calamity-0.12.0.0