APIRequest
public struct APIRequest<Model>
A bridge between API request call and a set of completions closures.
Completions are run after the call is finished in the reversed order.
Note
Completions chain is used to provide authorization before a real call.-
Executes a request and eventually calls all completions closures in reversed order on a main thread.
Declaration
Swift
public mutating func execute(append completion: @escaping (APIResult<Model>) -> Void)
Parameters
completion
closure appended to a completions set (and in the result called as the first one when request finishes). Can return
APIResult.failure
withAPIError.invalidResponseFormat
ifsuccessHandler
is not able to parse a response.