forked from Khan/genqlient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerated.go
More file actions
139 lines (114 loc) · 3.69 KB
/
Copy pathgenerated.go
File metadata and controls
139 lines (114 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
package main
import (
"context"
"time"
"github.com/Khan/genqlient/graphql"
)
// getUserResponse is returned by getUser on success.
type GetUserResponse struct {
// Lookup a user by login.
User getUserUser `json:"user"`
}
// GetUser returns GetUserResponse.User, and is useful for accessing the field via an interface.
func (v *GetUserResponse) GetUser() getUserUser { return v.User }
// getViewerResponse is returned by getViewer on success.
type GetViewerResponse struct {
// The currently authenticated user.
Viewer getViewerViewerUser `json:"viewer"`
}
// GetViewer returns GetViewerResponse.Viewer, and is useful for accessing the field via an interface.
func (v *GetViewerResponse) GetViewer() getViewerViewerUser { return v.Viewer }
// __getUserInput is used internally by genqlient
type __getUserInput struct {
Login string `json:"Login"`
}
// GetLogin returns __getUserInput.Login, and is useful for accessing the field via an interface.
func (v *__getUserInput) GetLogin() string { return v.Login }
// getUserUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A user is an individual's account on GitHub that owns repositories and can make new content.
type getUserUser struct {
// The user's public profile name.
TheirName string `json:"theirName"`
// Identifies the date and time when the object was created.
CreatedAt time.Time `json:"createdAt"`
}
// GetTheirName returns getUserUser.TheirName, and is useful for accessing the field via an interface.
func (v *getUserUser) GetTheirName() string { return v.TheirName }
// GetCreatedAt returns getUserUser.CreatedAt, and is useful for accessing the field via an interface.
func (v *getUserUser) GetCreatedAt() time.Time { return v.CreatedAt }
// getViewerViewerUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A user is an individual's account on GitHub that owns repositories and can make new content.
type getViewerViewerUser struct {
// The user's public profile name.
MyName string `json:"MyName"`
// Identifies the date and time when the object was created.
CreatedAt time.Time `json:"createdAt"`
}
// GetMyName returns getViewerViewerUser.MyName, and is useful for accessing the field via an interface.
func (v *getViewerViewerUser) GetMyName() string { return v.MyName }
// GetCreatedAt returns getViewerViewerUser.CreatedAt, and is useful for accessing the field via an interface.
func (v *getViewerViewerUser) GetCreatedAt() time.Time { return v.CreatedAt }
// The query or mutation executed by getUser.
const getUser_Operation = `
query getUser ($Login: String!) {
user(login: $Login) {
theirName: name
createdAt
}
}
`
// getUser gets the given user's name from their username.
func GetUserQuery(
ctx_ context.Context,
client_ graphql.Client,
Login string,
) (*GetUserResponse, error) {
req_ := &graphql.Request{
OpName: "getUser",
Query: getUser_Operation,
Variables: &__getUserInput{
Login: Login,
},
}
var err_ error
var data_ GetUserResponse
resp_ := &graphql.Response{Data: &data_}
err_ = client_.MakeRequest(
ctx_,
req_,
resp_,
)
return &data_, err_
}
// The query or mutation executed by getViewer.
const getViewer_Operation = `
query getViewer {
viewer {
MyName: name
createdAt
}
}
`
func GetViewerQuery(
ctx_ context.Context,
client_ graphql.Client,
) (*GetViewerResponse, error) {
req_ := &graphql.Request{
OpName: "getViewer",
Query: getViewer_Operation,
}
var err_ error
var data_ GetViewerResponse
resp_ := &graphql.Response{Data: &data_}
err_ = client_.MakeRequest(
ctx_,
req_,
resp_,
)
return &data_, err_
}