ParkingAPIClient
public final class ParkingAPIClient : NSObject, URLSessionDelegate
An http client to query data from the server
-
Default initializer
Declaration
Swift
public init(configuration: URLSessionConfiguration = .default, pageSize: UInt = 10)Parameters
configurationThe
URLSessionConfigurationto use. Default toURLSession.defaultpageSizeThe pagination value to use. Default to
10.
-
Retrieve the parkings’ locations with the legacy API
Declaration
Swift
@discardableResult public func getLegacyLocation(completion: @escaping (Result<LocationResponse, ParkingAPIClientError>) -> Void) -> CancelableRequestParameters
completionThe result when the request completed
Return Value
A
CancelableRequestcompatible element -
Retrieve the parkings’ statuses with the legacy API
Declaration
Swift
@discardableResult public func getLegacyStatus(completion: @escaping (Result<StatusResponse, ParkingAPIClientError>) -> Void) -> CancelableRequestParameters
completionThe result when the request completed
Return Value
A
CancelableRequestcompatible element -
Retrieve the parkings’ locations with the open data API
Declaration
Swift
@discardableResult public func getLocations(completion: @escaping (Result<[LocationOpenData], ParkingAPIClientError>) -> Void) -> CancelableRequestParameters
completionThe result when the request completed
Return Value
A
CancelableRequestcompatible element -
Retrieve the parkings’ status with the open data API
Declaration
Swift
@discardableResult public func getStatus(completion: @escaping (Result<[StatusOpenData], ParkingAPIClientError>) -> Void) -> CancelableRequestParameters
completionThe result when the request completed
Return Value
A
CancelableRequestcompatible element
-
Retrieve the parkings’ locations with the legacy API
Declaration
Swift
public func getLegacyLocationPublisher() -> AnyPublisher<LocationResponse, ParkingAPIClientError>Return Value
A
AnyPublisheranswering oneLocationResponseelement. -
Retrieve the parkings’ statuses with the legacy API
Declaration
Swift
public func getLegacyStatusPublisher() -> AnyPublisher<StatusResponse, ParkingAPIClientError>Return Value
A
AnyPublisheranswering oneStatusResponseelement. -
Retrieve the parkings’ locations using the open data API
Declaration
Swift
public func getLocationsPublisher() -> AnyPublisher<[LocationOpenData], ParkingAPIClientError>Return Value
A
AnyPublisheranswering one[LocationOpenData]. -
Retrieve the parkings’ statuses with the opendata API
Declaration
Swift
public func getStatusPublisher() -> AnyPublisher<[StatusOpenData], ParkingAPIClientError>Return Value
A
AnyPublisheranswering one[StatusOpenData]element.
-
fetchLegacyLocation()AsynchronousRetrieve the parkings’ location with the legacy API
Declaration
Swift
public func fetchLegacyLocation() async throws -> LocationResponseReturn Value
An array of
LocationResponse -
fetchLegacyStatus()AsynchronousRetrieve the parkings’ statuses with the legacy API
Declaration
Swift
public func fetchLegacyStatus() async throws -> StatusResponseReturn Value
An array of
StatusResponse -
fetchLocations()AsynchronousRetrieve the parkings’ location with the open data API
Declaration
Swift
public func fetchLocations() async throws -> [LocationOpenData]Return Value
An array of
LocationOpenData -
fetchStatus()AsynchronousRetrieve the parkings’ statuses with the open data API
Declaration
Swift
public func fetchStatus() async throws -> [StatusOpenData]Return Value
An array of
StatusResponse
View on GitHub
ParkingAPIClient Class Reference