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 // NOTE: contains Id
51 Body githubv4.String
52 Url githubv4.URI
53}
54
55type timelineItem struct {
56 Typename githubv4.String `graphql:"__typename"`
57
58 // issue
59 IssueComment issueComment `graphql:"... on IssueComment"`
60
61 // Label
62 LabeledEvent struct {
63 actorEvent
64 Label struct {
65 // Color githubv4.String
66 Name githubv4.String
67 }
68 } `graphql:"... on LabeledEvent"`
69 UnlabeledEvent struct {
70 actorEvent
71 Label struct {
72 // Color githubv4.String
73 Name githubv4.String
74 }
75 } `graphql:"... on UnlabeledEvent"`
76
77 // Status
78 ClosedEvent struct {
79 actorEvent
80 // Url githubv4.URI
81 } `graphql:"... on ClosedEvent"`
82 ReopenedEvent struct {
83 actorEvent
84 } `graphql:"... on ReopenedEvent"`
85
86 // Title
87 RenamedTitleEvent struct {
88 actorEvent
89 CurrentTitle githubv4.String
90 PreviousTitle githubv4.String
91 } `graphql:"... on RenamedTitleEvent"`
92}
93
94type ghostQuery struct {
95 User struct {
96 Login githubv4.String
97 AvatarUrl githubv4.String
98 Name *githubv4.String
99 } `graphql:"user(login: $login)"`
100}
101
102type labelsQuery struct {
103 Repository struct {
104 Labels struct {
105 Nodes []struct {
106 ID string `graphql:"id"`
107 Name string `graphql:"name"`
108 Color string `graphql:"color"`
109 Description string `graphql:"description"`
110 }
111 PageInfo pageInfo
112 } `graphql:"labels(first: $first, after: $after)"`
113 } `graphql:"repository(owner: $owner, name: $name)"`
114}
115
116type loginQuery struct {
117 Viewer struct {
118 Login string `graphql:"login"`
119 } `graphql:"viewer"`
120}
121
122type issueQuery struct {
123 Repository struct {
124 Issues struct {
125 Nodes []issue
126 PageInfo pageInfo
127 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
128 } `graphql:"repository(owner: $owner, name: $name)"`
129}
130
131type issue struct {
132 authorEvent
133 Title string
134 Number githubv4.Int
135 Body githubv4.String
136 Url githubv4.URI
137}
138
139type issueEditQuery struct {
140 Node struct {
141 Typename githubv4.String `graphql:"__typename"`
142 Issue struct {
143 UserContentEdits struct {
144 Nodes []userContentEdit
145 TotalCount githubv4.Int
146 PageInfo pageInfo
147 } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
148 } `graphql:"... on Issue"`
149 } `graphql:"node(id: $gqlNodeId)"`
150}
151
152type timelineQuery struct {
153 Node struct {
154 Typename githubv4.String `graphql:"__typename"`
155 Issue struct {
156 TimelineItems struct {
157 Nodes []timelineItem
158 PageInfo pageInfo
159 } `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
160 } `graphql:"... on Issue"`
161 } `graphql:"node(id: $gqlNodeId)"`
162}
163
164type commentEditQuery struct {
165 Node struct {
166 Typename githubv4.String `graphql:"__typename"`
167 IssueComment struct {
168 UserContentEdits struct {
169 Nodes []userContentEdit
170 PageInfo pageInfo
171 } `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
172 } `graphql:"... on IssueComment"`
173 } `graphql:"node(id: $gqlNodeId)"`
174}