1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2024-11-24 08:22:42 +02:00
go-jira/resolution.go
Andy Grunwald 146229d2ab
fix(product): Make product naming consistent, rename JIRA to Jira (#286)
Atlassian names the product "Jira".
In this library, the product name is used different (JIRA) and
inconsistent (sometimes JIRA, sometimes Jira).

closes issue #284
2020-05-14 17:18:31 +02:00

43 lines
1.4 KiB
Go

package jira
import "context"
// ResolutionService handles resolutions for the Jira instance / API.
//
// Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Resolution
type ResolutionService struct {
client *Client
}
// Resolution represents a resolution of a Jira issue.
// Typical types are "Fixed", "Suspended", "Won't Fix", ...
type Resolution struct {
Self string `json:"self" structs:"self"`
ID string `json:"id" structs:"id"`
Description string `json:"description" structs:"description"`
Name string `json:"name" structs:"name"`
}
// GetListWithContext gets all resolutions from Jira
//
// Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-resolution-get
func (s *ResolutionService) GetListWithContext(ctx context.Context) ([]Resolution, *Response, error) {
apiEndpoint := "rest/api/2/resolution"
req, err := s.client.NewRequestWithContext(ctx, "GET", apiEndpoint, nil)
if err != nil {
return nil, nil, err
}
resolutionList := []Resolution{}
resp, err := s.client.Do(req, &resolutionList)
if err != nil {
return nil, resp, NewJiraError(resp, err)
}
return resolutionList, resp, nil
}
// GetList wraps GetListWithContext using the background context.
func (s *ResolutionService) GetList() ([]Resolution, *Response, error) {
return s.GetListWithContext(context.Background())
}