import_query.go

  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 timelineItem struct {
117	Typename githubv4.String `graphql:"__typename"`
118
119	// issue
120	IssueComment issueComment `graphql:"... on IssueComment"`
121
122	// Label
123	LabeledEvent struct {
124		actorEvent
125		Label struct {
126			// Color githubv4.String
127			Name githubv4.String
128		}
129	} `graphql:"... on LabeledEvent"`
130	UnlabeledEvent struct {
131		actorEvent
132		Label struct {
133			// Color githubv4.String
134			Name githubv4.String
135		}
136	} `graphql:"... on UnlabeledEvent"`
137
138	// Status
139	ClosedEvent struct {
140		actorEvent
141		// Url githubv4.URI
142	} `graphql:"... on  ClosedEvent"`
143	ReopenedEvent struct {
144		actorEvent
145	} `graphql:"... on  ReopenedEvent"`
146
147	// Title
148	RenamedTitleEvent struct {
149		actorEvent
150		CurrentTitle  githubv4.String
151		PreviousTitle githubv4.String
152	} `graphql:"... on RenamedTitleEvent"`
153}
154
155type issueComment struct {
156	authorEvent // NOTE: contains Id
157	Body        githubv4.String
158	Url         githubv4.URI
159
160	UserContentEdits userContentEditConnection `graphql:"userContentEdits(last: $commentEditLast, before: $commentEditBefore)"`
161}
162
163type actor struct {
164	Typename  githubv4.String `graphql:"__typename"`
165	Login     githubv4.String
166	AvatarUrl githubv4.String
167	User      struct {
168		Name  *githubv4.String
169		Email githubv4.String
170	} `graphql:"... on User"`
171	Organization struct {
172		Name  *githubv4.String
173		Email *githubv4.String
174	} `graphql:"... on Organization"`
175}
176
177type actorEvent struct {
178	Id        githubv4.ID
179	CreatedAt githubv4.DateTime
180	Actor     *actor
181}
182
183type authorEvent struct {
184	Id        githubv4.ID
185	CreatedAt githubv4.DateTime
186	Author    *actor
187}
188
189type pageInfo struct {
190	EndCursor       githubv4.String
191	HasNextPage     bool
192	StartCursor     githubv4.String
193	HasPreviousPage bool
194}