mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-06 04:20:52 +00:00
83 lines
3.3 KiB
Swift
83 lines
3.3 KiB
Swift
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
|
|
import Foundation
|
|
|
|
extension Operations {
|
|
/// A model object
|
|
public struct Activity {
|
|
public let cancellable: Bool?
|
|
public let context: Operations.Context?
|
|
@DecimalSerialized
|
|
public private(set) var progress: Double?
|
|
public let subtitle: String?
|
|
public let title: String?
|
|
public let type: String?
|
|
@DecimalSerialized
|
|
public private(set) var userID: Double?
|
|
public let uuid: String?
|
|
|
|
/// Creates an object with the specified parameters
|
|
///
|
|
///
|
|
public init(cancellable: Bool? = nil, context: Operations.Context? = nil, progress: Double? = nil, subtitle: String? = nil, title: String? = nil, type: String? = nil, userID: Double? = nil, uuid: String? = nil) {
|
|
self.cancellable = cancellable
|
|
self.context = context
|
|
self._progress = DecimalSerialized<Double?>(wrappedValue: progress)
|
|
self.subtitle = subtitle
|
|
self.title = title
|
|
self.type = type
|
|
self._userID = DecimalSerialized<Double?>(wrappedValue: userID)
|
|
self.uuid = uuid
|
|
}
|
|
}}
|
|
|
|
extension Operations.Activity: Codable {
|
|
enum CodingKeys: String, CodingKey {
|
|
case cancellable
|
|
case context = "Context"
|
|
case progress
|
|
case subtitle
|
|
case title
|
|
case type
|
|
case userID
|
|
case uuid
|
|
}
|
|
|
|
public init(from decoder: Decoder) throws {
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
self.cancellable = try container.decodeIfPresent(Bool.self, forKey: .cancellable)
|
|
self.context = try container.decodeIfPresent(Operations.Context.self, forKey: .context)
|
|
self._progress = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .progress) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
|
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
|
|
self.title = try container.decodeIfPresent(String.self, forKey: .title)
|
|
self.type = try container.decodeIfPresent(String.self, forKey: .type)
|
|
self._userID = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .userID) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
|
self.uuid = try container.decodeIfPresent(String.self, forKey: .uuid)
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(self.cancellable, forKey: .cancellable)
|
|
try container.encodeIfPresent(self.context, forKey: .context)
|
|
if self.progress != nil {
|
|
try container.encode(self._progress, forKey: .progress)
|
|
}
|
|
try container.encodeIfPresent(self.subtitle, forKey: .subtitle)
|
|
try container.encodeIfPresent(self.title, forKey: .title)
|
|
try container.encodeIfPresent(self.type, forKey: .type)
|
|
if self.userID != nil {
|
|
try container.encode(self._userID, forKey: .userID)
|
|
}
|
|
try container.encodeIfPresent(self.uuid, forKey: .uuid)
|
|
}
|
|
}
|
|
|
|
extension Operations.Activity {
|
|
var userIDWrapper: DecimalSerialized<Double?> {
|
|
return _userID
|
|
}
|
|
var progressWrapper: DecimalSerialized<Double?> {
|
|
return _progress
|
|
}
|
|
}
|