forked from go-playground/webhooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayload.go
912 lines (845 loc) · 35.8 KB
/
payload.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
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
package gitlab
import (
"strings"
"time"
)
type customTime struct {
time.Time
}
func (t *customTime) UnmarshalJSON(b []byte) (err error) {
layout := []string{
"2006-01-02 15:04:05 MST",
"2006-01-02 15:04:05 Z07:00",
"2006-01-02 15:04:05 Z0700",
time.RFC3339,
}
s := strings.Trim(string(b), "\"")
if s == "null" {
t.Time = time.Time{}
return
}
for _, l := range layout {
t.Time, err = time.Parse(l, s)
if err == nil {
break
}
}
return
}
// IssueEventPayload contains the information for GitLab's issue event
type IssueEventPayload struct {
ObjectKind string `json:"object_kind"`
User User `json:"user"`
Project Project `json:"project"`
Repository Repository `json:"repository"`
ObjectAttributes ObjectAttributes `json:"object_attributes"`
Assignee Assignee `json:"assignee"`
Assignees []Assignee `json:"assignees"`
Changes Changes `json:"changes"`
}
// ConfidentialIssueEventPayload contains the information for GitLab's confidential issue event
type ConfidentialIssueEventPayload struct {
// The data for confidential issues is currently the same as normal issues,
// so we can just embed the normal issue payload type here.
IssueEventPayload
}
// MergeRequestEventPayload contains the information for GitLab's merge request event
type MergeRequestEventPayload struct {
ObjectKind string `json:"object_kind"`
EventType string `json:"event_type"`
User User `json:"user"`
ObjectAttributes ObjectAttributes `json:"object_attributes"`
Changes Changes `json:"changes"`
Project Project `json:"project"`
Repository Repository `json:"repository"`
Labels []Label `json:"labels"`
Assignees []Assignee `json:"assignees"`
Reviewers []Reviewers `json:"reviewers"`
}
// Reviewers contains all of the GitLab reviewers information
type Reviewers struct {
ID int `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
}
// PushEventPayload contains the information for GitLab's push event
type PushEventPayload struct {
ObjectKind string `json:"object_kind"`
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
CheckoutSHA string `json:"checkout_sha"`
UserID int64 `json:"user_id"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserEmail string `json:"user_email"`
UserAvatar string `json:"user_avatar"`
ProjectID int64 `json:"project_id"`
Project Project `json:"project"`
Repository Repository `json:"repository"`
Commits []Commit `json:"commits"`
TotalCommitsCount int64 `json:"total_commits_count"`
}
// TagEventPayload contains the information for GitLab's tag push event
type TagEventPayload struct {
ObjectKind string `json:"object_kind"`
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
CheckoutSHA string `json:"checkout_sha"`
UserID int64 `json:"user_id"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserAvatar string `json:"user_avatar"`
ProjectID int64 `json:"project_id"`
Project Project `json:"project"`
Repository Repository `json:"repository"`
Commits []Commit `json:"commits"`
TotalCommitsCount int64 `json:"total_commits_count"`
}
// WikiPageEventPayload contains the information for GitLab's wiki created/updated event
type WikiPageEventPayload struct {
ObjectKind string `json:"object_kind"`
User User `json:"user"`
Project Project `json:"project"`
Wiki Wiki `json:"wiki"`
ObjectAttributes ObjectAttributes `json:"object_attributes"`
}
// PipelineEventPayload contains the information for GitLab's pipeline status change event
type PipelineEventPayload struct {
ObjectKind string `json:"object_kind"`
User User `json:"user"`
Project Project `json:"project"`
Commit Commit `json:"commit"`
ObjectAttributes PipelineObjectAttributes `json:"object_attributes"`
MergeRequest MergeRequest `json:"merge_request"`
Builds []Build `json:"builds"`
}
// CommentEventPayload contains the information for GitLab's comment event
type CommentEventPayload struct {
ObjectKind string `json:"object_kind"`
EventType string `json:"event_type"`
User User `json:"user"`
ProjectID int64 `json:"project_id"`
Project Project `json:"project"`
Repository Repository `json:"repository"`
ObjectAttributes ObjectAttributes `json:"object_attributes"`
MergeRequest MergeRequest `json:"merge_request"`
Commit Commit `json:"commit"`
Issue Issue `json:"issue"`
Snippet Snippet `json:"snippet"`
}
// ConfidentialCommentEventPayload contains the information for GitLab's confidential issue event
type ConfidentialCommentEventPayload struct {
// The data for confidential issues is currently the same as normal issues,
// so we can just embed the normal issue payload type here.
CommentEventPayload
}
// BuildEventPayload contains the information for GitLab's build status change event
type BuildEventPayload struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
BeforeSHA string `json:"before_sha"`
SHA string `json:"sha"`
BuildID int64 `json:"build_id"`
BuildName string `json:"build_name"`
BuildStage string `json:"build_stage"`
BuildStatus string `json:"build_status"`
BuildStartedAt customTime `json:"build_started_at"`
BuildFinishedAt customTime `json:"build_finished_at"`
BuildQueuedDuration float64 `json:"build_queued_duration"`
BuildDuration float64 `json:"build_duration"`
BuildAllowFailure bool `json:"build_allow_failure"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
User User `json:"user"`
Commit BuildCommit `json:"commit"`
Repository Repository `json:"repository"`
Runner Runner `json:"runner"`
}
// JobEventPayload contains the information for GitLab's Job status change
type JobEventPayload struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
BeforeSHA string `json:"before_sha"`
SHA string `json:"sha"`
BuildID int64 `json:"build_id"`
BuildName string `json:"build_name"`
BuildStage string `json:"build_stage"`
BuildStatus string `json:"build_status"`
BuildStartedAt customTime `json:"build_started_at"`
BuildFinishedAt customTime `json:"build_finished_at"`
BuildQueuedDuration float64 `json:"build_queued_duration"`
BuildDuration float64 `json:"build_duration"`
BuildAllowFailure bool `json:"build_allow_failure"`
BuildFailureReason string `json:"build_failure_reason"`
PipelineID int64 `json:"pipeline_id"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
User User `json:"user"`
Commit BuildCommit `json:"commit"`
Repository Repository `json:"repository"`
Runner Runner `json:"runner"`
}
// DeploymentEventPayload contains the information for GitLab's triggered when a deployment
type DeploymentEventPayload struct {
ObjectKind string `json:"object_kind"`
Status string `json:"status"`
StatusChangeAt string `json:"status_changed_at"`
DeploymentId int64 `json:"deployment_id"`
DeployableId int64 `json:"deployable_id"`
DeployableUrl string `json:"deployable_url"`
Environment string `json:"environment"`
Project Project `json:"project"`
ShortSha string `json:"short_sha"`
User User `json:"user"`
UserUrl string `json:"user_url"`
CommitUrl string `json:"commit_url"`
CommitTitle string `json:"commit_title"`
}
// SystemHookPayload contains the ObjectKind to match with real hook events
type SystemHookPayload struct {
ObjectKind string `json:"object_kind"`
EventName string `json:"event_name"`
}
// ProjectCreatedEventPayload contains the information about GitLab's project created event
type ProjectCreatedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
OwnerEmail string `json:"owner_email"`
OwnerName string `json:"owner_name"`
Owners []Author `json:"owners"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
ProjectID int64 `json:"project_id"`
ProjectVisibility string `json:"project_visibility"`
}
// ProjectDestroyedEventPayload contains the information about GitLab's project destroyed event
type ProjectDestroyedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
OwnerEmail string `json:"owner_email"`
OwnerName string `json:"owner_name"`
Owners []Author `json:"owners"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
ProjectID int64 `json:"project_id"`
ProjectVisibility string `json:"project_visibility"`
}
// ProjectRenamedEventPayload contains the information about GitLab's project renamed event
type ProjectRenamedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
ProjectID int64 `json:"project_id"`
OwnerName string `json:"owner_name"`
OwnerEmail string `json:"owner_email"`
Owners []Author `json:"owners"`
ProjectVisibility string `json:"project_visibility"`
OldPathWithNamespace string `json:"old_path_with_namespace"`
}
// ProjectTransferredEventPayload contains the information about GitLab's project transferred event
type ProjectTransferredEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
ProjectID int64 `json:"project_id"`
OwnerName string `json:"owner_name"`
OwnerEmail string `json:"owner_email"`
Owners []Author `json:"owners"`
ProjectVisibility string `json:"project_visibility"`
OldPathWithNamespace string `json:"old_path_with_namespace"`
}
// ProjectUpdatedEventPayload contains the information about GitLab's project updated event
type ProjectUpdatedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
OwnerEmail string `json:"owner_email"`
OwnerName string `json:"owner_name"`
Owners []Author `json:"owners"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
ProjectID int64 `json:"project_id"`
ProjectVisibility string `json:"project_visibility"`
}
// TeamMemberAddedEventPayload contains the information about GitLab's new team member event
type TeamMemberAddedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
AccessLevel string `json:"access_level"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
ProjectPath string `json:"project_path"`
ProjectPathWithNamespace string `json:"project_path_with_namespace"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserID int64 `json:"user_id"`
ProjectVisibility string `json:"project_visibility"`
}
// TeamMemberRemovedEventPayload contains the information about GitLab's team member removed event
type TeamMemberRemovedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
AccessLevel string `json:"access_level"`
ProjectID int `json:"project_id"`
ProjectName string `json:"project_name"`
ProjectPath string `json:"project_path"`
ProjectPathWithNamespace string `json:"project_path_with_namespace"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserID int64 `json:"user_id"`
ProjectVisibility string `json:"project_visibility"`
}
// TeamMemberUpdatedEventPayload contains the information about GitLab's team member updated event
type TeamMemberUpdatedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
AccessLevel string `json:"access_level"`
ProjectID int64 `json:"project_id"`
ProjectName string `json:"project_name"`
ProjectPath string `json:"project_path"`
ProjectPathWithNamespace string `json:"project_path_with_namespace"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserID int64 `json:"user_id"`
ProjectVisibility string `json:"project_visibility"`
}
// UserCreatedEventPayload contains the information about GitLab's user created event
type UserCreatedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Email string `json:"email"`
EventName string `json:"event_name"`
Name string `json:"name"`
Username string `json:"username"`
UserID int64 `json:"user_id"`
}
// UserRemovedEventPayload contains the information about GitLab's user removed event
type UserRemovedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Email string `json:"email"`
EventName string `json:"event_name"`
Name string `json:"name"`
Username string `json:"username"`
UserID int64 `json:"user_id"`
}
// UserFailedLoginEventPayload contains the information about GitLab's user login failed event
type UserFailedLoginEventPayload struct {
EventName string `json:"event_name"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Name string `json:"name"`
Email string `json:"email"`
UserID int64 `json:"user_id"`
Username string `json:"username"`
State string `json:"state"`
}
// UserRenamedEventPayload contains the information about GitLab's user renamed event
type UserRenamedEventPayload struct {
EventName string `json:"event_name"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Name string `json:"name"`
Email string `json:"email"`
UserID int64 `json:"user_id"`
Username string `json:"username"`
OldUsername string `json:"old_username"`
}
// KeyAddedEventPayload contains the information about GitLab's key added event
type KeyAddedEventPayload struct {
EventName string `json:"event_name"`
CreatedAt string `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Username string `json:"username"`
Key string `json:"key"`
Id int64 `json:"id"`
}
// KeyRemovedEventPayload contains the information about GitLab's key removed event
type KeyRemovedEventPayload struct {
EventName string `json:"event_name"`
CreatedAt string `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Username string `json:"username"`
Key string `json:"key"`
Id int64 `json:"id"`
}
// GroupCreatedEventPayload contains the information about GitLab's group created event
type GroupCreatedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
Path string `json:"path"`
GroupID int64 `json:"group_id"`
}
// GroupRemovedEventPayload contains the information about GitLab's group removed event
type GroupRemovedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
Name string `json:"name"`
Path string `json:"path"`
GroupID int64 `json:"group_id"`
}
// GroupRenamedEventPayload contains the information about GitLab's group renamed event
type GroupRenamedEventPayload struct {
EventName string `json:"event_name"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Name string `json:"name"`
Path string `json:"path"`
FullPath string `json:"full_path"`
GroupID int64 `json:"group_id"`
OldPath string `json:"old_path"`
OldFullPath string `json:"old_full_path"`
}
// GroupMemberAddedEventPayload contains the information about GitLab's new group member event
type GroupMemberAddedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
GroupAccess string `json:"group_access"`
GroupID int64 `json:"group_id"`
GroupName string `json:"group_name"`
GroupPath string `json:"group_path"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserID int64 `json:"user_id"`
}
// GroupMemberRemovedEventPayload contains the information about GitLab's group member removed event
type GroupMemberRemovedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
GroupAccess string `json:"group_access"`
GroupID int64 `json:"group_id"`
GroupName string `json:"group_name"`
GroupPath string `json:"group_path"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserID int64 `json:"user_id"`
}
// GroupMemberUpdatedEventPayload contains the information about GitLab's group member updated event
type GroupMemberUpdatedEventPayload struct {
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
EventName string `json:"event_name"`
GroupAccess string `json:"group_access"`
GroupID int64 `json:"group_id"`
GroupName string `json:"group_name"`
GroupPath string `json:"group_path"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserID int64 `json:"user_id"`
}
// ReleaseEventPayload contains the information about GitLab's release event
type ReleaseEventPayload struct {
ID int `json:"id"`
CreatedAt customTime `json:"created_at"`
Description string `json:"description"`
Name string `json:"name"`
ReleasedAt customTime `json:"released_at"`
Tag string `json:"tag"`
ObjectKind string `json:"object_kind"`
Project Project `json:"project"`
URL string `json:"url"`
Action string `json:"action"`
Assets Assets `json:"assets"`
}
// Assets represent artefacts and links associated to a release
type Assets struct {
Count int `json:"count"`
Links []Link `json:"links"`
Sources []AssetSource `json:"sources"`
}
// Link represent a generic html link
type Link struct {
ID int `json:"id"`
External bool `json:"external"`
LinkType string `json:"link_type"`
Name string `json:"name"`
URL string `json:"url"`
}
// AssetSource represent the download url for an asset
type AssetSource struct {
Format string `json:"format"`
URL string `json:"url"`
}
// Issue contains all of the GitLab issue information
type Issue struct {
ID int64 `json:"id"`
Title string `json:"title"`
AssigneeID int64 `json:"assignee_id"`
AuthorID int64 `json:"author_id"`
ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Position int64 `json:"position"`
BranchName string `json:"branch_name"`
Description string `json:"description"`
MilestoneID int64 `json:"milestone_id"`
State string `json:"state"`
IID int64 `json:"iid"`
}
// Build contains all of the GitLab Build information
type Build struct {
ID int64 `json:"id"`
Stage string `json:"stage"`
Name string `json:"name"`
Status string `json:"status"`
CreatedAt customTime `json:"created_at"`
StartedAt customTime `json:"started_at"`
FinishedAt customTime `json:"finished_at"`
FailureReason string `json:"failure_reason"`
When string `json:"when"`
Manual bool `json:"manual"`
User User `json:"user"`
Runner Runner `json:"runner"`
ArtifactsFile ArtifactsFile `json:"artifactsfile"`
}
// Runner represents a runner agent
type Runner struct {
ID int64 `json:"id"`
Description string `json:"description"`
Active bool `json:"active"`
IsShared bool `json:"is_shared"`
}
// ArtifactsFile contains all of the GitLab artifact information
type ArtifactsFile struct {
Filename string `json:"filename"`
Size string `json:"size"`
}
// Wiki contains all of the GitLab wiki information
type Wiki struct {
WebURL string `json:"web_url"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
PathWithNamespace string `json:"path_with_namespace"`
DefaultBranch string `json:"default_branch"`
}
// Commit contains all of the GitLab commit information
type Commit struct {
ID string `json:"id"`
Message string `json:"message"`
Title string `json:"title"`
Timestamp customTime `json:"timestamp"`
URL string `json:"url"`
Author Author `json:"author"`
Added []string `json:"added"`
Modified []string `json:"modified"`
Removed []string `json:"removed"`
}
// BuildCommit contains all of the GitLab build commit information
type BuildCommit struct {
ID int64 `json:"id"`
SHA string `json:"sha"`
Message string `json:"message"`
AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email"`
Status string `json:"status"`
Duration float64 `json:"duration"`
StartedAt customTime `json:"started_at"`
FinishedAt customTime `json:"finished_at"`
}
// Snippet contains all of the GitLab snippet information
type Snippet struct {
ID int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
AuthorID int64 `json:"author_id"`
ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
FileName string `json:"file_name"`
ExpiresAt customTime `json:"expires_at"`
Type string `json:"type"`
VisibilityLevel int64 `json:"visibility_level"`
}
// User contains all of the GitLab user information
type User struct {
ID int64 `json:"id"`
Name string `json:"name"`
UserName string `json:"username"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
}
// Project contains all of the GitLab project information
type Project struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
WebURL string `json:"web_url"`
AvatarURL string `json:"avatar_url"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
Namespace string `json:"namespace"`
VisibilityLevel int64 `json:"visibility_level"`
PathWithNamespace string `json:"path_with_namespace"`
DefaultBranch string `json:"default_branch"`
CiConfigPath string `json:"ci_config_path"`
Homepage string `json:"homepage"`
URL string `json:"url"`
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
}
// Repository contains all of the GitLab repository information
type Repository struct {
Name string `json:"name"`
URL string `json:"url"`
Description string `json:"description"`
Homepage string `json:"homepage"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
VisibilityLevel int64 `json:"visibility_level"`
}
// ObjectAttributes contains all of the GitLab object attributes information
type ObjectAttributes struct {
ID int64 `json:"id"`
Title string `json:"title"`
AssigneeIDS []int64 `json:"assignee_ids"`
AssigneeID int64 `json:"assignee_id"`
ReviewerIDs []int64 `json:"reviewer_ids"`
AuthorID int64 `json:"author_id"`
ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
UpdatedByID int64 `json:"updated_by_id"`
LastEditedAt customTime `json:"last_edited_at"`
LastEditedByID int64 `json:"last_edited_by_id"`
RelativePosition int64 `json:"relative_position"`
Position Position `json:"position"`
BranchName string `json:"branch_name"`
Description string `json:"description"`
MilestoneID int64 `json:"milestone_id"`
State string `json:"state"`
StateID int64 `json:"state_id"`
Confidential bool `json:"confidential"`
DiscussionLocked bool `json:"discussion_locked"`
DueDate customTime `json:"due_date"`
TimeEstimate int64 `json:"time_estimate"`
TotalTimeSpent int64 `json:"total_time_spent"`
IID int64 `json:"iid"`
URL string `json:"url"`
Action string `json:"action"`
TargetBranch string `json:"target_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int64 `json:"source_project_id"`
TargetProjectID int64 `json:"target_project_id"`
StCommits string `json:"st_commits"`
MergeStatus string `json:"merge_status"`
Content string `json:"content"`
Format string `json:"format"`
Message string `json:"message"`
Slug string `json:"slug"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
SHA string `json:"sha"`
BeforeSHA string `json:"before_sha"`
Status string `json:"status"`
Stages []string `json:"stages"`
Duration int64 `json:"duration"`
Note string `json:"note"`
NotebookType string `json:"noteable_type"` // nolint:misspell
At customTime `json:"attachment"`
LineCode string `json:"line_code"`
CommitID string `json:"commit_id"`
NoteableID int64 `json:"noteable_id"` // nolint: misspell
System bool `json:"system"`
WorkInProgress bool `json:"work_in_progress"`
Draft bool `json:"draft"`
StDiffs []StDiff `json:"st_diffs"`
Source Source `json:"source"`
Target Target `json:"target"`
LastCommit LastCommit `json:"last_commit"`
Assignee Assignee `json:"assignee"`
DiscussionID string `json:"discussion_id"` // thread id
}
// PipelineObjectAttributes contains pipeline specific GitLab object attributes information
type PipelineObjectAttributes struct {
ID int64 `json:"id"`
IID int64 `json:"iid"`
Name string `json:"name"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
SHA string `json:"sha"`
BeforeSHA string `json:"before_sha"`
Source string `json:"source"`
Status string `json:"status"`
Stages []string `json:"stages"`
CreatedAt customTime `json:"created_at"`
FinishedAt customTime `json:"finished_at"`
Duration int64 `json:"duration"`
Variables []Variable `json:"variables"`
Url string `json:"url"`
}
// Variable contains pipeline variables
type Variable struct {
Key string `json:"key"`
Value string `json:"value"`
}
// Position defines a specific location, identified by paths line numbers and
// image coordinates, within a specific diff, identified by start, head and
// base commit ids.
//
// Text position will have: new_line and old_line
// Image position will have: width, height, x, y
type Position struct {
BaseSHA string `json:"base_sha"`
StartSHA string `json:"start_sha"`
HeadSHA string `json:"head_sha"`
OldPath string `json:"old_path"`
NewPath string `json:"new_path"`
PositionType string `json:"position_type"`
OldLine int64 `json:"old_line"`
NewLine int64 `json:"new_line"`
Width int64 `json:"width"`
Height int64 `json:"height"`
X int64 `json:"x"`
Y int64 `json:"y"`
}
// MergeRequest contains all of the GitLab merge request information
type MergeRequest struct {
ID int64 `json:"id"`
TargetBranch string `json:"target_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int64 `json:"source_project_id"`
AssigneeID int64 `json:"assignee_id"`
AuthorID int64 `json:"author_id"`
Title string `json:"title"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
MilestoneID int64 `json:"milestone_id"`
State string `json:"state"`
MergeStatus string `json:"merge_status"`
TargetProjectID int64 `json:"target_project_id"`
IID int64 `json:"iid"`
Description string `json:"description"`
Position int64 `json:"position"`
LockedAt customTime `json:"locked_at"`
Source Source `json:"source"`
Target Target `json:"target"`
LastCommit LastCommit `json:"last_commit"`
WorkInProgress bool `json:"work_in_progress"`
Assignee Assignee `json:"assignee"`
URL string `json:"url"`
}
// Assignee contains all of the GitLab assignee information
type Assignee struct {
ID int64 `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
}
// StDiff contains all of the GitLab diff information
type StDiff struct {
Diff string `json:"diff"`
NewPath string `json:"new_path"`
OldPath string `json:"old_path"`
AMode string `json:"a_mode"`
BMode string `json:"b_mode"`
NewFile bool `json:"new_file"`
RenamedFile bool `json:"renamed_file"`
DeletedFile bool `json:"deleted_file"`
}
// Source contains all of the GitLab source information
type Source struct {
Name string `json:"name"`
Description string `json:"description"`
WebURL string `json:"web_url"`
AvatarURL string `json:"avatar_url"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
Namespace string `json:"namespace"`
VisibilityLevel int64 `json:"visibility_level"`
PathWithNamespace string `json:"path_with_namespace"`
DefaultBranch string `json:"default_branch"`
Homepage string `json:"homepage"`
URL string `json:"url"`
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
}
// Target contains all of the GitLab target information
type Target struct {
Name string `json:"name"`
Description string `json:"description"`
WebURL string `json:"web_url"`
AvatarURL string `json:"avatar_url"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
Namespace string `json:"namespace"`
VisibilityLevel int64 `json:"visibility_level"`
PathWithNamespace string `json:"path_with_namespace"`
DefaultBranch string `json:"default_branch"`
Homepage string `json:"homepage"`
URL string `json:"url"`
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
}
// LastCommit contains all of the GitLab last commit information
type LastCommit struct {
ID string `json:"id"`
Message string `json:"message"`
Title string `json:"title"`
Timestamp customTime `json:"timestamp"`
URL string `json:"url"`
Author Author `json:"author"`
}
// Author contains all of the GitLab author information
type Author struct {
Name string `json:"name"`
Email string `json:"email"`
}
// Changes contains all changes associated with a GitLab issue or MR
type Changes struct {
LabelChanges LabelChanges `json:"labels"`
DraftChanges DraftChanges `json:"draft"`
}
// LabelChanges contains changes in labels associated with a GitLab issue or MR
type LabelChanges struct {
Previous []Label `json:"previous"`
Current []Label `json:"current"`
}
// DraftChanges contains the current and previous value of the draft property, tells us if draft was toggles
type DraftChanges struct {
Previous bool `json:"previous"`
Current bool `json:"current"`
}
// Label contains all of the GitLab label information
type Label struct {
ID int64 `json:"id"`
Title string `json:"title"`
Color string `json:"color"`
ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Template bool `json:"template"`
Description string `json:"description"`
Type string `json:"type"`
GroupID int64 `json:"group_id"`
}