# Table of Contents - [Alamofire Reference](#alamofire-reference) - [Adapter Class Reference](#adapter-class-reference) - [AlamofireNotifications Class Reference](#alamofirenotifications-class-reference) - [Alamofire Reference](#alamofire-reference) - [Classes Reference](#classes-reference) - [AuthenticationInterceptor Class Reference](#authenticationinterceptor-class-reference) - [RefreshWindow Structure Reference](#refreshwindow-structure-reference) - [CompositeTrustEvaluator Class Reference](#compositetrustevaluator-class-reference) - [ClosureEventMonitor Class Reference](#closureeventmonitor-class-reference) - [ConnectionLostRetryPolicy Class Reference](#connectionlostretrypolicy-class-reference) - [DataResponseSerializer Class Reference](#dataresponseserializer-class-reference) - [CompositeEventMonitor Class Reference](#compositeeventmonitor-class-reference) - [Stream Structure Reference](#stream-structure-reference) - [DataStreamRequest Class Reference](#datastreamrequest-class-reference) - [Completion Structure Reference](#completion-structure-reference) - [Event Enumeration Reference](#event-enumeration-reference) - [CancellationToken Structure Reference](#cancellationtoken-structure-reference) - [DataRequest Class Reference](#datarequest-class-reference) - [DecodableResponseSerializer Class Reference](#decodableresponseserializer-class-reference) - [DefaultTrustEvaluator Class Reference](#defaulttrustevaluator-class-reference) - [DisabledTrustEvaluator Class Reference](#disabledtrustevaluator-class-reference) - [Options Structure Reference](#options-structure-reference) - [DownloadRequest Class Reference](#downloadrequest-class-reference) - [JSONParameterEncoder Class Reference](#jsonparameterencoder-class-reference) - [Downloadable Enumeration Reference](#downloadable-enumeration-reference) - [Interceptor Class Reference](#interceptor-class-reference) - [JSONResponseSerializer Class Reference](#jsonresponseserializer-class-reference) - [MultipartFormData Class Reference](#multipartformdata-class-reference) - [PinnedCertificatesTrustEvaluator Class Reference](#pinnedcertificatestrustevaluator-class-reference) - [NetworkReachabilityManager Class Reference](#networkreachabilitymanager-class-reference) - [NetworkReachabilityStatus Enumeration Reference](#networkreachabilitystatus-enumeration-reference) - [PublicKeysTrustEvaluator Class Reference](#publickeystrustevaluator-class-reference) - [Retrier Class Reference](#retrier-class-reference) - [RetryPolicy Class Reference](#retrypolicy-class-reference) - [RevocationTrustEvaluator Class Reference](#revocationtrustevaluator-class-reference) - [Options Structure Reference](#options-structure-reference) - [ServerTrustManager Class Reference](#servertrustmanager-class-reference) - [SessionDelegate Class Reference](#sessiondelegate-class-reference) - [Request Class Reference](#request-class-reference) - [State Enumeration Reference](#state-enumeration-reference) - [ResponseDisposition Enumeration Reference](#responsedisposition-enumeration-reference) - [StringResponseSerializer Class Reference](#stringresponseserializer-class-reference) - [Session Class Reference](#session-class-reference) - [BoolEncoding Enumeration Reference](#boolencoding-enumeration-reference) - [DataEncoding Enumeration Reference](#dataencoding-enumeration-reference) - [URLEncodedFormEncoder Class Reference](#urlencodedformencoder-class-reference) - [ArrayEncoding Enumeration Reference](#arrayencoding-enumeration-reference) - [DateEncoding Enumeration Reference](#dateencoding-enumeration-reference) - [NilEncoding Structure Reference](#nilencoding-structure-reference) - [KeyEncoding Enumeration Reference](#keyencoding-enumeration-reference) - [Error Enumeration Reference](#error-enumeration-reference) - [Destination Enumeration Reference](#destination-enumeration-reference) - [KeyPathEncoding Structure Reference](#keypathencoding-structure-reference) - [Global Variables Reference](#global-variables-reference) - [SpaceEncoding Enumeration Reference](#spaceencoding-enumeration-reference) - [UploadRequest Class Reference](#uploadrequest-class-reference) - [URLEncodedFormParameterEncoder Class Reference](#urlencodedformparameterencoder-class-reference) - [Enumerations Reference](#enumerations-reference) - [Uploadable Enumeration Reference](#uploadable-enumeration-reference) - [MultipartEncodingFailureReason Enumeration Reference](#multipartencodingfailurereason-enumeration-reference) - [UnexpectedInputStreamLength Structure Reference](#unexpectedinputstreamlength-structure-reference) - [ParameterEncoderFailureReason Enumeration Reference](#parameterencoderfailurereason-enumeration-reference) - [AFError Enumeration Reference](#aferror-enumeration-reference) - [ParameterEncodingFailureReason Enumeration Reference](#parameterencodingfailurereason-enumeration-reference) - [ResponseValidationFailureReason Enumeration Reference](#responsevalidationfailurereason-enumeration-reference) - [ServerTrustFailureReason Enumeration Reference](#servertrustfailurereason-enumeration-reference) - [AFInfo Enumeration Reference](#afinfo-enumeration-reference) - [URLRequestValidationFailureReason Enumeration Reference](#urlrequestvalidationfailurereason-enumeration-reference) - [RetryResult Enumeration Reference](#retryresult-enumeration-reference) - [ResponseSerializationFailureReason Enumeration Reference](#responseserializationfailurereason-enumeration-reference) - [CharacterSet Extension Reference](#characterset-extension-reference) - [AuthenticationError Enumeration Reference](#authenticationerror-enumeration-reference) - [Error Extension Reference](#error-extension-reference) - [Extensions Reference](#extensions-reference) - [URLComponents Extension Reference](#urlcomponents-extension-reference) - [Notification Extension Reference](#notification-extension-reference) - [URL Extension Reference](#url-extension-reference) - [HTTPURLResponse Extension Reference](#httpurlresponse-extension-reference) - [String Extension Reference](#string-extension-reference) - [URLSessionConfiguration Extension Reference](#urlsessionconfiguration-extension-reference) - [URLRequest Extension Reference](#urlrequest-extension-reference) - [[ServerTrustEvaluating] Extension Reference](#-servertrustevaluating-extension-reference) - [Protocols Reference](#protocols-reference) - [CachedResponseHandler Protocol Reference](#cachedresponsehandler-protocol-reference) - [Authenticator Protocol Reference](#authenticator-protocol-reference) - [AlamofireExtended Protocol Reference](#alamofireextended-protocol-reference) - [AuthenticationCredential Protocol Reference](#authenticationcredential-protocol-reference) - [DataDecoder Protocol Reference](#datadecoder-protocol-reference) - [DataPreprocessor Protocol Reference](#datapreprocessor-protocol-reference) - [DataResponseSerializerProtocol Protocol Reference](#dataresponseserializerprotocol-protocol-reference) - [DownloadResponseSerializerProtocol Protocol Reference](#downloadresponseserializerprotocol-protocol-reference) - [ParameterEncoder Protocol Reference](#parameterencoder-protocol-reference) - [DataStreamSerializer Protocol Reference](#datastreamserializer-protocol-reference) - [ParameterEncoding Protocol Reference](#parameterencoding-protocol-reference) - [EmptyResponse Protocol Reference](#emptyresponse-protocol-reference) - [EventMonitor Protocol Reference](#eventmonitor-protocol-reference) - [RedirectHandler Protocol Reference](#redirecthandler-protocol-reference) - [RequestRetrier Protocol Reference](#requestretrier-protocol-reference) - [RequestAdapter Protocol Reference](#requestadapter-protocol-reference) - [URLConvertible Protocol Reference](#urlconvertible-protocol-reference) - [ResponseSerializer Protocol Reference](#responseserializer-protocol-reference) - [URLRequestConvertible Protocol Reference](#urlrequestconvertible-protocol-reference) - [RequestDelegate Protocol Reference](#requestdelegate-protocol-reference) - [UploadableConvertible Protocol Reference](#uploadableconvertible-protocol-reference) - [ServerTrustEvaluating Protocol Reference](#servertrustevaluating-protocol-reference) - [RequestInterceptor Protocol Reference](#requestinterceptor-protocol-reference) - [Structures Reference](#structures-reference) - [WebSocketMessageSerializer Protocol Reference](#websocketmessageserializer-protocol-reference) - [DataResponse Structure Reference](#dataresponse-structure-reference) - [AlamofireExtension Structure Reference](#alamofireextension-structure-reference) - [DataResponsePublisher Structure Reference](#dataresponsepublisher-structure-reference) - [DataStreamPublisher Structure Reference](#datastreampublisher-structure-reference) - [DataStreamTask Structure Reference](#datastreamtask-structure-reference) - [DataTask Structure Reference](#datatask-structure-reference) - [DecodableStreamSerializer Structure Reference](#decodablestreamserializer-structure-reference) - [DeflateRequestCompressor Structure Reference](#deflaterequestcompressor-structure-reference) - [DecodableWebSocketMessageDecoder Structure Reference](#decodablewebsocketmessagedecoder-structure-reference) - [DuplicateHeaderBehavior Enumeration Reference](#duplicateheaderbehavior-enumeration-reference) - [Error Enumeration Reference](#error-enumeration-reference) - [Empty Structure Reference](#empty-structure-reference) - [DownloadTask Structure Reference](#downloadtask-structure-reference) - [DownloadResponse Structure Reference](#downloadresponse-structure-reference) - [DownloadResponsePublisher Structure Reference](#downloadresponsepublisher-structure-reference) - [GoogleXSSIPreprocessor Structure Reference](#googlexssipreprocessor-structure-reference) - [HTTPHeaders Structure Reference](#httpheaders-structure-reference) - [HTTPMethod Structure Reference](#httpmethod-structure-reference) - [HTTPHeader Structure Reference](#httpheader-structure-reference) - [JSONEncoding Structure Reference](#jsonencoding-structure-reference) - [Error Enumeration Reference](#error-enumeration-reference) - [PassthroughPreprocessor Structure Reference](#passthroughpreprocessor-structure-reference) - [PassthroughStreamSerializer Structure Reference](#passthroughstreamserializer-structure-reference) - [RequestAdapterState Structure Reference](#requestadapterstate-structure-reference) - [Behavior Enumeration Reference](#behavior-enumeration-reference) - [ResponseCacher Structure Reference](#responsecacher-structure-reference) --- # Alamofire Reference ![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/AlamofireLogo.png) [![Swift](https://img.shields.io/badge/Swift-5.9_5.10_6.0-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.9_5.10_6.0-Orange?style=flat-square) [![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS_Linux_Windows_Android-yellowgreen?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_vision_OS_Linux_Windows_Android-Green?style=flat-square) [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg?style=flat-square)](https://img.shields.io/cocoapods/v/Alamofire.svg) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage) [![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square) [![Swift Forums](https://img.shields.io/badge/Swift_Forums-Alamofire-orange?style=flat-square)](https://forums.swift.org/c/related-projects/alamofire/37) Alamofire is an HTTP networking library written in Swift. * [Features](#features) * [Component Libraries](#component-libraries) * [Requirements](#requirements) * [Migration Guides](#migration-guides) * [Communication](#communication) * [Installation](#installation) * [Contributing](#contributing) * [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#using-alamofire) * [**Introduction -**](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#introduction) [Making Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-requests) , [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling) , [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation) , [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching) * **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods) , [Parameters and Parameter Encoder](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md##request-parameters-and-parameter-encoders) , [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers) , [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication) * **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file) , [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server) * **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics) , [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output) * [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md) * **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session) , [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#sessiondelegate) , [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request) * **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests) , [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests-with-requestinterceptor) * **Model Objects -** [Custom Response Handlers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#customizing-response-handlers) * **Advanced Concurrency -** [Swift Concurrency](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-swift-concurrency) and [Combine](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-combine) * **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security) , [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability) * [Open Radars](#open-radars) * [FAQ](#faq) * [Credits](#credits) * [Donations](#donations) * [License](#license) Features -------- * \[x\] Chainable Request / Response Methods * \[x\] Swift Concurrency Support Back to iOS 13, macOS 10.15, tvOS 13, and watchOS 6. * \[x\] Combine Support * \[x\] URL / JSON Parameter Encoding * \[x\] Upload File / Data / Stream / MultipartFormData * \[x\] Download File using Request or Resume Data * \[x\] Authentication with `URLCredential` * \[x\] HTTP Response Validation * \[x\] Upload and Download Progress Closures with Progress * \[x\] cURL Command Output * \[x\] Dynamically Adapt and Retry Requests * \[x\] TLS Certificate and Public Key Pinning * \[x\] Network Reachability * \[x\] Comprehensive Unit and Integration Test Coverage * \[x\] [Complete Documentation](https://alamofire.github.io/Alamofire) Write Requests Fast! -------------------- Alamofire’s compact syntax and extensive feature set allow requests with powerful features like automatic retry to be written in just a few lines of code. // Automatic String to URL conversion, Swift concurrency support, and automatic retry. let response = await AF.request("https://httpbin.org/get", interceptor: .retryPolicy) // Automatic HTTP Basic Auth. .authenticate(username: "user", password: "pass") // Caching customization. .cacheResponse(using: .cache) // Redirect customization. .redirect(using: .follow) // Validate response code and Content-Type. .validate() // Produce a cURL command for the request. .cURLDescription { description in print(description) } // Automatic Decodable support with background parsing. .serializingDecodable(DecodableType.self) // Await the full response with metrics and a parsed body. .response // Detailed response description for easy debugging. debugPrint(response) Component Libraries ------------------- In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem. * [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache, and a priority-based image downloading system. * [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire. Requirements ------------ | Platform | Minimum Swift Version | Installation | Status | | --- | --- | --- | --- | | iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.9 / Xcode 15.0 | [CocoaPods](#cocoapods)
, [Carthage](#carthage)
, [Swift Package Manager](#swift-package-manager)
, [Manual](#manually) | Fully Tested | | Linux | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported | | Windows | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported | | Android | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported | #### Known Issues on Linux and Windows Alamofire builds on Linux, Windows, and Android but there are missing features and many issues in the underlying `swift-corelibs-foundation` that prevent full functionality and may cause crashes. These include: * `[ServerTrustManager](Classes/ServerTrustManager.html) ` and associated certificate functionality is unavailable, so there is no certificate pinning and no client certificate support. * Various methods of HTTP authentication may crash, including HTTP Basic and HTTP Digest. Crashes may occur if responses contain server challenges. * Cache control through `[CachedResponseHandler](Protocols/CachedResponseHandler.html) ` and associated APIs is unavailable, as the underlying delegate methods aren’t called. * `URLSessionTaskMetrics` are never gathered. * `WebSocketRequest` is not available. Due to these issues, Alamofire is unsupported on Linux, Windows, and Android. Please report any crashes to the [Swift bug reporter](https://bugs.swift.org) . Migration Guides ---------------- * [Alamofire 5.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%205.0%20Migration%20Guide.md) * [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md) * [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md) * [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md) Communication ------------- * If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`. * If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/) or [Apple’s documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system) , on top of which Alamofire is built. * If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire) . * If you’d like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire) . * If you’d like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire) . * If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better! Installation ------------ ### Swift Package Manager The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift` or the Package list in Xcode. dependencies: [\ .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.10.0"))\ ] Normally you’ll want to depend on the `Alamofire` target: .product(name: "Alamofire", package: "Alamofire") But if you want to force Alamofire to be dynamically linked (do not do this unless you’re sure you need it), you can depend on the `AlamofireDynamic` target: .product(name: "AlamofireDynamic", package: "Alamofire") ### CocoaPods [CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: pod 'Alamofire' ### Carthage [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: github "Alamofire/Alamofire" ### Manually If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually. #### Embedded Framework * Open up Terminal, `cd` into your top-level project directory, and run the following command “if” your project is not initialized as a git repository: $ git init * Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command: $ git submodule add https://github.com/Alamofire/Alamofire.git * Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application’s Xcode project. > It should appear nested underneath your application’s blue project icon. Whether it is above or below all the other Xcode groups does not matter. * Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target. * Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the “Targets” heading in the sidebar. * In the tab bar at the top of that window, open the “General” panel. * Click on the `+` button under the “Embedded Binaries” section. * You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder. > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`. * Select the top `Alamofire.framework` for iOS and the bottom one for macOS. > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS`, or `Alamofire watchOS`. * And that’s it! > The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device. Contributing ------------ Before contributing to Alamofire, please read the instructions detailed in our [contribution guide](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md) . Open Radars ----------- The following radars have some effect on the current implementation of Alamofire. * [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in the test case * `rdar://26870455` - Background URL Session Configurations do not work in the simulator * `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest` Resolved Radars --------------- The following radars have been resolved over time after being filed against the Alamofire project. * [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage. * (Resolved): 9/1/17 in Xcode 9 beta 6. * [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+ * (Resolved): Just add `CFNetwork` to your linked frameworks. * `FB7624529` - `urlSession(_:task:didFinishCollecting:)` never called on watchOS * (Resolved): Metrics now collected on watchOS 7+. FAQ --- ### What’s the origin of the name Alamofire? Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html) , a hybrid variant of the Bluebonnet, the official state flower of Texas. Credits ------- Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org) . You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases. ### Security Disclosure If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to [security@alamofire.org](mailto:security@alamofire.org) . Please do not post it to a public issue tracker. Sponsorship ----------- The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially stay registered as a federal non-profit organization. Registering will allow Foundation members to gain some legal protections and also allow us to put donations to use, tax-free. Sponsoring the ASF will enable us to: * Pay our yearly legal fees to keep the non-profit in good status * Pay for our mail servers to help us stay on top of all questions and security issues * Potentially fund test servers to make it easier for us to test the edge cases * Potentially fund developers to work on one of our projects full-time The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Any amount you can donate, whether once or monthly, to help us reach our goal would be greatly appreciated. [Sponsor Alamofire](https://github.com/sponsors/Alamofire) Supporters ---------- [MacStadium](https://macstadium.com) provides Alamofire with a free, hosted Mac mini. ![Powered by MacStadium](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/MacStadiumLogo.png) License ------- Alamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) for details. --- # Adapter Class Reference Adapter ======= Closure-based `[RequestAdapter](../Protocols/RequestAdapter.html) `. * `[init(_:)](#/s:9Alamofire7AdapterCyACy10Foundation10URLRequestV_AA7SessionCys6ResultOyAFs5Error_pGctccfc) ` Creates an instance using the provided closure. #### Declaration #### Parameters | | | | --- | --- | | `_adaptHandler_` | `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` closure to be executed when handling request adaptation. | * `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) ` #### Declaration * `[adapt(_:using:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_5using10completiony10Foundation10URLRequestV_AA0bC5StateVys6ResultOyAIs5Error_pGYbctF) ` #### Declaration --- # AlamofireNotifications Class Reference AlamofireNotifications ====================== `[EventMonitor](../Protocols/EventMonitor.html) ` that provides Alamofire’s notifications. * `[init()](#/s:9Alamofire0A13NotificationsCACycfc) ` Creates an instance. #### Declaration * `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) ` #### Declaration * `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) ` #### Declaration * `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) ` #### Declaration * `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) ` #### Declaration * `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) ` #### Declaration --- # Alamofire Reference ![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/AlamofireLogo.png) [![Swift](https://img.shields.io/badge/Swift-5.9_5.10_6.0-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.9_5.10_6.0-Orange?style=flat-square) [![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS_Linux_Windows_Android-yellowgreen?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_vision_OS_Linux_Windows_Android-Green?style=flat-square) [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg?style=flat-square)](https://img.shields.io/cocoapods/v/Alamofire.svg) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage) [![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square) [![Swift Forums](https://img.shields.io/badge/Swift_Forums-Alamofire-orange?style=flat-square)](https://forums.swift.org/c/related-projects/alamofire/37) Alamofire is an HTTP networking library written in Swift. * [Features](#features) * [Component Libraries](#component-libraries) * [Requirements](#requirements) * [Migration Guides](#migration-guides) * [Communication](#communication) * [Installation](#installation) * [Contributing](#contributing) * [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#using-alamofire) * [**Introduction -**](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#introduction) [Making Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-requests) , [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling) , [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation) , [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching) * **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods) , [Parameters and Parameter Encoder](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md##request-parameters-and-parameter-encoders) , [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers) , [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication) * **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file) , [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server) * **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics) , [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output) * [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md) * **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session) , [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#sessiondelegate) , [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request) * **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests) , [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests-with-requestinterceptor) * **Model Objects -** [Custom Response Handlers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#customizing-response-handlers) * **Advanced Concurrency -** [Swift Concurrency](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-swift-concurrency) and [Combine](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-combine) * **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security) , [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability) * [Open Radars](#open-radars) * [FAQ](#faq) * [Credits](#credits) * [Donations](#donations) * [License](#license) Features -------- * \[x\] Chainable Request / Response Methods * \[x\] Swift Concurrency Support Back to iOS 13, macOS 10.15, tvOS 13, and watchOS 6. * \[x\] Combine Support * \[x\] URL / JSON Parameter Encoding * \[x\] Upload File / Data / Stream / MultipartFormData * \[x\] Download File using Request or Resume Data * \[x\] Authentication with `URLCredential` * \[x\] HTTP Response Validation * \[x\] Upload and Download Progress Closures with Progress * \[x\] cURL Command Output * \[x\] Dynamically Adapt and Retry Requests * \[x\] TLS Certificate and Public Key Pinning * \[x\] Network Reachability * \[x\] Comprehensive Unit and Integration Test Coverage * \[x\] [Complete Documentation](https://alamofire.github.io/Alamofire) Write Requests Fast! -------------------- Alamofire’s compact syntax and extensive feature set allow requests with powerful features like automatic retry to be written in just a few lines of code. // Automatic String to URL conversion, Swift concurrency support, and automatic retry. let response = await AF.request("https://httpbin.org/get", interceptor: .retryPolicy) // Automatic HTTP Basic Auth. .authenticate(username: "user", password: "pass") // Caching customization. .cacheResponse(using: .cache) // Redirect customization. .redirect(using: .follow) // Validate response code and Content-Type. .validate() // Produce a cURL command for the request. .cURLDescription { description in print(description) } // Automatic Decodable support with background parsing. .serializingDecodable(DecodableType.self) // Await the full response with metrics and a parsed body. .response // Detailed response description for easy debugging. debugPrint(response) Component Libraries ------------------- In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem. * [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache, and a priority-based image downloading system. * [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire. Requirements ------------ | Platform | Minimum Swift Version | Installation | Status | | --- | --- | --- | --- | | iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.9 / Xcode 15.0 | [CocoaPods](#cocoapods)
, [Carthage](#carthage)
, [Swift Package Manager](#swift-package-manager)
, [Manual](#manually) | Fully Tested | | Linux | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported | | Windows | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported | | Android | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported | #### Known Issues on Linux and Windows Alamofire builds on Linux, Windows, and Android but there are missing features and many issues in the underlying `swift-corelibs-foundation` that prevent full functionality and may cause crashes. These include: * `[ServerTrustManager](Classes/ServerTrustManager.html) ` and associated certificate functionality is unavailable, so there is no certificate pinning and no client certificate support. * Various methods of HTTP authentication may crash, including HTTP Basic and HTTP Digest. Crashes may occur if responses contain server challenges. * Cache control through `[CachedResponseHandler](Protocols/CachedResponseHandler.html) ` and associated APIs is unavailable, as the underlying delegate methods aren’t called. * `URLSessionTaskMetrics` are never gathered. * `WebSocketRequest` is not available. Due to these issues, Alamofire is unsupported on Linux, Windows, and Android. Please report any crashes to the [Swift bug reporter](https://bugs.swift.org) . Migration Guides ---------------- * [Alamofire 5.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%205.0%20Migration%20Guide.md) * [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md) * [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md) * [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md) Communication ------------- * If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`. * If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/) or [Apple’s documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system) , on top of which Alamofire is built. * If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire) . * If you’d like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire) . * If you’d like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire) . * If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better! Installation ------------ ### Swift Package Manager The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift` or the Package list in Xcode. dependencies: [\ .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.10.0"))\ ] Normally you’ll want to depend on the `Alamofire` target: .product(name: "Alamofire", package: "Alamofire") But if you want to force Alamofire to be dynamically linked (do not do this unless you’re sure you need it), you can depend on the `AlamofireDynamic` target: .product(name: "AlamofireDynamic", package: "Alamofire") ### CocoaPods [CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: pod 'Alamofire' ### Carthage [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: github "Alamofire/Alamofire" ### Manually If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually. #### Embedded Framework * Open up Terminal, `cd` into your top-level project directory, and run the following command “if” your project is not initialized as a git repository: $ git init * Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command: $ git submodule add https://github.com/Alamofire/Alamofire.git * Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application’s Xcode project. > It should appear nested underneath your application’s blue project icon. Whether it is above or below all the other Xcode groups does not matter. * Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target. * Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the “Targets” heading in the sidebar. * In the tab bar at the top of that window, open the “General” panel. * Click on the `+` button under the “Embedded Binaries” section. * You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder. > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`. * Select the top `Alamofire.framework` for iOS and the bottom one for macOS. > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS`, or `Alamofire watchOS`. * And that’s it! > The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device. Contributing ------------ Before contributing to Alamofire, please read the instructions detailed in our [contribution guide](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md) . Open Radars ----------- The following radars have some effect on the current implementation of Alamofire. * [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in the test case * `rdar://26870455` - Background URL Session Configurations do not work in the simulator * `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest` Resolved Radars --------------- The following radars have been resolved over time after being filed against the Alamofire project. * [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage. * (Resolved): 9/1/17 in Xcode 9 beta 6. * [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+ * (Resolved): Just add `CFNetwork` to your linked frameworks. * `FB7624529` - `urlSession(_:task:didFinishCollecting:)` never called on watchOS * (Resolved): Metrics now collected on watchOS 7+. FAQ --- ### What’s the origin of the name Alamofire? Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html) , a hybrid variant of the Bluebonnet, the official state flower of Texas. Credits ------- Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org) . You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases. ### Security Disclosure If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to [security@alamofire.org](mailto:security@alamofire.org) . Please do not post it to a public issue tracker. Sponsorship ----------- The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially stay registered as a federal non-profit organization. Registering will allow Foundation members to gain some legal protections and also allow us to put donations to use, tax-free. Sponsoring the ASF will enable us to: * Pay our yearly legal fees to keep the non-profit in good status * Pay for our mail servers to help us stay on top of all questions and security issues * Potentially fund test servers to make it easier for us to test the edge cases * Potentially fund developers to work on one of our projects full-time The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Any amount you can donate, whether once or monthly, to help us reach our goal would be greatly appreciated. [Sponsor Alamofire](https://github.com/sponsors/Alamofire) Supporters ---------- [MacStadium](https://macstadium.com) provides Alamofire with a free, hosted Mac mini. ![Powered by MacStadium](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/MacStadiumLogo.png) License ------- Alamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) for details. --- # Classes Reference Classes ======= The following classes are available globally. * `[DataRequest](#/s:9Alamofire11DataRequestC) ` `[Request](Classes/Request.html) ` subclass which handles in-memory `Data` download using `URLSessionDataTask`. [See more](Classes/DataRequest.html) #### Declaration * `[DataStreamRequest](#/s:9Alamofire17DataStreamRequestC) ` `[Request](Classes/Request.html) ` subclass which streams HTTP response `Data` through a `Handler` closure. [See more](Classes/DataStreamRequest.html) #### Declaration * `[DownloadRequest](#/s:9Alamofire15DownloadRequestC) ` `[Request](Classes/Request.html) ` subclass which downloads `Data` to a file on disk using `URLSessionDownloadTask`. [See more](Classes/DownloadRequest.html) #### Declaration * `[Request](#/s:9Alamofire7RequestC) ` `Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback handling. [See more](Classes/Request.html) #### Declaration * `[AlamofireNotifications](#/s:9Alamofire0A13NotificationsC) ` `[EventMonitor](Protocols/EventMonitor.html) ` that provides Alamofire’s notifications. [See more](Classes/AlamofireNotifications.html) #### Declaration * `[JSONParameterEncoder](#/s:9Alamofire20JSONParameterEncoderC) ` A `[ParameterEncoder](Protocols/ParameterEncoder.html) ` that encodes types as JSON body data. If no `Content-Type` header is already set on the provided `URLRequest`s, it’s set to `application/json`. [See more](Classes/JSONParameterEncoder.html) #### Declaration * `[URLEncodedFormParameterEncoder](#/s:9Alamofire30URLEncodedFormParameterEncoderC) ` A `[ParameterEncoder](Protocols/ParameterEncoder.html) ` that encodes types as URL-encoded query strings to be set on the URL or as body data, depending on the `Destination` set. If no `Content-Type` header is already set on the provided `URLRequest`s, it will be set to `application/x-www-form-urlencoded; charset=utf-8`. Encoding behavior can be customized by passing an instance of `[URLEncodedFormEncoder](Classes/URLEncodedFormEncoder.html) ` to the initializer. [See more](Classes/URLEncodedFormParameterEncoder.html) #### Declaration * `[Session](#/s:9Alamofire7SessionC) ` `Session` creates and manages Alamofire’s `[Request](Classes/Request.html) ` types during their lifetimes. It also provides common functionality for all `[Request](Classes/Request.html) `s, including queuing, interception, trust management, redirect handling, and response cache handling. [See more](Classes/Session.html) #### Declaration * `[SessionDelegate](#/c:@M@Alamofire@objc(cs)SessionDelegate) ` Class which implements the various `URLSessionDelegate` methods to connect various Alamofire features. [See more](Classes/SessionDelegate.html) #### Declaration * `[UploadRequest](#/s:9Alamofire13UploadRequestC) ` `[DataRequest](Classes/DataRequest.html) ` subclass which handles `Data` upload from memory, file, or stream using `URLSessionUploadTask`. [See more](Classes/UploadRequest.html) #### Declaration * `[AuthenticationInterceptor](#/s:9Alamofire25AuthenticationInterceptorC) ` The `AuthenticationInterceptor` class manages the queuing and threading complexity of authenticating requests. It relies on an `[Authenticator](Protocols/Authenticator.html) ` type to handle the actual `URLRequest` authentication and `Credential` refresh. [See more](Classes/AuthenticationInterceptor.html) #### Declaration * `[CompositeEventMonitor](#/s:9Alamofire21CompositeEventMonitorC) ` An `[EventMonitor](Protocols/EventMonitor.html) ` which can contain multiple `[EventMonitor](Protocols/EventMonitor.html) `s and calls their methods on their queues. [See more](Classes/CompositeEventMonitor.html) #### Declaration * `[ClosureEventMonitor](#/s:9Alamofire19ClosureEventMonitorC) ` `[EventMonitor](Protocols/EventMonitor.html) ` that allows optional closures to be set to receive events. [See more](Classes/ClosureEventMonitor.html) #### Declaration * `[MultipartFormData](#/s:9Alamofire17MultipartFormDataC) ` Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset. For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well and the w3 form documentation. * [https://www.ietf.org/rfc/rfc2388.txt](https://www.ietf.org/rfc/rfc2388.txt) * [https://www.ietf.org/rfc/rfc2045.txt](https://www.ietf.org/rfc/rfc2045.txt) * [https://www.w3.org/TR/html401/interact/forms.html#h-17.13](https://www.w3.org/TR/html401/interact/forms.html#h-17.13) [See more](Classes/MultipartFormData.html) #### Declaration * `[NetworkReachabilityManager](#/s:9Alamofire26NetworkReachabilityManagerC) ` The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and WiFi network interfaces. Reachability can be used to determine background information about why a network operation failed, or to retry network requests when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability. [See more](Classes/NetworkReachabilityManager.html) #### Declaration * `[Adapter](#/s:9Alamofire7AdapterC) ` Closure-based `[RequestAdapter](Protocols/RequestAdapter.html) `. [See more](Classes/Adapter.html) #### Declaration * `[Retrier](#/s:9Alamofire7RetrierC) ` Closure-based `[RequestRetrier](Protocols/RequestRetrier.html) `. [See more](Classes/Retrier.html) #### Declaration * `[Interceptor](#/s:9Alamofire11InterceptorC) ` `[RequestInterceptor](Protocols/RequestInterceptor.html) ` which can use multiple `[RequestAdapter](Protocols/RequestAdapter.html) ` and `[RequestRetrier](Protocols/RequestRetrier.html) ` values. [See more](Classes/Interceptor.html) #### Declaration [](#/Data) ### Data * `[DataResponseSerializer](#/s:9Alamofire22DataResponseSerializerC) ` A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that performs minimal response checking and returns any response `Data` as-is. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `Data` value is returned. [See more](Classes/DataResponseSerializer.html) #### Declaration [](#/String) ### String * `[StringResponseSerializer](#/s:9Alamofire24StringResponseSerializerC) ` A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that decodes the response data as a `String`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `String` is returned. [See more](Classes/StringResponseSerializer.html) #### Declaration [](#/JSON) ### JSON * `[JSONResponseSerializer](#/s:9Alamofire22JSONResponseSerializerC) ` A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that decodes the response data using `JSONSerialization`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an `NSNull` value is returned. [See more](Classes/JSONResponseSerializer.html) #### Declaration [](#/Decodable) ### Decodable * `[DecodableResponseSerializer](#/s:9Alamofire27DecodableResponseSerializerC) ` A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that decodes the response data as a `Decodable` value using any decoder that conforms to `[DataDecoder](Protocols/DataDecoder.html) `. By default, this is an instance of `JSONDecoder`. [See more](Classes/DecodableResponseSerializer.html) #### Declaration * `[RetryPolicy](#/s:9Alamofire11RetryPolicyC) ` A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes as well as certain types of networking errors. [See more](Classes/RetryPolicy.html) #### Declaration * `[ConnectionLostRetryPolicy](#/s:9Alamofire25ConnectionLostRetryPolicyC) ` A retry policy that automatically retries idempotent requests for network connection lost errors. For more information about retrying network connection lost errors, please refer to Apple’s [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html) . [See more](Classes/ConnectionLostRetryPolicy.html) #### Declaration * `[ServerTrustManager](#/s:9Alamofire18ServerTrustManagerC) ` Responsible for managing the mapping of `[ServerTrustEvaluating](Protocols/ServerTrustEvaluating.html) ` values to given hosts. [See more](Classes/ServerTrustManager.html) #### Declaration [](#/Server%20Trust%20Evaluators) ### Server Trust Evaluators * `[DefaultTrustEvaluator](#/s:9Alamofire21DefaultTrustEvaluatorC) ` An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain. [See more](Classes/DefaultTrustEvaluator.html) #### Declaration * `[RevocationTrustEvaluator](#/s:9Alamofire24RevocationTrustEvaluatorC) ` An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates. Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain. [See more](Classes/RevocationTrustEvaluator.html) #### Declaration * `[PinnedCertificatesTrustEvaluator](#/s:9Alamofire32PinnedCertificatesTrustEvaluatorC) ` Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned certificates match one of the server certificates. By validating both the certificate chain and host, certificate pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments. [See more](Classes/PinnedCertificatesTrustEvaluator.html) #### Declaration * `[PublicKeysTrustEvaluator](#/s:9Alamofire24PublicKeysTrustEvaluatorC) ` Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned public keys match one of the server certificate public keys. By validating both the certificate chain and host, public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments. [See more](Classes/PublicKeysTrustEvaluator.html) #### Declaration * `[CompositeTrustEvaluator](#/s:9Alamofire23CompositeTrustEvaluatorC) ` Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the evaluators consider it valid. [See more](Classes/CompositeTrustEvaluator.html) #### Declaration * `[DisabledTrustEvaluator](#/s:9Alamofire22DisabledTrustEvaluatorC) ` Disables all evaluation which in turn will always consider any server trust as valid. **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!** [See more](Classes/DisabledTrustEvaluator.html) #### Declaration * `[URLEncodedFormEncoder](#/s:9Alamofire21URLEncodedFormEncoderC) ` An object that encodes instances into URL-encoded query strings. `ArrayEncoding` can be used to configure how `Array` values are encoded. By default, the `.brackets` encoding is used, encoding array values with brackets for each value. e.g `array[]=1&array[]=2`. `BoolEncoding` can be used to configure how `Bool` values are encoded. By default, the `.numeric` encoding is used, encoding `true` as `1` and `false` as `0`. `DataEncoding` can be used to configure how `Data` values are encoded. By default, the `.deferredToData` encoding is used, which encodes `Data` values using their default `Encodable` implementation. `DateEncoding` can be used to configure how `Date` values are encoded. By default, the `.deferredToDate` encoding is used, which encodes `Date`s using their default `Encodable` implementation. `KeyEncoding` can be used to configure how keys are encoded. By default, the `.useDefaultKeys` encoding is used, which encodes the keys directly from the `Encodable` implementation. `KeyPathEncoding` can be used to configure how paths within nested objects are encoded. By default, the `.brackets` encoding is used, which encodes each sub-key in brackets. e.g. `parent[child][grandchild]=value`. `NilEncoding` can be used to configure how `nil` `Optional` values are encoded. By default, the `.dropKey` encoding is used, which drops `nil` key / value pairs from the output entirely. `SpaceEncoding` can be used to configure how spaces are encoded. By default, the `.percentEscaped` encoding is used, replacing spaces with `%20`. This type is largely based on Vapor’s [`url-encoded-form`](https://github.com/vapor/url-encoded-form) project. [See more](Classes/URLEncodedFormEncoder.html) #### Declaration --- # AuthenticationInterceptor Class Reference AuthenticationInterceptor ========================= The `AuthenticationInterceptor` class manages the queuing and threading complexity of authenticating requests. It relies on an `[Authenticator](../Protocols/Authenticator.html) ` type to handle the actual `URLRequest` authentication and `Credential` refresh. [](#/Typealiases) ### Typealiases * `[Credential](#/s:9Alamofire25AuthenticationInterceptorC10Credentiala) ` Type of credential used to authenticate requests. #### Declaration [](#/Helper%20Types) ### Helper Types * `[RefreshWindow](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV) ` Type that defines a time window used to identify excessive refresh calls. When enabled, prior to executing a refresh, the `[AuthenticationInterceptor](../Classes/AuthenticationInterceptor.html) ` compares the timestamp history of previous refresh calls against the `RefreshWindow`. If more refreshes have occurred within the refresh window than allowed, the refresh is cancelled and an `AuthorizationError.excessiveRefresh` error is thrown. [See more](../Classes/AuthenticationInterceptor/RefreshWindow.html) #### Declaration [](#/Properties) ### Properties * `[credential](#/s:9Alamofire25AuthenticationInterceptorC10credential10CredentialQzSgvp) ` The `[Credential](../Classes/AuthenticationInterceptor.html#/s:9Alamofire25AuthenticationInterceptorC10Credentiala) ` used to authenticate requests. #### Declaration [](#/Initialization) ### Initialization * `[init(authenticator:credential:refreshWindow:)](#/s:9Alamofire25AuthenticationInterceptorC13authenticator10credential13refreshWindowACyxGx_10CredentialQzSgAC07RefreshG0Vyx_GSgtcfc) ` Creates an `AuthenticationInterceptor` instance from the specified parameters. A `nil` `[RefreshWindow](../Classes/AuthenticationInterceptor/RefreshWindow.html) ` will result in the `AuthenticationInterceptor` not checking for excessive refresh calls. It is recommended to always use a `[RefreshWindow](../Classes/AuthenticationInterceptor/RefreshWindow.html) ` to avoid endless refresh cycles. #### Declaration #### Parameters | | | | --- | --- | | `_authenticator_` | The `[Authenticator](../Protocols/Authenticator.html) ` type. | | `_credential_` | The `[Credential](../Classes/AuthenticationInterceptor.html#/s:9Alamofire25AuthenticationInterceptorC10Credentiala) ` if it exists. `nil` by default. | | `_refreshWindow_` | The `[RefreshWindow](../Classes/AuthenticationInterceptor/RefreshWindow.html) ` used to identify excessive refresh calls. `RefreshWindow()` by default. | [](#/Adapt) ### Adapt * `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) ` #### Declaration [](#/Retry) ### Retry * `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) ` #### Declaration --- # RefreshWindow Structure Reference RefreshWindow ============= Type that defines a time window used to identify excessive refresh calls. When enabled, prior to executing a refresh, the `[AuthenticationInterceptor](../../Classes/AuthenticationInterceptor.html) ` compares the timestamp history of previous refresh calls against the `RefreshWindow`. If more refreshes have occurred within the refresh window than allowed, the refresh is cancelled and an `AuthorizationError.excessiveRefresh` error is thrown. * `[interval](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8intervalSdvp) ` `TimeInterval` defining the duration of the time window before the current time in which the number of refresh attempts is compared against `[maximumAttempts](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `. For example, if `interval` is 30 seconds, then the `RefreshWindow` represents the past 30 seconds. If more attempts occurred in the past 30 seconds than `[maximumAttempts](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `, an `.excessiveRefresh` error will be thrown. #### Declaration * `[maximumAttempts](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) ` Total refresh attempts allowed within `[interval](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8intervalSdvp) ` before throwing an `.excessiveRefresh` error. #### Declaration * `[init(interval:maximumAttempts:)](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8interval15maximumAttemptsAEyx_GSd_Sitcfc) ` Creates a `RefreshWindow` instance from the specified `[interval](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8intervalSdvp) ` and `[maximumAttempts](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `. #### Declaration #### Parameters | | | | --- | --- | | `_interval_` | `TimeInterval` defining the duration of the time window before the current time. | | `_maximumAttempts_` | The maximum attempts allowed within the `TimeInterval`. | --- # CompositeTrustEvaluator Class Reference CompositeTrustEvaluator ======================= Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the evaluators consider it valid. * `[init(evaluators:)](#/s:9Alamofire23CompositeTrustEvaluatorC10evaluatorsACSayAA06ServerC10Evaluating_pG_tcfc) ` Creates a `CompositeTrustEvaluator` from the provided evaluators. #### Declaration #### Parameters | | | | --- | --- | | `_evaluators_` | The `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` values used to evaluate the server trust. | * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` #### Declaration --- # ClosureEventMonitor Class Reference ClosureEventMonitor =================== `[EventMonitor](../Protocols/EventMonitor.html) ` that allows optional closures to be set to receive events. * `[sessionDidBecomeInvalidWithError](#/s:9Alamofire19ClosureEventMonitorC32sessionDidBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtcSgvp) ` Closure called on the `[urlSession(_:didBecomeInvalidWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF) ` event. #### Declaration * `[taskDidReceiveChallenge](#/s:9Alamofire19ClosureEventMonitorC23taskDidReceiveChallengeySo12NSURLSessionC_So0I4TaskCSo019NSURLAuthenticationH0CtcSgvp) ` Closure called on the `urlSession(_:task:didReceive:completionHandler:)`. #### Declaration * `[taskDidSendBodyData](#/s:9Alamofire19ClosureEventMonitorC19taskDidSendBodyDataySo12NSURLSessionC_So0J4TaskCs5Int64VA2JtcSgvp) ` Closure that receives `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF) ` event. #### Declaration * `[taskNeedNewBodyStream](#/s:9Alamofire19ClosureEventMonitorC21taskNeedNewBodyStreamySo12NSURLSessionC_So0J4TaskCtcSgvp) ` Closure called on the `urlSession(_:task:needNewBodyStream:)` event. #### Declaration * `[taskWillPerformHTTPRedirection](#/s:9Alamofire19ClosureEventMonitorC30taskWillPerformHTTPRedirectionySo12NSURLSessionC_So0I4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtcSgvp) ` Closure called on the `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` event. #### Declaration * `[taskDidFinishCollectingMetrics](#/s:9Alamofire19ClosureEventMonitorC30taskDidFinishCollectingMetricsySo12NSURLSessionC_So0J4TaskCSo0jkI0CtcSgvp) ` Closure called on the `[urlSession(_:task:didFinishCollecting:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF) ` event. #### Declaration * `[taskDidComplete](#/s:9Alamofire19ClosureEventMonitorC15taskDidCompleteySo12NSURLSessionC_So0H4TaskCs5Error_pSgtcSgvp) ` Closure called on the `[urlSession(_:task:didCompleteWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF) ` event. #### Declaration * `[taskIsWaitingForConnectivity](#/s:9Alamofire19ClosureEventMonitorC28taskIsWaitingForConnectivityySo12NSURLSessionC_So0J4TaskCtcSgvp) ` Closure called on the `[urlSession(_:taskIsWaitingForConnectivity:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF) ` event. #### Declaration * `[dataTaskDidReceiveResponse](#/s:9Alamofire19ClosureEventMonitorC26dataTaskDidReceiveResponseySo12NSURLSessionC_So0j4DataF0CSo13NSURLResponseCtcSgvp) ` Closure called on the `urlSession(_:dataTask:didReceive:completionHandler:)` event. #### Declaration * `[dataTaskDidReceiveData](#/s:9Alamofire19ClosureEventMonitorC22dataTaskDidReceiveDataySo12NSURLSessionC_So0jiF0C10Foundation0I0VtcSgvp) ` Closure that receives the `[urlSession(_:dataTask:didReceive:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) ` event. #### Declaration * `[dataTaskWillCacheResponse](#/s:9Alamofire19ClosureEventMonitorC25dataTaskWillCacheResponseySo12NSURLSessionC_So0j4DataF0CSo19NSCachedURLResponseCtcSgvp) ` Closure called on the `urlSession(_:dataTask:willCacheResponse:completionHandler:)` event. #### Declaration * `[downloadTaskDidFinishDownloadingToURL](#/s:9Alamofire19ClosureEventMonitorC37downloadTaskDidFinishDownloadingToURLySo12NSURLSessionC_So0l8DownloadF0C10Foundation0K0VtcSgvp) ` Closure called on the `[urlSession(_:downloadTask:didFinishDownloadingTo:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF) ` event. #### Declaration * `[downloadTaskDidWriteData](#/s:9Alamofire19ClosureEventMonitorC24downloadTaskDidWriteDataySo12NSURLSessionC_So0j8DownloadF0Cs5Int64VA2JtcSgvp) ` Closure called on the `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF) ` event. #### Declaration * `[downloadTaskDidResumeAtOffset](#/s:9Alamofire19ClosureEventMonitorC29downloadTaskDidResumeAtOffsetySo12NSURLSessionC_So0k8DownloadF0Cs5Int64VAJtcSgvp) ` Closure called on the `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF) ` event. #### Declaration [](#/Request%20Events) ### Request Events * `[requestDidCreateInitialURLRequest](#/s:9Alamofire19ClosureEventMonitorC33requestDidCreateInitialURLRequestyAA7RequestC_10Foundation0I0VtcSgvp) ` Closure called on the `[request(_:didCreateInitialURLRequest:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF) ` event. #### Declaration * `[requestDidFailToCreateURLRequestWithError](#/s:9Alamofire19ClosureEventMonitorC41requestDidFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtcSgvp) ` Closure called on the `[request(_:didFailToCreateURLRequestWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF) ` event. #### Declaration * `[requestDidAdaptInitialRequestToAdaptedRequest](#/s:9Alamofire19ClosureEventMonitorC038requestDidAdaptInitialRequestToAdaptedI0yAA0I0C_10Foundation10URLRequestVAItcSgvp) ` Closure called on the `[request(_:didAdaptInitialRequest:to:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF) ` event. #### Declaration * `[requestDidFailToAdaptURLRequestWithError](#/s:9Alamofire19ClosureEventMonitorC40requestDidFailToAdaptURLRequestWithErroryAA7RequestC_10Foundation0J0VAA7AFErrorOtcSgvp) ` Closure called on the `[request(_:didFailToAdaptURLRequest:withError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF) ` event. #### Declaration * `[requestDidCreateURLRequest](#/s:9Alamofire19ClosureEventMonitorC26requestDidCreateURLRequestyAA7RequestC_10Foundation0H0VtcSgvp) ` Closure called on the `[request(_:didCreateURLRequest:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF) ` event. #### Declaration * `[requestDidCreateTask](#/s:9Alamofire19ClosureEventMonitorC20requestDidCreateTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) ` Closure called on the `[request(_:didCreateTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event. #### Declaration * `[requestDidGatherMetrics](#/s:9Alamofire19ClosureEventMonitorC23requestDidGatherMetricsyAA7RequestC_So016NSURLSessionTaskH0CtcSgvp) ` Closure called on the `[request(_:didGatherMetrics:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF) ` event. #### Declaration * `[requestDidFailTaskEarlyWithError](#/s:9Alamofire19ClosureEventMonitorC32requestDidFailTaskEarlyWithErroryAA7RequestC_So012NSURLSessionH0CAA7AFErrorOtcSgvp) ` Closure called on the `[request(_:didFailTask:earlyWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF) ` event. #### Declaration * `[requestDidCompleteTaskWithError](#/s:9Alamofire19ClosureEventMonitorC31requestDidCompleteTaskWithErroryAA7RequestC_So012NSURLSessionH0CAA7AFErrorOSgtcSgvp) ` Closure called on the `[request(_:didCompleteTask:with:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) ` event. #### Declaration * `[requestIsRetrying](#/s:9Alamofire19ClosureEventMonitorC17requestIsRetryingyAA7RequestCcSgvp) ` Closure called on the `[requestIsRetrying(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF) ` event. #### Declaration * `[requestDidFinish](#/s:9Alamofire19ClosureEventMonitorC16requestDidFinishyAA7RequestCcSgvp) ` Closure called on the `[requestDidFinish(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) ` event. #### Declaration * `[requestDidResume](#/s:9Alamofire19ClosureEventMonitorC16requestDidResumeyAA7RequestCcSgvp) ` Closure called on the `[requestDidResume(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) ` event. #### Declaration * `[requestDidResumeTask](#/s:9Alamofire19ClosureEventMonitorC20requestDidResumeTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) ` Closure called on the `[request(_:didResumeTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event. #### Declaration * `[requestDidSuspend](#/s:9Alamofire19ClosureEventMonitorC17requestDidSuspendyAA7RequestCcSgvp) ` Closure called on the `[requestDidSuspend(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) ` event. #### Declaration * `[requestDidSuspendTask](#/s:9Alamofire19ClosureEventMonitorC21requestDidSuspendTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) ` Closure called on the `[request(_:didSuspendTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event. #### Declaration * `[requestDidCancel](#/s:9Alamofire19ClosureEventMonitorC16requestDidCancelyAA7RequestCcSgvp) ` Closure called on the `[requestDidCancel(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) ` event. #### Declaration * `[requestDidCancelTask](#/s:9Alamofire19ClosureEventMonitorC20requestDidCancelTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) ` Closure called on the `[request(_:didCancelTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event. #### Declaration * `[requestDidValidateRequestResponseDataWithResult](#/s:9Alamofire19ClosureEventMonitorC47requestDidValidateRequestResponseDataWithResultyAA0jH0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAG0J0VSgs0L0Oyyts5Error_pGtcSgvp) ` Closure called on the `[request(_:didValidateRequest:response:data:withResult:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF) ` event. #### Declaration * `[requestDidParseResponse](#/s:9Alamofire19ClosureEventMonitorC23requestDidParseResponseyAA11DataRequestC_AA0iH0Vy10Foundation0I0VSgAA7AFErrorOGtcSgvp) ` Closure called on the `[request(_:didParseResponse:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) ` event. #### Declaration * `[requestDidValidateRequestResponseWithResult](#/s:9Alamofire19ClosureEventMonitorC43requestDidValidateRequestResponseWithResultyAA010DataStreamH0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0K0Oyyts5Error_pGtcSgvp) ` Closure called on the `[request(_:didValidateRequest:response:withResult:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF) ` event. #### Declaration * `[requestDidCreateUploadable](#/s:9Alamofire19ClosureEventMonitorC26requestDidCreateUploadableyAA13UploadRequestC_AF0H0OtcSgvp) ` Closure called on the `[request(_:didCreateUploadable:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF) ` event. #### Declaration * `[requestDidFailToCreateUploadableWithError](#/s:9Alamofire19ClosureEventMonitorC41requestDidFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtcSgvp) ` Closure called on the `[request(_:didFailToCreateUploadableWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF) ` event. #### Declaration * `[requestDidProvideInputStream](#/s:9Alamofire19ClosureEventMonitorC28requestDidProvideInputStreamyAA13UploadRequestC_So07NSInputI0CtcSgvp) ` Closure called on the `[request(_:didProvideInputStream:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF) ` event. #### Declaration * `[requestDidFinishDownloadingUsingTaskWithResult](#/s:9Alamofire19ClosureEventMonitorC46requestDidFinishDownloadingUsingTaskWithResultyAA15DownloadRequestC_So012NSURLSessionJ0Cs0L0Oy10Foundation3URLVAA7AFErrorOGtcSgvp) ` Closure called on the `[request(_:didFinishDownloadingUsing:with:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF) ` event. #### Declaration * `[requestDidCreateDestinationURL](#/s:9Alamofire19ClosureEventMonitorC30requestDidCreateDestinationURLyAA15DownloadRequestC_10Foundation0I0VtcSgvp) ` Closure called on the `[request(_:didCreateDestinationURL:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF) ` event. #### Declaration * `[requestDidValidateRequestResponseFileURLWithResult](#/s:9Alamofire19ClosureEventMonitorC50requestDidValidateRequestResponseFileURLWithResultyAA08DownloadH0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAG3URLVSgs0L0Oyyts5Error_pGtcSgvp) ` Closure called on the `request(_:didValidateRequest:response:temporaryURL:destinationURL:withResult:)` event. #### Declaration * `[requestDidParseDownloadResponse](#/s:9Alamofire19ClosureEventMonitorC31requestDidParseDownloadResponseyAA0H7RequestC_AA0hI0Vy10Foundation3URLVSgAA7AFErrorOGtcSgvp) ` Closure called on the `[request(_:didParseResponse:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) ` event. #### Declaration * `[queue](#/s:9Alamofire12EventMonitorP5queueSo012OS_dispatch_D0Cvp) ` #### Declaration * `[init(queue:)](#/s:9Alamofire19ClosureEventMonitorC5queueACSo012OS_dispatch_E0C_tcfc) ` Creates an instance using the provided queue. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which events will fired. `.main` by default. | * `[urlSession(_:didBecomeInvalidWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF) ` #### Declaration * `[urlSession(_:task:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_4task10didReceiveySo12NSURLSessionC_So0I4TaskCSo28NSURLAuthenticationChallengeCtF) ` #### Declaration * `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF) ` #### Declaration * `[urlSession(_:taskNeedsNewBodyStream:)](#/s:9Alamofire12EventMonitorP10urlSession_22taskNeedsNewBodyStreamySo12NSURLSessionC_So0K4TaskCtF) ` #### Declaration * `[urlSession(_:task:willPerformHTTPRedirection:newRequest:)](#/s:9Alamofire12EventMonitorP10urlSession_4task26willPerformHTTPRedirection10newRequestySo12NSURLSessionC_So0L4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtF) ` #### Declaration * `[urlSession(_:task:didFinishCollecting:)](#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF) ` #### Declaration * `[urlSession(_:task:didCompleteWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF) ` #### Declaration * `[urlSession(_:taskIsWaitingForConnectivity:)](#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF) ` #### Declaration * `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) ` #### Declaration * `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0C10Foundation0K0VtF) ` #### Declaration * `[urlSession(_:dataTask:willCacheResponse:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask17willCacheResponseySo12NSURLSessionC_So0k4DataG0CSo19NSCachedURLResponseCtF) ` #### Declaration * `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF) ` #### Declaration * `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF) ` #### Declaration * `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF) ` #### Declaration * `[request(_:didCreateInitialURLRequest:)](#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF) ` #### Declaration * `[request(_:didFailToCreateURLRequestWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF) ` #### Declaration * `[request(_:didAdaptInitialRequest:to:)](#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF) ` #### Declaration * `[request(_:didFailToAdaptURLRequest:withError:)](#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF) ` #### Declaration * `[request(_:didCreateURLRequest:)](#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF) ` #### Declaration * `[request(_:didCreateTask:)](#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didGatherMetrics:)](#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF) ` #### Declaration * `[request(_:didFailTask:earlyWithError:)](#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF) ` #### Declaration * `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) ` #### Declaration * `[requestIsRetrying(_:)](#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF) ` #### Declaration * `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) ` #### Declaration * `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) ` #### Declaration * `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) ` #### Declaration * `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) ` #### Declaration * `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didValidateRequest:response:data:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF) ` #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) ` #### Declaration * `[request(_:didValidateRequest:response:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF) ` #### Declaration * `[request(_:didCreateUploadable:)](#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF) ` #### Declaration * `[request(_:didFailToCreateUploadableWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF) ` #### Declaration * `[request(_:didProvideInputStream:)](#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF) ` #### Declaration * `[request(_:didFinishDownloadingUsing:with:)](#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF) ` #### Declaration * `[request(_:didCreateDestinationURL:)](#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF) ` #### Declaration * `[request(_:didValidateRequest:response:fileURL:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response7fileURL10withResultyAA08DownloadG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0J0VSgs0L0Oyyts5Error_pGtF) ` #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vy10Foundation3URLVSgAA7AFErrorOGtF) ` #### Declaration --- # ConnectionLostRetryPolicy Class Reference ConnectionLostRetryPolicy ========================= A retry policy that automatically retries idempotent requests for network connection lost errors. For more information about retrying network connection lost errors, please refer to Apple’s [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html) . * `[init(retryLimit:exponentialBackoffBase:exponentialBackoffScale:retryableHTTPMethods:)](#/s:9Alamofire25ConnectionLostRetryPolicyC10retryLimit22exponentialBackoffBase0hI5Scale20retryableHTTPMethodsACSu_SuSdShyAA10HTTPMethodVGtcfc) ` Creates a `ConnectionLostRetryPolicy` instance from the specified parameters. #### Declaration #### Parameters | | | | --- | --- | | `_retryLimit_` | The total number of times the request is allowed to be retried. `[RetryPolicy.defaultRetryLimit](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC07defaultB5LimitSuvpZ) ` by default. | | `_exponentialBackoffBase_` | The base of the exponential backoff policy. `[RetryPolicy.defaultExponentialBackoffBase](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC29defaultExponentialBackoffBaseSuvpZ) ` by default. | | `_exponentialBackoffScale_` | The scale of the exponential backoff. `[RetryPolicy.defaultExponentialBackoffScale](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC30defaultExponentialBackoffScaleSdvpZ) ` by default. | | `_retryableHTTPMethods_` | The idempotent http methods to retry. `[RetryPolicy.defaultRetryableHTTPMethods](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) ` by default. | --- # DataResponseSerializer Class Reference DataResponseSerializer ====================== A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that performs minimal response checking and returns any response `Data` as-is. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](../Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `Data` value is returned. * `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) ` #### Declaration * `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) ` #### Declaration * `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) ` #### Declaration * `[init(dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire22DataResponseSerializerC16dataPreprocessor05emptyC5Codes0G14RequestMethodsAcA0bF0_p_ShySiGShyAA10HTTPMethodVGtcfc) ` Creates a `DataResponseSerializer` using the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | * `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) ` #### Declaration --- # CompositeEventMonitor Class Reference CompositeEventMonitor ===================== An `[EventMonitor](../Protocols/EventMonitor.html) ` which can contain multiple `[EventMonitor](../Protocols/EventMonitor.html) `s and calls their methods on their queues. * `[queue](#/s:9Alamofire12EventMonitorP5queueSo012OS_dispatch_D0Cvp) ` #### Declaration * `[urlSession(_:didBecomeInvalidWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF) ` #### Declaration * `[urlSession(_:task:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_4task10didReceiveySo12NSURLSessionC_So0I4TaskCSo28NSURLAuthenticationChallengeCtF) ` #### Declaration * `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF) ` #### Declaration * `[urlSession(_:taskNeedsNewBodyStream:)](#/s:9Alamofire12EventMonitorP10urlSession_22taskNeedsNewBodyStreamySo12NSURLSessionC_So0K4TaskCtF) ` #### Declaration * `[urlSession(_:task:willPerformHTTPRedirection:newRequest:)](#/s:9Alamofire12EventMonitorP10urlSession_4task26willPerformHTTPRedirection10newRequestySo12NSURLSessionC_So0L4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtF) ` #### Declaration * `[urlSession(_:task:didFinishCollecting:)](#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF) ` #### Declaration * `[urlSession(_:task:didCompleteWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF) ` #### Declaration * `[urlSession(_:taskIsWaitingForConnectivity:)](#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF) ` #### Declaration * `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) ` #### Declaration * `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0C10Foundation0K0VtF) ` #### Declaration * `[urlSession(_:dataTask:willCacheResponse:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask17willCacheResponseySo12NSURLSessionC_So0k4DataG0CSo19NSCachedURLResponseCtF) ` #### Declaration * `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF) ` #### Declaration * `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF) ` #### Declaration * `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF) ` #### Declaration * `[request(_:didCreateInitialURLRequest:)](#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF) ` #### Declaration * `[request(_:didFailToCreateURLRequestWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF) ` #### Declaration * `[request(_:didAdaptInitialRequest:to:)](#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF) ` #### Declaration * `[request(_:didFailToAdaptURLRequest:withError:)](#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF) ` #### Declaration * `[request(_:didCreateURLRequest:)](#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF) ` #### Declaration * `[request(_:didCreateTask:)](#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didGatherMetrics:)](#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF) ` #### Declaration * `[request(_:didFailTask:earlyWithError:)](#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF) ` #### Declaration * `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) ` #### Declaration * `[requestIsRetrying(_:)](#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF) ` #### Declaration * `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) ` #### Declaration * `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) ` #### Declaration * `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) ` #### Declaration * `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) ` #### Declaration * `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) ` #### Declaration * `[request(_:didValidateRequest:response:data:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF) ` #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) ` #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vyqd__AA7AFErrorOGts8SendableRd__lF) ` #### Declaration * `[request(_:didValidateRequest:response:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF) ` #### Declaration * `[request(_:didParseStream:)](#/s:9Alamofire12EventMonitorP7request_14didParseStreamyAA04DataG7RequestC_s6ResultOyqd__AA7AFErrorOGts8SendableRd__lF) ` #### Declaration * `[request(_:didCreateUploadable:)](#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF) ` #### Declaration * `[request(_:didFailToCreateUploadableWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF) ` #### Declaration * `[request(_:didProvideInputStream:)](#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF) ` #### Declaration * `[request(_:didFinishDownloadingUsing:with:)](#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF) ` #### Declaration * `[request(_:didCreateDestinationURL:)](#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF) ` #### Declaration * `[request(_:didValidateRequest:response:fileURL:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response7fileURL10withResultyAA08DownloadG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0J0VSgs0L0Oyyts5Error_pGtF) ` #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vy10Foundation3URLVSgAA7AFErrorOGtF) ` #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vyqd__AA7AFErrorOGts8SendableRd__lF) ` #### Declaration --- # Stream Structure Reference Stream ====== Type encapsulating an `[Event](../../Classes/DataStreamRequest/Event.html) ` as it flows through the stream, as well as a `[CancellationToken](../../Classes/DataStreamRequest/CancellationToken.html) ` which can be used to stop the stream at any time. * `[event](#/s:9Alamofire17DataStreamRequestC0C0V5eventAC5EventOy_xq_Gvp) ` Latest `[Event](../../Classes/DataStreamRequest/Event.html) ` from the stream. #### Declaration * `[token](#/s:9Alamofire17DataStreamRequestC0C0V5tokenAC17CancellationTokenVvp) ` Token used to cancel the stream. #### Declaration * `[cancel()](#/s:9Alamofire17DataStreamRequestC0C0V6cancelyyF) ` Cancel the ongoing stream by canceling the underlying `[DataStreamRequest](../../Classes/DataStreamRequest.html) `. #### Declaration * `[result](#/s:9Alamofire17DataStreamRequestC0C0V6results6ResultOyxq_GSgvp) ` Incoming `Result` values from `Event.stream`. #### Declaration * `[value](#/s:9Alamofire17DataStreamRequestC0C0V5valuexSgvp) ` `Success` value of the instance, if any. #### Declaration * `[error](#/s:9Alamofire17DataStreamRequestC0C0V5errorq_Sgvp) ` `Failure` value of the instance, if any. #### Declaration * `[completion](#/s:9Alamofire17DataStreamRequestC0C0V10completionAC10CompletionVSgvp) ` `[Completion](../../Classes/DataStreamRequest/Completion.html) ` value of the instance, if any. #### Declaration --- # DataStreamRequest Class Reference DataStreamRequest ================= `[Request](../Classes/Request.html) ` subclass which streams HTTP response `Data` through a `Handler` closure. * `[Handler](#/s:9Alamofire17DataStreamRequestC7Handlera) ` Closure type handling `[DataStreamRequest.Stream](../Classes/DataStreamRequest/Stream.html) ` values. #### Declaration * `[Stream](#/s:9Alamofire17DataStreamRequestC0C0V) ` Type encapsulating an `[Event](../Classes/DataStreamRequest/Event.html) ` as it flows through the stream, as well as a `[CancellationToken](../Classes/DataStreamRequest/CancellationToken.html) ` which can be used to stop the stream at any time. [See more](../Classes/DataStreamRequest/Stream.html) #### Declaration * `[Event](#/s:9Alamofire17DataStreamRequestC5EventO) ` Type representing an event flowing through the stream. Contains either the `Result` of processing streamed `Data` or the completion of the stream. [See more](../Classes/DataStreamRequest/Event.html) #### Declaration * `[Completion](#/s:9Alamofire17DataStreamRequestC10CompletionV) ` Value containing the state of a `[DataStreamRequest](../Classes/DataStreamRequest.html) ` when the stream was completed. [See more](../Classes/DataStreamRequest/Completion.html) #### Declaration * `[CancellationToken](#/s:9Alamofire17DataStreamRequestC17CancellationTokenV) ` Type used to cancel an ongoing stream. [See more](../Classes/DataStreamRequest/CancellationToken.html) #### Declaration * `[convertible](#/s:9Alamofire17DataStreamRequestC11convertibleAA21URLRequestConvertible_pvp) ` `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value used to create `URLRequest`s for this instance. #### Declaration * `[automaticallyCancelOnStreamError](#/s:9Alamofire17DataStreamRequestC021automaticallyCancelOnC5ErrorSbvp) ` Whether or not the instance will be cancelled if stream parsing encounters an error. #### Declaration * `[validate(_:)](#/s:9Alamofire17DataStreamRequestC8validateyACXDs6ResultOyyts5Error_pG10Foundation10URLRequestVSg_So17NSHTTPURLResponseCtYbcF) ` Validates the `URLRequest` and `HTTPURLResponse` received for the instance using the provided `[Validation](../Classes/DataStreamRequest.html#/s:9Alamofire17DataStreamRequestC10Validationa) ` closure. #### Declaration #### Parameters | | | | --- | --- | | `_validation_` | `[Validation](../Classes/DataStreamRequest.html#/s:9Alamofire17DataStreamRequestC10Validationa) ` closure used to validate the request and response. | #### Return Value The `DataStreamRequest`. * `[asInputStream(bufferSize:)](#/s:9Alamofire17DataStreamRequestC07asInputC010bufferSizeSo07NSInputC0CSgSi_tF) ` Produces an `InputStream` that receives the `Data` received by the instance. #### Declaration #### Parameters | | | | --- | --- | | `_bufferSize_` | Size, in bytes, of the buffer between the `OutputStream` and `InputStream`. | #### Return Value The `InputStream` bound to the internal `OutboundStream`. * `[onHTTPResponse(on:perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse0E07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseC_yAA0D0C19ResponseDispositionOctctF) ` Sets a closure called whenever the `[DataRequest](../Classes/DataRequest.html) ` produces an `HTTPURLResponse` and providing a completion handler to return a `ResponseDisposition` value. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. | | `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. The `completionHandler` provided MUST be called, otherwise the request will never complete. | #### Return Value The instance. * `[onHTTPResponse(on:perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse0E07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseCctF) ` Sets a closure called whenever the `[DataRequest](../Classes/DataRequest.html) ` produces an `HTTPURLResponse`. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. | | `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. | #### Return Value The instance. [](#/Response%20Serialization) ### Response Serialization * `[responseStream(on:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC02on6streamACXDSo17OS_dispatch_queueC_yAC0C0Vy_10Foundation0B0Vs5NeverOGKctF) ` Adds a `StreamHandler` which performs no parsing on incoming `Data`. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. | | `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. | #### Return Value The `DataStreamRequest`. * `[responseStream(using:on:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC05using2on6streamACXDx_So17OS_dispatch_queueCyAC0C0Vy_16SerializedObjectQzAA7AFErrorOGKctAA0bC10SerializerRzlF) ` Adds a `StreamHandler` which uses the provided `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` to process incoming `Data`. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` used to process incoming `Data`. Its work is done on the `serializationQueue`. | | `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. | | `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. | #### Return Value The `DataStreamRequest`. * `[responseStreamString(on:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC6String2on6streamACXDSo17OS_dispatch_queueC_yAC0C0Vy_SSs5NeverOGKctF) ` Adds a `StreamHandler` which parses incoming `Data` as a UTF8 `String`. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. | | `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. | #### Return Value The `DataStreamRequest`. * `[responseStreamDecodable(of:on:using:preprocessor:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC9Decodable2of2on5using12preprocessor6streamACXDxm_So17OS_dispatch_queueCAA0B7Decoder_pAA0B12Preprocessor_pyAC0C0Vy_xAA7AFErrorOGKctSeRzlF) ` Adds a `StreamHandler` which parses incoming `Data` using the provided `[DataDecoder](../Protocols/DataDecoder.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to parse incoming `Data` into. | | `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` used to decode the incoming `Data`. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to process the incoming `Data` before it’s passed to the `decoder`. | | `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. | #### Return Value The `DataStreamRequest`. [](#/DataRequest%20%2F%20UploadRequest) ### DataRequest / UploadRequest * `[publishStream(using:on:)](#/s:9Alamofire17DataStreamRequestC07publishC05using2onAA0bC9PublisherVy16SerializedObjectQzGx_So17OS_dispatch_queueCtAA0bC10SerializerRzlF) ` Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance using the given `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` and `DispatchQueue`. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` used to serialize the streamed `Data`. | | `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. | #### Return Value The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `. * `[publishData(queue:)](#/s:9Alamofire17DataStreamRequestC07publishB05queueAA0bC9PublisherVy10Foundation0B0VGSo012OS_dispatch_F0C_tF) ` Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance which uses a `[PassthroughStreamSerializer](../Structs/PassthroughStreamSerializer.html) ` to stream `Data` unserialized. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. | #### Return Value The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `. * `[publishString(queue:)](#/s:9Alamofire17DataStreamRequestC13publishString5queueAA0bC9PublisherVySSGSo012OS_dispatch_G0C_tF) ` Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance which uses a `[StringStreamSerializer](../Structs/StringStreamSerializer.html) ` to serialize stream `Data` values into `String` values. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. | #### Return Value The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `. * `[publishDecodable(type:queue:decoder:preprocessor:)](#/s:9Alamofire17DataStreamRequestC16publishDecodable4type5queue7decoder12preprocessorAA0bC9PublisherVyxGxm_So012OS_dispatch_H0CAA0B7Decoder_pAA0B12Preprocessor_ptSeRzs8SendableRzlF) ` Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance which uses a `[DecodableStreamSerializer](../Structs/DecodableStreamSerializer.html) ` with the provided parameters to serialize stream `Data` values into the provided type. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to which to decode stream `Data`. Inferred from the context by default. | | `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode stream `Data`. `JSONDecoder()` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters incoming stream `Data` before serialization. `PassthroughPreprocessor()` by default. | #### Return Value The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `. [](#/DataStreamTask) ### DataStreamTask * `[httpResponses(bufferingPolicy:)](#/s:9Alamofire17DataStreamRequestC13httpResponses15bufferingPolicyAA0C2OfVySo17NSHTTPURLResponseCGScS12ContinuationV09BufferingH0OyAI__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the instance’s responses. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. * `[onHTTPResponse(perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse7performACXDAA0D0C19ResponseDispositionOSo17NSHTTPURLResponseCYaYbc_tF) ` Sets an async closure returning a `[Request.ResponseDisposition](../Classes/Request/ResponseDisposition.html) `, called whenever the `DataStreamRequest` produces an `HTTPURLResponse`. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | Async closure executed when a new `HTTPURLResponse` is received and returning a `ResponseDisposition` value. This value determines whether to continue the request or cancel it as if `cancel()` had been called on the instance. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. | #### Return Value The instance. * `[onHTTPResponse(perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse7performACXDySo17NSHTTPURLResponseCYaYbc_tF) ` Sets an async closure called whenever the `DataStreamRequest` produces an `HTTPURLResponse`. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | Async closure executed when a new `HTTPURLResponse` is received. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. | #### Return Value The instance. * `[streamTask()](#/s:9Alamofire17DataStreamRequestC10streamTaskAA0bcF0VyF) ` Creates a `[DataStreamTask](../Structs/DataStreamTask.html) ` used to `await` streams of serialized values. #### Declaration #### Return Value The `[DataStreamTask](../Structs/DataStreamTask.html) `. * `[Validation](#/s:9Alamofire17DataStreamRequestC10Validationa) ` A closure used to validate a request that takes a `URLRequest` and `HTTPURLResponse` and returns whether the request was valid. #### Declaration * `[validate(statusCode:)](#/s:9Alamofire17DataStreamRequestC8validate10statusCodeACXDx_tSTRzSi7ElementRtzlF) ` Validates that the response has a status code in the specified sequence. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Parameters | | | | --- | --- | | `_acceptableStatusCodes_` | `Sequence` of acceptable response status codes. | #### Return Value The instance. * `[validate(contentType:)](#/s:9Alamofire17DataStreamRequestC8validate11contentTypeACXDxyXA_tSTRzSS7ElementRtzlF) ` Validates that the response has a content type in the specified sequence. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Parameters | | | | --- | --- | | `_contentType_` | The acceptable content types, which may specify wildcard types and/or subtypes. | #### Return Value The request. * `[validate()](#/s:9Alamofire17DataStreamRequestC8validateACXDyF) ` Validates that the response has a status code in the default acceptable range of 200…299, and that the content type matches any specified in the Accept HTTP header field. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Return Value The instance. --- # Completion Structure Reference Completion ========== Value containing the state of a `[DataStreamRequest](../../Classes/DataStreamRequest.html) ` when the stream was completed. * `[request](#/s:9Alamofire17DataStreamRequestC10CompletionV7request10Foundation10URLRequestVSgvp) ` Last `URLRequest` issued by the instance. #### Declaration * `[response](#/s:9Alamofire17DataStreamRequestC10CompletionV8responseSo17NSHTTPURLResponseCSgvp) ` Last `HTTPURLResponse` received by the instance. #### Declaration * `[metrics](#/s:9Alamofire17DataStreamRequestC10CompletionV7metricsSo23NSURLSessionTaskMetricsCSgvp) ` Last `URLSessionTaskMetrics` produced for the instance. #### Declaration * `[error](#/s:9Alamofire17DataStreamRequestC10CompletionV5errorAA7AFErrorOSgvp) ` `[AFError](../../Enums/AFError.html) ` produced for the instance, if any. #### Declaration --- # Event Enumeration Reference Event ===== Type representing an event flowing through the stream. Contains either the `Result` of processing streamed `Data` or the completion of the stream. * `[stream(_:)](#/s:9Alamofire17DataStreamRequestC5EventO6streamyAEy_xq_Gs6ResultOyxq_GcAGms8SendableRzs5ErrorR_r0_lF) ` Output produced every time the instance receives additional `Data`. The associated value contains the `Result` of processing the incoming `Data`. #### Declaration * `[complete(_:)](#/s:9Alamofire17DataStreamRequestC5EventO8completeyAEy_xq_GAC10CompletionVcAGms8SendableRzs5ErrorR_r0_lF) ` Output produced when the instance has completed, whether due to stream end, cancellation, or an error. Associated `[Completion](../../Classes/DataStreamRequest/Completion.html) ` value contains the final state. #### Declaration --- # CancellationToken Structure Reference CancellationToken ================= Type used to cancel an ongoing stream. * `[cancel()](#/s:9Alamofire17DataStreamRequestC17CancellationTokenV6cancelyyF) ` Cancel the ongoing stream by canceling the underlying `[DataStreamRequest](../../Classes/DataStreamRequest.html) `. #### Declaration --- # DataRequest Class Reference DataRequest =========== `[Request](../Classes/Request.html) ` subclass which handles in-memory `Data` download using `URLSessionDataTask`. * `[convertible](#/s:9Alamofire11DataRequestC11convertibleAA21URLRequestConvertible_pvp) ` `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value used to create `URLRequest`s for this instance. #### Declaration * `[data](#/s:9Alamofire11DataRequestC4data10Foundation0B0VSgvp) ` `Data` read from the server so far. #### Declaration * `[validate(_:)](#/s:9Alamofire11DataRequestC8validateyACXDs6ResultOyyts5Error_pG10Foundation10URLRequestVSg_So17NSHTTPURLResponseCAI0B0VSgtcF) ` Validates the request, using the specified closure. #### Declaration #### Parameters | | | | --- | --- | | `_validation_` | `[Validation](../Classes/DataRequest.html#/s:9Alamofire11DataRequestC10Validationa) ` closure used to validate the response. | #### Return Value The instance. * `[onHTTPResponse(on:perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse0D07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseC_yAA0C0C19ResponseDispositionOctctF) ` Sets a closure called whenever the `DataRequest` produces an `HTTPURLResponse` and providing a completion handler to return a `ResponseDisposition` value. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. | | `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. The `completionHandler` provided MUST be called, otherwise the request will never complete. | #### Return Value The instance. * `[onHTTPResponse(on:perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse0D07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseCctF) ` Sets a closure called whenever the `DataRequest` produces an `HTTPURLResponse`. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. | | `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. | #### Return Value The instance. [](#/Response%20Serialization) ### Response Serialization * `[response(queue:completionHandler:)](#/s:9Alamofire11DataRequestC8response5queue17completionHandlerACXDSo012OS_dispatch_E0C_yAA0B8ResponseVy10Foundation0B0VSgAA7AFErrorOGctF) ` Adds a handler to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_completionHandler_` | The code to be executed once the request has finished. | #### Return Value The request. * `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGctAA0bkF8ProtocolRzlF) ` Adds a handler to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default | | `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data. | | `_completionHandler_` | The code to be executed once the request has finished. | #### Return Value The request. * `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGctAA0kF0RzlF) ` Adds a handler to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default | | `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data. | | `_completionHandler_` | The code to be executed once the request has finished. | #### Return Value The request. * `[responseData(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire11DataRequestC08responseB05queue16dataPreprocessor18emptyResponseCodes0hC7Methods17completionHandlerACXDSo012OS_dispatch_E0C_AA0bG0_pShySiGShyAA10HTTPMethodVGyAA0bI0Vy10Foundation0B0VAA7AFErrorOGctF) ` Adds a handler using a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is called. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseString(queue:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire11DataRequestC14responseString5queue16dataPreprocessor8encoding18emptyResponseCodes0jC7Methods17completionHandlerACXDSo012OS_dispatch_F0C_AA0bH0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGyAA0bK0VySSAA7AFErrorOGctF) ` Adds a handler using a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_encoding_` | The string encoding. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseJSON(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:completionHandler:)](#/s:9Alamofire11DataRequestC12responseJSON5queue16dataPreprocessor18emptyResponseCodes0iC7Methods7options17completionHandlerACXDSo012OS_dispatch_F0C_AA0bH0_pShySiGShyAA10HTTPMethodVGSo20NSJSONReadingOptionsVyAA0bJ0VyypAA7AFErrorOGctF) ` Adds a handler using a `[JSONResponseSerializer](../Classes/JSONResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_options_` | `JSONSerialization.ReadingOptions` used when parsing the response. `.allowFragments` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseDecodable(of:queue:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire11DataRequestC17responseDecodable2of5queue16dataPreprocessor7decoder18emptyResponseCodes0kC7Methods17completionHandlerACXDxm_So012OS_dispatch_G0CAA0bI0_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGyAA0bL0VyxAA7AFErrorOGctSeRzlF) ` Adds a handler using a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to decode from response data. | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. [](#/DataRequest%20%2F%20UploadRequest) ### DataRequest / UploadRequest * `[publishResponse(using:on:)](#/s:9Alamofire11DataRequestC15publishResponse5using2onAA0bE9PublisherVyq_Gx_So17OS_dispatch_queueCtAA0E10SerializerRz16SerializedObjectQzRs_r0_lF) ` Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance using the given `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` and `DispatchQueue`. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` used to serialize response `Data`. | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. | #### Return Value The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `. * `[publishData(queue:preprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC07publishB05queue12preprocessor18emptyResponseCodes0gC7MethodsAA0bH9PublisherVy10Foundation0B0VGSo012OS_dispatch_E0C_AA0B12Preprocessor_pShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance and uses a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. | | `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. | #### Return Value The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `. * `[publishString(queue:preprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC13publishString5queue12preprocessor8encoding18emptyResponseCodes0iC7MethodsAA0bJ9PublisherVySSGSo012OS_dispatch_F0C_AA0B12Preprocessor_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance and uses a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. | | `_encoding_` | `String.Encoding` to parse the response. `nil` by default, in which case the encoding will be determined by the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. | #### Return Value The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `. * `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyResponseMethods:)](#/s:9Alamofire11DataRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jK7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA0B12Preprocessor_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) ` Undocumented #### Declaration * `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jC7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA0B12Preprocessor_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) ` Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance and uses a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to which to decode response `Data`. Inferred from the context by default. | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode response `Data`. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. | #### Return Value The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `. * `[publishUnserialized(queue:)](#/s:9Alamofire11DataRequestC19publishUnserialized5queueAA0B17ResponsePublisherVy10Foundation0B0VSgGSo012OS_dispatch_F0C_tF) ` Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance which does not serialize the response before publishing. * queue: `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. #### Declaration #### Return Value The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `. [](#/DataTask) ### DataTask * `[httpResponses(bufferingPolicy:)](#/s:9Alamofire11DataRequestC13httpResponses15bufferingPolicyAA8StreamOfVySo17NSHTTPURLResponseCGScS12ContinuationV09BufferingG0OyAI__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the instance’s responses. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. * `[onHTTPResponse(perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse7performACXDAA0C0C19ResponseDispositionOSo17NSHTTPURLResponseCYaYbc_tF) ` Sets an async closure returning a `[Request.ResponseDisposition](../Classes/Request/ResponseDisposition.html) `, called whenever the `DataRequest` produces an `HTTPURLResponse`. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | Async closure executed when a new `HTTPURLResponse` is received and returning a `ResponseDisposition` value. This value determines whether to continue the request or cancel it as if `cancel()` had been called on the instance. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. | #### Return Value The instance. * `[onHTTPResponse(perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse7performACXDySo17NSHTTPURLResponseCYaYbc_tF) ` Sets an async closure called whenever the `DataRequest` produces an `HTTPURLResponse`. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | Async closure executed when a new `HTTPURLResponse` is received. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. | #### Return Value The instance. * `[serializingData(automaticallyCancelling:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC011serializingB023automaticallyCancelling16dataPreprocessor18emptyResponseCodes0iC7MethodsAA0B4TaskVy10Foundation0B0VGSb_AA0bH0_pShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DataTask](../Structs/DataTask.html) ` to `await` a `Data` value. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before completion. | | `_emptyResponseCodes_` | HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | #### Return Value The `[DataTask](../Structs/DataTask.html) `. * `[serializingDecodable(_:automaticallyCancelling:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC20serializingDecodable_23automaticallyCancelling16dataPreprocessor7decoder18emptyResponseCodes0kC7MethodsAA0B4TaskVyxGxm_SbAA0bI0_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) ` Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization of a `Decodable` value. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to decode from response data. | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | #### Return Value The `[DataTask](../Structs/DataTask.html) `. * `[serializingString(automaticallyCancelling:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC17serializingString23automaticallyCancelling16dataPreprocessor8encoding18emptyResponseCodes0kC7MethodsAA0B4TaskVySSGSb_AA0bI0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization of a `String` value. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. | | `_encoding_` | `String.Encoding` to use during serialization. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | #### Return Value The `[DataTask](../Structs/DataTask.html) `. * `[serializingResponse(using:automaticallyCancelling:)](#/s:9Alamofire11DataRequestC19serializingResponse5using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA0E10SerializerRzlF) ` Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization using the provided `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` instance. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` responsible for serializing the request, response, and data. | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. | #### Return Value The `[DataTask](../Structs/DataTask.html) `. * `[serializingResponse(using:automaticallyCancelling:)](#/s:9Alamofire11DataRequestC19serializingResponse5using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA0bE18SerializerProtocolRzlF) ` Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization using the provided `[DataResponseSerializerProtocol](../Protocols/DataResponseSerializerProtocol.html) ` instance. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[DataResponseSerializerProtocol](../Protocols/DataResponseSerializerProtocol.html) ` responsible for serializing the request, response, and data. | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. | #### Return Value The `[DataTask](../Structs/DataTask.html) `. * `[Validation](#/s:9Alamofire11DataRequestC10Validationa) ` A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the request was valid. #### Declaration * `[validate(statusCode:)](#/s:9Alamofire11DataRequestC8validate10statusCodeACXDx_tSTRzSi7ElementRtzlF) ` Validates that the response has a status code in the specified sequence. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Parameters | | | | --- | --- | | `_acceptableStatusCodes_` | `Sequence` of acceptable response status codes. | #### Return Value The instance. * `[validate(contentType:)](#/s:9Alamofire11DataRequestC8validate11contentTypeACXDxyXA_tSTRzSS7ElementRtzlF) ` Validates that the response has a content type in the specified sequence. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Parameters | | | | --- | --- | | `_contentType_` | The acceptable content types, which may specify wildcard types and/or subtypes. | #### Return Value The request. * `[validate()](#/s:9Alamofire11DataRequestC8validateACXDyF) ` Validates that the response has a status code in the default acceptable range of 200…299, and that the content type matches any specified in the Accept HTTP header field. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Return Value The request. --- # DecodableResponseSerializer Class Reference DecodableResponseSerializer =========================== A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that decodes the response data as a `Decodable` value using any decoder that conforms to `[DataDecoder](../Protocols/DataDecoder.html) `. By default, this is an instance of `JSONDecoder`. * `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) ` #### Declaration * `[decoder](#/s:9Alamofire27DecodableResponseSerializerC7decoderAA11DataDecoder_pvp) ` The `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode responses. #### Declaration * `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) ` #### Declaration * `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) ` #### Declaration * `[init(dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire27DecodableResponseSerializerC16dataPreprocessor7decoder05emptyC5Codes0H14RequestMethodsACyxGAA04DataF0_p_AA0L7Decoder_pShySiGShyAA10HTTPMethodVGtcfc) ` Creates an instance using the values provided. #### Declaration #### Parameters | | | | --- | --- | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_decoder_` | The `[DataDecoder](../Protocols/DataDecoder.html) `. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | * `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) ` #### Declaration --- # DefaultTrustEvaluator Class Reference DefaultTrustEvaluator ===================== An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain. * `[init(validateHost:)](#/s:9Alamofire21DefaultTrustEvaluatorC12validateHostACSb_tcfc) ` Creates a `DefaultTrustEvaluator`. #### Declaration #### Parameters | | | | --- | --- | | `_validateHost_` | Determines whether or not the evaluator should validate the host. `true` by default. | * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` #### Declaration --- # DisabledTrustEvaluator Class Reference DisabledTrustEvaluator ====================== Disables all evaluation which in turn will always consider any server trust as valid. **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!** * `[init()](#/s:9Alamofire22DisabledTrustEvaluatorCACycfc) ` Creates an instance. #### Declaration * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` #### Declaration --- # Options Structure Reference Options ======= A set of options to be executed prior to moving a downloaded file from the temporary `URL` to the destination `URL`. * `[createIntermediateDirectories](#/s:9Alamofire15DownloadRequestC7OptionsV29createIntermediateDirectoriesAEvpZ) ` Specifies that intermediate directories for the destination URL should be created. #### Declaration * `[removePreviousFile](#/s:9Alamofire15DownloadRequestC7OptionsV18removePreviousFileAEvpZ) ` Specifies that any previous file at the destination `URL` should be removed. #### Declaration * `[rawValue](#/s:SY8rawValue03RawB0Qzvp) ` #### Declaration * `[init(rawValue:)](#/s:s9OptionSetP8rawValuex03RawD0Qz_tcfc) ` #### Declaration --- # DownloadRequest Class Reference DownloadRequest =============== `[Request](../Classes/Request.html) ` subclass which downloads `Data` to a file on disk using `URLSessionDownloadTask`. * `[Options](#/s:9Alamofire15DownloadRequestC7OptionsV) ` A set of options to be executed prior to moving a downloaded file from the temporary `URL` to the destination `URL`. [See more](../Classes/DownloadRequest/Options.html) #### Declaration [](#/Destination) ### Destination * `[Destination](#/s:9Alamofire15DownloadRequestC11Destinationa) ` A closure executed once a `DownloadRequest` has successfully completed in order to determine where to move the temporary file written to during the download process. The closure takes two arguments: the temporary file URL and the `HTTPURLResponse`, and returns two values: the file URL where the temporary file should be moved and the options defining how the file should be moved. #### Declaration * `[suggestedDownloadDestination(for:in:options:)](#/s:9Alamofire15DownloadRequestC09suggestedB11Destination3for2in7options10Foundation3URLV011destinationJ0_AC7OptionsVAGtAJ_So17NSHTTPURLResponseCtYbcSo21NSSearchPathDirectoryV_So0nO10DomainMaskVAMtFZ) ` Creates a download file destination closure which uses the default file manager to move the temporary file to a file URL in the first available directory with the specified search path directory and search path domain mask. #### Declaration #### Parameters | | | | --- | --- | | `_directory_` | The search path directory. `.documentDirectory` by default. | | `_domain_` | The search path domain mask. `.userDomainMask` by default. | | `_options_` | `[DownloadRequest.Options](../Classes/DownloadRequest/Options.html) ` used when moving the downloaded file to its destination. None by default. | #### Return Value The `[Destination](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC11Destinationa) ` closure. [](#/Downloadable) ### Downloadable * `[Downloadable](#/s:9Alamofire15DownloadRequestC12DownloadableO) ` Type describing the source used to create the underlying `URLSessionDownloadTask`. [See more](../Classes/DownloadRequest/Downloadable.html) #### Declaration [](#/Mutable%20State) ### Mutable State * `[resumeData](#/s:9Alamofire15DownloadRequestC10resumeData10Foundation0E0VSgvp) ` If the download is resumable and is eventually cancelled or fails, this value may be used to resume the download using the `download(resumingWith data:)` API. #### Declaration * `[fileURL](#/s:9Alamofire15DownloadRequestC7fileURL10Foundation0E0VSgvp) ` If the download is successful, the `URL` where the file was downloaded. #### Declaration [](#/Initial%20State) ### Initial State * `[downloadable](#/s:9Alamofire15DownloadRequestC12downloadableAC12DownloadableOvp) ` `[Downloadable](../Classes/DownloadRequest/Downloadable.html) ` value used for this instance. #### Declaration * `[task(forResumeData:using:)](#/s:9Alamofire15DownloadRequestC4task13forResumeData5usingSo16NSURLSessionTaskC10Foundation0G0V_So0I0CtF) ` Creates a `URLSessionTask` from the provided resume data. #### Declaration #### Parameters | | | | --- | --- | | `_data_` | `Data` used to resume the download. | | `_session_` | `URLSession` used to create the `URLSessionTask`. | #### Return Value The `URLSessionTask` created. * `[cancel()](#/s:9Alamofire15DownloadRequestC6cancelACXDyF) ` Cancels the instance. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended. #### Declaration #### Return Value The instance. * `[cancel(producingResumeData:)](#/s:9Alamofire15DownloadRequestC6cancel19producingResumeDataACXDSb_tF) ` Cancels the instance, optionally producing resume data. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended. #### Declaration #### Return Value The instance. * `[cancel(byProducingResumeData:)](#/s:9Alamofire15DownloadRequestC6cancel21byProducingResumeDataACXDy10Foundation0H0VSgc_tF) ` Cancels the instance while producing resume data. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended. #### Declaration #### Parameters | | | | --- | --- | | `_completionHandler_` | The completion handler that is called when the download has been successfully cancelled. It is not guaranteed to be called on a particular queue, so you may want use an appropriate queue to perform your work. | #### Return Value The instance. * `[validate(_:)](#/s:9Alamofire15DownloadRequestC8validateyACXDs6ResultOyyts5Error_pG10Foundation10URLRequestVSg_So17NSHTTPURLResponseCAI3URLVSgtYbcF) ` Validates the request, using the specified closure. #### Declaration #### Parameters | | | | --- | --- | | `_validation_` | `[Validation](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC10Validationa) ` closure to validate the response. | #### Return Value The instance. [](#/Response%20Serialization) ### Response Serialization * `[response(queue:completionHandler:)](#/s:9Alamofire15DownloadRequestC8response5queue17completionHandlerACXDSo012OS_dispatch_E0C_yAA0B8ResponseVy10Foundation3URLVSgAA7AFErrorOGctF) ` Adds a handler to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_completionHandler_` | The code to be executed once the request has finished. | #### Return Value The request. * `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGYbctAA0bkF8ProtocolRzlF) ` Adds a handler to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data contained in the destination `URL`. | | `_completionHandler_` | The code to be executed once the request has finished. | #### Return Value The request. * `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGYbctAA0kF0RzlF) ` Adds a handler to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data contained in the destination `URL`. | | `_completionHandler_` | The code to be executed once the request has finished. | #### Return Value The request. * `[responseURL(queue:completionHandler:)](#/s:9Alamofire15DownloadRequestC11responseURL5queue17completionHandlerACXDSo012OS_dispatch_F0C_yAA0B8ResponseVy10Foundation0E0VAA7AFErrorOGctF) ` Adds a handler using a `[URLResponseSerializer](../Structs/URLResponseSerializer.html) ` to be called once the request is finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is called. `.main` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseData(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire15DownloadRequestC12responseData5queue16dataPreprocessor18emptyResponseCodes0iC7Methods17completionHandlerACXDSo012OS_dispatch_F0C_AA0eH0_pShySiGShyAA10HTTPMethodVGyAA0bJ0Vy10Foundation0E0VAA7AFErrorOGctF) ` Adds a handler using a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is called. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseString(queue:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire15DownloadRequestC14responseString5queue16dataPreprocessor8encoding18emptyResponseCodes0jC7Methods17completionHandlerACXDSo012OS_dispatch_F0C_AA04DataH0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGyAA0bK0VySSAA7AFErrorOGctF) ` Adds a handler using a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_encoding_` | The string encoding. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseJSON(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:completionHandler:)](#/s:9Alamofire15DownloadRequestC12responseJSON5queue16dataPreprocessor18emptyResponseCodes0iC7Methods7options17completionHandlerACXDSo012OS_dispatch_F0C_AA04DataH0_pShySiGShyAA10HTTPMethodVGSo20NSJSONReadingOptionsVyAA0bJ0VyypAA7AFErrorOGctF) ` Adds a handler using a `[JSONResponseSerializer](../Classes/JSONResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_options_` | `JSONSerialization.ReadingOptions` used when parsing the response. `.allowFragments` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. * `[responseDecodable(of:queue:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire15DownloadRequestC17responseDecodable2of5queue16dataPreprocessor7decoder18emptyResponseCodes0kC7Methods17completionHandlerACXDxm_So012OS_dispatch_G0CAA04DataI0_pAA0S7Decoder_pShySiGShyAA10HTTPMethodVGyAA0bL0VyxAA7AFErrorOGctSeRzlF) ` Adds a handler using a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to be called once the request has finished. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to decode from response data. | | `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | | `_completionHandler_` | A closure to be executed once the request has finished. | #### Return Value The request. [](#/DataRequest%20%2F%20UploadRequest) ### DataRequest / UploadRequest * `[publishResponse(using:on:)](#/s:9Alamofire15DownloadRequestC15publishResponse5using2onAA0bE9PublisherVyq_Gx_So17OS_dispatch_queueCtAA0E10SerializerRz16SerializedObjectQzRs_r0_lF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance using the given `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` and `DispatchQueue`. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` used to serialize the response `Data` from disk. | | `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published.`.main` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. * `[publishResponse(using:on:)](#/s:9Alamofire15DownloadRequestC15publishResponse5using2onAA0bE9PublisherVyq_Gx_So17OS_dispatch_queueCtAA0bE18SerializerProtocolRz16SerializedObjectQzRs_r0_lF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance using the given `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` and `DispatchQueue`. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `DownloadResponseSerializer` used to serialize the response `Data` from disk. | | `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published.`.main` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. * `[publishURL(queue:)](#/s:9Alamofire15DownloadRequestC10publishURL5queueAA0B17ResponsePublisherVy10Foundation0E0VGSo012OS_dispatch_F0C_tF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[URLResponseSerializer](../Structs/URLResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published. `.main` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. * `[publishData(queue:preprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC11publishData5queue12preprocessor18emptyResponseCodes0hC7MethodsAA0bI9PublisherVy10Foundation0E0VGSo012OS_dispatch_F0C_AA0E12Preprocessor_pShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published. `.main` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. | | `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. * `[publishString(queue:preprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC13publishString5queue12preprocessor8encoding18emptyResponseCodes0iC7MethodsAA0bJ9PublisherVySSGSo012OS_dispatch_F0C_AA16DataPreprocessor_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. | | `_encoding_` | `String.Encoding` to parse the response. `nil` by default, in which case the encoding will be determined by the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. * `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyResponseMethods:)](#/s:9Alamofire15DownloadRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jK7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA16DataPreprocessor_pAA0Q7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) ` Undocumented #### Declaration * `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jC7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA16DataPreprocessor_pAA0Q7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to serialize the response. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to which to decode response `Data`. Inferred from the context by default. | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. | | `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode response `Data`. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. * `[publishUnserialized(on:)](#/s:9Alamofire15DownloadRequestC19publishUnserialized2onAA0B17ResponsePublisherVy10Foundation3URLVSgGSo17OS_dispatch_queueC_tF) ` Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance which does not serialize the response before publishing. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published. `.main` by default. | #### Return Value The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `. [](#/DownloadTask) ### DownloadTask * `[serializingData(automaticallyCancelling:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC15serializingData23automaticallyCancelling16dataPreprocessor18emptyResponseCodes0jC7MethodsAA0B4TaskVy10Foundation0E0VGSb_AA0eI0_pShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` a `Data` value. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before completion. | | `_emptyResponseCodes_` | HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | #### Return Value The `[DownloadTask](../Structs/DownloadTask.html) `. * `[serializingDecodable(_:automaticallyCancelling:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC20serializingDecodable_23automaticallyCancelling16dataPreprocessor7decoder18emptyResponseCodes0kC7MethodsAA0B4TaskVyxGxm_SbAA04DataI0_pAA0P7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) ` Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization of a `Decodable` value. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to decode from response data. | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | #### Return Value The `[DownloadTask](../Structs/DownloadTask.html) `. * `[serializingDownloadedFileURL(automaticallyCancelling:)](#/s:9Alamofire15DownloadRequestC28serializingDownloadedFileURL23automaticallyCancellingAA0B4TaskVy10Foundation0G0VGSb_tF) ` Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization of the downloaded file’s `URL` on disk. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. | #### Return Value The `[DownloadTask](../Structs/DownloadTask.html) `. * `[serializingString(automaticallyCancelling:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC17serializingString23automaticallyCancelling16dataPreprocessor8encoding18emptyResponseCodes0kC7MethodsAA0B4TaskVySSGSb_AA04DataI0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) ` Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization of a `String` value. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. | | `_encoding_` | `String.Encoding` to use during serialization. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. | | `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. | #### Return Value The `[DownloadTask](../Structs/DownloadTask.html) `. * `[serializingDownload(using:automaticallyCancelling:)](#/s:9Alamofire15DownloadRequestC011serializingB05using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA18ResponseSerializerRzlF) ` Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization using the provided `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` instance. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` responsible for serializing the request, response, and data. | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. | #### Return Value The `[DownloadTask](../Structs/DownloadTask.html) `. * `[serializingDownload(using:automaticallyCancelling:)](#/s:9Alamofire15DownloadRequestC011serializingB05using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA0B26ResponseSerializerProtocolRzlF) ` Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization using the provided `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` instance. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` responsible for serializing the request, response, and data. | | `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. | #### Return Value The `[DownloadTask](../Structs/DownloadTask.html) `. * `[Validation](#/s:9Alamofire15DownloadRequestC10Validationa) ` A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a destination URL, and returns whether the request was valid. #### Declaration * `[validate(statusCode:)](#/s:9Alamofire15DownloadRequestC8validate10statusCodeACXDx_tSTRzSi7ElementRtzlF) ` Validates that the response has a status code in the specified sequence. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Parameters | | | | --- | --- | | `_acceptableStatusCodes_` | `Sequence` of acceptable response status codes. | #### Return Value The instance. * `[validate(contentType:)](#/s:9Alamofire15DownloadRequestC8validate11contentTypeACXDxyXA_tSTRzSS7ElementRtzlF) ` Validates that the response has a `Content-Type` in the specified sequence. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Parameters | | | | --- | --- | | `_contentType_` | The acceptable content types, which may specify wildcard types and/or subtypes. | #### Return Value The request. * `[validate()](#/s:9Alamofire15DownloadRequestC8validateACXDyF) ` Validates that the response has a status code in the default acceptable range of 200…299, and that the content type matches any specified in the Accept HTTP header field. If validation fails, subsequent calls to response handlers will have an associated error. #### Declaration #### Return Value The request. --- # JSONParameterEncoder Class Reference JSONParameterEncoder ==================== A `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` that encodes types as JSON body data. If no `Content-Type` header is already set on the provided `URLRequest`s, it’s set to `application/json`. * `[default](#/s:9Alamofire20JSONParameterEncoderC7defaultACvpZ) ` Returns an encoder with default parameters. #### Declaration * `[prettyPrinted](#/s:9Alamofire20JSONParameterEncoderC13prettyPrintedACvpZ) ` Returns an encoder with `JSONEncoder.outputFormatting` set to `.prettyPrinted`. #### Declaration * `[sortedKeys](#/s:9Alamofire20JSONParameterEncoderC10sortedKeysACvpZ) ` Returns an encoder with `JSONEncoder.outputFormatting` set to `.sortedKeys`. #### Declaration * `[encoder](#/s:9Alamofire20JSONParameterEncoderC7encoder10Foundation11JSONEncoderCvp) ` `JSONEncoder` used to encode parameters. #### Declaration * `[init(encoder:)](#/s:9Alamofire20JSONParameterEncoderC7encoderAC10Foundation11JSONEncoderC_tcfc) ` Creates an instance with the provided `JSONEncoder`. #### Declaration #### Parameters | | | | --- | --- | | `_encoder_` | The `JSONEncoder`. `JSONEncoder()` by default. | * `[encode(_:into:)](#/s:9Alamofire16ParameterEncoderP6encode_4into10Foundation10URLRequestVqd__Sg_AHtKSERd__s8SendableRd__lF) ` #### Declaration --- # Downloadable Enumeration Reference Downloadable ============ Type describing the source used to create the underlying `URLSessionDownloadTask`. * `[request(_:)](#/s:9Alamofire15DownloadRequestC12DownloadableO7requestyAeA21URLRequestConvertible_pcAEmF) ` Download should be started from the `URLRequest` produced by the associated `[URLRequestConvertible](../../Protocols/URLRequestConvertible.html) ` value. #### Declaration * `[resumeData(_:)](#/s:9Alamofire15DownloadRequestC12DownloadableO10resumeDatayAE10Foundation0F0VcAEmF) ` Download should be started from the associated resume `Data` value. #### Declaration --- # Interceptor Class Reference Interceptor =========== `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` which can use multiple `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` values. * `[adapters](#/s:9Alamofire11InterceptorC8adaptersSayAA14RequestAdapter_pGvp) ` All `[RequestAdapter](../Protocols/RequestAdapter.html) `s associated with the instance. These adapters will be run until one fails. #### Declaration * `[retriers](#/s:9Alamofire11InterceptorC8retriersSayAA14RequestRetrier_pGvp) ` All `[RequestRetrier](../Protocols/RequestRetrier.html) `s associated with the instance. These retriers will be run one at a time until one triggers retry. #### Declaration * `[init(adaptHandler:retryHandler:)](#/s:9Alamofire11InterceptorC12adaptHandler05retryD0ACy10Foundation10URLRequestV_AA7SessionCys6ResultOyAHs5Error_pGYbctYbc_yAA7RequestC_AJsAM_pyAA05RetryI0OYbctYbctcfc) ` Creates an instance from `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` and `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closures. #### Declaration #### Parameters | | | | --- | --- | | `_adaptHandler_` | `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` closure to be used. | | `_retryHandler_` | `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closure to be used. | * `[init(adapter:retrier:)](#/s:9Alamofire11InterceptorC7adapter7retrierAcA14RequestAdapter_p_AA0E7Retrier_ptcfc) ` Creates an instance from `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` values. #### Declaration #### Parameters | | | | --- | --- | | `_adapter_` | `[RequestAdapter](../Protocols/RequestAdapter.html) ` value to be used. | | `_retrier_` | `[RequestRetrier](../Protocols/RequestRetrier.html) ` value to be used. | * `[init(adapters:retriers:interceptors:)](#/s:9Alamofire11InterceptorC8adapters8retriers12interceptorsACSayAA14RequestAdapter_pG_SayAA0F7Retrier_pGSayAA0fB0_pGtcfc) ` Creates an instance from the arrays of `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` values. #### Declaration #### Parameters | | | | --- | --- | | `_adapters_` | `[RequestAdapter](../Protocols/RequestAdapter.html) ` values to be used. | | `_retriers_` | `[RequestRetrier](../Protocols/RequestRetrier.html) ` values to be used. | | `_interceptors_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) `s to be used. | * `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) ` #### Declaration * `[adapt(_:using:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_5using10completiony10Foundation10URLRequestV_AA0bC5StateVys6ResultOyAIs5Error_pGYbctF) ` #### Declaration * `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) ` #### Declaration --- # JSONResponseSerializer Class Reference JSONResponseSerializer ====================== A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that decodes the response data using `JSONSerialization`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](../Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an `NSNull` value is returned. * `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) ` #### Declaration * `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) ` #### Declaration * `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) ` #### Declaration * `[options](#/s:9Alamofire22JSONResponseSerializerC7optionsSo20NSJSONReadingOptionsVvp) ` `JSONSerialization.ReadingOptions` used when serializing a response. #### Declaration * `[init(dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:)](#/s:9Alamofire22JSONResponseSerializerC16dataPreprocessor18emptyResponseCodes0F14RequestMethods7optionsAcA04DataE0_p_ShySiGShyAA10HTTPMethodVGSo20NSJSONReadingOptionsVtcfc) ` Creates an instance with the provided values. #### Declaration #### Parameters | | | | --- | --- | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | | `_options_` | The options to use. `.allowFragments` by default. | * `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) ` #### Declaration --- # MultipartFormData Class Reference MultipartFormData ================= Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset. For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well and the w3 form documentation. * [https://www.ietf.org/rfc/rfc2388.txt](https://www.ietf.org/rfc/rfc2388.txt) * [https://www.ietf.org/rfc/rfc2045.txt](https://www.ietf.org/rfc/rfc2045.txt) * [https://www.w3.org/TR/html401/interact/forms.html#h-17.13](https://www.w3.org/TR/html401/interact/forms.html#h-17.13) [](#/Properties) ### Properties * `[encodingMemoryThreshold](#/s:9Alamofire17MultipartFormDataC23encodingMemoryThresholds6UInt64VvpZ) ` Default memory threshold used when encoding `MultipartFormData`, in bytes. #### Declaration * `[contentType](#/s:9Alamofire17MultipartFormDataC11contentTypeSSvp) ` The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`. #### Declaration * `[contentLength](#/s:9Alamofire17MultipartFormDataC13contentLengths6UInt64Vvp) ` The content length of all body parts used to generate the `multipart/form-data` not including the boundaries. #### Declaration * `[boundary](#/s:9Alamofire17MultipartFormDataC8boundarySSvp) ` The boundary used to separate the body parts in the encoded form data. #### Declaration [](#/Lifecycle) ### Lifecycle * `[init(fileManager:boundary:)](#/s:9Alamofire17MultipartFormDataC11fileManager8boundaryACSo06NSFileF0C_SSSgtcfc) ` Creates an instance. #### Declaration #### Parameters | | | | --- | --- | | `_fileManager_` | `FileManager` to use for file operations, if needed. | | `_boundary_` | Boundary `String` used to separate body parts. | [](#/Body%20Parts) ### Body Parts * `[append(_:withName:fileName:mimeType:)](#/s:9Alamofire17MultipartFormDataC6append_8withName04fileG08mimeTypey10Foundation0D0V_S2SSgAKtF) ` Creates a body part from the data and appends it to the instance. The body part data will be encoded using the following format: * `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) * `Content-Type: #{mimeType}` (HTTP Header) * Encoded file data * Multipart form boundary #### Declaration #### Parameters | | | | --- | --- | | `_data_` | `Data` to encoding into the instance. | | `_name_` | Name to associate with the `Data` in the `Content-Disposition` HTTP header. | | `_fileName_` | Filename to associate with the `Data` in the `Content-Disposition` HTTP header. | | `_mimeType_` | MIME type to associate with the data in the `Content-Type` HTTP header. | * `[append(_:withName:)](#/s:9Alamofire17MultipartFormDataC6append_8withNamey10Foundation3URLV_SStF) ` Creates a body part from the file and appends it to the instance. The body part data will be encoded using the following format: * `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header) * `Content-Type: #{generated mimeType}` (HTTP Header) * Encoded file data * Multipart form boundary The filename in the `Content-Disposition` HTTP header is generated from the last path component of the `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the system associated MIME type. #### Declaration #### Parameters | | | | --- | --- | | `_fileURL_` | `URL` of the file whose content will be encoded into the instance. | | `_name_` | Name to associate with the file content in the `Content-Disposition` HTTP header. | * `[append(_:withName:fileName:mimeType:)](#/s:9Alamofire17MultipartFormDataC6append_8withName04fileG08mimeTypey10Foundation3URLV_S3StF) ` Creates a body part from the file and appends it to the instance. The body part data will be encoded using the following format: * Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header) * Content-Type: #{mimeType} (HTTP Header) * Encoded file data * Multipart form boundary #### Declaration #### Parameters | | | | --- | --- | | `_fileURL_` | `URL` of the file whose content will be encoded into the instance. | | `_name_` | Name to associate with the file content in the `Content-Disposition` HTTP header. | | `_fileName_` | Filename to associate with the file content in the `Content-Disposition` HTTP header. | | `_mimeType_` | MIME type to associate with the file content in the `Content-Type` HTTP header. | * `[append(_:withLength:name:fileName:mimeType:)](#/s:9Alamofire17MultipartFormDataC6append_10withLength4name8fileName8mimeTypeySo13NSInputStreamC_s6UInt64VS3StF) ` Creates a body part from the stream and appends it to the instance. The body part data will be encoded using the following format: * `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) * `Content-Type: #{mimeType}` (HTTP Header) * Encoded stream data * Multipart form boundary #### Declaration #### Parameters | | | | --- | --- | | `_stream_` | `InputStream` to encode into the instance. | | `_length_` | Length, in bytes, of the stream. | | `_name_` | Name to associate with the stream content in the `Content-Disposition` HTTP header. | | `_fileName_` | Filename to associate with the stream content in the `Content-Disposition` HTTP header. | | `_mimeType_` | MIME type to associate with the stream content in the `Content-Type` HTTP header. | * `[append(_:withLength:headers:)](#/s:9Alamofire17MultipartFormDataC6append_10withLength7headersySo13NSInputStreamC_s6UInt64VAA11HTTPHeadersVtF) ` Creates a body part with the stream, length, and headers and appends it to the instance. The body part data will be encoded using the following format: * HTTP headers * Encoded stream data * Multipart form boundary #### Declaration #### Parameters | | | | --- | --- | | `_stream_` | `InputStream` to encode into the instance. | | `_length_` | Length, in bytes, of the stream. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` for the body part. | [](#/Data%20Encoding) ### Data Encoding * `[encode()](#/s:9Alamofire17MultipartFormDataC6encode10Foundation0D0VyKF) ` Encodes all appended body parts into a single `Data` value. #### Declaration #### Return Value The encoded `Data`, if encoding is successful. * `[writeEncodedData(to:)](#/s:9Alamofire17MultipartFormDataC012writeEncodedD02toy10Foundation3URLV_tKF) ` Writes all appended body parts to the given file `URL`. This process is facilitated by reading and writing with input and output streams, respectively. Thus, this approach is very memory efficient and should be used for large body part data. #### Declaration #### Parameters | | | | --- | --- | | `_fileURL_` | File `URL` to which to write the form data. | --- # PinnedCertificatesTrustEvaluator Class Reference PinnedCertificatesTrustEvaluator ================================ Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned certificates match one of the server certificates. By validating both the certificate chain and host, certificate pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments. * `[init(certificates:acceptSelfSignedCertificates:performDefaultValidation:validateHost:)](#/s:9Alamofire32PinnedCertificatesTrustEvaluatorC12certificates016acceptSelfSignedC024performDefaultValidation12validateHostACSaySo17SecCertificateRefaG_S3btcfc) ` Creates a `PinnedCertificatesTrustEvaluator` from the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_certificates_` | The certificates to use to evaluate the trust. All `cer`, `crt`, and `der` certificates in `Bundle.main` by default. | | `_acceptSelfSignedCertificates_` | Adds the provided certificates as anchors for the trust evaluation, allowing self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE FALSE IN PRODUCTION! | | `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. | | `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. | * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` #### Declaration --- # NetworkReachabilityManager Class Reference NetworkReachabilityManager ========================== The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and WiFi network interfaces. Reachability can be used to determine background information about why a network operation failed, or to retry network requests when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability. * `[NetworkReachabilityStatus](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO) ` Defines the various states of network reachability. [See more](../Classes/NetworkReachabilityManager/NetworkReachabilityStatus.html) #### Declaration * `[Listener](#/s:9Alamofire26NetworkReachabilityManagerC8Listenera) ` A closure executed when the network reachability status changes. The closure takes a single argument: the network reachability status. #### Declaration * `[default](#/s:9Alamofire26NetworkReachabilityManagerC7defaultACSgvpZ) ` Default `NetworkReachabilityManager` for the zero address and a `listenerQueue` of `.main`. #### Declaration [](#/Properties) ### Properties * `[isReachable](#/s:9Alamofire26NetworkReachabilityManagerC11isReachableSbvp) ` Whether the network is currently reachable. #### Declaration * `[isReachableOnCellular](#/s:9Alamofire26NetworkReachabilityManagerC21isReachableOnCellularSbvp) ` Whether the network is currently reachable over the cellular interface. #### Declaration * `[isReachableOnEthernetOrWiFi](#/s:9Alamofire26NetworkReachabilityManagerC27isReachableOnEthernetOrWiFiSbvp) ` Whether the network is currently reachable over Ethernet or WiFi interface. #### Declaration * `[reachabilityQueue](#/s:9Alamofire26NetworkReachabilityManagerC17reachabilityQueueSo17OS_dispatch_queueCvp) ` `DispatchQueue` on which reachability will update. #### Declaration * `[flags](#/s:9Alamofire26NetworkReachabilityManagerC5flagsSo09SCNetworkC5FlagsVSgvp) ` Flags of the current reachability type, if any. #### Declaration * `[status](#/s:9Alamofire26NetworkReachabilityManagerC6statusAC0bC6StatusOvp) ` The current network reachability status. #### Declaration [](#/Initialization) ### Initialization * `[init(host:)](#/s:9Alamofire26NetworkReachabilityManagerC4hostACSgSS_tcfc) ` Creates an instance with the specified host. #### Declaration #### Parameters | | | | --- | --- | | `_host_` | Host used to evaluate network reachability. Must _not_ include the scheme (e.g. `https`). | * `[init()](#/s:9Alamofire26NetworkReachabilityManagerCACSgycfc) ` Creates an instance that monitors the address 0.0.0.0. Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing status of the device, both IPv4 and IPv6. #### Declaration [](#/Listening) ### Listening * `[startListening(onQueue:onUpdatePerforming:)](#/s:9Alamofire26NetworkReachabilityManagerC14startListening7onQueue0G16UpdatePerformingSbSo17OS_dispatch_queueC_yAC0bC6StatusOctF) ` Starts listening for changes in network reachability status. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which to call the `listener` closure. `.main` by default. | | `_listener_` | `[Listener](../Classes/NetworkReachabilityManager.html#/s:9Alamofire26NetworkReachabilityManagerC8Listenera) ` closure called when reachability changes. | #### Return Value `true` if listening was started successfully, `false` otherwise. * `[stopListening()](#/s:9Alamofire26NetworkReachabilityManagerC13stopListeningyyF) ` Stops listening for changes in network reachability status. #### Declaration --- # NetworkReachabilityStatus Enumeration Reference NetworkReachabilityStatus ========================= Defines the various states of network reachability. * `[unknown](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO7unknownyA2EmF) ` It is unknown whether the network is reachable. #### Declaration * `[notReachable](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO12notReachableyA2EmF) ` The network is not reachable. #### Declaration * `[reachable(_:)](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO9reachableyA2E14ConnectionTypeOcAEmF) ` The network is reachable on the associated `[ConnectionType](../../Classes/NetworkReachabilityManager/NetworkReachabilityStatus/ConnectionType.html) `. #### Declaration * `[ConnectionType](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO14ConnectionTypeO) ` Defines the various connection types detected by reachability flags. [See more](../../Classes/NetworkReachabilityManager/NetworkReachabilityStatus/ConnectionType.html) #### Declaration --- # PublicKeysTrustEvaluator Class Reference PublicKeysTrustEvaluator ======================== Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned public keys match one of the server certificate public keys. By validating both the certificate chain and host, public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments. * `[init(keys:performDefaultValidation:validateHost:)](#/s:9Alamofire24PublicKeysTrustEvaluatorC4keys24performDefaultValidation12validateHostACSaySo9SecKeyRefaG_S2btcfc) ` Creates a `PublicKeysTrustEvaluator` from the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_keys_` | The `SecKey`s to use to validate public keys. Defaults to the public keys of all certificates included in the main bundle. | | `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. | | `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. | * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` #### Declaration --- # Retrier Class Reference Retrier ======= Closure-based `[RequestRetrier](../Protocols/RequestRetrier.html) `. * `[init(_:)](#/s:9Alamofire7RetrierCyACyAA7RequestC_AA7SessionCs5Error_pyAA11RetryResultOctccfc) ` Creates an instance using the provided closure. #### Declaration #### Parameters | | | | --- | --- | | `_retryHandler_` | `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closure to be executed when handling request retry. | * `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) ` #### Declaration --- # RetryPolicy Class Reference RetryPolicy =========== A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes as well as certain types of networking errors. * `[defaultRetryLimit](#/s:9Alamofire11RetryPolicyC07defaultB5LimitSuvpZ) ` The default retry limit for retry policies. #### Declaration * `[defaultExponentialBackoffBase](#/s:9Alamofire11RetryPolicyC29defaultExponentialBackoffBaseSuvpZ) ` The default exponential backoff base for retry policies (must be a minimum of 2). #### Declaration * `[defaultExponentialBackoffScale](#/s:9Alamofire11RetryPolicyC30defaultExponentialBackoffScaleSdvpZ) ` The default exponential backoff scale for retry policies. #### Declaration * `[defaultRetryableHTTPMethods](#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) ` The default HTTP methods to retry. See [RFC 2616 - Section 9.1.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) for more information. #### Declaration * `[defaultRetryableHTTPStatusCodes](#/s:9Alamofire11RetryPolicyC31defaultRetryableHTTPStatusCodesShySiGvpZ) ` The default HTTP status codes to retry. See [RFC 2616 - Section 10](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10) for more information. #### Declaration * `[defaultRetryableURLErrorCodes](#/s:9Alamofire11RetryPolicyC29defaultRetryableURLErrorCodesShy10Foundation0F0V4CodeVGvpZ) ` The default URL error codes to retry. #### Declaration * `[retryLimit](#/s:9Alamofire11RetryPolicyC10retryLimitSuvp) ` The total number of times the request is allowed to be retried. #### Declaration * `[exponentialBackoffBase](#/s:9Alamofire11RetryPolicyC22exponentialBackoffBaseSuvp) ` The base of the exponential backoff policy (should always be greater than or equal to 2). #### Declaration * `[exponentialBackoffScale](#/s:9Alamofire11RetryPolicyC23exponentialBackoffScaleSdvp) ` The scale of the exponential backoff. #### Declaration * `[retryableHTTPMethods](#/s:9Alamofire11RetryPolicyC20retryableHTTPMethodsShyAA10HTTPMethodVGvp) ` The HTTP methods that are allowed to be retried. #### Declaration * `[retryableHTTPStatusCodes](#/s:9Alamofire11RetryPolicyC24retryableHTTPStatusCodesShySiGvp) ` The HTTP status codes that are automatically retried by the policy. #### Declaration * `[retryableURLErrorCodes](#/s:9Alamofire11RetryPolicyC22retryableURLErrorCodesShy10Foundation0E0V4CodeVGvp) ` The URL error codes that are automatically retried by the policy. #### Declaration * `[init(retryLimit:exponentialBackoffBase:exponentialBackoffScale:retryableHTTPMethods:retryableHTTPStatusCodes:retryableURLErrorCodes:)](#/s:9Alamofire11RetryPolicyC10retryLimit22exponentialBackoffBase0fG5Scale20retryableHTTPMethods0J15HTTPStatusCodes0j8URLErrorM0ACSu_SuSdShyAA10HTTPMethodVGShySiGShy10Foundation0N0V4CodeVGtcfc) ` Creates a `RetryPolicy` from the specified parameters. #### Declaration #### Parameters | | | | --- | --- | | `_retryLimit_` | The total number of times the request is allowed to be retried. `2` by default. | | `_exponentialBackoffBase_` | The base of the exponential backoff policy. `2` by default. | | `_exponentialBackoffScale_` | The scale of the exponential backoff. `0.5` by default. | | `_retryableHTTPMethods_` | The HTTP methods that are allowed to be retried. `[RetryPolicy.defaultRetryableHTTPMethods](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) ` by default. | | `_retryableHTTPStatusCodes_` | The HTTP status codes that are automatically retried by the policy. `[RetryPolicy.defaultRetryableHTTPStatusCodes](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC31defaultRetryableHTTPStatusCodesShySiGvpZ) ` by default. | | `_retryableURLErrorCodes_` | The URL error codes that are automatically retried by the policy. `[RetryPolicy.defaultRetryableURLErrorCodes](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC29defaultRetryableURLErrorCodesShy10Foundation0F0V4CodeVGvpZ) ` by default. | * `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) ` #### Declaration * `[shouldRetry(request:dueTo:)](#/s:9Alamofire11RetryPolicyC06shouldB07request5dueToSbAA7RequestC_s5Error_ptF) ` Determines whether or not to retry the provided `[Request](../Classes/Request.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[Request](../Classes/Request.html) ` that failed due to the provided `Error`. | | `_error_` | `Error` encountered while executing the `[Request](../Classes/Request.html) `. | #### Return Value `Bool` determining whether or not to retry the `[Request](../Classes/Request.html) `. --- # RevocationTrustEvaluator Class Reference RevocationTrustEvaluator ======================== An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates. Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain. * `[Options](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV) ` Represents the options to be use when evaluating the status of a certificate. Only Revocation Policy Constants are valid, and can be found in [Apple’s documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants) . [See more](../Classes/RevocationTrustEvaluator/Options.html) #### Declaration * `[init(performDefaultValidation:validateHost:options:)](#/s:9Alamofire24RevocationTrustEvaluatorC24performDefaultValidation12validateHost7optionsACSb_SbAC7OptionsVtcfc) ` Creates a `RevocationTrustEvaluator` using the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. | | `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. | | `_options_` | The `[Options](../Classes/RevocationTrustEvaluator/Options.html) ` to use to check the revocation status of the certificate. `.any` by default. | * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` #### Declaration --- # Options Structure Reference Options ======= Represents the options to be use when evaluating the status of a certificate. Only Revocation Policy Constants are valid, and can be found in [Apple’s documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants) . * `[crl](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV3crlAEvpZ) ` Perform revocation checking using the CRL (Certification Revocation List) method. #### Declaration * `[networkAccessDisabled](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV21networkAccessDisabledAEvpZ) ` Consult only locally cached replies; do not use network access. #### Declaration * `[ocsp](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV4ocspAEvpZ) ` Perform revocation checking using OCSP (Online Certificate Status Protocol). #### Declaration * `[preferCRL](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV9preferCRLAEvpZ) ` Prefer CRL revocation checking over OCSP; by default, OCSP is preferred. #### Declaration * `[requirePositiveResponse](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV23requirePositiveResponseAEvpZ) ` Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a “best attempt” basis, where failure to reach the server is not considered fatal. #### Declaration * `[any](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV3anyAEvpZ) ` Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the certificate and the value of `[preferCRL](../../Classes/RevocationTrustEvaluator/Options.html#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV9preferCRLAEvpZ) `. #### Declaration * `[rawValue](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV8rawValueSuvp) ` The raw value of the option. #### Declaration * `[init(rawValue:)](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV8rawValueAESu_tcfc) ` Creates an `Options` value with the given `CFOptionFlags`. #### Declaration #### Parameters | | | | --- | --- | | `_rawValue_` | The `CFOptionFlags` value to initialize with. | --- # ServerTrustManager Class Reference ServerTrustManager ================== Responsible for managing the mapping of `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` values to given hosts. * `[allHostsMustBeEvaluated](#/s:9Alamofire18ServerTrustManagerC23allHostsMustBeEvaluatedSbvp) ` Determines whether all hosts for this `ServerTrustManager` must be evaluated. `true` by default. #### Declaration * `[evaluators](#/s:9Alamofire18ServerTrustManagerC10evaluatorsSDySSAA0bC10Evaluating_pGvp) ` The dictionary of policies mapped to a particular host. #### Declaration * `[init(allHostsMustBeEvaluated:evaluators:)](#/s:9Alamofire18ServerTrustManagerC23allHostsMustBeEvaluated10evaluatorsACSb_SDySSAA0bC10Evaluating_pGtcfc) ` Initializes the `ServerTrustManager` instance with the given evaluators. Since different servers and web services can have different leaf certificates, intermediate and even root certificates, it is important to have the flexibility to specify evaluation policies on a per host basis. This allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key pinning for host3 and disabling evaluation for host4. #### Declaration #### Parameters | | | | --- | --- | | `_allHostsMustBeEvaluated_` | The value determining whether all hosts for this instance must be evaluated. `true` by default. | | `_evaluators_` | A dictionary of evaluators mapped to hosts. | * `[serverTrustEvaluator(forHost:)](#/s:9Alamofire18ServerTrustManagerC06serverC9Evaluator7forHostAA0bC10Evaluating_pSgSS_tKF) ` Returns the `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` value for the given host, if one is set. By default, this method will return the policy that perfectly matches the given host. Subclasses could override this method and implement more complex mapping implementations such as wildcards. #### Declaration #### Parameters | | | | --- | --- | | `_host_` | The host to use when searching for a matching policy. | #### Return Value The `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` value for the given host if found, `nil` otherwise. --- # SessionDelegate Class Reference SessionDelegate =============== Class which implements the various `URLSessionDelegate` methods to connect various Alamofire features. * `[init(fileManager:)](#/s:9Alamofire15SessionDelegateC11fileManagerACSo06NSFileE0C_tcfc) ` Creates an instance from the given `FileManager`. #### Declaration #### Parameters | | | | --- | --- | | `_fileManager_` | `FileManager` to use for underlying file management, such as moving downloaded files. `.default` by default. | [](#/URLSessionDelegate) ### URLSessionDelegate * `[urlSession(_:didBecomeInvalidWithError:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:didBecomeInvalidWithError:) ` Undocumented #### Declaration [](#/URLSessionTaskDelegate) ### URLSessionTaskDelegate * `[urlSession(_:task:didReceive:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didReceiveChallenge:completionHandler:) ` Undocumented #### Declaration * `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) ` Undocumented #### Declaration * `[urlSession(_:task:needNewBodyStream:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:needNewBodyStream:) ` Undocumented #### Declaration * `[urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:) ` Undocumented #### Declaration * `[urlSession(_:task:didFinishCollecting:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didFinishCollectingMetrics:) ` Undocumented #### Declaration * `[urlSession(_:task:didCompleteWithError:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didCompleteWithError:) ` Undocumented #### Declaration * `[urlSession(_:taskIsWaitingForConnectivity:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:taskIsWaitingForConnectivity:) ` Undocumented #### Declaration [](#/URLSessionDataDelegate) ### URLSessionDataDelegate * `[urlSession(_:dataTask:didReceive:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:dataTask:didReceiveResponse:completionHandler:) ` Undocumented #### Declaration * `[urlSession(_:dataTask:didReceive:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:dataTask:didReceiveData:) ` Undocumented #### Declaration * `[urlSession(_:dataTask:willCacheResponse:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:dataTask:willCacheResponse:completionHandler:) ` Undocumented #### Declaration [](#/URLSessionWebSocketDelegate) ### URLSessionWebSocketDelegate * `[urlSession(_:webSocketTask:didOpenWithProtocol:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:webSocketTask:didOpenWithProtocol:) ` Undocumented #### Declaration * `[urlSession(_:webSocketTask:didCloseWith:reason:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:webSocketTask:didCloseWithCode:reason:) ` Undocumented #### Declaration [](#/URLSessionDownloadDelegate) ### URLSessionDownloadDelegate * `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:) ` Undocumented #### Declaration * `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:) ` Undocumented #### Declaration * `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:downloadTask:didFinishDownloadingToURL:) ` Undocumented #### Declaration --- # Request Class Reference Request ======= `Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback handling. * `[State](#/s:9Alamofire7RequestC5StateO) ` State of the `[Request](../Classes/Request.html) `, with managed transitions between states set when calling `[resume()](../Classes/Request.html#/s:9Alamofire7RequestC6resumeACXDyF) `, `[suspend()](../Classes/Request.html#/s:9Alamofire7RequestC7suspendACXDyF) `, or `[cancel()](../Classes/Request.html#/s:9Alamofire7RequestC6cancelACXDyF) ` on the `[Request](../Classes/Request.html) `. [See more](../Classes/Request/State.html) #### Declaration [](#/Initial%20State) ### Initial State * `[id](#/s:9Alamofire7RequestC2id10Foundation4UUIDVvp) ` `UUID` providing a unique identifier for the `Request`, used in the `Hashable` and `Equatable` conformances. #### Declaration * `[underlyingQueue](#/s:9Alamofire7RequestC15underlyingQueueSo17OS_dispatch_queueCvp) ` The serial queue for all internal async actions. #### Declaration * `[serializationQueue](#/s:9Alamofire7RequestC18serializationQueueSo17OS_dispatch_queueCvp) ` The queue used for all serialization actions. By default it’s a serial queue that targets `[underlyingQueue](../Classes/Request.html#/s:9Alamofire7RequestC15underlyingQueueSo17OS_dispatch_queueCvp) `. #### Declaration * `[eventMonitor](#/s:9Alamofire7RequestC12eventMonitorAA05EventD0_pSgvp) ` `[EventMonitor](../Protocols/EventMonitor.html) ` used for event callbacks. #### Declaration * `[interceptor](#/s:9Alamofire7RequestC11interceptorAA0B11Interceptor_pSgvp) ` The `Request`‘s interceptor. #### Declaration * `[delegate](#/s:9Alamofire7RequestC8delegateAA0B8Delegate_pSgvp) ` The `Request`‘s delegate. #### Declaration [](#/Mutable%20State) ### Mutable State * `[state](#/s:9Alamofire7RequestC5stateAC5StateOvp) ` `[State](../Classes/Request/State.html) ` of the `Request`. #### Declaration * `[isInitialized](#/s:9Alamofire7RequestC13isInitializedSbvp) ` Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.initialized`. #### Declaration * `[isResumed](#/s:9Alamofire7RequestC9isResumedSbvp) ` Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.resumed`. #### Declaration * `[isSuspended](#/s:9Alamofire7RequestC11isSuspendedSbvp) ` Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.suspended`. #### Declaration * `[isCancelled](#/s:9Alamofire7RequestC11isCancelledSbvp) ` Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.cancelled`. #### Declaration * `[isFinished](#/s:9Alamofire7RequestC10isFinishedSbvp) ` Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.finished`. #### Declaration [](#/Progress) ### Progress * `[ProgressHandler](#/s:9Alamofire7RequestC15ProgressHandlera) ` Closure type executed when monitoring the upload or download progress of a request. #### Declaration * `[uploadProgress](#/s:9Alamofire7RequestC14uploadProgressSo10NSProgressCvp) ` `Progress` of the upload of the body of the executed `URLRequest`. Reset to `0` if the `Request` is retried. #### Declaration * `[downloadProgress](#/s:9Alamofire7RequestC16downloadProgressSo10NSProgressCvp) ` `Progress` of the download of any response data. Reset to `0` if the `Request` is retried. #### Declaration * `[uploadProgressHandler](#/s:9Alamofire7RequestC21uploadProgressHandlerySo10NSProgressCYbc7handler_So17OS_dispatch_queueC0J0tSgvp) ` `[ProgressHandler](../Classes/Request.html#/s:9Alamofire7RequestC15ProgressHandlera) ` called when `[uploadProgress](../Classes/Request.html#/s:9Alamofire7RequestC14uploadProgressSo10NSProgressCvp) ` is updated, on the provided `DispatchQueue`. #### Declaration * `[downloadProgressHandler](#/s:9Alamofire7RequestC23downloadProgressHandlerySo10NSProgressCYbc7handler_So17OS_dispatch_queueC0J0tSgvp) ` `[ProgressHandler](../Classes/Request.html#/s:9Alamofire7RequestC15ProgressHandlera) ` called when `[downloadProgress](../Classes/Request.html#/s:9Alamofire7RequestC16downloadProgressSo10NSProgressCvp) ` is updated, on the provided `DispatchQueue`. #### Declaration [](#/Redirect%20Handling) ### Redirect Handling * `[redirectHandler](#/s:9Alamofire7RequestC15redirectHandlerAA08RedirectD0_pSgvp) ` `[RedirectHandler](../Protocols/RedirectHandler.html) ` set on the instance. #### Declaration [](#/Cached%20Response%20Handling) ### Cached Response Handling * `[cachedResponseHandler](#/s:9Alamofire7RequestC21cachedResponseHandlerAA06CacheddE0_pSgvp) ` `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) ` set on the instance. #### Declaration [](#/URLCredential) ### URLCredential * `[credential](#/s:9Alamofire7RequestC10credentialSo15NSURLCredentialCSgvp) ` `URLCredential` used for authentication challenges. Created by calling one of the `authenticate` methods. #### Declaration [](#/URLRequests) ### URLRequests * `[requests](#/s:9Alamofire7RequestC8requestsSay10Foundation10URLRequestVGvp) ` All `URLRequest`s created on behalf of the `Request`, including original and adapted requests. #### Declaration * `[firstRequest](#/s:9Alamofire7RequestC05firstB010Foundation10URLRequestVSgvp) ` First `URLRequest` created on behalf of the `Request`. May not be the first one actually executed. #### Declaration * `[lastRequest](#/s:9Alamofire7RequestC04lastB010Foundation10URLRequestVSgvp) ` Last `URLRequest` created on behalf of the `Request`. #### Declaration * `[request](#/s:9Alamofire7RequestC7request10Foundation10URLRequestVSgvp) ` Current `URLRequest` created on behalf of the `Request`. #### Declaration * `[performedRequests](#/s:9Alamofire7RequestC17performedRequestsSay10Foundation10URLRequestVGvp) ` `URLRequest`s from all of the `URLSessionTask`s executed on behalf of the `Request`. May be different from `[requests](../Classes/Request.html#/s:9Alamofire7RequestC8requestsSay10Foundation10URLRequestVGvp) ` due to `URLSession` manipulation. #### Declaration [](#/HTTPURLResponse) ### HTTPURLResponse * `[response](#/s:9Alamofire7RequestC8responseSo17NSHTTPURLResponseCSgvp) ` `HTTPURLResponse` received from the server, if any. If the `Request` was retried, this is the response of the last `URLSessionTask`. #### Declaration [](#/Tasks) ### Tasks * `[tasks](#/s:9Alamofire7RequestC5tasksSaySo16NSURLSessionTaskCGvp) ` All `URLSessionTask`s created on behalf of the `Request`. #### Declaration * `[firstTask](#/s:9Alamofire7RequestC9firstTaskSo012NSURLSessionD0CSgvp) ` First `URLSessionTask` created on behalf of the `Request`. #### Declaration * `[lastTask](#/s:9Alamofire7RequestC8lastTaskSo012NSURLSessionD0CSgvp) ` Last `URLSessionTask` created on behalf of the `Request`. #### Declaration * `[task](#/s:9Alamofire7RequestC4taskSo16NSURLSessionTaskCSgvp) ` Current `URLSessionTask` created on behalf of the `Request`. #### Declaration [](#/Metrics) ### Metrics * `[allMetrics](#/s:9Alamofire7RequestC10allMetricsSaySo016NSURLSessionTaskD0CGvp) ` All `URLSessionTaskMetrics` gathered on behalf of the `Request`. Should correspond to the `[tasks](../Classes/Request.html#/s:9Alamofire7RequestC5tasksSaySo16NSURLSessionTaskCGvp) ` created. #### Declaration * `[firstMetrics](#/s:9Alamofire7RequestC12firstMetricsSo016NSURLSessionTaskD0CSgvp) ` First `URLSessionTaskMetrics` gathered on behalf of the `Request`. #### Declaration * `[lastMetrics](#/s:9Alamofire7RequestC11lastMetricsSo016NSURLSessionTaskD0CSgvp) ` Last `URLSessionTaskMetrics` gathered on behalf of the `Request`. #### Declaration * `[metrics](#/s:9Alamofire7RequestC7metricsSo23NSURLSessionTaskMetricsCSgvp) ` Current `URLSessionTaskMetrics` gathered on behalf of the `Request`. #### Declaration [](#/Retry%20Count) ### Retry Count * `[retryCount](#/s:9Alamofire7RequestC10retryCountSivp) ` Number of times the `Request` has been retried. #### Declaration [](#/Error) ### Error * `[error](#/s:9Alamofire7RequestC5errorAA7AFErrorOSgvp) ` `Error` returned from Alamofire internally, from the network request directly, or any validators executed. #### Declaration [](#/State) ### State * `[cancel()](#/s:9Alamofire7RequestC6cancelACXDyF) ` Cancels the instance. Once cancelled, a `Request` can no longer be resumed or suspended. #### Declaration #### Return Value The instance. * `[suspend()](#/s:9Alamofire7RequestC7suspendACXDyF) ` Suspends the instance. #### Declaration #### Return Value The instance. * `[resume()](#/s:9Alamofire7RequestC6resumeACXDyF) ` Resumes the instance. #### Declaration #### Return Value The instance. [](#/Closure%20API) ### Closure API * `[authenticate(username:password:persistence:)](#/s:9Alamofire7RequestC12authenticate8username8password11persistenceACXDSS_SSSo26NSURLCredentialPersistenceVtF) ` Associates a credential using the provided values with the instance. #### Declaration #### Parameters | | | | --- | --- | | `_username_` | The username. | | `_password_` | The password. | | `_persistence_` | The `URLCredential.Persistence` for the created `URLCredential`. `.forSession` by default. | #### Return Value The instance. * `[authenticate(with:)](#/s:9Alamofire7RequestC12authenticate4withACXDSo15NSURLCredentialC_tF) ` Associates the provided credential with the instance. #### Declaration #### Parameters | | | | --- | --- | | `_credential_` | The `URLCredential`. | #### Return Value The instance. * `[downloadProgress(queue:closure:)](#/s:9Alamofire7RequestC16downloadProgress5queue7closureACXDSo012OS_dispatch_E0C_ySo10NSProgressCctF) ` Sets a closure to be called periodically during the lifecycle of the instance as data is read from the server. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The `DispatchQueue` to execute the closure on. `.main` by default. | | `_closure_` | The closure to be executed periodically as data is read from the server. | #### Return Value The instance. * `[uploadProgress(queue:closure:)](#/s:9Alamofire7RequestC14uploadProgress5queue7closureACXDSo012OS_dispatch_E0C_ySo10NSProgressCctF) ` Sets a closure to be called periodically during the lifecycle of the instance as data is sent to the server. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | The `DispatchQueue` to execute the closure on. `.main` by default. | | `_closure_` | The closure to be executed periodically as data is sent to the server. | #### Return Value The instance. [](#/Redirects) ### Redirects * `[redirect(using:)](#/s:9Alamofire7RequestC8redirect5usingACXDAA15RedirectHandler_p_tF) ` Sets the redirect handler for the instance which will be used if a redirect response is encountered. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | The `[RedirectHandler](../Protocols/RedirectHandler.html) `. | #### Return Value The instance. [](#/Cached%20Responses) ### Cached Responses * `[cacheResponse(using:)](#/s:9Alamofire7RequestC13cacheResponse5usingACXDAA06CachedD7Handler_p_tF) ` Sets the cached response handler for the `Request` which will be used when attempting to cache a response. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | The `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) `. | #### Return Value The instance. [](#/Lifetime%20APIs) ### Lifetime APIs * `[cURLDescription(on:calling:)](#/s:9Alamofire7RequestC15cURLDescription2on7callingACXDSo17OS_dispatch_queueC_ySSctF) ` Sets a handler to be called when the cURL description of the request is available. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which `handler` will be called. | | `_handler_` | Closure to be called when the cURL description is available. | #### Return Value The instance. * `[cURLDescription(calling:)](#/s:9Alamofire7RequestC15cURLDescription7callingACXDySSc_tF) ` Sets a handler to be called when the cURL description of the request is available. #### Declaration #### Parameters | | | | --- | --- | | `_handler_` | Closure to be called when the cURL description is available. Called on the instance’s `[underlyingQueue](../Classes/Request.html#/s:9Alamofire7RequestC15underlyingQueueSo17OS_dispatch_queueCvp) ` by default. | #### Return Value The instance. * `[onURLRequestCreation(on:perform:)](#/s:9Alamofire7RequestC20onURLRequestCreation0C07performACXDSo17OS_dispatch_queueC_y10Foundation0D0VctF) ` Sets a closure to called whenever Alamofire creates a `URLRequest` for this instance. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which `handler` will be called. `.main` by default. | | `_handler_` | Closure to be called when a `URLRequest` is available. | #### Return Value The instance. * `[onURLSessionTaskCreation(on:perform:)](#/s:9Alamofire7RequestC24onURLSessionTaskCreation0C07performACXDSo17OS_dispatch_queueC_ySo012NSURLSessionE0CctF) ` Sets a closure to be called whenever the instance creates a `URLSessionTask`. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which `handler` will be called. `.main` by default. | | `_handler_` | Closure to be called when the `URLSessionTask` is available. | #### Return Value The instance. * `[didResumeNotification](#/s:9Alamofire7RequestC21didResumeNotificationSo18NSNotificationNameavpZ) ` Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`. #### Declaration * `[didSuspendNotification](#/s:9Alamofire7RequestC22didSuspendNotificationSo18NSNotificationNameavpZ) ` Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`. #### Declaration * `[didCancelNotification](#/s:9Alamofire7RequestC21didCancelNotificationSo18NSNotificationNameavpZ) ` Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`. #### Declaration * `[didFinishNotification](#/s:9Alamofire7RequestC21didFinishNotificationSo18NSNotificationNameavpZ) ` Posted when a `Request` is finished. The `Notification` contains the completed `Request`. #### Declaration * `[didResumeTaskNotification](#/s:9Alamofire7RequestC25didResumeTaskNotificationSo18NSNotificationNameavpZ) ` Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`. #### Declaration * `[didSuspendTaskNotification](#/s:9Alamofire7RequestC26didSuspendTaskNotificationSo18NSNotificationNameavpZ) ` Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`. #### Declaration * `[didCancelTaskNotification](#/s:9Alamofire7RequestC25didCancelTaskNotificationSo18NSNotificationNameavpZ) ` Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`. #### Declaration * `[didCompleteTaskNotification](#/s:9Alamofire7RequestC27didCompleteTaskNotificationSo18NSNotificationNameavpZ) ` Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`. #### Declaration * `[ResponseDisposition](#/s:9Alamofire7RequestC19ResponseDispositionO) ` Type indicating how a `[DataRequest](../Classes/DataRequest.html) ` or `[DataStreamRequest](../Classes/DataStreamRequest.html) ` should proceed after receiving an `HTTPURLResponse`. [See more](../Classes/Request/ResponseDisposition.html) #### Declaration [](#/Protocol%20Conformances) ### Protocol Conformances * `[==(_:_:)](#/s:SQ2eeoiySbx_xtFZ) ` #### Declaration * `[hash(into:)](#/s:SH4hash4intoys6HasherVz_tF) ` #### Declaration * `[description](#/s:9Alamofire7RequestC11descriptionSSvp) ` A textual representation of this instance, including the `[HTTPMethod](../Structs/HTTPMethod.html) ` and `URL` if the `URLRequest` has been created, as well as the response status code, if a response has been received. #### Declaration * `[cURLDescription()](#/s:9Alamofire7RequestC15cURLDescriptionSSyF) ` cURL representation of the instance. #### Declaration #### Return Value The cURL equivalent of the instance. [](#/Request%20Event%20Streams) ### Request Event Streams * `[uploadProgress(bufferingPolicy:)](#/s:9Alamofire7RequestC14uploadProgress15bufferingPolicyAA8StreamOfVySo10NSProgressCGScS12ContinuationV09BufferingF0OyAI__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the instance’s upload progress. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. * `[downloadProgress(bufferingPolicy:)](#/s:9Alamofire7RequestC16downloadProgress15bufferingPolicyAA8StreamOfVySo10NSProgressCGScS12ContinuationV09BufferingF0OyAI__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the instance’s download progress. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. * `[urlRequests(bufferingPolicy:)](#/s:9Alamofire7RequestC11urlRequests15bufferingPolicyAA8StreamOfVy10Foundation10URLRequestVGScS12ContinuationV09BufferingF0OyAJ__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the `URLRequest`s produced for the instance. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. * `[urlSessionTasks(bufferingPolicy:)](#/s:9Alamofire7RequestC15urlSessionTasks15bufferingPolicyAA8StreamOfVySo16NSURLSessionTaskCGScS12ContinuationV09BufferingG0OyAI__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the `URLSessionTask`s produced for the instance. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. * `[cURLDescriptions(bufferingPolicy:)](#/s:9Alamofire7RequestC16cURLDescriptions15bufferingPolicyAA8StreamOfVySSGScS12ContinuationV09BufferingE0OySS__G_tF) ` Creates a `[StreamOf](../Structs/StreamOf.html) ` for the cURL descriptions produced for the instance. #### Declaration #### Parameters | | | | --- | --- | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[StreamOf](../Structs/StreamOf.html) `. [](#/Helper%20Types) ### Helper Types * `[ValidationResult](#/s:9Alamofire7RequestC16ValidationResulta) ` Used to represent whether a validation succeeded or failed. #### Declaration --- # State Enumeration Reference State ===== State of the `[Request](../../Classes/Request.html) `, with managed transitions between states set when calling `[resume()](../../Classes/Request.html#/s:9Alamofire7RequestC6resumeACXDyF) `, `[suspend()](../../Classes/Request.html#/s:9Alamofire7RequestC7suspendACXDyF) `, or `[cancel()](../../Classes/Request.html#/s:9Alamofire7RequestC6cancelACXDyF) ` on the `[Request](../../Classes/Request.html) `. * `[initialized](#/s:9Alamofire7RequestC5StateO11initializedyA2EmF) ` Initial state of the `[Request](../../Classes/Request.html) `. #### Declaration * `[resumed](#/s:9Alamofire7RequestC5StateO7resumedyA2EmF) ` `State` set when `[resume()](../../Classes/Request.html#/s:9Alamofire7RequestC6resumeACXDyF) ` is called. Any tasks created for the `[Request](../../Classes/Request.html) ` will have `[resume()](../../Classes/Request.html#/s:9Alamofire7RequestC6resumeACXDyF) ` called on them in this state. #### Declaration * `[suspended](#/s:9Alamofire7RequestC5StateO9suspendedyA2EmF) ` `State` set when `[suspend()](../../Classes/Request.html#/s:9Alamofire7RequestC7suspendACXDyF) ` is called. Any tasks created for the `[Request](../../Classes/Request.html) ` will have `[suspend()](../../Classes/Request.html#/s:9Alamofire7RequestC7suspendACXDyF) ` called on them in this state. #### Declaration * `[cancelled](#/s:9Alamofire7RequestC5StateO9cancelledyA2EmF) ` `State` set when `[cancel()](../../Classes/Request.html#/s:9Alamofire7RequestC6cancelACXDyF) ` is called. Any tasks created for the `[Request](../../Classes/Request.html) ` will have `[cancel()](../../Classes/Request.html#/s:9Alamofire7RequestC6cancelACXDyF) ` called on them. Unlike `[resumed](../../Classes/Request/State.html#/s:9Alamofire7RequestC5StateO7resumedyA2EmF) ` or `[suspended](../../Classes/Request/State.html#/s:9Alamofire7RequestC5StateO9suspendedyA2EmF) `, once in the `cancelled` state, the `[Request](../../Classes/Request.html) ` can no longer transition to any other state. #### Declaration * `[finished](#/s:9Alamofire7RequestC5StateO8finishedyA2EmF) ` `State` set when all response serialization completion closures have been cleared on the `[Request](../../Classes/Request.html) ` and enqueued on their respective queues. #### Declaration --- # ResponseDisposition Enumeration Reference ResponseDisposition =================== Type indicating how a `[DataRequest](../../Classes/DataRequest.html) ` or `[DataStreamRequest](../../Classes/DataStreamRequest.html) ` should proceed after receiving an `HTTPURLResponse`. * `[allow](#/s:9Alamofire7RequestC19ResponseDispositionO5allowyA2EmF) ` Allow the request to continue normally. #### Declaration * `[cancel](#/s:9Alamofire7RequestC19ResponseDispositionO6cancelyA2EmF) ` Cancel the request, similar to calling `[cancel()](../../Classes/Request.html#/s:9Alamofire7RequestC6cancelACXDyF) `. #### Declaration --- # StringResponseSerializer Class Reference StringResponseSerializer ======================== A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that decodes the response data as a `String`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](../Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `String` is returned. * `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) ` #### Declaration * `[encoding](#/s:9Alamofire24StringResponseSerializerC8encodingSS10FoundationE8EncodingVSgvp) ` Optional string encoding used to validate the response. #### Declaration * `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) ` #### Declaration * `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) ` #### Declaration * `[init(dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire24StringResponseSerializerC16dataPreprocessor8encoding05emptyC5Codes0H14RequestMethodsAcA04DataF0_p_SS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtcfc) ` Creates an instance with the provided values. #### Declaration #### Parameters | | | | --- | --- | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_encoding_` | A string encoding. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | * `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) ` #### Declaration --- # Session Class Reference Session ======= `Session` creates and manages Alamofire’s `[Request](../Classes/Request.html) ` types during their lifetimes. It also provides common functionality for all `[Request](../Classes/Request.html) `s, including queuing, interception, trust management, redirect handling, and response cache handling. * `[default](#/s:9Alamofire7SessionC7defaultACvpZ) ` Shared singleton instance used by all `AF.request` APIs. Cannot be modified. #### Declaration * `[session](#/s:9Alamofire7SessionC7sessionSo12NSURLSessionCvp) ` Underlying `URLSession` used to create `URLSessionTasks` for this instance, and for which this instance’s `[delegate](../Classes/Session.html#/s:9Alamofire7SessionC8delegateAA0B8DelegateCvp) ` handles `URLSessionDelegate` callbacks. #### Declaration * `[delegate](#/s:9Alamofire7SessionC8delegateAA0B8DelegateCvp) ` Instance’s `[SessionDelegate](../Classes/SessionDelegate.html) `, which handles the `URLSessionDelegate` methods and `[Request](../Classes/Request.html) ` interaction. #### Declaration * `[rootQueue](#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` Root `DispatchQueue` for all internal callbacks and state update. **MUST** be a serial queue. #### Declaration * `[startRequestsImmediately](#/s:9Alamofire7SessionC24startRequestsImmediatelySbvp) ` Value determining whether this instance automatically calls `resume()` on all created `[Request](../Classes/Request.html) `s. #### Declaration * `[requestQueue](#/s:9Alamofire7SessionC12requestQueueSo17OS_dispatch_queueCvp) ` `DispatchQueue` on which `URLRequest`s are created asynchronously. By default this queue uses `[rootQueue](../Classes/Session.html#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` as its `target`, but a separate queue can be used if request creation is determined to be a bottleneck. Always profile and test before introducing an additional queue. #### Declaration * `[serializationQueue](#/s:9Alamofire7SessionC18serializationQueueSo17OS_dispatch_queueCvp) ` `DispatchQueue` passed to all `[Request](../Classes/Request.html) `s on which they perform their response serialization. By default this queue uses `[rootQueue](../Classes/Session.html#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` as its `target` but a separate queue can be used if response serialization is determined to be a bottleneck. Always profile and test before introducing an additional queue. #### Declaration * `[interceptor](#/s:9Alamofire7SessionC11interceptorAA18RequestInterceptor_pSgvp) ` `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` used for all `[Request](../Classes/Request.html) ` created by the instance. `[RequestInterceptor](../Protocols/RequestInterceptor.html) `s can also be set on a per-`[Request](../Classes/Request.html) ` basis, in which case the `[Request](../Classes/Request.html) `‘s interceptor takes precedence over this value. #### Declaration * `[serverTrustManager](#/s:9Alamofire7SessionC18serverTrustManagerAA06ServerdE0CSgvp) ` `[ServerTrustManager](../Classes/ServerTrustManager.html) ` instance used to evaluate all trust challenges and provide certificate and key pinning. #### Declaration * `[redirectHandler](#/s:9Alamofire7SessionC15redirectHandlerAA08RedirectD0_pSgvp) ` `[RedirectHandler](../Protocols/RedirectHandler.html) ` instance used to provide customization for request redirection. #### Declaration * `[cachedResponseHandler](#/s:9Alamofire7SessionC21cachedResponseHandlerAA06CacheddE0_pSgvp) ` `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) ` instance used to provide customization of cached response handling. #### Declaration * `[eventMonitor](#/s:9Alamofire7SessionC12eventMonitorAA014CompositeEventD0Cvp) ` `[CompositeEventMonitor](../Classes/CompositeEventMonitor.html) ` used to compose any passed `[EventMonitor](../Protocols/EventMonitor.html) `s. #### Declaration * `[defaultEventMonitors](#/s:9Alamofire7SessionC20defaultEventMonitorsSayAA0D7Monitor_pGvp) ` `[EventMonitor](../Protocols/EventMonitor.html) `s included in all instances unless overwritten. `[AlamofireNotifications()]` by default. #### Declaration * `[init(session:delegate:rootQueue:startRequestsImmediately:requestQueue:serializationQueue:interceptor:serverTrustManager:redirectHandler:cachedResponseHandler:eventMonitors:)](#/s:9Alamofire7SessionC7session8delegate9rootQueue24startRequestsImmediately07requestF0013serializationF011interceptor18serverTrustManager15redirectHandler014cachedResponseQ013eventMonitorsACSo12NSURLSessionC_AA0B8DelegateCSo17OS_dispatch_queueCSbATSgAuA18RequestInterceptor_pSgAA06ServernO0CSgAA08RedirectQ0_pSgAA06CachedsQ0_pSgSayAA12EventMonitor_pGtcfc) ` Creates a `Session` from a `URLSession` and other parameters. #### Declaration #### Parameters | | | | --- | --- | | `_session_` | Underlying `URLSession` for this instance. | | `_delegate_` | `[SessionDelegate](../Classes/SessionDelegate.html) ` that handles `[session](../Classes/Session.html#/s:9Alamofire7SessionC7sessionSo12NSURLSessionCvp) `‘s delegate callbacks as well as `[Request](../Classes/Request.html) ` interaction. | | `_rootQueue_` | Root `DispatchQueue` for all internal callbacks and state updates. **MUST** be a serial queue. | | `_startRequestsImmediately_` | Determines whether this instance will automatically start all `[Request](../Classes/Request.html) `s. `true` by default. If set to `false`, all `[Request](../Classes/Request.html) `s created must have `.resume()` called. on them for them to start. | | `_requestQueue_` | `DispatchQueue` on which to perform `URLRequest` creation. By default this queue will use the `[rootQueue](../Classes/Session.html#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` as its `target`. A separate queue can be used if it’s determined request creation is a bottleneck, but that should only be done after careful testing and profiling. `nil` by default. | | `_serializationQueue_` | `DispatchQueue` on which to perform all response serialization. By default this queue will use the `[rootQueue](../Classes/Session.html#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` as its `target`. A separate queue can be used if it’s determined response serialization is a bottleneck, but that should only be done after careful testing and profiling. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` to be used for all `[Request](../Classes/Request.html) `s created by this instance. `nil` by default. | | `_serverTrustManager_` | `[ServerTrustManager](../Classes/ServerTrustManager.html) ` to be used for all trust evaluations by this instance. `nil` by default. | | `_redirectHandler_` | `[RedirectHandler](../Protocols/RedirectHandler.html) ` to be used by all `[Request](../Classes/Request.html) `s created by this instance. `nil` by default. | | `_cachedResponseHandler_` | `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) ` to be used by all `[Request](../Classes/Request.html) `s created by this instance. `nil` by default. | | `_eventMonitors_` | `[EventMonitor](../Protocols/EventMonitor.html) `s used by the instance. `[AlamofireNotifications()]` by default. | * `[init(configuration:delegate:rootQueue:startRequestsImmediately:requestQueue:serializationQueue:interceptor:serverTrustManager:redirectHandler:cachedResponseHandler:eventMonitors:)](#/s:9Alamofire7SessionC13configuration8delegate9rootQueue24startRequestsImmediately07requestF0013serializationF011interceptor18serverTrustManager15redirectHandler014cachedResponseQ013eventMonitorsACSo25NSURLSessionConfigurationC_AA0B8DelegateCSo17OS_dispatch_queueCSbATSgAuA18RequestInterceptor_pSgAA06ServernO0CSgAA08RedirectQ0_pSgAA06CachedsQ0_pSgSayAA12EventMonitor_pGtcfc) ` Creates a `Session` from a `URLSessionConfiguration`. #### Declaration #### Parameters | | | | --- | --- | | `_configuration_` | `URLSessionConfiguration` to be used to create the underlying `URLSession`. Changes to this value after being passed to this initializer will have no effect. `URLSessionConfiguration.af.default` by default. | | `_delegate_` | `[SessionDelegate](../Classes/SessionDelegate.html) ` that handles `[session](../Classes/Session.html#/s:9Alamofire7SessionC7sessionSo12NSURLSessionCvp) `‘s delegate callbacks as well as `[Request](../Classes/Request.html) ` interaction. `SessionDelegate()` by default. | | `_rootQueue_` | Root `DispatchQueue` for all internal callbacks and state updates. **MUST** be a serial queue. `DispatchQueue(label: "org.alamofire.session.rootQueue")` by default. | | `_startRequestsImmediately_` | Determines whether this instance will automatically start all `[Request](../Classes/Request.html) `s. `true` by default. If set to `false`, all `[Request](../Classes/Request.html) `s created must have `.resume()` called. on them for them to start. | | `_requestQueue_` | `DispatchQueue` on which to perform `URLRequest` creation. By default this queue will use the `[rootQueue](../Classes/Session.html#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` as its `target`. A separate queue can be used if it’s determined request creation is a bottleneck, but that should only be done after careful testing and profiling. `nil` by default. | | `_serializationQueue_` | `DispatchQueue` on which to perform all response serialization. By default this queue will use the `[rootQueue](../Classes/Session.html#/s:9Alamofire7SessionC9rootQueueSo17OS_dispatch_queueCvp) ` as its `target`. A separate queue can be used if it’s determined response serialization is a bottleneck, but that should only be done after careful testing and profiling. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` to be used for all `[Request](../Classes/Request.html) `s created by this instance. `nil` by default. | | `_serverTrustManager_` | `[ServerTrustManager](../Classes/ServerTrustManager.html) ` to be used for all trust evaluations by this instance. `nil` by default. | | `_redirectHandler_` | `[RedirectHandler](../Protocols/RedirectHandler.html) ` to be used by all `[Request](../Classes/Request.html) `s created by this instance. `nil` by default. | | `_cachedResponseHandler_` | `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) ` to be used by all `[Request](../Classes/Request.html) `s created by this instance. `nil` by default. | | `_eventMonitors_` | `[EventMonitor](../Protocols/EventMonitor.html) `s used by the instance. `[AlamofireNotifications()]` by default. | [](#/All%20Requests%20API) ### All Requests API * `[withAllRequests(perform:)](#/s:9Alamofire7SessionC15withAllRequests7performyyShyAA7RequestCGYbc_tF) ` Perform an action on all active `[Request](../Classes/Request.html) `s. #### Declaration #### Parameters | | | | --- | --- | | `_action_` | Closure to perform with all `[Request](../Classes/Request.html) `s. | * `[cancelAllRequests(completingOnQueue:completion:)](#/s:9Alamofire7SessionC17cancelAllRequests17completingOnQueue10completionySo17OS_dispatch_queueC_yyYbcSgtF) ` Cancel all active `[Request](../Classes/Request.html) `s, optionally calling a completion handler when complete. #### Declaration #### Parameters | | | | --- | --- | | `_queue_` | `DispatchQueue` on which the completion handler is run. `.main` by default. | | `_completion_` | Closure to be called when all `[Request](../Classes/Request.html) `s have been cancelled. | [](#/DataRequest) ### DataRequest * `[RequestModifier](#/s:9Alamofire7SessionC15RequestModifiera) ` Closure which provides a `URLRequest` for mutation. #### Declaration * `[request(_:method:parameters:encoding:headers:interceptor:requestModifier:)](#/s:9Alamofire7SessionC7request_6method10parameters8encoding7headers11interceptor0C8ModifierAA11DataRequestCAA14URLConvertible_p_AA10HTTPMethodVSDySSs8Sendable_pGSgAA17ParameterEncoding_pAA11HTTPHeadersVSgAA0K11Interceptor_pSgy10Foundation10URLRequestVzYbKcSgtF) ` Creates a `[DataRequest](../Classes/DataRequest.html) ` from a `URLRequest` created using the passed components and a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.get` by default. | | `_parameters_` | `[Parameters](../Typealiases.html#/s:9Alamofire10Parametersa) ` (a.k.a. `[String: Any]`) value to be encoded into the `URLRequest`. `nil` by default. | | `_encoding_` | `[ParameterEncoding](../Protocols/ParameterEncoding.html) ` to be used to encode the `parameters` value into the `URLRequest`. `[URLEncoding.default](../Structs/URLEncoding.html#/s:9Alamofire11URLEncodingV7defaultACvpZ) ` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[DataRequest](../Classes/DataRequest.html) `. * `[request(_:method:parameters:encoder:headers:interceptor:requestModifier:)](#/s:9Alamofire7SessionC7request_6method10parameters7encoder7headers11interceptor0C8ModifierAA11DataRequestCAA14URLConvertible_p_AA10HTTPMethodVxSgAA16ParameterEncoder_pAA11HTTPHeadersVSgAA0K11Interceptor_pSgy10Foundation10URLRequestVzYbKcSgtSERzs8SendableRzlF) ` Creates a `[DataRequest](../Classes/DataRequest.html) ` from a `URLRequest` created using the passed components, `Encodable` parameters, and a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.get` by default. | | `_parameters_` | `Encodable` value to be encoded into the `URLRequest`. `nil` by default. | | `_encoder_` | `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` to be used to encode the `parameters` value into the `URLRequest`. `[URLEncodedFormParameterEncoder.default](../Classes/URLEncodedFormParameterEncoder.html#/s:9Alamofire30URLEncodedFormParameterEncoderC7defaultACvpZ) ` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[DataRequest](../Classes/DataRequest.html) `. * `[request(_:interceptor:)](#/s:9Alamofire7SessionC7request_11interceptorAA11DataRequestCAA21URLRequestConvertible_p_AA0F11Interceptor_pSgtF) ` Creates a `[DataRequest](../Classes/DataRequest.html) ` from a `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value and a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | #### Return Value The created `[DataRequest](../Classes/DataRequest.html) `. [](#/DataStreamRequest) ### DataStreamRequest * `[streamRequest(_:method:parameters:encoder:headers:automaticallyCancelOnStreamError:interceptor:requestModifier:)](#/s:9Alamofire7SessionC13streamRequest_6method10parameters7encoder7headers32automaticallyCancelOnStreamError11interceptor15requestModifierAA04DatalD0CAA14URLConvertible_p_AA10HTTPMethodVxSgAA16ParameterEncoder_pAA11HTTPHeadersVSgSbAA0D11Interceptor_pSgy10Foundation10URLRequestVzYbKcSgtSERzs8SendableRzlF) ` Creates a `[DataStreamRequest](../Classes/DataStreamRequest.html) ` from the passed components, `Encodable` parameters, and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.get` by default. | | `_parameters_` | `Encodable` value to be encoded into the `URLRequest`. `nil` by default. | | `_encoder_` | `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` to be used to encode the `parameters` value into the `URLRequest`. `[URLEncodedFormParameterEncoder.default](../Classes/URLEncodedFormParameterEncoder.html#/s:9Alamofire30URLEncodedFormParameterEncoderC7defaultACvpZ) ` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_automaticallyCancelOnStreamError_` | `Bool` indicating whether the instance should be canceled when an `Error` is thrown while serializing stream `Data`. `false` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `DataStream` request. * `[streamRequest(_:method:headers:automaticallyCancelOnStreamError:interceptor:requestModifier:)](#/s:9Alamofire7SessionC13streamRequest_6method7headers32automaticallyCancelOnStreamError11interceptor15requestModifierAA04DatajD0CAA14URLConvertible_p_AA10HTTPMethodVAA11HTTPHeadersVSgSbAA0D11Interceptor_pSgy10Foundation10URLRequestVzYbKcSgtF) ` Creates a `[DataStreamRequest](../Classes/DataStreamRequest.html) ` from the passed components and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.get` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_automaticallyCancelOnStreamError_` | `Bool` indicating whether the instance should be canceled when an `Error` is thrown while serializing stream `Data`. `false` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `DataStream` request. * `[streamRequest(_:automaticallyCancelOnStreamError:interceptor:)](#/s:9Alamofire7SessionC13streamRequest_32automaticallyCancelOnStreamError11interceptorAA04DatahD0CAA21URLRequestConvertible_p_SbAA0D11Interceptor_pSgtF) ` Creates a `[DataStreamRequest](../Classes/DataStreamRequest.html) ` from the passed `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_automaticallyCancelOnStreamError_` | `Bool` indicating whether the instance should be canceled when an `Error` is thrown while serializing stream `Data`. `false` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | #### Return Value The created `[DataStreamRequest](../Classes/DataStreamRequest.html) `. [](#/DownloadRequest) ### DownloadRequest * `[download(_:method:parameters:encoding:headers:interceptor:requestModifier:to:)](#/s:9Alamofire7SessionC8download_6method10parameters8encoding7headers11interceptor15requestModifier2toAA15DownloadRequestCAA14URLConvertible_p_AA10HTTPMethodVSDySSs8Sendable_pGSgAA17ParameterEncoding_pAA11HTTPHeadersVSgAA0M11Interceptor_pSgy10Foundation10URLRequestVzYbKcSgAZ3URLV011destinationW0_AM7OptionsV7optionstA3__So17NSHTTPURLResponseCtYbcSgtF) ` Creates a `[DownloadRequest](../Classes/DownloadRequest.html) ` using a `URLRequest` created using the passed components, `[RequestInterceptor](../Protocols/RequestInterceptor.html) `, and `Destination`. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.get` by default. | | `_parameters_` | `[Parameters](../Typealiases.html#/s:9Alamofire10Parametersa) ` (a.k.a. `[String: Any]`) value to be encoded into the `URLRequest`. `nil` by default. | | `_encoding_` | `[ParameterEncoding](../Protocols/ParameterEncoding.html) ` to be used to encode the `parameters` value into the `URLRequest`. Defaults to `[URLEncoding.default](../Structs/URLEncoding.html#/s:9Alamofire11URLEncodingV7defaultACvpZ) `. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | | `_destination_` | `[DownloadRequest.Destination](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC11Destinationa) ` closure used to determine how and where the downloaded file should be moved. `nil` by default. | #### Return Value The created `[DownloadRequest](../Classes/DownloadRequest.html) `. * `[download(_:method:parameters:encoder:headers:interceptor:requestModifier:to:)](#/s:9Alamofire7SessionC8download_6method10parameters7encoder7headers11interceptor15requestModifier2toAA15DownloadRequestCAA14URLConvertible_p_AA10HTTPMethodVxSgAA16ParameterEncoder_pAA11HTTPHeadersVSgAA0M11Interceptor_pSgy10Foundation10URLRequestVzYbKcSgAX3URLV011destinationV0_AM7OptionsV7optionstA1__So17NSHTTPURLResponseCtYbcSgtSERzs8SendableRzlF) ` Creates a `[DownloadRequest](../Classes/DownloadRequest.html) ` from a `URLRequest` created using the passed components, `Encodable` parameters, and a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.get` by default. | | `_parameters_` | Value conforming to `Encodable` to be encoded into the `URLRequest`. `nil` by default. | | `_encoder_` | `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` to be used to encode the `parameters` value into the `URLRequest`. Defaults to `[URLEncodedFormParameterEncoder.default](../Classes/URLEncodedFormParameterEncoder.html#/s:9Alamofire30URLEncodedFormParameterEncoderC7defaultACvpZ) `. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | | `_destination_` | `[DownloadRequest.Destination](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC11Destinationa) ` closure used to determine how and where the downloaded file should be moved. `nil` by default. | #### Return Value The created `[DownloadRequest](../Classes/DownloadRequest.html) `. * `[download(_:interceptor:to:)](#/s:9Alamofire7SessionC8download_11interceptor2toAA15DownloadRequestCAA21URLRequestConvertible_p_AA0G11Interceptor_pSg10Foundation3URLV011destinationL0_AH7OptionsV7optionstAN_So17NSHTTPURLResponseCtYbcSgtF) ` Creates a `[DownloadRequest](../Classes/DownloadRequest.html) ` from a `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value, a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `, and a `Destination`. #### Declaration #### Parameters | | | | --- | --- | | `_convertible_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_destination_` | `[DownloadRequest.Destination](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC11Destinationa) ` closure used to determine how and where the downloaded file should be moved. `nil` by default. | #### Return Value The created `[DownloadRequest](../Classes/DownloadRequest.html) `. * `[download(resumingWith:interceptor:to:)](#/s:9Alamofire7SessionC8download12resumingWith11interceptor2toAA15DownloadRequestC10Foundation4DataV_AA0I11Interceptor_pSgAJ3URLV011destinationM0_AI7OptionsV7optionstAP_So17NSHTTPURLResponseCtYbcSgtF) ` Creates a `[DownloadRequest](../Classes/DownloadRequest.html) ` from the `resumeData` produced from a previously cancelled `[DownloadRequest](../Classes/DownloadRequest.html) `, as well as a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `, and a `Destination`. #### Declaration #### Parameters | | | | --- | --- | | `_data_` | The resume data from a previously cancelled `[DownloadRequest](../Classes/DownloadRequest.html) ` or `URLSessionDownloadTask`. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_destination_` | `[DownloadRequest.Destination](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC11Destinationa) ` closure used to determine how and where the downloaded file should be moved. `nil` by default. | #### Return Value The created `[DownloadRequest](../Classes/DownloadRequest.html) `. [](#/Data) ### Data * `[upload(_:to:method:headers:interceptor:fileManager:requestModifier:)](#/s:9Alamofire7SessionC6upload_2to6method7headers11interceptor11fileManager15requestModifierAA13UploadRequestC10Foundation4DataV_AA14URLConvertible_pAA10HTTPMethodVAA11HTTPHeadersVSgAA0M11Interceptor_pSgSo06NSFileI0CyAM10URLRequestVzYbKcSgtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the given `Data`, `URLRequest` components, and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_data_` | The `Data` to upload. | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.post` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. * `[upload(_:with:interceptor:fileManager:)](#/s:9Alamofire7SessionC6upload_4with11interceptor11fileManagerAA13UploadRequestC10Foundation4DataV_AA21URLRequestConvertible_pAA0I11Interceptor_pSgSo06NSFileG0CtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the given `Data` using the `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_data_` | The `Data` to upload. | | `_convertible_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. [](#/File) ### File * `[upload(_:to:method:headers:interceptor:fileManager:requestModifier:)](#/s:9Alamofire7SessionC6upload_2to6method7headers11interceptor11fileManager15requestModifierAA13UploadRequestC10Foundation3URLV_AA14URLConvertible_pAA10HTTPMethodVAA11HTTPHeadersVSgAA0M11Interceptor_pSgSo06NSFileI0CyAM10URLRequestVzYbKcSgtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the file at the given file `URL`, using a `URLRequest` from the provided components and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_fileURL_` | The `URL` of the file to upload. | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.post` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. * `[upload(_:with:interceptor:fileManager:)](#/s:9Alamofire7SessionC6upload_4with11interceptor11fileManagerAA13UploadRequestC10Foundation3URLV_AA21URLRequestConvertible_pAA0I11Interceptor_pSgSo06NSFileG0CtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the file at the given file `URL` using the `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_fileURL_` | The `URL` of the file to upload. | | `_convertible_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. [](#/InputStream) ### InputStream * `[upload(_:to:method:headers:interceptor:fileManager:requestModifier:)](#/s:9Alamofire7SessionC6upload_2to6method7headers11interceptor11fileManager15requestModifierAA13UploadRequestCSo13NSInputStreamC_AA14URLConvertible_pAA10HTTPMethodVAA11HTTPHeadersVSgAA0M11Interceptor_pSgSo06NSFileI0Cy10Foundation10URLRequestVzYbKcSgtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` from the `InputStream` provided using a `URLRequest` from the provided components and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_stream_` | The `InputStream` that provides the data to upload. | | `_convertible_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.post` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. * `[upload(_:with:interceptor:fileManager:)](#/s:9Alamofire7SessionC6upload_4with11interceptor11fileManagerAA13UploadRequestCSo13NSInputStreamC_AA21URLRequestConvertible_pAA0I11Interceptor_pSgSo06NSFileG0CtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` from the provided `InputStream` using the `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_stream_` | The `InputStream` that provides the data to upload. | | `_convertible_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. [](#/MultipartFormData) ### MultipartFormData * `[upload(multipartFormData:to:usingThreshold:method:headers:interceptor:fileManager:requestModifier:)](#/s:9Alamofire7SessionC6upload17multipartFormData2to14usingThreshold6method7headers11interceptor11fileManager15requestModifierAA13UploadRequestCyAA09MultiparteF0Cc_AA14URLConvertible_ps6UInt64VAA10HTTPMethodVAA11HTTPHeadersVSgAA0R11Interceptor_pSgSo06NSFileN0Cy10Foundation10URLRequestVzYbKcSgtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the multipart form data built using a closure and sent using the provided `URLRequest` components and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. It is important to understand the memory implications of uploading `[MultipartFormData](../Classes/MultipartFormData.html) `. If the cumulative payload is small, encoding the data in-memory and directly uploading to a server is the by far the most efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be used for larger payloads such as video content. The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory or stream from disk. If the content length of the `[MultipartFormData](../Classes/MultipartFormData.html) ` is below the `encodingMemoryThreshold`, encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding technique was used. #### Declaration #### Parameters | | | | --- | --- | | `_multipartFormData_` | `[MultipartFormData](../Classes/MultipartFormData.html) ` building closure. | | `_url_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_encodingMemoryThreshold_` | Byte threshold used to determine whether the form data is encoded into memory or onto disk before being uploaded. `[MultipartFormData.encodingMemoryThreshold](../Classes/MultipartFormData.html#/s:9Alamofire17MultipartFormDataC23encodingMemoryThresholds6UInt64VvpZ) ` by default. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.post` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` to be used if the form data exceeds the memory threshold and is written to disk before being uploaded. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. * `[upload(multipartFormData:with:usingThreshold:interceptor:fileManager:)](#/s:9Alamofire7SessionC6upload17multipartFormData4with14usingThreshold11interceptor11fileManagerAA13UploadRequestCyAA09MultiparteF0Cc_AA21URLRequestConvertible_ps6UInt64VAA0N11Interceptor_pSgSo06NSFileL0CtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` using a `[MultipartFormData](../Classes/MultipartFormData.html) ` building closure, the provided `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value, and a `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. It is important to understand the memory implications of uploading `[MultipartFormData](../Classes/MultipartFormData.html) `. If the cumulative payload is small, encoding the data in-memory and directly uploading to a server is the by far the most efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be used for larger payloads such as video content. The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory or stream from disk. If the content length of the `[MultipartFormData](../Classes/MultipartFormData.html) ` is below the `encodingMemoryThreshold`, encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding technique was used. #### Declaration #### Parameters | | | | --- | --- | | `_multipartFormData_` | `[MultipartFormData](../Classes/MultipartFormData.html) ` building closure. | | `_request_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_encodingMemoryThreshold_` | Byte threshold used to determine whether the form data is encoded into memory or onto disk before being uploaded. `[MultipartFormData.encodingMemoryThreshold](../Classes/MultipartFormData.html#/s:9Alamofire17MultipartFormDataC23encodingMemoryThresholds6UInt64VvpZ) ` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` to be used if the form data exceeds the memory threshold and is written to disk before being uploaded. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. * `[upload(multipartFormData:to:usingThreshold:method:headers:interceptor:fileManager:requestModifier:)](#/s:9Alamofire7SessionC6upload17multipartFormData2to14usingThreshold6method7headers11interceptor11fileManager15requestModifierAA13UploadRequestCAA09MultiparteF0C_AA14URLConvertible_ps6UInt64VAA10HTTPMethodVAA11HTTPHeadersVSgAA0R11Interceptor_pSgSo06NSFileN0Cy10Foundation10URLRequestVzYbKcSgtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the prebuilt `[MultipartFormData](../Classes/MultipartFormData.html) ` value using the provided `URLRequest` components and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. It is important to understand the memory implications of uploading `[MultipartFormData](../Classes/MultipartFormData.html) `. If the cumulative payload is small, encoding the data in-memory and directly uploading to a server is the by far the most efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be used for larger payloads such as video content. The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory or stream from disk. If the content length of the `[MultipartFormData](../Classes/MultipartFormData.html) ` is below the `encodingMemoryThreshold`, encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding technique was used. #### Declaration #### Parameters | | | | --- | --- | | `_multipartFormData_` | `[MultipartFormData](../Classes/MultipartFormData.html) ` instance to upload. | | `_url_` | `[URLConvertible](../Protocols/URLConvertible.html) ` value to be used as the `URLRequest`‘s `URL`. | | `_encodingMemoryThreshold_` | Byte threshold used to determine whether the form data is encoded into memory or onto disk before being uploaded. `[MultipartFormData.encodingMemoryThreshold](../Classes/MultipartFormData.html#/s:9Alamofire17MultipartFormDataC23encodingMemoryThresholds6UInt64VvpZ) ` by default. | | `_method_` | `[HTTPMethod](../Structs/HTTPMethod.html) ` for the `URLRequest`. `.post` by default. | | `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` value to be added to the `URLRequest`. `nil` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` to be used if the form data exceeds the memory threshold and is written to disk before being uploaded. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | | `_requestModifier_` | `[RequestModifier](../Classes/Session.html#/s:9Alamofire7SessionC15RequestModifiera) ` which will be applied to the `URLRequest` created from the provided parameters. `nil` by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. * `[upload(multipartFormData:with:usingThreshold:interceptor:fileManager:)](#/s:9Alamofire7SessionC6upload17multipartFormData4with14usingThreshold11interceptor11fileManagerAA13UploadRequestCAA09MultiparteF0C_AA21URLRequestConvertible_ps6UInt64VAA0N11Interceptor_pSgSo06NSFileL0CtF) ` Creates an `[UploadRequest](../Classes/UploadRequest.html) ` for the prebuilt `[MultipartFormData](../Classes/MultipartFormData.html) ` value using the providing `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value and `[RequestInterceptor](../Protocols/RequestInterceptor.html) `. It is important to understand the memory implications of uploading `[MultipartFormData](../Classes/MultipartFormData.html) `. If the cumulative payload is small, encoding the data in-memory and directly uploading to a server is the by far the most efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be used for larger payloads such as video content. The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory or stream from disk. If the content length of the `[MultipartFormData](../Classes/MultipartFormData.html) ` is below the `encodingMemoryThreshold`, encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding technique was used. #### Declaration #### Parameters | | | | --- | --- | | `_multipartFormData_` | `[MultipartFormData](../Classes/MultipartFormData.html) ` instance to upload. | | `_request_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value to be used to create the `URLRequest`. | | `_encodingMemoryThreshold_` | Byte threshold used to determine whether the form data is encoded into memory or onto disk before being uploaded. `[MultipartFormData.encodingMemoryThreshold](../Classes/MultipartFormData.html#/s:9Alamofire17MultipartFormDataC23encodingMemoryThresholds6UInt64VvpZ) ` by default. | | `_interceptor_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) ` value to be used by the returned `[DataRequest](../Classes/DataRequest.html) `. `nil` by default. | | `_fileManager_` | `FileManager` instance to be used by the returned `[UploadRequest](../Classes/UploadRequest.html) `. `[.default](../Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` instance by default. | #### Return Value The created `[UploadRequest](../Classes/UploadRequest.html) `. [](#/RequestDelegate) ### RequestDelegate * `[sessionConfiguration](#/s:9Alamofire15RequestDelegateP20sessionConfigurationSo012NSURLSessionE0Cvp) ` #### Declaration * `[startImmediately](#/s:9Alamofire15RequestDelegateP16startImmediatelySbvp) ` #### Declaration * `[cleanup(after:)](#/s:9Alamofire15RequestDelegateP7cleanup5afteryAA0B0C_tF) ` #### Declaration * `[retryResult(for:dueTo:completion:)](#/s:9Alamofire15RequestDelegateP11retryResult3for5dueTo10completionyAA0B0C_AA7AFErrorOyAA05RetryE0OYbctF) ` #### Declaration * `[retryRequest(_:withDelay:)](#/s:9Alamofire15RequestDelegateP05retryB0_9withDelayyAA0B0C_SdSgtF) ` #### Declaration --- # BoolEncoding Enumeration Reference BoolEncoding ============ Encoding to use for `Bool` values. * `[numeric](#/s:9Alamofire21URLEncodedFormEncoderC12BoolEncodingO7numericyA2EmF) ` Encodes `true` as `1`, `false` as `0`. #### Declaration * `[literal](#/s:9Alamofire21URLEncodedFormEncoderC12BoolEncodingO7literalyA2EmF) ` Encodes `true` as “true”, `false` as “false”. This is the default encoding. #### Declaration --- # DataEncoding Enumeration Reference DataEncoding ============ Encoding to use for `Data` values. * `[deferredToData](#/s:9Alamofire21URLEncodedFormEncoderC12DataEncodingO010deferredToE0yA2EmF) ` Defers encoding to the `Data` type. #### Declaration * `[base64](#/s:9Alamofire21URLEncodedFormEncoderC12DataEncodingO6base64yA2EmF) ` Encodes `Data` as a Base64-encoded string. This is the default encoding. #### Declaration * `[custom(_:)](#/s:9Alamofire21URLEncodedFormEncoderC12DataEncodingO6customyAESS10Foundation0E0VKccAEmF) ` Encode the `Data` as a custom value encoded by the given closure. #### Declaration --- # URLEncodedFormEncoder Class Reference URLEncodedFormEncoder ===================== An object that encodes instances into URL-encoded query strings. `ArrayEncoding` can be used to configure how `Array` values are encoded. By default, the `.brackets` encoding is used, encoding array values with brackets for each value. e.g `array[]=1&array[]=2`. `BoolEncoding` can be used to configure how `Bool` values are encoded. By default, the `.numeric` encoding is used, encoding `true` as `1` and `false` as `0`. `DataEncoding` can be used to configure how `Data` values are encoded. By default, the `.deferredToData` encoding is used, which encodes `Data` values using their default `Encodable` implementation. `DateEncoding` can be used to configure how `Date` values are encoded. By default, the `.deferredToDate` encoding is used, which encodes `Date`s using their default `Encodable` implementation. `KeyEncoding` can be used to configure how keys are encoded. By default, the `.useDefaultKeys` encoding is used, which encodes the keys directly from the `Encodable` implementation. `KeyPathEncoding` can be used to configure how paths within nested objects are encoded. By default, the `.brackets` encoding is used, which encodes each sub-key in brackets. e.g. `parent[child][grandchild]=value`. `NilEncoding` can be used to configure how `nil` `Optional` values are encoded. By default, the `.dropKey` encoding is used, which drops `nil` key / value pairs from the output entirely. `SpaceEncoding` can be used to configure how spaces are encoded. By default, the `.percentEscaped` encoding is used, replacing spaces with `%20`. This type is largely based on Vapor’s [`url-encoded-form`](https://github.com/vapor/url-encoded-form) project. * `[ArrayEncoding](#/s:9Alamofire21URLEncodedFormEncoderC13ArrayEncodingO) ` Encoding to use for `Array` values. [See more](../Classes/URLEncodedFormEncoder/ArrayEncoding.html) #### Declaration * `[BoolEncoding](#/s:9Alamofire21URLEncodedFormEncoderC12BoolEncodingO) ` Encoding to use for `Bool` values. [See more](../Classes/URLEncodedFormEncoder/BoolEncoding.html) #### Declaration * `[DataEncoding](#/s:9Alamofire21URLEncodedFormEncoderC12DataEncodingO) ` Encoding to use for `Data` values. [See more](../Classes/URLEncodedFormEncoder/DataEncoding.html) #### Declaration * `[DateEncoding](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO) ` Encoding to use for `Date` values. [See more](../Classes/URLEncodedFormEncoder/DateEncoding.html) #### Declaration * `[KeyEncoding](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO) ` Encoding to use for keys. This type is derived from [`JSONEncoder`‘s `KeyEncodingStrategy`](https://github.com/apple/swift/blob/6aa313b8dd5f05135f7f878eccc1db6f9fbe34ff/stdlib/public/Darwin/Foundation/JSONEncoder.swift#L128) and [`XMLEncoder`s `KeyEncodingStrategy`](https://github.com/MaxDesiatov/XMLCoder/blob/master/Sources/XMLCoder/Encoder/XMLEncoder.swift#L102) . [See more](../Classes/URLEncodedFormEncoder/KeyEncoding.html) #### Declaration * `[KeyPathEncoding](#/s:9Alamofire21URLEncodedFormEncoderC15KeyPathEncodingV) ` Encoding to use for nested object and `Encodable` value key paths. ["parent" : ["child" : ["grandchild": "value"]]] This encoding affects how the `parent`, `child`, `grandchild` path is encoded. Brackets are used by default. e.g. `parent[child][grandchild]=value`. [See more](../Classes/URLEncodedFormEncoder/KeyPathEncoding.html) #### Declaration * `[NilEncoding](#/s:9Alamofire21URLEncodedFormEncoderC11NilEncodingV) ` Encoding to use for `nil` values. [See more](../Classes/URLEncodedFormEncoder/NilEncoding.html) #### Declaration * `[SpaceEncoding](#/s:9Alamofire21URLEncodedFormEncoderC13SpaceEncodingO) ` Encoding to use for spaces. [See more](../Classes/URLEncodedFormEncoder/SpaceEncoding.html) #### Declaration * `[Error](#/s:9Alamofire21URLEncodedFormEncoderC5ErrorO) ` `[URLEncodedFormEncoder](../Classes/URLEncodedFormEncoder.html) ` error. [See more](../Classes/URLEncodedFormEncoder/Error.html) #### Declaration * `[alphabetizeKeyValuePairs](#/s:9Alamofire21URLEncodedFormEncoderC24alphabetizeKeyValuePairsSbvp) ` Whether or not to sort the encoded key value pairs. #### Declaration * `[arrayEncoding](#/s:9Alamofire21URLEncodedFormEncoderC13arrayEncodingAC05ArrayF0Ovp) ` The `[ArrayEncoding](../Classes/URLEncodedFormEncoder/ArrayEncoding.html) ` to use. #### Declaration * `[boolEncoding](#/s:9Alamofire21URLEncodedFormEncoderC12boolEncodingAC04BoolF0Ovp) ` The `[BoolEncoding](../Classes/URLEncodedFormEncoder/BoolEncoding.html) ` to use. #### Declaration * `[dataEncoding](#/s:9Alamofire21URLEncodedFormEncoderC12dataEncodingAC04DataF0Ovp) ` THe `[DataEncoding](../Classes/URLEncodedFormEncoder/DataEncoding.html) ` to use. #### Declaration * `[dateEncoding](#/s:9Alamofire21URLEncodedFormEncoderC12dateEncodingAC04DateF0Ovp) ` The `[DateEncoding](../Classes/URLEncodedFormEncoder/DateEncoding.html) ` to use. #### Declaration * `[keyEncoding](#/s:9Alamofire21URLEncodedFormEncoderC11keyEncodingAC03KeyF0Ovp) ` The `[KeyEncoding](../Classes/URLEncodedFormEncoder/KeyEncoding.html) ` to use. #### Declaration * `[keyPathEncoding](#/s:9Alamofire21URLEncodedFormEncoderC15keyPathEncodingAC03KeyfG0Vvp) ` The `[KeyPathEncoding](../Classes/URLEncodedFormEncoder/KeyPathEncoding.html) ` to use. #### Declaration * `[nilEncoding](#/s:9Alamofire21URLEncodedFormEncoderC11nilEncodingAC03NilF0Vvp) ` The `[NilEncoding](../Classes/URLEncodedFormEncoder/NilEncoding.html) ` to use. #### Declaration * `[spaceEncoding](#/s:9Alamofire21URLEncodedFormEncoderC13spaceEncodingAC05SpaceF0Ovp) ` The `[SpaceEncoding](../Classes/URLEncodedFormEncoder/SpaceEncoding.html) ` to use. #### Declaration * `[allowedCharacters](#/s:9Alamofire21URLEncodedFormEncoderC17allowedCharacters10Foundation12CharacterSetVvp) ` The `CharacterSet` of allowed (non-escaped) characters. #### Declaration * `[init(alphabetizeKeyValuePairs:arrayEncoding:boolEncoding:dataEncoding:dateEncoding:keyEncoding:keyPathEncoding:nilEncoding:spaceEncoding:allowedCharacters:)](#/s:9Alamofire21URLEncodedFormEncoderC24alphabetizeKeyValuePairs13arrayEncoding04boolJ004dataJ004dateJ003keyJ00n4PathJ003nilJ005spaceJ017allowedCharactersACSb_AC05ArrayJ0OAC04BoolJ0OAC04DataJ0OAC04DateJ0OAC0fJ0OAC0foJ0VAC03NilJ0VAC05SpaceJ0O10Foundation12CharacterSetVtcfc) ` Creates an instance from the supplied parameters. #### Declaration #### Parameters | | | | --- | --- | | `_alphabetizeKeyValuePairs_` | Whether or not to sort the encoded key value pairs. `true` by default. | | `_arrayEncoding_` | The `[ArrayEncoding](../Classes/URLEncodedFormEncoder/ArrayEncoding.html) ` to use. `.brackets` by default. | | `_boolEncoding_` | The `[BoolEncoding](../Classes/URLEncodedFormEncoder/BoolEncoding.html) ` to use. `.numeric` by default. | | `_dataEncoding_` | The `[DataEncoding](../Classes/URLEncodedFormEncoder/DataEncoding.html) ` to use. `.base64` by default. | | `_dateEncoding_` | The `[DateEncoding](../Classes/URLEncodedFormEncoder/DateEncoding.html) ` to use. `.deferredToDate` by default. | | `_keyEncoding_` | The `[KeyEncoding](../Classes/URLEncodedFormEncoder/KeyEncoding.html) ` to use. `.useDefaultKeys` by default. | | `_nilEncoding_` | The `[NilEncoding](../Classes/URLEncodedFormEncoder/NilEncoding.html) ` to use. `.drop` by default. | | `_spaceEncoding_` | The `[SpaceEncoding](../Classes/URLEncodedFormEncoder/SpaceEncoding.html) ` to use. `.percentEscaped` by default. | | `_allowedCharacters_` | The `CharacterSet` of allowed (non-escaped) characters. `.afURLQueryAllowed` by default. | * `[encode(_:)](#/s:9Alamofire21URLEncodedFormEncoderC6encodeySSSE_pKF) ` Encodes the `value` as a URL form encoded `String`. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Encodable` value. | #### Return Value The encoded `String`. * `[encode(_:)](#/s:9Alamofire21URLEncodedFormEncoderC6encodey10Foundation4DataVSE_pKF) ` Encodes the value as `Data`. This is performed by first creating an encoded `String` and then returning the `.utf8` data. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Encodable` value. | #### Return Value The encoded `Data`. --- # ArrayEncoding Enumeration Reference ArrayEncoding ============= Encoding to use for `Array` values. * `[brackets](#/s:9Alamofire21URLEncodedFormEncoderC13ArrayEncodingO8bracketsyA2EmF) ` An empty set of square brackets (“\[\]”) are appended to the key for every value. This is the default encoding. #### Declaration * `[noBrackets](#/s:9Alamofire21URLEncodedFormEncoderC13ArrayEncodingO10noBracketsyA2EmF) ` No brackets are appended to the key and the key is encoded as is. #### Declaration * `[indexInBrackets](#/s:9Alamofire21URLEncodedFormEncoderC13ArrayEncodingO15indexInBracketsyA2EmF) ` Brackets containing the item index are appended. This matches the jQuery and Node.js behavior. #### Declaration * `[custom(_:)](#/s:9Alamofire21URLEncodedFormEncoderC13ArrayEncodingO6customyAES2S_SitccAEmF) ` Provide a custom array key encoding with the given closure. #### Declaration --- # DateEncoding Enumeration Reference DateEncoding ============ Encoding to use for `Date` values. * `[deferredToDate](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO010deferredToE0yA2EmF) ` Defers encoding to the `Date` type. This is the default encoding. #### Declaration * `[secondsSince1970](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO16secondsSince1970yA2EmF) ` Encodes `Date`s as seconds since midnight UTC on January 1, 1970. #### Declaration * `[millisecondsSince1970](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO21millisecondsSince1970yA2EmF) ` Encodes `Date`s as milliseconds since midnight UTC on January 1, 1970. #### Declaration * `[iso8601](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO7iso8601yA2EmF) ` Encodes `Date`s according to the ISO8601 and RFC3339 standards. #### Declaration * `[formatted(_:)](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO9formattedyAESo15NSDateFormatterCcAEmF) ` Encodes `Date`s using the given `DateFormatter`. #### Declaration * `[custom(_:)](#/s:9Alamofire21URLEncodedFormEncoderC12DateEncodingO6customyAESS10Foundation0E0VKccAEmF) ` Encodes `Date`s using the given closure. #### Declaration --- # NilEncoding Structure Reference NilEncoding =========== Encoding to use for `nil` values. * `[dropKey](#/s:9Alamofire21URLEncodedFormEncoderC11NilEncodingV7dropKeyAEvpZ) ` Encodes `nil` by dropping the entire key / value pair. #### Declaration * `[dropValue](#/s:9Alamofire21URLEncodedFormEncoderC11NilEncodingV9dropValueAEvpZ) ` Encodes `nil` by dropping only the value. e.g. `value1=one&nilValue=&value2=two`. #### Declaration * `[null](#/s:9Alamofire21URLEncodedFormEncoderC11NilEncodingV4nullAEvpZ) ` Encodes `nil` as `null`. #### Declaration * `[init(encoding:)](#/s:9Alamofire21URLEncodedFormEncoderC11NilEncodingV8encodingAESSSgyYbc_tcfc) ` Creates an instance with the encoding closure called for `nil` values. #### Declaration #### Parameters | | | | --- | --- | | `_encoding_` | Closure used to perform the encoding. | --- # KeyEncoding Enumeration Reference KeyEncoding =========== Encoding to use for keys. This type is derived from [`JSONEncoder`‘s `KeyEncodingStrategy`](https://github.com/apple/swift/blob/6aa313b8dd5f05135f7f878eccc1db6f9fbe34ff/stdlib/public/Darwin/Foundation/JSONEncoder.swift#L128) and [`XMLEncoder`s `KeyEncodingStrategy`](https://github.com/MaxDesiatov/XMLCoder/blob/master/Sources/XMLCoder/Encoder/XMLEncoder.swift#L102) . * `[useDefaultKeys](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO14useDefaultKeysyA2EmF) ` Use the keys specified by each type. This is the default encoding. #### Declaration * `[convertToSnakeCase](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO18convertToSnakeCaseyA2EmF) ` Convert from “camelCaseKeys” to “snake\_case\_keys” before writing a key. Capital characters are determined by testing membership in `CharacterSet.uppercaseLetters` and `CharacterSet.lowercaseLetters` (Unicode General Categories Lu and Lt). The conversion to lower case uses `Locale.system`, also known as the ICU “root” locale. This means the result is consistent regardless of the current user’s locale and language preferences. Converting from camel case to snake case: 1. Splits words at the boundary of lower-case to upper-case 2. Inserts `_` between words 3. Lowercases the entire string 4. Preserves starting and ending `_`. For example, `oneTwoThree` becomes `one_two_three`. `_oneTwoThree_` becomes `_one_two_three_`. #### Declaration * `[convertToKebabCase](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO18convertToKebabCaseyA2EmF) ` Same as convertToSnakeCase, but using `-` instead of `_`. For example `oneTwoThree` becomes `one-two-three`. #### Declaration * `[capitalized](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO11capitalizedyA2EmF) ` Capitalize the first letter only. For example `oneTwoThree` becomes `OneTwoThree`. #### Declaration * `[uppercased](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO10uppercasedyA2EmF) ` Uppercase all letters. For example `oneTwoThree` becomes `ONETWOTHREE`. #### Declaration * `[lowercased](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO10lowercasedyA2EmF) ` Lowercase all letters. For example `oneTwoThree` becomes `onetwothree`. #### Declaration * `[custom(_:)](#/s:9Alamofire21URLEncodedFormEncoderC11KeyEncodingO6customyAES2SccAEmF) ` A custom encoding using the provided closure. #### Declaration --- # Error Enumeration Reference Error ===== `[URLEncodedFormEncoder](../../Classes/URLEncodedFormEncoder.html) ` error. * `[invalidRootObject(_:)](#/s:9Alamofire21URLEncodedFormEncoderC5ErrorO17invalidRootObjectyAESScAEmF) ` An invalid root object was created by the encoder. Only keyed values are valid. #### Declaration --- # Destination Enumeration Reference Destination =========== Defines where the URL-encoded string should be set for each `URLRequest`. * `[methodDependent](#/s:9Alamofire30URLEncodedFormParameterEncoderC11DestinationO15methodDependentyA2EmF) ` Applies the encoded query string to any existing query string for `.get`, `.head`, and `.delete` request. Sets it to the `[httpBody](../../Classes/URLEncodedFormParameterEncoder/Destination.html#/s:9Alamofire30URLEncodedFormParameterEncoderC11DestinationO8httpBodyyA2EmF) ` for all other methods. #### Declaration * `[queryString](#/s:9Alamofire30URLEncodedFormParameterEncoderC11DestinationO11queryStringyA2EmF) ` Applies the encoded query string to any existing query string from the `URLRequest`. #### Declaration * `[httpBody](#/s:9Alamofire30URLEncodedFormParameterEncoderC11DestinationO8httpBodyyA2EmF) ` Applies the encoded query string to the `httpBody` of the `URLRequest`. #### Declaration --- # KeyPathEncoding Structure Reference KeyPathEncoding =============== Encoding to use for nested object and `Encodable` value key paths. ["parent" : ["child" : ["grandchild": "value"]]] This encoding affects how the `parent`, `child`, `grandchild` path is encoded. Brackets are used by default. e.g. `parent[child][grandchild]=value`. * `[brackets](#/s:9Alamofire21URLEncodedFormEncoderC15KeyPathEncodingV8bracketsAEvpZ) ` Encodes key paths by wrapping each component in brackets. e.g. `parent[child][grandchild]`. #### Declaration * `[dots](#/s:9Alamofire21URLEncodedFormEncoderC15KeyPathEncodingV4dotsAEvpZ) ` Encodes key paths by separating each component with dots. e.g. `parent.child.grandchild`. #### Declaration * `[init(encoding:)](#/s:9Alamofire21URLEncodedFormEncoderC15KeyPathEncodingV8encodingAES2SYbc_tcfc) ` Creates an instance with the encoding closure called for each sub-key in a key path. #### Declaration #### Parameters | | | | --- | --- | | `_encoding_` | Closure used to perform the encoding. | --- # Global Variables Reference Global Variables ================ The following global variables are available globally. * `[AF](#/s:9Alamofire2AFAA7SessionCvp) ` Reference to `[Session.default](Classes/Session.html#/s:9Alamofire7SessionC7defaultACvpZ) ` for quick bootstrapping and examples. #### Declaration --- # SpaceEncoding Enumeration Reference SpaceEncoding ============= Encoding to use for spaces. * `[percentEscaped](#/s:9Alamofire21URLEncodedFormEncoderC13SpaceEncodingO14percentEscapedyA2EmF) ` Encodes spaces using percent escaping (`%20`). #### Declaration * `[plusReplaced](#/s:9Alamofire21URLEncodedFormEncoderC13SpaceEncodingO12plusReplacedyA2EmF) ` Encodes spaces as `+`. #### Declaration --- # UploadRequest Class Reference UploadRequest ============= `[DataRequest](../Classes/DataRequest.html) ` subclass which handles `Data` upload from memory, file, or stream using `URLSessionUploadTask`. * `[Uploadable](#/s:9Alamofire13UploadRequestC10UploadableO) ` Type describing the origin of the upload, whether `Data`, file, or stream. [See more](../Classes/UploadRequest/Uploadable.html) #### Declaration [](#/Initial%20State) ### Initial State * `[upload](#/s:9Alamofire13UploadRequestC6uploadAA21UploadableConvertible_pvp) ` The `[UploadableConvertible](../Protocols/UploadableConvertible.html) ` value used to produce the `[Uploadable](../Classes/UploadRequest/Uploadable.html) ` value for this instance. #### Declaration * `[fileManager](#/s:9Alamofire13UploadRequestC11fileManagerSo06NSFileE0Cvp) ` `FileManager` used to perform cleanup tasks, including the removal of multipart form encoded payloads written to disk. #### Declaration [](#/Mutable%20State) ### Mutable State * `[uploadable](#/s:9Alamofire13UploadRequestC10uploadableAC10UploadableOSgvp) ` `[Uploadable](../Classes/UploadRequest/Uploadable.html) ` value used by the instance. #### Declaration * `[cleanup()](#/s:9Alamofire13UploadRequestC7cleanupyyF) ` #### Declaration --- # URLEncodedFormParameterEncoder Class Reference URLEncodedFormParameterEncoder ============================== A `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` that encodes types as URL-encoded query strings to be set on the URL or as body data, depending on the `Destination` set. If no `Content-Type` header is already set on the provided `URLRequest`s, it will be set to `application/x-www-form-urlencoded; charset=utf-8`. Encoding behavior can be customized by passing an instance of `[URLEncodedFormEncoder](../Classes/URLEncodedFormEncoder.html) ` to the initializer. * `[Destination](#/s:9Alamofire30URLEncodedFormParameterEncoderC11DestinationO) ` Defines where the URL-encoded string should be set for each `URLRequest`. [See more](../Classes/URLEncodedFormParameterEncoder/Destination.html) #### Declaration * `[default](#/s:9Alamofire30URLEncodedFormParameterEncoderC7defaultACvpZ) ` Returns an encoder with default parameters. #### Declaration * `[encoder](#/s:9Alamofire30URLEncodedFormParameterEncoderC7encoderAA0bcE0Cvp) ` The `[URLEncodedFormEncoder](../Classes/URLEncodedFormEncoder.html) ` to use. #### Declaration * `[destination](#/s:9Alamofire30URLEncodedFormParameterEncoderC11destinationAC11DestinationOvp) ` The `[Destination](../Classes/URLEncodedFormParameterEncoder/Destination.html) ` for the URL-encoded string. #### Declaration * `[init(encoder:destination:)](#/s:9Alamofire30URLEncodedFormParameterEncoderC7encoder11destinationAcA0bcE0C_AC11DestinationOtcfc) ` Creates an instance with the provided `[URLEncodedFormEncoder](../Classes/URLEncodedFormEncoder.html) ` instance and `[Destination](../Classes/URLEncodedFormParameterEncoder/Destination.html) ` value. #### Declaration #### Parameters | | | | --- | --- | | `_encoder_` | The `[URLEncodedFormEncoder](../Classes/URLEncodedFormEncoder.html) `. `URLEncodedFormEncoder()` by default. | | `_destination_` | The `[Destination](../Classes/URLEncodedFormParameterEncoder/Destination.html) `. `.methodDependent` by default. | * `[encode(_:into:)](#/s:9Alamofire16ParameterEncoderP6encode_4into10Foundation10URLRequestVqd__Sg_AHtKSERd__s8SendableRd__lF) ` #### Declaration --- # Enumerations Reference Enumerations ============ The following enumerations are available globally. * `[AFInfo](#/s:9Alamofire6AFInfoO) ` Namespace for informational Alamofire values. [See more](Enums/AFInfo.html) #### Declaration * `[AFError](#/s:9Alamofire7AFErrorO) ` `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with their own associated reasons. [See more](Enums/AFError.html) #### Declaration * `[AuthenticationError](#/s:9Alamofire19AuthenticationErrorO) ` Represents various authentication failures that occur when using the `[AuthenticationInterceptor](Classes/AuthenticationInterceptor.html) `. All errors are still vended from Alamofire as `[AFError](Enums/AFError.html) ` types. The `AuthenticationError` instances will be embedded within `[AFError](Enums/AFError.html) ` `.requestAdaptationFailed` or `.requestRetryFailed` cases. [See more](Enums/AuthenticationError.html) #### Declaration * `[RetryResult](#/s:9Alamofire11RetryResultO) ` Outcome of determination whether retry is necessary. [See more](Enums/RetryResult.html) #### Declaration --- # Uploadable Enumeration Reference Uploadable ========== Type describing the origin of the upload, whether `Data`, file, or stream. * `[data(_:)](#/s:9Alamofire13UploadRequestC10UploadableO4datayAE10Foundation4DataVcAEmF) ` Upload from the provided `Data` value. #### Declaration * `[file(_:shouldRemove:)](#/s:9Alamofire13UploadRequestC10UploadableO4fileyAE10Foundation3URLV_SbtcAEmF) ` Upload from the provided file `URL`, as well as a `Bool` determining whether the source file should be automatically removed once uploaded. #### Declaration * `[stream(_:)](#/s:9Alamofire13UploadRequestC10UploadableO6streamyAESo13NSInputStreamCcAEmF) ` Upload from the provided `InputStream`. #### Declaration * `[createUploadable()](#/s:9Alamofire21UploadableConvertibleP06createB0AA13UploadRequestC0B0OyKF) ` #### Declaration --- # MultipartEncodingFailureReason Enumeration Reference MultipartEncodingFailureReason ============================== The underlying reason the `.multipartEncodingFailed` error occurred. * `[bodyPartURLInvalid(url:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO18bodyPartURLInvalidyAE10Foundation3URLV_tcAEmF) ` The `fileURL` provided for reading an encodable body part isn’t a file `URL`. #### Declaration * `[bodyPartFilenameInvalid(in:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO23bodyPartFilenameInvalidyAE10Foundation3URLV_tcAEmF) ` The filename of the `fileURL` provided has either an empty `lastPathComponent` or `pathExtension`. #### Declaration * `[bodyPartFileNotReachable(at:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO24bodyPartFileNotReachableyAE10Foundation3URLV_tcAEmF) ` The file at the `fileURL` provided was not reachable. #### Declaration * `[bodyPartFileNotReachableWithError(atURL:error:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO33bodyPartFileNotReachableWithErroryAE10Foundation3URLV_s0M0_ptcAEmF) ` Attempting to check the reachability of the `fileURL` provided threw an error. #### Declaration * `[bodyPartFileIsDirectory(at:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO23bodyPartFileIsDirectoryyAE10Foundation3URLV_tcAEmF) ` The file at the `fileURL` provided is actually a directory. #### Declaration * `[bodyPartFileSizeNotAvailable(at:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO28bodyPartFileSizeNotAvailableyAE10Foundation3URLV_tcAEmF) ` The size of the file at the `fileURL` provided was not returned by the system. #### Declaration * `[bodyPartFileSizeQueryFailedWithError(forURL:error:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO36bodyPartFileSizeQueryFailedWithErroryAE10Foundation3URLV_s0N0_ptcAEmF) ` The attempt to find the size of the file at the `fileURL` provided threw an error. #### Declaration * `[bodyPartInputStreamCreationFailed(for:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO33bodyPartInputStreamCreationFailedyAE10Foundation3URLV_tcAEmF) ` An `InputStream` could not be created for the provided `fileURL`. #### Declaration * `[outputStreamCreationFailed(for:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO26outputStreamCreationFailedyAE10Foundation3URLV_tcAEmF) ` An `OutputStream` could not be created when attempting to write the encoded data to disk. #### Declaration * `[outputStreamFileAlreadyExists(at:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO29outputStreamFileAlreadyExistsyAE10Foundation3URLV_tcAEmF) ` The encoded body data could not be written to disk because a file already exists at the provided `fileURL`. #### Declaration * `[outputStreamURLInvalid(url:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO22outputStreamURLInvalidyAE10Foundation3URLV_tcAEmF) ` The `fileURL` provided for writing the encoded body data to disk is not a file `URL`. #### Declaration * `[outputStreamWriteFailed(error:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO23outputStreamWriteFailedyAEs5Error_p_tcAEmF) ` The attempt to write the encoded body data to disk failed with an underlying error. #### Declaration * `[inputStreamReadFailed(error:)](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO21inputStreamReadFailedyAEs5Error_p_tcAEmF) ` The attempt to read an encoded body part `InputStream` failed with underlying system error. #### Declaration --- # UnexpectedInputStreamLength Structure Reference UnexpectedInputStreamLength =========================== Represents unexpected input stream length that occur when encoding the `[MultipartFormData](../../Classes/MultipartFormData.html) `. Instances will be embedded within an `AFError.multipartEncodingFailed` `.inputStreamReadFailed` case. * `[bytesExpected](#/s:9Alamofire7AFErrorO27UnexpectedInputStreamLengthV13bytesExpecteds6UInt64Vvp) ` The expected byte count to read. #### Declaration * `[bytesRead](#/s:9Alamofire7AFErrorO27UnexpectedInputStreamLengthV9bytesReads6UInt64Vvp) ` The actual byte count read. #### Declaration --- # ParameterEncoderFailureReason Enumeration Reference ParameterEncoderFailureReason ============================= The underlying reason the `.parameterEncoderFailed` error occurred. * `[RequiredComponent](#/s:9Alamofire7AFErrorO29ParameterEncoderFailureReasonO17RequiredComponentO) ` Possible missing components. [See more](../../Enums/AFError/ParameterEncoderFailureReason/RequiredComponent.html) #### Declaration * `[missingRequiredComponent(_:)](#/s:9Alamofire7AFErrorO29ParameterEncoderFailureReasonO24missingRequiredComponentyA2E0hI0OcAEmF) ` A `[RequiredComponent](../../Enums/AFError/ParameterEncoderFailureReason/RequiredComponent.html) ` was missing during encoding. #### Declaration * `[encoderFailed(error:)](#/s:9Alamofire7AFErrorO29ParameterEncoderFailureReasonO13encoderFailedyAEs5Error_p_tcAEmF) ` The underlying encoder failed with the associated error. #### Declaration --- # AFError Enumeration Reference AFError ======= `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with their own associated reasons. * `[MultipartEncodingFailureReason](#/s:9Alamofire7AFErrorO30MultipartEncodingFailureReasonO) ` The underlying reason the `.multipartEncodingFailed` error occurred. [See more](../Enums/AFError/MultipartEncodingFailureReason.html) #### Declaration * `[UnexpectedInputStreamLength](#/s:9Alamofire7AFErrorO27UnexpectedInputStreamLengthV) ` Represents unexpected input stream length that occur when encoding the `[MultipartFormData](../Classes/MultipartFormData.html) `. Instances will be embedded within an `AFError.multipartEncodingFailed` `.inputStreamReadFailed` case. [See more](../Enums/AFError/UnexpectedInputStreamLength.html) #### Declaration * `[ParameterEncodingFailureReason](#/s:9Alamofire7AFErrorO30ParameterEncodingFailureReasonO) ` The underlying reason the `.parameterEncodingFailed` error occurred. [See more](../Enums/AFError/ParameterEncodingFailureReason.html) #### Declaration * `[ParameterEncoderFailureReason](#/s:9Alamofire7AFErrorO29ParameterEncoderFailureReasonO) ` The underlying reason the `.parameterEncoderFailed` error occurred. [See more](../Enums/AFError/ParameterEncoderFailureReason.html) #### Declaration * `[ResponseValidationFailureReason](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO) ` The underlying reason the `.responseValidationFailed` error occurred. [See more](../Enums/AFError/ResponseValidationFailureReason.html) #### Declaration * `[ResponseSerializationFailureReason](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO) ` The underlying reason the response serialization error occurred. [See more](../Enums/AFError/ResponseSerializationFailureReason.html) #### Declaration * `[ServerTrustFailureReason](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO) ` Underlying reason a server trust evaluation error occurred. [See more](../Enums/AFError/ServerTrustFailureReason.html) #### Declaration * `[URLRequestValidationFailureReason](#/s:9Alamofire7AFErrorO33URLRequestValidationFailureReasonO) ` The underlying reason the `.urlRequestValidationFailed` error occurred. [See more](../Enums/AFError/URLRequestValidationFailureReason.html) #### Declaration * `[createUploadableFailed(error:)](#/s:9Alamofire7AFErrorO22createUploadableFailedyACs5Error_p_tcACmF) ` `[UploadableConvertible](../Protocols/UploadableConvertible.html) ` threw an error in `createUploadable()`. #### Declaration * `[createURLRequestFailed(error:)](#/s:9Alamofire7AFErrorO22createURLRequestFailedyACs5Error_p_tcACmF) ` `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` threw an error in `asURLRequest()`. #### Declaration * `[downloadedFileMoveFailed(error:source:destination:)](#/s:9Alamofire7AFErrorO24downloadedFileMoveFailedyACs5Error_p_10Foundation3URLVAHtcACmF) ` `[SessionDelegate](../Classes/SessionDelegate.html) ` threw an error while attempting to move downloaded file to destination URL. #### Declaration * `[explicitlyCancelled](#/s:9Alamofire7AFErrorO19explicitlyCancelledyA2CmF) ` `[Request](../Classes/Request.html) ` was explicitly cancelled. #### Declaration * `[invalidURL(url:)](#/s:9Alamofire7AFErrorO10invalidURLyAcA14URLConvertible_p_tcACmF) ` `[URLConvertible](../Protocols/URLConvertible.html) ` type failed to create a valid `URL`. #### Declaration * `[multipartEncodingFailed(reason:)](#/s:9Alamofire7AFErrorO23multipartEncodingFailedyA2C09MultipartD13FailureReasonO_tcACmF) ` Multipart form encoding failed. #### Declaration * `[parameterEncodingFailed(reason:)](#/s:9Alamofire7AFErrorO23parameterEncodingFailedyA2C09ParameterD13FailureReasonO_tcACmF) ` `[ParameterEncoding](../Protocols/ParameterEncoding.html) ` threw an error during the encoding process. #### Declaration * `[parameterEncoderFailed(reason:)](#/s:9Alamofire7AFErrorO22parameterEncoderFailedyA2C09ParameterD13FailureReasonO_tcACmF) ` `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` threw an error while running the encoder. #### Declaration * `[requestAdaptationFailed(error:)](#/s:9Alamofire7AFErrorO23requestAdaptationFailedyACs5Error_p_tcACmF) ` `[RequestAdapter](../Protocols/RequestAdapter.html) ` threw an error during adaptation. #### Declaration * `[requestRetryFailed(retryError:originalError:)](#/s:9Alamofire7AFErrorO18requestRetryFailedyACs5Error_p_sAE_ptcACmF) ` `[RequestRetrier](../Protocols/RequestRetrier.html) ` threw an error during the request retry process. #### Declaration * `[responseValidationFailed(reason:)](#/s:9Alamofire7AFErrorO24responseValidationFailedyA2C08ResponseD13FailureReasonO_tcACmF) ` Response validation failed. #### Declaration * `[responseSerializationFailed(reason:)](#/s:9Alamofire7AFErrorO27responseSerializationFailedyA2C08ResponseD13FailureReasonO_tcACmF) ` Response serialization failed. #### Declaration * `[serverTrustEvaluationFailed(reason:)](#/s:9Alamofire7AFErrorO27serverTrustEvaluationFailedyA2C06ServerD13FailureReasonO_tcACmF) ` `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` instance threw an error during trust evaluation. #### Declaration * `[sessionDeinitialized](#/s:9Alamofire7AFErrorO20sessionDeinitializedyA2CmF) ` `[Session](../Classes/Session.html) ` which issued the `[Request](../Classes/Request.html) ` was deinitialized, most likely because its reference went out of scope. #### Declaration * `[sessionInvalidated(error:)](#/s:9Alamofire7AFErrorO18sessionInvalidatedyACs5Error_pSg_tcACmF) ` `[Session](../Classes/Session.html) ` was explicitly invalidated, possibly with the `Error` produced by the underlying `URLSession`. #### Declaration * `[sessionTaskFailed(error:)](#/s:9Alamofire7AFErrorO17sessionTaskFailedyACs5Error_p_tcACmF) ` `URLSessionTask` completed with error. #### Declaration * `[urlRequestValidationFailed(reason:)](#/s:9Alamofire7AFErrorO26urlRequestValidationFailedyA2C010URLRequestE13FailureReasonO_tcACmF) ` `URLRequest` failed validation. #### Declaration [](#/Error%20Booleans) ### Error Booleans * `[isSessionDeinitializedError](#/s:9Alamofire7AFErrorO27isSessionDeinitializedErrorSbvp) ` Returns whether the instance is `[.sessionDeinitialized](../Enums/AFError.html#/s:9Alamofire7AFErrorO20sessionDeinitializedyA2CmF) `. #### Declaration * `[isSessionInvalidatedError](#/s:9Alamofire7AFErrorO25isSessionInvalidatedErrorSbvp) ` Returns whether the instance is `.sessionInvalidated`. #### Declaration * `[isExplicitlyCancelledError](#/s:9Alamofire7AFErrorO26isExplicitlyCancelledErrorSbvp) ` Returns whether the instance is `[.explicitlyCancelled](../Enums/AFError.html#/s:9Alamofire7AFErrorO19explicitlyCancelledyA2CmF) `. #### Declaration * `[isInvalidURLError](#/s:9Alamofire7AFErrorO17isInvalidURLErrorSbvp) ` Returns whether the instance is `.invalidURL`. #### Declaration * `[isParameterEncodingError](#/s:9Alamofire7AFErrorO24isParameterEncodingErrorSbvp) ` Returns whether the instance is `.parameterEncodingFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isParameterEncoderError](#/s:9Alamofire7AFErrorO23isParameterEncoderErrorSbvp) ` Returns whether the instance is `.parameterEncoderFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isMultipartEncodingError](#/s:9Alamofire7AFErrorO24isMultipartEncodingErrorSbvp) ` Returns whether the instance is `.multipartEncodingFailed`. When `true`, the `[url](../Enums/AFError.html#/s:9Alamofire7AFErrorO3url10Foundation3URLVSgvp) ` and `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` properties will contain the associated values. #### Declaration * `[isRequestAdaptationError](#/s:9Alamofire7AFErrorO24isRequestAdaptationErrorSbvp) ` Returns whether the instance is `.requestAdaptationFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isResponseValidationError](#/s:9Alamofire7AFErrorO25isResponseValidationErrorSbvp) ` Returns whether the instance is `.responseValidationFailed`. When `true`, the `[acceptableContentTypes](../Enums/AFError.html#/s:9Alamofire7AFErrorO22acceptableContentTypesSaySSGSgvp) `, `[responseContentType](../Enums/AFError.html#/s:9Alamofire7AFErrorO19responseContentTypeSSSgvp) `, `[responseCode](../Enums/AFError.html#/s:9Alamofire7AFErrorO12responseCodeSiSgvp) `, and `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` properties will contain the associated values. #### Declaration * `[isResponseSerializationError](#/s:9Alamofire7AFErrorO28isResponseSerializationErrorSbvp) ` Returns whether the instance is `.responseSerializationFailed`. When `true`, the `[failedStringEncoding](../Enums/AFError.html#/s:9Alamofire7AFErrorO20failedStringEncodingSS10FoundationE0E0VSgvp) ` and `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` properties will contain the associated values. #### Declaration * `[isServerTrustEvaluationError](#/s:9Alamofire7AFErrorO28isServerTrustEvaluationErrorSbvp) ` Returns whether the instance is `.serverTrustEvaluationFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isRequestRetryError](#/s:9Alamofire7AFErrorO19isRequestRetryErrorSbvp) ` Returns whether the instance is `requestRetryFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isCreateUploadableError](#/s:9Alamofire7AFErrorO23isCreateUploadableErrorSbvp) ` Returns whether the instance is `createUploadableFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isCreateURLRequestError](#/s:9Alamofire7AFErrorO23isCreateURLRequestErrorSbvp) ` Returns whether the instance is `createURLRequestFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration * `[isDownloadedFileMoveError](#/s:9Alamofire7AFErrorO25isDownloadedFileMoveErrorSbvp) ` Returns whether the instance is `downloadedFileMoveFailed`. When `true`, the `destination` and `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` properties will contain the associated values. #### Declaration * `[isSessionTaskError](#/s:9Alamofire7AFErrorO18isSessionTaskErrorSbvp) ` Returns whether the instance is `createURLRequestFailed`. When `true`, the `[underlyingError](../Enums/AFError.html#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` property will contain the associated value. #### Declaration [](#/Convenience%20Properties) ### Convenience Properties * `[urlConvertible](#/s:9Alamofire7AFErrorO14urlConvertibleAA14URLConvertible_pSgvp) ` The `[URLConvertible](../Protocols/URLConvertible.html) ` associated with the error. #### Declaration * `[url](#/s:9Alamofire7AFErrorO3url10Foundation3URLVSgvp) ` The `URL` associated with the error. #### Declaration * `[underlyingError](#/s:9Alamofire7AFErrorO15underlyingErrors0D0_pSgvp) ` The underlying `Error` responsible for generating the failure associated with `.sessionInvalidated`, `.parameterEncodingFailed`, `.parameterEncoderFailed`, `.multipartEncodingFailed`, `.requestAdaptationFailed`, `.responseSerializationFailed`, `.requestRetryFailed` errors. #### Declaration * `[acceptableContentTypes](#/s:9Alamofire7AFErrorO22acceptableContentTypesSaySSGSgvp) ` The acceptable `Content-Type`s of a `.responseValidationFailed` error. #### Declaration * `[responseContentType](#/s:9Alamofire7AFErrorO19responseContentTypeSSSgvp) ` The response `Content-Type` of a `.responseValidationFailed` error. #### Declaration * `[responseCode](#/s:9Alamofire7AFErrorO12responseCodeSiSgvp) ` The response code of a `.responseValidationFailed` error. #### Declaration * `[failedStringEncoding](#/s:9Alamofire7AFErrorO20failedStringEncodingSS10FoundationE0E0VSgvp) ` The `String.Encoding` associated with a failed `.stringResponse()` call. #### Declaration * `[sourceURL](#/s:9Alamofire7AFErrorO9sourceURL10Foundation0D0VSgvp) ` The `source` URL of a `.downloadedFileMoveFailed` error. #### Declaration * `[destinationURL](#/s:9Alamofire7AFErrorO14destinationURL10Foundation0D0VSgvp) ` The `destination` URL of a `.downloadedFileMoveFailed` error. #### Declaration * `[downloadResumeData](#/s:9Alamofire7AFErrorO18downloadResumeData10Foundation0E0VSgvp) ` The download resume data of any underlying network error. Only produced by `[DownloadRequest](../Classes/DownloadRequest.html) `s. #### Declaration [](#/Error%20Descriptions) ### Error Descriptions * `[errorDescription](#/s:10Foundation14LocalizedErrorP16errorDescriptionSSSgvp) ` #### Declaration --- # ParameterEncodingFailureReason Enumeration Reference ParameterEncodingFailureReason ============================== The underlying reason the `.parameterEncodingFailed` error occurred. * `[missingURL](#/s:9Alamofire7AFErrorO30ParameterEncodingFailureReasonO10missingURLyA2EmF) ` The `URLRequest` did not have a `URL` to encode. #### Declaration * `[jsonEncodingFailed(error:)](#/s:9Alamofire7AFErrorO30ParameterEncodingFailureReasonO04jsonD6FailedyAEs5Error_p_tcAEmF) ` JSON serialization failed with an underlying system error during the encoding process. #### Declaration * `[customEncodingFailed(error:)](#/s:9Alamofire7AFErrorO30ParameterEncodingFailureReasonO06customD6FailedyAEs5Error_p_tcAEmF) ` Custom parameter encoding failed due to the associated `Error`. #### Declaration --- # ResponseValidationFailureReason Enumeration Reference ResponseValidationFailureReason =============================== The underlying reason the `.responseValidationFailed` error occurred. * `[dataFileNil](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO11dataFileNilyA2EmF) ` The data file containing the server response did not exist. #### Declaration * `[dataFileReadFailed(at:)](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO18dataFileReadFailedyAE10Foundation3URLV_tcAEmF) ` The data file containing the server response at the associated `URL` could not be read. #### Declaration * `[missingContentType(acceptableContentTypes:)](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO18missingContentTypeyAESaySSG_tcAEmF) ` The response did not contain a `Content-Type` and the `[acceptableContentTypes](../../Enums/AFError.html#/s:9Alamofire7AFErrorO22acceptableContentTypesSaySSGSgvp) ` provided did not contain a wildcard type. #### Declaration * `[unacceptableContentType(acceptableContentTypes:responseContentType:)](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO23unacceptableContentTypeyAESaySSG_SStcAEmF) ` The response `Content-Type` did not match any type in the provided `[acceptableContentTypes](../../Enums/AFError.html#/s:9Alamofire7AFErrorO22acceptableContentTypesSaySSGSgvp) `. #### Declaration * `[unacceptableStatusCode(code:)](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO22unacceptableStatusCodeyAESi_tcAEmF) ` The response status code was not acceptable. #### Declaration * `[customValidationFailed(error:)](#/s:9Alamofire7AFErrorO31ResponseValidationFailureReasonO06customD6FailedyAEs5Error_p_tcAEmF) ` Custom response validation failed due to the associated `Error`. #### Declaration --- # ServerTrustFailureReason Enumeration Reference ServerTrustFailureReason ======================== Underlying reason a server trust evaluation error occurred. * `[Output](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO6OutputV) ` The output of a server trust evaluation. [See more](../../Enums/AFError/ServerTrustFailureReason/Output.html) #### Declaration * `[noRequiredEvaluator(host:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO19noRequiredEvaluatoryAESS_tcAEmF) ` No `ServerTrustEvaluator` was found for the associated host. #### Declaration * `[noCertificatesFound](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO19noCertificatesFoundyA2EmF) ` No certificates were found with which to perform the trust evaluation. #### Declaration * `[noPublicKeysFound](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO17noPublicKeysFoundyA2EmF) ` No public keys were found with which to perform the trust evaluation. #### Declaration * `[policyApplicationFailed(trust:policy:status:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO23policyApplicationFailedyAESo03SecD3Refa_So0j6PolicyK0as5Int32VtcAEmF) ` During evaluation, application of the associated `SecPolicy` failed. #### Declaration * `[settingAnchorCertificatesFailed(status:certificates:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO31settingAnchorCertificatesFailedyAEs5Int32V_SaySo17SecCertificateRefaGtcAEmF) ` During evaluation, setting the associated anchor certificates failed. #### Declaration * `[revocationPolicyCreationFailed](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO30revocationPolicyCreationFailedyA2EmF) ` During evaluation, creation of the revocation policy failed. #### Declaration * `[trustEvaluationFailed(error:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO21trustEvaluationFailedyAEs5Error_pSg_tcAEmF) ` `SecTrust` evaluation failed with the associated `Error`, if one was produced. #### Declaration * `[defaultEvaluationFailed(output:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO23defaultEvaluationFailedyA2E6OutputV_tcAEmF) ` Default evaluation failed with the associated `[Output](../../Enums/AFError/ServerTrustFailureReason/Output.html) `. #### Declaration * `[hostValidationFailed(output:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO20hostValidationFailedyA2E6OutputV_tcAEmF) ` Host validation failed with the associated `[Output](../../Enums/AFError/ServerTrustFailureReason/Output.html) `. #### Declaration * `[revocationCheckFailed(output:options:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO21revocationCheckFailedyA2E6OutputV_AA010RevocationD9EvaluatorC7OptionsVtcAEmF) ` Revocation check failed with the associated `[Output](../../Enums/AFError/ServerTrustFailureReason/Output.html) ` and options. #### Declaration * `[certificatePinningFailed(host:trust:pinnedCertificates:serverCertificates:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO24certificatePinningFailedyAESS_So03SecD3RefaSaySo0j11CertificateK0aGAKtcAEmF) ` Certificate pinning failed. #### Declaration * `[publicKeyPinningFailed(host:trust:pinnedKeys:serverKeys:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO22publicKeyPinningFailedyAESS_So03SecD3RefaSaySo0khL0aGAKtcAEmF) ` Public key pinning failed. #### Declaration * `[customEvaluationFailed(error:)](#/s:9Alamofire7AFErrorO24ServerTrustFailureReasonO22customEvaluationFailedyAEs5Error_p_tcAEmF) ` Custom server trust evaluation failed due to the associated `Error`. #### Declaration --- # AFInfo Enumeration Reference AFInfo ====== Namespace for informational Alamofire values. * `[version](#/s:9Alamofire6AFInfoO7versionSSvpZ) ` Current Alamofire version. #### Declaration --- # URLRequestValidationFailureReason Enumeration Reference URLRequestValidationFailureReason ================================= The underlying reason the `.urlRequestValidationFailed` error occurred. * `[bodyDataInGETRequest(_:)](#/s:9Alamofire7AFErrorO33URLRequestValidationFailureReasonO20bodyDataInGETRequestyAE10Foundation0H0VcAEmF) ` URLRequest with GET method had body data. #### Declaration --- # RetryResult Enumeration Reference RetryResult =========== Outcome of determination whether retry is necessary. * `[retry](#/s:9Alamofire11RetryResultO5retryyA2CmF) ` Retry should be attempted immediately. #### Declaration * `[retryWithDelay(_:)](#/s:9Alamofire11RetryResultO14retryWithDelayyACSdcACmF) ` Retry should be attempted after the associated `TimeInterval`. #### Declaration * `[doNotRetry](#/s:9Alamofire11RetryResultO05doNotB0yA2CmF) ` Do not retry. #### Declaration * `[doNotRetryWithError(_:)](#/s:9Alamofire11RetryResultO05doNotB9WithErroryACs0G0_pcACmF) ` Do not retry due to the associated `Error`. #### Declaration --- # ResponseSerializationFailureReason Enumeration Reference ResponseSerializationFailureReason ================================== The underlying reason the response serialization error occurred. * `[inputDataNilOrZeroLength](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO24inputDataNilOrZeroLengthyA2EmF) ` The server response contained no data or the data was zero length. #### Declaration * `[inputFileNil](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO12inputFileNilyA2EmF) ` The file containing the server response did not exist. #### Declaration * `[inputFileReadFailed(at:)](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO19inputFileReadFailedyAE10Foundation3URLV_tcAEmF) ` The file containing the server response could not be read from the associated `URL`. #### Declaration * `[stringSerializationFailed(encoding:)](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO06stringD6FailedyAESS10FoundationE8EncodingV_tcAEmF) ` String serialization failed using the provided `String.Encoding`. #### Declaration * `[jsonSerializationFailed(error:)](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO04jsonD6FailedyAEs5Error_p_tcAEmF) ` JSON serialization failed with an underlying system error. #### Declaration * `[decodingFailed(error:)](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO14decodingFailedyAEs5Error_p_tcAEmF) ` A `[DataDecoder](../../Protocols/DataDecoder.html) ` failed to decode the response due to the associated `Error`. #### Declaration * `[customSerializationFailed(error:)](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO06customD6FailedyAEs5Error_p_tcAEmF) ` A custom response serializer failed due to the associated `Error`. #### Declaration * `[invalidEmptyResponse(type:)](#/s:9Alamofire7AFErrorO34ResponseSerializationFailureReasonO012invalidEmptyC0yAESS_tcAEmF) ` Generic serialization failed for an empty response that wasn’t type `[Empty](../../Structs/Empty.html) ` but instead the associated type. #### Declaration --- # CharacterSet Extension Reference CharacterSet ============ * `[afURLQueryAllowed](#/s:10Foundation12CharacterSetV9AlamofireE17afURLQueryAllowedACvpZ) ` Creates a CharacterSet from RFC 3986 allowed characters. RFC 3986 states that the following characters are “reserved” characters. * General Delimiters: “:”, “#”, “\[”, “\]”, “@”, “?”, “/” * Sub-Delimiters: “!”, “$”, “&”, “‘”, “(”, “)”, “\*”, “+”, “,”, “;”, “=” In RFC 3986 - Section 3.4, it states that the “?” and “/” characters should not be escaped to allow query strings to include a URL. Therefore, all “reserved” characters with the exception of “?” and “/” should be percent-escaped in the query string. #### Declaration --- # AuthenticationError Enumeration Reference AuthenticationError =================== Represents various authentication failures that occur when using the `[AuthenticationInterceptor](../Classes/AuthenticationInterceptor.html) `. All errors are still vended from Alamofire as `[AFError](../Enums/AFError.html) ` types. The `AuthenticationError` instances will be embedded within `[AFError](../Enums/AFError.html) ` `.requestAdaptationFailed` or `.requestRetryFailed` cases. * `[missingCredential](#/s:9Alamofire19AuthenticationErrorO17missingCredentialyA2CmF) ` The credential was missing so the request could not be authenticated. #### Declaration * `[excessiveRefresh](#/s:9Alamofire19AuthenticationErrorO16excessiveRefreshyA2CmF) ` The credential was refreshed too many times within the `RefreshWindow`. #### Declaration --- # Error Extension Reference Error ===== * `[asAFError](#/s:s5ErrorP9AlamofireE9asAFErrorAC0D0OSgvp) ` Returns the instance cast as an `[AFError](../Enums/AFError.html) `. #### Declaration * `[asAFError(orFailWith:file:line:)](#/s:s5ErrorP9AlamofireE9asAFError10orFailWith4file4lineAC0D0OSSyXK_s12StaticStringVSutF) ` Returns the instance cast as an `[AFError](../Enums/AFError.html) `. If casting fails, a `fatalError` with the specified `message` is thrown. #### Declaration --- # Extensions Reference Extensions ========== The following extensions are available globally. * `[Error](#/s:s5ErrorP) ` [See more](Extensions/Error.html) #### Declaration [](#/System%20Type%20Extensions) ### System Type Extensions * `[URLRequest](#/s:10Foundation10URLRequestV) ` [See more](Extensions/URLRequest.html) #### Declaration * `[HTTPURLResponse](#/c:objc(cs)NSHTTPURLResponse) ` [See more](Extensions/HTTPURLResponse.html) #### Declaration * `[URLSessionConfiguration](#/c:objc(cs)NSURLSessionConfiguration) ` [See more](Extensions/URLSessionConfiguration.html) #### Declaration * `[Notification](#/s:10Foundation12NotificationV) ` [See more](Extensions/Notification.html) #### Declaration * `[Protected](#/) ` * `[String](#/s:SS) ` [See more](Extensions/String.html) #### Declaration * `[URL](#/s:10Foundation3URLV) ` [See more](Extensions/URL.html) #### Declaration * `[URLComponents](#/s:10Foundation13URLComponentsV) ` [See more](Extensions/URLComponents.html) #### Declaration [](#/DataDecoder%20Protocol) ### DataDecoder Protocol * `[JSONDecoder](#/s:10Foundation11JSONDecoderC) ` `JSONDecoder` automatically conforms to `[DataDecoder](Protocols/DataDecoder.html) `. #### Declaration * `[PropertyListDecoder](#/s:10Foundation19PropertyListDecoderC) ` `PropertyListDecoder` automatically conforms to `[DataDecoder](Protocols/DataDecoder.html) `. #### Declaration [](#/Extensions) ### Extensions * `[[ServerTrustEvaluating]](#/) ` [See more](Extensions/%5BServerTrustEvaluating%5D.html) * `[Bundle](#/c:objc(cs)NSBundle) ` #### Declaration * `[SecTrust](#/c:@T@SecTrustRef) ` #### Declaration * `[SecPolicy](#/c:@T@SecPolicyRef) ` #### Declaration * `[Array](#/s:Sa) ` #### Declaration * `[SecCertificate](#/c:@T@SecCertificateRef) ` #### Declaration * `[OSStatus](#/c:@T@OSStatus) ` #### Declaration * `[SecTrustResultType](#/c:@E@SecTrustResultType) ` #### Declaration * `[CharacterSet](#/s:10Foundation12CharacterSetV) ` [See more](Extensions/CharacterSet.html) #### Declaration --- # URLComponents Extension Reference URLComponents ============= * `[asURL()](#/s:10Foundation13URLComponentsV9AlamofireE5asURLAA0E0VyKF) ` Returns a `URL` if the `self`‘s `url` is not nil, otherwise throws. #### Declaration #### Return Value The `URL` from the `url` property. --- # Notification Extension Reference Notification ============ * `[request](#/s:10Foundation12NotificationV9AlamofireE7requestAD7RequestCSgvp) ` The `[Request](../Classes/Request.html) ` contained by the instance’s `userInfo`, `nil` otherwise. #### Declaration --- # URL Extension Reference URL === * `[asURL()](#/s:10Foundation3URLV9AlamofireE02asB0ACyKF) ` Returns `self`. #### Declaration --- # HTTPURLResponse Extension Reference HTTPURLResponse =============== * `[headers](#/s:So17NSHTTPURLResponseC9AlamofireE7headersAC11HTTPHeadersVvp) ` Returns `allHeaderFields` as `[HTTPHeaders](../Structs/HTTPHeaders.html) `. #### Declaration --- # String Extension Reference String ====== * `[asURL()](#/s:SS9AlamofireE5asURL10Foundation0C0VyKF) ` Returns a `URL` if `self` can be used to initialize a `URL` instance, otherwise throws. #### Declaration #### Return Value The `URL` initialized with `self`. --- # URLSessionConfiguration Extension Reference URLSessionConfiguration ======================= * `[headers](#/s:So25NSURLSessionConfigurationC9AlamofireE7headersAC11HTTPHeadersVvp) ` Returns `httpAdditionalHeaders` as `[HTTPHeaders](../Structs/HTTPHeaders.html) `. #### Declaration --- # URLRequest Extension Reference URLRequest ========== * `[headers](#/s:10Foundation10URLRequestV9AlamofireE7headersAD11HTTPHeadersVvp) ` Returns `allHTTPHeaderFields` as `[HTTPHeaders](../Structs/HTTPHeaders.html) `. #### Declaration * `[asURLRequest()](#/s:10Foundation10URLRequestV9AlamofireE02asB0ACyKF) ` Returns `self`. #### Declaration * `[init(url:method:headers:)](#/s:10Foundation10URLRequestV9AlamofireE3url6method7headersAcD14URLConvertible_p_AD10HTTPMethodVAD11HTTPHeadersVSgtKcfc) ` Creates an instance with the specified `url`, `[method](../Extensions/URLRequest.html#/s:10Foundation10URLRequestV9AlamofireE6methodAD10HTTPMethodVSgvp) `, and `[headers](../Extensions/URLRequest.html#/s:10Foundation10URLRequestV9AlamofireE7headersAD11HTTPHeadersVvp) `. #### Declaration #### Parameters | | | | --- | --- | | `_url_` | The `[URLConvertible](../Protocols/URLConvertible.html) ` value. | | `_method_` | The `[HTTPMethod](../Structs/HTTPMethod.html) `. | | `_headers_` | The `[HTTPHeaders](../Structs/HTTPHeaders.html) `, `nil` by default. | * `[method](#/s:10Foundation10URLRequestV9AlamofireE6methodAD10HTTPMethodVSgvp) ` Returns the `httpMethod` as Alamofire’s `[HTTPMethod](../Structs/HTTPMethod.html) ` type. #### Declaration * `[validate()](#/s:10Foundation10URLRequestV9AlamofireE8validateyyKF) ` Undocumented #### Declaration --- # [ServerTrustEvaluating] Extension Reference \[ServerTrustEvaluating\] ========================= * `[evaluate(_:forHost:)](#/s:Sa9AlamofireAA21ServerTrustEvaluating_pRszlE8evaluate_7forHostySo03SecC3Refa_SStKF) ` Evaluates the given `SecTrust` value for the given `host`. #### Declaration #### Parameters | | | | --- | --- | | `_trust_` | The `SecTrust` value to evaluate. | | `_host_` | The host for which to evaluate the `SecTrust` value. | #### Return Value Whether or not the evaluator considers the `SecTrust` value valid for `host`. --- # Protocols Reference Protocols ========= The following protocols are available globally. [](#/Serialization) ### Serialization * `[DataStreamSerializer](#/s:9Alamofire20DataStreamSerializerP) ` A type which can serialize incoming `Data`. [See more](Protocols/DataStreamSerializer.html) #### Declaration * `[ParameterEncoder](#/s:9Alamofire16ParameterEncoderP) ` A type that can encode any `Encodable` type into a `URLRequest`. [See more](Protocols/ParameterEncoder.html) #### Declaration * `[ParameterEncoding](#/s:9Alamofire17ParameterEncodingP) ` A type used to define how a set of parameters are applied to a `URLRequest`. [See more](Protocols/ParameterEncoding.html) #### Declaration [](#/Protocol%20Conformances) ### Protocol Conformances * `[RequestDelegate](#/s:9Alamofire15RequestDelegateP) ` Protocol abstraction for `[Request](Classes/Request.html) `‘s communication back to the `[SessionDelegate](Classes/SessionDelegate.html) `. [See more](Protocols/RequestDelegate.html) #### Declaration * `[URLConvertible](#/s:9Alamofire14URLConvertibleP) ` Types adopting the `URLConvertible` protocol can be used to construct `URL`s, which can then be used to construct `URLRequest`s. [See more](Protocols/URLConvertible.html) #### Declaration * `[URLRequestConvertible](#/s:9Alamofire21URLRequestConvertibleP) ` Types adopting the `URLRequestConvertible` protocol can be used to safely construct `URLRequest`s. [See more](Protocols/URLRequestConvertible.html) #### Declaration * `[UploadableConvertible](#/s:9Alamofire21UploadableConvertibleP) ` A type that can produce an `[UploadRequest.Uploadable](Classes/UploadRequest/Uploadable.html) ` value. [See more](Protocols/UploadableConvertible.html) #### Declaration * `[UploadConvertible](#/s:9Alamofire17UploadConvertibleP) ` A type that can be converted to an upload, whether from an `[UploadRequest.Uploadable](Classes/UploadRequest/Uploadable.html) ` or `[URLRequestConvertible](Protocols/URLRequestConvertible.html) `. #### Declaration * `[WebSocketMessageSerializer](#/s:9Alamofire26WebSocketMessageSerializerP) ` Undocumented [See more](Protocols/WebSocketMessageSerializer.html) #### Declaration * `[AlamofireExtended](#/s:9Alamofire0A8ExtendedP) ` Protocol describing the `af` extension points for Alamofire extended types. [See more](Protocols/AlamofireExtended.html) #### Declaration * `[AuthenticationCredential](#/s:9Alamofire24AuthenticationCredentialP) ` Types adopting the `AuthenticationCredential` protocol can be used to authenticate `URLRequest`s. One common example of an `AuthenticationCredential` is an OAuth2 credential containing an access token used to authenticate all requests on behalf of a user. The access token generally has an expiration window of 60 minutes which will then require a refresh of the credential using the refresh token to generate a new access token. [See more](Protocols/AuthenticationCredential.html) #### Declaration * `[Authenticator](#/s:9Alamofire13AuthenticatorP) ` Types adopting the `Authenticator` protocol can be used to authenticate `URLRequest`s with an `[AuthenticationCredential](Protocols/AuthenticationCredential.html) ` as well as refresh the `[AuthenticationCredential](Protocols/AuthenticationCredential.html) ` when required. [See more](Protocols/Authenticator.html) #### Declaration * `[CachedResponseHandler](#/s:9Alamofire21CachedResponseHandlerP) ` A type that handles whether the data task should store the HTTP response in the cache. [See more](Protocols/CachedResponseHandler.html) #### Declaration * `[EventMonitor](#/s:9Alamofire12EventMonitorP) ` Protocol outlining the lifetime events inside Alamofire. It includes both events received from the various `URLSession` delegate protocols as well as various events from the lifetime of `[Request](Classes/Request.html) ` and its subclasses. [See more](Protocols/EventMonitor.html) #### Declaration * `[RedirectHandler](#/s:9Alamofire15RedirectHandlerP) ` A type that handles how an HTTP redirect response from a remote server should be redirected to the new request. [See more](Protocols/RedirectHandler.html) #### Declaration * `[RequestInterceptor](#/s:9Alamofire18RequestInterceptorP) ` Type that provides both `[RequestAdapter](Protocols/RequestAdapter.html) ` and `[RequestRetrier](Protocols/RequestRetrier.html) ` functionality. [See more](Protocols/RequestInterceptor.html) #### Declaration * `[RequestAdapter](#/s:9Alamofire14RequestAdapterP) ` A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary. [See more](Protocols/RequestAdapter.html) #### Declaration * `[RequestRetrier](#/s:9Alamofire14RequestRetrierP) ` A type that determines whether a request should be retried after being executed by the specified session manager and encountering an error. [See more](Protocols/RequestRetrier.html) #### Declaration * `[DataResponseSerializerProtocol](#/s:9Alamofire30DataResponseSerializerProtocolP) ` The type to which all data response serializers must conform in order to serialize a response. [See more](Protocols/DataResponseSerializerProtocol.html) #### Declaration * `[DownloadResponseSerializerProtocol](#/s:9Alamofire34DownloadResponseSerializerProtocolP) ` The type to which all download response serializers must conform in order to serialize a response. [See more](Protocols/DownloadResponseSerializerProtocol.html) #### Declaration * `[ResponseSerializer](#/s:9Alamofire18ResponseSerializerP) ` A serializer that can handle both data and download responses. [See more](Protocols/ResponseSerializer.html) #### Declaration * `[DataPreprocessor](#/s:9Alamofire16DataPreprocessorP) ` Type used to preprocess `Data` before it handled by a serializer. [See more](Protocols/DataPreprocessor.html) #### Declaration [](#/Empty) ### Empty * `[EmptyResponse](#/s:9Alamofire13EmptyResponseP) ` Protocol representing an empty response. Use `T.emptyValue()` to get an instance. [See more](Protocols/EmptyResponse.html) #### Declaration [](#/DataDecoder%20Protocol) ### DataDecoder Protocol * `[DataDecoder](#/s:9Alamofire11DataDecoderP) ` Any type which can decode `Data` into a `Decodable` type. [See more](Protocols/DataDecoder.html) #### Declaration * `[ServerTrustEvaluating](#/s:9Alamofire21ServerTrustEvaluatingP) ` A protocol describing the API used to evaluate server trusts. [See more](Protocols/ServerTrustEvaluating.html) #### Declaration --- # CachedResponseHandler Protocol Reference CachedResponseHandler ===================== A type that handles whether the data task should store the HTTP response in the cache. * `[dataTask(_:willCacheResponse:completion:)](#/s:9Alamofire21CachedResponseHandlerP8dataTask_09willCacheC010completionySo016NSURLSessionDataF0C_So19NSCachedURLResponseCyAJSgctF) ` Determines whether the HTTP response should be stored in the cache. The `completion` closure should be passed one of three possible options: 1. The cached response provided by the server (this is the most common use case). 2. A modified version of the cached response (you may want to modify it in some way before caching). 3. A `nil` value to prevent the cached response from being stored in the cache. #### Declaration #### Parameters | | | | --- | --- | | `_task_` | The data task whose request resulted in the cached response. | | `_response_` | The cached response to potentially store in the cache. | | `_completion_` | The closure to execute containing cached response, a modified response, or `nil`. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60ResponseCacher%60) ### Available where `Self` == `[ResponseCacher](../Structs/ResponseCacher.html) ` * `[cache](#/s:9Alamofire21CachedResponseHandlerPA2A0C6CacherVRszrlE5cacheAEvpZ)` Extension method Provides a `[ResponseCacher](../Structs/ResponseCacher.html) ` which caches the response, if allowed. Equivalent to `[ResponseCacher.cache](../Structs/ResponseCacher.html#/s:9Alamofire14ResponseCacherV5cacheACvpZ) `. #### Declaration * `[doNotCache](#/s:9Alamofire21CachedResponseHandlerPA2A0C6CacherVRszrlE10doNotCacheAEvpZ)` Extension method Provides a `[ResponseCacher](../Structs/ResponseCacher.html) ` which does not cache the response. Equivalent to `[ResponseCacher.doNotCache](../Structs/ResponseCacher.html#/s:9Alamofire14ResponseCacherV10doNotCacheACvpZ) `. #### Declaration * `[modify(using:)](#/s:9Alamofire21CachedResponseHandlerPA2A0C6CacherVRszrlE6modify5usingAESo19NSCachedURLResponseCSgSo20NSURLSessionDataTaskC_AItYbc_tFZ)` Extension method Creates a `[ResponseCacher](../Structs/ResponseCacher.html) ` which modifies the proposed `CachedURLResponse` using the provided closure. #### Declaration #### Parameters | | | | --- | --- | | `_closure_` | Closure used to modify the `CachedURLResponse`. | #### Return Value The `[ResponseCacher](../Structs/ResponseCacher.html) `. --- # Authenticator Protocol Reference Authenticator ============= Types adopting the `Authenticator` protocol can be used to authenticate `URLRequest`s with an `[AuthenticationCredential](../Protocols/AuthenticationCredential.html) ` as well as refresh the `[AuthenticationCredential](../Protocols/AuthenticationCredential.html) ` when required. * `[Credential](#/s:9Alamofire13AuthenticatorP10CredentialQa) ` The type of credential associated with the `Authenticator` instance. #### Declaration * `[apply(_:to:)](#/s:9Alamofire13AuthenticatorP5apply_2toy10CredentialQz_10Foundation10URLRequestVztF) ` Applies the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` to the `URLRequest`. In the case of OAuth2, the access token of the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` would be added to the `URLRequest` as a Bearer token to the `Authorization` header. #### Declaration #### Parameters | | | | --- | --- | | `_credential_` | The `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `. | | `_urlRequest_` | The `URLRequest`. | * `[refresh(_:for:completion:)](#/s:9Alamofire13AuthenticatorP7refresh_3for10completiony10CredentialQz_AA7SessionCys6ResultOyAHs5Error_pGYbctF) ` Refreshes the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` and executes the `completion` closure with the `Result` once complete. Refresh can be called in one of two ways. It can be called before the `[Request](../Classes/Request.html) ` is actually executed due to a `requiresRefresh` returning `true` during the adapt portion of the `[Request](../Classes/Request.html) ` creation process. It can also be triggered by a failed `[Request](../Classes/Request.html) ` where the authentication server denied access due to an expired or invalidated access token. In the case of OAuth2, this method would use the refresh token of the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` to generate a new `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` using the authentication service. Once complete, the `completion` closure should be called with the new `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `, or the error that occurred. In general, if the refresh call fails with certain status codes from the authentication server (commonly a 401), the refresh token in the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` can no longer be used to generate a valid `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `. In these cases, you will need to reauthenticate the user with their username / password. Please note, these are just general examples of common use cases. They are not meant to solve your specific authentication server challenges. Please work with your authentication server team to ensure your `Authenticator` logic matches their expectations. #### Declaration #### Parameters | | | | --- | --- | | `_credential_` | The `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` to refresh. | | `_session_` | The `[Session](../Classes/Session.html) ` requiring the refresh. | | `_completion_` | The closure to be executed once the refresh is complete. | * `[didRequest(_:with:failDueToAuthenticationError:)](#/s:9Alamofire13AuthenticatorP10didRequest_4with28failDueToAuthenticationErrorSb10Foundation10URLRequestV_So17NSHTTPURLResponseCs0J0_ptF) ` Determines whether the `URLRequest` failed due to an authentication error based on the `HTTPURLResponse`. If the authentication server **CANNOT** invalidate credentials after they are issued, then simply return `false` for this method. If the authentication server **CAN** invalidate credentials due to security breaches, then you will need to work with your authentication server team to understand how to identify when this occurs. In the case of OAuth2, where an authentication server can invalidate credentials, you will need to inspect the `HTTPURLResponse` or possibly the `Error` for when this occurs. This is commonly handled by the authentication server returning a 401 status code and some additional header to indicate an OAuth2 failure occurred. It is very important to understand how your authentication server works to be able to implement this correctly. For example, if your authentication server returns a 401 when an OAuth2 error occurs, and your downstream service also returns a 401 when you are not authorized to perform that operation, how do you know which layer of the backend returned you a 401? You do not want to trigger a refresh unless you know your authentication server is actually the layer rejecting the request. Again, work with your authentication server team to understand how to identify an OAuth2 401 error vs. a downstream 401 error to avoid endless refresh loops. #### Declaration #### Parameters | | | | --- | --- | | `_urlRequest_` | The `URLRequest`. | | `_response_` | The `HTTPURLResponse`. | | `_error_` | The `Error`. | #### Return Value `true` if the `URLRequest` failed due to an authentication error, `false` otherwise. * `[isRequest(_:authenticatedWith:)](#/s:9Alamofire13AuthenticatorP9isRequest_17authenticatedWithSb10Foundation10URLRequestV_10CredentialQztF) ` Determines whether the `URLRequest` is authenticated with the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `. If the authentication server **CANNOT** invalidate credentials after they are issued, then simply return `true` for this method. If the authentication server **CAN** invalidate credentials due to security breaches, then read on. When an authentication server can invalidate credentials, it means that you may have a non-expired credential that appears to be valid, but will be rejected by the authentication server when used. Generally when this happens, a number of requests are all sent when the application is foregrounded, and all of them will be rejected by the authentication server in the order they are received. The first failed request will trigger a refresh internally, which will update the credential, and then retry all the queued requests with the new credential. However, it is possible that some of the original requests will not return from the authentication server until the refresh has completed. This is where this method comes in. When the authentication server rejects a credential, we need to check to make sure we haven’t refreshed the credential while the request was in flight. If it has already refreshed, then we don’t need to trigger an additional refresh. If it hasn’t refreshed, then we need to refresh. Now that it is understood how the result of this method is used in the refresh lifecycle, let’s walk through how to implement it. You should return `true` in this method if the `URLRequest` is authenticated in a way that matches the values in the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `. In the case of OAuth2, this would mean that the Bearer token in the `Authorization` header of the `URLRequest` matches the access token in the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `. If it matches, then we know the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) ` was used to authenticate the `URLRequest` and should return `true`. If the Bearer token did not match the access token, then you should return `false`. #### Declaration #### Parameters | | | | --- | --- | | `_urlRequest_` | The `URLRequest`. | | `_credential_` | The `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `. | #### Return Value `true` if the `URLRequest` is authenticated with the `[Credential](../Protocols/Authenticator.html#/s:9Alamofire13AuthenticatorP10CredentialQa) `, `false` otherwise. --- # AlamofireExtended Protocol Reference AlamofireExtended ================= Protocol describing the `af` extension points for Alamofire extended types. * `[ExtendedType](#/s:9Alamofire0A8ExtendedP0B4TypeQa) ` Type being extended. #### Declaration * `[af](#/s:9Alamofire0A8ExtendedP2afAA0A9ExtensionVy0B4TypeQzGmvpZ)` Default implementation Static Alamofire extension point. #### Default Implementation Static Alamofire extension point. #### Declaration * `[af](#/s:9Alamofire0A8ExtendedP2afAA0A9ExtensionVy0B4TypeQzGvp)` Default implementation Instance Alamofire extension point. #### Default Implementation Instance Alamofire extension point. #### Declaration --- # AuthenticationCredential Protocol Reference AuthenticationCredential ======================== Types adopting the `AuthenticationCredential` protocol can be used to authenticate `URLRequest`s. One common example of an `AuthenticationCredential` is an OAuth2 credential containing an access token used to authenticate all requests on behalf of a user. The access token generally has an expiration window of 60 minutes which will then require a refresh of the credential using the refresh token to generate a new access token. * `[requiresRefresh](#/s:9Alamofire24AuthenticationCredentialP15requiresRefreshSbvp) ` Whether the credential requires a refresh. This property should always return `true` when the credential is expired. It is also wise to consider returning `true` when the credential will expire in several seconds or minutes depending on the expiration window of the credential. For example, if the credential is valid for 60 minutes, then it would be wise to return `true` when the credential is only valid for 5 minutes or less. That ensures the credential will not expire as it is passed around backend services. #### Declaration --- # DataDecoder Protocol Reference DataDecoder =========== Any type which can decode `Data` into a `Decodable` type. * `[decode(_:from:)](#/s:9Alamofire11DataDecoderP6decode_4fromqd__qd__m_10Foundation0B0VtKSeRd__lF) ` Decode `Data` into the provided type. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | The `Type` to be decoded. | | `_data_` | The `Data` to be decoded. | #### Return Value The decoded value of type `D`. --- # DataPreprocessor Protocol Reference DataPreprocessor ================ Type used to preprocess `Data` before it handled by a serializer. * `[preprocess(_:)](#/s:9Alamofire16DataPreprocessorP10preprocessy10Foundation0B0VAGKF) ` Process `Data` before it’s handled by a serializer. #### Declaration #### Parameters | | | | --- | --- | | `_data_` | The raw `Data` to process. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60PassthroughPreprocessor%60) ### Available where `Self` == `[PassthroughPreprocessor](../Structs/PassthroughPreprocessor.html) ` * `[passthrough](#/s:9Alamofire16DataPreprocessorPA2A011PassthroughC0VRszrlE11passthroughAEvpZ)` Extension method Provides a `[PassthroughPreprocessor](../Structs/PassthroughPreprocessor.html) ` instance. #### Declaration [](#/Available%20where%20%60Self%60%20%3D%3D%20%60GoogleXSSIPreprocessor%60) ### Available where `Self` == `[GoogleXSSIPreprocessor](../Structs/GoogleXSSIPreprocessor.html) ` * `[googleXSSI](#/s:9Alamofire16DataPreprocessorPA2A22GoogleXSSIPreprocessorVRszrlE10googleXSSIAEvpZ)` Extension method Provides a `[GoogleXSSIPreprocessor](../Structs/GoogleXSSIPreprocessor.html) ` instance. #### Declaration --- # DataResponseSerializerProtocol Protocol Reference DataResponseSerializerProtocol ============================== The type to which all data response serializers must conform in order to serialize a response. * `[SerializedObject](#/s:9Alamofire30DataResponseSerializerProtocolP16SerializedObjectQa) ` The type of serialized object to be created. #### Declaration * `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) ` Serialize the response `Data` into the provided type. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `URLRequest` which was used to perform the request, if any. | | `_response_` | `HTTPURLResponse` received from the server, if any. | | `_data_` | `Data` returned from the server, if any. | | `_error_` | `Error` produced by Alamofire or the underlying `URLSession` during the request. | #### Return Value The `[SerializedObject](../Protocols/DataResponseSerializerProtocol.html#/s:9Alamofire30DataResponseSerializerProtocolP16SerializedObjectQa) `. --- # DownloadResponseSerializerProtocol Protocol Reference DownloadResponseSerializerProtocol ================================== The type to which all download response serializers must conform in order to serialize a response. * `[SerializedObject](#/s:9Alamofire34DownloadResponseSerializerProtocolP16SerializedObjectQa) ` The type of serialized object to be created. #### Declaration * `[serializeDownload(request:response:fileURL:error:)](#/s:9Alamofire34DownloadResponseSerializerProtocolP09serializeB07request8response7fileURL5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0J0VSgs5Error_pSgtKF) ` Serialize the downloaded response `Data` from disk into the provided type. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `URLRequest` which was used to perform the request, if any. | | `_response_` | `HTTPURLResponse` received from the server, if any. | | `_fileURL_` | File `URL` to which the response data was downloaded. | | `_error_` | `Error` produced by Alamofire or the underlying `URLSession` during the request. | #### Return Value The `[SerializedObject](../Protocols/DownloadResponseSerializerProtocol.html#/s:9Alamofire34DownloadResponseSerializerProtocolP16SerializedObjectQa) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60URLResponseSerializer%60) ### Available where `Self` == `[URLResponseSerializer](../Structs/URLResponseSerializer.html) ` * `[url](#/s:9Alamofire34DownloadResponseSerializerProtocolPA2A011URLResponseD0VRszrlE3urlAEvpZ)` Extension method Provides a `[URLResponseSerializer](../Structs/URLResponseSerializer.html) ` instance. #### Declaration --- # ParameterEncoder Protocol Reference ParameterEncoder ================ A type that can encode any `Encodable` type into a `URLRequest`. * `[encode(_:into:)](#/s:9Alamofire16ParameterEncoderP6encode_4into10Foundation10URLRequestVqd__Sg_AHtKSERd__s8SendableRd__lF) ` Encode the provided `Encodable` parameters into `request`. #### Declaration #### Parameters | | | | --- | --- | | `_parameters_` | The `Encodable` parameter value. | | `_request_` | The `URLRequest` into which to encode the parameters. | #### Return Value A `URLRequest` with the result of the encoding. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60JSONParameterEncoder%60) ### Available where `Self` == `[JSONParameterEncoder](../Classes/JSONParameterEncoder.html) ` * `[json](#/s:9Alamofire16ParameterEncoderPA2A013JSONParameterC0CRszrlE4jsonAEvpZ)` Extension method Provides a default `[JSONParameterEncoder](../Classes/JSONParameterEncoder.html) ` instance. #### Declaration * `[json(encoder:)](#/s:9Alamofire16ParameterEncoderPA2A013JSONParameterC0CRszrlE4json7encoderAE10Foundation11JSONEncoderC_tFZ)` Extension method Creates a `[JSONParameterEncoder](../Classes/JSONParameterEncoder.html) ` using the provided `JSONEncoder`. #### Declaration #### Parameters | | | | --- | --- | | `_encoder_` | `JSONEncoder` used to encode parameters. `JSONEncoder()` by default. | #### Return Value The `[JSONParameterEncoder](../Classes/JSONParameterEncoder.html) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60URLEncodedFormParameterEncoder%60) ### Available where `Self` == `[URLEncodedFormParameterEncoder](../Classes/URLEncodedFormParameterEncoder.html) ` * `[urlEncodedForm](#/s:9Alamofire16ParameterEncoderPA2A014URLEncodedFormbC0CRszrlE010urlEncodedE0AEvpZ)` Extension method Provides a default `[URLEncodedFormParameterEncoder](../Classes/URLEncodedFormParameterEncoder.html) ` instance. #### Declaration * `[urlEncodedForm(encoder:destination:)](#/s:9Alamofire16ParameterEncoderPA2A014URLEncodedFormbC0CRszrlE010urlEncodedE07encoder11destinationAeA0deC0C_AE11DestinationOtFZ)` Extension method Creates a `[URLEncodedFormParameterEncoder](../Classes/URLEncodedFormParameterEncoder.html) ` with the provided encoder and destination. #### Declaration #### Parameters | | | | --- | --- | | `_encoder_` | `[URLEncodedFormEncoder](../Classes/URLEncodedFormEncoder.html) ` used to encode the parameters. `URLEncodedFormEncoder()` by default. | | `_destination_` | `Destination` to which to encode the parameters. `.methodDependent` by default. | #### Return Value The `[URLEncodedFormParameterEncoder](../Classes/URLEncodedFormParameterEncoder.html) `. --- # DataStreamSerializer Protocol Reference DataStreamSerializer ==================== A type which can serialize incoming `Data`. * `[SerializedObject](#/s:9Alamofire20DataStreamSerializerP16SerializedObjectQa) ` Type produced from the serialized `Data`. #### Declaration * `[serialize(_:)](#/s:9Alamofire20DataStreamSerializerP9serializey16SerializedObjectQz10Foundation0B0VKF) ` Serializes incoming `Data` into a `[SerializedObject](../Protocols/DataStreamSerializer.html#/s:9Alamofire20DataStreamSerializerP16SerializedObjectQa) ` value. #### Declaration #### Parameters | | | | --- | --- | | `_data_` | `Data` to be serialized. | [](#/Serialization) ### Serialization * `[decodable(of:decoder:dataPreprocessor:)](#/s:9Alamofire20DataStreamSerializerPAAE9decodable2of7decoder16dataPreprocessorAA09DecodablecD0Vyqd__Gqd__m_AA0B7Decoder_pAA0bI0_ptAJRszSeRd__s8SendableRd__lFZ)` Extension method Creates a `[DecodableStreamSerializer](../Structs/DecodableStreamSerializer.html) ` instance with the provided `[DataDecoder](../Protocols/DataDecoder.html) ` and `[DataPreprocessor](../Protocols/DataPreprocessor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to decode from stream data. | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` used to decode incoming `Data`. `JSONDecoder()` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to process incoming `Data` before it’s passed through the `decoder`. `PassthroughPreprocessor()` by default. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60PassthroughStreamSerializer%60) ### Available where `Self` == `[PassthroughStreamSerializer](../Structs/PassthroughStreamSerializer.html) ` * `[passthrough](#/s:9Alamofire20DataStreamSerializerPA2A011PassthroughcD0VRszrlE11passthroughAEvpZ)` Extension method Provides a `[PassthroughStreamSerializer](../Structs/PassthroughStreamSerializer.html) ` instance. #### Declaration [](#/Available%20where%20%60Self%60%20%3D%3D%20%60StringStreamSerializer%60) ### Available where `Self` == `[StringStreamSerializer](../Structs/StringStreamSerializer.html) ` * `[string](#/s:9Alamofire20DataStreamSerializerPA2A06StringcD0VRszrlE6stringAEvpZ)` Extension method Provides a `[StringStreamSerializer](../Structs/StringStreamSerializer.html) ` instance. #### Declaration --- # ParameterEncoding Protocol Reference ParameterEncoding ================= A type used to define how a set of parameters are applied to a `URLRequest`. * `[encode(_:with:)](#/s:9Alamofire17ParameterEncodingP6encode_4with10Foundation10URLRequestVAA0G11Convertible_p_SDySSs8Sendable_pGSgtKF) ` Creates a `URLRequest` by encoding parameters and applying them on the passed request. #### Declaration #### Parameters | | | | --- | --- | | `_urlRequest_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value onto which parameters will be encoded. | | `_parameters_` | `[Parameters](../Typealiases.html#/s:9Alamofire10Parametersa) ` to encode onto the request. | #### Return Value The encoded `URLRequest`. --- # EmptyResponse Protocol Reference EmptyResponse ============= Protocol representing an empty response. Use `T.emptyValue()` to get an instance. * `[emptyValue()](#/s:9Alamofire13EmptyResponseP10emptyValuexyFZ) ` Empty value for the conforming type. #### Declaration #### Return Value Value of `Self` to use for empty values. --- # EventMonitor Protocol Reference EventMonitor ============ Protocol outlining the lifetime events inside Alamofire. It includes both events received from the various `URLSession` delegate protocols as well as various events from the lifetime of `[Request](../Classes/Request.html) ` and its subclasses. * `[queue](#/s:9Alamofire12EventMonitorP5queueSo012OS_dispatch_D0Cvp)` Default implementation The `DispatchQueue` onto which Alamofire’s root `[CompositeEventMonitor](../Classes/CompositeEventMonitor.html) ` will dispatch events. `.main` by default. #### Default Implementation The default queue on which `CompositeEventMonitor`s will call the `EventMonitor` methods. `.main` by default. #### Declaration [](#/URLSessionDelegate%20Events) ### URLSessionDelegate Events * `[urlSession(_:didBecomeInvalidWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF)` Default implementation Event called during `URLSessionDelegate`‘s `urlSession(_:didBecomeInvalidWithError:)` method. #### Default Implementation #### Declaration [](#/URLSessionTaskDelegate%20Events) ### URLSessionTaskDelegate Events * `[urlSession(_:task:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_4task10didReceiveySo12NSURLSessionC_So0I4TaskCSo28NSURLAuthenticationChallengeCtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:task:didReceive:completionHandler:)` method. #### Default Implementation #### Declaration * `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` method. #### Default Implementation #### Declaration * `[urlSession(_:taskNeedsNewBodyStream:)](#/s:9Alamofire12EventMonitorP10urlSession_22taskNeedsNewBodyStreamySo12NSURLSessionC_So0K4TaskCtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:task:needNewBodyStream:)` method. #### Default Implementation #### Declaration * `[urlSession(_:task:willPerformHTTPRedirection:newRequest:)](#/s:9Alamofire12EventMonitorP10urlSession_4task26willPerformHTTPRedirection10newRequestySo12NSURLSessionC_So0L4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` method. #### Default Implementation #### Declaration * `[urlSession(_:task:didFinishCollecting:)](#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:task:didFinishCollecting:)` method. #### Default Implementation #### Declaration * `[urlSession(_:task:didCompleteWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:task:didCompleteWithError:)` method. #### Default Implementation #### Declaration * `[urlSession(_:taskIsWaitingForConnectivity:)](#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF)` Default implementation Event called during `URLSessionTaskDelegate`‘s `urlSession(_:taskIsWaitingForConnectivity:)` method. #### Default Implementation #### Declaration [](#/URLSessionDataDelegate%20Events) ### URLSessionDataDelegate Events * `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF)` Default implementation Event called during `URLSessionDataDelegate`‘s `urlSession(_:dataTask:didReceive:completionHandler:)` method. #### Default Implementation Undocumented #### Declaration * `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0C10Foundation0K0VtF) ` Event called during `URLSessionDataDelegate`‘s `[urlSession(_:dataTask:didReceive:)](../Protocols/EventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) ` method. #### Declaration * `[urlSession(_:dataTask:willCacheResponse:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask17willCacheResponseySo12NSURLSessionC_So0k4DataG0CSo19NSCachedURLResponseCtF)` Default implementation Event called during `URLSessionDataDelegate`‘s `urlSession(_:dataTask:willCacheResponse:completionHandler:)` method. #### Default Implementation #### Declaration [](#/URLSessionDownloadDelegate%20Events) ### URLSessionDownloadDelegate Events * `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF)` Default implementation Event called during `URLSessionDownloadDelegate`‘s `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` method. #### Default Implementation #### Declaration * `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF)` Default implementation Event called during `URLSessionDownloadDelegate`‘s `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)` method. #### Default Implementation #### Declaration * `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF)` Default implementation Event called during `URLSessionDownloadDelegate`‘s `urlSession(_:downloadTask:didFinishDownloadingTo:)` method. #### Default Implementation #### Declaration [](#/Request%20Events) ### Request Events * `[request(_:didCreateInitialURLRequest:)](#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF)` Default implementation Event called when a `URLRequest` is first created for a `[Request](../Classes/Request.html) `. If a `[RequestAdapter](../Protocols/RequestAdapter.html) ` is active, the `URLRequest` will be adapted before being issued. #### Default Implementation #### Declaration * `[request(_:didFailToCreateURLRequestWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF)` Default implementation Event called when the attempt to create a `URLRequest` from a `[Request](../Classes/Request.html) `‘s original `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value fails. #### Default Implementation #### Declaration * `[request(_:didAdaptInitialRequest:to:)](#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF)` Default implementation Event called when a `[RequestAdapter](../Protocols/RequestAdapter.html) ` adapts the `[Request](../Classes/Request.html) `‘s initial `URLRequest`. #### Default Implementation #### Declaration * `[request(_:didFailToAdaptURLRequest:withError:)](#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF)` Default implementation Event called when a `[RequestAdapter](../Protocols/RequestAdapter.html) ` fails to adapt the `[Request](../Classes/Request.html) `‘s initial `URLRequest`. #### Default Implementation #### Declaration * `[request(_:didCreateURLRequest:)](#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF)` Default implementation Event called when a final `URLRequest` is created for a `[Request](../Classes/Request.html) `. #### Default Implementation #### Declaration * `[request(_:didCreateTask:)](#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF)` Default implementation Event called when a `URLSessionTask` subclass instance is created for a `[Request](../Classes/Request.html) `. #### Default Implementation #### Declaration * `[request(_:didGatherMetrics:)](#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` receives a `URLSessionTaskMetrics` value. #### Default Implementation #### Declaration * `[request(_:didFailTask:earlyWithError:)](#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` fails due to an error created by Alamofire. e.g. When certificate pinning fails. #### Default Implementation #### Declaration * `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF)` Default implementation Event called when a `[Request](../Classes/Request.html) `‘s task completes, possibly with an error. A `[Request](../Classes/Request.html) ` may receive this event multiple times if it is retried. #### Default Implementation #### Declaration * `[requestIsRetrying(_:)](#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` is about to be retried. #### Default Implementation #### Declaration * `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` finishes and response serializers are being called. #### Default Implementation #### Declaration * `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` receives a `resume` call. #### Default Implementation #### Declaration * `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF)` Default implementation Event called when a `[Request](../Classes/Request.html) `‘s associated `URLSessionTask` is resumed. #### Default Implementation #### Declaration * `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` receives a `suspend` call. #### Default Implementation #### Declaration * `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF)` Default implementation Event called when a `[Request](../Classes/Request.html) `‘s associated `URLSessionTask` is suspended. #### Default Implementation #### Declaration * `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF)` Default implementation Event called when a `[Request](../Classes/Request.html) ` receives a `cancel` call. #### Default Implementation #### Declaration * `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF)` Default implementation Event called when a `[Request](../Classes/Request.html) `‘s associated `URLSessionTask` is cancelled. #### Default Implementation #### Declaration [](#/DataRequest%20Events) ### DataRequest Events * `[request(_:didValidateRequest:response:data:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF)` Default implementation Event called when a `[DataRequest](../Classes/DataRequest.html) ` calls a `Validation`. #### Default Implementation #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF)` Default implementation Event called when a `[DataRequest](../Classes/DataRequest.html) ` creates a `[DataResponse](../Structs/DataResponse.html) ` value without calling a `[ResponseSerializer](../Protocols/ResponseSerializer.html) `. #### Default Implementation Undocumented #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vyqd__AA7AFErrorOGts8SendableRd__lF) ` Event called when a `[DataRequest](../Classes/DataRequest.html) ` calls a `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` and creates a generic `DataResponse`. #### Declaration [](#/DataStreamRequest%20Events) ### DataStreamRequest Events * `[request(_:didValidateRequest:response:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF)` Default implementation Event called when a `[DataStreamRequest](../Classes/DataStreamRequest.html) ` calls a `Validation` closure. #### Default Implementation #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DataStreamRequest](../Classes/DataStreamRequest.html) ` which is calling the `Validation`. | | `_urlRequest_` | `URLRequest` of the request being validated. | | `_response_` | `HTTPURLResponse` of the request being validated. | | `_result_` | Produced `ValidationResult`. | * `[request(_:didParseStream:)](#/s:9Alamofire12EventMonitorP7request_14didParseStreamyAA04DataG7RequestC_s6ResultOyqd__AA7AFErrorOGts8SendableRd__lF)` Default implementation Event called when a `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` produces a value from streamed `Data`. #### Default Implementation #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DataStreamRequest](../Classes/DataStreamRequest.html) ` for which the value was serialized. | | `_result_` | `Result` of the serialization attempt. | [](#/UploadRequest%20Events) ### UploadRequest Events * `[request(_:didCreateUploadable:)](#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF)` Default implementation Event called when an `[UploadRequest](../Classes/UploadRequest.html) ` creates its `Uploadable` value, indicating the type of upload it represents. #### Default Implementation #### Declaration * `[request(_:didFailToCreateUploadableWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF)` Default implementation Event called when an `[UploadRequest](../Classes/UploadRequest.html) ` failed to create its `Uploadable` value due to an error. #### Default Implementation #### Declaration * `[request(_:didProvideInputStream:)](#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF)` Default implementation Event called when an `[UploadRequest](../Classes/UploadRequest.html) ` provides the `InputStream` from its `Uploadable` value. This only occurs if the `InputStream` does not wrap a `Data` value or file `URL`. #### Default Implementation #### Declaration [](#/DownloadRequest%20Events) ### DownloadRequest Events * `[request(_:didFinishDownloadingUsing:with:)](#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF)` Default implementation Event called when a `[DownloadRequest](../Classes/DownloadRequest.html) `‘s `URLSessionDownloadTask` finishes and the temporary file has been moved. #### Default Implementation #### Declaration * `[request(_:didCreateDestinationURL:)](#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF)` Default implementation Event called when a `[DownloadRequest](../Classes/DownloadRequest.html) `‘s `Destination` closure is called and creates the destination URL the downloaded file will be moved to. #### Default Implementation #### Declaration * `[request(_:didValidateRequest:response:fileURL:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response7fileURL10withResultyAA08DownloadG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0J0VSgs0L0Oyyts5Error_pGtF)` Default implementation Event called when a `[DownloadRequest](../Classes/DownloadRequest.html) ` calls a `Validation`. #### Default Implementation #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vy10Foundation3URLVSgAA7AFErrorOGtF) ` Event called when a `[DownloadRequest](../Classes/DownloadRequest.html) ` creates a `DownloadResponse` without calling a `[ResponseSerializer](../Protocols/ResponseSerializer.html) `. #### Declaration * `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vyqd__AA7AFErrorOGts8SendableRd__lF) ` Event called when a `[DownloadRequest](../Classes/DownloadRequest.html) ` calls a `DownloadResponseSerializer` and creates a generic `DownloadResponse` #### Declaration --- # RedirectHandler Protocol Reference RedirectHandler =============== A type that handles how an HTTP redirect response from a remote server should be redirected to the new request. * `[task(_:willBeRedirectedTo:for:completion:)](#/s:9Alamofire15RedirectHandlerP4task_18willBeRedirectedTo3for10completionySo16NSURLSessionTaskC_10Foundation10URLRequestVSo17NSHTTPURLResponseCyALSgctF) ` Determines how the HTTP redirect response should be redirected to the new request. The `completion` closure should be passed one of three possible options: 1. The new request specified by the redirect (this is the most common use case). 2. A modified version of the new request (you may want to route it somewhere else). 3. A `nil` value to deny the redirect request and return the body of the redirect response. #### Declaration #### Parameters | | | | --- | --- | | `_task_` | The `URLSessionTask` whose request resulted in a redirect. | | `_request_` | The `URLRequest` to the new location specified by the redirect response. | | `_response_` | The `HTTPURLResponse` containing the server’s response to the original request. | | `_completion_` | The closure to execute containing the new `URLRequest`, a modified `URLRequest`, or `nil`. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60Redirector%60) ### Available where `Self` == `[Redirector](../Structs/Redirector.html) ` * `[follow](#/s:9Alamofire15RedirectHandlerPA2A10RedirectorVRszrlE6followAEvpZ)` Extension method Provides a `[Redirector](../Structs/Redirector.html) ` which follows redirects. Equivalent to `[Redirector.follow](../Structs/Redirector.html#/s:9Alamofire10RedirectorV6followACvpZ) `. #### Declaration * `[doNotFollow](#/s:9Alamofire15RedirectHandlerPA2A10RedirectorVRszrlE11doNotFollowAEvpZ)` Extension method Provides a `[Redirector](../Structs/Redirector.html) ` which does not follow redirects. Equivalent to `[Redirector.doNotFollow](../Structs/Redirector.html#/s:9Alamofire10RedirectorV11doNotFollowACvpZ) `. #### Declaration * `[modify(using:)](#/s:9Alamofire15RedirectHandlerPA2A10RedirectorVRszrlE6modify5usingAE10Foundation10URLRequestVSgSo16NSURLSessionTaskC_AJSo17NSHTTPURLResponseCtYbc_tFZ)` Extension method Creates a `[Redirector](../Structs/Redirector.html) ` which modifies the redirected `URLRequest` using the provided closure. #### Declaration #### Parameters | | | | --- | --- | | `_closure_` | Closure used to modify the redirect. | #### Return Value The `[Redirector](../Structs/Redirector.html) `. --- # RequestRetrier Protocol Reference RequestRetrier ============== A type that determines whether a request should be retried after being executed by the specified session manager and encountering an error. * `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) ` Determines whether the `[Request](../Classes/Request.html) ` should be retried by calling the `completion` closure. This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs to be retried. The one requirement is that the completion closure is called to ensure the request is properly cleaned up after. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[Request](../Classes/Request.html) ` that failed due to the provided `Error`. | | `_session_` | `[Session](../Classes/Session.html) ` that produced the `[Request](../Classes/Request.html) `. | | `_error_` | `Error` encountered while executing the `[Request](../Classes/Request.html) `. | | `_completion_` | Completion closure to be executed when a retry decision has been determined. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60Retrier%60) ### Available where `Self` == `[Retrier](../Classes/Retrier.html) ` * `[retrier(using:)](#/s:9Alamofire14RequestRetrierPA2A0C0CRszrlE7retrier5usingAEyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOctc_tFZ)` Extension method Creates a `[Retrier](../Classes/Retrier.html) ` using the provided `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closure. #### Declaration #### Parameters | | | | --- | --- | | `_closure_` | `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` to use to retry the request. | #### Return Value The `[Retrier](../Classes/Retrier.html) `. --- # RequestAdapter Protocol Reference RequestAdapter ============== A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary. * `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) ` Inspects and adapts the specified `URLRequest` in some manner and calls the completion handler with the Result. #### Declaration #### Parameters | | | | --- | --- | | `_urlRequest_` | The `URLRequest` to adapt. | | `_session_` | The `[Session](../Classes/Session.html) ` that will execute the `URLRequest`. | | `_completion_` | The completion handler that must be called when adaptation is complete. | * `[adapt(_:using:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_5using10completiony10Foundation10URLRequestV_AA0bC5StateVys6ResultOyAIs5Error_pGYbctF)` Default implementation Inspects and adapts the specified `URLRequest` in some manner and calls the completion handler with the Result. #### Default Implementation #### Declaration #### Parameters | | | | --- | --- | | `_urlRequest_` | The `URLRequest` to adapt. | | `_state_` | The `[RequestAdapterState](../Structs/RequestAdapterState.html) ` associated with the `URLRequest`. | | `_completion_` | The completion handler that must be called when adaptation is complete. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60Adapter%60) ### Available where `Self` == `[Adapter](../Classes/Adapter.html) ` * `[adapter(using:)](#/s:9Alamofire14RequestAdapterPA2A0C0CRszrlE7adapter5usingAEy10Foundation10URLRequestV_AA7SessionCys6ResultOyAJs5Error_pGctc_tFZ)` Extension method Creates an `[Adapter](../Classes/Adapter.html) ` using the provided `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` closure. #### Declaration #### Parameters | | | | --- | --- | | `_closure_` | `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` to use to adapt the request. | #### Return Value The `[Adapter](../Classes/Adapter.html) `. --- # URLConvertible Protocol Reference URLConvertible ============== Types adopting the `URLConvertible` protocol can be used to construct `URL`s, which can then be used to construct `URLRequest`s. * `[asURL()](#/s:9Alamofire14URLConvertibleP5asURL10Foundation0D0VyKF) ` Returns a `URL` from the conforming instance or throws. #### Declaration #### Return Value The `URL` created from the instance. --- # ResponseSerializer Protocol Reference ResponseSerializer ================== A serializer that can handle both data and download responses. * `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp)` Default implementation `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare incoming `Data` for serialization. #### Default Implementation #### Declaration * `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp)` Default implementation `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty response bodies are considered appropriate. #### Default Implementation #### Declaration * `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp)` Default implementation HTTP response codes for which empty response bodies are considered appropriate. #### Default Implementation #### Declaration * `[defaultDataPreprocessor](#/s:9Alamofire18ResponseSerializerPAAE23defaultDataPreprocessorAA0eF0_pvpZ)` Extension method Default `[DataPreprocessor](../Protocols/DataPreprocessor.html) `. `[PassthroughPreprocessor](../Structs/PassthroughPreprocessor.html) ` by default. #### Declaration * `[defaultEmptyRequestMethods](#/s:9Alamofire18ResponseSerializerPAAE26defaultEmptyRequestMethodsShyAA10HTTPMethodVGvpZ)` Extension method Default `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty response bodies are always considered appropriate. `[.head]` by default. #### Declaration * `[defaultEmptyResponseCodes](#/s:9Alamofire18ResponseSerializerPAAE012defaultEmptyB5CodesShySiGvpZ)` Extension method HTTP response codes for which empty response bodies are always considered appropriate. `[204, 205]` by default. #### Declaration * `[requestAllowsEmptyResponseData(_:)](#/s:9Alamofire18ResponseSerializerPAAE018requestAllowsEmptyB4DataySbSg10Foundation10URLRequestVSgF)` Extension method Determines whether the `request` allows empty response bodies, if `request` exists. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `URLRequest` to evaluate. | #### Return Value `Bool` representing the outcome of the evaluation, or `nil` if `request` was `nil`. * `[responseAllowsEmptyResponseData(_:)](#/s:9Alamofire18ResponseSerializerPAAE019responseAllowsEmptyB4DataySbSgSo17NSHTTPURLResponseCSgF)` Extension method Determines whether the `response` allows empty response bodies, if `response` exists. #### Declaration #### Parameters | | | | --- | --- | | `_response_` | `HTTPURLResponse` to evaluate. | #### Return Value `Bool` representing the outcome of the evaluation, or `nil` if `response` was `nil`. * `[emptyResponseAllowed(forRequest:response:)](#/s:9Alamofire18ResponseSerializerPAAE05emptyB7Allowed10forRequest8responseSb10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgtF)` Extension method Determines whether `request` and `response` allow empty response bodies. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `URLRequest` to evaluate. | | `_response_` | `HTTPURLResponse` to evaluate. | #### Return Value `true` if `request` or `response` allow empty bodies, `false` otherwise. [](#/Decodable) ### Decodable * `[decodable(of:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire18ResponseSerializerPAAE9decodable2of16dataPreprocessor7decoder05emptyB5Codes0I14RequestMethodsAA09DecodablebC0Cyqd__Gqd__m_AA04DataG0_pAA0N7Decoder_pShySiGShyAA10HTTPMethodVGtALRszSeRd__s8SendableRd__lFZ)` Extension method Creates a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` using the values provided. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to decode from response data. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_decoder_` | The `[DataDecoder](../Protocols/DataDecoder.html) `. `JSONDecoder()` by default. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | #### Return Value The `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60DataResponseSerializer%60) ### Available where `Self` == `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` * `[data](#/s:9Alamofire18ResponseSerializerPA2A04DatabC0CRszrlE4dataAEvpZ)` Extension method Provides a default `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` instance. #### Declaration * `[data(dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire18ResponseSerializerPA2A04DatabC0CRszrlE4data0E12Preprocessor05emptyB5Codes0G14RequestMethodsAeA0dF0_p_ShySiGShyAA10HTTPMethodVGtFZ)` Extension method Creates a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` using the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | #### Return Value The `[DataResponseSerializer](../Classes/DataResponseSerializer.html) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60StringResponseSerializer%60) ### Available where `Self` == `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` * `[string](#/s:9Alamofire18ResponseSerializerPA2A06StringbC0CRszrlE6stringAEvpZ)` Extension method Provides a default `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` instance. #### Declaration * `[string(dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire18ResponseSerializerPA2A06StringbC0CRszrlE6string16dataPreprocessor8encoding05emptyB5Codes0I14RequestMethodsAeA04DataG0_p_SS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtFZ)` Extension method Creates a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` with the provided values. #### Declaration #### Parameters | | | | --- | --- | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. | | `_encoding_` | A string encoding. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. | | `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. | | `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. | #### Return Value The `[StringResponseSerializer](../Classes/StringResponseSerializer.html) `. --- # URLRequestConvertible Protocol Reference URLRequestConvertible ===================== Types adopting the `URLRequestConvertible` protocol can be used to safely construct `URLRequest`s. * `[asURLRequest()](#/s:9Alamofire21URLRequestConvertibleP02asB010Foundation0B0VyKF) ` Returns a `URLRequest` or throws if an `Error` was encountered. #### Declaration #### Return Value A `URLRequest`. * `[urlRequest](#/s:9Alamofire21URLRequestConvertiblePAAE10urlRequest10Foundation0B0VSgvp)` Extension method The `URLRequest` returned by discarding any `Error` encountered. #### Declaration --- # RequestDelegate Protocol Reference RequestDelegate =============== Protocol abstraction for `[Request](../Classes/Request.html) `‘s communication back to the `[SessionDelegate](../Classes/SessionDelegate.html) `. * `[sessionConfiguration](#/s:9Alamofire15RequestDelegateP20sessionConfigurationSo012NSURLSessionE0Cvp) ` `URLSessionConfiguration` used to create the underlying `URLSessionTask`s. #### Declaration * `[startImmediately](#/s:9Alamofire15RequestDelegateP16startImmediatelySbvp) ` Determines whether the `[Request](../Classes/Request.html) ` should automatically call `resume()` when adding the first response handler. #### Declaration * `[cleanup(after:)](#/s:9Alamofire15RequestDelegateP7cleanup5afteryAA0B0C_tF) ` Notifies the delegate the `[Request](../Classes/Request.html) ` has reached a point where it needs cleanup. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | The `[Request](../Classes/Request.html) ` to cleanup after. | * `[retryResult(for:dueTo:completion:)](#/s:9Alamofire15RequestDelegateP11retryResult3for5dueTo10completionyAA0B0C_AA7AFErrorOyAA05RetryE0OYbctF) ` Asynchronously ask the delegate whether a `[Request](../Classes/Request.html) ` will be retried. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[Request](../Classes/Request.html) ` which failed. | | `_error_` | `Error` which produced the failure. | | `_completion_` | Closure taking the `[RetryResult](../Enums/RetryResult.html) ` for evaluation. | * `[retryRequest(_:withDelay:)](#/s:9Alamofire15RequestDelegateP05retryB0_9withDelayyAA0B0C_SdSgtF) ` Asynchronously retry the `[Request](../Classes/Request.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[Request](../Classes/Request.html) ` which will be retried. | | `_timeDelay_` | `TimeInterval` after which the retry will be triggered. | --- # UploadableConvertible Protocol Reference UploadableConvertible ===================== A type that can produce an `[UploadRequest.Uploadable](../Classes/UploadRequest/Uploadable.html) ` value. * `[createUploadable()](#/s:9Alamofire21UploadableConvertibleP06createB0AA13UploadRequestC0B0OyKF) ` Produces an `[UploadRequest.Uploadable](../Classes/UploadRequest/Uploadable.html) ` value from the instance. #### Declaration #### Return Value The `[UploadRequest.Uploadable](../Classes/UploadRequest/Uploadable.html) `. --- # ServerTrustEvaluating Protocol Reference ServerTrustEvaluating ===================== A protocol describing the API used to evaluate server trusts. * `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) ` Evaluates the given `SecTrust` value for the given `host`. #### Declaration #### Parameters | | | | --- | --- | | `_trust_` | The `SecTrust` value to evaluate. | | `_host_` | The host for which to evaluate the `SecTrust` value. | #### Return Value A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60RevocationTrustEvaluator%60) ### Available where `Self` == `[RevocationTrustEvaluator](../Classes/RevocationTrustEvaluator.html) ` * `[revocationChecking](#/s:9Alamofire21ServerTrustEvaluatingPA2A010RevocationC9EvaluatorCRszrlE18revocationCheckingAEvpZ)` Extension method Provides a default `[RevocationTrustEvaluator](../Classes/RevocationTrustEvaluator.html) ` instance. #### Declaration * `[revocationChecking(performDefaultValidation:validateHost:options:)](#/s:9Alamofire21ServerTrustEvaluatingPA2A010RevocationC9EvaluatorCRszrlE18revocationChecking24performDefaultValidation12validateHost7optionsAESb_SbAE7OptionsVtFZ)` Extension method Creates a `[RevocationTrustEvaluator](../Classes/RevocationTrustEvaluator.html) ` using the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. | | `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. | | `_options_` | The `Options` to use to check the revocation status of the certificate. `.any` by default. | #### Return Value The `[RevocationTrustEvaluator](../Classes/RevocationTrustEvaluator.html) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60PinnedCertificatesTrustEvaluator%60) ### Available where `Self` == `[PinnedCertificatesTrustEvaluator](../Classes/PinnedCertificatesTrustEvaluator.html) ` * `[pinnedCertificates](#/s:9Alamofire21ServerTrustEvaluatingPA2A018PinnedCertificatesC9EvaluatorCRszrlE06pinnedF0AEvpZ)` Extension method Provides a default `[PinnedCertificatesTrustEvaluator](../Classes/PinnedCertificatesTrustEvaluator.html) ` instance. #### Declaration * `[pinnedCertificates(certificates:acceptSelfSignedCertificates:performDefaultValidation:validateHost:)](#/s:9Alamofire21ServerTrustEvaluatingPA2A018PinnedCertificatesC9EvaluatorCRszrlE06pinnedF012certificates016acceptSelfSignedF024performDefaultValidation12validateHostAESaySo17SecCertificateRefaG_S3btFZ)` Extension method Creates a `[PinnedCertificatesTrustEvaluator](../Classes/PinnedCertificatesTrustEvaluator.html) ` using the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_certificates_` | The certificates to use to evaluate the trust. All `cer`, `crt`, and `der` certificates in `Bundle.main` by default. | | `_acceptSelfSignedCertificates_` | Adds the provided certificates as anchors for the trust evaluation, allowing self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE FALSE IN PRODUCTION! | | `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. | | `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60PublicKeysTrustEvaluator%60) ### Available where `Self` == `[PublicKeysTrustEvaluator](../Classes/PublicKeysTrustEvaluator.html) ` * `[publicKeys](#/s:9Alamofire21ServerTrustEvaluatingPA2A010PublicKeysC9EvaluatorCRszrlE06publicF0AEvpZ)` Extension method Provides a default `[PublicKeysTrustEvaluator](../Classes/PublicKeysTrustEvaluator.html) ` instance. #### Declaration * `[publicKeys(keys:performDefaultValidation:validateHost:)](#/s:9Alamofire21ServerTrustEvaluatingPA2A010PublicKeysC9EvaluatorCRszrlE06publicF04keys24performDefaultValidation12validateHostAESaySo9SecKeyRefaG_S2btFZ)` Extension method Creates a `[PublicKeysTrustEvaluator](../Classes/PublicKeysTrustEvaluator.html) ` from the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_keys_` | The `SecKey`s to use to validate public keys. Defaults to the public keys of all certificates included in the main bundle. | | `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. | | `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. | [](#/Available%20where%20%60Self%60%20%3D%3D%20%60CompositeTrustEvaluator%60) ### Available where `Self` == `[CompositeTrustEvaluator](../Classes/CompositeTrustEvaluator.html) ` * `[composite(evaluators:)](#/s:9Alamofire21ServerTrustEvaluatingPA2A09CompositeC9EvaluatorCRszrlE9composite10evaluatorsAESayAaB_pG_tFZ)` Extension method Creates a `[CompositeTrustEvaluator](../Classes/CompositeTrustEvaluator.html) ` from the provided evaluators. #### Declaration #### Parameters | | | | --- | --- | | `_evaluators_` | The `ServerTrustEvaluating` values used to evaluate the server trust. | --- # RequestInterceptor Protocol Reference RequestInterceptor ================== Type that provides both `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` functionality. * `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF)` Extension method #### Declaration * `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF)` Extension method #### Declaration [](#/Available%20where%20%60Self%60%20%3D%3D%20%60DeflateRequestCompressor%60) ### Available where `Self` == `[DeflateRequestCompressor](../Structs/DeflateRequestCompressor.html) ` * `[deflateCompressor](#/s:9Alamofire18RequestInterceptorPA2A07DeflateB10CompressorVRszrlE07deflateE0AEvpZ)` Extension method Create a `[DeflateRequestCompressor](../Structs/DeflateRequestCompressor.html) ` with default `duplicateHeaderBehavior` and `shouldCompressBodyData` values. #### Declaration * `[deflateCompressor(duplicateHeaderBehavior:shouldCompressBodyData:)](#/s:9Alamofire18RequestInterceptorPA2A07DeflateB10CompressorVRszrlE07deflateE023duplicateHeaderBehavior22shouldCompressBodyDataA2E09DuplicatehI0O_Sb10Foundation0M0VYbctFZ)` Extension method Creates a `[DeflateRequestCompressor](../Structs/DeflateRequestCompressor.html) ` with the provided `DuplicateHeaderBehavior` and `shouldCompressBodyData` closure. #### Declaration #### Parameters | | | | --- | --- | | `_duplicateHeaderBehavior_` | `DuplicateHeaderBehavior` to use. | | `_shouldCompressBodyData_` | Closure which determines whether the outgoing body data should be compressed. `true` by default. | #### Return Value The `[DeflateRequestCompressor](../Structs/DeflateRequestCompressor.html) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60Interceptor%60) ### Available where `Self` == `[Interceptor](../Classes/Interceptor.html) ` * `[interceptor(adapter:retrier:)](#/s:9Alamofire18RequestInterceptorPA2A0C0CRszrlE11interceptor7adapter7retrierAEy10Foundation10URLRequestV_AA7SessionCys6ResultOyAKs5Error_pGctc_yAA0B0C_AMsAP_pyAA05RetryJ0OctctFZ)` Extension method Creates an `[Interceptor](../Classes/Interceptor.html) ` using the provided `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` and `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closures. #### Declaration #### Parameters | | | | --- | --- | | `_adapter_` | `AdapterHandler`to use to adapt the request. | | `_retrier_` | `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` to use to retry the request. | #### Return Value The `[Interceptor](../Classes/Interceptor.html) `. * `[interceptor(adapter:retrier:)](#/s:9Alamofire18RequestInterceptorPA2A0C0CRszrlE11interceptor7adapter7retrierAeA0B7Adapter_p_AA0B7Retrier_ptFZ)` Extension method Creates an `[Interceptor](../Classes/Interceptor.html) ` using the provided `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` instances. #### Declaration #### Parameters | | | | --- | --- | | `_adapter_` | `[RequestAdapter](../Protocols/RequestAdapter.html) ` to use to adapt the request | | `_retrier_` | `[RequestRetrier](../Protocols/RequestRetrier.html) ` to use to retry the request. | #### Return Value The `[Interceptor](../Classes/Interceptor.html) `. * `[interceptor(adapters:retriers:interceptors:)](#/s:9Alamofire18RequestInterceptorPA2A0C0CRszrlE11interceptor8adapters8retriers12interceptorsAESayAA0B7Adapter_pG_SayAA0B7Retrier_pGSayAaB_pGtFZ)` Extension method Creates an `[Interceptor](../Classes/Interceptor.html) ` using the provided `[RequestAdapter](../Protocols/RequestAdapter.html) `s, `[RequestRetrier](../Protocols/RequestRetrier.html) `s, and `RequestInterceptor`s. #### Declaration #### Parameters | | | | --- | --- | | `_adapters_` | `[RequestAdapter](../Protocols/RequestAdapter.html) `s to use to adapt the request. These adapters will be run until one fails. | | `_retriers_` | `[RequestRetrier](../Protocols/RequestRetrier.html) `s to use to retry the request. These retriers will be run one at a time until a retry is triggered. | | `_interceptors_` | `RequestInterceptor`s to use to intercept the request. | #### Return Value The `[Interceptor](../Classes/Interceptor.html) `. [](#/Available%20where%20%60Self%60%20%3D%3D%20%60RetryPolicy%60) ### Available where `Self` == `[RetryPolicy](../Classes/RetryPolicy.html) ` * `[retryPolicy](#/s:9Alamofire18RequestInterceptorPA2A11RetryPolicyCRszrlE05retryE0AEvpZ)` Extension method Provides a default `[RetryPolicy](../Classes/RetryPolicy.html) ` instance. #### Declaration * `[retryPolicy(retryLimit:exponentialBackoffBase:exponentialBackoffScale:retryableHTTPMethods:retryableHTTPStatusCodes:retryableURLErrorCodes:)](#/s:9Alamofire18RequestInterceptorPA2A11RetryPolicyCRszrlE05retryE00F5Limit22exponentialBackoffBase0hI5Scale20retryableHTTPMethods0L15HTTPStatusCodes0l8URLErrorO0AESu_SuSdShyAA10HTTPMethodVGShySiGShy10Foundation0P0V4CodeVGtFZ)` Extension method Creates an `[RetryPolicy](../Classes/RetryPolicy.html) ` from the specified parameters. #### Declaration #### Parameters | | | | --- | --- | | `_retryLimit_` | The total number of times the request is allowed to be retried. `2` by default. | | `_exponentialBackoffBase_` | The base of the exponential backoff policy. `2` by default. | | `_exponentialBackoffScale_` | The scale of the exponential backoff. `0.5` by default. | | `_retryableHTTPMethods_` | The HTTP methods that are allowed to be retried. `[RetryPolicy.defaultRetryableHTTPMethods](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) ` by default. | | `_retryableHTTPStatusCodes_` | The HTTP status codes that are automatically retried by the policy. `[RetryPolicy.defaultRetryableHTTPStatusCodes](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC31defaultRetryableHTTPStatusCodesShySiGvpZ) ` by default. | | `_retryableURLErrorCodes_` | The URL error codes that are automatically retried by the policy. `[RetryPolicy.defaultRetryableURLErrorCodes](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC29defaultRetryableURLErrorCodesShy10Foundation0F0V4CodeVGvpZ) ` by default. | #### Return Value The `[RetryPolicy](../Classes/RetryPolicy.html) ` [](#/Available%20where%20%60Self%60%20%3D%3D%20%60ConnectionLostRetryPolicy%60) ### Available where `Self` == `[ConnectionLostRetryPolicy](../Classes/ConnectionLostRetryPolicy.html) ` * `[connectionLostRetryPolicy](#/s:9Alamofire18RequestInterceptorPA2A25ConnectionLostRetryPolicyCRszrlE010connectionefG0AEvpZ)` Extension method Provides a default `[ConnectionLostRetryPolicy](../Classes/ConnectionLostRetryPolicy.html) ` instance. #### Declaration * `[connectionLostRetryPolicy(retryLimit:exponentialBackoffBase:exponentialBackoffScale:retryableHTTPMethods:)](#/s:9Alamofire18RequestInterceptorPA2A25ConnectionLostRetryPolicyCRszrlE010connectionefG010retryLimit22exponentialBackoffBase0kL5Scale20retryableHTTPMethodsAESu_SuSdShyAA10HTTPMethodVGtFZ)` Extension method Creates a `[ConnectionLostRetryPolicy](../Classes/ConnectionLostRetryPolicy.html) ` instance from the specified parameters. #### Declaration #### Parameters | | | | --- | --- | | `_retryLimit_` | The total number of times the request is allowed to be retried. `[RetryPolicy.defaultRetryLimit](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC07defaultB5LimitSuvpZ) ` by default. | | `_exponentialBackoffBase_` | The base of the exponential backoff policy. `[RetryPolicy.defaultExponentialBackoffBase](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC29defaultExponentialBackoffBaseSuvpZ) ` by default. | | `_exponentialBackoffScale_` | The scale of the exponential backoff. `[RetryPolicy.defaultExponentialBackoffScale](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC30defaultExponentialBackoffScaleSdvpZ) ` by default. | | `_retryableHTTPMethods_` | The idempotent http methods to retry. | #### Return Value The `[ConnectionLostRetryPolicy](../Classes/ConnectionLostRetryPolicy.html) `. --- # Structures Reference Structures ========== The following structures are available globally. [](#/Serialization) ### Serialization * `[DecodableStreamSerializer](#/s:9Alamofire25DecodableStreamSerializerV) ` `[DataStreamSerializer](Protocols/DataStreamSerializer.html) ` which uses the provided `[DataPreprocessor](Protocols/DataPreprocessor.html) ` and `[DataDecoder](Protocols/DataDecoder.html) ` to serialize the incoming `Data`. [See more](Structs/DecodableStreamSerializer.html) #### Declaration * `[PassthroughStreamSerializer](#/s:9Alamofire27PassthroughStreamSerializerV) ` `[DataStreamSerializer](Protocols/DataStreamSerializer.html) ` which performs no serialization on incoming `Data`. [See more](Structs/PassthroughStreamSerializer.html) #### Declaration * `[StringStreamSerializer](#/s:9Alamofire22StringStreamSerializerV) ` `[DataStreamSerializer](Protocols/DataStreamSerializer.html) ` which serializes incoming stream `Data` into `UTF8`\-decoded `String` values. [See more](Structs/StringStreamSerializer.html) #### Declaration * `[HTTPHeaders](#/s:9Alamofire11HTTPHeadersV) ` An order-preserving and case-insensitive representation of HTTP headers. [See more](Structs/HTTPHeaders.html) #### Declaration [](#/HTTPHeader) ### HTTPHeader * `[HTTPHeader](#/s:9Alamofire10HTTPHeaderV) ` A representation of a single HTTP header’s name / value pair. [See more](Structs/HTTPHeader.html) #### Declaration * `[HTTPMethod](#/s:9Alamofire10HTTPMethodV) ` 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](https://tools.ietf.org/html/rfc7231#section-4.3) [See more](Structs/HTTPMethod.html) #### Declaration * `[URLEncoding](#/s:9Alamofire11URLEncodingV) ` 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](Structs/URLEncoding.html) #### Declaration * `[JSONEncoding](#/s:9Alamofire12JSONEncodingV) ` 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](Structs/JSONEncoding.html) #### Declaration * `[DataResponse](#/s:9Alamofire12DataResponseV) ` Type used to store all values associated with a serialized response of a `[DataRequest](Classes/DataRequest.html) ` or `[UploadRequest](Classes/UploadRequest.html) `. [See more](Structs/DataResponse.html) #### Declaration * `[DownloadResponse](#/s:9Alamofire16DownloadResponseV) ` Used to store all data associated with a serialized response of a download request. [See more](Structs/DownloadResponse.html) #### Declaration * `[DecodableWebSocketMessageDecoder](#/s:9Alamofire32DecodableWebSocketMessageDecoderV) ` Undocumented [See more](Structs/DecodableWebSocketMessageDecoder.html) #### Declaration * `[AlamofireExtension](#/s:9Alamofire0A9ExtensionV) ` Type that acts as a generic extension point for all `[AlamofireExtended](Protocols/AlamofireExtended.html) ` types. [See more](Structs/AlamofireExtension.html) #### Declaration * `[ResponseCacher](#/s:9Alamofire14ResponseCacherV) ` `ResponseCacher` is a convenience `[CachedResponseHandler](Protocols/CachedResponseHandler.html) ` making it easy to cache, not cache, or modify a cached response. [See more](Structs/ResponseCacher.html) #### Declaration [](#/DataRequest%20%2F%20UploadRequest) ### DataRequest / UploadRequest * `[DataResponsePublisher](#/s:9Alamofire21DataResponsePublisherV) ` A Combine `Publisher` that publishes the `DataResponse` of the provided `[DataRequest](Classes/DataRequest.html) `. [See more](Structs/DataResponsePublisher.html) #### Declaration * `[DataStreamPublisher](#/s:9Alamofire19DataStreamPublisherV) ` Undocumented [See more](Structs/DataStreamPublisher.html) #### Declaration * `[DownloadResponsePublisher](#/s:9Alamofire25DownloadResponsePublisherV) ` A Combine `Publisher` that publishes the `DownloadResponse` of the provided `[DownloadRequest](Classes/DownloadRequest.html) `. [See more](Structs/DownloadResponsePublisher.html) #### Declaration [](#/DataTask) ### DataTask * `[DataTask](#/s:9Alamofire8DataTaskV) ` Value used to `await` a `[DataResponse](Structs/DataResponse.html) ` and associated values. [See more](Structs/DataTask.html) #### Declaration [](#/DownloadTask) ### DownloadTask * `[DownloadTask](#/s:9Alamofire12DownloadTaskV) ` Value used to `await` a `[DownloadResponse](Structs/DownloadResponse.html) ` and associated values. [See more](Structs/DownloadTask.html) #### Declaration [](#/DataStreamTask) ### DataStreamTask * `[DataStreamTask](#/s:9Alamofire14DataStreamTaskV) ` Undocumented [See more](Structs/DataStreamTask.html) #### Declaration [](#/WebSocketTask) ### WebSocketTask * `[StreamOf](#/s:9Alamofire8StreamOfV) ` An asynchronous sequence generated from an underlying `AsyncStream`. Only produced by Alamofire. [See more](Structs/StreamOf.html) #### Declaration * `[Redirector](#/s:9Alamofire10RedirectorV) ` `Redirector` is a convenience `[RedirectHandler](Protocols/RedirectHandler.html) ` making it easy to follow, not follow, or modify a redirect. [See more](Structs/Redirector.html) #### Declaration * `[DeflateRequestCompressor](#/s:9Alamofire24DeflateRequestCompressorV) ` `[RequestAdapter](Protocols/RequestAdapter.html) ` which compresses outgoing `URLRequest` bodies using the `deflate` `Content-Encoding` and adds the appropriate header. [See more](Structs/DeflateRequestCompressor.html) #### Declaration * `[RequestAdapterState](#/s:9Alamofire19RequestAdapterStateV) ` Stores all state associated with a `URLRequest` being adapted. [See more](Structs/RequestAdapterState.html) #### Declaration * `[PassthroughPreprocessor](#/s:9Alamofire23PassthroughPreprocessorV) ` `[DataPreprocessor](Protocols/DataPreprocessor.html) ` that returns passed `Data` without any transform. [See more](Structs/PassthroughPreprocessor.html) #### Declaration * `[GoogleXSSIPreprocessor](#/s:9Alamofire22GoogleXSSIPreprocessorV) ` `[DataPreprocessor](Protocols/DataPreprocessor.html) ` that trims Google’s typical `)]}',\n` XSSI JSON header. [See more](Structs/GoogleXSSIPreprocessor.html) #### Declaration [](#/URL) ### URL * `[URLResponseSerializer](#/s:9Alamofire21URLResponseSerializerV) ` A `[DownloadResponseSerializerProtocol](Protocols/DownloadResponseSerializerProtocol.html) ` that performs only `Error` checking and ensures that a downloaded `fileURL` is present. [See more](Structs/URLResponseSerializer.html) #### Declaration [](#/Empty) ### Empty * `[Empty](#/s:9Alamofire5EmptyV) ` Type representing an empty value. Use `[Empty.value](Structs/Empty.html#/s:9Alamofire5EmptyV5valueACvpZ) ` to get the static instance. [See more](Structs/Empty.html) #### Declaration --- # WebSocketMessageSerializer Protocol Reference WebSocketMessageSerializer ========================== Undocumented * `[Output](#/s:9Alamofire26WebSocketMessageSerializerP6OutputQa) ` Undocumented #### Declaration * `[Failure](#/s:9Alamofire26WebSocketMessageSerializerP7FailureQa) ` Undocumented #### Declaration * `[decode(_:)](#/s:9Alamofire26WebSocketMessageSerializerP6decodey6OutputQzSo012NSURLSessionbC4TaskC10FoundationE0D0OKF) ` Undocumented #### Declaration * `[json(decoding:using:)](#/s:9Alamofire26WebSocketMessageSerializerPAAE4json8decoding5usingAA09DecodablebcD7DecoderVyqd__Gqd__m_10Foundation11JSONDecoderCtAIRszSeRd__s8SendableRd__lFZ)` Extension method Undocumented #### Declaration --- # DataResponse Structure Reference DataResponse ============ Type used to store all values associated with a serialized response of a `[DataRequest](../Classes/DataRequest.html) ` or `[UploadRequest](../Classes/UploadRequest.html) `. * `[request](#/s:9Alamofire12DataResponseV7request10Foundation10URLRequestVSgvp) ` The URL request sent to the server. #### Declaration * `[response](#/s:9Alamofire12DataResponseV8responseSo17NSHTTPURLResponseCSgvp) ` The server’s response to the URL request. #### Declaration * `[data](#/s:9Alamofire12DataResponseV4data10Foundation0B0VSgvp) ` The data returned by the server. #### Declaration * `[metrics](#/s:9Alamofire12DataResponseV7metricsSo23NSURLSessionTaskMetricsCSgvp) ` The final metrics of the response. #### Declaration * `[serializationDuration](#/s:9Alamofire12DataResponseV21serializationDurationSdvp) ` The time taken to serialize the response. #### Declaration * `[result](#/s:9Alamofire12DataResponseV6results6ResultOyxq_Gvp) ` The result of response serialization. #### Declaration * `[value](#/s:9Alamofire12DataResponseV5valuexSgvp) ` Returns the associated value of the result if it is a success, `nil` otherwise. #### Declaration * `[error](#/s:9Alamofire12DataResponseV5errorq_Sgvp) ` Returns the associated error value if the result if it is a failure, `nil` otherwise. #### Declaration * `[init(request:response:data:metrics:serializationDuration:result:)](#/s:9Alamofire12DataResponseV7request8response4data7metrics21serializationDuration6resultACyxq_G10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgSo23NSURLSessionTaskMetricsCSgSds6ResultOyxq_Gtcfc) ` Creates a `DataResponse` instance with the specified parameters derived from the response serialization. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | The `URLRequest` sent to the server. | | `_response_` | The `HTTPURLResponse` from the server. | | `_data_` | The `Data` returned by the server. | | `_metrics_` | The `URLSessionTaskMetrics` of the `[DataRequest](../Classes/DataRequest.html) ` or `[UploadRequest](../Classes/UploadRequest.html) `. | | `_serializationDuration_` | The duration taken by serialization. | | `_result_` | The `Result` of response serialization. | * `[description](#/s:9Alamofire12DataResponseV11descriptionSSvp) ` The textual representation used when written to an output stream, which includes whether the result was a success or failure. #### Declaration * `[debugDescription](#/s:9Alamofire12DataResponseV16debugDescriptionSSvp) ` The debug textual representation used when written to an output stream, which includes (if available) a summary of the `URLRequest`, the request’s headers and body (if decodable as a `String` below 100KB); the `HTTPURLResponse`‘s status code, headers, and body; the duration of the network and serialization actions; and the `Result` of serialization. #### Declaration * `[map(_:)](#/s:9Alamofire12DataResponseV3mapyACyqd__q_Gqd__xXEs8SendableRd__lF) ` Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped result value as a parameter. Use the `map` method with a closure that does not throw. For example: let possibleData: DataResponse = ... let possibleInt = possibleData.map { $0.count } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A closure that takes the success value of the instance’s result. | #### Return Value A `DataResponse` whose result wraps the value returned by the given closure. If this instance’s result is a failure, returns a response wrapping the same failure. * `[tryMap(_:)](#/s:9Alamofire12DataResponseV6tryMapyACyqd__s5Error_pGqd__xKXEs8SendableRd__lF) ` Evaluates the given closure when the result of this `DataResponse` is a success, passing the unwrapped result value as a parameter. Use the `tryMap` method with a closure that may throw an error. For example: let possibleData: DataResponse = ... let possibleObject = possibleData.tryMap { try JSONSerialization.jsonObject(with: $0) } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A closure that takes the success value of the instance’s result. | #### Return Value A success or failure `DataResponse` depending on the result of the given closure. If this instance’s result is a failure, returns the same failure. * `[mapError(_:)](#/s:9Alamofire12DataResponseV8mapErroryACyxqd__Gqd__q_XEs0E0Rd__lF) ` Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter. Use the `mapError` function with a closure that does not throw. For example: let possibleData: DataResponse = ... let withMyError = possibleData.mapError { MyError.error($0) } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A closure that takes the error of the instance. | #### Return Value A `DataResponse` instance containing the result of the transform. * `[tryMapError(_:)](#/s:9Alamofire12DataResponseV11tryMapErroryACyxs0F0_pGqd__q_KXEsAERd__lF) ` Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter. Use the `tryMapError` function with a closure that may throw an error. For example: let possibleData: DataResponse = ... let possibleObject = possibleData.tryMapError { try someFailableFunction(taking: $0) } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A throwing closure that takes the error of the instance. | #### Return Value A `DataResponse` instance containing the result of the transform. --- # AlamofireExtension Structure Reference AlamofireExtension ================== Type that acts as a generic extension point for all `[AlamofireExtended](../Protocols/AlamofireExtended.html) ` types. * `[type](#/s:9Alamofire0A9ExtensionV4typexvp) ` Stores the type or meta-type of any extended type. #### Declaration * `[init(_:)](#/s:9Alamofire0A9ExtensionVyACyxGxcfc) ` Create an instance from the provided value. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | Instance being extended. | [](#/Available%20where%20%60ExtendedType%60%3A%20%60URLSessionConfiguration%60) ### Available where `ExtendedType`: `URLSessionConfiguration` * `[default](#/s:9Alamofire0A9ExtensionVAASo25NSURLSessionConfigurationCRbzlE7defaultAEvpZ) ` Alamofire’s default configuration. Same as `URLSessionConfiguration.default` but adds Alamofire default `Accept-Language`, `Accept-Encoding`, and `User-Agent` headers. #### Declaration * `[ephemeral](#/s:9Alamofire0A9ExtensionVAASo25NSURLSessionConfigurationCRbzlE9ephemeralAEvpZ) ` `.ephemeral` configuration with Alamofire’s default `Accept-Language`, `Accept-Encoding`, and `User-Agent` headers. #### Declaration [](#/Available%20where%20%60ExtendedType%60%3A%20%60Bundle%60) ### Available where `ExtendedType`: `Bundle` * `[certificates](#/s:9Alamofire0A9ExtensionVAASo8NSBundleCRbzlE12certificatesSaySo17SecCertificateRefaGvp) ` Returns all valid `cer`, `crt`, and `der` certificates in the bundle. #### Declaration * `[publicKeys](#/s:9Alamofire0A9ExtensionVAASo8NSBundleCRbzlE10publicKeysSaySo9SecKeyRefaGvp) ` Returns all public keys for the valid certificates in the bundle. #### Declaration * `[paths(forResourcesOfTypes:)](#/s:9Alamofire0A9ExtensionVAASo8NSBundleCRbzlE5paths19forResourcesOfTypesSaySSGAH_tF) ` Returns all pathnames for the resources identified by the provided file extensions. #### Declaration #### Parameters | | | | --- | --- | | `_types_` | The filename extensions locate. | #### Return Value All pathnames for the given filename extensions. [](#/Available%20where%20%60ExtendedType%60%20%3D%3D%20%60SecTrust%60) ### Available where `ExtendedType` == `SecTrust` * `[evaluate(afterApplying:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE8evaluate13afterApplyingySo0c6PolicyE0a_tKF) ` Evaluates `self` after applying the `SecPolicy` value provided. #### Declaration #### Parameters | | | | --- | --- | | `_policy_` | The `SecPolicy` to apply to `self` before evaluation. | * `[validate(policy:errorProducer:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE8validate6policy13errorProducerySo0c6PolicyE0a_s5Error_ps5Int32V_So0cD10ResultTypeVtXEtKF) ` Attempts to validate `self` using the `SecPolicy` provided and transforming any error produced using the closure passed. #### Declaration #### Parameters | | | | --- | --- | | `_policy_` | The `SecPolicy` used to evaluate `self`. | | `_errorProducer_` | The closure used transform the failed `OSStatus` and `SecTrustResultType`. | * `[apply(policy:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE5apply6policyAESo0c6PolicyE0a_tKF) ` Applies a `SecPolicy` to `self`, throwing if it fails. #### Declaration #### Parameters | | | | --- | --- | | `_policy_` | The `SecPolicy`. | #### Return Value `self`, with the policy applied. * `[evaluate()](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE8evaluateyyKF) ` Evaluate `self`, throwing an `Error` if evaluation fails. #### Declaration * `[validate(errorProducer:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE8validate13errorProducerys5Error_ps5Int32V_So0cD10ResultTypeVtXE_tKF) ` Validate `self`, passing any failure values through `errorProducer`. #### Declaration #### Parameters | | | | --- | --- | | `_errorProducer_` | The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an `Error`. | * `[setAnchorCertificates(_:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE21setAnchorCertificatesyySaySo0c11CertificateE0aGKF) ` Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain. #### Declaration #### Parameters | | | | --- | --- | | `_certificates_` | The `SecCertificate`s to add to the chain. | * `[publicKeys](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE10publicKeysSaySo0c3KeyE0aGvp) ` The public keys contained in `self`. #### Declaration * `[certificates](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE12certificatesSaySo0c11CertificateE0aGvp) ` The `SecCertificate`s contained in `self`. #### Declaration * `[certificateData](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE15certificateDataSay10Foundation0G0VGvp) ` The `Data` values for all certificates contained in `self`. #### Declaration * `[performDefaultValidation(forHost:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE24performDefaultValidation7forHostySS_tKF) ` Validates `self` after applying `SecPolicy.af.default`. This evaluation does not validate the hostname. #### Declaration #### Parameters | | | | --- | --- | | `_host_` | The hostname, used only in the error output if validation fails. | * `[performValidation(forHost:)](#/s:9Alamofire0A9ExtensionVAASo11SecTrustRefaRszlE17performValidation7forHostySS_tKF) ` Validates `self` after applying `SecPolicy.af.hostname(host)`, which performs the default validation as well as hostname validation. #### Declaration #### Parameters | | | | --- | --- | | `_host_` | The hostname to use in the validation. | [](#/Available%20where%20%60ExtendedType%60%20%3D%3D%20%60SecPolicy%60) ### Available where `ExtendedType` == `SecPolicy` * `[default](#/s:9Alamofire0A9ExtensionVAASo12SecPolicyRefaRszlE7defaultAEvpZ) ` Creates a `SecPolicy` instance which will validate server certificates but not require a host name match. #### Declaration * `[hostname(_:)](#/s:9Alamofire0A9ExtensionVAASo12SecPolicyRefaRszlE8hostnameyAESSFZ) ` Creates a `SecPolicy` instance which will validate server certificates and much match the provided hostname. #### Declaration #### Parameters | | | | --- | --- | | `_hostname_` | The hostname to validate against. | #### Return Value The `SecPolicy`. * `[revocation(options:)](#/s:9Alamofire0A9ExtensionVAASo12SecPolicyRefaRszlE10revocation7optionsAeA24RevocationTrustEvaluatorC7OptionsV_tKFZ) ` Creates a `SecPolicy` which checks the revocation of certificates. #### Declaration #### Parameters | | | | --- | --- | | `_options_` | The `[RevocationTrustEvaluator.Options](../Classes/RevocationTrustEvaluator/Options.html) ` for evaluation. | #### Return Value The `SecPolicy`. [](#/Available%20where%20%60ExtendedType%60%20%3D%3D%20%5B%60SecCertificate%60%5D) ### Available where `ExtendedType` == \[`SecCertificate`\] * `[data](#/s:9Alamofire0A9ExtensionVAASaySo17SecCertificateRefaGRszlE4dataSay10Foundation4DataVGvp) ` All `Data` values for the contained `SecCertificate`s. #### Declaration * `[publicKeys](#/s:9Alamofire0A9ExtensionVAASaySo17SecCertificateRefaGRszlE10publicKeysSaySo0c3KeyE0aGvp) ` All public `SecKey` values for the contained `SecCertificate`s. #### Declaration [](#/Available%20where%20%60ExtendedType%60%20%3D%3D%20%60SecCertificate%60) ### Available where `ExtendedType` == `SecCertificate` * `[publicKey](#/s:9Alamofire0A9ExtensionVAASo17SecCertificateRefaRszlE9publicKeySo0cgE0aSgvp) ` The public key for `self`, if it can be extracted. #### Declaration [](#/Available%20where%20%60ExtendedType%60%20%3D%3D%20%60OSStatus%60) ### Available where `ExtendedType` == `OSStatus` * `[isSuccess](#/s:9Alamofire0A9ExtensionVAAs5Int32VRszlE9isSuccessSbvp) ` Returns whether `self` is `errSecSuccess`. #### Declaration [](#/Available%20where%20%60ExtendedType%60%20%3D%3D%20%60SecTrustResultType%60) ### Available where `ExtendedType` == `SecTrustResultType` * `[isSuccess](#/s:9Alamofire0A9ExtensionVAASo18SecTrustResultTypeVRszlE9isSuccessSbvp) ` Returns whether `self` is `.unspecified` or `.proceed`. #### Declaration --- # DataResponsePublisher Structure Reference DataResponsePublisher ===================== A Combine `Publisher` that publishes the `DataResponse` of the provided `[DataRequest](../Classes/DataRequest.html) `. * `[Output](#/s:7Combine9PublisherP6OutputQa) ` #### Declaration * `[Failure](#/s:7Combine9PublisherP7FailureQa) ` #### Declaration * `[init(_:queue:serializer:)](#/s:9Alamofire21DataResponsePublisherV_5queue10serializerACyxGAA0B7RequestC_So012OS_dispatch_E0Cqd__tc16SerializedObjectQyd__RszAA0C10SerializerRd__lufc) ` Creates an instance which will serialize responses using the provided `[ResponseSerializer](../Protocols/ResponseSerializer.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DataRequest](../Classes/DataRequest.html) ` for which to publish the response. | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` value will be published. `.main` by default. | | `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` used to produce the published `[DataResponse](../Structs/DataResponse.html) `. | * `[init(_:queue:serializer:)](#/s:9Alamofire21DataResponsePublisherV_5queue10serializerACyxGAA0B7RequestC_So012OS_dispatch_E0Cqd__tc16SerializedObjectQyd__RszAA0bC18SerializerProtocolRd__lufc) ` Creates an instance which will serialize responses using the provided `[DataResponseSerializerProtocol](../Protocols/DataResponseSerializerProtocol.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DataRequest](../Classes/DataRequest.html) ` for which to publish the response. | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` value will be published. `.main` by default. | | `_serializer_` | `[DataResponseSerializerProtocol](../Protocols/DataResponseSerializerProtocol.html) ` used to produce the published `[DataResponse](../Structs/DataResponse.html) `. | * `[result()](#/s:9Alamofire21DataResponsePublisherV6result7Combine03AnyD0Vys6ResultOyxAA7AFErrorOGs5NeverOGyF) ` Publishes only the `Result` of the `[DataResponse](../Structs/DataResponse.html) ` value. #### Declaration #### Return Value The `AnyPublisher` publishing the `Result` value. * `[value()](#/s:9Alamofire21DataResponsePublisherV5value7Combine03AnyD0VyxAA7AFErrorOGyF) ` Publishes the `Result` of the `[DataResponse](../Structs/DataResponse.html) ` as a single `Value` or fail with the `[AFError](../Enums/AFError.html) ` instance. #### Declaration #### Return Value The `AnyPublisher` publishing the stream. * `[receive(subscriber:)](#/s:7Combine9PublisherP7receive10subscriberyqd___tAA10SubscriberRd__7FailureQyd__AGRtz5InputQyd__6OutputRtzlF) ` #### Declaration [](#/Available%20where%20%60Value%60%20%3D%3D%20%60Data%60%3F) ### Available where `Value` == `Data`? * `[init(_:queue:)](#/s:9Alamofire21DataResponsePublisherVAA10Foundation0B0VSgRszrlE_5queueACyAGGAA0B7RequestC_So012OS_dispatch_F0Ctcfc) ` Creates an instance which publishes a `DataResponse` value without serialization. #### Declaration --- # DataStreamPublisher Structure Reference DataStreamPublisher =================== Undocumented * `[Output](#/s:7Combine9PublisherP6OutputQa) ` #### Declaration * `[Failure](#/s:7Combine9PublisherP7FailureQa) ` #### Declaration * `[init(_:queue:serializer:)](#/s:9Alamofire19DataStreamPublisherV_5queue10serializerACyxGAA0bC7RequestC_So012OS_dispatch_E0Cqd__tc16SerializedObjectQyd__RszAA0bC10SerializerRd__lufc) ` Creates an instance which will serialize responses using the provided `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DataStreamRequest](../Classes/DataStreamRequest.html) ` for which to publish the response. | | `_queue_` | `DispatchQueue` on which the `Stream` values will be published. `.main` by default. | | `_serializer_` | `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` used to produce the published `Stream` values. | * `[result()](#/s:9Alamofire19DataStreamPublisherV6result7Combine03AnyD0Vys6ResultOyxAA7AFErrorOGs5NeverOGyF) ` Publishes only the `Result` of the `[DataStreamRequest.Stream](../Classes/DataStreamRequest/Stream.html) `‘s `Event`s. #### Declaration #### Return Value The `AnyPublisher` publishing the `Result` value. * `[value()](#/s:9Alamofire19DataStreamPublisherV5value7Combine03AnyD0VyxAA7AFErrorOGyF) ` Publishes the streamed values of the `[DataStreamRequest.Stream](../Classes/DataStreamRequest/Stream.html) ` as a sequence of `Value` or fail with the `[AFError](../Enums/AFError.html) ` instance. #### Declaration #### Return Value The `AnyPublisher` publishing the stream. * `[receive(subscriber:)](#/s:7Combine9PublisherP7receive10subscriberyqd___tAA10SubscriberRd__7FailureQyd__AGRtz5InputQyd__6OutputRtzlF) ` #### Declaration --- # DataStreamTask Structure Reference DataStreamTask ============== Undocumented * `[Stream](#/s:9Alamofire14DataStreamTaskV0C0a) ` Undocumented #### Declaration * `[streamingData(automaticallyCancelling:bufferingPolicy:)](#/s:9Alamofire14DataStreamTaskV09streamingB023automaticallyCancelling15bufferingPolicyAA0C2OfVyAA0bC7RequestC0C0Vy_10Foundation0B0Vs5NeverOGGSb_ScS12ContinuationV09BufferingI0OyAR__GtF) ` Creates a `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) ` of `Data` values from the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` indicating whether the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) ` should be canceled which observation of the stream stops. `true` by default. | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) `. * `[streamingStrings(automaticallyCancelling:bufferingPolicy:)](#/s:9Alamofire14DataStreamTaskV16streamingStrings23automaticallyCancelling15bufferingPolicyAA0C2OfVyAA0bC7RequestC0C0Vy_SSs5NeverOGGSb_ScS12ContinuationV09BufferingJ0OyAO__GtF) ` Creates a `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) ` of `UTF-8` `String`s from the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_shouldAutomaticallyCancel_` | `Bool` indicating whether the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) ` should be canceled which observation of the stream stops. `true` by default. | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value * `[streamingDecodables(_:automaticallyCancelling:bufferingPolicy:)](#/s:9Alamofire14DataStreamTaskV19streamingDecodables_23automaticallyCancelling15bufferingPolicyAA0C2OfVyAA0bC7RequestC0C0Vy_xAA7AFErrorOGGxm_SbScS12ContinuationV09BufferingJ0OyAO__GtSeRzs8SendableRzlF) ` Creates a `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) ` of `Decodable` values from the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_type_` | `Decodable` type to be serialized from stream payloads. | | `_shouldAutomaticallyCancel_` | `Bool` indicating whether the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) ` should be canceled which observation of the stream stops. `true` by default. | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) `. * `[streamingResponses(serializedUsing:automaticallyCancelling:bufferingPolicy:)](#/s:9Alamofire14DataStreamTaskV18streamingResponses15serializedUsing23automaticallyCancelling15bufferingPolicyAA0C2OfVyAA0bC7RequestC0C0Vy_16SerializedObjectQzAA7AFErrorOGGx_SbScS12ContinuationV09BufferingL0OyAR__GtAA0bC10SerializerRzlF) ` Creates a `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) ` of values using the provided `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` from the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_serializer_` | `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` to use to serialize incoming `Data`. | | `_shouldAutomaticallyCancel_` | `Bool` indicating whether the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) ` should be canceled which observation of the stream stops. `true` by default. | | `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. | #### Return Value The `[Stream](../Structs/DataStreamTask.html#/s:9Alamofire14DataStreamTaskV0C0a) `. * `[cancel()](#/s:9Alamofire14DataStreamTaskV6cancelyyF) ` Cancel the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration * `[resume()](#/s:9Alamofire14DataStreamTaskV6resumeyyF) ` Resume the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration * `[suspend()](#/s:9Alamofire14DataStreamTaskV7suspendyyF) ` Suspend the underlying `[DataStreamRequest](../Classes/DataStreamRequest.html) `. #### Declaration --- # DataTask Structure Reference DataTask ======== Value used to `await` a `[DataResponse](../Structs/DataResponse.html) ` and associated values. * `[response](#/s:9Alamofire8DataTaskV8responseAA0B8ResponseVyxAA7AFErrorOGvp)` Asynchronous `[DataResponse](../Structs/DataResponse.html) ` produced by the `[DataRequest](../Classes/DataRequest.html) ` and its response handler. #### Declaration * `[result](#/s:9Alamofire8DataTaskV6results6ResultOyxAA7AFErrorOGvp)` Asynchronous `Result` of any response serialization performed for the `[response](../Structs/DataTask.html#/s:9Alamofire8DataTaskV8responseAA0B8ResponseVyxAA7AFErrorOGvp) `. #### Declaration * `[value](#/s:9Alamofire8DataTaskV5valuexvp)` Asynchronous `Value` returned by the `[response](../Structs/DataTask.html#/s:9Alamofire8DataTaskV8responseAA0B8ResponseVyxAA7AFErrorOGvp) `. #### Declaration * `[cancel()](#/s:9Alamofire8DataTaskV6cancelyyF) ` Cancel the underlying `[DataRequest](../Classes/DataRequest.html) ` and `Task`. #### Declaration * `[resume()](#/s:9Alamofire8DataTaskV6resumeyyF) ` Resume the underlying `[DataRequest](../Classes/DataRequest.html) `. #### Declaration * `[suspend()](#/s:9Alamofire8DataTaskV7suspendyyF) ` Suspend the underlying `[DataRequest](../Classes/DataRequest.html) `. #### Declaration --- # DecodableStreamSerializer Structure Reference DecodableStreamSerializer ========================= `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` which uses the provided `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` and `[DataDecoder](../Protocols/DataDecoder.html) ` to serialize the incoming `Data`. * `[decoder](#/s:9Alamofire25DecodableStreamSerializerV7decoderAA11DataDecoder_pvp) ` `[DataDecoder](../Protocols/DataDecoder.html) ` used to decode incoming `Data`. #### Declaration * `[dataPreprocessor](#/s:9Alamofire25DecodableStreamSerializerV16dataPreprocessorAA04DataF0_pvp) ` `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` incoming `Data` is passed through before being passed to the `[DataDecoder](../Protocols/DataDecoder.html) `. #### Declaration * `[init(decoder:dataPreprocessor:)](#/s:9Alamofire25DecodableStreamSerializerV7decoder16dataPreprocessorACyxGAA11DataDecoder_p_AA0hG0_ptcfc) ` Creates an instance with the provided `[DataDecoder](../Protocols/DataDecoder.html) ` and `[DataPreprocessor](../Protocols/DataPreprocessor.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` used to decode incoming `Data`. `JSONDecoder()` by default. | | `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to process incoming `Data` before it’s passed through the `[decoder](../Structs/DecodableStreamSerializer.html#/s:9Alamofire25DecodableStreamSerializerV7decoderAA11DataDecoder_pvp) `. `PassthroughPreprocessor()` by default. | * `[serialize(_:)](#/s:9Alamofire20DataStreamSerializerP9serializey16SerializedObjectQz10Foundation0B0VKF) ` #### Declaration --- # DeflateRequestCompressor Structure Reference DeflateRequestCompressor ======================== `[RequestAdapter](../Protocols/RequestAdapter.html) ` which compresses outgoing `URLRequest` bodies using the `deflate` `Content-Encoding` and adds the appropriate header. * `[DuplicateHeaderBehavior](#/s:9Alamofire24DeflateRequestCompressorV23DuplicateHeaderBehaviorO) ` Type that determines the action taken when the `URLRequest` already has a `Content-Encoding` header. [See more](../Structs/DeflateRequestCompressor/DuplicateHeaderBehavior.html) #### Declaration * `[DuplicateHeaderError](#/s:9Alamofire24DeflateRequestCompressorV20DuplicateHeaderErrorV) ` `Error` produced when the outgoing `URLRequest` already has a `Content-Encoding` header, when the instance has been configured to produce an error. #### Declaration * `[duplicateHeaderBehavior](#/s:9Alamofire24DeflateRequestCompressorV23duplicateHeaderBehaviorAC09DuplicatefG0Ovp) ` Behavior to use when the outgoing `URLRequest` already has a `Content-Encoding` header. #### Declaration * `[shouldCompressBodyData](#/s:9Alamofire24DeflateRequestCompressorV22shouldCompressBodyDataySb10Foundation0H0VYbcvp) ` Closure which determines whether the outgoing body data should be compressed. #### Declaration * `[init(duplicateHeaderBehavior:shouldCompressBodyData:)](#/s:9Alamofire24DeflateRequestCompressorV23duplicateHeaderBehavior22shouldCompressBodyDataA2C09DuplicatefG0O_Sb10Foundation0K0VYbctcfc) ` Creates an instance with the provided parameters. #### Declaration #### Parameters | | | | --- | --- | | `_duplicateHeaderBehavior_` | `[DuplicateHeaderBehavior](../Structs/DeflateRequestCompressor/DuplicateHeaderBehavior.html) ` to use. `.error` by default. | | `_shouldCompressBodyData_` | Closure which determines whether the outgoing body data should be compressed. `true` by default. | * `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) ` #### Declaration --- # DecodableWebSocketMessageDecoder Structure Reference DecodableWebSocketMessageDecoder ================================ Undocumented * `[Error](#/s:9Alamofire32DecodableWebSocketMessageDecoderV5ErrorO) ` Undocumented [See more](../Structs/DecodableWebSocketMessageDecoder/Error.html) #### Declaration * `[decoder](#/s:9Alamofire32DecodableWebSocketMessageDecoderV7decoderAA04DataF0_pvp) ` Undocumented #### Declaration * `[init(decoder:)](#/s:9Alamofire32DecodableWebSocketMessageDecoderV7decoderACyxGAA04DataF0_p_tcfc) ` Undocumented #### Declaration * `[decode(_:)](#/s:9Alamofire32DecodableWebSocketMessageDecoderV6decodeyxSo012NSURLSessioncD4TaskC10FoundationE0E0OKF) ` Undocumented #### Declaration --- # DuplicateHeaderBehavior Enumeration Reference DuplicateHeaderBehavior ======================= Type that determines the action taken when the `URLRequest` already has a `Content-Encoding` header. * `[error](#/s:9Alamofire24DeflateRequestCompressorV23DuplicateHeaderBehaviorO5erroryA2EmF) ` Throws a `[DuplicateHeaderError](../../Structs/DeflateRequestCompressor.html#/s:9Alamofire24DeflateRequestCompressorV20DuplicateHeaderErrorV) `. The default. #### Declaration * `[replace](#/s:9Alamofire24DeflateRequestCompressorV23DuplicateHeaderBehaviorO7replaceyA2EmF) ` Replaces the existing header value with `deflate`. #### Declaration * `[skip](#/s:9Alamofire24DeflateRequestCompressorV23DuplicateHeaderBehaviorO4skipyA2EmF) ` Silently skips compression when the header exists. #### Declaration --- # Error Enumeration Reference Error ===== Undocumented * `[decoding(_:)](#/s:9Alamofire32DecodableWebSocketMessageDecoderV5ErrorO8decodingyAEyx_GsAD_pcAGmSeRzs8SendableRzlF) ` Undocumented #### Declaration * `[unknownMessage(description:)](#/s:9Alamofire32DecodableWebSocketMessageDecoderV5ErrorO07unknownE0yAEyx_GSS_tcAGmSeRzs8SendableRzlF) ` Undocumented #### Declaration --- # Empty Structure Reference Empty ===== Type representing an empty value. Use `[Empty.value](../Structs/Empty.html#/s:9Alamofire5EmptyV5valueACvpZ) ` to get the static instance. * `[value](#/s:9Alamofire5EmptyV5valueACvpZ) ` Static `Empty` instance used for all `Empty` responses. #### Declaration [](#/Empty) ### Empty * `[emptyValue()](#/s:9Alamofire13EmptyResponseP10emptyValuexyFZ) ` #### Declaration --- # DownloadTask Structure Reference DownloadTask ============ Value used to `await` a `[DownloadResponse](../Structs/DownloadResponse.html) ` and associated values. * `[response](#/s:9Alamofire12DownloadTaskV8responseAA0B8ResponseVyxAA7AFErrorOGvp)` Asynchronous `[DownloadResponse](../Structs/DownloadResponse.html) ` produced by the `[DownloadRequest](../Classes/DownloadRequest.html) ` and its response handler. #### Declaration * `[result](#/s:9Alamofire12DownloadTaskV6results6ResultOyxAA7AFErrorOGvp)` Asynchronous `Result` of any response serialization performed for the `[response](../Structs/DownloadTask.html#/s:9Alamofire12DownloadTaskV8responseAA0B8ResponseVyxAA7AFErrorOGvp) `. #### Declaration * `[value](#/s:9Alamofire12DownloadTaskV5valuexvp)` Asynchronous `Value` returned by the `[response](../Structs/DownloadTask.html#/s:9Alamofire12DownloadTaskV8responseAA0B8ResponseVyxAA7AFErrorOGvp) `. #### Declaration * `[cancel()](#/s:9Alamofire12DownloadTaskV6cancelyyF) ` Cancel the underlying `[DownloadRequest](../Classes/DownloadRequest.html) ` and `Task`. #### Declaration * `[resume()](#/s:9Alamofire12DownloadTaskV6resumeyyF) ` Resume the underlying `[DownloadRequest](../Classes/DownloadRequest.html) `. #### Declaration * `[suspend()](#/s:9Alamofire12DownloadTaskV7suspendyyF) ` Suspend the underlying `[DownloadRequest](../Classes/DownloadRequest.html) `. #### Declaration --- # DownloadResponse Structure Reference DownloadResponse ================ Used to store all data associated with a serialized response of a download request. * `[request](#/s:9Alamofire16DownloadResponseV7request10Foundation10URLRequestVSgvp) ` The URL request sent to the server. #### Declaration * `[response](#/s:9Alamofire16DownloadResponseV8responseSo17NSHTTPURLResponseCSgvp) ` The server’s response to the URL request. #### Declaration * `[fileURL](#/s:9Alamofire16DownloadResponseV7fileURL10Foundation0E0VSgvp) ` The final destination URL of the data returned from the server after it is moved. #### Declaration * `[resumeData](#/s:9Alamofire16DownloadResponseV10resumeData10Foundation0E0VSgvp) ` The resume data generated if the request was cancelled. #### Declaration * `[metrics](#/s:9Alamofire16DownloadResponseV7metricsSo23NSURLSessionTaskMetricsCSgvp) ` The final metrics of the response. #### Declaration * `[serializationDuration](#/s:9Alamofire16DownloadResponseV21serializationDurationSdvp) ` The time taken to serialize the response. #### Declaration * `[result](#/s:9Alamofire16DownloadResponseV6results6ResultOyxq_Gvp) ` The result of response serialization. #### Declaration * `[value](#/s:9Alamofire16DownloadResponseV5valuexSgvp) ` Returns the associated value of the result if it is a success, `nil` otherwise. #### Declaration * `[error](#/s:9Alamofire16DownloadResponseV5errorq_Sgvp) ` Returns the associated error value if the result if it is a failure, `nil` otherwise. #### Declaration * `[init(request:response:fileURL:resumeData:metrics:serializationDuration:result:)](#/s:9Alamofire16DownloadResponseV7request8response7fileURL10resumeData7metrics21serializationDuration6resultACyxq_G10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAL0G0VSgAL0I0VSgSo23NSURLSessionTaskMetricsCSgSds6ResultOyxq_Gtcfc) ` Creates a `DownloadResponse` instance with the specified parameters derived from response serialization. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | The `URLRequest` sent to the server. | | `_response_` | The `HTTPURLResponse` from the server. | | `_fileURL_` | The final destination URL of the data returned from the server after it is moved. | | `_resumeData_` | The resume `Data` generated if the request was cancelled. | | `_metrics_` | The `URLSessionTaskMetrics` of the `[DownloadRequest](../Classes/DownloadRequest.html) `. | | `_serializationDuration_` | The duration taken by serialization. | | `_result_` | The `Result` of response serialization. | * `[description](#/s:9Alamofire16DownloadResponseV11descriptionSSvp) ` The textual representation used when written to an output stream, which includes whether the result was a success or failure. #### Declaration * `[debugDescription](#/s:9Alamofire16DownloadResponseV16debugDescriptionSSvp) ` The debug textual representation used when written to an output stream, which includes the URL request, the URL response, the temporary and destination URLs, the resume data, the durations of the network and serialization actions, and the response serialization result. #### Declaration * `[map(_:)](#/s:9Alamofire16DownloadResponseV3mapyACyqd__q_Gqd__xXEs8SendableRd__lF) ` Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped result value as a parameter. Use the `map` method with a closure that does not throw. For example: let possibleData: DownloadResponse = ... let possibleInt = possibleData.map { $0.count } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A closure that takes the success value of the instance’s result. | #### Return Value A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance’s result is a failure, returns a response wrapping the same failure. * `[tryMap(_:)](#/s:9Alamofire16DownloadResponseV6tryMapyACyqd__s5Error_pGqd__xKXEs8SendableRd__lF) ` Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped result value as a parameter. Use the `tryMap` method with a closure that may throw an error. For example: let possibleData: DownloadResponse = ... let possibleObject = possibleData.tryMap { try JSONSerialization.jsonObject(with: $0) } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A closure that takes the success value of the instance’s result. | #### Return Value A success or failure `DownloadResponse` depending on the result of the given closure. If this instance’s result is a failure, returns the same failure. * `[mapError(_:)](#/s:9Alamofire16DownloadResponseV8mapErroryACyxqd__Gqd__q_XEs0E0Rd__lF) ` Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter. Use the `mapError` function with a closure that does not throw. For example: let possibleData: DownloadResponse = ... let withMyError = possibleData.mapError { MyError.error($0) } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A closure that takes the error of the instance. | #### Return Value A `DownloadResponse` instance containing the result of the transform. * `[tryMapError(_:)](#/s:9Alamofire16DownloadResponseV11tryMapErroryACyxs0F0_pGqd__q_KXEsAERd__lF) ` Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter. Use the `tryMapError` function with a closure that may throw an error. For example: let possibleData: DownloadResponse = ... let possibleObject = possibleData.tryMapError { try someFailableFunction(taking: $0) } #### Declaration #### Parameters | | | | --- | --- | | `_transform_` | A throwing closure that takes the error of the instance. | #### Return Value A `DownloadResponse` instance containing the result of the transform. --- # DownloadResponsePublisher Structure Reference DownloadResponsePublisher ========================= A Combine `Publisher` that publishes the `DownloadResponse` of the provided `[DownloadRequest](../Classes/DownloadRequest.html) `. * `[Output](#/s:7Combine9PublisherP6OutputQa) ` #### Declaration * `[Failure](#/s:7Combine9PublisherP7FailureQa) ` #### Declaration * `[init(_:queue:serializer:)](#/s:9Alamofire25DownloadResponsePublisherV_5queue10serializerACyxGAA0B7RequestC_So012OS_dispatch_E0Cqd__tc16SerializedObjectQyd__RszAA0C10SerializerRd__lufc) ` Creates an instance which will serialize responses using the provided `[ResponseSerializer](../Protocols/ResponseSerializer.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DownloadRequest](../Classes/DownloadRequest.html) ` for which to publish the response. | | `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` value will be published. `.main` by default. | | `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` used to produce the published `[DownloadResponse](../Structs/DownloadResponse.html) `. | * `[init(_:queue:serializer:)](#/s:9Alamofire25DownloadResponsePublisherV_5queue10serializerACyxGAA0B7RequestC_So012OS_dispatch_E0Cqd__tc16SerializedObjectQyd__RszAA0bC18SerializerProtocolRd__lufc) ` Creates an instance which will serialize responses using the provided `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` value. #### Declaration #### Parameters | | | | --- | --- | | `_request_` | `[DownloadRequest](../Classes/DownloadRequest.html) ` for which to publish the response. | | `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` value will be published. `.main` by default. | | `_serializer_` | `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` used to produce the published `[DownloadResponse](../Structs/DownloadResponse.html) `. | * `[result()](#/s:9Alamofire25DownloadResponsePublisherV6result7Combine03AnyD0Vys6ResultOyxAA7AFErrorOGs5NeverOGyF) ` Publishes only the `Result` of the `[DownloadResponse](../Structs/DownloadResponse.html) ` value. #### Declaration #### Return Value The `AnyPublisher` publishing the `Result` value. * `[value()](#/s:9Alamofire25DownloadResponsePublisherV5value7Combine03AnyD0VyxAA7AFErrorOGyF) ` Publishes the `Result` of the `[DownloadResponse](../Structs/DownloadResponse.html) ` as a single `Value` or fail with the `[AFError](../Enums/AFError.html) ` instance. #### Declaration #### Return Value The `AnyPublisher` publishing the stream. * `[receive(subscriber:)](#/s:7Combine9PublisherP7receive10subscriberyqd___tAA10SubscriberRd__7FailureQyd__AGRtz5InputQyd__6OutputRtzlF) ` #### Declaration [](#/Available%20where%20%60Value%60%20%3D%3D%20%60URL%60%3F) ### Available where `Value` == `URL`? * `[init(_:queue:)](#/s:9Alamofire25DownloadResponsePublisherVAA10Foundation3URLVSgRszrlE_5queueACyAGGAA0B7RequestC_So012OS_dispatch_G0Ctcfc) ` Creates an instance which publishes a `DownloadResponse` value without serialization. #### Declaration --- # GoogleXSSIPreprocessor Structure Reference GoogleXSSIPreprocessor ====================== `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` that trims Google’s typical `)]}',\n` XSSI JSON header. * `[init()](#/s:9Alamofire22GoogleXSSIPreprocessorVACycfc) ` Creates an instance. #### Declaration * `[preprocess(_:)](#/s:9Alamofire16DataPreprocessorP10preprocessy10Foundation0B0VAGKF) ` #### Declaration --- # HTTPHeaders Structure Reference HTTPHeaders =========== An order-preserving and case-insensitive representation of HTTP headers. * `[init()](#/s:9Alamofire11HTTPHeadersVACycfc) ` Creates an empty instance. #### Declaration * `[init(_:)](#/s:9Alamofire11HTTPHeadersVyACSayAA10HTTPHeaderVGcfc) ` Creates an instance from an array of `[HTTPHeader](../Structs/HTTPHeader.html) `s. Duplicate case-insensitive names are collapsed into the last name and value encountered. #### Declaration * `[init(_:)](#/s:9Alamofire11HTTPHeadersVyACSDyS2SGcfc) ` Creates an instance from a `[String: String]`. Duplicate case-insensitive names are collapsed into the last name and value encountered. #### Declaration * `[add(name:value:)](#/s:9Alamofire11HTTPHeadersV3add4name5valueySS_SStF) ` Case-insensitively updates or appends an `[HTTPHeader](../Structs/HTTPHeader.html) ` into the instance using the provided `name` and `value`. #### Declaration #### Parameters | | | | --- | --- | | `_name_` | The `[HTTPHeader](../Structs/HTTPHeader.html) ` name. | | `_value_` | The `[HTTPHeader](../Structs/HTTPHeader.html) ` value. | * `[add(_:)](#/s:9Alamofire11HTTPHeadersV3addyyAA10HTTPHeaderVF) ` Case-insensitively updates or appends the provided `[HTTPHeader](../Structs/HTTPHeader.html) ` into the instance. #### Declaration #### Parameters | | | | --- | --- | | `_header_` | The `[HTTPHeader](../Structs/HTTPHeader.html) ` to update or append. | * `[update(name:value:)](#/s:9Alamofire11HTTPHeadersV6update4name5valueySS_SStF) ` Case-insensitively updates or appends an `[HTTPHeader](../Structs/HTTPHeader.html) ` into the instance using the provided `name` and `value`. #### Declaration #### Parameters | | | | --- | --- | | `_name_` | The `[HTTPHeader](../Structs/HTTPHeader.html) ` name. | | `_value_` | The `[HTTPHeader](../Structs/HTTPHeader.html) ` value. | * `[update(_:)](#/s:9Alamofire11HTTPHeadersV6updateyyAA10HTTPHeaderVF) ` Case-insensitively updates or appends the provided `[HTTPHeader](../Structs/HTTPHeader.html) ` into the instance. #### Declaration #### Parameters | | | | --- | --- | | `_header_` | The `[HTTPHeader](../Structs/HTTPHeader.html) ` to update or append. | * `[remove(name:)](#/s:9Alamofire11HTTPHeadersV6remove4nameySS_tF) ` Case-insensitively removes an `[HTTPHeader](../Structs/HTTPHeader.html) `, if it exists, from the instance. #### Declaration #### Parameters | | | | --- | --- | | `_name_` | The name of the `[HTTPHeader](../Structs/HTTPHeader.html) ` to remove. | * `[sort()](#/s:9Alamofire11HTTPHeadersV4sortyyF) ` Sort the current instance by header name, case insensitively. #### Declaration * `[sorted()](#/s:9Alamofire11HTTPHeadersV6sortedACyF) ` Returns an instance sorted by header name. #### Declaration #### Return Value A copy of the current instance sorted by name. * `[value(for:)](#/s:9Alamofire11HTTPHeadersV5value3forSSSgSS_tF) ` Case-insensitively find a header’s value by name. #### Declaration #### Parameters | | | | --- | --- | | `_name_` | The name of the header to search for, case-insensitively. | #### Return Value The value of header, if it exists. * `[subscript(_:)](#/s:9Alamofire11HTTPHeadersVySSSgSScip) ` Case-insensitively access the header with the given name. #### Declaration #### Parameters | | | | --- | --- | | `_name_` | The name of the header. | * `[dictionary](#/s:9Alamofire11HTTPHeadersV10dictionarySDyS2SGvp) ` The dictionary representation of all headers. This representation does not preserve the current order of the instance. #### Declaration * `[init(dictionaryLiteral:)](#/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc) ` #### Declaration * `[init(arrayLiteral:)](#/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc) ` #### Declaration * `[makeIterator()](#/s:ST12makeIterator0B0QzyF) ` #### Declaration * `[startIndex](#/s:Sl10startIndex0B0Qzvp) ` #### Declaration * `[endIndex](#/s:Sl8endIndex0B0Qzvp) ` #### Declaration * `[subscript(_:)](#/s:Sly7ElementQz5IndexQzcip) ` #### Declaration * `[index(after:)](#/s:Sl5index5after5IndexQzAD_tF) ` #### Declaration * `[description](#/s:s23CustomStringConvertibleP11descriptionSSvp) ` #### Declaration [](#/Defaults) ### Defaults * `[default](#/s:9Alamofire11HTTPHeadersV7defaultACvpZ) ` The default set of `HTTPHeaders` used by Alamofire. Includes `Accept-Encoding`, `Accept-Language`, and `User-Agent`. #### Declaration --- # HTTPMethod Structure Reference 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](https://tools.ietf.org/html/rfc7231#section-4.3) * `[connect](#/s:9Alamofire10HTTPMethodV7connectACvpZ) ` `CONNECT` method. #### Declaration * `[delete](#/s:9Alamofire10HTTPMethodV6deleteACvpZ) ` `DELETE` method. #### Declaration * `[get](#/s:9Alamofire10HTTPMethodV3getACvpZ) ` `GET` method. #### Declaration * `[head](#/s:9Alamofire10HTTPMethodV4headACvpZ) ` `HEAD` method. #### Declaration * `[options](#/s:9Alamofire10HTTPMethodV7optionsACvpZ) ` `OPTIONS` method. #### Declaration * `[patch](#/s:9Alamofire10HTTPMethodV5patchACvpZ) ` `PATCH` method. #### Declaration * `[post](#/s:9Alamofire10HTTPMethodV4postACvpZ) ` `POST` method. #### Declaration * `[put](#/s:9Alamofire10HTTPMethodV3putACvpZ) ` `PUT` method. #### Declaration * `[query](#/s:9Alamofire10HTTPMethodV5queryACvpZ) ` `QUERY` method. #### Declaration * `[trace](#/s:9Alamofire10HTTPMethodV5traceACvpZ) ` `TRACE` method. #### Declaration * `[rawValue](#/s:SY8rawValue03RawB0Qzvp) ` #### Declaration * `[init(rawValue:)](#/s:SY8rawValuexSg03RawB0Qz_tcfc) ` #### Declaration --- # HTTPHeader Structure Reference HTTPHeader ========== A representation of a single HTTP header’s name / value pair. * `[name](#/s:9Alamofire10HTTPHeaderV4nameSSvp) ` Name of the header. #### Declaration * `[value](#/s:9Alamofire10HTTPHeaderV5valueSSvp) ` Value of the header. #### Declaration * `[init(name:value:)](#/s:9Alamofire10HTTPHeaderV4name5valueACSS_SStcfc) ` Creates an instance from the given `[name](../Structs/HTTPHeader.html#/s:9Alamofire10HTTPHeaderV4nameSSvp) ` and `[value](../Structs/HTTPHeader.html#/s:9Alamofire10HTTPHeaderV5valueSSvp) `. #### Declaration #### Parameters | | | | --- | --- | | `_name_` | The name of the header. | | `_value_` | The value of the header. | [](#/HTTPHeader) ### HTTPHeader * `[description](#/s:s23CustomStringConvertibleP11descriptionSSvp) ` #### Declaration * `[accept(_:)](#/s:9Alamofire10HTTPHeaderV6acceptyACSSFZ) ` Returns an `Accept` header. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Accept` value. | #### Return Value The header. * `[acceptCharset(_:)](#/s:9Alamofire10HTTPHeaderV13acceptCharsetyACSSFZ) ` Returns an `Accept-Charset` header. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Accept-Charset` value. | #### Return Value The header. * `[acceptLanguage(_:)](#/s:9Alamofire10HTTPHeaderV14acceptLanguageyACSSFZ) ` Returns an `Accept-Language` header. Alamofire offers a default Accept-Language header that accumulates and encodes the system’s preferred languages. Use `[HTTPHeader.defaultAcceptLanguage](../Structs/HTTPHeader.html#/s:9Alamofire10HTTPHeaderV21defaultAcceptLanguageACvpZ) `. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Accept-Language` value. | #### Return Value The header. * `[acceptEncoding(_:)](#/s:9Alamofire10HTTPHeaderV14acceptEncodingyACSSFZ) ` Returns an `Accept-Encoding` header. Alamofire offers a default accept encoding value that provides the most common values. Use `[HTTPHeader.defaultAcceptEncoding](../Structs/HTTPHeader.html#/s:9Alamofire10HTTPHeaderV21defaultAcceptEncodingACvpZ) `. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Accept-Encoding` value. | #### Return Value The header * `[authorization(username:password:)](#/s:9Alamofire10HTTPHeaderV13authorization8username8passwordACSS_SStFZ) ` Returns a `Basic` `Authorization` header using the `username` and `password` provided. #### Declaration #### Parameters | | | | --- | --- | | `_username_` | The username of the header. | | `_password_` | The password of the header. | #### Return Value The header. * `[authorization(bearerToken:)](#/s:9Alamofire10HTTPHeaderV13authorization11bearerTokenACSS_tFZ) ` Returns a `Bearer` `Authorization` header using the `bearerToken` provided. #### Declaration #### Parameters | | | | --- | --- | | `_bearerToken_` | The bearer token. | #### Return Value The header. * `[authorization(_:)](#/s:9Alamofire10HTTPHeaderV13authorizationyACSSFZ) ` Returns an `Authorization` header. Alamofire provides built-in methods to produce `Authorization` headers. For a Basic `Authorization` header use `[HTTPHeader.authorization(username:password:)](../Structs/HTTPHeader.html#/s:9Alamofire10HTTPHeaderV13authorization8username8passwordACSS_SStFZ) `. For a Bearer `Authorization` header, use `[HTTPHeader.authorization(bearerToken:)](../Structs/HTTPHeader.html#/s:9Alamofire10HTTPHeaderV13authorization11bearerTokenACSS_tFZ) `. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Authorization` value. | #### Return Value The header. * `[contentDisposition(_:)](#/s:9Alamofire10HTTPHeaderV18contentDispositionyACSSFZ) ` Returns a `Content-Disposition` header. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Content-Disposition` value. | #### Return Value The header. * `[contentEncoding(_:)](#/s:9Alamofire10HTTPHeaderV15contentEncodingyACSSFZ) ` Returns a `Content-Encoding` header. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Content-Encoding`. | #### Return Value The header. * `[contentType(_:)](#/s:9Alamofire10HTTPHeaderV11contentTypeyACSSFZ) ` Returns a `Content-Type` header. All Alamofire `[ParameterEncoding](../Protocols/ParameterEncoding.html) `s and `[ParameterEncoder](../Protocols/ParameterEncoder.html) `s set the `Content-Type` of the request, so it may not be necessary to manually set this value. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Content-Type` value. | #### Return Value The header. * `[userAgent(_:)](#/s:9Alamofire10HTTPHeaderV9userAgentyACSSFZ) ` Returns a `User-Agent` header. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `User-Agent` value. | #### Return Value The header. * `[websocketProtocol(_:)](#/s:9Alamofire10HTTPHeaderV17websocketProtocolyACSSFZ) ` Returns a `Sec-WebSocket-Protocol` header. #### Declaration #### Parameters | | | | --- | --- | | `_value_` | The `Sec-WebSocket-Protocol` value. | #### Return Value The header. [](#/Defaults) ### Defaults * `[defaultAcceptEncoding](#/s:9Alamofire10HTTPHeaderV21defaultAcceptEncodingACvpZ) ` Returns Alamofire’s default `Accept-Encoding` header, appropriate for the encodings supported by particular OS versions. See the [Accept-Encoding HTTP header documentation](https://tools.ietf.org/html/rfc7230#section-4.2.3) . #### Declaration * `[defaultAcceptLanguage](#/s:9Alamofire10HTTPHeaderV21defaultAcceptLanguageACvpZ) ` Returns Alamofire’s default `Accept-Language` header, generated by querying `Locale` for the user’s `preferredLanguages`. See the [Accept-Language HTTP header documentation](https://tools.ietf.org/html/rfc7231#section-5.3.5) . #### Declaration * `[defaultUserAgent](#/s:9Alamofire10HTTPHeaderV16defaultUserAgentACvpZ) ` Returns Alamofire’s default `User-Agent` header. See the [User-Agent header documentation](https://tools.ietf.org/html/rfc7231#section-5.5.3) . Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 13.0.0) Alamofire/5.0.0` #### Declaration --- # JSONEncoding Structure Reference 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`. * `[Error](#/s:9Alamofire12JSONEncodingV5ErrorO) ` Error produced by `[JSONEncoding](../Structs/JSONEncoding.html) `. [See more](../Structs/JSONEncoding/Error.html) #### Declaration [](#/Properties) ### Properties * `[default](#/s:9Alamofire12JSONEncodingV7defaultACvpZ) ` Returns a `JSONEncoding` instance with default writing options. #### Declaration * `[prettyPrinted](#/s:9Alamofire12JSONEncodingV13prettyPrintedACvpZ) ` Returns a `JSONEncoding` instance with `.prettyPrinted` writing options. #### Declaration * `[options](#/s:9Alamofire12JSONEncodingV7optionsSo20NSJSONWritingOptionsVvp) ` The options for writing the parameters as JSON data. #### Declaration [](#/Initialization) ### Initialization * `[init(options:)](#/s:9Alamofire12JSONEncodingV7optionsACSo20NSJSONWritingOptionsV_tcfc) ` Creates an instance using the specified `WritingOptions`. #### Declaration #### Parameters | | | | --- | --- | | `_options_` | `JSONSerialization.WritingOptions` to use. | [](#/Encoding) ### Encoding * `[encode(_:with:)](#/s:9Alamofire17ParameterEncodingP6encode_4with10Foundation10URLRequestVAA0G11Convertible_p_SDySSs8Sendable_pGSgtKF) ` #### Declaration * `[encode(_:withJSONObject:)](#/s:9Alamofire12JSONEncodingV6encode_14withJSONObject10Foundation10URLRequestVAA0G11Convertible_p_ypSgtKF) ` Encodes any JSON compatible object into a `URLRequest`. #### Declaration #### Parameters | | | | --- | --- | | `_urlRequest_` | `[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value into which the object will be encoded. | | `_jsonObject_` | `Any` value (must be JSON compatible) to be encoded into the `URLRequest`. `nil` by default. | #### Return Value The encoded `URLRequest`. --- # Error Enumeration Reference Error ===== Error produced by `[JSONEncoding](../../Structs/JSONEncoding.html) `. * `[invalidJSONObject](#/s:9Alamofire12JSONEncodingV5ErrorO17invalidJSONObjectyA2EmF) ` `[JSONEncoding](../../Structs/JSONEncoding.html) ` attempted to encode an invalid JSON object. Usually this means the value included types not representable in Objective-C. See `JSONSerialization.isValidJSONObject` for details. #### Declaration * `[localizedDescription](#/s:9Alamofire12JSONEncodingV5ErrorO20localizedDescriptionSSvp) ` Undocumented #### Declaration --- # PassthroughPreprocessor Structure Reference PassthroughPreprocessor ======================= `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` that returns passed `Data` without any transform. * `[init()](#/s:9Alamofire23PassthroughPreprocessorVACycfc) ` Creates an instance. #### Declaration * `[preprocess(_:)](#/s:9Alamofire16DataPreprocessorP10preprocessy10Foundation0B0VAGKF) ` #### Declaration --- # PassthroughStreamSerializer Structure Reference PassthroughStreamSerializer =========================== `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` which performs no serialization on incoming `Data`. * `[init()](#/s:9Alamofire27PassthroughStreamSerializerVACycfc) ` Creates an instance. #### Declaration * `[serialize(_:)](#/s:9Alamofire20DataStreamSerializerP9serializey16SerializedObjectQz10Foundation0B0VKF) ` #### Declaration --- # RequestAdapterState Structure Reference RequestAdapterState =================== Stores all state associated with a `URLRequest` being adapted. * `[requestID](#/s:9Alamofire19RequestAdapterStateV9requestID10Foundation4UUIDVvp) ` The `UUID` of the `[Request](../Classes/Request.html) ` associated with the `URLRequest` to adapt. #### Declaration * `[session](#/s:9Alamofire19RequestAdapterStateV7sessionAA7SessionCvp) ` The `[Session](../Classes/Session.html) ` associated with the `URLRequest` to adapt. #### Declaration --- # Behavior Enumeration Reference Behavior ======== Defines the behavior of the `[Redirector](../../Structs/Redirector.html) ` type. * `[follow](#/s:9Alamofire10RedirectorV8BehaviorO6followyA2EmF) ` Follow the redirect as defined in the response. #### Declaration * `[doNotFollow](#/s:9Alamofire10RedirectorV8BehaviorO11doNotFollowyA2EmF) ` Do not follow the redirect defined in the response. #### Declaration * `[modify(_:)](#/s:9Alamofire10RedirectorV8BehaviorO6modifyyAE10Foundation10URLRequestVSgSo16NSURLSessionTaskC_AISo17NSHTTPURLResponseCtYbccAEmF) ` Modify the redirect request defined in the response. #### Declaration --- # ResponseCacher Structure Reference ResponseCacher ============== `ResponseCacher` is a convenience `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) ` making it easy to cache, not cache, or modify a cached response. * `[Behavior](#/s:9Alamofire14ResponseCacherV8BehaviorO) ` Defines the behavior of the `[ResponseCacher](../Structs/ResponseCacher.html) ` type. [See more](../Structs/ResponseCacher/Behavior.html) #### Declaration * `[cache](#/s:9Alamofire14ResponseCacherV5cacheACvpZ) ` Returns a `ResponseCacher` with a `.cache` `[Behavior](../Structs/ResponseCacher/Behavior.html) `. #### Declaration * `[doNotCache](#/s:9Alamofire14ResponseCacherV10doNotCacheACvpZ) ` Returns a `ResponseCacher` with a `.doNotCache` `[Behavior](../Structs/ResponseCacher/Behavior.html) `. #### Declaration * `[behavior](#/s:9Alamofire14ResponseCacherV8behaviorAC8BehaviorOvp) ` The `[Behavior](../Structs/ResponseCacher/Behavior.html) ` of the `ResponseCacher`. #### Declaration * `[init(behavior:)](#/s:9Alamofire14ResponseCacherV8behaviorA2C8BehaviorO_tcfc) ` Creates a `ResponseCacher` instance from the `[Behavior](../Structs/ResponseCacher/Behavior.html) `. #### Declaration #### Parameters | | | | --- | --- | | `_behavior_` | The `[Behavior](../Structs/ResponseCacher/Behavior.html) `. | * `[dataTask(_:willCacheResponse:completion:)](#/s:9Alamofire21CachedResponseHandlerP8dataTask_09willCacheC010completionySo016NSURLSessionDataF0C_So19NSCachedURLResponseCyAJSgctF) ` #### Declaration ---