Requestable
public protocol Requestable : BaseRequestable
Represents a Requestable for Restofire.
Create custom Requestable
protocol HTTPBinGETService: Requestable {
typealias Response = Data
var path: String? = "get"
}
-
validationBlockDefault implementationThe Alamofire data request validation.
Default Implementation
Validation.default.dataValidationDeclaration
Swift
var validationBlock: DataRequest.Validation? { get } -
request(_:didCompleteWithValue:)Default implementationCalled when the Request succeeds.
Default Implementation
Does NothingDeclaration
Swift
func request(_ request: RequestOperation<Self>, didCompleteWithValue value: Response)Parameters
requestThe Alamofire.DataRequest
errorThe Response
-
request(_:didFailWithError:)Default implementationCalled when the Request fails.
Default Implementation
Does NothingDeclaration
Swift
func request(_ request: RequestOperation<Self>, didFailWithError error: Error)Parameters
requestThe Alamofire.DataRequest
errorThe Error
-
Creates a
RequestOperationfor the specifiedRequestableobject.Declaration
Swift
@discardableResult public func operation( parameters: Any? = nil, downloadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> RequestOperation<Self>Parameters
downloadProgressHandlerA closure to be executed once the download progresses.
nilby default.completionHandlerA closure to be executed once the request has finished.
nilby default.Return Value
The created
RequestOperation. -
Creates a
RequestOperationfor the specifiedRequestableobject and asynchronously executes it.Declaration
Swift
@discardableResult public func enqueue( parameters: Any? = nil, downloadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> CancellableParameters
downloadProgressHandlerA closure to be executed once the download progresses.
nilby default.completionHandlerA closure to be executed once the request has finished.
nilby default.Return Value
The created
Cancellable. -
Creates a
RequestOperationfor the specifiedRequestableobject.Declaration
Swift
@discardableResult public func operation<T: Encodable>( parameters: T, downloadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> RequestOperation<Self>Parameters
downloadProgressHandlerA closure to be executed once the download progresses.
nilby default.completionHandlerA closure to be executed once the request has finished.
nilby default.Return Value
The created
RequestOperation. -
Creates a
RequestOperationfor the specifiedRequestableobject and asynchronously executes it.Declaration
Swift
@discardableResult public func enqueue<T: Encodable>( parameters: T, downloadProgressHandler: ((Progress) -> Void, queue: DispatchQueue?)? = nil, completionQueue: DispatchQueue = .main, completionHandler: ((DataResponse<Response>) -> Void)? = nil ) throws -> CancellableParameters
downloadProgressHandlerA closure to be executed once the download progresses.
nilby default.completionHandlerA closure to be executed once the request has finished.
nilby default.Return Value
The created
Cancellable.
Requestable Protocol Reference