github.com/opiuman/genqlient@v1.0.0/generate/testdata/snapshots/TestGenerate-Pokemon.graphql-Pokemon.graphql.go (about)

     1  // Code generated by github.com/opiuman/genqlient, DO NOT EDIT.
     2  
     3  package test
     4  
     5  import (
     6  	"github.com/opiuman/genqlient/graphql"
     7  	"github.com/opiuman/genqlient/internal/testutil"
     8  )
     9  
    10  // GetPokemonSiblingsResponse is returned by GetPokemonSiblings on success.
    11  type GetPokemonSiblingsResponse 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 GetPokemonSiblingsUser `json:"user"`
    17  }
    18  
    19  // GetUser returns GetPokemonSiblingsResponse.User, and is useful for accessing the field via an interface.
    20  func (v *GetPokemonSiblingsResponse) GetUser() GetPokemonSiblingsUser { return v.User }
    21  
    22  // GetPokemonSiblingsUser 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 GetPokemonSiblingsUser struct {
    27  	// id is the user's ID.
    28  	//
    29  	// It is stable, unique, and opaque, like all good IDs.
    30  	Id               string                                   `json:"id"`
    31  	Roles            []string                                 `json:"roles"`
    32  	Name             string                                   `json:"name"`
    33  	Pokemon          []testutil.Pokemon                       `json:"pokemon"`
    34  	GenqlientPokemon []GetPokemonSiblingsUserGenqlientPokemon `json:"genqlientPokemon"`
    35  }
    36  
    37  // GetId returns GetPokemonSiblingsUser.Id, and is useful for accessing the field via an interface.
    38  func (v *GetPokemonSiblingsUser) GetId() string { return v.Id }
    39  
    40  // GetRoles returns GetPokemonSiblingsUser.Roles, and is useful for accessing the field via an interface.
    41  func (v *GetPokemonSiblingsUser) GetRoles() []string { return v.Roles }
    42  
    43  // GetName returns GetPokemonSiblingsUser.Name, and is useful for accessing the field via an interface.
    44  func (v *GetPokemonSiblingsUser) GetName() string { return v.Name }
    45  
    46  // GetPokemon returns GetPokemonSiblingsUser.Pokemon, and is useful for accessing the field via an interface.
    47  func (v *GetPokemonSiblingsUser) GetPokemon() []testutil.Pokemon { return v.Pokemon }
    48  
    49  // GetGenqlientPokemon returns GetPokemonSiblingsUser.GenqlientPokemon, and is useful for accessing the field via an interface.
    50  func (v *GetPokemonSiblingsUser) GetGenqlientPokemon() []GetPokemonSiblingsUserGenqlientPokemon {
    51  	return v.GenqlientPokemon
    52  }
    53  
    54  // GetPokemonSiblingsUserGenqlientPokemon includes the requested fields of the GraphQL type Pokemon.
    55  type GetPokemonSiblingsUserGenqlientPokemon struct {
    56  	Species string `json:"species"`
    57  	Level   int    `json:"level"`
    58  }
    59  
    60  // GetSpecies returns GetPokemonSiblingsUserGenqlientPokemon.Species, and is useful for accessing the field via an interface.
    61  func (v *GetPokemonSiblingsUserGenqlientPokemon) GetSpecies() string { return v.Species }
    62  
    63  // GetLevel returns GetPokemonSiblingsUserGenqlientPokemon.Level, and is useful for accessing the field via an interface.
    64  func (v *GetPokemonSiblingsUserGenqlientPokemon) GetLevel() int { return v.Level }
    65  
    66  // __GetPokemonSiblingsInput is used internally by genqlient
    67  type __GetPokemonSiblingsInput struct {
    68  	Input testutil.Pokemon `json:"input"`
    69  }
    70  
    71  // GetInput returns __GetPokemonSiblingsInput.Input, and is useful for accessing the field via an interface.
    72  func (v *__GetPokemonSiblingsInput) GetInput() testutil.Pokemon { return v.Input }
    73  
    74  func GetPokemonSiblings(
    75  	client graphql.Client,
    76  	input testutil.Pokemon,
    77  ) (*GetPokemonSiblingsResponse, error) {
    78  	req := &graphql.Request{
    79  		OpName: "GetPokemonSiblings",
    80  		Query: `
    81  query GetPokemonSiblings ($input: PokemonInput!) {
    82  	user(query: {hasPokemon:$input}) {
    83  		id
    84  		roles
    85  		name
    86  		pokemon {
    87  			species
    88  			level
    89  		}
    90  		genqlientPokemon: pokemon {
    91  			species
    92  			level
    93  		}
    94  	}
    95  }
    96  `,
    97  		Variables: &__GetPokemonSiblingsInput{
    98  			Input: input,
    99  		},
   100  	}
   101  	var err error
   102  
   103  	var data GetPokemonSiblingsResponse
   104  	resp := &graphql.Response{Data: &data}
   105  
   106  	err = client.MakeRequest(
   107  		nil,
   108  		req,
   109  		resp,
   110  	)
   111  
   112  	return &data, err
   113  }
   114