Repository navigation
feat: add Workspaces.get_asset for a presigned asset download URL - #78
akhil-vamshi-konam wants to merge 1 commit into
Conversation
Wraps GET /workspaces/{slug}/assets/{asset_id}/, which returns a presigned
download URL for any workspace asset, including images embedded in work item
descriptions (those are not listed as work item attachments).
asset_url is optional: the server answers 200 with a null url when it cannot
presign the stored file.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Download response model plane/models/workspaces.py |
Adds WorkspaceAssetDownload with a required asset ID and optional URL, name, and type fields. |
Asset retrieval and validation plane/api/workspaces.py, tests/unit/test_workspaces.py |
Adds Workspaces.get_asset and tests for response parsing, the request route and API-key header, optional fields, and HTTP 400 and 404 errors. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Suggested reviewers: gurusainath
Merge Risk: 
Minimal · up to 91978
-
No merge-blocking issue is evident in the supplied review evidence.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Description
Adds
Workspaces.get_asset(workspace_slug, asset_id), 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.Why: images embedded in a work item description (
<image-component src="<asset-id>">) are stored as separateISSUE_DESCRIPTIONassets.work_items.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 (a follow-up PR inplane-mcp-server).Workspaces.get_assetreturning a newWorkspaceAssetDownloadmodel (asset_id,asset_url,asset_name,asset_type).asset_urlisstr | None: the server answers 200 with a null url when it cannot presign the stored file, and that should not surface as a validation error.HttpErrorlike every other call (400 for an asset that is not uploaded yet, 404 for a missing asset).Type of Change
Screenshots and Media (if applicable)
N/A
Test Scenarios
pytest tests/unit/test_workspaces.py -k Offline: 6 new ofsession, no network or credentials):/workspaces/{slug}/assets/{id}/route with theX-Api-Keyheader;asset_url, and defaults optional fieldHttpErrorfor 400 and 404.ruff checkandruff format --checkare clean on the chaget_assetreturned the presigned URL for an inline screenshot, and the image was downloaded and read.Summary by CodeRabbit