github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerate-SimpleInput.graphql-SimpleInput.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 // SimpleInputQueryResponse is returned by SimpleInputQuery on success. 11 type SimpleInputQueryResponse struct { 12 // user looks up a user by some stuff. 13 // 14 // See UserQueryInput for what stuff is supported. 15 // If query is null, returns the current user. 16 User SimpleInputQueryUser `json:"user"` 17 } 18 19 // GetUser returns SimpleInputQueryResponse.User, and is useful for accessing the field via an interface. 20 func (v *SimpleInputQueryResponse) GetUser() SimpleInputQueryUser { return v.User } 21 22 // SimpleInputQueryUser includes the requested fields of the GraphQL type User. 23 // The GraphQL type's documentation follows. 24 // 25 // A User is a user! 26 type SimpleInputQueryUser struct { 27 // id is the user's ID. 28 // 29 // It is stable, unique, and opaque, like all good IDs. 30 Id testutil.ID `json:"id"` 31 } 32 33 // GetId returns SimpleInputQueryUser.Id, and is useful for accessing the field via an interface. 34 func (v *SimpleInputQueryUser) GetId() testutil.ID { return v.Id } 35 36 // __SimpleInputQueryInput is used internally by genqlient 37 type __SimpleInputQueryInput struct { 38 Name string `json:"name"` 39 } 40 41 // GetName returns __SimpleInputQueryInput.Name, and is useful for accessing the field via an interface. 42 func (v *__SimpleInputQueryInput) GetName() string { return v.Name } 43 44 // The query or mutation executed by SimpleInputQuery. 45 const SimpleInputQuery_Operation = ` 46 query SimpleInputQuery ($name: String!) { 47 user(query: {name:$name}) { 48 id 49 } 50 } 51 ` 52 53 func SimpleInputQuery( 54 client_ graphql.Client, 55 name string, 56 ) (*SimpleInputQueryResponse, error) { 57 req_ := &graphql.Request{ 58 OpName: "SimpleInputQuery", 59 Query: SimpleInputQuery_Operation, 60 Variables: &__SimpleInputQueryInput{ 61 Name: name, 62 }, 63 } 64 var err_ error 65 66 var data_ SimpleInputQueryResponse 67 resp_ := &graphql.Response{Data: &data_} 68 69 err_ = client_.MakeRequest( 70 nil, 71 req_, 72 resp_, 73 ) 74 75 return &data_, err_ 76 } 77