github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerateWithConfig-OptionalGeneric-testdata-queries-generated.go (about) 1 // Code generated by github.com/codykaup/genqlient, DO NOT EDIT. 2 3 package queries 4 5 import ( 6 "context" 7 8 "github.com/codykaup/genqlient/graphql" 9 "github.com/codykaup/genqlient/internal/testutil" 10 ) 11 12 // ListInputQueryResponse is returned by ListInputQuery on success. 13 type ListInputQueryResponse struct { 14 // user looks up a user by some stuff. 15 // 16 // See UserQueryInput for what stuff is supported. 17 // If query is null, returns the current user. 18 User testutil.Option[ListInputQueryUser] `json:"user"` 19 } 20 21 // GetUser returns ListInputQueryResponse.User, and is useful for accessing the field via an interface. 22 func (v *ListInputQueryResponse) GetUser() testutil.Option[ListInputQueryUser] { return v.User } 23 24 // ListInputQueryUser includes the requested fields of the GraphQL type User. 25 // The GraphQL type's documentation follows. 26 // 27 // A User is a user! 28 type ListInputQueryUser struct { 29 // id is the user's ID. 30 // 31 // It is stable, unique, and opaque, like all good IDs. 32 Id string `json:"id"` 33 } 34 35 // GetId returns ListInputQueryUser.Id, and is useful for accessing the field via an interface. 36 func (v *ListInputQueryUser) GetId() string { return v.Id } 37 38 // QueryWithSlicesResponse is returned by QueryWithSlices on success. 39 type QueryWithSlicesResponse struct { 40 // user looks up a user by some stuff. 41 // 42 // See UserQueryInput for what stuff is supported. 43 // If query is null, returns the current user. 44 User testutil.Option[QueryWithSlicesUser] `json:"user"` 45 } 46 47 // GetUser returns QueryWithSlicesResponse.User, and is useful for accessing the field via an interface. 48 func (v *QueryWithSlicesResponse) GetUser() testutil.Option[QueryWithSlicesUser] { return v.User } 49 50 // QueryWithSlicesUser includes the requested fields of the GraphQL type User. 51 // The GraphQL type's documentation follows. 52 // 53 // A User is a user! 54 type QueryWithSlicesUser struct { 55 Emails []string `json:"emails"` 56 EmailsOrNull []string `json:"emailsOrNull"` 57 EmailsWithNulls []testutil.Option[string] `json:"emailsWithNulls"` 58 EmailsWithNullsOrNull []testutil.Option[string] `json:"emailsWithNullsOrNull"` 59 } 60 61 // GetEmails returns QueryWithSlicesUser.Emails, and is useful for accessing the field via an interface. 62 func (v *QueryWithSlicesUser) GetEmails() []string { return v.Emails } 63 64 // GetEmailsOrNull returns QueryWithSlicesUser.EmailsOrNull, and is useful for accessing the field via an interface. 65 func (v *QueryWithSlicesUser) GetEmailsOrNull() []string { return v.EmailsOrNull } 66 67 // GetEmailsWithNulls returns QueryWithSlicesUser.EmailsWithNulls, and is useful for accessing the field via an interface. 68 func (v *QueryWithSlicesUser) GetEmailsWithNulls() []testutil.Option[string] { 69 return v.EmailsWithNulls 70 } 71 72 // GetEmailsWithNullsOrNull returns QueryWithSlicesUser.EmailsWithNullsOrNull, and is useful for accessing the field via an interface. 73 func (v *QueryWithSlicesUser) GetEmailsWithNullsOrNull() []testutil.Option[string] { 74 return v.EmailsWithNullsOrNull 75 } 76 77 // __ListInputQueryInput is used internally by genqlient 78 type __ListInputQueryInput struct { 79 Names []testutil.Option[string] `json:"names"` 80 } 81 82 // GetNames returns __ListInputQueryInput.Names, and is useful for accessing the field via an interface. 83 func (v *__ListInputQueryInput) GetNames() []testutil.Option[string] { return v.Names } 84 85 // The query or mutation executed by ListInputQuery. 86 const ListInputQuery_Operation = ` 87 query ListInputQuery ($names: [String]) { 88 user(query: {names:$names}) { 89 id 90 } 91 } 92 ` 93 94 func ListInputQuery( 95 ctx_ context.Context, 96 client_ graphql.Client, 97 names []testutil.Option[string], 98 ) (*ListInputQueryResponse, error) { 99 req_ := &graphql.Request{ 100 OpName: "ListInputQuery", 101 Query: ListInputQuery_Operation, 102 Variables: &__ListInputQueryInput{ 103 Names: names, 104 }, 105 } 106 var err_ error 107 108 var data_ ListInputQueryResponse 109 resp_ := &graphql.Response{Data: &data_} 110 111 err_ = client_.MakeRequest( 112 ctx_, 113 req_, 114 resp_, 115 ) 116 117 return &data_, err_ 118 } 119 120 // The query or mutation executed by QueryWithSlices. 121 const QueryWithSlices_Operation = ` 122 query QueryWithSlices { 123 user { 124 emails 125 emailsOrNull 126 emailsWithNulls 127 emailsWithNullsOrNull 128 } 129 } 130 ` 131 132 func QueryWithSlices( 133 ctx_ context.Context, 134 client_ graphql.Client, 135 ) (*QueryWithSlicesResponse, error) { 136 req_ := &graphql.Request{ 137 OpName: "QueryWithSlices", 138 Query: QueryWithSlices_Operation, 139 } 140 var err_ error 141 142 var data_ QueryWithSlicesResponse 143 resp_ := &graphql.Response{Data: &data_} 144 145 err_ = client_.MakeRequest( 146 ctx_, 147 req_, 148 resp_, 149 ) 150 151 return &data_, err_ 152 } 153