github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-QueryWithStructs.graphql-QueryWithStructs.graphql.go (about) 1 // Code generated by github.com/Desuuuu/genqlient, DO NOT EDIT. 2 3 package test 4 5 import ( 6 "github.com/Desuuuu/genqlient/graphql" 7 ) 8 9 // QueryWithStructsResponse is returned by QueryWithStructs on success. 10 type QueryWithStructsResponse struct { 11 // user looks up a user by some stuff. 12 // 13 // See UserQueryInput for what stuff is supported. 14 // If query is null, returns the current user. 15 User QueryWithStructsUser `json:"user"` 16 } 17 18 // GetUser returns QueryWithStructsResponse.User, and is useful for accessing the field via an interface. 19 func (v *QueryWithStructsResponse) GetUser() QueryWithStructsUser { return v.User } 20 21 // QueryWithStructsUser includes the requested fields of the GraphQL type User. 22 // The GraphQL type's documentation follows. 23 // 24 // A User is a user! 25 type QueryWithStructsUser struct { 26 AuthMethods []QueryWithStructsUserAuthMethodsAuthMethod `json:"authMethods"` 27 } 28 29 // GetAuthMethods returns QueryWithStructsUser.AuthMethods, and is useful for accessing the field via an interface. 30 func (v *QueryWithStructsUser) GetAuthMethods() []QueryWithStructsUserAuthMethodsAuthMethod { 31 return v.AuthMethods 32 } 33 34 // QueryWithStructsUserAuthMethodsAuthMethod includes the requested fields of the GraphQL type AuthMethod. 35 type QueryWithStructsUserAuthMethodsAuthMethod struct { 36 Provider string `json:"provider"` 37 Email string `json:"email"` 38 } 39 40 // GetProvider returns QueryWithStructsUserAuthMethodsAuthMethod.Provider, and is useful for accessing the field via an interface. 41 func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetProvider() string { return v.Provider } 42 43 // GetEmail returns QueryWithStructsUserAuthMethodsAuthMethod.Email, and is useful for accessing the field via an interface. 44 func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetEmail() string { return v.Email } 45 46 func QueryWithStructs( 47 client graphql.Client, 48 ) (*QueryWithStructsResponse, error) { 49 req := &graphql.Request{ 50 OpName: "QueryWithStructs", 51 Query: ` 52 query QueryWithStructs { 53 user { 54 authMethods { 55 provider 56 email 57 } 58 } 59 } 60 `, 61 } 62 var err error 63 64 var data QueryWithStructsResponse 65 resp := &graphql.Response{Data: &data} 66 67 err = client.MakeRequest( 68 nil, 69 req, 70 resp, 71 ) 72 73 return &data, err 74 } 75