diff --git a/client.go b/client.go index fae6fd8..20f87a9 100644 --- a/client.go +++ b/client.go @@ -80,3 +80,23 @@ func (c JiraClient) GetProject(keyOrId string) (Project, error) { 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 +}