mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-03-21 21:07:03 +02:00
add boards service
This commit is contained in:
parent
de59b131b3
commit
9e70267766
58
board.go
58
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user