@@ -478,6 +478,60 @@ public final class Client {
478478 return newClient
479479 }
480480
481+ @available( * , deprecated, message: " This function will be removed on d14n cutover. Use connectToApiBackend instead. " )
482+ public static func connectToApiBackendExclusive( api: ClientOptions . Api)
483+ async throws
484+ -> XmtpApiClient
485+ {
486+ let cacheKey = ApiCacheKey ( api: api) . stringValue
487+
488+ // Check for an existing connected client
489+ if let cached = await apiCache. getClient ( forKey: cacheKey) ,
490+ try await isConnected ( api: cached)
491+ {
492+ return cached
493+ }
494+
495+ // Either not cached or not connected; create new client
496+ let newClient = try await connectToBackendExclusive (
497+ v3Host: api. env. url,
498+ gatewayHost: api. gatewayHost,
499+ clientMode: FfiClientMode . default,
500+ appVersion: api. appVersion,
501+ authCallback: nil ,
502+ authHandle: nil
503+ )
504+ await apiCache. setClient ( newClient, forKey: cacheKey)
505+ return newClient
506+ }
507+
508+ @available( * , deprecated, message: " This function will be removed on d14n cutover. Use connectToSyncApiBackend instead. " )
509+ public static func connectToSyncApiBackendExclusive( api: ClientOptions . Api)
510+ async throws
511+ -> XmtpApiClient
512+ {
513+ let cacheKey = ApiCacheKey ( api: api) . stringValue
514+
515+ // Check for an existing connected client
516+ if let cached = await apiCache. getSyncClient ( forKey: cacheKey) ,
517+ try await isConnected ( api: cached)
518+ {
519+ return cached
520+ }
521+
522+ // Either not cached or not connected; create new client
523+ let newClient = try await connectToBackendExclusive (
524+ v3Host: api. env. url,
525+ gatewayHost: api. gatewayHost,
526+ clientMode: FfiClientMode . default,
527+ appVersion: api. appVersion,
528+ authCallback: nil ,
529+ authHandle: nil
530+ )
531+ await apiCache. setSyncClient ( newClient, forKey: cacheKey)
532+ return newClient
533+ }
534+
481535 public static func getOrCreateInboxId(
482536 api: ClientOptions . Api, publicIdentity: PublicIdentity
483537 ) async throws -> InboxId {
0 commit comments