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 a GraphQL Mutation with an input object to examples #98

Closed
mntlty opened this issue Jan 17, 2023 · 1 comment · Fixed by #99
Closed

Add a GraphQL Mutation with an input object to examples #98

mntlty opened this issue Jan 17, 2023 · 1 comment · Fixed by #99

Comments

@mntlty
Copy link
Contributor

mntlty commented Jan 17, 2023

I noticed that there are no examples of Mutations in https://github.com/cli/go-gh/blob/trunk/example_gh_test.go

I think this is important for a few reasons:

  • there's no mention of Mutate in the examples or in the readme. including it in the examples may make it more discoverable
  • unlike queries, many of the GitHub GraphQL mutations take an input object, for example the addStar mutation and its input. because this is a nested object, it has a different format than queries such as
    func ExampleGQLClient_advanced() {
    Figuring out the right Go syntax took me some time even when I had a properly formed GraphQL mutation to compare it to

If you agree, I'd be happy to open a PR to update, and would like to know:

  1. is addStar a good reference, or is there another that looks better?
  2. for variables, would it be better to use https://github.com/shurcooL/githubv4 or to use only standard types?
  3. should the Readme also mention mutations, or is it sufficient to have them in the examples?
@mislav
Copy link
Contributor

mislav commented Jan 17, 2023

Great idea! Go ahead please.

  1. addStar seems fine! Any simple mutation would do.
  2. We like to use githubv4 because it validates the input types.
  3. No, the README doesn't need to showcase mutations.

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 a pull request may close this issue.

2 participants