APIClientType

public protocol APIClientType

Define an APIClient

Version

1.0.0

Date

20/11/22

Author

Adamas
  • Request an object

    Declaration

    Swift

    func requestObject<Object: Decodable>(
        using request: URLRequest,
        promoting businessErrorTypes: [any BusinessError.Type]) -> AnyPublisher<Object, APIError>

    Parameters

    request

    The URL request

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    An object publisher

  • Request a list of objects

    Declaration

    Swift

    func requestObjects<Object: Decodable>(
        using request: URLRequest,
        promoting businessErrorTypes: [any BusinessError.Type]) -> AnyPublisher<[Object], APIError>

    Parameters

    request

    The URL request

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    An object list publisher

  • Request a data block

    Declaration

    Swift

    func requestData(
        using request: URLRequest,
        promoting businessErrorTypes: [any BusinessError.Type]) -> AnyPublisher<Data, APIError>

    Parameters

    request

    The URL request

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    A data publisher

  • Request an object

    Declaration

    Swift

    func requestObject<Object: Decodable>(
        from url: URL,
        using method: RequestMethod,
        attaching header: RequestHeaders? = nil,
        and parameters: URLParameters? = nil,
        with body: RequestBody? = nil,
        promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<Object, APIError>

    Parameters

    url

    The URL

    method

    The HTTP method

    header

    The HTTP header

    parameters

    The URL parameters

    body

    The request body

    bodyType

    The type of the request body

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    An object publisher

  • // Request a list of objects // // - Parameters: // - url: The URL // - method: The HTTP method // - header: The HTTP header // - parameters: The URL parameters // - body: The request body // - bodyType: The type of the request body // - businessErrorTypes: All types of BusinessError that should be detected // - Returns: An object list publisher

    Declaration

    Swift

    func requestObjects<Object: Decodable>(
        from url: URL,
        using method: RequestMethod,
        attaching header: RequestHeaders? = nil,
        and parameters: URLParameters? = nil,
        with body: RequestBody? = nil,
        promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<[Object], APIError>
  • // Request a data block // // - Parameters: // - url: The URL // - method: The HTTP method // - header: The HTTP header // - parameters: The URL parameters // - body: The request body // - bodyType: The type of the request body // - businessErrorTypes: All types of BusinessError that should be detected // - Returns: A data publisher

    Declaration

    Swift

    func requestData(
        from url: URL,
        using method: RequestMethod,
        attaching header: RequestHeaders? = nil,
        and parameters: URLParameters? = nil,
        with body: RequestBody? = nil,
        promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<Data, APIError>
  • Request an object

    Declaration

    Swift

    func requestObject<Object: Decodable>(
        from api: API,
        promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<Object, APIError>

    Parameters

    api

    The API

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    An object publisher

  • Request a list of object

    Declaration

    Swift

    func requestObjects<Object: Decodable>(
        from api: API,
        promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<[Object], APIError>

    Parameters

    api

    The API

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    An object publisher

  • requestData(from:promoting:) Extension method

    Request a data

    Declaration

    Swift

    func requestData(
        from api: API,
        promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<Data, APIError>

    Parameters

    api

    The API

    businessErrorTypes

    All types of BusinessError that should be detected

    Return Value

    An object publisher