APIotaCodableEndpoint
public protocol APIotaCodableEndpoint
Defines an API endpoint for a Client.
The definition must include a path and a httpMethod.
It can also optionaly include definitions for headers, httpBody and queryItems.
-
A type alias for the decoded object for the successful response to a
URLRequest.Declaration
Swift
associatedtype SuccessResponse : Decodable -
A type alias for the decoded object for the error response to a
URLRequest.Declaration
Swift
associatedtype ErrorResponse : Decodable -
A type alias for the encoded data attached to the body of a
URLRequest.Declaration
Swift
associatedtype Body : Encodable -
A
JSONEncoderto use for encoding body data to the requests generated by the receiver.Declaration
Swift
var encoder: JSONEncoder { get } -
A
HTTPHeadersinstance used for configuring the HTTP headers attached to an initializedURLRequestgenerated by the endpoint.Declaration
Swift
var headers: HTTPHeaders? { get } -
A
HTTPMethodto use when initializing aURLRequestgenerated by the endpoint.Declaration
Swift
var httpMethod: HTTPMethod { get } -
A
Stringdefining thepathcomponent of the endpoint URL (i.e. appended after thehostcomponent).Declaration
Swift
var path: String { get } -
An optional array of
URLQueryItems to use for thequerycomponent of the endpoint URL.Declaration
Swift
var queryItems: [URLQueryItem]? { get } -
request(baseUrlComponents:Default implementation) Generates a
URLRequestready for use.Default Implementation
Declaration
Swift
func request(baseUrlComponents: URLComponents) throws -> URLRequestParameters
baseUrlComponentsURLComponentsdefining the base URL of the API Client.Return Value
A
URLRequestconfigured according to the receiver’s definition.
View on GitHub
Install in Dash
APIotaCodableEndpoint Protocol Reference