HARequest

public struct HARequest

A request, with data, to be issued

  • Create a request

    Precondition

    data is a JSON-encodable value. From JSONSerialization documentation:
    • All objects are String, numbers (Int, Float, etc.), Array, Dictionary, or nil
    • All dictionary keys are String
    • Numbers (Int, Float, etc.) are not .nan or .infinity

    Declaration

    Swift

    public init(
        type: HARequestType,
        data: [String: Any] = [:],
        queryItems: [URLQueryItem] = [],
        shouldRetry: Bool = true
    )

    Parameters

    type

    The type of the request to issue

    data

    The data to accompany with the request, at the top level

    queryItems

    Query items to include in the call, for REST requests

    shouldRetry

    Whether to retry the request when a connection change occurs

  • The type of the request to be issued

    Declaration

    Swift

    public var type: HARequestType
  • Additional top-level data to include in the request

    Declaration

    Swift

    public var data: [String : Any]
  • Whether the request should be retried if the connection closes and reopens

    Declaration

    Swift

    public var shouldRetry: Bool
  • For REST requests, any query items to include in the call

    Declaration

    Swift

    public var queryItems: [URLQueryItem]