github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerateWithConfig-EnumRawCasingAll-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  )
    10  
    11  // QueryWithEnumsOtherUser includes the requested fields of the GraphQL type User.
    12  // The GraphQL type's documentation follows.
    13  //
    14  // A User is a user!
    15  type QueryWithEnumsOtherUser struct {
    16  	Roles []Role `json:"roles"`
    17  }
    18  
    19  // GetRoles returns QueryWithEnumsOtherUser.Roles, and is useful for accessing the field via an interface.
    20  func (v *QueryWithEnumsOtherUser) GetRoles() []Role { return v.Roles }
    21  
    22  // QueryWithEnumsResponse is returned by QueryWithEnums on success.
    23  type QueryWithEnumsResponse struct {
    24  	// user looks up a user by some stuff.
    25  	//
    26  	// See UserQueryInput for what stuff is supported.
    27  	// If query is null, returns the current user.
    28  	User QueryWithEnumsUser `json:"user"`
    29  	// user looks up a user by some stuff.
    30  	//
    31  	// See UserQueryInput for what stuff is supported.
    32  	// If query is null, returns the current user.
    33  	OtherUser QueryWithEnumsOtherUser `json:"otherUser"`
    34  }
    35  
    36  // GetUser returns QueryWithEnumsResponse.User, and is useful for accessing the field via an interface.
    37  func (v *QueryWithEnumsResponse) GetUser() QueryWithEnumsUser { return v.User }
    38  
    39  // GetOtherUser returns QueryWithEnumsResponse.OtherUser, and is useful for accessing the field via an interface.
    40  func (v *QueryWithEnumsResponse) GetOtherUser() QueryWithEnumsOtherUser { return v.OtherUser }
    41  
    42  // QueryWithEnumsUser includes the requested fields of the GraphQL type User.
    43  // The GraphQL type's documentation follows.
    44  //
    45  // A User is a user!
    46  type QueryWithEnumsUser struct {
    47  	Roles []Role `json:"roles"`
    48  }
    49  
    50  // GetRoles returns QueryWithEnumsUser.Roles, and is useful for accessing the field via an interface.
    51  func (v *QueryWithEnumsUser) GetRoles() []Role { return v.Roles }
    52  
    53  // Role is a type a user may have.
    54  type Role string
    55  
    56  const (
    57  	// What is a student?
    58  	//
    59  	// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
    60  	//
    61  	// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
    62  	Role_STUDENT Role = "STUDENT"
    63  	// Teacher is a teacher, who teaches the students.
    64  	Role_TEACHER Role = "TEACHER"
    65  )
    66  
    67  // The query or mutation executed by QueryWithEnums.
    68  const QueryWithEnums_Operation = `
    69  query QueryWithEnums {
    70  	user {
    71  		roles
    72  	}
    73  	otherUser: user {
    74  		roles
    75  	}
    76  }
    77  `
    78  
    79  func QueryWithEnums(
    80  	ctx_ context.Context,
    81  	client_ graphql.Client,
    82  ) (*QueryWithEnumsResponse, error) {
    83  	req_ := &graphql.Request{
    84  		OpName: "QueryWithEnums",
    85  		Query:  QueryWithEnums_Operation,
    86  	}
    87  	var err_ error
    88  
    89  	var data_ QueryWithEnumsResponse
    90  	resp_ := &graphql.Response{Data: &data_}
    91  
    92  	err_ = client_.MakeRequest(
    93  		ctx_,
    94  		req_,
    95  		resp_,
    96  	)
    97  
    98  	return &data_, err_
    99  }
   100