POIAPIClient
public class POIAPIClient
Manages and sends APIRequests
-
Undocumented
Declaration
Swift
public static var `default`: POIAPIClient -
A list of RequestBehaviours that can be used to monitor and alter all requests
Declaration
Swift
public var behaviours: [POIAPIRequestBehaviour] -
The base url prepended before every request path
Declaration
Swift
public var baseURL: String -
The UrlSession used for each request
Declaration
Swift
public var session: URLSession -
These headers will get added to every request
Declaration
Swift
public var defaultHeaders: [String : String] -
Undocumented
Declaration
Swift
public var jsonDecoder: JSONDecoder -
Undocumented
Declaration
Swift
public var jsonEncoder: JSONEncoder -
Undocumented
Declaration
Swift
public var decodingQueue: DispatchQueue -
Undocumented
Declaration
Swift
public init(baseURL: String, configuration: URLSessionConfiguration = .default, defaultHeaders: [String : String] = [:], behaviours: [POIAPIRequestBehaviour] = []) -
Makes a network request
Declaration
Swift
@discardableResult public func makeRequest<T>(_ request: POIAPIRequest<T>, behaviours: [POIAPIRequestBehaviour] = [], completionQueue: DispatchQueue = DispatchQueue.main, complete: @escaping (POIAPIResponse<T>) -> Void) -> CancellablePOIAPIRequest? where T : APIResponseValueParameters
requestThe API request to make
behavioursA list of behaviours that will be run for this request. Merged with APIClient.behaviours
completionQueueThe queue that complete will be called on
completeA closure that gets passed the POIAPIResponse
Return Value
A cancellable request. Not that cancellation will only work after any validation RequestBehaviours have run
-
Undocumented
Declaration
Swift
static var custom: POIAPIClient
View on GitHub
POIAPIClient Class Reference