// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. import Foundation extension Operations { /// A model object public struct GetLibraryHubsMetadata { public let addedAt: Int? public let art: String? @DecimalSerialized public private(set) var audienceRating: Double? public let audienceRatingImage: String? public let chapterSource: String? public let contentRating: String? public let country: [Operations.GetLibraryHubsCountry]? public let director: [Operations.GetLibraryHubsDirector]? public let duration: Int? public let genre: [Operations.GetLibraryHubsGenre]? public let guid: String? public let key: String? public let lastViewedAt: Int? public let librarySectionID: Int? public let librarySectionKey: String? public let librarySectionTitle: String? public let media: [Operations.GetLibraryHubsMedia]? @DateOnly public private(set) var originallyAvailableAt: Date? public let primaryExtraKey: String? @DecimalSerialized public private(set) var rating: Double? public let ratingImage: String? public let ratingKey: String? public let role: [Operations.GetLibraryHubsRole]? public let skipCount: Int? 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 viewCount: Int? public let writer: [Operations.GetLibraryHubsWriter]? public let year: Int? /// Creates an object with the specified parameters /// /// public init(addedAt: Int? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, chapterSource: String? = nil, contentRating: String? = nil, country: [Operations.GetLibraryHubsCountry]? = nil, director: [Operations.GetLibraryHubsDirector]? = nil, duration: Int? = nil, genre: [Operations.GetLibraryHubsGenre]? = nil, guid: String? = nil, key: String? = nil, lastViewedAt: Int? = nil, librarySectionID: Int? = nil, librarySectionKey: String? = nil, librarySectionTitle: String? = nil, media: [Operations.GetLibraryHubsMedia]? = nil, originallyAvailableAt: Date? = nil, primaryExtraKey: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: String? = nil, role: [Operations.GetLibraryHubsRole]? = nil, skipCount: Int? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Int? = nil, viewCount: Int? = nil, writer: [Operations.GetLibraryHubsWriter]? = nil, year: Int? = nil) { self.addedAt = addedAt self.art = art self._audienceRating = DecimalSerialized(wrappedValue: audienceRating) self.audienceRatingImage = audienceRatingImage self.chapterSource = chapterSource self.contentRating = contentRating self.country = country self.director = director self.duration = duration self.genre = genre self.guid = guid self.key = key self.lastViewedAt = lastViewedAt self.librarySectionID = librarySectionID self.librarySectionKey = librarySectionKey self.librarySectionTitle = librarySectionTitle self.media = media self._originallyAvailableAt = DateOnly(wrappedValue: originallyAvailableAt) self.primaryExtraKey = primaryExtraKey self._rating = DecimalSerialized(wrappedValue: rating) self.ratingImage = ratingImage self.ratingKey = ratingKey self.role = role self.skipCount = skipCount self.studio = studio self.summary = summary self.tagline = tagline self.thumb = thumb self.title = title self.type = type self.updatedAt = updatedAt self.viewCount = viewCount self.writer = writer self.year = year } }} extension Operations.GetLibraryHubsMetadata: Codable { enum CodingKeys: String, CodingKey { case addedAt case art case audienceRating case audienceRatingImage case chapterSource case contentRating case country = "Country" case director = "Director" case duration case genre = "Genre" case guid case key case lastViewedAt case librarySectionID case librarySectionKey case librarySectionTitle case media = "Media" case originallyAvailableAt case primaryExtraKey case rating case ratingImage case ratingKey case role = "Role" case skipCount case studio case summary case tagline case thumb case title case type case updatedAt case viewCount 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.chapterSource = try container.decodeIfPresent(String.self, forKey: .chapterSource) self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating) self.country = try container.decodeIfPresent([Operations.GetLibraryHubsCountry].self, forKey: .country) self.director = try container.decodeIfPresent([Operations.GetLibraryHubsDirector].self, forKey: .director) self.duration = try container.decodeIfPresent(Int.self, forKey: .duration) self.genre = try container.decodeIfPresent([Operations.GetLibraryHubsGenre].self, forKey: .genre) self.guid = try container.decodeIfPresent(String.self, forKey: .guid) self.key = try container.decodeIfPresent(String.self, forKey: .key) self.lastViewedAt = try container.decodeIfPresent(Int.self, forKey: .lastViewedAt) 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.GetLibraryHubsMedia].self, forKey: .media) self._originallyAvailableAt = try container.decodeIfPresent(DateOnly.self, forKey: .originallyAvailableAt) ?? DateOnly(wrappedValue: nil) self.primaryExtraKey = try container.decodeIfPresent(String.self, forKey: .primaryExtraKey) 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.role = try container.decodeIfPresent([Operations.GetLibraryHubsRole].self, forKey: .role) self.skipCount = try container.decodeIfPresent(Int.self, forKey: .skipCount) 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.viewCount = try container.decodeIfPresent(Int.self, forKey: .viewCount) self.writer = try container.decodeIfPresent([Operations.GetLibraryHubsWriter].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.chapterSource, forKey: .chapterSource) 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.guid, forKey: .guid) try container.encodeIfPresent(self.key, forKey: .key) try container.encodeIfPresent(self.lastViewedAt, forKey: .lastViewedAt) 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.primaryExtraKey, forKey: .primaryExtraKey) 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.role, forKey: .role) try container.encodeIfPresent(self.skipCount, forKey: .skipCount) 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.viewCount, forKey: .viewCount) try container.encodeIfPresent(self.writer, forKey: .writer) try container.encodeIfPresent(self.year, forKey: .year) } } extension Operations.GetLibraryHubsMetadata { var ratingWrapper: DecimalSerialized { return _rating } var audienceRatingWrapper: DecimalSerialized { return _audienceRating } var originallyAvailableAtWrapper: DateOnly { return _originallyAvailableAt } }