Uploadable
public protocol Uploadable : BaseRequestable
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<T>(parametersType: ParametersType<T>) throws -> () -> UploadRequest where T : Encodable
-
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 }
-
Creates a
UploadOperation
for the specifiedUploadable
object.Declaration
Swift
@discardableResult public func operation( parameters: Any? = nil, uploadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, 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
UploadOperation
. -
Creates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
@discardableResult public func enqueue( parameters: Any? = nil, uploadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> Cancellable
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
Cancellable
. -
Creates a
UploadOperation
for the specifiedUploadable
object.Declaration
Swift
@discardableResult public func operation<T: Encodable>( parameters: T, uploadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, 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
UploadOperation
. -
Creates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
@discardableResult public func enqueue<T: Encodable>( parameters: T, uploadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> Cancellable
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
Cancellable
.