forked from loafle/openapi-generator-original
generate samples
This commit is contained in:
@@ -78,13 +78,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>Character</li>
|
||||
<li>Data</li>
|
||||
<li>Date</li>
|
||||
<li>DateWithoutTime</li>
|
||||
<li>Decimal</li>
|
||||
<li>Double</li>
|
||||
<li>Float</li>
|
||||
<li>Int</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>OpenAPIDateWithoutTime</li>
|
||||
<li>String</li>
|
||||
<li>URL</li>
|
||||
<li>UUID</li>
|
||||
|
||||
@@ -14,7 +14,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -59,6 +58,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
README.md
|
||||
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// DateWithoutTime.swift
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
@@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
@@ -40,7 +40,7 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
@@ -56,8 +56,14 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// DateWithoutTime.swift
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
@@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
@@ -40,7 +40,7 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
@@ -56,8 +56,14 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// DateWithoutTime.swift
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
@@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
@@ -40,7 +40,7 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
@@ -56,8 +56,14 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -68,6 +67,7 @@ PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// DateWithoutTime.swift
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
@@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
@@ -40,7 +40,7 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
@@ -56,8 +56,14 @@ public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -21,6 +20,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Order.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// DateWithoutTime.swift
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
@@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
internal struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
internal struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
internal let wrappedDate: Date
|
||||
internal let timezone: TimeZone
|
||||
|
||||
@@ -40,7 +40,7 @@ internal struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
@@ -56,8 +56,14 @@ internal struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ PetstoreClient/Classes/OpenAPIs/APIs.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -16,6 +15,7 @@ PetstoreClient/Classes/OpenAPIs/Models.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/Apple.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/Banana.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/Fruit.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -92,12 +92,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ Sources/PetstoreClient/APIs/StoreAPI.swift
|
||||
Sources/PetstoreClient/APIs/UserAPI.swift
|
||||
Sources/PetstoreClient/CodableHelper.swift
|
||||
Sources/PetstoreClient/Configuration.swift
|
||||
Sources/PetstoreClient/DateWithoutTime.swift
|
||||
Sources/PetstoreClient/Extensions.swift
|
||||
Sources/PetstoreClient/JSONDataEncoding.swift
|
||||
Sources/PetstoreClient/JSONEncodingHelper.swift
|
||||
@@ -59,6 +58,7 @@ Sources/PetstoreClient/Models/Tag.swift
|
||||
Sources/PetstoreClient/Models/TypeHolderDefault.swift
|
||||
Sources/PetstoreClient/Models/TypeHolderExample.swift
|
||||
Sources/PetstoreClient/Models/User.swift
|
||||
Sources/PetstoreClient/OpenAPIDateWithoutTime.swift
|
||||
Sources/PetstoreClient/OpenISO8601DateFormatter.swift
|
||||
Sources/PetstoreClient/SynchronizedDictionary.swift
|
||||
Sources/PetstoreClient/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ Sources/PetstoreClient/APIs/PetAPI.swift
|
||||
Sources/PetstoreClient/APIs/StoreAPI.swift
|
||||
Sources/PetstoreClient/APIs/UserAPI.swift
|
||||
Sources/PetstoreClient/Configuration.swift
|
||||
Sources/PetstoreClient/DateWithoutTime.swift
|
||||
Sources/PetstoreClient/Extensions.swift
|
||||
Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift
|
||||
Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift
|
||||
@@ -62,6 +61,7 @@ Sources/PetstoreClient/Models/TypeHolderDefault.swift
|
||||
Sources/PetstoreClient/Models/TypeHolderExample.swift
|
||||
Sources/PetstoreClient/Models/User.swift
|
||||
Sources/PetstoreClient/Models/XmlItem.swift
|
||||
Sources/PetstoreClient/OpenAPIDateWithoutTime.swift
|
||||
Sources/PetstoreClient/OpenISO8601DateFormatter.swift
|
||||
docs/AdditionalPropertiesAnyType.md
|
||||
docs/AdditionalPropertiesArray.md
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift
|
||||
PetstoreClient/Classes/OpenAPIs/CodableHelper.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Configuration.swift
|
||||
PetstoreClient/Classes/OpenAPIs/DateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Extensions.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift
|
||||
PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift
|
||||
@@ -58,6 +57,7 @@ PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
|
||||
PetstoreClient/Classes/OpenAPIs/Models/User.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenAPIDateWithoutTime.swift
|
||||
PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift
|
||||
PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift
|
||||
PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// DateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct DateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `DateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
internal func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,6 @@ extension Date: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension DateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONEncodable where Self: Encodable {
|
||||
func encodeToJSON() -> Any {
|
||||
guard let data = try? CodableHelper.jsonEncoder.encode(self) else {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// OpenAPIDateWithoutTime.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a date without time information (e.g. a birthday) for transmission from and to a REST API
|
||||
///
|
||||
/// This type is used as a representation for openapi specs `date` format which does not contain
|
||||
/// time information as opposed to the `date-time` format. Although it internally uses `Date` for
|
||||
/// (de-)serialization as well the generator needs to be able to distinguish between the two formats.
|
||||
/// - note: As `Date` is agnostic to timezones (and calendars), timezone information is needed to be able to add
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
case wrappedDate
|
||||
case timezone
|
||||
}
|
||||
|
||||
/// On decoding ISO8601 timezone is assumed
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
self.wrappedDate = try container.decode(Date.self)
|
||||
self.timezone = OpenISO8601DateFormatter.withoutTime.timeZone
|
||||
}
|
||||
|
||||
/// Convenience Initializer which is useful when dealing with optionals a lot like e.g. in API mappers
|
||||
public init?(wrappedDate: Date?, timezone: TimeZone = .current) {
|
||||
guard let wrappedDate = wrappedDate else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(wrappedDate: wrappedDate, timezone: timezone)
|
||||
}
|
||||
|
||||
/// Designated Initializer for `OpenAPIDateWithoutTime`
|
||||
///
|
||||
/// Since usually `Date`s without time components - as e.g. birthdays - are created Calendar- and timezone-aware
|
||||
// it is important to also provide a timezone so that the generator is able to normalize the supplied Date to ISO8601 (GMT+0)
|
||||
public init(wrappedDate: Date, timezone: TimeZone) {
|
||||
self.wrappedDate = wrappedDate
|
||||
self.timezone = timezone
|
||||
}
|
||||
|
||||
/// Only the wrappedDate is encoded normalized to GMT+0 with an offset derived from the supplied Timezone
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(OpenISO8601DateFormatter.withoutTime.string(from: normalizedWrappedDate()))
|
||||
}
|
||||
|
||||
/// Normalizes the wrappedDate to GMT+0 according to the supplied timezone
|
||||
fileprivate func normalizedWrappedDate() -> Date {
|
||||
return wrappedDate.addingTimeInterval(
|
||||
Double(timezone.secondsFromGMT(for: wrappedDate)))
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
||||
func encodeToJSON() -> Any {
|
||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user