1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-11-29 22:28:34 +02:00

Add the ability to get all issues in a sprint

This commit is contained in:
attack7
2016-07-26 16:18:58 -04:00
parent cdb3939c4c
commit fe70b5c836
3 changed files with 167 additions and 0 deletions

View File

@@ -15,6 +15,11 @@ type IssuesWrapper struct {
Issues []string `json:"issues"`
}
// Wrapper struct for search result
type IssuesInSprintResult struct {
Issues []Issue `json:"issues"`
}
// MoveIssuesToSprint moves issues to a sprint, for a given sprint Id.
// Issues can only be moved to open or active sprints.
// The maximum number of issues that can be moved in one operation is 50.
@@ -34,3 +39,20 @@ func (s *SprintService) MoveIssuesToSprint(sprintID int, issueIDs []string) (*Re
resp, err := s.client.Do(req, nil)
return resp, err
}
// For a given sprint Id, return all issues currently associated with that sprint
//
// JIRA API Docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/sprint-getIssuesForSprint
func (s *SprintService) GetIssuesInSprint(sprintID int) ([]Issue, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/sprint/%d/issue", sprintID)
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
if err != nil {
return nil, nil, err
}
result := new(IssuesInSprintResult)
resp, err := s.client.Do(req, result)
return result.Issues, resp, err
}