Skip to content

Commit 7aeb478

Browse files
committed
Reuse User type for assignees and reviewers
1 parent 53694f8 commit 7aeb478

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

gitlab/payload.go

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ type IssueEventPayload struct {
3737
Project Project `json:"project"`
3838
Repository Repository `json:"repository"`
3939
ObjectAttributes ObjectAttributes `json:"object_attributes"`
40-
Assignee Assignee `json:"assignee"`
41-
Assignees []Assignee `json:"assignees"`
40+
Assignee User `json:"assignee"`
41+
Assignees []User `json:"assignees"`
4242
Changes Changes `json:"changes"`
4343
}
4444

@@ -59,17 +59,13 @@ type MergeRequestEventPayload struct {
5959
Project Project `json:"project"`
6060
Repository Repository `json:"repository"`
6161
Labels []Label `json:"labels"`
62-
Assignees []Assignee `json:"assignees"`
63-
Reviewers []Reviewers `json:"reviewers"`
62+
Assignees []User `json:"assignees"`
63+
Reviewers []User `json:"reviewers"`
6464
}
6565

6666
// Reviewers contains all of the GitLab reviewers information
67-
type Reviewers struct {
68-
ID int `json:"id"`
69-
Name string `json:"name"`
70-
Username string `json:"username"`
71-
AvatarURL string `json:"avatar_url"`
72-
}
67+
// Deprecated: Use User instead
68+
type Reviewers User
7369

7470
// PushEventPayload contains the information for GitLab's push event
7571
type PushEventPayload struct {
@@ -728,7 +724,7 @@ type ObjectAttributes struct {
728724
Source Source `json:"source"`
729725
Target Target `json:"target"`
730726
LastCommit LastCommit `json:"last_commit"`
731-
Assignee Assignee `json:"assignee"`
727+
Assignee User `json:"assignee"`
732728
}
733729

734730
// PipelineObjectAttributes contains pipeline specific GitLab object attributes information
@@ -800,18 +796,13 @@ type MergeRequest struct {
800796
Target Target `json:"target"`
801797
LastCommit LastCommit `json:"last_commit"`
802798
WorkInProgress bool `json:"work_in_progress"`
803-
Assignee Assignee `json:"assignee"`
799+
Assignee User `json:"assignee"`
804800
URL string `json:"url"`
805801
}
806802

807803
// Assignee contains all of the GitLab assignee information
808-
type Assignee struct {
809-
ID int64 `json:"id"`
810-
Name string `json:"name"`
811-
Username string `json:"username"`
812-
AvatarURL string `json:"avatar_url"`
813-
Email string `json:"email"`
814-
}
804+
// Deprecated: Use User instead
805+
type Assignee User
815806

816807
// StDiff contains all of the GitLab diff information
817808
type StDiff struct {

0 commit comments

Comments
 (0)