Skip to content

Commit

Permalink
Merge pull request #8 from incident-io/ejs/fix-issue-type-list-response
Browse files Browse the repository at this point in the history
Fix IssueLinkType response
  • Loading branch information
estephinson authored Feb 22, 2024
2 parents b5c43d4 + 7cae3f4 commit 4a9eb07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ type IssueLinkType struct {
Outward string `json:"outward" structs:"outward"`
}

type IssueLinkTypeResponse struct {
IssueLinkTypes []IssueLinkType `json:"issueLinkTypes" structs:"issueLinkTypes"`
}

// Comments represents a list of Comment.
type Comments struct {
Comments []*Comment `json:"comments,omitempty" structs:"comments,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions issuelinktype.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ type IssueLinkTypeService struct {
// GetListWithContext gets all of the issue link types from Jira.
//
// Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-get
func (s *IssueLinkTypeService) GetListWithContext(ctx context.Context) ([]IssueLinkType, *Response, error) {
func (s *IssueLinkTypeService) GetListWithContext(ctx context.Context) (*IssueLinkTypeResponse, *Response, error) {
apiEndpoint := "rest/api/2/issueLinkType"
req, err := s.client.NewRequestWithContext(ctx, "GET", apiEndpoint, nil)
if err != nil {
return nil, nil, err
}

linkTypeList := []IssueLinkType{}
linkTypeList := IssueLinkTypeResponse{}
resp, err := s.client.Do(req, &linkTypeList)
if err != nil {
return nil, resp, NewJiraError(resp, err)
}
return linkTypeList, resp, nil
return &linkTypeList, resp, nil
}

// GetList wraps GetListWithContext using the background context.
func (s *IssueLinkTypeService) GetList() ([]IssueLinkType, *Response, error) {
func (s *IssueLinkTypeService) GetList() (*IssueLinkTypeResponse, *Response, error) {
return s.GetListWithContext(context.Background())
}

Expand Down

0 comments on commit 4a9eb07

Please sign in to comment.