|
|
|
|
@ -216,7 +216,7 @@ actor ApiCallCollection<T: Storable>: SomeCallCollection { |
|
|
|
|
|
|
|
|
|
/// Returns an APICall instance for the Storable [instance] and an HTTP [method] |
|
|
|
|
/// The method updates existing calls or creates a new one |
|
|
|
|
fileprivate func _callForInstance(_ instance: T, method: HTTPMethod) throws -> ApiCall<T>? { |
|
|
|
|
fileprivate func _callForInstance(_ instance: T, method: HTTPMethod) async throws -> ApiCall<T>? { |
|
|
|
|
|
|
|
|
|
if let existingCall = self.items.first(where: { $0.dataId == instance.stringId }) { |
|
|
|
|
switch method { |
|
|
|
|
@ -293,7 +293,7 @@ actor ApiCallCollection<T: Storable>: SomeCallCollection { |
|
|
|
|
|
|
|
|
|
/// Initiates the process of sending the data with the server |
|
|
|
|
fileprivate func _synchronize<V: Decodable>(_ instance: T, method: HTTPMethod) async throws -> V? { |
|
|
|
|
if let apiCall = try self._callForInstance(instance, method: method) { |
|
|
|
|
if let apiCall = try await self._callForInstance(instance, method: method) { |
|
|
|
|
self._prepareCall(apiCall: apiCall) |
|
|
|
|
return try await self._executeApiCall(apiCall) |
|
|
|
|
} else { |
|
|
|
|
|