github.com/nathanstitt/genqlient@v0.3.1-0.20211028004951-a2bda3c41ab8/generate/testdata/snapshots/TestGenerate-QueryWithStructs.graphql-QueryWithStructs.graphql.go (about)

     1  package test
     2  
     3  // Code generated by github.com/Khan/genqlient, DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/Khan/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  	var err error
    50  
    51  	var retval QueryWithStructsResponse
    52  	err = client.MakeRequest(
    53  		nil,
    54  		"QueryWithStructs",
    55  		`
    56  query QueryWithStructs {
    57  	user {
    58  		authMethods {
    59  			provider
    60  			email
    61  		}
    62  	}
    63  }
    64  `,
    65  		&retval,
    66  		nil,
    67  	)
    68  	return &retval, err
    69  }
    70