// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. import Foundation extension Operations { /// The Pin public struct GetPinResponseBody { public let authToken: String? public let clientIdentifier: String? public let code: String? @DateTime public private(set) var createdAt: Date? @DateTime public private(set) var expiresAt: Date? @DecimalSerialized public private(set) var expiresIn: Double? /// PinID for use with authentication @DecimalSerialized public private(set) var id: Double? public let location: Operations.Location? public let newRegistration: String? public let product: String? /// a link to a QR code hosted on plex.tv /// The QR code redirects to the relevant `plex.tv/link` authentication page /// Which then prompts the user for the 4 Digit Link Pin /// public let qr: String? public let trusted: Bool? /// Creates an object with the specified parameters /// /// - Parameter id: PinID for use with authentication /// - Parameter qr: a link to a QR code hosted on plex.tv /// The QR code redirects to the relevant `plex.tv/link` authentication page /// Which then prompts the user for the 4 Digit Link Pin /// /// public init(authToken: String? = nil, clientIdentifier: String? = nil, code: String? = nil, createdAt: Date? = nil, expiresAt: Date? = nil, expiresIn: Double? = nil, id: Double? = nil, location: Operations.Location? = nil, newRegistration: String? = nil, product: String? = nil, qr: String? = nil, trusted: Bool? = nil) { self.authToken = authToken self.clientIdentifier = clientIdentifier self.code = code self._createdAt = DateTime(wrappedValue: createdAt) self._expiresAt = DateTime(wrappedValue: expiresAt) self._expiresIn = DecimalSerialized(wrappedValue: expiresIn) self._id = DecimalSerialized(wrappedValue: id) self.location = location self.newRegistration = newRegistration self.product = product self.qr = qr self.trusted = trusted } } } extension Operations.GetPinResponseBody: Codable { enum CodingKeys: String, CodingKey { case authToken case clientIdentifier case code case createdAt case expiresAt case expiresIn case id case location case newRegistration case product case qr case trusted } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.authToken = try container.decodeIfPresent(String.self, forKey: .authToken) self.clientIdentifier = try container.decodeIfPresent(String.self, forKey: .clientIdentifier) self.code = try container.decodeIfPresent(String.self, forKey: .code) self._createdAt = try container.decodeIfPresent(DateTime.self, forKey: .createdAt) ?? DateTime(wrappedValue: nil) self._expiresAt = try container.decodeIfPresent(DateTime.self, forKey: .expiresAt) ?? DateTime(wrappedValue: nil) self._expiresIn = try container.decodeIfPresent(DecimalSerialized.self, forKey: .expiresIn) ?? DecimalSerialized(wrappedValue: nil) self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) self.location = try container.decodeIfPresent(Operations.Location.self, forKey: .location) self.newRegistration = try container.decodeIfPresent(String.self, forKey: .newRegistration) self.product = try container.decodeIfPresent(String.self, forKey: .product) self.qr = try container.decodeIfPresent(String.self, forKey: .qr) self.trusted = try container.decodeIfPresent(Bool.self, forKey: .trusted) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(self.authToken, forKey: .authToken) try container.encodeIfPresent(self.clientIdentifier, forKey: .clientIdentifier) try container.encodeIfPresent(self.code, forKey: .code) if self.createdAt != nil { try container.encode(self._createdAt, forKey: .createdAt) } if self.expiresAt != nil { try container.encode(self._expiresAt, forKey: .expiresAt) } if self.expiresIn != nil { try container.encode(self._expiresIn, forKey: .expiresIn) } if self.id != nil { try container.encode(self._id, forKey: .id) } try container.encodeIfPresent(self.location, forKey: .location) try container.encodeIfPresent(self.newRegistration, forKey: .newRegistration) try container.encodeIfPresent(self.product, forKey: .product) try container.encodeIfPresent(self.qr, forKey: .qr) try container.encodeIfPresent(self.trusted, forKey: .trusted) } } extension Operations.GetPinResponseBody { var idWrapper: DecimalSerialized { return _id } var expiresInWrapper: DecimalSerialized { return _expiresIn } var createdAtWrapper: DateTime { return _createdAt } var expiresAtWrapper: DateTime { return _expiresAt } }