APIClientType
public protocol APIClientType
Define an APIClient
Version
1.0.0Date
20/11/22-
Request an object
Declaration
Swift
func requestObject<Object: Decodable>( using request: URLRequest, promoting businessErrorTypes: [any BusinessError.Type]) -> AnyPublisher<Object, APIError>Parameters
requestThe URL request
businessErrorTypesAll 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
requestThe URL request
businessErrorTypesAll 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
requestThe URL request
businessErrorTypesAll types of BusinessError that should be detected
Return Value
A data publisher
-
requestObject(from:Extension methodusing: attaching: and: with: promoting: ) 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
urlThe URL
methodThe HTTP method
headerThe HTTP header
parametersThe URL parameters
bodyThe request body
bodyTypeThe type of the request body
businessErrorTypesAll types of BusinessError that should be detected
Return Value
An object publisher
-
requestObjects(from:Extension methodusing: attaching: and: with: promoting: ) // 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> -
requestData(from:Extension methodusing: attaching: and: with: promoting: ) // 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> -
requestObject(from:Extension methodpromoting: ) Request an object
Declaration
Swift
func requestObject<Object: Decodable>( from api: API, promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<Object, APIError>Parameters
apiThe API
businessErrorTypesAll types of BusinessError that should be detected
Return Value
An object publisher
-
requestObjects(from:Extension methodpromoting: ) Request a list of object
Declaration
Swift
func requestObjects<Object: Decodable>( from api: API, promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<[Object], APIError>Parameters
apiThe API
businessErrorTypesAll types of BusinessError that should be detected
Return Value
An object publisher
-
requestData(from:Extension methodpromoting: ) Request a data
Declaration
Swift
func requestData( from api: API, promoting businessErrorTypes: [any BusinessError.Type] = []) -> AnyPublisher<Data, APIError>Parameters
apiThe API
businessErrorTypesAll types of BusinessError that should be detected
Return Value
An object publisher
APIClientType Protocol Reference