Skip to content

Commit 19cab95

Browse files
author
Dean Karn
authored
Merge pull request #21 from Mingan/master
[GitLab] Parse label changes on issue and MR events
2 parents ced2e97 + 78ce03b commit 19cab95

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

gitlab/payload.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type IssueEventPayload struct {
3838
Repository Repository `json:"repository"`
3939
ObjectAttributes ObjectAttributes `json:"object_attributes"`
4040
Assignee Assignee `json:"assignee"`
41+
Changes Changes `json:"changes"`
4142
}
4243

4344
// ConfidentialIssueEventPayload contains the information for GitLab's confidential issue event
@@ -52,6 +53,7 @@ type MergeRequestEventPayload struct {
5253
ObjectKind string `json:"object_kind"`
5354
User User `json:"user"`
5455
ObjectAttributes ObjectAttributes `json:"object_attributes"`
56+
Changes Changes `json:"changes"`
5557
}
5658

5759
// PushEventPayload contains the information for GitLab's push event
@@ -409,3 +411,28 @@ type Author struct {
409411
Name string `json:"name"`
410412
Email string `json:"email"`
411413
}
414+
415+
// Changes contains all changes associated with a GitLab issue or MR
416+
type Changes struct {
417+
LabelChanges LabelChanges `json:"labels"`
418+
}
419+
420+
// LabelChanges contains changes in labels assocatiated with a GitLab issue or MR
421+
type LabelChanges struct {
422+
Previous []Label `json:"previous"`
423+
Current []Label `json:"current"`
424+
}
425+
426+
// Label contains all of the GitLab label information
427+
type Label struct {
428+
Id int64 `json:"id"`
429+
Title string `json:"title"`
430+
Color string `json:"color"`
431+
ProjectId int64 `json:"project_id"`
432+
CreatedAt customTime `json:"created_at"`
433+
UpdatedAt customTime `json:"updated_at"`
434+
Template bool `json:"template"`
435+
Description string `json:"description"`
436+
Type string `json:"type"`
437+
GroupId int64 `json:"group_id"`
438+
}

0 commit comments

Comments
 (0)