1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-07-17 01:12:24 +02:00

Add boards and fix some bugs in project

This commit is contained in:
Evgen Kostenko
2016-06-15 12:20:37 +03:00
parent ba0906a1b8
commit 065bb9db44
4 changed files with 66 additions and 25 deletions

View File

@ -11,41 +11,40 @@ type BoardService struct {
//Type for boards list
type BoardsList struct {
MaxResults int `json:"maxResults"`
StartAt int `json:"startAt"`
Total int `json:"total"`
IsLast bool `json:"isLast"`
Values []struct {
ID int `json:"id"`
MaxResults int `json:"maxResults"`
StartAt int `json:"startAt"`
Total int `json:"total"`
IsLast bool `json:"isLast"`
Values []struct {
ID int `json:"id"`
Self string `json:"self"`
Name string `json:"name"`
Type string `json:"type"`
} `json:"values"`
}
type BoardListSettings struct {
startAt int
maxResults int
boardType string
name string
projectKeyOrId string
}
// BoardListOptions specifies the optional parameters to the BoardService.GetList
type BoardListOptions struct {
// Filters results to boards of the specified type.
// Valid values: scrum, kanban.
BoardType string `url:"boardType,omitempty"`
// Filters results to boards that match or partially match the specified name.
Name string `url:"name,omitempty"`
// Filters results to boards that are relevant to a project.
// Relevance meaning that the jql filter defined in board contains a reference to a project.
ProjectKeyOrId string `url:"projectKeyOrId,omitempty"`
// Default Pagination options
ListOptions
}
// Get all boards form jira
//
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getAllProjects
func (s *BoardService) GetList(bs *BoardListSettings) (*BoardsList, *http.Response, error) {
func (s *BoardService) GetList(opt *BoardListOptions) (*BoardsList, *http.Response, error) {
apiEndpoint := "/rest/agile/1.0/board"
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
if bs != nil {
values := req.URL.Query()
values.Add(name, value)
}
url, err := addOptions(apiEndpoint, opt)
req, err := s.client.NewRequest("GET", url, nil)
if err != nil {
return nil, nil, err
}
@ -55,5 +54,6 @@ func (s *BoardService) GetList(bs *BoardListSettings) (*BoardsList, *http.Respon
if err != nil {
return nil, resp, err
}
return boards, resp, nil
return boards, resp, err
}