Uploadable
public protocol Uploadable : _Requestable
Represents an abstract Uploadable
.
Instead implement FileUploadable, DataUploadable, StreamUploadable, AMultipartUplodable protocols.
-
validationBlock
Default implementationThe Alamofire upload request validation.
Default Implementation
Validation.default.uploadValidation
Declaration
Swift
var validationBlock: DataRequest.Validation? { get }
-
The uplaod request for subclasses to provide the implementation.
Declaration
Swift
func asRequest() throws -> UploadRequest
-
request(_:didCompleteWithValue:)
Default implementationCalled when the Request succeeds.
Default Implementation
Does Nothing
Declaration
Swift
func request(_ request: UploadOperation<Self>, didCompleteWithValue value: Response)
Parameters
request
The Alamofire.UploadRequest
value
The Response
-
request(_:didFailWithError:)
Default implementationCalled when the Request fails
Default Implementation
Does Nothing
Declaration
Swift
func request(_ request: UploadOperation<Self>, didFailWithError error: Error)
Parameters
request
The Alamofire.UploadRequest
error
The Error
-
method
Extension method.post
Declaration
Swift
public var method: HTTPMethod { get }
-
operation(uploadProgressHandler:completionHandler:)
Extension methodCreates a
RequestOperation
for the specifiedRequestable
object.Declaration
Swift
@discardableResult public func operation( uploadProgressHandler: ((Progress) -> Void)? = nil, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> UploadOperation<Self>
Parameters
uploadProgressHandler
A closure to be executed once the upload progresses.
nil
by default.completionHandler
A closure to be executed once the request has finished.
nil
by default.Return Value
The created
RequestOperation
. -
operation(request:uploadProgressHandler:completionHandler:)
Extension methodCreates a
RequestOperation
for the specifiedRequestable
object.Declaration
Swift
public func operation( request: @autoclosure @escaping () -> UploadRequest, uploadProgressHandler: ((Progress) -> Void)? = nil, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) -> UploadOperation<Self>
Parameters
request
A data request instance
uploadProgressHandler
A closure to be executed once the upload progresses.
nil
by default.completionHandler
A closure to be executed once the request has finished.
nil
by default.Return Value
The created
RequestOperation
. -
execute(uploadProgressHandler:completionHandler:)
Extension methodCreates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
@discardableResult public func execute( uploadProgressHandler: ((Progress) -> Void)? = nil, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> UploadOperation<Self>
Parameters
uploadProgressHandler
A closure to be executed once the upload progresses.
nil
by default.completionHandler
A closure to be executed once the download has finished.
nil
by default.Return Value
The created
UploadOperation
. -
execute(request:uploadProgressHandler:completionHandler:)
Extension methodCreates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
@discardableResult public func execute( request: @autoclosure @escaping () -> UploadRequest, uploadProgressHandler: ((Progress) -> Void)? = nil, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) -> UploadOperation<Self>
Parameters
request
An upload request instance
uploadProgressHandler
A closure to be executed once the upload progresses.
nil
by default.completionHandler
A closure to be executed once the download has finished.
nil
by default.Return Value
The created
UploadOperation
.