Files
plexswift/Sources/Plexswift/models/operations/Ratings.swift

52 lines
1.6 KiB
Swift

// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
import Foundation
extension Operations {
/// A model object
public struct Ratings {
public let image: String?
public let type: String?
@DecimalSerialized
public private(set) var value: Double?
/// Creates an object with the specified parameters
///
///
public init(image: String? = nil, type: String? = nil, value: Double? = nil) {
self.image = image
self.type = type
self._value = DecimalSerialized<Double?>(wrappedValue: value)
}
}}
extension Operations.Ratings: Codable {
enum CodingKeys: String, CodingKey {
case image
case type
case value
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.image = try container.decodeIfPresent(String.self, forKey: .image)
self.type = try container.decodeIfPresent(String.self, forKey: .type)
self._value = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .value) ?? DecimalSerialized<Double?>(wrappedValue: nil)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(self.image, forKey: .image)
try container.encodeIfPresent(self.type, forKey: .type)
if self.value != nil {
try container.encode(self._value, forKey: .value)
}
}
}
extension Operations.Ratings {
var valueWrapper: DecimalSerialized<Double?> {
return _value
}
}