mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-06 20:57:46 +00:00
68 lines
2.5 KiB
Swift
68 lines
2.5 KiB
Swift
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
|
|
import Foundation
|
|
|
|
extension Operations {
|
|
/// A model object
|
|
public struct Device {
|
|
public let clientIdentifier: String?
|
|
@DecimalSerialized
|
|
public private(set) var createdAt: Double?
|
|
@DecimalSerialized
|
|
public private(set) var id: Double?
|
|
public let name: String?
|
|
public let platform: String?
|
|
|
|
/// Creates an object with the specified parameters
|
|
///
|
|
///
|
|
public init(clientIdentifier: String? = nil, createdAt: Double? = nil, id: Double? = nil, name: String? = nil, platform: String? = nil) {
|
|
self.clientIdentifier = clientIdentifier
|
|
self._createdAt = DecimalSerialized<Double?>(wrappedValue: createdAt)
|
|
self._id = DecimalSerialized<Double?>(wrappedValue: id)
|
|
self.name = name
|
|
self.platform = platform
|
|
}
|
|
}}
|
|
|
|
extension Operations.Device: Codable {
|
|
enum CodingKeys: String, CodingKey {
|
|
case clientIdentifier
|
|
case createdAt
|
|
case id
|
|
case name
|
|
case platform
|
|
}
|
|
|
|
public init(from decoder: Decoder) throws {
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
self.clientIdentifier = try container.decodeIfPresent(String.self, forKey: .clientIdentifier)
|
|
self._createdAt = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .createdAt) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
|
self._id = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .id) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
|
self.name = try container.decodeIfPresent(String.self, forKey: .name)
|
|
self.platform = try container.decodeIfPresent(String.self, forKey: .platform)
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(self.clientIdentifier, forKey: .clientIdentifier)
|
|
if self.createdAt != nil {
|
|
try container.encode(self._createdAt, forKey: .createdAt)
|
|
}
|
|
if self.id != nil {
|
|
try container.encode(self._id, forKey: .id)
|
|
}
|
|
try container.encodeIfPresent(self.name, forKey: .name)
|
|
try container.encodeIfPresent(self.platform, forKey: .platform)
|
|
}
|
|
}
|
|
|
|
extension Operations.Device {
|
|
var idWrapper: DecimalSerialized<Double?> {
|
|
return _id
|
|
}
|
|
var createdAtWrapper: DecimalSerialized<Double?> {
|
|
return _createdAt
|
|
}
|
|
}
|