[Feature Enhancement]: Add a URL-returning overload of `getBlob(from:cid:)`
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 52/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- swift
調査の方向性
Start by reading the existing getBlob(from:cid:) implementation and the account PDS endpoint resolution discussed in issue #319. Add a synchronous overload that builds a URL using the resolved PDS endpoint and the supplied DID and CID; done means callers can obtain a URL without downloading the blob as Data. The issue names no relevant test file, so locate tests for getBlob and endpoint resolution before making the change.
索引モデルが issue の本文から書いたものです。
説明
Summary
getBlob(from:cid:) currently returns Data via an async throws call, which is appropriate for saving or exporting a blob. However, display-oriented APIs such as SwiftUI's AsyncImage and AVPlayer require a URL, not Data. A synchronous URL-building overload with the same name would cover this use case without an additional download.
Pain points
Callers that only need a URL for playback or image loading are forced to either:
- Download the full blob as
Dataand convert it toUIImage/NSImage— wasting memory and blocking the async task before display can begin, or - Construct the URL manually from the PDS endpoint string, bypassing the typed API.
Concrete cases where a URL is required by the consuming API:
- SwiftUI
AsyncImage(url:)— displays a blob image (thumbnail, avatar stored as blob, etc.) with built-in lazy loading and caching. AcceptsURL, notData. AVPlayer(url:)— streams a video blob for playback.AVPlayermust be initialised with aURL; passingDatais not supported.
Considered Alternatives
Keeping a raw helper that builds the URL from a PDS endpoint string — this works but lives outside the typed API and requires the caller to manage the endpoint separately.
Is this a breaking change?
No
Additional Context
The com.atproto.sync.getBlob lexicon specifies "output": { "encoding": "*/*" } and notes it is implemented by PDS. The URL-returning overload should therefore resolve the account's PDS endpoint rather than hardcoding a relay (see #319).
The new synchronous overload can construct the correct URL from the resolved PDS endpoint and the provided DID/CID query parameters.
Proposed addition:
public func getBlob(from accountDID: String, cid: String) -> URL?
Swift disambiguates the two overloads at the call site: the existing async throws form is chosen when the caller writes try await, and the new synchronous form is chosen when a URL? is expected without await.
- 主要言語
- Swift
- スター
- 226
- フォーク
- 40
- 平均マージ
- 5時間 8分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MasterJ93/ATProtoKit のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
MasterJ93/ATProtoKit#344 ·
-
new feature
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
MasterJ93/ATProtoKit#321 · コメント 1 件 ·
-
new feature
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
MasterJ93/ATProtoKit#320 · コメント 1 件 ·
-
new feature
難易度 4/5 1〜2日 初心者へのやさしさ 55/100
MasterJ93/ATProtoKit#316 · コメント 1 件 ·
-
new feature
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
MasterJ93/ATProtoKit#216 · コメント 1 件 ·
MasterJ93/ATProtoKit の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
🎉 Add Woundオープン
難易度 1/5 1時間未満 初心者へのやさしさ 77/100
jaywcjlove/awesome-mac#4357 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
VictorKildahl/cra#243 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
OneBusAway/vehicle-positions#260 ·
メンテナーはふだん 1 日以内に返信