@@ -49,7 +49,7 @@ public class {{ options.name }}Client {
4949 /// - currentRetryCount: The current number of retries for this request due to network connection errors and timeouts
5050 /// - completionQueue: The queue that complete will be called on
5151 /// - complete: A closure that gets passed the {{ options.name }}Response
52- /// - Returns: A cancellable request. Not that cancellation will only work after any validation RequestBehaviours have run
52+ /// - Returns: A cancellable request. Note that cancellation will only work after any validation RequestBehaviours have run
5353 @discardableResult
5454 public func makeRequest< T> ( _ request: { { options. name } } Request< T> ,
5555 behaviours: [ { { options. name } } RequestBehaviour] = [ ] ,
@@ -365,3 +365,28 @@ public class {{ options.name }}Client {
365365 }
366366 }
367367}
368+
369+ @available ( iOS 13 . 0 , watchOS 6 . 0 , * ) @MainActor
370+ public extension { { options. name } } Client {
371+ /// Makes a network request
372+ ///
373+ /// - Parameters:
374+ /// - request: The API request to make
375+ /// - behaviours: A list of behaviours that will be run for this request. Merged with APIClient.behaviours
376+ /// - currentUnauthorizedRetryCount: The current number of retries for this request due to `401` responses
377+ /// - currentRetryCount: The current number of retries for this request due to network connection errors and timeouts
378+ /// - Returns: An asynchronously-delivered result that either contains the response of the request
379+ func makeRequest< T> ( _ request: { { options. name } } Request< T> ,
380+ behaviours: [ { { options. name } } RequestBehaviour] = [ ] ,
381+ currentUnauthorizedRetryCount: Int = 0 ,
382+ currentRetryCount: Int = 0 ) async -> { { options. name } } Response< T> {
383+ await withCheckedContinuation { [ weak self] continuation in
384+ _ = self ? . makeRequest ( request, behaviours: behaviours,
385+ currentUnauthorizedRetryCount: currentUnauthorizedRetryCount,
386+ currentRetryCount: currentRetryCount,
387+ complete: { response in
388+ continuation. resume ( returning: response)
389+ } )
390+ }
391+ }
392+ }
0 commit comments