Back to Alamofire

Structures

docs/Structs.html

5.12.010.7 KB
Original Source

Structures

The following structures are available globally.

Serialization

`

                DecodableStreamSerializer
                `

DataStreamSerializer which uses the provided DataPreprocessor and DataDecoder to serialize the incoming Data.

See more

Declaration

Swift

public struct DecodableStreamSerializer<T> : DataStreamSerializer where T : Decodable, T : Sendable

`

                PassthroughStreamSerializer
                `

DataStreamSerializer which performs no serialization on incoming Data.

See more

Declaration

Swift

public struct PassthroughStreamSerializer : DataStreamSerializer

`

                StringStreamSerializer
                `

DataStreamSerializer which serializes incoming stream Data into UTF8-decoded String values.

See more

Declaration

Swift

public struct StringStreamSerializer : DataStreamSerializer

`

                HTTPHeaders
                `

An order-preserving and case-insensitive representation of HTTP headers.

See more

Declaration

Swift

public struct HTTPHeaders : Equatable, Hashable, Sendable
extension HTTPHeaders: ExpressibleByDictionaryLiteral
extension HTTPHeaders: ExpressibleByArrayLiteral
extension HTTPHeaders: Sequence
extension HTTPHeaders: Collection
extension HTTPHeaders: CustomStringConvertible

HTTPHeader

`

                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

`

                HTTPMethod
                `

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

`

                URLEncoding
                `

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

`

                JSONEncoding
                `

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

`

                DataResponse
                `

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

`

                DownloadResponse
                `

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

`

                DecodableWebSocketMessageDecoder
                `

Undocumented

See more

Declaration

Swift

public struct DecodableWebSocketMessageDecoder<Value> : WebSocketMessageSerializer where Value : Decodable, Value : Sendable

`

                AlamofireExtension
                `

Type that acts as a generic extension point for all AlamofireExtended types.

See more

Declaration

Swift

public struct AlamofireExtension<ExtendedType>

`

                ResponseCacher
                `

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

`

                DataResponsePublisher
                `

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

`

                DataStreamPublisher
                `

Undocumented

See more

Declaration

Swift

public struct DataStreamPublisher<Value> : Publisher where Value : Sendable

`

                DownloadResponsePublisher
                `

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

`

                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

`

                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

`

                DataStreamTask
                `

Undocumented

See more

Declaration

Swift

public struct DataStreamTask : Sendable

WebSocketTask

`

                StreamOf
                `

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

Note

Like AsyncStream, StreamOf does not support multiple iteration. Multiple iteration may lead to lost values or other misbehavior. See more

Declaration

Swift

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public struct StreamOf<Element> : AsyncSequence

`

                Redirector
                `

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

`

                DeflateRequestCompressor
                `

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

`

                RequestAdapterState
                `

Stores all state associated with a URLRequest being adapted.

See more

Declaration

Swift

public struct RequestAdapterState : Sendable

`

                PassthroughPreprocessor
                `

DataPreprocessor that returns passed Data without any transform.

See more

Declaration

Swift

public struct PassthroughPreprocessor : DataPreprocessor

`

                GoogleXSSIPreprocessor
                `

DataPreprocessor that trims Google’s typical )]}',\n XSSI JSON header.

See more

Declaration

Swift

public struct GoogleXSSIPreprocessor : DataPreprocessor

URL

`

                URLResponseSerializer
                `

A DownloadResponseSerializerProtocol that performs only Error checking and ensures that a downloaded fileURL is present.

See more

Declaration

Swift

public struct URLResponseSerializer : DownloadResponseSerializerProtocol

Empty

`

                Empty
                `

Type representing an empty value. Use Empty.value to get the static instance.

See more

Declaration

Swift

public struct Empty : Hashable, Codable, Sendable
extension Empty: EmptyResponse