1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2024-12-02 08:51:43 +02:00

Merge pull request #68 from wvell/master

Adds support for selecting specific fields from the jira api. 
See https://docs.atlassian.com/jira/REST/cloud/#api/2/search-search for details
This commit is contained in:
Andy Grunwald 2017-04-13 21:46:41 +02:00 committed by GitHub
commit 320d02c202

View File

@ -436,6 +436,7 @@ type SearchOptions struct {
MaxResults int `url:"maxResults,omitempty"`
// Expand: Expand specific sections in the returned issues
Expand string `url:"expand,omitempty"`
Fields []string
}
// searchResult is only a small wrapper around the Search (with JQL) method
@ -622,8 +623,8 @@ func (s *IssueService) Search(jql string, options *SearchOptions) ([]Issue, *Res
if options == nil {
u = fmt.Sprintf("rest/api/2/search?jql=%s", url.QueryEscape(jql))
} else {
u = fmt.Sprintf("rest/api/2/search?jql=%s&startAt=%d&maxResults=%d&expand=%s", url.QueryEscape(jql),
options.StartAt, options.MaxResults, options.Expand)
u = fmt.Sprintf("rest/api/2/search?jql=%s&startAt=%d&maxResults=%d&expand=%s&fields=%s", url.QueryEscape(jql),
options.StartAt, options.MaxResults, options.Expand, strings.Join(options.Fields, ","))
}
req, err := s.client.NewRequest("GET", u, nil)