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