[Feature Enhancement]: Add a URL-returning overload of `getBlob(from:cid:)`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- swift
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Swift
- Star
- 226
- Fork
- 40
- Merge trung bình
- 5 giờ 8 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MasterJ93/ATProtoKit
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
MasterJ93/ATProtoKit#344 ·
-
new feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
MasterJ93/ATProtoKit#321 · 1 bình luận ·
-
new feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
MasterJ93/ATProtoKit#320 · 1 bình luận ·
-
new feature
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
MasterJ93/ATProtoKit#316 · 1 bình luận ·
-
new feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
MasterJ93/ATProtoKit#216 · 1 bình luận ·
Tất cả issue của MasterJ93/ATProtoKit
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
🎉 Add WoundĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 77/100
jaywcjlove/awesome-mac#4357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Bug: on hover a tab's name in Cra stops ~16 pt short of Arc's, with 24 pt of air before the ✕Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
VictorKildahl/cra#243 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
OneBusAway/vehicle-positions#260 ·
Maintainer thường phản hồi trong vòng 1 ngày