forked from andygrunwald/go-jira
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evgen Kostenko
committed
Jun 1, 2016
1 parent
de59b13
commit 9e70267
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |