phadej · GitHub

@matsubara0507

Copy link Copy Markdown

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 Copy Markdown

Contributor

{ "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).

phadej

instance Binary NewGist

instance ToJSON NewGist where
toJSON (NewGist { newGistDescription = description

Copy link Copy Markdown

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 Copy Markdown

Contributor Author

Choose a reason for hiding this comment

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

@matsubara0507

Copy link Copy Markdown

Contributor Author

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

@phadej

Read the original on github.com ↗