github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.graphql.go (about) 1 // Code generated by github.com/codykaup/genqlient, DO NOT EDIT. 2 3 package test 4 5 import ( 6 "github.com/codykaup/genqlient/graphql" 7 "github.com/codykaup/genqlient/internal/testutil" 8 ) 9 10 // SimpleMutationCreateUser includes the requested fields of the GraphQL type User. 11 // The GraphQL type's documentation follows. 12 // 13 // A User is a user! 14 type SimpleMutationCreateUser struct { 15 // id is the user's ID. 16 // 17 // It is stable, unique, and opaque, like all good IDs. 18 Id testutil.ID `json:"id"` 19 Name string `json:"name"` 20 } 21 22 // GetId returns SimpleMutationCreateUser.Id, and is useful for accessing the field via an interface. 23 func (v *SimpleMutationCreateUser) GetId() testutil.ID { return v.Id } 24 25 // GetName returns SimpleMutationCreateUser.Name, and is useful for accessing the field via an interface. 26 func (v *SimpleMutationCreateUser) GetName() string { return v.Name } 27 28 // SimpleMutationResponse is returned by SimpleMutation on success. 29 type SimpleMutationResponse struct { 30 CreateUser SimpleMutationCreateUser `json:"createUser"` 31 } 32 33 // GetCreateUser returns SimpleMutationResponse.CreateUser, and is useful for accessing the field via an interface. 34 func (v *SimpleMutationResponse) GetCreateUser() SimpleMutationCreateUser { return v.CreateUser } 35 36 // __SimpleMutationInput is used internally by genqlient 37 type __SimpleMutationInput struct { 38 Name string `json:"name"` 39 } 40 41 // GetName returns __SimpleMutationInput.Name, and is useful for accessing the field via an interface. 42 func (v *__SimpleMutationInput) GetName() string { return v.Name } 43 44 // The query or mutation executed by SimpleMutation. 45 const SimpleMutation_Operation = ` 46 mutation SimpleMutation ($name: String!) { 47 createUser(name: $name) { 48 id 49 name 50 } 51 } 52 ` 53 54 // SimpleMutation creates a user. 55 // 56 // It has a long doc-comment, to test that we handle that correctly. 57 // What a long comment indeed. 58 func SimpleMutation( 59 client_ graphql.Client, 60 name string, 61 ) (*SimpleMutationResponse, error) { 62 req_ := &graphql.Request{ 63 OpName: "SimpleMutation", 64 Query: SimpleMutation_Operation, 65 Variables: &__SimpleMutationInput{ 66 Name: name, 67 }, 68 } 69 var err_ error 70 71 var data_ SimpleMutationResponse 72 resp_ := &graphql.Response{Data: &data_} 73 74 err_ = client_.MakeRequest( 75 nil, 76 req_, 77 resp_, 78 ) 79 80 return &data_, err_ 81 } 82