github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-QueryWithAlias.graphql-QueryWithAlias.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  	"github.com/Desuuuu/genqlient/internal/testutil"
     8  )
     9  
    10  // QueryWithAliasResponse is returned by QueryWithAlias on success.
    11  type QueryWithAliasResponse 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 QueryWithAliasUser `json:"User"`
    17  }
    18  
    19  // GetUser returns QueryWithAliasResponse.User, and is useful for accessing the field via an interface.
    20  func (v *QueryWithAliasResponse) GetUser() QueryWithAliasUser { return v.User }
    21  
    22  // QueryWithAliasUser 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 QueryWithAliasUser 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  	// id is the user's ID.
    32  	//
    33  	// It is stable, unique, and opaque, like all good IDs.
    34  	OtherID testutil.ID `json:"otherID"`
    35  }
    36  
    37  // GetID returns QueryWithAliasUser.ID, and is useful for accessing the field via an interface.
    38  func (v *QueryWithAliasUser) GetID() testutil.ID { return v.ID }
    39  
    40  // GetOtherID returns QueryWithAliasUser.OtherID, and is useful for accessing the field via an interface.
    41  func (v *QueryWithAliasUser) GetOtherID() testutil.ID { return v.OtherID }
    42  
    43  func QueryWithAlias(
    44  	client graphql.Client,
    45  ) (*QueryWithAliasResponse, error) {
    46  	req := &graphql.Request{
    47  		OpName: "QueryWithAlias",
    48  		Query: `
    49  query QueryWithAlias {
    50  	User: user {
    51  		ID: id
    52  		otherID: id
    53  	}
    54  }
    55  `,
    56  	}
    57  	var err error
    58  
    59  	var data QueryWithAliasResponse
    60  	resp := &graphql.Response{Data: &data}
    61  
    62  	err = client.MakeRequest(
    63  		nil,
    64  		req,
    65  		resp,
    66  	)
    67  
    68  	return &data, err
    69  }
    70