mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-11-25 22:12:08 +02:00
feat(context): Add support for context package
This commit is contained in:
13
priority.go
13
priority.go
@@ -1,5 +1,7 @@
|
||||
package jira
|
||||
|
||||
import "context"
|
||||
|
||||
// PriorityService handles priorities for the JIRA instance / API.
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Priority
|
||||
@@ -18,12 +20,12 @@ type Priority struct {
|
||||
Description string `json:"description,omitempty" structs:"description,omitempty"`
|
||||
}
|
||||
|
||||
// GetList gets all priorities from JIRA
|
||||
// GetListWithContext gets all priorities from JIRA
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-priority-get
|
||||
func (s *PriorityService) GetList() ([]Priority, *Response, error) {
|
||||
func (s *PriorityService) GetListWithContext(ctx context.Context) ([]Priority, *Response, error) {
|
||||
apiEndpoint := "rest/api/2/priority"
|
||||
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||
req, err := s.client.NewRequestWithContext(ctx, "GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -35,3 +37,8 @@ func (s *PriorityService) GetList() ([]Priority, *Response, error) {
|
||||
}
|
||||
return priorityList, resp, nil
|
||||
}
|
||||
|
||||
// GetList wraps GetListWithContext using the background context.
|
||||
func (s *PriorityService) GetList() ([]Priority, *Response, error) {
|
||||
return s.GetListWithContext(context.Background())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user