1package github
2
3import "github.com/shurcooL/githubv4"
4
5type pageInfo struct {
6 EndCursor githubv4.String
7 HasNextPage bool
8 StartCursor githubv4.String
9 HasPreviousPage bool
10}
11
12type actor struct {
13 Typename githubv4.String `graphql:"__typename"`
14 Login githubv4.String
15 AvatarUrl githubv4.String
16 User struct {
17 Name *githubv4.String
18 Email githubv4.String
19 } `graphql:"... on User"`
20 Organization struct {
21 Name *githubv4.String
22 Email *githubv4.String
23 } `graphql:"... on Organization"`
24}
25
26type actorEvent struct {
27 Id githubv4.ID
28 CreatedAt githubv4.DateTime
29 Actor *actor
30}
31
32type authorEvent struct {
33 Id githubv4.ID
34 CreatedAt githubv4.DateTime
35 Author *actor
36}
37
38type userContentEdit struct {
39 Id githubv4.ID
40 CreatedAt githubv4.DateTime
41 UpdatedAt githubv4.DateTime
42 EditedAt githubv4.DateTime
43 Editor *actor
44 DeletedAt *githubv4.DateTime
45 DeletedBy *actor
46 Diff *githubv4.String
47}
48
49type issueComment struct {
50 authorEvent
51 Body githubv4.String
52 Url githubv4.URI
53
54 UserContentEdits struct {
55 Nodes []userContentEdit
56 PageInfo pageInfo
57 } `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
58}
59
60type timelineItem struct {
61 Typename githubv4.String `graphql:"__typename"`
62
63 // issue
64 IssueComment issueComment `graphql:"... on IssueComment"`
65
66 // Label
67 LabeledEvent struct {
68 actorEvent
69 Label struct {
70 // Color githubv4.String
71 Name githubv4.String
72 }
73 } `graphql:"... on LabeledEvent"`
74 UnlabeledEvent struct {
75 actorEvent
76 Label struct {
77 // Color githubv4.String
78 Name githubv4.String
79 }
80 } `graphql:"... on UnlabeledEvent"`
81
82 // Status
83 ClosedEvent struct {
84 actorEvent
85 // Url githubv4.URI
86 } `graphql:"... on ClosedEvent"`
87 ReopenedEvent struct {
88 actorEvent
89 } `graphql:"... on ReopenedEvent"`
90
91 // Title
92 RenamedTitleEvent struct {
93 actorEvent
94 CurrentTitle githubv4.String
95 PreviousTitle githubv4.String
96 } `graphql:"... on RenamedTitleEvent"`
97}
98
99type issueTimeline struct {
100 authorEvent
101 Title string
102 Number githubv4.Int
103 Body githubv4.String
104 Url githubv4.URI
105
106 TimelineItems struct {
107 Edges []struct {
108 Cursor githubv4.String
109 Node timelineItem
110 }
111 PageInfo pageInfo
112 } `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
113
114 UserContentEdits struct {
115 Nodes []userContentEdit
116 PageInfo pageInfo
117 } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
118}
119
120// Alex
121type timelineItemsQuery struct {
122 Repository struct {
123 Issue struct {
124 TimelineItems struct {
125 Edges []struct {
126 Cursor githubv4.String
127 Node timelineItem
128 }
129 PageInfo pageInfo
130 } `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
131 } `graphql:"issue(number: $issueNumber)"`
132 } `graphql:"repository(owner: $owner, name: $name)"`
133}
134
135type issueEdit struct {
136 UserContentEdits struct {
137 Nodes []userContentEdit
138 PageInfo pageInfo
139 } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
140}
141
142type issueTimelineQuery struct {
143 Repository struct {
144 Issues struct {
145 Nodes []issueTimeline
146 PageInfo pageInfo
147 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
148 } `graphql:"repository(owner: $owner, name: $name)"`
149}
150
151type issueEditQuery struct {
152 Repository struct {
153 Issues struct {
154 Nodes []issueEdit
155 PageInfo pageInfo
156 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
157 } `graphql:"repository(owner: $owner, name: $name)"`
158}
159
160type commentEditQuery struct {
161 Repository struct {
162 Issues struct {
163 Nodes []struct {
164 Timeline struct {
165 Nodes []struct {
166 IssueComment struct {
167 UserContentEdits struct {
168 Nodes []userContentEdit
169 PageInfo pageInfo
170 } `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
171 } `graphql:"... on IssueComment"`
172 }
173 } `graphql:"timeline(first: $timelineFirst, after: $timelineAfter)"`
174 }
175 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
176 } `graphql:"repository(owner: $owner, name: $name)"`
177}
178
179type ghostQuery struct {
180 User struct {
181 Login githubv4.String
182 AvatarUrl githubv4.String
183 Name *githubv4.String
184 } `graphql:"user(login: $login)"`
185}
186
187type labelsQuery struct {
188 Repository struct {
189 Labels struct {
190 Nodes []struct {
191 ID string `graphql:"id"`
192 Name string `graphql:"name"`
193 Color string `graphql:"color"`
194 Description string `graphql:"description"`
195 }
196 PageInfo pageInfo
197 } `graphql:"labels(first: $first, after: $after)"`
198 } `graphql:"repository(owner: $owner, name: $name)"`
199}
200
201type loginQuery struct {
202 Viewer struct {
203 Login string `graphql:"login"`
204 } `graphql:"viewer"`
205}
206
207type issueQuery struct {
208 Repository struct {
209 Issues struct {
210 Nodes []issue
211 PageInfo pageInfo
212 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC})"` //, filterBy: {since: $issueSince})"`
213 } `graphql:"repository(owner: $owner, name: $name)"`
214}
215
216type issue struct {
217 authorEvent
218 Title string
219 Number githubv4.Int
220 Body githubv4.String
221 Url githubv4.URI
222}
223
224type issueEditQuery_A struct {
225 Node struct {
226 Typename githubv4.String `graphql:"__typename"`
227 Issue struct {
228 UserContentEdits struct {
229 Nodes []userContentEdit
230 TotalCount githubv4.Int
231 PageInfo pageInfo
232 } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
233 } `graphql:"... on Issue"`
234 } `graphql:"node(id: $gqlNodeId)"`
235}
236
237type timelineQuery struct {
238 Node struct {
239 Typename githubv4.String `graphql:"__typename"`
240 Issue struct {
241 TimelineItems struct {
242 Nodes []timelineItem
243 PageInfo pageInfo
244 } `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
245 } `graphql:"... on Issue"`
246 } `graphql:"node(id: $gqlNodeId)"`
247}
248
249type commentEditQuery_A struct {
250 Node struct {
251 Typename githubv4.String `graphql:"__typename"`
252 IssueComment struct {
253 UserContentEdits struct {
254 Nodes []userContentEdit
255 PageInfo pageInfo
256 } `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
257 } `graphql:"... on IssueComment"`
258 } `graphql:"node(id: $gqlNodeId)"`
259}