HTTPClient

public class HTTPClient : Networking

Implementation of the Networking protocol

  • Undocumented

    Declaration

    Swift

    public init(using session: URLSessionProtocol)
  • Sends a request to the server and the response can be subscribed to

    Declaration

    Swift

    public static func response(for request: URLRequest, in session: URLSessionProtocol = URLSession.shared) -> Observable<(response: HTTPURLResponse, data: Data?)>

    Parameters

    request

    request sent to server

    session

    session used for communication

    Return Value

    An Observable of the HTTPURLResponse and Data if there is any

  • Sends a request to the server and the response header can be subscribed to

    Declaration

    Swift

    public static func header(for request: URLRequest, in session: URLSessionProtocol = URLSession.shared) -> Observable<Header>

    Parameters

    request

    request sent to server

    session

    session used for communication

    Return Value

    An Observable of the Header

  • Sends a request to the server and the response data can be subscribed to

    Declaration

    Swift

    public static func data(for request: URLRequest, in session: URLSessionProtocol = URLSession.shared) -> Observable<Data>

    Parameters

    request

    request sent to server

    session

    session used for communication

    Return Value

    An Observable of the Data if there is any

  • Sends a request to the server and the response data are transformed into object of type T and it can be subscribed to

    Declaration

    Swift

    public static func object<T>(for request: URLRequest, in session: URLSessionProtocol = URLSession.shared) -> Observable<T> where T: Decodable, T: Encodable

    Parameters

    request

    request sent to server

    session

    session used for communication

    Return Value

    An Observable of T

  • Sends a request to the server and the response data in JSON format can be subscribed to

    Declaration

    Swift

    public static func json(for request: URLRequest, in session: URLSessionProtocol = URLSession.shared) -> Observable<JSONDictionary>

    Parameters

    request

    request sent to server

    session

    session used for communication

    Return Value

    An Observable of the JSONDictionary

  • Sends a request to the server and the response can be subscribed to

    Declaration

    Swift

    public func response(for request: URLRequest) -> Observable<(response: HTTPURLResponse, data: Data?)>

    Parameters

    request

    request sent to server

    Return Value

    An Observable of the HTTPURLResponse and Data if there is any

  • Sends a request to the server and the response header can be subscribed to

    Declaration

    Swift

    public func header(for request: URLRequest) -> Observable<Header>

    Parameters

    request

    request sent to server

    Return Value

    An Observable of the Header

  • Sends a request to the server and the response data can be subscribed to

    Declaration

    Swift

    public func data(for request: URLRequest) -> Observable<Data>

    Parameters

    request

    request sent to server

    Return Value

    An Observable of the Data if there is any

  • Sends a request to the server and the response data are transformed into object of type T and it can be subscribed to

    Declaration

    Swift

    public func object<T>(for request: URLRequest) -> Observable<T> where T : Decodable, T : Encodable

    Parameters

    request

    request sent to server

    Return Value

    An Observable of T

  • Sends a request to the server and the response data in JSON format can be subscribed to

    Declaration

    Swift

    public func json(for request: URLRequest) -> Observable<JSONDictionary>

    Parameters

    request

    request sent to server

    Return Value

    An Observable of the JSONDictionary