Skip to content

feat: add Workspaces.get_asset for a presigned asset download URL - #78

Open
akhil-vamshi-konam wants to merge 1 commit into
mainfrom
feat-workspace-get-asset
Open

akhil-vamshi-konam wants to merge 1 commit into
mainfrom
feat-workspace-get-asset

Conversation

@akhil-vamshi-konam

@akhil-vamshi-konam akhil-vamshi-konam commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds Workspaces.get_asset(workspace_slug, asset_id), a wrapper for the existing v1 endpoint GET /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 separate ISSUE_DESCRIPTION assets. work_items.attachments.list filters on ISSUE_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 in plane-mcp-server).

  • New method Workspaces.get_asset returning a new WorkspaceAssetDownload model (asset_id, asset_url, asset_name, asset_type).
  • asset_url is str | 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.
  • Errors surface as HttpError like every other call (400 for an asset that is not uploaded yet, 404 for a missing asset).
  • No new dependencies. No version bump in this PR.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

N/A

Test Scenarios

  • pytest tests/unit/test_workspaces.py -k Offline: 6 new ofsession, no network or credentials):
    • returns the download details, and builds the correct /workspaces/{slug}/assets/{id}/ route with the X-Api-Key header;
    • tolerates a null asset_url, and defaults optional field
    • raises HttpError for 400 and 404.
  • ruff check and ruff format --check are clean on the cha
  • Exercised end to end through Plane MCP against a local Plane instance: get_asset returned the presigned URL for an inline screenshot, and the image was downloaded and read.

Summary by CodeRabbit

  • New Features
    • Added the ability to request downloads for workspace assets and receive their download details.
    • Download links are time-limited and can be accessed without Plane authentication. If a file cannot be prepared for download, the link may be unavailable.
  • Bug Fixes
    • Improved handling of unsuccessful asset download requests, including cases where an asset is unavailable or the request is invalid.

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.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3e9e4c5-8967-49e4-856c-4b6ab00eb208
Commits

Reviewing files that changed from the base of the PR and between a8d4530 and 9197886.

Files selected for processing: 3
  • plane/api/workspaces.py
  • plane/models/workspaces.py
  • tests/unit/test_workspaces.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The SDK adds Workspaces.get_asset to retrieve workspace asset download details. It validates the response with the new WorkspaceAssetDownload model. Unit tests cover successful responses, request details, optional fields, and HTTP errors.

Changes: Workspace Asset Downloads

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding Workspaces.get_asset to retrieve a presigned asset download URL.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full 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.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant