Request
public struct Request<Model> : Requestable where Model : Decodable
Request representation returned by CoinpaprikaAPI methods. To perform request use .perform() method. It will call callback with error reason or
-
Declaration
Swift
public enum Method : String -
Declaration
Swift
public typealias Params = [String : Any] -
Declaration
Swift
public enum BodyEncoding -
Declaration
Swift
public enum AuthorisationMethod -
Request initializer that may be used if you want to extend client API with another methods
Declaration
Swift
public init(baseUrl: URL, method: Method, path: String, params: Params?, userAgent: String = "Coinpaprika API Client - Swift", bodyEncoding: BodyEncoding = .json, authorisation: AuthorisationMethod = .none)Parameters
baseUrlBase URL containing base path for API, like https://api.coinpaprika.com/v1/
methodHTTP Method
pathendpoint path like tickers/btc-bitcoin
paramsarray of parameters appended in URL Query
-
Perform API request
Declaration
Swift
public func perform(responseQueue: DispatchQueue? = nil, cachePolicy: URLRequest.CachePolicy? = nil, _ callback: @escaping (Result<Model, Error>) -> Void)Parameters
responseQueueThe queue on which the completion handler is dispatched
cachePolicycache policy that should be used in this request
callbackCompletion handler triggered on request success & failure
-
Declaration
Swift
public var description: String { get }
Request Structure Reference