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

Add endpoint to create gist #455

Merged

Conversation

matsubara0507
Copy link
Contributor

ref https://docs.github.com/rest/reference/gists#create-a-gist

ghci> github (OAuth "...") $ createGistR (NewGist "" (HashMap.fromList [("hoge.txt", NewGistFile "abc")]) False)
Right (Gist {...})

about NewGist's fields:

  • description is optional param according to reference. But, when use Maybe type and Nothing, occur error Invalid request.\\n\\nFor 'properties/description', nil is not a string.. So, description param is Text type.
  • public is optional param according to reference. But, when use Maybe type and Nothing, occur error Left (ParseError "Error in $.public: expected Bool, but encountered Null"). So, public param is Bool type.

@phadej
Copy link
Contributor

phadej commented Dec 31, 2020

{ "foo": null }

is not the same as

{}
```.

See https://github.com/phadej/github/blob/master/src/GitHub/Data/Milestone.hs#L56-L65 for an example (filtering out `null`s).

instance Binary NewGist

instance ToJSON NewGist where
toJSON (NewGist { newGistDescription = description
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brackets are redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, remove () 91424a9

@matsubara0507
Copy link
Contributor Author

Thank you. Use Maybe a type to description and public params with filter notNull. c44824b

@phadej phadej merged commit eac5751 into haskell-github:master Oct 9, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants