Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateWebhookData has field username instead of name. #71

Open
MorrowM opened this issue Jul 3, 2024 · 1 comment
Open

CreateWebhookData has field username instead of name. #71

MorrowM opened this issue Jul 3, 2024 · 1 comment

Comments

@MorrowM
Copy link
Contributor

MorrowM commented Jul 3, 2024

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.

simmsb added a commit that referenced this issue Jul 11, 2024
@simmsb
Copy link
Owner

simmsb commented Jul 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants