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

move agile issue api to sprint, change name of GetByOption to GetWithOptions

This commit is contained in:
zenixhuang
2018-04-03 14:29:29 +09:00
parent 8a9b83c1eb
commit 18de7ff5fd
6 changed files with 72 additions and 42 deletions

View File

@ -553,44 +553,6 @@ func (s *IssueService) Get(issueID string, options *GetQueryOptions) (*Issue, *R
return issue, resp, nil
}
// Get returns a full representation of the issue for the given issue key.
// JIRA will attempt to identify the issue by the issueIdOrKey path parameter.
// This can be an issue id, or an issue key.
// If the issue cannot be found via an exact match, JIRA will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved.
//
// The given options will be appended to the query string
//
// JIRA API docs: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/issue-getIssue
//
// TODO: create agile service for holding all agile apis' implementation
func (s *IssueService) GetWithAgile(issueID string, options *GetQueryOptions) (*Issue, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/issue/%s", issueID)
if !s.client.Authentication.Authenticated() {
return nil, nil, fmt.Errorf("agile endpoints need to be authenticated for testing")
}
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
if err != nil {
return nil, nil, err
}
if options != nil {
q, err := query.Values(options)
if err != nil {
return nil, nil, err
}
req.URL.RawQuery = q.Encode()
}
issue := new(Issue)
resp, err := s.client.Do(req, issue)
if err != nil {
jerr := NewJiraError(resp, err)
return nil, resp, jerr
}
return issue, resp, nil
}
// DownloadAttachment returns a Response of an attachment for a given attachmentID.
// The attachment is in the Response.Body of the response.
// This is an io.ReadCloser.