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	Body  githubv4.String
103	Url   githubv4.URI
104
105	TimelineItems struct {
106		Edges []struct {
107			Cursor githubv4.String
108			Node   timelineItem
109		}
110		PageInfo pageInfo
111	} `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
112
113	UserContentEdits struct {
114		Nodes    []userContentEdit
115		PageInfo pageInfo
116	} `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
117}
118
119type issueEdit struct {
120	UserContentEdits struct {
121		Nodes    []userContentEdit
122		PageInfo pageInfo
123	} `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
124}
125
126type issueTimelineQuery struct {
127	Repository struct {
128		Issues struct {
129			Nodes    []issueTimeline
130			PageInfo pageInfo
131		} `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
132	} `graphql:"repository(owner: $owner, name: $name)"`
133}
134
135type issueEditQuery struct {
136	Repository struct {
137		Issues struct {
138			Nodes    []issueEdit
139			PageInfo pageInfo
140		} `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
141	} `graphql:"repository(owner: $owner, name: $name)"`
142}
143
144type commentEditQuery struct {
145	Repository struct {
146		Issues struct {
147			Nodes []struct {
148				Timeline struct {
149					Nodes []struct {
150						IssueComment struct {
151							UserContentEdits struct {
152								Nodes    []userContentEdit
153								PageInfo pageInfo
154							} `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
155						} `graphql:"... on IssueComment"`
156					}
157				} `graphql:"timeline(first: $timelineFirst, after: $timelineAfter)"`
158			}
159		} `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC}, filterBy: {since: $issueSince})"`
160	} `graphql:"repository(owner: $owner, name: $name)"`
161}
162
163type ghostQuery struct {
164	User struct {
165		Login     githubv4.String
166		AvatarUrl githubv4.String
167		Name      *githubv4.String
168	} `graphql:"user(login: $login)"`
169}
170
171type labelsQuery struct {
172	Repository struct {
173		Labels struct {
174			Nodes []struct {
175				ID          string `graphql:"id"`
176				Name        string `graphql:"name"`
177				Color       string `graphql:"color"`
178				Description string `graphql:"description"`
179			}
180			PageInfo pageInfo
181		} `graphql:"labels(first: $first, after: $after)"`
182	} `graphql:"repository(owner: $owner, name: $name)"`
183}
184
185type loginQuery struct {
186	Viewer struct {
187		Login string `graphql:"login"`
188	} `graphql:"viewer"`
189}