aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/import_query.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-10-01 23:34:45 +0200
committerMichael Muré <batolettre@gmail.com>2018-10-01 23:34:45 +0200
commit8ec1dd092656aed5dae22a0301bd3f85b5dabb88 (patch)
tree26ee832a2d629d48e9ac9f43fc808f17a4a77154 /bridge/github/import_query.go
parentf18c2d278352f556b90ad9a52c33499665e16fa2 (diff)
downloadgit-bug-8ec1dd092656aed5dae22a0301bd3f85b5dabb88.tar.gz
github: working incremental + comment history for the first comment
Diffstat (limited to 'bridge/github/import_query.go')
-rw-r--r--bridge/github/import_query.go128
1 files changed, 128 insertions, 0 deletions
diff --git a/bridge/github/import_query.go b/bridge/github/import_query.go
new file mode 100644
index 00000000..0eb8ad34
--- /dev/null
+++ b/bridge/github/import_query.go
@@ -0,0 +1,128 @@
+package github
+
+import "github.com/shurcooL/githubv4"
+
+type pageInfo struct {
+ EndCursor githubv4.String
+ HasNextPage bool
+}
+
+type actor struct {
+ Login githubv4.String
+ AvatarUrl githubv4.String
+}
+
+type actorEvent struct {
+ Id githubv4.ID
+ CreatedAt githubv4.DateTime
+ Actor actor
+}
+
+type authorEvent struct {
+ Id githubv4.ID
+ CreatedAt githubv4.DateTime
+ Author actor
+}
+
+type userContentEdit struct {
+ Id githubv4.ID
+ CreatedAt githubv4.DateTime
+ UpdatedAt githubv4.DateTime
+ EditedAt githubv4.DateTime
+ Editor *actor
+ DeletedAt *githubv4.DateTime
+ DeletedBy *actor
+ Diff *githubv4.String
+}
+
+type issueComment struct {
+ authorEvent
+ Body githubv4.String
+ Url githubv4.URI
+
+ UserContentEdits struct {
+ Nodes []userContentEdit
+ PageInfo pageInfo
+ } `graphql:"userContentEdits(first: $commentEditFirst, after: $commentEditAfter)"`
+}
+
+type timelineItem struct {
+ Typename githubv4.String `graphql:"__typename"`
+
+ // issue
+ IssueComment issueComment `graphql:"... on IssueComment"`
+
+ // Label
+ LabeledEvent struct {
+ actorEvent
+ Label struct {
+ // Color githubv4.String
+ Name githubv4.String
+ }
+ } `graphql:"... on LabeledEvent"`
+ UnlabeledEvent struct {
+ actorEvent
+ Label struct {
+ // Color githubv4.String
+ Name githubv4.String
+ }
+ } `graphql:"... on UnlabeledEvent"`
+
+ // Status
+ ClosedEvent struct {
+ actorEvent
+ // Url githubv4.URI
+ } `graphql:"... on ClosedEvent"`
+ ReopenedEvent struct {
+ actorEvent
+ } `graphql:"... on ReopenedEvent"`
+
+ // Title
+ RenamedTitleEvent struct {
+ actorEvent
+ CurrentTitle githubv4.String
+ PreviousTitle githubv4.String
+ } `graphql:"... on RenamedTitleEvent"`
+}
+
+type issueTimeline struct {
+ authorEvent
+ Title string
+ Body githubv4.String
+ Url githubv4.URI
+
+ Timeline struct {
+ Nodes []timelineItem
+ PageInfo pageInfo
+ } `graphql:"timeline(first: $timelineFirst, after: $timelineAfter)"`
+
+ UserContentEdits struct {
+ Nodes []userContentEdit
+ PageInfo pageInfo
+ } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
+}
+
+type issueEdit struct {
+ UserContentEdits struct {
+ Nodes []userContentEdit
+ PageInfo pageInfo
+ } `graphql:"userContentEdits(last: $issueEditLast, before: $issueEditBefore)"`
+}
+
+type issueTimelineQuery struct {
+ Repository struct {
+ Issues struct {
+ Nodes []issueTimeline
+ PageInfo pageInfo
+ } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC})"`
+ } `graphql:"repository(owner: $owner, name: $name)"`
+}
+
+type issueEditQuery struct {
+ Repository struct {
+ Issues struct {
+ Nodes []issueEdit
+ PageInfo pageInfo
+ } `graphql:"issues(first: $issueFirst, after: $issueAfter, orderBy: {field: CREATED_AT, direction: ASC})"`
+ } `graphql:"repository(owner: $owner, name: $name)"`
+}