Skip to content

How can i run multiple mutation  #113

@liangyuanpeng

Description

@liangyuanpeng
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.

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