File tree Expand file tree Collapse file tree
Sources/ATProtoKit/APIReference/ComAtprotoAPI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ extension ATProtoKit {
2626 /// - collection: The Namespaced Identifier (NSID) of the record.
2727 /// - recordKey: The record key of the record.
2828 /// - recordCID: The CID hash of the record. Optional.
29+ /// - pdsURL: The URL of the Personal Data Server (PDS). Optional. Defaults to `nil`.
2930 /// - Returns: The record itself, as well as its URI and CID.
3031 ///
3132 /// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
@@ -34,9 +35,17 @@ extension ATProtoKit {
3435 from repository: String ,
3536 collection: String ,
3637 recordKey: String ,
37- recordCID: String ? = nil
38+ recordCID: String ? = nil ,
39+ pdsURL: String ? = nil
3840 ) async throws -> ComAtprotoLexicon . Repository . GetRecordOutput {
39- guard let requestURL = URL ( string: " \( self . pdsURL) /xrpc/com.atproto.repo.getRecord " ) else {
41+ let host : String
42+ if let pdsURL, !pdsURL. isEmpty {
43+ host = pdsURL
44+ } else {
45+ host = await resolvePDSHost ( for: repository)
46+ }
47+
48+ guard let requestURL = URL ( string: " \( host) /xrpc/com.atproto.repo.getRecord " ) else {
4049 throw ATRequestPrepareError . invalidRequestURL
4150 }
4251
You can’t perform that action at this time.
0 commit comments