From 9e70267766289879809f4ae143df49795b84bb6c Mon Sep 17 00:00:00 2001 From: Evgen Kostenko Date: Wed, 1 Jun 2016 21:23:27 +0300 Subject: [PATCH] add boards service --- board.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/board.go b/board.go index 8fa05fc..36a85a1 100644 --- a/board.go +++ b/board.go @@ -1 +1,59 @@ package jira + +import ( + //"fmt" + "net/http" +) + +type BoardService struct { + client *Client +} + +//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"` + 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 +} + + +// 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) { + + + 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) + } + + if err != nil { + return nil, nil, err + } + + boards := new(BoardsList) + resp, err := s.client.Do(req, boards) + if err != nil { + return nil, resp, err + } + return boards, resp, nil +}