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 Login githubv4.String
14 AvatarUrl githubv4.String
15}
16
17type actorEvent struct {
18 Id githubv4.ID
19 CreatedAt githubv4.DateTime
20 Actor *actor
21}
22
23type authorEvent struct {
24 Id githubv4.ID
25 CreatedAt githubv4.DateTime
26 Author *actor
27}
28
29type userContentEdit struct {
30 Id githubv4.ID
31 CreatedAt githubv4.DateTime
32 UpdatedAt githubv4.DateTime
33 EditedAt githubv4.DateTime
34 Editor *actor
35 DeletedAt *githubv4.DateTime
36 DeletedBy *actor
37 Diff *githubv4.String
38}
39
40type issueComment struct {
41 authorEvent
42 Body githubv4.String
43 Url githubv4.URI
44
45 UserContentEdits struct {
46 Nodes []userContentEdit
47 PageInfo pageInfo
48 } `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
49}
50
51type timelineItem struct {
52 Typename githubv4.String `graphql:"__typename"`
53
54 // issue
55 IssueComment issueComment `graphql:"... on IssueComment"`
56
57 // Label
58 LabeledEvent struct {
59 actorEvent
60 Label struct {
61 // Color githubv4.String
62 Name githubv4.String
63 }
64 } `graphql:"... on LabeledEvent"`
65 UnlabeledEvent struct {
66 actorEvent
67 Label struct {
68 // Color githubv4.String
69 Name githubv4.String
70 }
71 } `graphql:"... on UnlabeledEvent"`
72
73 // Status
74 ClosedEvent struct {
75 actorEvent
76 // Url githubv4.URI
77 } `graphql:"... on ClosedEvent"`
78 ReopenedEvent struct {
79 actorEvent
80 } `graphql:"... on ReopenedEvent"`
81
82 // Title
83 RenamedTitleEvent struct {
84 actorEvent
85 CurrentTitle githubv4.String
86 PreviousTitle githubv4.String
87 } `graphql:"... on RenamedTitleEvent"`
88}
89
90type issueTimeline struct {
91 authorEvent
92 Title string
93 Body githubv4.String
94 Url githubv4.URI
95
96 Timeline struct {
97 Edges []struct {
98 Cursor githubv4.String
99 Node timelineItem
100 }
101 PageInfo pageInfo
102 } `graphql:"timeline(first: $timelineFirst, after: $timelineAfter)"`
103
104 UserContentEdits struct {
105 Nodes []userContentEdit
106 PageInfo pageInfo
107 } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
108}
109
110type issueEdit struct {
111 UserContentEdits struct {
112 Nodes []userContentEdit
113 PageInfo pageInfo
114 } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
115}
116
117type issueTimelineQuery struct {
118 Repository struct {
119 Issues struct {
120 Nodes []issueTimeline
121 PageInfo pageInfo
122 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC})"`
123 } `graphql:"repository(owner: $owner, name: $name)"`
124}
125
126type issueEditQuery struct {
127 Repository struct {
128 Issues struct {
129 Nodes []issueEdit
130 PageInfo pageInfo
131 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC})"`
132 } `graphql:"repository(owner: $owner, name: $name)"`
133}
134
135type commentEditQuery struct {
136 Repository struct {
137 Issues struct {
138 Nodes []struct {
139 Timeline struct {
140 Nodes []struct {
141 IssueComment struct {
142 UserContentEdits struct {
143 Nodes []userContentEdit
144 PageInfo pageInfo
145 } `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
146 } `graphql:"... on IssueComment"`
147 }
148 } `graphql:"timeline(first: $timelineFirst, after: $timelineAfter)"`
149 }
150 } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC})"`
151 } `graphql:"repository(owner: $owner, name: $name)"`
152}
153
154type userQuery struct {
155 User actor `graphql:"user(login: $login)"`
156}