This is an api generated from a OpenAPI 3.0 spec with SwagGen using a Vapor specific template.
Each operation is an extension on Vapor's Client object.
Models that are sent and returned from the API are mutable classes. Each model conforms to Vapor's Content protocol.
Required properties are non optional and non-required are optional
All properties can be passed into the initializer, with required properties being mandatory.
If a model has additionalProperties it will have a subscript to access these by string
The extension is used to encode, send, and decode the requests. There is a Server.main that uses the default base URL:
func getObject(headers: HTTPHeaders) -> EventLoopFuture<SomeResponseType> The name of the func will be defined by the spec and is a combination of [get|post|put|delete]<pathName>. The return type is an EventLoopFuture<T> where T is the model defined in the Response on the spec.
To make a request first initialize a Request and then pass it to makeRequest. The complete closure will be called with an APIResponse
func makeRequest<T>(_ request: APIRequest<T>, behaviours: [RequestBehaviour] = [], queue: DispatchQueue = DispatchQueue.main, complete: @escaping (APIResponse<T>) -> Void) -> Request? {Example request (that is not neccessarily in this api):
let client: Client
let headers: HTTPHeaders
client.getMyObject(headers)
.flatMap { object in
print(object.someCoolObjectProperty)
}Only JSON requests and responses are supported. These are encoded and decoded by JSONEncoder and JSONDecoder respectively, using Swift's Codable apis.
There are some options to control how invalid JSON is handled when decoding and these are available as static properties on VaporEcobee:
safeOptionalDecoding: Whether to discard any errors when decoding optional properties. Defaults totrue.safeArrayDecoding: Whether to remove invalid elements instead of throwing when decoding arrays. Defaults totrue.
Dates are encoded and decoded differently according to the swagger date format. They use different DateFormatter's that you can set.
date-timeDateTime.dateEncodingFormatter: defaults toyyyy-MM-dd'T'HH:mm:ss.ZDateTime.dateDecodingFormatters: an array of date formatters. The first one to decode successfully will be used
dateDateDay.dateFormatter: defaults toyyyy-MM-dd
- AccessTokenRequest
- AccessTokenResponse
- Runtime
- Thermostat
- ThermostatPage
- ThermostatResponse
- VaporEcobee.GetThermostatSummary: GET
/thermostatsummary - VaporEcobee.Developers
- RefreshToken: POST
/token
- RefreshToken: POST