TeraRuntimeTodayClient.swift (1627B)
1 import Foundation 2 3 extension TeraRuntimeClient { 4 func reconcileToday(request: TeraTodayReconcileRequest) async throws -> TeraTodayPage { 5 do { 6 return try await runtimeOperation("runtime.today.reconcile") { backend in 7 try await backend.reconcileToday(request: request) 8 } 9 } catch let error as TeraRuntimeClientError { 10 throw error 11 } catch { 12 throw TeraRuntimeClientError.today(Self.failure(from: error, operation: "runtime.today.reconcile")) 13 } 14 } 15 16 func todayPage(request: TeraTodayPageRequest) async throws -> TeraTodayPage { 17 do { 18 return try await runtimeOperation("runtime.today.page") { backend in 19 try await backend.todayPage(request: request) 20 } 21 } catch let error as TeraRuntimeClientError { 22 throw error 23 } catch { 24 throw TeraRuntimeClientError.today( 25 Self.failure(from: error, operation: "runtime.today.page") 26 ) 27 } 28 } 29 30 func refreshToday( 31 context: TeraLocalNetwork, 32 nowUnixSeconds: UInt64, 33 update: TeraTodayProjectionUpdate = .incremental, 34 backfillCursor: String? = nil 35 ) async throws -> TeraTodaySyncReceipt { 36 do { 37 return try await runtimeOperation("runtime.today.refresh") { backend in 38 try await backend.refreshToday( 39 context: context, 40 nowUnixSeconds: nowUnixSeconds, 41 update: update, backfillCursor: backfillCursor 42 ) 43 } 44 } catch let error as TeraRuntimeClientError { 45 throw error 46 } catch { 47 throw TeraRuntimeClientError.today( 48 Self.failure(from: error, operation: "runtime.today.refresh") 49 ) 50 } 51 } 52 }