github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-InputEnum.graphql-InputEnum.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 // InputEnumQueryResponse is returned by InputEnumQuery on success. 11 type InputEnumQueryResponse struct { 12 // usersWithRole looks a user up by role. 13 UsersWithRole []InputEnumQueryUsersWithRoleUser `json:"usersWithRole"` 14 } 15 16 // GetUsersWithRole returns InputEnumQueryResponse.UsersWithRole, and is useful for accessing the field via an interface. 17 func (v *InputEnumQueryResponse) GetUsersWithRole() []InputEnumQueryUsersWithRoleUser { 18 return v.UsersWithRole 19 } 20 21 // InputEnumQueryUsersWithRoleUser includes the requested fields of the GraphQL type User. 22 // The GraphQL type's documentation follows. 23 // 24 // A User is a user! 25 type InputEnumQueryUsersWithRoleUser struct { 26 // id is the user's ID. 27 // 28 // It is stable, unique, and opaque, like all good IDs. 29 Id testutil.ID `json:"id"` 30 } 31 32 // GetId returns InputEnumQueryUsersWithRoleUser.Id, and is useful for accessing the field via an interface. 33 func (v *InputEnumQueryUsersWithRoleUser) GetId() testutil.ID { return v.Id } 34 35 // Role is a type a user may have. 36 type Role string 37 38 const ( 39 // What is a student? 40 // 41 // 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. 42 // 43 // (from [Wikipedia](https://en.wikipedia.org/wiki/Student)) 44 RoleStudent Role = "STUDENT" 45 // Teacher is a teacher, who teaches the students. 46 RoleTeacher Role = "TEACHER" 47 ) 48 49 // __InputEnumQueryInput is used internally by genqlient 50 type __InputEnumQueryInput struct { 51 Role Role `json:"role"` 52 } 53 54 // GetRole returns __InputEnumQueryInput.Role, and is useful for accessing the field via an interface. 55 func (v *__InputEnumQueryInput) GetRole() Role { return v.Role } 56 57 func InputEnumQuery( 58 client graphql.Client, 59 role Role, 60 ) (*InputEnumQueryResponse, error) { 61 req := &graphql.Request{ 62 OpName: "InputEnumQuery", 63 Query: ` 64 query InputEnumQuery ($role: Role!) { 65 usersWithRole(role: $role) { 66 id 67 } 68 } 69 `, 70 Variables: &__InputEnumQueryInput{ 71 Role: role, 72 }, 73 } 74 var err error 75 76 var data InputEnumQueryResponse 77 resp := &graphql.Response{Data: &data} 78 79 err = client.MakeRequest( 80 nil, 81 req, 82 resp, 83 ) 84 85 return &data, err 86 } 87