Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit fd3ac63

Browse files
authored
Merge pull request #1764 from giuliohome/master
Epic Boards
2 parents c1c9341 + be121d5 commit fd3ac63

File tree

3 files changed

+385
-0
lines changed

3 files changed

+385
-0
lines changed

gitlab.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ type Client struct {
137137
GroupAccessTokens *GroupAccessTokensService
138138
GroupBadges *GroupBadgesService
139139
GroupCluster *GroupClustersService
140+
GroupEpicBoards *GroupEpicBoardsService
140141
GroupImportExport *GroupImportExportService
141142
GroupIssueBoards *GroupIssueBoardsService
142143
GroupIterations *GroupIterationsService
@@ -357,6 +358,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
357358
c.GroupAccessTokens = &GroupAccessTokensService{client: c}
358359
c.GroupBadges = &GroupBadgesService{client: c}
359360
c.GroupCluster = &GroupClustersService{client: c}
361+
c.GroupEpicBoards = &GroupEpicBoardsService{client: c}
360362
c.GroupImportExport = &GroupImportExportService{client: c}
361363
c.GroupIssueBoards = &GroupIssueBoardsService{client: c}
362364
c.GroupIterations = &GroupIterationsService{client: c}

group_epic_boards.go

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
//
2+
// Copyright 2021, Patrick Webster
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
package gitlab
18+
19+
import (
20+
"fmt"
21+
"net/http"
22+
)
23+
24+
// GroupEpicBoardsService handles communication with the group epic board
25+
// related methods of the GitLab API.
26+
//
27+
// GitLab API docs:
28+
// https://docs.gitlab.com/ee/api/group_epic_boards.html
29+
type GroupEpicBoardsService struct {
30+
client *Client
31+
}
32+
33+
// GroupEpicBoard represents a GitLab group epic board.
34+
//
35+
// GitLab API docs:
36+
// https://docs.gitlab.com/ee/api/group_epic_boards.html
37+
type GroupEpicBoard struct {
38+
ID int `json:"id"`
39+
Name string `json:"name"`
40+
Group *Group `json:"group"`
41+
Labels []*LabelDetails `json:"labels"`
42+
Lists []*BoardList `json:"lists"`
43+
}
44+
45+
func (b GroupEpicBoard) String() string {
46+
return Stringify(b)
47+
}
48+
49+
// ListGroupEpicBoardsOptions represents the available
50+
// ListGroupEpicBoards() options.
51+
//
52+
// GitLab API docs:
53+
// https://docs.gitlab.com/ee/api/group_epic_boards.html#list-all-epic-boards-in-a-group
54+
type ListGroupEpicBoardsOptions ListOptions
55+
56+
// ListGroupEpicBoards gets a list of all epic boards in a group.
57+
//
58+
// GitLab API docs:
59+
// https://docs.gitlab.com/ee/api/group_epic_boards.html#list-all-epic-boards-in-a-group
60+
func (s *GroupEpicBoardsService) ListGroupEpicBoards(gid interface{}, opt *ListGroupEpicBoardsOptions, options ...RequestOptionFunc) ([]*GroupEpicBoard, *Response, error) {
61+
group, err := parseID(gid)
62+
if err != nil {
63+
return nil, nil, err
64+
}
65+
u := fmt.Sprintf("groups/%s/epic_boards", PathEscape(group))
66+
67+
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
68+
if err != nil {
69+
return nil, nil, err
70+
}
71+
72+
var gs []*GroupEpicBoard
73+
resp, err := s.client.Do(req, &gs)
74+
if err != nil {
75+
return nil, resp, err
76+
}
77+
78+
return gs, resp, nil
79+
}
80+
81+
// GetGroupEpicBoard gets a single epic board of a group.
82+
//
83+
// GitLab API docs:
84+
// https://docs.gitlab.com/ee/api/group_epic_boards.html#single-group-epic-board
85+
func (s *GroupEpicBoardsService) GetGroupEpicBoard(gid interface{}, board int, options ...RequestOptionFunc) (*GroupEpicBoard, *Response, error) {
86+
group, err := parseID(gid)
87+
if err != nil {
88+
return nil, nil, err
89+
}
90+
u := fmt.Sprintf("groups/%s/epic_boards/%d", PathEscape(group), board)
91+
92+
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
93+
if err != nil {
94+
return nil, nil, err
95+
}
96+
97+
gib := new(GroupEpicBoard)
98+
resp, err := s.client.Do(req, gib)
99+
if err != nil {
100+
return nil, resp, err
101+
}
102+
103+
return gib, resp, nil
104+
}

0 commit comments

Comments
 (0)