Protocols

The following protocols are available globally.

  • A type used to define how a set of array parameters are applied to a URLRequest.

    See more

    Declaration

    Swift

    public protocol ArrayParameterEncoding
  • Represents an abstract _Requestable.

    Instead implement Requestable, Downloadable, FileUploadable, DataUploadable, StreamUploadable, MultipartUplodable protocols.

    See more

    Declaration

    Swift

    public protocol _Requestable : Configurable, ResponseSerializable
  • Represents a DataUploadable for Alamofire.

    Create custom DataUploadable

    protocol HTTPBinUploadService: DataUploadable {
    
        typealias Response = Data
    
        var path: String? = "post"
        var data: Data = {
            return "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
               .data(using: .utf8, allowLossyConversion: false)!
        }()
    
    }
    
    See more

    Declaration

    Swift

    public protocol DataUploadable : Uploadable
  • Represents a Downloadable for Restofire.

    protocol HTTPBinDownloadService: Downloadable {
    
        typealias Response = Data
    
        var path: String? = "bytes/\(4 * 1024 * 1024)"
        var destination: DownloadFileDestination?
    
        init(destination: @escaping DownloadFileDestination) {
            self.destination = destination
        }
    
    }
    
    See more

    Declaration

    Swift

    public protocol Downloadable : _Requestable
  • Represents a FileUploadable for Alamofire.

    Create custom FileUploadable

    protocol HTTPBinUploadService: FileUploadable {
    
        typealias Response = Data
    
        var path: String? = "post"
        let url: URL = FileManager.url(forResource: "rainbow", withExtension: "jpg")
    
    }
    
    See more

    Declaration

    Swift

    public protocol FileUploadable : Uploadable
  • Represents a MultipartUploadable for Alamofire.

    Create custom MultipartUploadable

    protocol HTTPBinUploadService: MultipartUploadable {
    
        typealias Response = Data
    
        var path: String? = "post"
        var multipartFormData: (MultipartFormData) -> Void = { multipartFormData in
            multipartFormData.append("français".data(using: .utf8)!, withName: "french")
            multipartFormData.append("日本語".data(using: .utf8)!, withName: "japanese")
        }
    
    }
    
    See more

    Declaration

    Swift

    public protocol MultipartUploadable : Uploadable
  • Represents a Requestable for Restofire.

    Create custom Requestable

    protocol HTTPBinGETService: Requestable {
    
        typealias Response = Data
        var path: String? = "get"
    
    }
    
    See more

    Declaration

    Swift

    public protocol Requestable : _Requestable
  • Represents a StreamUploadable for Alamofire.

    Create custom StreamUploadable

    protocol HTTPBinUploadService: StreamUploadable {
    
        typealias Response = Data
    
        var path: String? = "post"
        var stream: InputStream = InputStream(url: FileManager.imageURL)!
    
    }
    
    See more

    Declaration

    Swift

    public protocol StreamUploadable : Uploadable
  • Represents an abstract Uploadable.

    Instead implement FileUploadable, DataUploadable, StreamUploadable, AMultipartUplodable protocols.

    See more

    Declaration

    Swift

    public protocol Uploadable : _Requestable