forked from rogaha/gohook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packet.go
753 lines (694 loc) · 28 KB
/
packet.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
package gohook
import (
"time"
)
// SenderType represents the structure of the sender field in push/ping events.
type SenderType struct {
Login string `json:"login"`
ID int `json:"id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
}
// UserType represents the structure of a user as used in commits.
type UserType struct {
Name string `json:"name"`
Email string `json:"email"`
Username string `json:"username"`
}
// PusherType represents the structure of a user as used in PushEvents.
type PusherType struct {
Name string `json:"name"`
Email string `json:"email"`
}
// OrgType represents the structure of an organization as used in ping/push events.
type OrgType struct {
Login string `json:"login"`
ID int `json:"id"`
URL string `json:"url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
MembersURL string `json:"members_url"`
PublicMembersURL string `json:"public_members_url"`
AvatarURL string `json:"avatar_url"`
Description string `json:"description"`
}
// CommitType represents the structure of a commit as used in push events.
type CommitType struct {
ID string `json:"id"`
Distinct bool `json:"distinct"`
Message string `json:"message"`
Timestamp string `json:"timestamp"`
URL string `json:"url"`
Author UserType `json:"author"`
Committer UserType `json:"committer"`
Added []string `json:"added"`
Removed []string `json:"removed"`
Modified []string `json:"modified"`
}
// RepoType represents the structure of a repository as used in push events.
type RepoType struct {
ID int `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Owner SenderType `json:"owner"`
Private bool `json:"private"`
HTMLURL string `json:"html_url"`
Description string `json:"description"`
Fork bool `json:"fork"`
URL string `json:"url"`
ForksURL string `json:"forks_url"`
KeysURL string `json:"keys_url"`
CollaboratorsURL string `json:"collaborators_url"`
TeamsURL string `json:"teams_url"`
HooksURL string `json:"hooks_url"`
IssueEventsURL string `json:"issue_events_url"`
EventsURL string `json:"events_url"`
AssigneesURL string `json:"assignees_url"`
BranchesURL string `json:"branches_url"`
TagsURL string `json:"tags_url"`
BlobsURL string `json:"blobs_url"`
GitTagsURL string `json:"git_tags_url"`
GitRefsURL string `json:"git_refs_url"`
TreesURL string `json:"trees_url"`
StatusesURL string `json:"statuses_url"`
LanguagesURL string `json:"languages_url"`
StargazersURL string `json:"stargazers_url"`
ContributorsURL string `json:"contributors_url"`
SubscribersURL string `json:"subscribers_url"`
SubscriptionURL string `json:"subscription_url"`
CommitsURL string `json:"commits_url"`
GitCommitsURL string `json:"git_commits_url"`
CommentsURL string `json:"comments_url"`
IssueCommentURL string `json:"issue_comment_url"`
ContentsURL string `json:"contents_url"`
CompareURL string `json:"compare_url"`
MergesURL string `json:"mergers_url"`
ArchiveURL string `json:"archive_url"`
DownloadsURL string `json:"downloads_url"`
IssuesURL string `json:"issues_url"`
PullsURL string `json:"pulls_url"`
MilestonesURL string `json:"milestones_url"`
NotificationsURL string `json:"notifications_url"`
LabelsURL string `json:"labels_url"`
ReleasesURL string `json:"releases_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PushedAt time.Time `json:"pushed_at"`
GitURL string `json:"git_url"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
SvnURL string `json:"svn_url"`
Homepage string `json:"homepage"`
Size int `json:"size"`
StargazersCount int `json:"stargazers_count"`
WatchersCount int `json:"watchers_count"`
Language string `json:"language"`
HasIssues bool `json:"has_issues"`
HasDownloads bool `json:"has_downloads"`
HasWiki bool `json:"has_wiki"`
HasPages bool `json:"has_pages"`
ForksCount int `json:"forks_count"`
MirrorURL string `json:"mirror_url"`
OpenIssuesCount int `json:"open_issues_count"`
Forks int `json:"forks"`
OpenIssues int `json:"open_issues"`
Watchers int `json:"watchers"`
DefaultBranch string `json:"default_branch"`
Stargazers int `json:"stargazers"`
MasterBranch string `json:"master_branch"`
Organization string `json:"organization"`
}
// RepoType represents the structure of a repository as used in push events.
type RepoPushType struct {
ID int `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Owner SenderType `json:"owner"`
Private bool `json:"private"`
HTMLURL string `json:"html_url"`
Description string `json:"description"`
Fork bool `json:"fork"`
URL string `json:"url"`
ForksURL string `json:"forks_url"`
KeysURL string `json:"keys_url"`
CollaboratorsURL string `json:"collaborators_url"`
TeamsURL string `json:"teams_url"`
HooksURL string `json:"hooks_url"`
IssueEventsURL string `json:"issue_events_url"`
EventsURL string `json:"events_url"`
AssigneesURL string `json:"assignees_url"`
BranchesURL string `json:"branches_url"`
TagsURL string `json:"tags_url"`
BlobsURL string `json:"blobs_url"`
GitTagsURL string `json:"git_tags_url"`
GitRefsURL string `json:"git_refs_url"`
TreesURL string `json:"trees_url"`
StatusesURL string `json:"statuses_url"`
LanguagesURL string `json:"languages_url"`
StargazersURL string `json:"stargazers_url"`
ContributorsURL string `json:"contributors_url"`
SubscribersURL string `json:"subscribers_url"`
SubscriptionURL string `json:"subscription_url"`
CommitsURL string `json:"commits_url"`
GitCommitsURL string `json:"git_commits_url"`
CommentsURL string `json:"comments_url"`
IssueCommentURL string `json:"issue_comment_url"`
ContentsURL string `json:"contents_url"`
CompareURL string `json:"compare_url"`
MergesURL string `json:"mergers_url"`
ArchiveURL string `json:"archive_url"`
DownloadsURL string `json:"downloads_url"`
IssuesURL string `json:"issues_url"`
PullsURL string `json:"pulls_url"`
MilestonesURL string `json:"milestones_url"`
NotificationsURL string `json:"notifications_url"`
LabelsURL string `json:"labels_url"`
ReleasesURL string `json:"releases_url"`
CreatedAt int64 `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PushedAt int64 `json:"pushed_at"`
GitURL string `json:"git_url"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
SvnURL string `json:"svn_url"`
Homepage string `json:"homepage"`
Size int `json:"size"`
StargazersCount int `json:"stargazers_count"`
WatchersCount int `json:"watchers_count"`
Language string `json:"language"`
HasIssues bool `json:"has_issues"`
HasDownloads bool `json:"has_downloads"`
HasWiki bool `json:"has_wiki"`
HasPages bool `json:"has_pages"`
ForksCount int `json:"forks_count"`
MirrorURL string `json:"mirror_url"`
OpenIssuesCount int `json:"open_issues_count"`
Forks int `json:"forks"`
OpenIssues int `json:"open_issues"`
Watchers int `json:"watchers"`
DefaultBranch string `json:"default_branch"`
Stargazers int `json:"stargazers"`
MasterBranch string `json:"master_branch"`
Organization string `json:"organization"`
}
// PushEvent represents the basic, top-level structure of a push event.
type PushEvent struct {
Ref string `json:"ref"`
Before string `json:"before"`
After string `json:"after"`
Created bool `json:"created"`
Deleted bool `json:"deleted"`
Forced bool `json:"forced"`
BaseRef string `json:"base_ref"`
Compare string `json:"compare"`
Commits []CommitType `json:"commits"`
HeadCommit CommitType `json:"head_commit"`
Repository RepoPushType `json:"repository"`
Pusher PusherType `json:"pusher"`
Organization OrgType `json:"organization"`
Sender SenderType `json:"sender"`
}
type ConfigType struct {
URL string `json:"url"`
ContentType string `json:"content_type"`
}
type HookType struct {
ID int `json:"id"`
URL string `json:"url"`
TestURL string `json:"test_url"`
PingURL string `json:"ping_url"`
Name string `json:"name"`
Events []string `json:"events"`
Active bool `json:"active"`
Config ConfigType `json:"config"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
// PingEvent represents the basic, top-level structure of a ping event.
type PingEvent struct {
Zen string `json:"zen"`
HookID int `json:"hook_id"`
Hook HookType `json:"hook"`
Organization OrgType `json:"organization"`
Sender SenderType `json:"sender"`
}
type CommentType struct {
URL string `json:"url"`
HTMLURL string `json:"html_url"`
ID int `json:"id"`
User SenderType `json:"user"`
Position string `json:"position"`
Line string `json:"line"`
Path string `json:"path"`
CommitID string `json:"commit_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Body string `json:"body"`
}
type CommitCommentEvent struct {
Comment CommentType `json:"comment"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
Organization OrgType `json:"organization"`
}
type IssueCommentType struct {
ID int `json:"id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
Body string `json:"body"`
User SenderType `json:"user"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"created_at"`
}
type LabelType struct {
URL string `json:"url"`
Name string `json:"name"`
Color string `json:"color"`
}
type MilestoneType struct {
URL string `json:"url"`
HTMLURL string `json:"html_url"`
LabelsURL string `json:"labels_url"`
ID int `json:"id"`
Number int `json:"number"`
State string `json:"state"`
Title string `json:"title"`
Description string `json:"description"`
Creator SenderType `json:"creator"`
OpenIssues int `json:"open_issues"`
ClosedIssues int `json:"closed_issues"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"`
DueOn string `json:"due_on"`
}
type ShortPullRequestType struct {
URL string `json:"url"`
HTMLURL string `json:"html_url"`
DiffURL string `json:"diff_url"`
PatchURL string `json:"patch_url"`
}
type IssueType struct {
ID int `json:"id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
Number int `json:"number"`
State string `json:"state"`
Title string `json:"title"`
Body string `json:"body"`
User SenderType `json:"user"`
Labels []LabelType `json:"labels"`
Assignee SenderType `json:"assignee"`
Milestone MilestoneType `json:"milestone"`
Comments int `json:"comments"`
PullRequest ShortPullRequestType `json:"pull_request"`
ClosedAt *time.Time `json:"closed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type IssueCommentEvent struct {
Action string `json:"action"`
Issue IssueType `json:"issue"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
Comment IssueCommentType `json:"comment"`
}
type IssuesEvent struct {
Action string `json:"action"`
Issue IssueType `json:"issue"`
Assignee SenderType `json:"assignee"`
Label LabelType `json:"label"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type CreateEvent struct {
RefType string `json:"ref_type"`
Ref string `json:"ref"`
MasterBranch string `json:"master_branch"`
Description string `json:"description"`
PusherType string `json:"pusher_type"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type DeleteEvent struct {
RefType string `json:"ref_type"`
Ref string `json:"ref"`
PusherType string `json:"pusher_type"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type RepositoryEvent struct {
Action string `json:"action"`
Repository RepoType `json:"repository"`
Organization OrgType `json:"organization"`
Sender SenderType `json:"sender"`
}
type DeploymentType struct {
URL string `json:"url"`
ID int `json:"id"`
SHA string `json:"sha"`
Ref string `json:"ref"`
Task string `json:"task"`
Payload map[string]string `json:"payload"`
Environment string `json:"environment"`
Description string `json:"description"`
Creator SenderType `json:"creator"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StatusesURL string `json:"statuses_url"`
RepositoryURL string `json:"repository_url"`
}
type DeploymentEvent struct {
Deployment DeploymentType `json:"deployment"`
ID int `json:"id"`
SHA string `json:"sha"`
Ref string `json:"ref"`
Task string `json:"task"`
Name string `json:"name"`
Environment string `json:"environment"`
Payload map[string]string `json:"payload"`
Description string `json:"description"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type DeploymentStatusType struct {
URL string `json:"url"`
ID int `json:"id"`
State string `json:"state"`
Creator SenderType `json:"creator"`
Description string `json:"description"`
TargetURL string `json:"target_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeploymentURL string `json:"deployment_url"`
RepositoryURL string `json:"repository_url"`
}
type DeploymentStatusEvent struct {
Deployment DeploymentType `json:"deployment"`
DeploymentStatus DeploymentStatusType `json:"deployment_status"`
ID int `json:"id"`
State string `json:"state"`
TargetURL string `json:"target_url"`
Description string `json:"description"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type ForkEvent struct {
Forkee RepoType `json:"forkee"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type PageType struct {
PageName string `json:"page_name"`
Title string `json:"title"`
Summary string `json:"summary"`
Action string `json:"action"`
SHA string `json:"sha"`
HTMLURL string `json:"html_url"`
}
type GollumEvent struct {
Pages []PageType `json:"pages"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type MemberEvent struct {
Action string `json:"action"`
Member SenderType `json:"member"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type TeamType struct {
Name string `json:"name"`
ID int `json:"id"`
Slug string `json:"slug"`
Permission string `json:"permission"`
URL string `json:"url"`
MembersURL string `json:"members_url"`
RepositoriesURL string `json:"repositories_url"`
}
type ProjectType struct {
Owner_Url string `json:"owner_url"`
HTMLURL string `json:"html_url"`
ID int `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
Body string `json:"body"`
Number int `json:"number"`
State string `json:"state"`
}
type ProjectCardType struct {
URL string `json:"url"`
ContentURL string `json:"content_url"`
ColumnURL string `json:"column_url"`
ColumnID int `json:"column_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID int `json:"id"`
Note string `json:note"`
}
type ProjectCardEvent struct {
Action string `json:"action"`
ProjectCard ProjectCardType `json:"project_card"`
OpenIssues int `json:"open_issues"`
}
type ProjectEvent struct {
Action string `json:"action"`
Project ProjectType `json:"project"`
HTMLURL string `json:"html_url"`
Repository RepoType `json:"repository"`
Organization OrgType `json:"organization"`
Sender SenderType `json:"sender"`
}
type MembershipEvent struct {
Action string `json:"action"`
Scope string `json:"scope"`
Member SenderType `json:"member"`
Team TeamType `json:"team"`
Sender SenderType `json:"sender"`
Organization OrgType `json:"organization"`
}
type ErrorType struct {
Message string `json:"message"`
}
type BuildType struct {
URL string `json:"url"`
Status string `json:"status"`
Error ErrorType `json:"error"`
Pusher SenderType `json:"pusher"`
Commit string `json:"commit"`
Duration int `json:"duration"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type PageBuildEvent struct {
ID int `json:"id"`
Build BuildType `json:"build"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type PublicEvent struct {
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type BaseHeadType struct {
Label string `json:"label"`
Ref string `json:"ref"`
SHA string `json:"sha"`
User SenderType `json:"user"`
Repo RepoType `json:"repo"`
}
type Link struct {
HREF string `json:"href"`
}
type PullRequestType struct {
ID int `json:"id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
DiffURL string `json:"diff_url"`
PatchURL string `json:"patch_url"`
IssueURL string `json:"issue_url"`
CommitsURL string `json:"commits_url"`
ReviewCommentsURL string `json:"review_comments_url"`
ReviewCommentURL string `json:"review_comment_url"`
CommentsURL string `json:"comments_url"`
StatusesURL string `json:"statuses_url"`
Number int `json:"number"`
State string `json:"state"`
Title string `json:"title"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"`
MergedAt *time.Time `json:"merged_at"`
Head BaseHeadType `json:"head"`
Repo RepoType `json:"repo"`
Base BaseHeadType `json:"Base"`
Links map[string]Link `json:"_links"`
User SenderType `json:"User"`
MergeCommitSHA string `json:"merge_commit_sha"`
Merged bool `json:"merged"`
Mergeable bool `json:"mergeable"`
MergedBy SenderType `json:"merged_by"`
Comments int `json:"comments"`
Commits int `json:"commits"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Assignee *UserType `json:"assignee"`
Milestone *MilestoneType `json:"milestone"`
ChangedFiles int `json:"changed_files"`
}
type PullRequestEvent struct {
Action string `json:"action"`
Number int `json:"number"`
PullRequest PullRequestType `json:"pull_request"`
Repository RepoType `json:"repository"`
Label LabelType `json:"label"`
Sender SenderType `json:"sender"`
}
type PullRequestReviewCommentType struct {
URL string `json:"url"`
ID int `json:"id"`
DiffHunk string `json:"diff_hunk"`
Path string `json:"path"`
Position int `json:"position"`
OriginalPosition int `json:"original_position"`
CommitID string `json:"commit_id"`
OriginalCommitID string `json:"original_commit_id"`
User SenderType `json:"user"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
PullRequestURL string `json:"pull_request_url"`
Links map[string]Link `json:"_links"`
}
type PullRequestReviewCommentEvent struct {
Action string `json:"action"`
Comment PullRequestReviewCommentType `json:"comment"`
PullRequest PullRequestType `json:"pull_request"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type AssetType struct {
URL string `json:"url"`
BrowserDownloadURL string `json:"browser_download_url"`
ID int `json:"id"`
Name string `json:"name"`
Label string `json:"label"`
State string `json:"state"`
ContentType string `json:"content_type"`
Size int `json:"size"`
DownloadCount int `json:"download_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Uploader SenderType `json:"uploader"`
}
type ReleaseType struct {
URL string `json:"url"`
HTMLURL string `json:"html_url"`
AssetsURL string `json:"assets_url"`
UploadURL string `json:"upload_url"`
TarballURL string `json:"tarball_url"`
ZipballURL string `json:"zipball_url"`
ID int `json:"id"`
TagName string `json:"tag_name"`
TargetCommitish string `json:"target_commitish"`
Name string `json:"name"`
Body string `json:"body"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
CreatedAt time.Time `json:"created_at"`
PublishedAt time.Time `json:"published_at"`
Author SenderType `json:"author"`
Assets []AssetType `json:"assets"`
}
type ReleaseEvent struct {
Action string `json:"action"`
Release ReleaseType `json:"release"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type ShortCommitType struct {
SHA string `json:"sha"`
URL string `json:"url"`
}
type BranchType struct {
Name string `json:"master"`
Commit ShortCommitType `json:"commit"`
}
type StatusEvent struct {
ID int `json:"id"`
SHA string `json:"sha"`
Name string `json:"name"`
TargetURL string `json:"target_url"`
Context string `json:"context"`
Description string `json:"description"`
State string `json:"state"`
Commit CommitType `json:"commit"`
Branches []BranchType `json:"branches"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
}
type TeamAddEvent struct {
Team TeamType `json:"team"`
Repository RepoType `json:"repository"`
Organization OrgType `json:"organization"`
Sender SenderType `json:"sender"`
}
type WatchEvent struct {
Action string `json:"action"`
Repository RepoType `json:"repository"`
Sender SenderType `json:"sender"`
Organization OrgType `json:"organization"`
}
// EventType is an alias for string that provides type safety for the event types.
type EventType string
// These constants define types for the implemented types of packets.
const (
PingEventType = EventType("ping")
PushEventType = EventType("push")
ProjectEventType = EventType("project")
ProjectColumnEvent = EventType("project_column")
ProjectCardEventType = EventType("project_card")
CommitCommentEventType = EventType("commit_comment")
IssueCommentEventType = EventType("issue_comment")
IssuesEventType = EventType("issues")
CreateEventType = EventType("create")
DeleteEventType = EventType("delete")
RepositoryEventType = EventType("repository")
DeploymentEventType = EventType("deployment")
DeploymentStatusEventType = EventType("deployment_status")
ForkEventType = EventType("fork")
GollumEventType = EventType("gollum")
MemberEventType = EventType("member")
MembershipEventType = EventType("membership")
PageBuildEventType = EventType("page_build")
PublicEventType = EventType("public")
PullRequestEventType = EventType("pull_request")
PullRequestReviewCommentEventType = EventType("pull_request_review_comment")
ReleaseEventType = EventType("release")
StatusEventType = EventType("status")
TeamAddEventType = EventType("team_add")
WatchEventType = EventType("watch")
)
// EventAndType holds an event and its type, to be used later in a type assertion on the event.
type EventAndType struct {
Event interface{}
Type EventType
}