feat: support the related issues API - #181
Merged
Merged
Conversation
Add client methods for the issue relation endpoints: - GET /api/v2/issues/:issueIdOrKey/relatedIssues - POST /api/v2/issues/:issueIdOrKey/relatedIssues - DELETE /api/v2/issues/:issueIdOrKey/relatedIssues/:relatedIssueId The responses are Issue objects with an extra `type` field holding the relation type, so `Entity.Issue.RelatedIssue` extends `Entity.Issue.Issue`. `Types.IssueRelationType` covers "RELATES" and the reserved "PRECEDES". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Keep the public type within the scope the API actually supports today. The server also defines a reserved PRECEDES type, but it is never accepted or returned yet, so exposing it here would leak an unreleased feature into the client surface. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds client support for the issue relation ("related issues") endpoints:
getRelatedIssues(issueIdOrKey)GET /api/v2/issues/:issueIdOrKey/relatedIssuesaddRelatedIssue(issueIdOrKey, params)POST /api/v2/issues/:issueIdOrKey/relatedIssuesremoveRelatedIssue(issueIdOrKey, relatedIssueId)DELETE /api/v2/issues/:issueIdOrKey/relatedIssues/:relatedIssueIdTypes
Entity.Issue.RelatedIssue extends Entity.Issue.Issue— the responses are plain Issue objects with an extratypefield carrying the relation type, so extendingIssuemirrors the wire format exactly.Types.IssueRelationType = "RELATES"— kept to what the API actually supports today. The server also defines a reserved relation type that is neither accepted nor returned yet; exposing it here would leak an unreleased feature into the client surface, so it is intentionally left out and can be added when it ships.Option.Issue.AddRelatedIssueParams = { targetIssueId: number }.Usage
Verification
Unit tests were added for all three methods (the
POSTtest also asserts the form-encoded request body).The methods were additionally exercised against a real Backlog space, which confirmed:
addRelatedIssue/removeRelatedIssuereturn the target issue plustype: "RELATES".getRelatedIssueson the target issue returns the source issue.Error.BacklogApiError(HTTP 404), so no special handling is needed on the client side.npm run typecheck,npm test,npm run lintandnpm run fmt:checkall pass.Notes
The JSDoc comments reference the endpoint paths rather than developer.nulab.com URLs, because the documentation pages for these endpoints are not published yet. They should be swapped for the canonical URLs once the docs go live.
🤖 Generated with Claude Code