UploadAPIRequest

open class UploadAPIRequest<Model, ErrorModel> : BaseRequest<Model, ErrorModel> where ErrorModel : ErrorSerializable

UploadAPIRequest encapsulates upload request creation logic, stubbing options, and response/error parsing.

  • Serializes received response into Result

    Declaration

    Swift

    open var responseParser: ResponseParser
  • Serializes received error into APIError

    Declaration

    Swift

    open var errorParser: ErrorParser
  • Closure that is applied to request before it is sent.

    Declaration

    Swift

    open var validationClosure: (UploadRequest) -> UploadRequest
  • Sets validationClosure to validation parameter and returns configured request

    Declaration

    Swift

    open func validation(_ validation: @escaping (UploadRequest) -> UploadRequest) -> Self

    Parameters

    validation

    validation to perform.

    Return Value

    configured request.

  • Creates UploadAPIRequest with specified type, path and configures it with to be used with tron.

    Declaration

    Swift

    public init<Serializer: DataResponseSerializerProtocol>(type: UploadRequestType, path: String, tron: TRON, responseSerializer: Serializer)
        where Serializer.SerializedObject == Model
  • Undocumented

    Declaration

    Swift

    @discardableResult
    open func perform(withSuccess successBlock: ((Model) -> Void)? = nil, failure failureBlock: ((ErrorModel) -> Void)? = nil) -> UploadRequest
  • Undocumented

    Declaration

    Swift

    @discardableResult
    open func performCollectingTimeline(withCompletion completion: @escaping ((Alamofire.DataResponse<Model, AFError>) -> Void)) -> UploadRequest
  • Undocumented

    Declaration

    Swift

    func publisher() -> AnyPublisher<Model, ErrorModel>