NetworkRequest

public protocol NetworkRequest

Undocumented

  • The expected output type returned in the network request

    Declaration

    Swift

    associatedtype Output
  • A result containing either the specified output type or an error

    Declaration

    Swift

    typealias RequestResult = Result<Output, Error>
  • A result containing either the specified output type or an error

    Declaration

    Swift

    typealias RequestResultIncludingElapsedTime = (Result<Output, Error>, TimeInterval, TimeInterval)
  • A callback which includes the result of the networking operation

    Declaration

    Swift

    typealias Completion = (_ result: RequestResult) -> Void

    Parameters

    result

    A result containing either the specified output type or an error

  • A callback which includes the result of the networking operation and elapsed times. The first TimeInterval is the seconds which the networking itself took and the second is the processing time in seconds

    Declaration

    Swift

    typealias CompletionWithElapsedTime = (_ result: RequestResult, _ networkingTime: TimeInterval, _ processingTime: TimeInterval) -> Void

    Parameters

    result

    A result containing either the specified output type or an error

    networkingTime

    the time in seconds which the networking itself took

    processingTime

    the time in seconds which the processing took

  • finishingQueue Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    var finishingQueue: DispatchQueue { get }
  • httpBody Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    var httpBody: Data? { get }
  • urlSession Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    var urlSession: URLSession { get }
  • headerFields Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    var headerFields: [NetworkRequestHeaderField]? { get }
  • The request method that will be used

    Declaration

    Swift

    var requestMethod: NetworkRequestMethod { get }
  • authentication Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    var authentication: NetworkRequestAuthentication? { get }
  • Undocumented

    Declaration

    Swift

    func makeURL() throws -> URL
  • Undocumented

    Declaration

    Swift

    func convertResponse(response: NetworkResponse) throws -> Output
  • convertError(_:data:response:) Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    func convertError(_ error: Error, data: Data?, response: URLResponse?) -> Error
  • dataTaskPublisher() Extension method

    Undocumented

    Declaration

    Swift

    func dataTaskPublisher() -> AnyPublisher<Output, Error>

Sensible Defaults

Available where Output == Data