github.com/opiuman/genqlient@v1.0.0/generate/testdata/snapshots/TestGenerate-QueryWithEnums.graphql-QueryWithEnums.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 ) 8 9 // QueryWithEnumsOtherUser includes the requested fields of the GraphQL type User. 10 // The GraphQL type's documentation follows. 11 // 12 // A User is a user! 13 type QueryWithEnumsOtherUser struct { 14 Roles []Role `json:"roles"` 15 } 16 17 // GetRoles returns QueryWithEnumsOtherUser.Roles, and is useful for accessing the field via an interface. 18 func (v *QueryWithEnumsOtherUser) GetRoles() []Role { return v.Roles } 19 20 // QueryWithEnumsResponse is returned by QueryWithEnums on success. 21 type QueryWithEnumsResponse struct { 22 // user looks up a user by some stuff. 23 // 24 // See UserQueryInput for what stuff is supported. 25 // If query is null, returns the current user. 26 User QueryWithEnumsUser `json:"user"` 27 // user looks up a user by some stuff. 28 // 29 // See UserQueryInput for what stuff is supported. 30 // If query is null, returns the current user. 31 OtherUser QueryWithEnumsOtherUser `json:"otherUser"` 32 } 33 34 // GetUser returns QueryWithEnumsResponse.User, and is useful for accessing the field via an interface. 35 func (v *QueryWithEnumsResponse) GetUser() QueryWithEnumsUser { return v.User } 36 37 // GetOtherUser returns QueryWithEnumsResponse.OtherUser, and is useful for accessing the field via an interface. 38 func (v *QueryWithEnumsResponse) GetOtherUser() QueryWithEnumsOtherUser { return v.OtherUser } 39 40 // QueryWithEnumsUser includes the requested fields of the GraphQL type User. 41 // The GraphQL type's documentation follows. 42 // 43 // A User is a user! 44 type QueryWithEnumsUser struct { 45 Roles []Role `json:"roles"` 46 } 47 48 // GetRoles returns QueryWithEnumsUser.Roles, and is useful for accessing the field via an interface. 49 func (v *QueryWithEnumsUser) GetRoles() []Role { return v.Roles } 50 51 // Role is a type a user may have. 52 type Role string 53 54 const ( 55 // What is a student? 56 // 57 // 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. 58 // 59 // (from [Wikipedia](https://en.wikipedia.org/wiki/Student)) 60 RoleStudent Role = "STUDENT" 61 // Teacher is a teacher, who teaches the students. 62 RoleTeacher Role = "TEACHER" 63 ) 64 65 func QueryWithEnums( 66 client graphql.Client, 67 ) (*QueryWithEnumsResponse, error) { 68 req := &graphql.Request{ 69 OpName: "QueryWithEnums", 70 Query: ` 71 query QueryWithEnums { 72 user { 73 roles 74 } 75 otherUser: user { 76 roles 77 } 78 } 79 `, 80 } 81 var err error 82 83 var data QueryWithEnumsResponse 84 resp := &graphql.Response{Data: &data} 85 86 err = client.MakeRequest( 87 nil, 88 req, 89 resp, 90 ) 91 92 return &data, err 93 } 94