Skip to content

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

Closed
@mntlty

Description

@mntlty

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions