Repository navigation
feat: add Workspace.getAsset for a presigned asset download URL - #62
Conversation
Wraps GET /api/v1/workspaces/{slug}/assets/{asset_id}/ and adds the
WorkspaceAssetDownload model. Mirrors plane-python-sdk#78.
Bumps version to 0.3.2.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 56 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Both tests were sending payloads the server rejects with a 400:
- collections: a collection holds only workspace wiki pages, and the test
added a project-scoped page ("Page ... is not a workspace wiki page").
Create the page at the workspace path and archive+delete it on cleanup.
- group-sync: project roles are admin/contributor/commenter/guest; there is
no project "member" role ("Unknown project role slug"). Use "contributor".
Test-only change; no SDK code touched.
Description
Adds
client.workspace.getAsset(workspaceSlug, assetId), a wrapper for the existing v1 endpointGET /api/v1/workspaces/{slug}/assets/{asset_id}/. It returns a presigned, time-limited download URL for any uploaded workspace asset, plus the asset's name and MIME type. Mirrors plane-python-sdk#78.Why: images embedded in a work item description (
<image-component src="<asset-id>">) are stored as separateISSUE_DESCRIPTIONassets.workItems.attachments.listfilters onISSUE_ATTACHMENT, so they never appear there, and the SDK had no call that could fetch them. Plane MCP needs this to let agents read inline images.Changes
Workspace.getAsset(src/api/Workspace.ts) returning a newWorkspaceAssetDownloadmodel (asset_id,asset_url,asset_name?,asset_type?), exported fromsrc/models.asset_urlisstring | null: the server answers 200 with a null url when it cannot presign the stored file, and that should not surface as an error.HttpErrorlike every other call (400 for an asset that is not uploaded yet, 404 for a missing asset).0.3.1->0.3.2inpackage.json.scripts/__fixtures__/types-bundle-exports.snapshot.txt: one new export (WorkspaceAssetDownload) and theWorkspaceclass hash changed because it gained a method. No other entries moved.Type of Change
Test Scenarios
Offline, no network or credentials (
tests/unit/workspace-assets.test.ts, 6 tests usingnock):/api/v1/workspaces/{slug}/assets/{id}/with theX-Api-Keyheader;asset_url;HttpErrorfor 400 and 404.Run locally on this branch:
pnpm exec jest tests/unit: 79 suites passed, 986 tests passed (51 e2e-style suites skipped without.env.test)pnpm build(tsc + types bundle + export-surface check): passespnpm check:format: cleanpnpm check:lint: 0 errors (166 pre-existing warnings)Summary by CodeRabbit