Files

103 lines
5.0 KiB
Swift

// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
import Foundation
extension Operations {
/// A model object
public struct MyPlex {
public let authToken: String?
public let mappingError: String?
public let mappingState: String?
public let privateAddress: String?
@DecimalSerialized
public private(set) var privatePort: Double?
public let publicAddress: String?
@DecimalSerialized
public private(set) var publicPort: Double?
public let signInState: String?
public let subscriptionActive: Bool?
public let subscriptionFeatures: String?
public let subscriptionState: String?
public let username: String?
/// Creates an object with the specified parameters
///
///
public init(authToken: String? = nil, mappingError: String? = nil, mappingState: String? = nil, privateAddress: String? = nil, privatePort: Double? = nil, publicAddress: String? = nil, publicPort: Double? = nil, signInState: String? = nil, subscriptionActive: Bool? = nil, subscriptionFeatures: String? = nil, subscriptionState: String? = nil, username: String? = nil) {
self.authToken = authToken
self.mappingError = mappingError
self.mappingState = mappingState
self.privateAddress = privateAddress
self._privatePort = DecimalSerialized<Double?>(wrappedValue: privatePort)
self.publicAddress = publicAddress
self._publicPort = DecimalSerialized<Double?>(wrappedValue: publicPort)
self.signInState = signInState
self.subscriptionActive = subscriptionActive
self.subscriptionFeatures = subscriptionFeatures
self.subscriptionState = subscriptionState
self.username = username
}
}}
extension Operations.MyPlex: Codable {
enum CodingKeys: String, CodingKey {
case authToken
case mappingError
case mappingState
case privateAddress
case privatePort
case publicAddress
case publicPort
case signInState
case subscriptionActive
case subscriptionFeatures
case subscriptionState
case username
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.authToken = try container.decodeIfPresent(String.self, forKey: .authToken)
self.mappingError = try container.decodeIfPresent(String.self, forKey: .mappingError)
self.mappingState = try container.decodeIfPresent(String.self, forKey: .mappingState)
self.privateAddress = try container.decodeIfPresent(String.self, forKey: .privateAddress)
self._privatePort = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .privatePort) ?? DecimalSerialized<Double?>(wrappedValue: nil)
self.publicAddress = try container.decodeIfPresent(String.self, forKey: .publicAddress)
self._publicPort = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .publicPort) ?? DecimalSerialized<Double?>(wrappedValue: nil)
self.signInState = try container.decodeIfPresent(String.self, forKey: .signInState)
self.subscriptionActive = try container.decodeIfPresent(Bool.self, forKey: .subscriptionActive)
self.subscriptionFeatures = try container.decodeIfPresent(String.self, forKey: .subscriptionFeatures)
self.subscriptionState = try container.decodeIfPresent(String.self, forKey: .subscriptionState)
self.username = try container.decodeIfPresent(String.self, forKey: .username)
}
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.mappingError, forKey: .mappingError)
try container.encodeIfPresent(self.mappingState, forKey: .mappingState)
try container.encodeIfPresent(self.privateAddress, forKey: .privateAddress)
if self.privatePort != nil {
try container.encode(self._privatePort, forKey: .privatePort)
}
try container.encodeIfPresent(self.publicAddress, forKey: .publicAddress)
if self.publicPort != nil {
try container.encode(self._publicPort, forKey: .publicPort)
}
try container.encodeIfPresent(self.signInState, forKey: .signInState)
try container.encodeIfPresent(self.subscriptionActive, forKey: .subscriptionActive)
try container.encodeIfPresent(self.subscriptionFeatures, forKey: .subscriptionFeatures)
try container.encodeIfPresent(self.subscriptionState, forKey: .subscriptionState)
try container.encodeIfPresent(self.username, forKey: .username)
}
}
extension Operations.MyPlex {
var publicPortWrapper: DecimalSerialized<Double?> {
return _publicPort
}
var privatePortWrapper: DecimalSerialized<Double?> {
return _privatePort
}
}