UsherAPIRequestConfiguration

public struct UsherAPIRequestConfiguration : APIRequestConfigurationType

An APIRequestConfigurationType that configures API requirements for the Usher Server either by providing an UsherAPITask at initialization or initializing with a server and device instance. This class will also automatically configure other properties required by the Usher Server such as access token, location, device and OS info, locale, timezone and time.

  • Usher device

    Declaration

    Swift

    public var device: Device?
  • Usher Server

    Declaration

    Swift

    public var server: Server? { get set }
  • Server host address string

    Declaration

    Swift

    public var host: String?
  • URL path

    Declaration

    Swift

    public var path: String
  • Http method

    Declaration

    Swift

    public var method: HTTPMethod
  • Custom API header fields. By default, this class adds User-Agent, Authorization, Accept, Accept-Encoding and Content-Type fields

    Declaration

    Swift

    public var customHeaders: [String : String]
  • Multipart form data

    Declaration

    Swift

    public var multipartFormData: MultipartFormData?
  • URL parameters.

    Declaration

    Swift

    public var parameters: [(ParameterEncoding, [String : CustomStringConvertible])]
  • Set to true if API call requires access token. Default is true

    Declaration

    Swift

    public var requiresAccessToken: Bool
  • Custom response deserializer closure. See CustomResponseDeserializer

    Declaration

    Swift

    public var responseDeserializer: CustomResponseDeserializer?
  • Custom error extractor closure. See CustomErrorExtractor

    Declaration

    Swift

    public var customErrorExtractor: CustomErrorExtractor?
  • Server API version. Leave default value to connect to the latest API version.

    Declaration

    Swift

    public var apiVersion: Int
  • Server API error version.

    Declaration

    Swift

    public var errorVersion: Int
  • Initializer

    Declaration

    Swift

    public init()
  • Initializer

    Declaration

    Swift

    public init(with server: Server, and device: Device)
    Parameters
    server

    Server

    device

    Device

  • Formats the api URL using the host and the API path.

    Throws

    throws AFError.invalidURL if a URL cannot be formatted.
    Declaration

    Swift

    public func asURL() throws -> URL
    Return Value

    Returns a URL combining the server host string and the API path.

  • Formats a URLRequest from configuration. This method will take care of setting property values and parameters required by Usher Server such as access token, location, device and OS info, locale, timezone and time. This method will throw error if URLRequest cannot be configured.

    Declaration

    Swift

    public func asURLRequest() throws -> URLRequest
    Return Value

    A URLRequest instance