From 80c7bdb3088b6343b559d4bca4959dc0f4e37248 Mon Sep 17 00:00:00 2001 From: katayama8000 Date: Tue, 28 Jul 2026 15:56:29 +0900 Subject: [PATCH] feat: add externalFileLinks to Issue entity The Get Issue API response includes an `externalFileLinks` array (Scala: `IssueJson.sharedExternalFileLinks`), but the `Entity.Issue.Issue` type was missing it, so consumers had to cast to reach the field. Verified against a Backlog space that `GET /api/v2/issues/:issueIdOrKey` returns `externalFileLinks` on every issue (empty array when no links). `createdUser` / `updatedUser` are optional because they are `Option[User]` on the server side. Co-Authored-By: Claude Opus 5 (1M context) --- src/entity.ts | 12 ++++++++++++ test/test.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/entity.ts b/src/entity.ts index 3d85daf..9e32946 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -620,10 +620,22 @@ export namespace Issue { customFields: CustomFieldValue.CustomFieldValue[]; attachments: File.IssueFileInfo[]; sharedFiles: Project.SharedFile[]; + externalFileLinks: ExternalFileLink[]; stars: Star.Star[]; childIssueSummary?: ChildIssueSummary; } + export interface ExternalFileLink { + id: number; + serviceType: string; + name: string; + url: string; + createdUser?: User.User; + created: string; + updatedUser?: User.User; + updated: string; + } + export interface ChildIssueSummary { total: number; closed: number; diff --git a/test/test.ts b/test/test.ts index 09e5c13..551988a 100644 --- a/test/test.ts +++ b/test/test.ts @@ -306,6 +306,41 @@ describe("Backlog API", () => { expect(data.childIssueSummary).toEqual({ total: 3, closed: 1 }); }); + it("should get a single issue with externalFileLinks.", async () => { + const externalFileLink = { + id: 10, + serviceType: "googledrive", + name: "spec.pdf", + url: "https://drive.google.com/file/d/xxxx/view", + createdUser: null, + created: "2026-07-28T00:00:00Z", + updatedUser: null, + updated: "2026-07-28T00:00:00Z", + }; + const issue = { + id: 1, + projectId: 1, + issueKey: "TEST-1", + keyId: 1, + summary: "with external file link", + sharedFiles: [], + externalFileLinks: [externalFileLink], + }; + mockRequest({ + method: "GET", + path: "/api/v2/issues/TEST-1", + query: { apiKey }, + status: 200, + data: issue, + times: 1, + }); + const data = await backlog.getIssue("TEST-1"); + expect(data).toEqual(issue); + expect(data.externalFileLinks).toHaveLength(1); + expect(data.externalFileLinks[0].serviceType).toBe("googledrive"); + expect(data.externalFileLinks[0].url).toBe(externalFileLink.url); + }); + it("should serialize the expand parameter using bracket array format.", () => { const query = (backlog as any).toQueryString({ parentChild: backlogjs.Option.Issue.ParentChildType.GrandchildOnly,