HPNetwork Documentation Beta

Class Decodable​Request

open class DecodableRequest<T: Decodable>: NetworkRequest
DecodableRequest DecodableRequest NetworkRequest NetworkRequest DecodableRequest->NetworkRequest

Conforms To

NetworkRequest

A protocol to wrap request objects. This gives us a better API over URLRequest.

Nested Type Aliases

Input

public typealias Input = Data

Output

public typealias Output = T

Initializers

init(url​String:​url​Session:​finishing​Queue:​request​Method:​authentication:​)

public init(urlString: String, urlSession: URLSession = .shared, finishingQueue: DispatchQueue = .main, requestMethod: NetworkRequestMethod = .get, authentication: NetworkRequestAuthentication? = nil)

init(url:​url​Session:​finishing​Queue:​request​Method:​authentication:​)

public init(url: URL, urlSession: URLSession = .shared, finishingQueue: DispatchQueue = .main, requestMethod: NetworkRequestMethod = .get, authentication: NetworkRequestAuthentication? = nil)

Properties

url​Session

let urlSession: URLSession

finishing​Queue

let finishingQueue: DispatchQueue

request​Method

let requestMethod: NetworkRequestMethod

authentication

let authentication: NetworkRequestAuthentication?

url​String

let urlString: String

url

var url: URL?

decoder

var decoder: JSONDecoder

Methods

convert​Response(response:​)

public func convertResponse(response: NetworkResponse) throws -> Output