From b1831844e4c0e0773e09e3c2dc801b9a99d6fc71 Mon Sep 17 00:00:00 2001 From: Mark Xue Date: Tue, 27 Oct 2026 19:42:52 -0700 Subject: [PATCH 1/3] Apply Swift API guidelines to AtprotoClient --- .changeset/swift-api-guidelines.md | 5 ++ Package.resolved | 10 ++-- Package.swift | 9 +--- .../Agent/Agents/BskyAppAgent.swift | 4 +- .../Capabilities/XRPCProxyCallable.swift | 4 +- .../Agent/XRPCRequestComponents.swift | 4 +- Sources/AtprotoClient/BskyCDN.swift | 2 +- .../Lexicon/AppBsky/Actor/GetProfile.swift | 2 +- .../Lexicon/AppBsky/Actor/GetProfiles.swift | 2 +- .../Lexicon/AppBsky/Graph/GetBlocks.swift | 2 +- .../Lexicon/AppBsky/Graph/GetFollowers.swift | 2 +- .../Lexicon/AppBsky/Graph/GetFollows.swift | 2 +- .../AppBsky/Graph/GetKnownFollowers.swift | 2 +- .../AppBsky/Graph/GetRelationships.swift | 2 +- Sources/AtprotoClient/Resolver.swift | 4 +- Sources/AtprotoClient/XRPC/Procedure.swift | 2 +- Sources/AtprotoClient/XRPC/Request.swift | 2 +- .../AtprotoClientMocks/MockPDS/MockPDS.swift | 48 +++++++++---------- .../AtprotoClientMocks/MockPDS/MockRepo.swift | 6 +-- Tests/AtprotoClientTests/BskyCDNTests.swift | 8 ++-- .../PutRecordSwapTests.swift | 4 +- 21 files changed, 63 insertions(+), 63 deletions(-) create mode 100644 .changeset/swift-api-guidelines.md diff --git a/.changeset/swift-api-guidelines.md b/.changeset/swift-api-guidelines.md new file mode 100644 index 0000000..08fc690 --- /dev/null +++ b/.changeset/swift-api-guidelines.md @@ -0,0 +1,5 @@ +--- +"AtprotoClient": minor +--- + +Adopt Swift naming conventions in XRPC query parameters, CID string access, and optional unwrapping. See the upstream dependency changesets for the new names and compatibility period. diff --git a/Package.resolved b/Package.resolved index cdd0494..55f77dc 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "fb002b0e1e109d1ba8d2d8be2bda715292effc75a7594d92e7ca8102617db45d", + "originHash" : "1deeaac1bafe9bbeb43c22f940c90d7a0044fda4a840e20f2c18ff8245303518", "pins" : [ { "identity" : "atprototypes", "kind" : "remoteSourceControl", "location" : "https://github.com/germ-network/AtprotoTypes.git", "state" : { - "revision" : "ecb21a26d61befd5cf41927e5a64af9e89bd162e", - "version" : "0.8.0" + "branch" : "mark/api-guidelines-atprototypes", + "revision" : "dfefaa6d4c9069f7e5bcfe4270d0a53398a12f6d" } }, { @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/germ-network/GermConvenience.git", "state" : { - "revision" : "93816f6efe28ecf5dfb6141dfa3e770449777de2", - "version" : "0.14.0" + "branch" : "mark/ger-3167-germconvenience", + "revision" : "8e2b7cba3a27381885c36e169a146a93662b55c9" } }, { diff --git a/Package.swift b/Package.swift index 26b9c6a..21306e5 100644 --- a/Package.swift +++ b/Package.swift @@ -17,16 +17,11 @@ let package = Package( dependencies: [ .package( url: "https://github.com/germ-network/AtprotoTypes.git", - // 0.8.0: Atproto.RecordSwap, for putRecord's explicit-null swapRecord. - from: "0.8.0" + branch: "mark/api-guidelines-atprototypes" ), .package( url: "https://github.com/germ-network/GermConvenience.git", - // 0.14.0: RedirectRefusingHTTPFetcher, required by the resolvers that - // screen a host once before fetching. 0.13.0 moved the URLSession - // conformers into GermConvenienceURLSession, so the portable targets - // here no longer reach URLSession. - from: "0.14.0" + branch: "mark/ger-3167-germconvenience" ), .package( url: "https://github.com/apple/swift-crypto.git", diff --git a/Sources/AtprotoClient/Agent/Agents/BskyAppAgent.swift b/Sources/AtprotoClient/Agent/Agents/BskyAppAgent.swift index 5d7e81d..547d722 100644 --- a/Sources/AtprotoClient/Agent/Agents/BskyAppAgent.swift +++ b/Sources/AtprotoClient/Agent/Agents/BskyAppAgent.swift @@ -32,14 +32,14 @@ public struct BskyAppViewAgent { public static func blackskyAppView(resourceFetcher: HTTPFetcher) throws -> Self { try .init( - serviceUrl: try URL(string: "https://api.blacksky.community").tryUnwrap, + serviceUrl: try URL(string: "https://api.blacksky.community").unwrapped, resourceFetcher: resourceFetcher ) } public static func blueskyAppView(resourceFetcher: HTTPFetcher) throws -> Self { try .init( - serviceUrl: try URL(string: "https://public.api.bsky.app").tryUnwrap, + serviceUrl: try URL(string: "https://public.api.bsky.app").unwrapped, resourceFetcher: resourceFetcher ) } diff --git a/Sources/AtprotoClient/Agent/Capabilities/XRPCProxyCallable.swift b/Sources/AtprotoClient/Agent/Capabilities/XRPCProxyCallable.swift index b4a28a7..a1035f3 100644 --- a/Sources/AtprotoClient/Agent/Capabilities/XRPCProxyCallable.swift +++ b/Sources/AtprotoClient/Agent/Capabilities/XRPCProxyCallable.swift @@ -21,7 +21,7 @@ extension Atproto.XRPC.ProxyCallable { ) async throws -> X.Output { var request = try constructRequest(request, parameters: parameters) - request.headers[try .atprotoProxy.tryUnwrap] = proxy.headerValue + request.headers[try .atprotoProxy.unwrapped] = proxy.headerValue return try await response(request) .parse(X.self) @@ -39,7 +39,7 @@ extension Atproto.XRPC.ProxyCallable { input: input ) - request.headers[try .atprotoProxy.tryUnwrap] = proxy.headerValue + request.headers[try .atprotoProxy.unwrapped] = proxy.headerValue return try await response(request) .parse(X.self) diff --git a/Sources/AtprotoClient/Agent/XRPCRequestComponents.swift b/Sources/AtprotoClient/Agent/XRPCRequestComponents.swift index 1bc5d3c..2ec9807 100644 --- a/Sources/AtprotoClient/Agent/XRPCRequestComponents.swift +++ b/Sources/AtprotoClient/Agent/XRPCRequestComponents.swift @@ -37,7 +37,7 @@ public struct XRPCRequestComponents: Sendable { var components = try URLComponents( url: serviceUrl, resolvingAgainstBaseURL: false - ).tryUnwrap + ).unwrapped //xrpc path must be top-level, not below a prefix //https://atproto.com/specs/xrpc @@ -47,7 +47,7 @@ public struct XRPCRequestComponents: Sendable { return try .init( method: method, - url: components.url.tryUnwrap, + url: components.url.unwrapped, headerFields: headers, body: body ) diff --git a/Sources/AtprotoClient/BskyCDN.swift b/Sources/AtprotoClient/BskyCDN.swift index b248650..21ae5a1 100644 --- a/Sources/AtprotoClient/BskyCDN.swift +++ b/Sources/AtprotoClient/BskyCDN.swift @@ -53,7 +53,7 @@ extension Atproto { // set through `percentEncodedPath` instead, on an already-escaped // string. built.percentEncodedPath = - "/img/\(kind.rawValue)/plain/\(try Self.pathSegment(did.rawValue))/\(try Self.pathSegment(blob.ref.link.string))@jpeg" + "/img/\(kind.rawValue)/plain/\(try Self.pathSegment(did.rawValue))/\(try Self.pathSegment(blob.ref.link.rawValue))@jpeg" guard let url = built.url else { throw Errors.invalidHost } diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfile.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfile.swift index 83e83b4..e1230ee 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfile.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfile.swift @@ -33,7 +33,7 @@ extension Lexicon.App.Bsky.Actor { self.actor = actor } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { [.init(name: "actor", value: actor.rawValue)] } } diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfiles.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfiles.swift index 11b835f..2539625 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfiles.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Actor/GetProfiles.swift @@ -32,7 +32,7 @@ extension Lexicon.App.Bsky.Actor { self.actor = actor } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { [.init(name: "actor", value: actor.rawValue)] } } diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetBlocks.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetBlocks.swift index fb7eea9..e3d00e9 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetBlocks.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetBlocks.swift @@ -51,7 +51,7 @@ extension Lexicon.App.Bsky.Graph { } } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { var base: [URLQueryItem] = [] if let limit { base.append(.init(name: "limit", value: limit.description)) diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollowers.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollowers.swift index e3e7418..408dbc3 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollowers.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollowers.swift @@ -54,7 +54,7 @@ extension Lexicon.App.Bsky.Graph { } } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { var base: [URLQueryItem] = [ .init(name: "actor", value: actor.rawValue) ] diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollows.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollows.swift index 3cbb91b..2adbb3b 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollows.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetFollows.swift @@ -54,7 +54,7 @@ extension Lexicon.App.Bsky.Graph { } } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { var base: [URLQueryItem] = [ .init(name: "actor", value: actor.rawValue) ] diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetKnownFollowers.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetKnownFollowers.swift index fa760d2..a5ccb98 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetKnownFollowers.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetKnownFollowers.swift @@ -54,7 +54,7 @@ extension Lexicon.App.Bsky.Graph { } } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { var base: [URLQueryItem] = [ .init(name: "actor", value: actor.rawValue) ] diff --git a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetRelationships.swift b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetRelationships.swift index 7366c81..f9b9eee 100644 --- a/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetRelationships.swift +++ b/Sources/AtprotoClient/Lexicon/AppBsky/Graph/GetRelationships.swift @@ -43,7 +43,7 @@ extension Lexicon.App.Bsky.Graph { self.others = others } - public func asQueryItems() -> [URLQueryItem] { + public var queryItems: [URLQueryItem] { [URLQueryItem(name: "actor", value: actor.rawValue)] + (others ?? []) .map { diff --git a/Sources/AtprotoClient/Resolver.swift b/Sources/AtprotoClient/Resolver.swift index 47519d3..da951b9 100644 --- a/Sources/AtprotoClient/Resolver.swift +++ b/Sources/AtprotoClient/Resolver.swift @@ -38,7 +38,7 @@ extension Atproto.Resolver { } //if a did doc doesn't resolve it's an error - return try await resolve(did: did).tryUnwrap + return try await resolve(did: did).unwrapped .verified(expecting: handle, did: did) } @@ -52,7 +52,7 @@ extension Atproto.Resolver { try await resolve(did: did)? .verified { unverifiedHandle in try await resolve(handle: unverifiedHandle) - .tryUnwrap + .unwrapped } } } diff --git a/Sources/AtprotoClient/XRPC/Procedure.swift b/Sources/AtprotoClient/XRPC/Procedure.swift index bbfb2a4..0a5fecb 100644 --- a/Sources/AtprotoClient/XRPC/Procedure.swift +++ b/Sources/AtprotoClient/XRPC/Procedure.swift @@ -53,7 +53,7 @@ extension Atproto.XRPC.Callable { return .init( relativePath: "/xrpc/" + X.Id.nsid.rawValue, - queryItems: queryParams.asQueryItems(), + queryItems: queryParams.queryItems, headers: headerFields, method: .post, body: try X.Input.encode(input.schema) diff --git a/Sources/AtprotoClient/XRPC/Request.swift b/Sources/AtprotoClient/XRPC/Request.swift index b08dac1..98a9a55 100644 --- a/Sources/AtprotoClient/XRPC/Request.swift +++ b/Sources/AtprotoClient/XRPC/Request.swift @@ -29,7 +29,7 @@ extension Atproto.XRPC.Callable { ) throws -> XRPCRequestComponents { .init( relativePath: "/xrpc/" + X.Id.nsid.rawValue, - queryItems: parameters.asQueryItems(), + queryItems: parameters.queryItems, headers: .init( dictionaryLiteral: (.accept, X.outputEncoding.rawValue) ), diff --git a/Sources/AtprotoClientMocks/MockPDS/MockPDS.swift b/Sources/AtprotoClientMocks/MockPDS/MockPDS.swift index b18b44a..1ee6443 100644 --- a/Sources/AtprotoClientMocks/MockPDS/MockPDS.swift +++ b/Sources/AtprotoClientMocks/MockPDS/MockPDS.swift @@ -20,7 +20,7 @@ public actor MockPDS { public init() throws { self.serviceUrl = try URL( string: "https://\(UUID().uuidString).example.com" - ).tryUnwrap + ).unwrapped } public func host( @@ -68,12 +68,12 @@ public actor MockPDS { authedDid: Atproto.DID? ) async throws -> HTTPDataResponse { let request = try requestComponents.constructUrl(serviceUrl: serviceUrl) - let requestUrl = try request.request.url.tryUnwrap + let requestUrl = try request.request.url.unwrapped let components = try URLComponents( url: requestUrl, resolvingAgainstBaseURL: false - ).tryUnwrap + ).unwrapped let pathComponents = requestUrl.pathComponents @@ -113,7 +113,7 @@ public actor MockPDS { } return try await createRecord( - authedDid: authedDid, bodyData: body.tryUnwrap + authedDid: authedDid, bodyData: body.unwrapped ) case Lexicon.Com.Atproto.Repo.PutRecordNSID.nsid: @@ -122,7 +122,7 @@ public actor MockPDS { } return try await putRecord( - authedDid: authedDid, bodyData: body.tryUnwrap + authedDid: authedDid, bodyData: body.unwrapped ) case Lexicon.Com.Atproto.Repo.DeleteRecordNSID.nsid: @@ -131,7 +131,7 @@ public actor MockPDS { } return try await deleteRecord( - authedDid: authedDid, bodyData: body.tryUnwrap + authedDid: authedDid, bodyData: body.unwrapped ) default: return try .mock(error: "InvalidRequest", status: 400) @@ -178,9 +178,9 @@ public actor MockPDS { public func getRecord( queryItems: [URLQueryItem]?, ) async throws -> HTTPDataResponse { - let repoParam = try (queryItems?["repo"]).tryUnwrap - let collection = try (queryItems?["collection"]).tryUnwrap - let encodedRkey = try (queryItems?["rkey"]).tryUnwrap + let repoParam = try (queryItems?["repo"]).unwrapped + let collection = try (queryItems?["collection"]).unwrapped + let encodedRkey = try (queryItems?["rkey"]).unwrapped let cid = queryItems?["cid"] let typedCid: Atproto.CID? = try { guard let cid else { @@ -210,7 +210,7 @@ public actor MockPDS { error: "InvalidRequest", message: failure.bodyString ?? "Mock Error" ), - status: .init(code: failure.code) + status: .init(code: failure.statusCode) ) } } @@ -218,8 +218,8 @@ public actor MockPDS { private func listRecords( queryItems: [URLQueryItem]? ) async throws -> HTTPDataResponse { - let repoParam = try (queryItems?["repo"]).tryUnwrap - let collection = try (queryItems?["collection"]).tryUnwrap + let repoParam = try (queryItems?["repo"]).unwrapped + let collection = try (queryItems?["collection"]).unwrapped let limit = queryItems?["limit"] let cursor = queryItems?["cursor"] let reverse = queryItems?["reverse"] @@ -265,7 +265,7 @@ public actor MockPDS { //hacky, but type-erases the record type let input = try JSONSerialization.jsonObject(with: bodyData) - let inputDict = try (input as? [String: Any]).tryUnwrap + let inputDict = try (input as? [String: Any]).unwrapped //The lexicon's optional rkey is deliberately NOT modeled. Honoring it //without also modeling the already-exists failure would just be putRecord @@ -286,7 +286,7 @@ public actor MockPDS { let encodedRecord = try JSONSerialization - .data(withJSONObject: inputDict["record"].tryUnwrap) + .data(withJSONObject: inputDict["record"].unwrapped) try await repo.createRecord( collection: protoSchema.collection, @@ -302,7 +302,7 @@ public actor MockPDS { collection: protoSchema.collection, rkey: rkey ), - cid: Atproto.CID.mock().string, + cid: Atproto.CID.mock().rawValue, commit: try .mock(), validationStatus: .valid ) @@ -329,12 +329,12 @@ public actor MockPDS { //hacky, but type-erases the record type let input = try JSONSerialization.jsonObject(with: bodyData) - let inputDict = try (input as? [String: Any]).tryUnwrap - let inputRkey = try (inputDict["rkey"] as? String).tryUnwrap + let inputDict = try (input as? [String: Any]).unwrapped + let inputRkey = try (inputDict["rkey"] as? String).unwrapped let encodedRecord = try JSONSerialization - .data(withJSONObject: inputDict["record"].tryUnwrap) + .data(withJSONObject: inputDict["record"].unwrapped) try await repo.putRecord( collection: protoSchema.collection, @@ -348,7 +348,7 @@ public actor MockPDS { collection: protoSchema.collection, rkey: inputRkey ), - cid: Atproto.CID.mock().string, + cid: Atproto.CID.mock().rawValue, commit: try .mock(), validationStatus: .valid ) @@ -436,13 +436,13 @@ extension MockPDS { public func getGraph(did: Atproto.DID) async throws -> ( [Lexicon.App.Bsky.Graph.Follow], [Lexicon.App.Bsky.Graph.Block] ) { - try await repos[did].tryUnwrap + try await repos[did].unwrapped .getGraph() } public func getBskyProfile(did: Atproto.DID) async throws -> Lexicon.App.Bsky.Actor.Profile? { - try await repos[did].tryUnwrap + try await repos[did].unwrapped .getTypedRecord( collection: Lexicon.App.Bsky.Actor.Profile.Collection.nsid, encodedRkey: "self", @@ -453,19 +453,19 @@ extension MockPDS { public func follow(did: Atproto.DID, from viewer: Atproto.DID) async throws { try await repos[viewer] - .tryUnwrap + .unwrapped .follow(did: did) } public func block(did: Atproto.DID, from viewer: Atproto.DID) async throws { try await repos[viewer] - .tryUnwrap + .unwrapped .block(did: did) } public func unfollow(did: Atproto.DID, from viewer: Atproto.DID) async throws { try await repos[viewer] - .tryUnwrap + .unwrapped .unfollow(did: did) } } diff --git a/Sources/AtprotoClientMocks/MockPDS/MockRepo.swift b/Sources/AtprotoClientMocks/MockPDS/MockRepo.swift index 9cd6522..70e7756 100644 --- a/Sources/AtprotoClientMocks/MockPDS/MockRepo.swift +++ b/Sources/AtprotoClientMocks/MockPDS/MockRepo.swift @@ -96,7 +96,7 @@ extension MockRepo { return nil } - let anyType = try dict["value"].tryUnwrap + let anyType = try dict["value"].unwrapped let encoded = try JSONSerialization.data(withJSONObject: anyType, options: []) return try JSONDecoder().decode(R.self, from: encoded) @@ -116,7 +116,7 @@ extension MockRepo { return [ "uri": recordUri(collection: collection, rkey: encodedRkey), - "cid": Atproto.CID.mock().string, + "cid": Atproto.CID.mock().rawValue, "value": try JSONSerialization.jsonObject(with: record), ] } @@ -188,7 +188,7 @@ extension MockRepo { .map { (key, encodedRecord) in [ "uri": recordUri(collection: collection, rkey: key), - "cid": Atproto.CID.mock().string, + "cid": Atproto.CID.mock().rawValue, "value": try JSONSerialization .jsonObject(with: encodedRecord), diff --git a/Tests/AtprotoClientTests/BskyCDNTests.swift b/Tests/AtprotoClientTests/BskyCDNTests.swift index d3212c8..c3a16e0 100644 --- a/Tests/AtprotoClientTests/BskyCDNTests.swift +++ b/Tests/AtprotoClientTests/BskyCDNTests.swift @@ -23,7 +23,7 @@ import Testing #expect( url.absoluteString - == "https://cdn.bsky.app/img/avatar/plain/\(did.rawValue)/\(cid.string)@jpeg" + == "https://cdn.bsky.app/img/avatar/plain/\(did.rawValue)/\(cid.rawValue)@jpeg" ) } @@ -38,7 +38,7 @@ import Testing #expect( url.absoluteString - == "https://cdn.example.net/img/banner/plain/\(did.rawValue)/\(cid.string)@jpeg" + == "https://cdn.example.net/img/banner/plain/\(did.rawValue)/\(cid.rawValue)@jpeg" ) } @@ -72,7 +72,7 @@ import Testing #expect( url.absoluteString - == "https://cdn.bsky.app/img/avatar/plain/\(did.rawValue)/\(cid.string)@jpeg" + == "https://cdn.bsky.app/img/avatar/plain/\(did.rawValue)/\(cid.rawValue)@jpeg" ) } @@ -85,7 +85,7 @@ import Testing #expect(did.rawValue.contains("@")) let pathAfterDID = url.absoluteString.components(separatedBy: "/").last ?? "" - #expect(pathAfterDID == "\(cid.string)@jpeg") + #expect(pathAfterDID == "\(cid.rawValue)@jpeg") #expect(url.absoluteString.contains("%40")) } diff --git a/Tests/AtprotoClientTests/PutRecordSwapTests.swift b/Tests/AtprotoClientTests/PutRecordSwapTests.swift index bef797b..4cd77f2 100644 --- a/Tests/AtprotoClientTests/PutRecordSwapTests.swift +++ b/Tests/AtprotoClientTests/PutRecordSwapTests.swift @@ -61,8 +61,8 @@ struct PutRecordSwapTests { func recordSwapSendsCidSwapRecord() async throws { let cid = try Atproto.CID(string: Self.cidString) let body = try await sentBody(swap: .record(cid), swapCommit: cid) - #expect(body["swapRecord"] as? String == cid.string) - #expect(body["swapCommit"] as? String == cid.string) + #expect(body["swapRecord"] as? String == cid.rawValue) + #expect(body["swapCommit"] as? String == cid.rawValue) } @Test From 3f0ace73cb6c1cdfb78a590c81625ce30b4950cf Mon Sep 17 00:00:00 2001 From: Mark Xue Date: Tue, 27 Oct 2026 21:55:18 -0700 Subject: [PATCH 2/3] Repin AtprotoClient preview dependencies --- .changeset/swift-api-guidelines.md | 4 ++-- Package.resolved | 9 ++++----- Package.swift | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.changeset/swift-api-guidelines.md b/.changeset/swift-api-guidelines.md index 08fc690..15800cb 100644 --- a/.changeset/swift-api-guidelines.md +++ b/.changeset/swift-api-guidelines.md @@ -1,5 +1,5 @@ --- -"AtprotoClient": minor +"@germ-network/atprotoclient": minor --- -Adopt Swift naming conventions in XRPC query parameters, CID string access, and optional unwrapping. See the upstream dependency changesets for the new names and compatibility period. +Adopt Swift naming conventions in XRPC query parameters, CID string access, and optional unwrapping. Pin AtprotoTypes to the merged API update and GermConvenience to 0.15.0. See the upstream dependency changesets for the new names and compatibility period. diff --git a/Package.resolved b/Package.resolved index 55f77dc..f086909 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,12 @@ { - "originHash" : "1deeaac1bafe9bbeb43c22f940c90d7a0044fda4a840e20f2c18ff8245303518", + "originHash" : "b7e50733b560451eaf7705e3b0082b50b69a06f083db15a1bf1fe563b978888b", "pins" : [ { "identity" : "atprototypes", "kind" : "remoteSourceControl", "location" : "https://github.com/germ-network/AtprotoTypes.git", "state" : { - "branch" : "mark/api-guidelines-atprototypes", - "revision" : "dfefaa6d4c9069f7e5bcfe4270d0a53398a12f6d" + "revision" : "16d75d5888225701a8e568d110ae640c3b6e1eef" } }, { @@ -15,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/germ-network/GermConvenience.git", "state" : { - "branch" : "mark/ger-3167-germconvenience", - "revision" : "8e2b7cba3a27381885c36e169a146a93662b55c9" + "revision" : "6f9f44970d38889a02e8c3b2e51d0261c67237e2", + "version" : "0.15.0" } }, { diff --git a/Package.swift b/Package.swift index 21306e5..6f68ba7 100644 --- a/Package.swift +++ b/Package.swift @@ -17,11 +17,11 @@ let package = Package( dependencies: [ .package( url: "https://github.com/germ-network/AtprotoTypes.git", - branch: "mark/api-guidelines-atprototypes" + revision: "16d75d5888225701a8e568d110ae640c3b6e1eef" ), .package( url: "https://github.com/germ-network/GermConvenience.git", - branch: "mark/ger-3167-germconvenience" + from: "0.15.0" ), .package( url: "https://github.com/apple/swift-crypto.git", From ea4e6ce6166e69aec344ab34bdbb5ce024dd2a19 Mon Sep 17 00:00:00 2001 From: Mark Xue Date: Tue, 27 Oct 2026 22:43:35 -0700 Subject: [PATCH 3/3] Repin AtprotoTypes to 0.11.0 --- Package.resolved | 5 +++-- Package.swift | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Package.resolved b/Package.resolved index f086909..b62f4c0 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,12 +1,13 @@ { - "originHash" : "b7e50733b560451eaf7705e3b0082b50b69a06f083db15a1bf1fe563b978888b", + "originHash" : "0910ae48d4c3fa9158ef063354bac00366272d3ce2a18decccf1f28d5aabcc70", "pins" : [ { "identity" : "atprototypes", "kind" : "remoteSourceControl", "location" : "https://github.com/germ-network/AtprotoTypes.git", "state" : { - "revision" : "16d75d5888225701a8e568d110ae640c3b6e1eef" + "revision" : "c129e67243aa5327926e0991e6c16f61790fcd79", + "version" : "0.11.0" } }, { diff --git a/Package.swift b/Package.swift index 6f68ba7..8d441a4 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,8 @@ let package = Package( dependencies: [ .package( url: "https://github.com/germ-network/AtprotoTypes.git", - revision: "16d75d5888225701a8e568d110ae640c3b6e1eef" + // 0.11.0 includes the Swift API naming updates. + from: "0.11.0" ), .package( url: "https://github.com/germ-network/GermConvenience.git", @@ -59,7 +60,9 @@ let package = Package( dependencies: [ "AtprotoClient", "AtprotoClientMocks", .product(name: "GermConvenienceHTTP", package: "GermConvenience"), - .product(name: "GermConvenienceURLSession", package: "GermConvenience"), + .product( + name: "GermConvenienceURLSession", + package: "GermConvenience"), ] ), ]