1package github
2
3import "github.com/shurcooL/githubv4"
4
5type rateLimitQuery struct {
6 RateLimit struct {
7 ResetAt githubv4.DateTime
8 //Limit githubv4.Int
9 //Remaining githubv4.Int
10 }
11}
12
13type userQuery struct {
14 User user `graphql:"user(login: $login)"`
15}
16
17type labelsQuery struct {
18 Repository struct {
19 Labels struct {
20 Nodes []struct {
21 ID string `graphql:"id"`
22 Name string `graphql:"name"`
23 Color string `graphql:"color"`
24 Description string `graphql:"description"`
25 }
26 PageInfo pageInfo
27 } `graphql:"labels(first: $first, after: $after)"`
28 } `graphql:"repository(owner: $owner, name: $name)"`
29}
30
31type loginQuery struct {
32 Viewer struct {
33 Login string `graphql:"login"`
34 } `graphql:"viewer"`
35}
36
37type issueQuery struct {
38 Repository struct {
39 Issues issueConnection `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
40 } `graphql:"repository(owner: $owner, name: $name)"`
41}
42
43type issueEditQuery struct {
44 Node struct {
45 Typename githubv4.String `graphql:"__typename"`
46 Issue struct {
47 UserContentEdits userContentEditConnection `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
48 } `graphql:"... on Issue"`
49 } `graphql:"node(id: $gqlNodeId)"`
50}
51
52type timelineQuery struct {
53 Node struct {
54 Typename githubv4.String `graphql:"__typename"`
55 Issue struct {
56 TimelineItems timelineItemsConnection `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
57 } `graphql:"... on Issue"`
58 } `graphql:"node(id: $gqlNodeId)"`
59}
60
61type commentEditQuery struct {
62 Node struct {
63 Typename githubv4.String `graphql:"__typename"`
64 IssueComment struct {
65 UserContentEdits userContentEditConnection `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
66 } `graphql:"... on IssueComment"`
67 } `graphql:"node(id: $gqlNodeId)"`
68}
69
70type user struct {
71 Login githubv4.String
72 AvatarUrl githubv4.String
73 Name *githubv4.String
74}
75
76type issueConnection struct {
77 Nodes []issueNode
78 PageInfo pageInfo
79}
80
81type issueNode struct {
82 issue
83 UserContentEdits userContentEditConnection `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
84 TimelineItems timelineItemsConnection `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
85}
86
87type issue struct {
88 authorEvent
89 Title githubv4.String
90 Number githubv4.Int
91 Body githubv4.String
92 Url githubv4.URI
93}
94
95type timelineItemsConnection struct {
96 Nodes []timelineItem
97 PageInfo pageInfo
98}
99
100type userContentEditConnection struct {
101 Nodes []userContentEdit
102 PageInfo pageInfo
103}
104
105type userContentEdit struct {
106 Id githubv4.ID
107 CreatedAt githubv4.DateTime
108 UpdatedAt githubv4.DateTime
109 EditedAt githubv4.DateTime
110 Editor *actor
111 DeletedAt *githubv4.DateTime
112 DeletedBy *actor
113 Diff *githubv4.String
114}
115
116type label struct {
117 Name githubv4.String
118}
119
120type labeledEvent struct {
121 actorEvent
122 Label label
123}
124
125type unlabeledEvent struct {
126 actorEvent
127 Label label
128}
129
130type renamedTitleEvent struct {
131 actorEvent
132 CurrentTitle githubv4.String
133 PreviousTitle githubv4.String
134}
135
136type timelineItem struct {
137 Typename githubv4.String `graphql:"__typename"`
138
139 // issue
140 IssueComment issueComment `graphql:"... on IssueComment"`
141
142 // Label
143 LabeledEvent labeledEvent `graphql:"... on LabeledEvent"`
144 UnlabeledEvent unlabeledEvent `graphql:"... on UnlabeledEvent"`
145
146 // Status
147 ClosedEvent struct {
148 actorEvent
149 // Url githubv4.URI
150 } `graphql:"... on ClosedEvent"`
151 ReopenedEvent struct {
152 actorEvent
153 } `graphql:"... on ReopenedEvent"`
154
155 // Title
156 RenamedTitleEvent renamedTitleEvent `graphql:"... on RenamedTitleEvent"`
157}
158
159type issueComment struct {
160 authorEvent // NOTE: contains Id
161 Body githubv4.String
162 Url githubv4.URI
163
164 UserContentEdits userContentEditConnection `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
165}
166
167type userActor struct {
168 Name *githubv4.String
169 Email githubv4.String
170}
171
172type actor struct {
173 Typename githubv4.String `graphql:"__typename"`
174 Login githubv4.String
175 AvatarUrl githubv4.String
176 // User struct {
177 // Name *githubv4.String
178 // Email githubv4.String
179 // } `graphql:"... on User"`
180 User userActor `graphql:"... on User"`
181 Organization struct {
182 Name *githubv4.String
183 Email *githubv4.String
184 } `graphql:"... on Organization"`
185}
186
187type actorEvent struct {
188 Id githubv4.ID
189 CreatedAt githubv4.DateTime
190 Actor *actor
191}
192
193type authorEvent struct {
194 Id githubv4.ID
195 CreatedAt githubv4.DateTime
196 Author *actor
197}
198
199type pageInfo struct {
200 EndCursor githubv4.String
201 HasNextPage bool
202 StartCursor githubv4.String
203 HasPreviousPage bool
204}