Add the `JiraClient.Search()` method
parent
0b9f5491d2
commit
f9465c884d
20
client.go
20
client.go
|
@ -80,3 +80,23 @@ func (c JiraClient) GetProject(keyOrId string) (Project, error) {
|
||||||
|
|
||||||
return project, err
|
return project, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c JiraClient) Search(jql string) ([]Issue, error) {
|
||||||
|
var issues []Issue
|
||||||
|
|
||||||
|
type SearchResponse struct {
|
||||||
|
Issues []Issue `json:"issues"`
|
||||||
|
}
|
||||||
|
searchResponse := SearchResponse{}
|
||||||
|
|
||||||
|
url := fmt.Sprintf("https://%s.atlassian.net/rest/api/2/search", c.Domain)
|
||||||
|
|
||||||
|
body, err := c.get(url, map[string]string{"jql": jql})
|
||||||
|
if err != nil {
|
||||||
|
return issues, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(body, &searchResponse)
|
||||||
|
|
||||||
|
return searchResponse.Issues, err
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue