Skip to content

Commit 4a79f74

Browse files
authored
Merge pull request xanzy#1504 from timofurrer/project-issue-board
Update Project Issue Board API to match upstream API
2 parents 40de111 + 781f8b4 commit 4a79f74

File tree

3 files changed

+43
-11
lines changed

3 files changed

+43
-11
lines changed

boards.go

+31-9
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,21 @@ type IssueBoardsService struct {
3333
//
3434
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
3535
type IssueBoard struct {
36-
ID int `json:"id"`
37-
Name string `json:"name"`
38-
Project *Project `json:"project"`
39-
Milestone *Milestone `json:"milestone"`
40-
Lists []*BoardList `json:"lists"`
36+
ID int `json:"id"`
37+
Name string `json:"name"`
38+
Project *Project `json:"project"`
39+
Milestone *Milestone `json:"milestone"`
40+
Assignee *struct {
41+
ID int `json:"id"`
42+
Username string `json:"username"`
43+
Name string `json:"name"`
44+
State string `json:"state"`
45+
AvatarURL string `json:"avatar_url"`
46+
WebURL string `json:"web_url"`
47+
} `json:"assignee"`
48+
Lists []*BoardList `json:"lists"`
49+
Weight int `json:"weight"`
50+
Labels []*LabelDetails `json:"labels"`
4151
}
4252

4353
func (b IssueBoard) String() string {
@@ -48,9 +58,18 @@ func (b IssueBoard) String() string {
4858
//
4959
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
5060
type BoardList struct {
51-
ID int `json:"id"`
52-
Label *Label `json:"label"`
53-
Position int `json:"position"`
61+
ID int `json:"id"`
62+
Assignee *struct {
63+
ID int `json:"id"`
64+
Name string `json:"name"`
65+
Username string `json:"username"`
66+
} `json:"assignee"`
67+
Iteration *ProjectIteration `json:"iteration"`
68+
Label *Label `json:"label"`
69+
MaxIssueCount int `json:"max_issue_count"`
70+
MaxIssueWeight int `json:"max_issue_weight"`
71+
Milestone *Milestone `json:"milestone"`
72+
Position int `json:"position"`
5473
}
5574

5675
func (b BoardList) String() string {
@@ -257,7 +276,10 @@ func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int,
257276
//
258277
// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
259278
type CreateIssueBoardListOptions struct {
260-
LabelID *int `url:"label_id" json:"label_id"`
279+
LabelID *int `url:"label_id,omitempty" json:"label_id,omitempty"`
280+
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
281+
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
282+
IterationID *int `url:"iteration_id,omitempty" json:"iteration_id,omitempty"`
261283
}
262284

263285
// CreateIssueBoardList creates a new issue board list.

boards_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ func TestIssueBoardsService_CreateIssueBoard(t *testing.T) {
4949
Path: "diaspora-project-site",
5050
PathWithNamespace: "diaspora/diaspora-project-site",
5151
},
52-
Lists: []*BoardList{},
52+
Lists: []*BoardList{},
53+
Labels: []*LabelDetails{},
5354
}
5455

5556
ib, resp, err := client.Boards.CreateIssueBoard(5, nil, nil)
@@ -114,7 +115,8 @@ func TestIssueBoardsService_UpdateIssueBoard(t *testing.T) {
114115
Path: "diaspora-project-site",
115116
PathWithNamespace: "diaspora/diaspora-project-site",
116117
},
117-
Lists: []*BoardList{},
118+
Lists: []*BoardList{},
119+
Labels: []*LabelDetails{},
118120
}
119121

120122
ib, resp, err := client.Boards.UpdateIssueBoard(5, 1, nil, nil)

group_boards_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,14 @@ func TestGroupIssueBoardsService_CreateGroupIssueBoardList(t *testing.T) {
583583
ID: 9,
584584
Label: nil,
585585
Position: 0,
586+
Milestone: &Milestone{
587+
ID: 7,
588+
IID: 3,
589+
Title: "Milestone with due date",
590+
Description: "",
591+
State: "active",
592+
WebURL: "https://gitlab.example.com/groups/issue-reproduce/-/milestones/3",
593+
},
586594
}
587595

588596
bl, resp, err := client.GroupIssueBoards.CreateGroupIssueBoardList(5, 1, nil, nil)

0 commit comments

Comments
 (0)