Structures

The following structures are available globally.

Serialization

HTTPHeader

  • A representation of a single HTTP header’s name / value pair.

    See more

    Declaration

    Swift

    public struct HTTPHeader : Equatable, Hashable, Sendable
    extension HTTPHeader: CustomStringConvertible
  • Type representing HTTP methods. Raw String value is stored and compared case-sensitively, so HTTPMethod.get != HTTPMethod(rawValue: "get").

    See https://tools.ietf.org/html/rfc7231#section-4.3

    See more

    Declaration

    Swift

    public struct HTTPMethod : RawRepresentable, Equatable, Hashable, Sendable
  • Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP body of the URL request. Whether the query string is set or appended to any existing URL query string or set as the HTTP body depends on the destination of the encoding.

    The Content-Type HTTP header field of an encoded request with HTTP body is set to application/x-www-form-urlencoded; charset=utf-8.

    There is no published specification for how to encode collection types. By default the convention of appending [] to the key for array values (foo[]=1&foo[]=2), and appending the key surrounded by square brackets for nested dictionary values (foo[bar]=baz) is used. Optionally, ArrayEncoding can be used to omit the square brackets appended to array keys.

    BoolEncoding can be used to configure how boolean values are encoded. The default behavior is to encode true as 1 and false as 0.

    See more

    Declaration

    Swift

    public struct URLEncoding : ParameterEncoding
  • Uses JSONSerialization to create a JSON representation of the parameters object, which is set as the body of the request. The Content-Type HTTP header field of an encoded request is set to application/json.

    See more

    Declaration

    Swift

    public struct JSONEncoding : ParameterEncoding
  • Type used to store all values associated with a serialized response of a DataRequest or UploadRequest.

    See more

    Declaration

    Swift

    public struct DataResponse<Success, Failure> : Sendable where Success : Sendable, Failure : Error
    extension DataResponse: CustomStringConvertible, CustomDebugStringConvertible
  • Used to store all data associated with a serialized response of a download request.

    See more

    Declaration

    Swift

    public struct DownloadResponse<Success, Failure> : Sendable where Success : Sendable, Failure : Error
    extension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertible
  • Undocumented

    See more

    Declaration

    Swift

    public struct DecodableWebSocketMessageDecoder<Value> : WebSocketMessageSerializer where Value : Decodable, Value : Sendable
  • Type that acts as a generic extension point for all AlamofireExtended types.

    See more

    Declaration

    Swift

    public struct AlamofireExtension<ExtendedType>
  • ResponseCacher is a convenience CachedResponseHandler making it easy to cache, not cache, or modify a cached response.

    See more

    Declaration

    Swift

    public struct ResponseCacher
    extension ResponseCacher: CachedResponseHandler

DataRequest / UploadRequest

  • A Combine Publisher that publishes the DataResponse<Value, AFError> of the provided DataRequest.

    See more

    Declaration

    Swift

    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
    public struct DataResponsePublisher<Value> : Publisher where Value : Sendable
  • Undocumented

    See more

    Declaration

    Swift

    public struct DataStreamPublisher<Value> : Publisher where Value : Sendable
  • A Combine Publisher that publishes the DownloadResponse<Value, AFError> of the provided DownloadRequest.

    See more

    Declaration

    Swift

    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
    public struct DownloadResponsePublisher<Value> : Publisher where Value : Sendable

DataTask

  • Value used to await a DataResponse and associated values.

    See more

    Declaration

    Swift

    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    public struct DataTask<Value> : Sendable where Value : Sendable

DownloadTask

  • Value used to await a DownloadResponse and associated values.

    See more

    Declaration

    Swift

    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    public struct DownloadTask<Value> : Sendable where Value : Sendable

DataStreamTask

WebSocketTask

  • An asynchronous sequence generated from an underlying AsyncStream. Only produced by Alamofire.

    See more

    Declaration

    Swift

    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    public struct StreamOf<Element> : AsyncSequence
  • Redirector is a convenience RedirectHandler making it easy to follow, not follow, or modify a redirect.

    See more

    Declaration

    Swift

    public struct Redirector
    extension Redirector: RedirectHandler
  • RequestAdapter which compresses outgoing URLRequest bodies using the deflate Content-Encoding and adds the appropriate header.

    Note

    Most requests to most APIs are small and so would only be slowed down by applying this adapter. Measure the size of your request bodies and the performance impact of using this adapter before use. Using this adapter with already compressed data, such as images, will, at best, have no effect. Additionally, body compression is a synchronous operation, so measuring the performance impact may be important to determine whether you want to use a dedicated requestQueue in your Session instance. Finally, not all servers support request compression, so test with all of your server configurations before deploying.
    See more

    Declaration

    Swift

    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    public struct DeflateRequestCompressor : Sendable, RequestInterceptor
  • Stores all state associated with a URLRequest being adapted.

    See more

    Declaration

    Swift

    public struct RequestAdapterState : Sendable
  • DataPreprocessor that returns passed Data without any transform.

    See more

    Declaration

    Swift

    public struct PassthroughPreprocessor : DataPreprocessor
  • DataPreprocessor that trims Google’s typical )]}',\n XSSI JSON header.

    See more

    Declaration

    Swift

    public struct GoogleXSSIPreprocessor : DataPreprocessor

URL

Empty