Functions
The following functions are available globally.
-
Undocumented
-
Creates a request using the shared manager instance for the specified method, URL string, parameters, and parameter encoding.
Declaration
Swift
public func request(method: Method, URLString: URLStringConvertible, parameters: [String : AnyObject]? = default, encoding: ParameterEncoding = default) -> Request
Parameters
method
The HTTP method.
URLString
The URL string.
parameters
The parameters.
nil
by default.encoding
The parameter encoding.
.URL
by default.Return Value
The created request.
-
Creates a request using the shared manager instance for the specified URL request.If
startRequestsImmediately
istrue
, the request will haveresume()
called before being returned.Declaration
Swift
public func request(URLRequest: URLRequestConvertible) -> Request
Parameters
URLRequest
The URL request
Return Value
The created request.
-
Creates an upload request using the shared manager instance for the specified method, URL string, and file.
Declaration
Swift
public func upload(method: Method, URLString: URLStringConvertible, file: NSURL) -> Request
Parameters
method
The HTTP method.
URLString
The URL string.
file
The file to upload.
Return Value
The created upload request.
-
Creates an upload request using the shared manager instance for the specified URL request and file.
Declaration
Swift
public func upload(URLRequest: URLRequestConvertible, file: NSURL) -> Request
Parameters
URLRequest
The URL request.
file
The file to upload.
Return Value
The created upload request.
-
Creates an upload request using the shared manager instance for the specified method, URL string, and data.
Declaration
Swift
public func upload(method: Method, URLString: URLStringConvertible, data: NSData) -> Request
Parameters
method
The HTTP method.
URLString
The URL string.
data
The data to upload.
Return Value
The created upload request.
-
Creates an upload request using the shared manager instance for the specified URL request and data.
Declaration
Swift
public func upload(URLRequest: URLRequestConvertible, data: NSData) -> Request
Parameters
URLRequest
The URL request.
data
The data to upload.
Return Value
The created upload request.
-
Creates an upload request using the shared manager instance for the specified method, URL string, and stream.
Declaration
Swift
public func upload(method: Method, URLString: URLStringConvertible, stream: NSInputStream) -> Request
Parameters
method
The HTTP method.
URLString
The URL string.
stream
The stream to upload.
Return Value
The created upload request.
-
Creates an upload request using the shared manager instance for the specified URL request and stream.
Declaration
Swift
public func upload(URLRequest: URLRequestConvertible, stream: NSInputStream) -> Request
Parameters
URLRequest
The URL request.
stream
The stream to upload.
Return Value
The created upload request.
-
Creates a download request using the shared manager instance for the specified method and URL string.
Declaration
Swift
public func download(method: Method, URLString: URLStringConvertible, destination: Request.DownloadFileDestination) -> Request
Parameters
method
The HTTP method.
URLString
The URL string.
destination
The closure used to determine the destination of the downloaded file.
Return Value
The created download request.
-
Creates a download request using the shared manager instance for the specified URL request.
Declaration
Swift
public func download(URLRequest: URLRequestConvertible, destination: Request.DownloadFileDestination) -> Request
Parameters
URLRequest
The URL request.
destination
The closure used to determine the destination of the downloaded file.
Return Value
The created download request.
-
Creates a request using the shared manager instance for downloading from the resume data produced from a previous request cancellation.
Declaration
Swift
public func download(resumeData data: NSData, destination: Request.DownloadFileDestination) -> Request
Parameters
resumeData
The resume data. This is an opaque data blob produced by
NSURLSessionDownloadTask
when a task is cancelled. SeeNSURLSession -downloadTaskWithResumeData:
for additional information.destination
The closure used to determine the destination of the downloaded file.
Return Value
The created download request.