Skip to content

Commit

Permalink
feat: Implement issue link type DELETE
Browse files Browse the repository at this point in the history
  • Loading branch information
johanmeiring authored and ghostsquad committed Dec 12, 2019
1 parent 48a15c1 commit e37cc6c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions issuelinktype.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,17 @@ func (s *IssueLinkTypeService) Update(linkType *IssueLinkType) (*IssueLinkType,
ret := *linkType
return &ret, resp, nil
}

// Delete deletes an issue link type based on provided ID.
//
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-issueLinkTypeId-delete
func (s *IssueLinkTypeService) Delete(ID string) (*Response, error) {
apiEndpoint := fmt.Sprintf("rest/api/2/issueLinkType/%s", ID)
req, err := s.client.NewRequest("DELETE", apiEndpoint, nil)
if err != nil {
return nil, err
}

resp, err := s.client.Do(req, nil)
return resp, err
}
19 changes: 19 additions & 0 deletions issuelinktype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,22 @@ func TestIssueLinkTypeService_Update(t *testing.T) {
t.Error("Expected linkType. LinkType is nil")
}
}

func TestIssueLinkTypeService_Delete(t *testing.T) {
setup()
defer teardown()
testMux.HandleFunc("/rest/api/2/issueLinkType/100", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testRequestURL(t, r, "/rest/api/2/issueLinkType/100")

w.WriteHeader(http.StatusNoContent)
})

resp, err := testClient.IssueLinkType.Delete("100")
if resp.StatusCode != http.StatusNoContent {
t.Error("Expected issue not deleted.")
}
if err != nil {
t.Errorf("Error given: %s", err)
}
}

0 comments on commit e37cc6c

Please sign in to comment.