mount public data from the atmosphere to a virtual filesystem (macos only) pdfs.at
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(atproto): add listBlobs typed endpoint

+39
+6
Packages/ATProto/Sources/ATProto/XRPC/ListBlobsOutput.swift
··· 1 + import Foundation 2 + 3 + public struct ListBlobsOutput: Decodable, Sendable, Equatable { 4 + public let cids: [String] 5 + public let cursor: String? 6 + }
+17
Packages/ATProto/Sources/ATProto/XRPC/XRPCEndpoints.swift
··· 40 40 return try await get(nsid: "com.atproto.repo.getRecord", params: params) 41 41 } 42 42 } 43 + 44 + // MARK: - listBlobs 45 + 46 + public extension XRPCClient { 47 + func listBlobs( 48 + did: String, 49 + limit: Int? = nil, 50 + cursor: String? = nil, 51 + since: String? = nil 52 + ) async throws -> ListBlobsOutput { 53 + var params: [String: String] = ["did": did] 54 + if let limit { params["limit"] = String(limit) } 55 + if let cursor { params["cursor"] = cursor } 56 + if let since { params["since"] = since } 57 + return try await get(nsid: "com.atproto.sync.listBlobs", params: params) 58 + } 59 + }
+16
Packages/ATProto/Tests/ATProtoTests/XRPCEndpointsTests.swift
··· 71 71 let pretty = String(data: out.value, encoding: .utf8)! 72 72 #expect(pretty.contains("\"hello\"")) 73 73 } 74 + 75 + @Test("listBlobs returns CIDs + cursor") 76 + func listBlobs() async throws { 77 + let (client, session) = makeClient { request in 78 + #expect(request.url?.path == "/xrpc/com.atproto.sync.listBlobs") 79 + let q = request.url?.query ?? "" 80 + #expect(q.contains("did=did:plc:abc")) 81 + #expect(q.contains("limit=500")) 82 + return .json(#"{"cids":["bafkreia","bafkreib"],"cursor":"c1"}"#) 83 + } 84 + defer { URLProtocolStub.reset(session: session) } 85 + 86 + let out = try await client.listBlobs(did: "did:plc:abc", limit: 500, cursor: nil, since: nil) 87 + #expect(out.cids == ["bafkreia", "bafkreib"]) 88 + #expect(out.cursor == "c1") 89 + } 74 90 }