Handling API Requests
-
An abstract class that represents a request to the Spotify Web API.
An
See moreSKRequestobject encapsulates the properties of an HTTP request, providing a convenient template for you to create, prepare, and send requests to the Web API. See the API Requests Guide for more details.Declaration
Swift
public class SKRequest
-
The callback handler for a request.
Declaration
Swift
public typealias SKRequestHandler = (_ data: Data?, _ status: SKResponseStatus?, _ error: Error?) -> VoidParameters
dataThe data (typically an encoded JSON object) returned by the request, if any. If the data returned represents an API-specific error object, that object will be provided via the
errorparameter instead.statusThe API-specific HTTP status code associated with the response. If the underlying URL request could not be completed successfully, or the URL response contained an unexpected status code, this parameter will be
nil.errorAn error identifying if and why the request failed, or
nilif the request was successful. -
The callback handler for a request.
Declaration
Swift
public typealias SKDecodableHandler<T> = (_ type: T?, _ error: Error?) -> VoidParameters
typeThe type decoded from the JSON data returned by the request. If the type could not be decoded from the data received, the
errorparameter will provide details.errorAn error identifying if and why the request or decoding failed, or
nilif the request was successful. -
The callback handler for a request.
Declaration
Swift
public typealias SKErrorHandler = (_ error: Error?) -> VoidParameters
errorAn error identifying if and why the request or decoding failed, or
nilif the request was successful.
-
The Response Status Codes used by the Spotify Web API, as defined in the RFC 2616 and RFC 6585.
See moreDeclaration
Swift
public struct SKResponseStatus
-
Declaration
Swift
public struct SKError : Error, JSONDecodable
-
An authentication error returned by the Spotify Web API.
See moreSee also
The Web API Authentication Error object.Declaration
Swift
public struct SKAuthenticationError : Error, JSONDecodable
View on GitHub
Handling API Requests Reference