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

56 lines
1.8 KiB
Swift

// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
import Foundation
extension Operations {
/// A model object
public struct Rating {
/// The image or reference for the rating.
public let image: String
/// The type of rating (e.g., audience, critic).
public let type: String
/// The rating value.
@DecimalSerialized
public private(set) var value: Double
/// Creates an object with the specified parameters
///
/// - Parameter image: The image or reference for the rating.
/// - Parameter type: The type of rating (e.g., audience, critic).
/// - Parameter value: The rating value.
///
public init(image: String, type: String, value: Double) {
self.image = image
self.type = type
self._value = DecimalSerialized<Double>(wrappedValue: value)
}
}}
extension Operations.Rating: 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.decode(String.self, forKey: .image)
self.type = try container.decode(String.self, forKey: .type)
self._value = try container.decode(DecimalSerialized<Double>.self, forKey: .value)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.image, forKey: .image)
try container.encode(self.type, forKey: .type)
try container.encode(self._value, forKey: .value)
}
}
extension Operations.Rating {
var valueWrapper: DecimalSerialized<Double> {
return _value
}
}