Skip to content

Commit 9eaa723

Browse files
committed
Cloud/Board: Add Location to Board struct
Thanks goes to @wardviaene for his work in #455
1 parent 4496e87 commit 9eaa723

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

cloud/board.go

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,24 @@ type BoardsList struct {
2323

2424
// Board represents a Jira agile board
2525
type Board struct {
26-
ID int `json:"id,omitempty" structs:"id,omitempty"`
27-
Self string `json:"self,omitempty" structs:"self,omitempty"`
28-
Name string `json:"name,omitempty" structs:"name,omitemtpy"`
29-
Type string `json:"type,omitempty" structs:"type,omitempty"`
30-
FilterID int `json:"filterId,omitempty" structs:"filterId,omitempty"`
26+
ID int `json:"id,omitempty" structs:"id,omitempty"`
27+
Self string `json:"self,omitempty" structs:"self,omitempty"`
28+
Name string `json:"name,omitempty" structs:"name,omitemtpy"`
29+
Type string `json:"type,omitempty" structs:"type,omitempty"`
30+
Location BoardLocation `json:"location,omitempty" structs:"location,omitempty"`
31+
FilterID int `json:"filterId,omitempty" structs:"filterId,omitempty"`
32+
}
33+
34+
// BoardLocation represents the location of a Jira board
35+
type BoardLocation struct {
36+
ProjectID int `json:"projectId"`
37+
UserID int `json:"userId"`
38+
UserAccountID string `json:"userAccountId"`
39+
DisplayName string `json:"displayName"`
40+
ProjectName string `json:"projectName"`
41+
ProjectKey string `json:"projectKey"`
42+
ProjectTypeKey string `json:"projectTypeKey"`
43+
Name string `json:"name"`
3144
}
3245

3346
// BoardListOptions specifies the optional parameters to the BoardService.GetList
@@ -152,14 +165,12 @@ func (s *BoardService) GetAllBoards(ctx context.Context, opt *BoardListOptions)
152165
return boards, resp, err
153166
}
154167

155-
// GetBoard will returns the board for the given boardID.
168+
// GetBoard returns the board for the given board ID.
156169
// This board will only be returned if the user has permission to view it.
170+
// Admins without the view permission will see the board as a private one, so will see only a subset of the board's data (board location for instance).
157171
//
158-
// Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getBoard
159-
//
160-
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
161-
// This double check effort is done for v2 - Remove this two lines if this is completed.
162-
func (s *BoardService) GetBoard(ctx context.Context, boardID int) (*Board, *Response, error) {
172+
// Jira API docs: https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-get
173+
func (s *BoardService) GetBoard(ctx context.Context, boardID int64) (*Board, *Response, error) {
163174
apiEndpoint := fmt.Sprintf("rest/agile/1.0/board/%v", boardID)
164175
req, err := s.client.NewRequest(ctx, http.MethodGet, apiEndpoint, nil)
165176
if err != nil {

testing/mock-data/all_boards.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@
3838
"id": 1,
3939
"self": "https://test.jira.org/rest/agile/1.0/board/1",
4040
"name": "Test Mobile",
41-
"type": "scrum"
41+
"type": "scrum",
42+
"location": {
43+
"projectId": 10000,
44+
"displayName": "aproject (AP)",
45+
"projectName": "aproject",
46+
"projectKey": "AP",
47+
"projectTypeKey": "software",
48+
"name": "aproject (AP)"
49+
}
4250
}
4351
]
4452
}

0 commit comments

Comments
 (0)