mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-08-06 22:13:02 +02:00
feat(context): Add support for context package
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package jira
|
||||
|
||||
import "context"
|
||||
|
||||
// StatusCategoryService handles status categories for the JIRA instance / API.
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-Statuscategory
|
||||
@ -25,12 +27,12 @@ const (
|
||||
StatusCategoryUndefined = "undefined"
|
||||
)
|
||||
|
||||
// GetList gets all status categories from JIRA
|
||||
// GetListWithContext gets all status categories from JIRA
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-statuscategory-get
|
||||
func (s *StatusCategoryService) GetList() ([]StatusCategory, *Response, error) {
|
||||
func (s *StatusCategoryService) GetListWithContext(ctx context.Context) ([]StatusCategory, *Response, error) {
|
||||
apiEndpoint := "rest/api/2/statuscategory"
|
||||
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||
req, err := s.client.NewRequestWithContext(ctx,"GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@ -42,3 +44,8 @@ func (s *StatusCategoryService) GetList() ([]StatusCategory, *Response, error) {
|
||||
}
|
||||
return statusCategoryList, resp, nil
|
||||
}
|
||||
|
||||
// GetList wraps GetListWithContext using the background context.
|
||||
func (s *StatusCategoryService) GetList() ([]StatusCategory, *Response, error) {
|
||||
return s.GetListWithContext(context.Background())
|
||||
}
|
Reference in New Issue
Block a user