From 7cae3f4db1de31c10522d451c46e9fdf31769b91 Mon Sep 17 00:00:00 2001 From: Ed Stephinson Date: Thu, 22 Feb 2024 18:59:53 +0000 Subject: [PATCH] Fix IssueLinkType response --- issue.go | 4 ++++ issuelinktype.go | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/issue.go b/issue.go index 5fd07fc9..03d363f7 100644 --- a/issue.go +++ b/issue.go @@ -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"` diff --git a/issuelinktype.go b/issuelinktype.go index 24a3ab0e..4e3c9301 100644 --- a/issuelinktype.go +++ b/issuelinktype.go @@ -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()) }