// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. import Foundation extension Operations { /// A model object public struct GetMetaDataByRatingKeyMetadata { public let addedAt: Int? public let art: String? @DecimalSerialized public private(set) var audienceRating: Double? public let audienceRatingImage: String? public let contentRating: String? public let country: [Operations.GetMetaDataByRatingKeyCountry]? public let director: [Operations.GetMetaDataByRatingKeyDirector]? public let duration: Int? public let genre: [Operations.GetMetaDataByRatingKeyGenre]? /// The name of the album artist for the track when audio, and the name of the TV show for the episode when video. public let grandparentTitle: String? public let guid: String? public let guids: [Operations.Guids]? public let hasPremiumPrimaryExtra: String? /// The index starting from 0 of this media item in the MetaData array. public let index: Int? public let key: String? public let librarySectionID: Int? public let librarySectionKey: String? public let librarySectionTitle: String? public let media: [Operations.GetMetaDataByRatingKeyMedia]? @DateOnly public private(set) var originallyAvailableAt: Date? /// The orginal untranslated name of the media item when non-english. public let originalTitle: String? /// The parent index starting from 0 of this media item in the parent MetaData array. public let parentIndex: Int? /// The name of the album for the track when audio, and the name of the season for the episode when TV show. public let parentTitle: String? public let producer: [Operations.Producer]? @DecimalSerialized public private(set) var rating: Double? public let ratingImage: String? public let ratingKey: String? public let ratings: [Operations.Ratings]? public let role: [Operations.GetMetaDataByRatingKeyRole]? public let studio: String? public let summary: String? public let tagline: String? public let thumb: String? public let title: String? public let type: String? public let updatedAt: Int? public let writer: [Operations.GetMetaDataByRatingKeyWriter]? public let year: Int? /// Creates an object with the specified parameters /// /// - Parameter grandparentTitle: The name of the album artist for the track when audio, and the name of the TV show for the episode when video. /// - Parameter index: The index starting from 0 of this media item in the MetaData array. /// - Parameter originalTitle: The orginal untranslated name of the media item when non-english. /// - Parameter parentIndex: The parent index starting from 0 of this media item in the parent MetaData array. /// - Parameter parentTitle: The name of the album for the track when audio, and the name of the season for the episode when TV show. /// public init(addedAt: Int? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, contentRating: String? = nil, country: [Operations.GetMetaDataByRatingKeyCountry]? = nil, director: [Operations.GetMetaDataByRatingKeyDirector]? = nil, duration: Int? = nil, genre: [Operations.GetMetaDataByRatingKeyGenre]? = nil, grandparentTitle: String? = nil, guid: String? = nil, guids: [Operations.Guids]? = nil, hasPremiumPrimaryExtra: String? = nil, index: Int? = nil, key: String? = nil, librarySectionID: Int? = nil, librarySectionKey: String? = nil, librarySectionTitle: String? = nil, media: [Operations.GetMetaDataByRatingKeyMedia]? = nil, originallyAvailableAt: Date? = nil, originalTitle: String? = nil, parentIndex: Int? = nil, parentTitle: String? = nil, producer: [Operations.Producer]? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: String? = nil, ratings: [Operations.Ratings]? = nil, role: [Operations.GetMetaDataByRatingKeyRole]? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Int? = nil, writer: [Operations.GetMetaDataByRatingKeyWriter]? = nil, year: Int? = nil) { self.addedAt = addedAt self.art = art self._audienceRating = DecimalSerialized(wrappedValue: audienceRating) self.audienceRatingImage = audienceRatingImage self.contentRating = contentRating self.country = country self.director = director self.duration = duration self.genre = genre self.grandparentTitle = grandparentTitle self.guid = guid self.guids = guids self.hasPremiumPrimaryExtra = hasPremiumPrimaryExtra self.index = index self.key = key self.librarySectionID = librarySectionID self.librarySectionKey = librarySectionKey self.librarySectionTitle = librarySectionTitle self.media = media self._originallyAvailableAt = DateOnly(wrappedValue: originallyAvailableAt) self.originalTitle = originalTitle self.parentIndex = parentIndex self.parentTitle = parentTitle self.producer = producer self._rating = DecimalSerialized(wrappedValue: rating) self.ratingImage = ratingImage self.ratingKey = ratingKey self.ratings = ratings self.role = role self.studio = studio self.summary = summary self.tagline = tagline self.thumb = thumb self.title = title self.type = type self.updatedAt = updatedAt self.writer = writer self.year = year } }} extension Operations.GetMetaDataByRatingKeyMetadata: Codable { enum CodingKeys: String, CodingKey { case addedAt case art case audienceRating case audienceRatingImage case contentRating case country = "Country" case director = "Director" case duration case genre = "Genre" case grandparentTitle case guid case guids = "Guid" case hasPremiumPrimaryExtra case index case key case librarySectionID case librarySectionKey case librarySectionTitle case media = "Media" case originallyAvailableAt case originalTitle case parentIndex case parentTitle case producer = "Producer" case rating case ratingImage case ratingKey case ratings = "Rating" case role = "Role" case studio case summary case tagline case thumb case title case type case updatedAt case writer = "Writer" case year } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.addedAt = try container.decodeIfPresent(Int.self, forKey: .addedAt) self.art = try container.decodeIfPresent(String.self, forKey: .art) self._audienceRating = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audienceRating) ?? DecimalSerialized(wrappedValue: nil) self.audienceRatingImage = try container.decodeIfPresent(String.self, forKey: .audienceRatingImage) self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating) self.country = try container.decodeIfPresent([Operations.GetMetaDataByRatingKeyCountry].self, forKey: .country) self.director = try container.decodeIfPresent([Operations.GetMetaDataByRatingKeyDirector].self, forKey: .director) self.duration = try container.decodeIfPresent(Int.self, forKey: .duration) self.genre = try container.decodeIfPresent([Operations.GetMetaDataByRatingKeyGenre].self, forKey: .genre) self.grandparentTitle = try container.decodeIfPresent(String.self, forKey: .grandparentTitle) self.guid = try container.decodeIfPresent(String.self, forKey: .guid) self.guids = try container.decodeIfPresent([Operations.Guids].self, forKey: .guids) self.hasPremiumPrimaryExtra = try container.decodeIfPresent(String.self, forKey: .hasPremiumPrimaryExtra) self.index = try container.decodeIfPresent(Int.self, forKey: .index) self.key = try container.decodeIfPresent(String.self, forKey: .key) self.librarySectionID = try container.decodeIfPresent(Int.self, forKey: .librarySectionID) self.librarySectionKey = try container.decodeIfPresent(String.self, forKey: .librarySectionKey) self.librarySectionTitle = try container.decodeIfPresent(String.self, forKey: .librarySectionTitle) self.media = try container.decodeIfPresent([Operations.GetMetaDataByRatingKeyMedia].self, forKey: .media) self._originallyAvailableAt = try container.decodeIfPresent(DateOnly.self, forKey: .originallyAvailableAt) ?? DateOnly(wrappedValue: nil) self.originalTitle = try container.decodeIfPresent(String.self, forKey: .originalTitle) self.parentIndex = try container.decodeIfPresent(Int.self, forKey: .parentIndex) self.parentTitle = try container.decodeIfPresent(String.self, forKey: .parentTitle) self.producer = try container.decodeIfPresent([Operations.Producer].self, forKey: .producer) self._rating = try container.decodeIfPresent(DecimalSerialized.self, forKey: .rating) ?? DecimalSerialized(wrappedValue: nil) self.ratingImage = try container.decodeIfPresent(String.self, forKey: .ratingImage) self.ratingKey = try container.decodeIfPresent(String.self, forKey: .ratingKey) self.ratings = try container.decodeIfPresent([Operations.Ratings].self, forKey: .ratings) self.role = try container.decodeIfPresent([Operations.GetMetaDataByRatingKeyRole].self, forKey: .role) self.studio = try container.decodeIfPresent(String.self, forKey: .studio) self.summary = try container.decodeIfPresent(String.self, forKey: .summary) self.tagline = try container.decodeIfPresent(String.self, forKey: .tagline) self.thumb = try container.decodeIfPresent(String.self, forKey: .thumb) self.title = try container.decodeIfPresent(String.self, forKey: .title) self.type = try container.decodeIfPresent(String.self, forKey: .type) self.updatedAt = try container.decodeIfPresent(Int.self, forKey: .updatedAt) self.writer = try container.decodeIfPresent([Operations.GetMetaDataByRatingKeyWriter].self, forKey: .writer) self.year = try container.decodeIfPresent(Int.self, forKey: .year) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(self.addedAt, forKey: .addedAt) try container.encodeIfPresent(self.art, forKey: .art) if self.audienceRating != nil { try container.encode(self._audienceRating, forKey: .audienceRating) } try container.encodeIfPresent(self.audienceRatingImage, forKey: .audienceRatingImage) try container.encodeIfPresent(self.contentRating, forKey: .contentRating) try container.encodeIfPresent(self.country, forKey: .country) try container.encodeIfPresent(self.director, forKey: .director) try container.encodeIfPresent(self.duration, forKey: .duration) try container.encodeIfPresent(self.genre, forKey: .genre) try container.encodeIfPresent(self.grandparentTitle, forKey: .grandparentTitle) try container.encodeIfPresent(self.guid, forKey: .guid) try container.encodeIfPresent(self.guids, forKey: .guids) try container.encodeIfPresent(self.hasPremiumPrimaryExtra, forKey: .hasPremiumPrimaryExtra) try container.encodeIfPresent(self.index, forKey: .index) try container.encodeIfPresent(self.key, forKey: .key) try container.encodeIfPresent(self.librarySectionID, forKey: .librarySectionID) try container.encodeIfPresent(self.librarySectionKey, forKey: .librarySectionKey) try container.encodeIfPresent(self.librarySectionTitle, forKey: .librarySectionTitle) try container.encodeIfPresent(self.media, forKey: .media) if self.originallyAvailableAt != nil { try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt) } try container.encodeIfPresent(self.originalTitle, forKey: .originalTitle) try container.encodeIfPresent(self.parentIndex, forKey: .parentIndex) try container.encodeIfPresent(self.parentTitle, forKey: .parentTitle) try container.encodeIfPresent(self.producer, forKey: .producer) if self.rating != nil { try container.encode(self._rating, forKey: .rating) } try container.encodeIfPresent(self.ratingImage, forKey: .ratingImage) try container.encodeIfPresent(self.ratingKey, forKey: .ratingKey) try container.encodeIfPresent(self.ratings, forKey: .ratings) try container.encodeIfPresent(self.role, forKey: .role) try container.encodeIfPresent(self.studio, forKey: .studio) try container.encodeIfPresent(self.summary, forKey: .summary) try container.encodeIfPresent(self.tagline, forKey: .tagline) try container.encodeIfPresent(self.thumb, forKey: .thumb) try container.encodeIfPresent(self.title, forKey: .title) try container.encodeIfPresent(self.type, forKey: .type) try container.encodeIfPresent(self.updatedAt, forKey: .updatedAt) try container.encodeIfPresent(self.writer, forKey: .writer) try container.encodeIfPresent(self.year, forKey: .year) } } extension Operations.GetMetaDataByRatingKeyMetadata { var ratingWrapper: DecimalSerialized { return _rating } var audienceRatingWrapper: DecimalSerialized { return _audienceRating } var originallyAvailableAtWrapper: DateOnly { return _originallyAvailableAt } }