calamity icon indicating copy to clipboard operation
calamity copied to clipboard

`CreateWebhookData` has field `username` instead of `name`.

Open MorrowM opened this issue 1 week ago • 0 comments

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.

MorrowM avatar Jul 03 '24 18:07 MorrowM