Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mattt
Last active April 9, 2020 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattt/803e1c4f6a0efee600e7ac339f4137a6 to your computer and use it in GitHub Desktop.
Save mattt/803e1c4f6a0efee600e7ac339f4137a6 to your computer and use it in GitHub Desktop.
Extremely early proof-of-concept Markdown document generation output for swift-doc
{
"/Users/mattt/Desktop/Alamofire.swift" : {
"deinitializers" : [],
"functions" : [
{
"declaration" : {
"name" : "request",
"genericRequirements" : [],
"signature" : {
"output" : "DataRequest",
"input" : [
{
"firstName" : "_",
"attributes" : [],
"type" : "URLConvertible",
"secondName" : "url"
},
{
"defaultArgument" : ".get",
"type" : "HTTPMethod",
"firstName" : "method",
"attributes" : []
},
{
"defaultArgument" : "nil",
"type" : "Parameters?",
"firstName" : "parameters",
"attributes" : []
},
{
"defaultArgument" : "URLEncoding.default",
"attributes" : [],
"firstName" : "encoding",
"type" : "ParameterEncoding"
},
{
"defaultArgument" : "nil",
"firstName" : "headers",
"attributes" : [],
"type" : "HTTPHeaders?"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"firstName" : "interceptor",
"attributes" : []
}
]
},
"attributes" : [],
"keyword" : "func",
"genericParameters" : [],
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"context" : "AF"
},
"location" : {
"column" : 38,
"line" : 30
},
"documentation" : [
[
"summary",
"Creates a `DataRequest` using `Session.default` to retrieve the contents of the specified `url` using the\n`method`, `parameters`, `encoding`, and `headers` provided.\n"
],
[
"parameters",
{
"parameters" : "The `Parameters`, `nil` by default.",
"interceptor" : "The `RequestInterceptor`, `nil` by default.",
"url" : "The `URLConvertible` value.",
"encoding" : "The `ParameterEncoding`, `URLEncoding.default` by default.",
"method" : "The `HTTPMethod`, `.get` by default.",
"headers" : "The `HTTPHeaders`, `nil` by default."
}
],
[
"field",
"returns",
"The created `DataRequest`."
]
]
},
{
"documentation" : [
[
"summary",
"Creates a `DataRequest` using `Session.default` to retrieve the contents of the specified `url` using the\n`method`, `parameters`, `encoding`, and `headers` provided.\n"
],
[
"parameters",
{
"interceptor" : "The `RequestInterceptor`, `nil` by default.",
"parameters" : "The `Encodable` parameters, `nil` by default.",
"url" : "The `URLConvertible` value.",
"headers" : "The `HTTPHeaders`, `nil` by default.",
"method" : "The `HTTPMethod`, `.get` by default.",
"encoding" : "The `ParameterEncoder`, `URLEncodedFormParameterEncoder.default` by default."
}
],
[
"field",
"returns",
"The created `DataRequest`."
]
],
"location" : {
"line" : 58,
"column" : 6
},
"declaration" : {
"signature" : {
"output" : "DataRequest",
"input" : [
{
"secondName" : "url",
"attributes" : [],
"firstName" : "_",
"type" : "URLConvertible"
},
{
"type" : "HTTPMethod",
"firstName" : "method",
"attributes" : [],
"defaultArgument" : ".get"
},
{
"defaultArgument" : "nil",
"attributes" : [],
"firstName" : "parameters",
"type" : "Parameters?"
},
{
"defaultArgument" : "URLEncodedFormParameterEncoder.default",
"attributes" : [],
"firstName" : "encoder",
"type" : "ParameterEncoder"
},
{
"defaultArgument" : "nil",
"firstName" : "headers",
"attributes" : [],
"type" : "HTTPHeaders?"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"attributes" : [],
"firstName" : "interceptor"
}
]
},
"attributes" : [],
"keyword" : "func",
"genericRequirements" : [],
"name" : "request",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [
{
"firstName" : "Parameters",
"attributes" : [],
"type" : "Encodable"
}
],
"context" : "AF"
}
},
{
"declaration" : {
"attributes" : [],
"signature" : {
"output" : "DataRequest",
"input" : [
{
"secondName" : "urlRequest",
"attributes" : [],
"firstName" : "_",
"type" : "URLRequestConvertible"
},
{
"firstName" : "interceptor",
"attributes" : [],
"type" : "RequestInterceptor?",
"defaultArgument" : "nil"
}
]
},
"keyword" : "func",
"genericRequirements" : [],
"name" : "request",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"context" : "AF"
},
"location" : {
"column" : 6,
"line" : 84
},
"documentation" : [
[
"summary",
"Creates a `DataRequest` using `Session.default` to execute the specified `urlRequest`.\n"
],
[
"parameters",
{
"urlRequest" : "The `URLRequestConvertible` value.",
"interceptor" : "The `RequestInterceptor`, `nil` by default."
}
],
[
"field",
"returns",
"The created `DataRequest`."
]
]
},
{
"declaration" : {
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"context" : "AF",
"attributes" : [],
"signature" : {
"output" : "DownloadRequest",
"input" : [
{
"firstName" : "_",
"attributes" : [],
"type" : "URLConvertible",
"secondName" : "url"
},
{
"defaultArgument" : ".get",
"firstName" : "method",
"attributes" : [],
"type" : "HTTPMethod"
},
{
"firstName" : "parameters",
"attributes" : [],
"type" : "Parameters?",
"defaultArgument" : "nil"
},
{
"type" : "ParameterEncoding",
"firstName" : "encoding",
"attributes" : [],
"defaultArgument" : "URLEncoding.default"
},
{
"firstName" : "headers",
"attributes" : [],
"type" : "HTTPHeaders?",
"defaultArgument" : "nil"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"attributes" : [],
"firstName" : "interceptor"
},
{
"secondName" : "destination",
"defaultArgument" : "nil",
"firstName" : "to",
"attributes" : [],
"type" : "DownloadRequest.Destination?"
}
]
},
"keyword" : "func",
"genericRequirements" : [],
"name" : "download"
},
"location" : {
"column" : 6,
"line" : 95
},
"documentation" : [
[
"summary",
"Creates a `DownloadRequest` using `Session.default` to download the contents of the specified `url` to\nthe provided `destination` using the `method`, `parameters`, `encoding`, and `headers` provided.\n"
],
[
"discussion",
"If `destination` is not specified, the download will be moved to a temporary location determined by Alamofire.\n"
],
[
"parameters",
{
"interceptor" : "The `RequestInterceptor`, `nil` by default.",
"parameters" : "The `Parameters`, `nil` by default.",
"url" : "The `URLConvertible` value.",
"method" : "The `HTTPMethod`, `.get` by default.",
"encoding" : "The `ParameterEncoding`, `URLEncoding.default` by default.",
"headers" : "The `HTTPHeaders`, `nil` by default.",
"destination" : "The `DownloadRequest.Destination` closure used the determine the destination of the"
}
],
[
"field",
"returns",
"The created `DownloadRequest`."
]
]
},
{
"location" : {
"column" : 6,
"line" : 129
},
"declaration" : {
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [
{
"firstName" : "Parameters",
"attributes" : [],
"type" : "Encodable"
}
],
"context" : "AF",
"name" : "download",
"genericRequirements" : [],
"signature" : {
"output" : "DownloadRequest",
"input" : [
{
"type" : "URLConvertible",
"attributes" : [],
"firstName" : "_",
"secondName" : "url"
},
{
"defaultArgument" : ".get",
"attributes" : [],
"firstName" : "method",
"type" : "HTTPMethod"
},
{
"firstName" : "parameters",
"attributes" : [],
"type" : "Parameters?",
"defaultArgument" : "nil"
},
{
"defaultArgument" : "URLEncodedFormParameterEncoder.default",
"type" : "ParameterEncoder",
"attributes" : [],
"firstName" : "encoder"
},
{
"firstName" : "headers",
"attributes" : [],
"type" : "HTTPHeaders?",
"defaultArgument" : "nil"
},
{
"attributes" : [],
"firstName" : "interceptor",
"type" : "RequestInterceptor?",
"defaultArgument" : "nil"
},
{
"secondName" : "destination",
"defaultArgument" : "nil",
"attributes" : [],
"firstName" : "to",
"type" : "DownloadRequest.Destination?"
}
]
},
"attributes" : [],
"keyword" : "func"
},
"documentation" : [
[
"summary",
"Creates a `DownloadRequest` using `Session.default` to download the contents of the specified `url` to the\nprovided `destination` using the `method`, encodable `parameters`, `encoder`, and `headers` provided.\n"
],
[
"field",
"note",
"If `destination` is not specified, the download will be moved to a temporary location determined by\nAlamofire."
],
[
"parameters",
{
"url" : "The `URLConvertible` value.",
"destination" : "The `DownloadRequest.Destination` closure used the determine the destination of the",
"headers" : "The `HTTPHeaders`, `nil` by default.",
"method" : "The `HTTPMethod`, `.get` by default.",
"parameters" : "The `Encodable` parameters, `nil` by default.",
"interceptor" : "The `RequestInterceptor`, `nil` by default.",
"encoder" : "The `ParameterEncoder`, `URLEncodedFormParameterEncoder.default` by default."
}
],
[
"field",
"returns",
"The created `DownloadRequest`."
]
]
},
{
"location" : {
"column" : 6,
"line" : 162
},
"declaration" : {
"genericRequirements" : [],
"name" : "download",
"signature" : {
"input" : [
{
"secondName" : "urlRequest",
"type" : "URLRequestConvertible",
"firstName" : "_",
"attributes" : []
},
{
"attributes" : [],
"firstName" : "interceptor",
"type" : "RequestInterceptor?",
"defaultArgument" : "nil"
},
{
"type" : "DownloadRequest.Destination?",
"firstName" : "to",
"attributes" : [],
"secondName" : "destination",
"defaultArgument" : "nil"
}
],
"output" : "DownloadRequest"
},
"attributes" : [],
"keyword" : "func",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"context" : "AF"
},
"documentation" : [
[
"summary",
"Creates a `DownloadRequest` using `Session.default` to execute the specified `urlRequest` and download\nthe result to the provided `destination`.\n"
],
[
"parameters",
{
"urlRequest" : "The `URLRequestConvertible` value.",
"interceptor" : "The `RequestInterceptor`, `nil` by default.",
"destination" : "The `DownloadRequest.Destination` closure used the determine the destination of the"
}
],
[
"field",
"returns",
"The created `DownloadRequest`."
]
]
},
{
"documentation" : [
[
"summary",
"Creates a `DownloadRequest` using the `Session.default` from the `resumeData` produced from a previous\n`DownloadRequest` cancellation to retrieve the contents of the original request and save them to the `destination`.\n"
],
[
"field",
"note",
"If `destination` is not specified, the download will be moved to a temporary location determined by\nAlamofire."
],
[
"field",
"note",
"On some versions of all Apple platforms (iOS 10 - 10.2, macOS 10.12 - 10.12.2, tvOS 10 - 10.1, watchOS 3 - 3.1.1),\n`resumeData` is broken on background URL session configurations. There's an underlying bug in the `resumeData`\ngeneration logic where the data is written incorrectly and will always fail to resume the download. For more\ninformation about the bug and possible workarounds, please refer to the [this Stack Overflow post](http://stackoverflow.com/a/39347461/1342462)."
],
[
"parameters",
{
"interceptor" : "The `RequestInterceptor`, `nil` by default.",
"destination" : "The `DownloadRequest.Destination` closure used to determine the destination of the downloaded",
"resumeData" : "The resume `Data`. This is an opaque blob produced by `URLSessionDownloadTask` when a task is"
}
],
[
"field",
"returns",
"The created `DownloadRequest`."
]
],
"location" : {
"line" : 180,
"column" : 6
},
"declaration" : {
"keyword" : "func",
"signature" : {
"output" : "DownloadRequest",
"input" : [
{
"secondName" : "resumeData",
"attributes" : [],
"firstName" : "resumingWith",
"type" : "Data"
},
{
"firstName" : "interceptor",
"attributes" : [],
"type" : "RequestInterceptor?",
"defaultArgument" : "nil"
},
{
"secondName" : "destination",
"defaultArgument" : "nil",
"attributes" : [],
"firstName" : "to",
"type" : "DownloadRequest.Destination?"
}
]
},
"attributes" : [],
"name" : "download",
"genericRequirements" : [],
"context" : "AF",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : []
}
},
{
"location" : {
"line" : 208,
"column" : 6
},
"declaration" : {
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"context" : "AF",
"genericRequirements" : [],
"name" : "upload",
"signature" : {
"output" : "UploadRequest",
"input" : [
{
"secondName" : "data",
"firstName" : "_",
"attributes" : [],
"type" : "Data"
},
{
"secondName" : "convertible",
"firstName" : "to",
"attributes" : [],
"type" : "URLConvertible"
},
{
"defaultArgument" : ".post",
"attributes" : [],
"firstName" : "method",
"type" : "HTTPMethod"
},
{
"defaultArgument" : "nil",
"firstName" : "headers",
"attributes" : [],
"type" : "HTTPHeaders?"
},
{
"defaultArgument" : "nil",
"attributes" : [],
"firstName" : "interceptor",
"type" : "RequestInterceptor?"
},
{
"type" : "FileManager",
"firstName" : "fileManager",
"attributes" : [],
"defaultArgument" : ".default"
}
]
},
"attributes" : [],
"keyword" : "func"
},
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the given `Data`, `URLRequest` components, and `RequestInterceptor`.\n"
],
[
"parameters",
{
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"convertible" : "`URLConvertible` value to be used as the `URLRequest`'s `URL`.",
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by",
"method" : "`HTTPMethod` for the `URLRequest`. `.post` by default.",
"headers" : "`HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.",
"data" : "The `Data` to upload."
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
]
},
{
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the given `Data` using the `URLRequestConvertible` value and `RequestInterceptor`.\n"
],
[
"parameters",
{
"data" : "The `Data` to upload.",
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by",
"convertible" : "`URLRequestConvertible` value to be used to create the `URLRequest`.",
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default."
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
],
"declaration" : {
"context" : "AF",
"genericParameters" : [],
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericRequirements" : [],
"name" : "upload",
"keyword" : "func",
"signature" : {
"input" : [
{
"secondName" : "data",
"type" : "Data",
"attributes" : [],
"firstName" : "_"
},
{
"type" : "URLRequestConvertible",
"firstName" : "with",
"attributes" : [],
"secondName" : "convertible"
},
{
"firstName" : "interceptor",
"attributes" : [],
"type" : "RequestInterceptor?",
"defaultArgument" : "nil"
},
{
"defaultArgument" : ".default",
"type" : "FileManager",
"attributes" : [],
"firstName" : "fileManager"
}
],
"output" : "UploadRequest"
},
"attributes" : []
},
"location" : {
"column" : 6,
"line" : 238
}
},
{
"declaration" : {
"name" : "upload",
"genericRequirements" : [],
"keyword" : "func",
"signature" : {
"output" : "UploadRequest",
"input" : [
{
"secondName" : "fileURL",
"type" : "URL",
"firstName" : "_",
"attributes" : []
},
{
"secondName" : "convertible",
"type" : "URLConvertible",
"firstName" : "to",
"attributes" : []
},
{
"defaultArgument" : ".post",
"firstName" : "method",
"attributes" : [],
"type" : "HTTPMethod"
},
{
"defaultArgument" : "nil",
"type" : "HTTPHeaders?",
"attributes" : [],
"firstName" : "headers"
},
{
"type" : "RequestInterceptor?",
"attributes" : [],
"firstName" : "interceptor",
"defaultArgument" : "nil"
},
{
"attributes" : [],
"firstName" : "fileManager",
"type" : "FileManager",
"defaultArgument" : ".default"
}
]
},
"attributes" : [],
"context" : "AF",
"genericParameters" : [],
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
]
},
"location" : {
"line" : 255,
"column" : 6
},
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the file at the given file `URL`, using a `URLRequest` from the provided\ncomponents and `RequestInterceptor`.\n"
],
[
"parameters",
{
"fileURL" : "The `URL` of the file to upload.",
"method" : "`HTTPMethod` for the `URLRequest`. `.post` by default.",
"headers" : "`HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.",
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by",
"interceptor" : "`RequestInterceptor` value to be used by the returned `UploadRequest`. `nil` by default.",
"convertible" : "`URLConvertible` value to be used as the `URLRequest`'s `URL`."
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
]
},
{
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the file at the given file `URL` using the `URLRequestConvertible` value and\n`RequestInterceptor`.\n"
],
[
"parameters",
{
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"convertible" : "`URLRequestConvertible` value to be used to create the `URLRequest`.",
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by",
"fileURL" : "The `URL` of the file to upload."
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
],
"location" : {
"line" : 284,
"column" : 6
},
"declaration" : {
"signature" : {
"output" : "UploadRequest",
"input" : [
{
"secondName" : "fileURL",
"attributes" : [],
"firstName" : "_",
"type" : "URL"
},
{
"type" : "URLRequestConvertible",
"firstName" : "with",
"attributes" : [],
"secondName" : "convertible"
},
{
"defaultArgument" : "nil",
"firstName" : "interceptor",
"attributes" : [],
"type" : "RequestInterceptor?"
},
{
"defaultArgument" : ".default",
"type" : "FileManager",
"attributes" : [],
"firstName" : "fileManager"
}
]
},
"attributes" : [],
"keyword" : "func",
"genericRequirements" : [],
"name" : "upload",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"context" : "AF"
}
},
{
"documentation" : [
[
"summary",
"Creates an `UploadRequest` from the `InputStream` provided using a `URLRequest` from the provided components and\n`RequestInterceptor`.\n"
],
[
"parameters",
{
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by",
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"convertible" : "`URLConvertible` value to be used as the `URLRequest`'s `URL`.",
"stream" : "The `InputStream` that provides the data to upload.",
"method" : "`HTTPMethod` for the `URLRequest`. `.post` by default.",
"headers" : "`HTTPHeaders` value to be added to the `URLRequest`. `nil` by default."
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
],
"location" : {
"line" : 302,
"column" : 6
},
"declaration" : {
"context" : "AF",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"keyword" : "func",
"attributes" : [],
"signature" : {
"input" : [
{
"type" : "InputStream",
"attributes" : [],
"firstName" : "_",
"secondName" : "stream"
},
{
"type" : "URLConvertible",
"attributes" : [],
"firstName" : "to",
"secondName" : "convertible"
},
{
"defaultArgument" : ".post",
"type" : "HTTPMethod",
"attributes" : [],
"firstName" : "method"
},
{
"type" : "HTTPHeaders?",
"firstName" : "headers",
"attributes" : [],
"defaultArgument" : "nil"
},
{
"type" : "RequestInterceptor?",
"firstName" : "interceptor",
"attributes" : [],
"defaultArgument" : "nil"
},
{
"firstName" : "fileManager",
"attributes" : [],
"type" : "FileManager",
"defaultArgument" : ".default"
}
],
"output" : "UploadRequest"
},
"genericRequirements" : [],
"name" : "upload"
}
},
{
"documentation" : [
[
"summary",
"Creates an `UploadRequest` from the provided `InputStream` using the `URLRequestConvertible` value and\n`RequestInterceptor`.\n"
],
[
"parameters",
{
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"stream" : "The `InputStream` that provides the data to upload.",
"convertible" : "`URLRequestConvertible` value to be used to create the `URLRequest`.",
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by"
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
],
"declaration" : {
"attributes" : [],
"signature" : {
"output" : "UploadRequest",
"input" : [
{
"secondName" : "stream",
"attributes" : [],
"firstName" : "_",
"type" : "InputStream"
},
{
"attributes" : [],
"firstName" : "with",
"type" : "URLRequestConvertible",
"secondName" : "convertible"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"attributes" : [],
"firstName" : "interceptor"
},
{
"firstName" : "fileManager",
"attributes" : [],
"type" : "FileManager",
"defaultArgument" : ".default"
}
]
},
"keyword" : "func",
"name" : "upload",
"genericRequirements" : [],
"genericParameters" : [],
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"context" : "AF"
},
"location" : {
"line" : 331,
"column" : 6
}
},
{
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the multipart form data built using a closure and sent using the provided\n`URLRequest` components and `RequestInterceptor`.\n"
],
[
"discussion",
"It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\npayload is small, encoding the data in-memory and directly uploading to a server is the by far the most\nefficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\nbe terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\nfootprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\nused for larger payloads such as video content.\n"
],
[
"discussion",
"The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\nor stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\nencoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\nduring the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\ntechnique was used.\n"
],
[
"parameters",
{
"multipartFormData" : "`MultipartFormData` building closure.",
"headers" : "`HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.",
"method" : "`HTTPMethod` for the `URLRequest`. `.post` by default.",
"convertible" : "`URLConvertible` value to be used as the `URLRequest`'s `URL`.",
"encodingMemoryThreshold" : "Byte threshold used to determine whether the form data is encoded into memory or",
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"fileManager" : "`FileManager` to be used if the form data exceeds the memory threshold and is"
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
],
"location" : {
"column" : 6,
"line" : 349
},
"declaration" : {
"context" : "AF",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : [],
"keyword" : "func",
"attributes" : [],
"signature" : {
"input" : [
{
"type" : "@escaping (MultipartFormData) -> Void",
"firstName" : "multipartFormData",
"attributes" : []
},
{
"firstName" : "to",
"attributes" : [],
"type" : "URLConvertible",
"secondName" : "url"
},
{
"secondName" : "encodingMemoryThreshold",
"defaultArgument" : "MultipartFormData.encodingMemoryThreshold",
"attributes" : [],
"firstName" : "usingThreshold",
"type" : "UInt64"
},
{
"attributes" : [],
"firstName" : "method",
"type" : "HTTPMethod",
"defaultArgument" : ".post"
},
{
"defaultArgument" : "nil",
"attributes" : [],
"firstName" : "headers",
"type" : "HTTPHeaders?"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"attributes" : [],
"firstName" : "interceptor"
},
{
"defaultArgument" : ".default",
"attributes" : [],
"firstName" : "fileManager",
"type" : "FileManager"
}
],
"output" : "UploadRequest"
},
"name" : "upload",
"genericRequirements" : []
}
},
{
"location" : {
"column" : 6,
"line" : 396
},
"declaration" : {
"keyword" : "func",
"attributes" : [],
"signature" : {
"input" : [
{
"firstName" : "multipartFormData",
"attributes" : [],
"type" : "@escaping (MultipartFormData) -> Void"
},
{
"firstName" : "with",
"attributes" : [],
"type" : "URLRequestConvertible",
"secondName" : "request"
},
{
"type" : "UInt64",
"firstName" : "usingThreshold",
"attributes" : [],
"defaultArgument" : "MultipartFormData.encodingMemoryThreshold",
"secondName" : "encodingMemoryThreshold"
},
{
"type" : "RequestInterceptor?",
"attributes" : [],
"firstName" : "interceptor",
"defaultArgument" : "nil"
},
{
"defaultArgument" : ".default",
"type" : "FileManager",
"firstName" : "fileManager",
"attributes" : []
}
],
"output" : "UploadRequest"
},
"genericRequirements" : [],
"name" : "upload",
"context" : "AF",
"genericParameters" : [],
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
]
},
"documentation" : [
[
"summary",
"Creates an `UploadRequest` using a `MultipartFormData` building closure, the provided `URLRequestConvertible`\nvalue, and a `RequestInterceptor`.\n"
],
[
"discussion",
"It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\npayload is small, encoding the data in-memory and directly uploading to a server is the by far the most\nefficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\nbe terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\nfootprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\nused for larger payloads such as video content.\n"
],
[
"discussion",
"The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\nor stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\nencoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\nduring the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\ntechnique was used.\n"
],
[
"parameters",
{
"multipartFormData" : "`MultipartFormData` building closure.",
"request" : "`URLRequestConvertible` value to be used to create the `URLRequest`.",
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"encodingMemoryThreshold" : "Byte threshold used to determine whether the form data is encoded into memory or",
"fileManager" : "`FileManager` to be used if the form data exceeds the memory threshold and is"
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
]
},
{
"declaration" : {
"keyword" : "func",
"signature" : {
"output" : "UploadRequest",
"input" : [
{
"type" : "MultipartFormData",
"firstName" : "multipartFormData",
"attributes" : []
},
{
"firstName" : "to",
"attributes" : [],
"type" : "URLConvertible",
"secondName" : "url"
},
{
"defaultArgument" : "MultipartFormData.encodingMemoryThreshold",
"secondName" : "encodingMemoryThreshold",
"firstName" : "usingThreshold",
"attributes" : [],
"type" : "UInt64"
},
{
"firstName" : "method",
"attributes" : [],
"type" : "HTTPMethod",
"defaultArgument" : ".post"
},
{
"type" : "HTTPHeaders?",
"attributes" : [],
"firstName" : "headers",
"defaultArgument" : "nil"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"firstName" : "interceptor",
"attributes" : []
},
{
"defaultArgument" : ".default",
"type" : "FileManager",
"firstName" : "fileManager",
"attributes" : []
}
]
},
"attributes" : [],
"name" : "upload",
"genericRequirements" : [],
"context" : "AF",
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"genericParameters" : []
},
"location" : {
"column" : 6,
"line" : 435
},
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the prebuilt `MultipartFormData` value using the provided `URLRequest` components\nand `RequestInterceptor`.\n"
],
[
"discussion",
"It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\npayload is small, encoding the data in-memory and directly uploading to a server is the by far the most\nefficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\nbe terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\nfootprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\nused for larger payloads such as video content.\n"
],
[
"discussion",
"The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\nor stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\nencoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\nduring the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\ntechnique was used.\n"
],
[
"parameters",
{
"fileManager" : "`FileManager` to be used if the form data exceeds the memory threshold and is",
"encodingMemoryThreshold" : "Byte threshold used to determine whether the form data is encoded into memory or",
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"url" : "`URLConvertible` value to be used as the `URLRequest`'s `URL`.",
"multipartFormData" : "`MultipartFormData` instance to upload.",
"headers" : "`HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.",
"method" : "`HTTPMethod` for the `URLRequest`. `.post` by default."
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
]
},
{
"documentation" : [
[
"summary",
"Creates an `UploadRequest` for the prebuilt `MultipartFormData` value using the providing `URLRequestConvertible`\nvalue and `RequestInterceptor`.\n"
],
[
"discussion",
"It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\npayload is small, encoding the data in-memory and directly uploading to a server is the by far the most\nefficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\nbe terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\nfootprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\nused for larger payloads such as video content.\n"
],
[
"discussion",
"The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\nor stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\nencoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\nduring the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\ntechnique was used.\n"
],
[
"parameters",
{
"multipartFormData" : "`MultipartFormData` instance to upload.",
"encodingMemoryThreshold" : "Byte threshold used to determine whether the form data is encoded into memory or",
"interceptor" : "`RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.",
"request" : "`URLRequestConvertible` value to be used to create the `URLRequest`.",
"fileManager" : "`FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by"
}
],
[
"field",
"returns",
"The created `UploadRequest`."
]
],
"declaration" : {
"signature" : {
"input" : [
{
"type" : "MultipartFormData",
"attributes" : [],
"firstName" : "multipartFormData"
},
{
"secondName" : "request",
"firstName" : "with",
"attributes" : [],
"type" : "URLRequestConvertible"
},
{
"attributes" : [],
"firstName" : "usingThreshold",
"type" : "UInt64",
"defaultArgument" : "MultipartFormData.encodingMemoryThreshold",
"secondName" : "encodingMemoryThreshold"
},
{
"defaultArgument" : "nil",
"type" : "RequestInterceptor?",
"firstName" : "interceptor",
"attributes" : []
},
{
"firstName" : "fileManager",
"attributes" : [],
"type" : "FileManager",
"defaultArgument" : ".default"
}
],
"output" : "UploadRequest"
},
"attributes" : [],
"keyword" : "func",
"genericRequirements" : [],
"name" : "upload",
"genericParameters" : [],
"modifiers" : [
{
"name" : "public"
},
{
"name" : "static"
}
],
"context" : "AF"
},
"location" : {
"column" : 6,
"line" : 480
}
}
],
"subscripts" : [],
"classes" : [],
"enumerations" : [
{
"declaration" : {
"attributes" : [],
"modifiers" : [
{
"name" : "public"
}
],
"cases" : [],
"keyword" : "enum",
"name" : "AF"
},
"location" : {
"column" : 18,
"line" : 25
},
"documentation" : [
[
"summary",
"Global namespace containing API for the `default` `Session` instance.\n"
]
]
}
],
"initializers" : [],
"precedenceGroups" : [],
"associatedTypes" : [],
"typealiases" : [],
"structures" : [],
"url" : "file:///Users/mattt/Desktop/Alamofire.swift",
"variables" : [
{
"location" : {
"column" : 17,
"line" : 28
},
"declaration" : {
"context" : "AF",
"initializedValue" : "\"5.0.0-rc.3\"",
"keyword" : "let",
"attributes" : [],
"modifiers" : [
{
"name" : "static"
}
],
"name" : "version "
},
"documentation" : [
[
"summary",
"Current Alamofire version. Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.\n"
]
]
}
],
"protocols" : []
}
}

Functions

download(_:interceptor:to:)

public static func download(
  _ urlRequest: URLRequestConvertible, interceptor: RequestInterceptor? = nil,
  to destination: DownloadRequest.Destination? = nil
) -> DownloadRequest

Creates a DownloadRequest using Session.default to execute the specified urlRequest and download the result to the provided destination.

Parameters

  • urlRequest: The URLRequestConvertible value.
  • interceptor: The RequestInterceptor, nil by default.
  • destination: The DownloadRequest.Destination closure used the determine the destination of the

Returns

The created DownloadRequest.


download(_:method:parameters:encoder:headers:interceptor:to:)

public static func download<Parameters: Encodable>(
  _ url: URLConvertible, method: HTTPMethod = .get, parameters: Parameters? = nil,
  encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default, headers: HTTPHeaders? = nil,
  interceptor: RequestInterceptor? = nil, to destination: DownloadRequest.Destination? = nil
) -> DownloadRequest

Creates a DownloadRequest using Session.default to download the contents of the specified url to the provided destination using the method, encodable parameters, encoder, and headers provided.

Note: If destination is not specified, the download will be moved to a temporary location determined by Alamofire.

Parameters

  • url: The URLConvertible value.
  • method: The HTTPMethod, .get by default.
  • parameters: The Encodable parameters, nil by default.
  • encoder: The ParameterEncoder, URLEncodedFormParameterEncoder.default by default.
  • headers: The HTTPHeaders, nil by default.
  • interceptor: The RequestInterceptor, nil by default.
  • destination: The DownloadRequest.Destination closure used the determine the destination of the

Returns

The created DownloadRequest.


download(_:method:parameters:encoding:headers:interceptor:to:)

public static func download(
  _ url: URLConvertible, method: HTTPMethod = .get, parameters: Parameters? = nil,
  encoding: ParameterEncoding = URLEncoding.default, headers: HTTPHeaders? = nil,
  interceptor: RequestInterceptor? = nil, to destination: DownloadRequest.Destination? = nil
) -> DownloadRequest

Creates a DownloadRequest using Session.default to download the contents of the specified url to the provided destination using the method, parameters, encoding, and headers provided.

If destination is not specified, the download will be moved to a temporary location determined by Alamofire.

Parameters

  • url: The URLConvertible value.
  • method: The HTTPMethod, .get by default.
  • parameters: The Parameters, nil by default.
  • encoding: The ParameterEncoding, URLEncoding.default by default.
  • headers: The HTTPHeaders, nil by default.
  • interceptor: The RequestInterceptor, nil by default.
  • destination: The DownloadRequest.Destination closure used the determine the destination of the

Returns

The created DownloadRequest.


download(resumingWith:interceptor:to:)

public static func download(
  resumingWith resumeData: Data, interceptor: RequestInterceptor? = nil,
  to destination: DownloadRequest.Destination? = nil
) -> DownloadRequest

Creates a DownloadRequest using the Session.default from the resumeData produced from a previous DownloadRequest cancellation to retrieve the contents of the original request and save them to the destination.

Note: If destination is not specified, the download will be moved to a temporary location determined by Alamofire.

Note: On some versions of all Apple platforms (iOS 10 - 10.2, macOS 10.12 - 10.12.2, tvOS 10 - 10.1, watchOS 3 - 3.1.1), resumeData is broken on background URL session configurations. There's an underlying bug in the resumeData generation logic where the data is written incorrectly and will always fail to resume the download. For more information about the bug and possible workarounds, please refer to the this Stack Overflow post.

Parameters

  • resumeData: The resume Data. This is an opaque blob produced by URLSessionDownloadTask when a task is
  • interceptor: The RequestInterceptor, nil by default.
  • destination: The DownloadRequest.Destination closure used to determine the destination of the downloaded

Returns

The created DownloadRequest.


request(_:interceptor:)

public static func request(
  _ urlRequest: URLRequestConvertible, interceptor: RequestInterceptor? = nil
) -> DataRequest

Creates a DataRequest using Session.default to execute the specified urlRequest.

Parameters

  • urlRequest: The URLRequestConvertible value.
  • interceptor: The RequestInterceptor, nil by default.

Returns

The created DataRequest.


request(_:method:parameters:encoder:headers:interceptor:)

public static func request<Parameters: Encodable>(
  _ url: URLConvertible, method: HTTPMethod = .get, parameters: Parameters? = nil,
  encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default, headers: HTTPHeaders? = nil,
  interceptor: RequestInterceptor? = nil
) -> DataRequest

Creates a DataRequest using Session.default to retrieve the contents of the specified url using the method, parameters, encoding, and headers provided.

Parameters

  • url: The URLConvertible value.
  • method: The HTTPMethod, .get by default.
  • parameters: The Encodable parameters, nil by default.
  • encoding: The ParameterEncoder, URLEncodedFormParameterEncoder.default by default.
  • headers: The HTTPHeaders, nil by default.
  • interceptor: The RequestInterceptor, nil by default.

Returns

The created DataRequest.


request(_:method:parameters:encoding:headers:interceptor:)

public static func request(
  _ url: URLConvertible, method: HTTPMethod = .get, parameters: Parameters? = nil,
  encoding: ParameterEncoding = URLEncoding.default, headers: HTTPHeaders? = nil,
  interceptor: RequestInterceptor? = nil
) -> DataRequest

Creates a DataRequest using Session.default to retrieve the contents of the specified url using the method, parameters, encoding, and headers provided.

Parameters

  • url: The URLConvertible value.
  • method: The HTTPMethod, .get by default.
  • parameters: The Parameters, nil by default.
  • encoding: The ParameterEncoding, URLEncoding.default by default.
  • headers: The HTTPHeaders, nil by default.
  • interceptor: The RequestInterceptor, nil by default.

Returns

The created DataRequest.


upload(_:to:method:headers:interceptor:fileManager:)

public static func upload(
  _ data: Data, to convertible: URLConvertible, method: HTTPMethod = .post,
  headers: HTTPHeaders? = nil, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the given Data, URLRequest components, and RequestInterceptor.

Parameters

  • data: The Data to upload.
  • convertible: URLConvertible value to be used as the URLRequest's URL.
  • method: HTTPMethod for the URLRequest. .post by default.
  • headers: HTTPHeaders value to be added to the URLRequest. nil by default.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


upload(_:to:method:headers:interceptor:fileManager:)

public static func upload(
  _ fileURL: URL, to convertible: URLConvertible, method: HTTPMethod = .post,
  headers: HTTPHeaders? = nil, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the file at the given file URL, using a URLRequest from the provided components and RequestInterceptor.

Parameters

  • fileURL: The URL of the file to upload.
  • convertible: URLConvertible value to be used as the URLRequest's URL.
  • method: HTTPMethod for the URLRequest. .post by default.
  • headers: HTTPHeaders value to be added to the URLRequest. nil by default.
  • interceptor: RequestInterceptor value to be used by the returned UploadRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


upload(_:to:method:headers:interceptor:fileManager:)

public static func upload(
  _ stream: InputStream, to convertible: URLConvertible, method: HTTPMethod = .post,
  headers: HTTPHeaders? = nil, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest from the InputStream provided using a URLRequest from the provided components and RequestInterceptor.

Parameters

  • stream: The InputStream that provides the data to upload.
  • convertible: URLConvertible value to be used as the URLRequest's URL.
  • method: HTTPMethod for the URLRequest. .post by default.
  • headers: HTTPHeaders value to be added to the URLRequest. nil by default.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


upload(_:with:interceptor:fileManager:)

public static func upload(
  _ data: Data, with convertible: URLRequestConvertible, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the given Data using the URLRequestConvertible value and RequestInterceptor.

Parameters

  • data: The Data to upload.
  • convertible: URLRequestConvertible value to be used to create the URLRequest.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


upload(_:with:interceptor:fileManager:)

public static func upload(
  _ fileURL: URL, with convertible: URLRequestConvertible, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the file at the given file URL using the URLRequestConvertible value and RequestInterceptor.

Parameters

  • fileURL: The URL of the file to upload.
  • convertible: URLRequestConvertible value to be used to create the URLRequest.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


upload(_:with:interceptor:fileManager:)

public static func upload(
  _ stream: InputStream, with convertible: URLRequestConvertible,
  interceptor: RequestInterceptor? = nil, fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest from the provided InputStream using the URLRequestConvertible value and RequestInterceptor.

Parameters

  • stream: The InputStream that provides the data to upload.
  • convertible: URLRequestConvertible value to be used to create the URLRequest.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


upload(multipartFormData:to:usingThreshold:method:headers:interceptor:fileManager:)

public static func upload(
  multipartFormData: @escaping (MultipartFormData) -> Void, to url: URLConvertible,
  usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
  method: HTTPMethod = .post, headers: HTTPHeaders? = nil, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the multipart form data built using a closure and sent using the provided URLRequest components and RequestInterceptor.

It is important to understand the memory implications of uploading MultipartFormData. 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 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.

Parameters

  • multipartFormData: MultipartFormData building closure.
  • convertible: URLConvertible value to be used as the URLRequest's URL.
  • encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or
  • method: HTTPMethod for the URLRequest. .post by default.
  • headers: HTTPHeaders value to be added to the URLRequest. nil by default.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager to be used if the form data exceeds the memory threshold and is

Returns

The created UploadRequest.


upload(multipartFormData:to:usingThreshold:method:headers:interceptor:fileManager:)

public static func upload(
  multipartFormData: MultipartFormData, to url: URLConvertible,
  usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
  method: HTTPMethod = .post, headers: HTTPHeaders? = nil, interceptor: RequestInterceptor? = nil,
  fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the prebuilt MultipartFormData value using the provided URLRequest components and RequestInterceptor.

It is important to understand the memory implications of uploading MultipartFormData. 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 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.

Parameters

  • multipartFormData: MultipartFormData instance to upload.
  • url: URLConvertible value to be used as the URLRequest's URL.
  • encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or
  • method: HTTPMethod for the URLRequest. .post by default.
  • headers: HTTPHeaders value to be added to the URLRequest. nil by default.
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager to be used if the form data exceeds the memory threshold and is

Returns

The created UploadRequest.


upload(multipartFormData:with:usingThreshold:interceptor:fileManager:)

public static func upload(
  multipartFormData: @escaping (MultipartFormData) -> Void, with request: URLRequestConvertible,
  usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
  interceptor: RequestInterceptor? = nil, fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest using a MultipartFormData building closure, the provided URLRequestConvertible value, and a RequestInterceptor.

It is important to understand the memory implications of uploading MultipartFormData. 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 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.

Parameters

  • multipartFormData: MultipartFormData building closure.
  • request: URLRequestConvertible value to be used to create the URLRequest.
  • encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager to be used if the form data exceeds the memory threshold and is

Returns

The created UploadRequest.


upload(multipartFormData:with:usingThreshold:interceptor:fileManager:)

public static func upload(
  multipartFormData: MultipartFormData, with request: URLRequestConvertible,
  usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
  interceptor: RequestInterceptor? = nil, fileManager: FileManager = .default
) -> UploadRequest

Creates an UploadRequest for the prebuilt MultipartFormData value using the providing URLRequestConvertible value and RequestInterceptor.

It is important to understand the memory implications of uploading MultipartFormData. 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 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.

Parameters

  • multipartFormData: MultipartFormData instance to upload.
  • request: URLRequestConvertible value to be used to create the URLRequest.
  • encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or
  • interceptor: RequestInterceptor value to be used by the returned DataRequest. nil by default.
  • fileManager: FileManager instance to be used by the returned UploadRequest. .default instance by

Returns

The created UploadRequest.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment