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

How can i run multiple mutation #113

Open
liangyuanpeng opened this issue Apr 19, 2023 · 1 comment
Open

How can i run multiple mutation #113

liangyuanpeng opened this issue Apr 19, 2023 · 1 comment

Comments

@liangyuanpeng
Copy link

liangyuanpeng commented Apr 19, 2023

mutation {
  createDiscussion(input: {
    repositoryId: "abc"
    title: "first discussion title"
    body: "first discussion body"
    categoryId: "asd"
  }) {
    discussion {
      id
    }
  }
  addDiscussionComment(input: {
    discussionId: "asd"
    body: "first discussion reply!"
  }) {
    comment {
      id
    }
  }
} 

I want to use this lib to request this graphql and i just can let it work for one mutation:

mutation {
  createDiscussion(input: {
    repositoryId: "abc"
    title: "first discussion title"
    body: "first discussion body"
    categoryId: "asd"
  })

This is the code for it:

var m struct {
		CreateDiscussion struct {
			Discussion struct {
				Repository struct {
					ID githubv4.ID
				}
				Title    githubv4.String
				Body     githubv4.String
				Category struct {
					ID githubv4.ID
				}
			}
		} `graphql:"createDiscussion(input:$input)"`
	}
	input := githubv4.CreateDiscussionInput{
		RepositoryID: "asd",
		Title:        githubv4.String("first discussion title"),
		Body:         githubv4.String("first discussion body!"),
		CategoryID:   "asd",
	}
	err := ghV4Client.Mutate(context.Background(), &m, input, nil)
	if err != nil {
		panic(err)
	}

Thanks any help and this project is great, Thanks for your work.

@liangyuanpeng
Copy link
Author

Just work for this graphql also great:

mutation {
  createDiscussion(input: {
    repositoryId: "abc"
    title: "first discussion title"
    body: "first discussion body"
    categoryId: "asd"
  })
}

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

No branches or pull requests

1 participant