10.9.2 Generation (#35)

This commit is contained in:
Ethan Pippin 2024-05-20 12:37:34 -06:00 committed by GitHub
parent eae2ab5ed7
commit a0e848a7aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
227 changed files with 13658 additions and 7201 deletions

View File

@ -22,6 +22,7 @@ struct Plugin: CommandPlugin {
// Apply post patches // Apply post patches
try await patchRemoteSearchResult(context: context) try await patchRemoteSearchResult(context: context)
try await patchAnyJSON(context: context) try await patchAnyJSON(context: context)
try await patchGroupUpdateDiscriminator(context: context)
// Move patch files // Move patch files
try await addSpecialFeatureType(context: context) try await addSpecialFeatureType(context: context)
@ -103,8 +104,8 @@ struct Plugin: CommandPlugin {
try FileManager.default.removeItem(atPath: filePath.string) try FileManager.default.removeItem(atPath: filePath.string)
} }
// BaseItemDto: add SpecialFeatureType string format and CollectionTypeOptions // TODO: remove when BaseItemDto uses `ExtraType` or other
// object reference to properties prior to generation // BaseItemDto: add SpecialFeatureType string format to property prior to generation
private func patchBaseItemDtoSchema(context: PluginContext) async throws { private func patchBaseItemDtoSchema(context: PluginContext) async throws {
let contents = try await parseOriginalSchema(context: context) let contents = try await parseOriginalSchema(context: context)
@ -122,16 +123,6 @@ struct Plugin: CommandPlugin {
] ]
) )
// TODO: Uncomment once Swiftfin has refactored how it uses the existing CollectionType
// property for library management
// properties["CollectionType"] = AnyJSON.object(
// [
// "allOf": .array([.object(["$ref": .string("#/components/schemas/CollectionTypeOptions")])]),
// "nullable": .bool(true),
// "description": .string("Gets or sets the type of the collection."),
// ]
// )
baseItemDto["properties"] = .object(properties) baseItemDto["properties"] = .object(properties)
schemas["BaseItemDto"] = .object(baseItemDto) schemas["BaseItemDto"] = .object(baseItemDto)
components["schemas"] = .object(schemas) components["schemas"] = .object(schemas)
@ -195,4 +186,20 @@ struct Plugin: CommandPlugin {
try sourceData.write(to: URL(fileURLWithPath: finalFilePath.string)) try sourceData.write(to: URL(fileURLWithPath: finalFilePath.string))
} }
// TODO: Remove if/when fixed within CreateAPI
// Entities/GroupUpdate.swift: change generated `Type` name to `_Type`
private func patchGroupUpdateDiscriminator(context: PluginContext) async throws {
let filePath = context
.package
.directory
.appending(["Sources", "Entities", "GroupUpdate.swift"])
let contents = try String(contentsOfFile: filePath.string)
.replacingOccurrences(of: "Type", with: "_Type")
try contents
.data(using: .utf8)?
.write(to: URL(fileURLWithPath: filePath.string))
}
} }

View File

@ -19,4 +19,6 @@ public enum SpecialFeatureType: String, Codable, CaseIterable {
case sample = "Sample" case sample = "Sample"
case themeSong = "ThemeSong" case themeSong = "ThemeSong"
case themeVideo = "ThemeVideo" case themeVideo = "ThemeVideo"
case featurette = "Featurette"
case short = "Short"
} }

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Activity log created message.
public struct ActivityLogEntryMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: [ActivityLogEntry]?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: [ActivityLogEntry]? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent([ActivityLogEntry].self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,36 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Activity log entry start message.
///
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
public struct ActivityLogEntryStartMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(String.self, forKey: "Data")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,29 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Activity log entry stop message.
public struct ActivityLogEntryStopMessage: Codable, Hashable {
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageType: SessionMessageType? = nil) {
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,16 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// An enum representing formats of spatial audio.
public enum AudioSpatialFormat: String, Codable, CaseIterable {
case none = "None"
case dolbyAtmos = "DolbyAtmos"
case dtsx = "DTSX"
}

View File

@ -10,31 +10,24 @@ import Foundation
/// The authenticate user by name request body. /// The authenticate user by name request body.
public struct AuthenticateUserByName: Codable, Hashable { public struct AuthenticateUserByName: Codable, Hashable {
/// Gets or sets the sha1-hashed password.
///
/// - warning: Deprecated.
public var password: String?
/// Gets or sets the plain text password. /// Gets or sets the plain text password.
public var pw: String? public var pw: String?
/// Gets or sets the username. /// Gets or sets the username.
public var username: String? public var username: String?
public init(password: String? = nil, pw: String? = nil, username: String? = nil) { public init(pw: String? = nil, username: String? = nil) {
self.password = password
self.pw = pw self.pw = pw
self.username = username self.username = username
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.password = try values.decodeIfPresent(String.self, forKey: "Password")
self.pw = try values.decodeIfPresent(String.self, forKey: "Pw") self.pw = try values.decodeIfPresent(String.self, forKey: "Pw")
self.username = try values.decodeIfPresent(String.self, forKey: "Username") self.username = try values.decodeIfPresent(String.self, forKey: "Username")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(password, forKey: "Password")
try values.encodeIfPresent(pw, forKey: "Pw") try values.encodeIfPresent(pw, forKey: "Pw")
try values.encodeIfPresent(username, forKey: "Username") try values.encodeIfPresent(username, forKey: "Username")
} }

View File

@ -61,7 +61,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
/// Gets or sets the child count. /// Gets or sets the child count.
public var childCount: Int? public var childCount: Int?
/// Gets or sets the type of the collection. /// Gets or sets the type of the collection.
public var collectionType: String? public var collectionType: CollectionType?
/// Gets or sets the community rating. /// Gets or sets the community rating.
public var communityRating: Float? public var communityRating: Float?
/// Gets or sets the completion percentage. /// Gets or sets the completion percentage.
@ -98,6 +98,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
public var genreItems: [NameGuidPair]? public var genreItems: [NameGuidPair]?
/// Gets or sets the genres. /// Gets or sets the genres.
public var genres: [String]? public var genres: [String]?
public var hasLyrics: Bool?
public var hasSubtitles: Bool? public var hasSubtitles: Bool?
public var height: Int? public var height: Int?
/// Gets or sets the id. /// Gets or sets the id.
@ -154,13 +155,15 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
/// Gets or sets the media streams. /// Gets or sets the media streams.
public var mediaStreams: [MediaStream]? public var mediaStreams: [MediaStream]?
/// Gets or sets the type of the media. /// Gets or sets the type of the media.
public var mediaType: String? public var mediaType: MediaType?
/// Gets or sets the movie count. /// Gets or sets the movie count.
public var movieCount: Int? public var movieCount: Int?
/// Gets or sets the music video count. /// Gets or sets the music video count.
public var musicVideoCount: Int? public var musicVideoCount: Int?
/// Gets or sets the name. /// Gets or sets the name.
public var name: String? public var name: String?
/// Gets or sets the gain required for audio normalization.
public var normalizationGain: Float?
/// Gets or sets the number. /// Gets or sets the number.
public var number: String? public var number: String?
/// Gets or sets the official rating. /// Gets or sets the official rating.
@ -170,11 +173,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
public var overview: String? public var overview: String?
/// Gets or sets the parent art image tag. /// Gets or sets the parent art image tag.
public var parentArtImageTag: String? public var parentArtImageTag: String?
/// Gets or sets wether the item has fan art, this will hold the Id of the Parent that has one. /// Gets or sets whether the item has fan art, this will hold the Id of the Parent that has one.
public var parentArtItemID: String? public var parentArtItemID: String?
/// Gets or sets the parent backdrop image tags. /// Gets or sets the parent backdrop image tags.
public var parentBackdropImageTags: [String]? public var parentBackdropImageTags: [String]?
/// Gets or sets wether the item has any backdrops, this will hold the Id of the Parent that has one. /// Gets or sets whether the item has any backdrops, this will hold the Id of the Parent that has one.
public var parentBackdropItemID: String? public var parentBackdropItemID: String?
/// Gets or sets the parent id. /// Gets or sets the parent id.
public var parentID: String? public var parentID: String?
@ -182,7 +185,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
public var parentIndexNumber: Int? public var parentIndexNumber: Int?
/// Gets or sets the parent logo image tag. /// Gets or sets the parent logo image tag.
public var parentLogoImageTag: String? public var parentLogoImageTag: String?
/// Gets or sets wether the item has a logo, this will hold the Id of the Parent that has one. /// Gets or sets whether the item has a logo, this will hold the Id of the Parent that has one.
public var parentLogoItemID: String? public var parentLogoItemID: String?
/// Gets or sets the parent primary image item identifier. /// Gets or sets the parent primary image item identifier.
public var parentPrimaryImageItemID: String? public var parentPrimaryImageItemID: String?
@ -260,8 +263,6 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
public var status: String? public var status: String?
/// Gets or sets the studios. /// Gets or sets the studios.
public var studios: [NameGuidPair]? public var studios: [NameGuidPair]?
/// Gets or sets a value indicating whether [supports synchronize].
public var isSupportsSync: Bool?
/// Gets or sets the taglines. /// Gets or sets the taglines.
public var taglines: [String]? public var taglines: [String]?
/// Gets or sets the tags. /// Gets or sets the tags.
@ -270,6 +271,8 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
public var timerID: String? public var timerID: String?
/// Gets or sets the trailer count. /// Gets or sets the trailer count.
public var trailerCount: Int? public var trailerCount: Int?
/// Gets or sets the trickplay manifest.
public var trickplay: [String: [String: TrickplayInfo]]?
/// Gets or sets the type. /// Gets or sets the type.
public var type: BaseItemKind? public var type: BaseItemKind?
/// Gets or sets the user data for this item based on the user it's being requested for. /// Gets or sets the user data for this item based on the user it's being requested for.
@ -394,7 +397,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
channelType: ChannelType? = nil, channelType: ChannelType? = nil,
chapters: [ChapterInfo]? = nil, chapters: [ChapterInfo]? = nil,
childCount: Int? = nil, childCount: Int? = nil,
collectionType: String? = nil, collectionType: CollectionType? = nil,
communityRating: Float? = nil, communityRating: Float? = nil,
completionPercentage: Double? = nil, completionPercentage: Double? = nil,
container: String? = nil, container: String? = nil,
@ -417,6 +420,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
forcedSortName: String? = nil, forcedSortName: String? = nil,
genreItems: [NameGuidPair]? = nil, genreItems: [NameGuidPair]? = nil,
genres: [String]? = nil, genres: [String]? = nil,
hasLyrics: Bool? = nil,
hasSubtitles: Bool? = nil, hasSubtitles: Bool? = nil,
height: Int? = nil, height: Int? = nil,
id: String? = nil, id: String? = nil,
@ -447,10 +451,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
mediaSourceCount: Int? = nil, mediaSourceCount: Int? = nil,
mediaSources: [MediaSourceInfo]? = nil, mediaSources: [MediaSourceInfo]? = nil,
mediaStreams: [MediaStream]? = nil, mediaStreams: [MediaStream]? = nil,
mediaType: String? = nil, mediaType: MediaType? = nil,
movieCount: Int? = nil, movieCount: Int? = nil,
musicVideoCount: Int? = nil, musicVideoCount: Int? = nil,
name: String? = nil, name: String? = nil,
normalizationGain: Float? = nil,
number: String? = nil, number: String? = nil,
officialRating: String? = nil, officialRating: String? = nil,
originalTitle: String? = nil, originalTitle: String? = nil,
@ -504,11 +509,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
startDate: Date? = nil, startDate: Date? = nil,
status: String? = nil, status: String? = nil,
studios: [NameGuidPair]? = nil, studios: [NameGuidPair]? = nil,
isSupportsSync: Bool? = nil,
taglines: [String]? = nil, taglines: [String]? = nil,
tags: [String]? = nil, tags: [String]? = nil,
timerID: String? = nil, timerID: String? = nil,
trailerCount: Int? = nil, trailerCount: Int? = nil,
trickplay: [String: [String: TrickplayInfo]]? = nil,
type: BaseItemKind? = nil, type: BaseItemKind? = nil,
userData: UserItemDataDto? = nil, userData: UserItemDataDto? = nil,
video3DFormat: Video3DFormat? = nil, video3DFormat: Video3DFormat? = nil,
@ -568,6 +573,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.forcedSortName = forcedSortName self.forcedSortName = forcedSortName
self.genreItems = genreItems self.genreItems = genreItems
self.genres = genres self.genres = genres
self.hasLyrics = hasLyrics
self.hasSubtitles = hasSubtitles self.hasSubtitles = hasSubtitles
self.height = height self.height = height
self.id = id self.id = id
@ -602,6 +608,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.movieCount = movieCount self.movieCount = movieCount
self.musicVideoCount = musicVideoCount self.musicVideoCount = musicVideoCount
self.name = name self.name = name
self.normalizationGain = normalizationGain
self.number = number self.number = number
self.officialRating = officialRating self.officialRating = officialRating
self.originalTitle = originalTitle self.originalTitle = originalTitle
@ -655,11 +662,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.startDate = startDate self.startDate = startDate
self.status = status self.status = status
self.studios = studios self.studios = studios
self.isSupportsSync = isSupportsSync
self.taglines = taglines self.taglines = taglines
self.tags = tags self.tags = tags
self.timerID = timerID self.timerID = timerID
self.trailerCount = trailerCount self.trailerCount = trailerCount
self.trickplay = trickplay
self.type = type self.type = type
self.userData = userData self.userData = userData
self.video3DFormat = video3DFormat self.video3DFormat = video3DFormat
@ -699,7 +706,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.channelType = try values.decodeIfPresent(ChannelType.self, forKey: "ChannelType") self.channelType = try values.decodeIfPresent(ChannelType.self, forKey: "ChannelType")
self.chapters = try values.decodeIfPresent([ChapterInfo].self, forKey: "Chapters") self.chapters = try values.decodeIfPresent([ChapterInfo].self, forKey: "Chapters")
self.childCount = try values.decodeIfPresent(Int.self, forKey: "ChildCount") self.childCount = try values.decodeIfPresent(Int.self, forKey: "ChildCount")
self.collectionType = try values.decodeIfPresent(String.self, forKey: "CollectionType") self.collectionType = try values.decodeIfPresent(CollectionType.self, forKey: "CollectionType")
self.communityRating = try values.decodeIfPresent(Float.self, forKey: "CommunityRating") self.communityRating = try values.decodeIfPresent(Float.self, forKey: "CommunityRating")
self.completionPercentage = try values.decodeIfPresent(Double.self, forKey: "CompletionPercentage") self.completionPercentage = try values.decodeIfPresent(Double.self, forKey: "CompletionPercentage")
self.container = try values.decodeIfPresent(String.self, forKey: "Container") self.container = try values.decodeIfPresent(String.self, forKey: "Container")
@ -722,6 +729,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.forcedSortName = try values.decodeIfPresent(String.self, forKey: "ForcedSortName") self.forcedSortName = try values.decodeIfPresent(String.self, forKey: "ForcedSortName")
self.genreItems = try values.decodeIfPresent([NameGuidPair].self, forKey: "GenreItems") self.genreItems = try values.decodeIfPresent([NameGuidPair].self, forKey: "GenreItems")
self.genres = try values.decodeIfPresent([String].self, forKey: "Genres") self.genres = try values.decodeIfPresent([String].self, forKey: "Genres")
self.hasLyrics = try values.decodeIfPresent(Bool.self, forKey: "HasLyrics")
self.hasSubtitles = try values.decodeIfPresent(Bool.self, forKey: "HasSubtitles") self.hasSubtitles = try values.decodeIfPresent(Bool.self, forKey: "HasSubtitles")
self.height = try values.decodeIfPresent(Int.self, forKey: "Height") self.height = try values.decodeIfPresent(Int.self, forKey: "Height")
self.id = try values.decodeIfPresent(String.self, forKey: "Id") self.id = try values.decodeIfPresent(String.self, forKey: "Id")
@ -752,10 +760,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.mediaSourceCount = try values.decodeIfPresent(Int.self, forKey: "MediaSourceCount") self.mediaSourceCount = try values.decodeIfPresent(Int.self, forKey: "MediaSourceCount")
self.mediaSources = try values.decodeIfPresent([MediaSourceInfo].self, forKey: "MediaSources") self.mediaSources = try values.decodeIfPresent([MediaSourceInfo].self, forKey: "MediaSources")
self.mediaStreams = try values.decodeIfPresent([MediaStream].self, forKey: "MediaStreams") self.mediaStreams = try values.decodeIfPresent([MediaStream].self, forKey: "MediaStreams")
self.mediaType = try values.decodeIfPresent(String.self, forKey: "MediaType") self.mediaType = try values.decodeIfPresent(MediaType.self, forKey: "MediaType")
self.movieCount = try values.decodeIfPresent(Int.self, forKey: "MovieCount") self.movieCount = try values.decodeIfPresent(Int.self, forKey: "MovieCount")
self.musicVideoCount = try values.decodeIfPresent(Int.self, forKey: "MusicVideoCount") self.musicVideoCount = try values.decodeIfPresent(Int.self, forKey: "MusicVideoCount")
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decodeIfPresent(String.self, forKey: "Name")
self.normalizationGain = try values.decodeIfPresent(Float.self, forKey: "NormalizationGain")
self.number = try values.decodeIfPresent(String.self, forKey: "Number") self.number = try values.decodeIfPresent(String.self, forKey: "Number")
self.officialRating = try values.decodeIfPresent(String.self, forKey: "OfficialRating") self.officialRating = try values.decodeIfPresent(String.self, forKey: "OfficialRating")
self.originalTitle = try values.decodeIfPresent(String.self, forKey: "OriginalTitle") self.originalTitle = try values.decodeIfPresent(String.self, forKey: "OriginalTitle")
@ -809,11 +818,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
self.startDate = try values.decodeIfPresent(Date.self, forKey: "StartDate") self.startDate = try values.decodeIfPresent(Date.self, forKey: "StartDate")
self.status = try values.decodeIfPresent(String.self, forKey: "Status") self.status = try values.decodeIfPresent(String.self, forKey: "Status")
self.studios = try values.decodeIfPresent([NameGuidPair].self, forKey: "Studios") self.studios = try values.decodeIfPresent([NameGuidPair].self, forKey: "Studios")
self.isSupportsSync = try values.decodeIfPresent(Bool.self, forKey: "SupportsSync")
self.taglines = try values.decodeIfPresent([String].self, forKey: "Taglines") self.taglines = try values.decodeIfPresent([String].self, forKey: "Taglines")
self.tags = try values.decodeIfPresent([String].self, forKey: "Tags") self.tags = try values.decodeIfPresent([String].self, forKey: "Tags")
self.timerID = try values.decodeIfPresent(String.self, forKey: "TimerId") self.timerID = try values.decodeIfPresent(String.self, forKey: "TimerId")
self.trailerCount = try values.decodeIfPresent(Int.self, forKey: "TrailerCount") self.trailerCount = try values.decodeIfPresent(Int.self, forKey: "TrailerCount")
self.trickplay = try values.decodeIfPresent([String: [String: TrickplayInfo]].self, forKey: "Trickplay")
self.type = try values.decodeIfPresent(BaseItemKind.self, forKey: "Type") self.type = try values.decodeIfPresent(BaseItemKind.self, forKey: "Type")
self.userData = try values.decodeIfPresent(UserItemDataDto.self, forKey: "UserData") self.userData = try values.decodeIfPresent(UserItemDataDto.self, forKey: "UserData")
self.video3DFormat = try values.decodeIfPresent(Video3DFormat.self, forKey: "Video3DFormat") self.video3DFormat = try values.decodeIfPresent(Video3DFormat.self, forKey: "Video3DFormat")
@ -876,6 +885,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
try values.encodeIfPresent(forcedSortName, forKey: "ForcedSortName") try values.encodeIfPresent(forcedSortName, forKey: "ForcedSortName")
try values.encodeIfPresent(genreItems, forKey: "GenreItems") try values.encodeIfPresent(genreItems, forKey: "GenreItems")
try values.encodeIfPresent(genres, forKey: "Genres") try values.encodeIfPresent(genres, forKey: "Genres")
try values.encodeIfPresent(hasLyrics, forKey: "HasLyrics")
try values.encodeIfPresent(hasSubtitles, forKey: "HasSubtitles") try values.encodeIfPresent(hasSubtitles, forKey: "HasSubtitles")
try values.encodeIfPresent(height, forKey: "Height") try values.encodeIfPresent(height, forKey: "Height")
try values.encodeIfPresent(id, forKey: "Id") try values.encodeIfPresent(id, forKey: "Id")
@ -910,6 +920,7 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
try values.encodeIfPresent(movieCount, forKey: "MovieCount") try values.encodeIfPresent(movieCount, forKey: "MovieCount")
try values.encodeIfPresent(musicVideoCount, forKey: "MusicVideoCount") try values.encodeIfPresent(musicVideoCount, forKey: "MusicVideoCount")
try values.encodeIfPresent(name, forKey: "Name") try values.encodeIfPresent(name, forKey: "Name")
try values.encodeIfPresent(normalizationGain, forKey: "NormalizationGain")
try values.encodeIfPresent(number, forKey: "Number") try values.encodeIfPresent(number, forKey: "Number")
try values.encodeIfPresent(officialRating, forKey: "OfficialRating") try values.encodeIfPresent(officialRating, forKey: "OfficialRating")
try values.encodeIfPresent(originalTitle, forKey: "OriginalTitle") try values.encodeIfPresent(originalTitle, forKey: "OriginalTitle")
@ -963,11 +974,11 @@ public struct BaseItemDto: Codable, Hashable, Identifiable {
try values.encodeIfPresent(startDate, forKey: "StartDate") try values.encodeIfPresent(startDate, forKey: "StartDate")
try values.encodeIfPresent(status, forKey: "Status") try values.encodeIfPresent(status, forKey: "Status")
try values.encodeIfPresent(studios, forKey: "Studios") try values.encodeIfPresent(studios, forKey: "Studios")
try values.encodeIfPresent(isSupportsSync, forKey: "SupportsSync")
try values.encodeIfPresent(taglines, forKey: "Taglines") try values.encodeIfPresent(taglines, forKey: "Taglines")
try values.encodeIfPresent(tags, forKey: "Tags") try values.encodeIfPresent(tags, forKey: "Tags")
try values.encodeIfPresent(timerID, forKey: "TimerId") try values.encodeIfPresent(timerID, forKey: "TimerId")
try values.encodeIfPresent(trailerCount, forKey: "TrailerCount") try values.encodeIfPresent(trailerCount, forKey: "TrailerCount")
try values.encodeIfPresent(trickplay, forKey: "Trickplay")
try values.encodeIfPresent(type, forKey: "Type") try values.encodeIfPresent(type, forKey: "Type")
try values.encodeIfPresent(userData, forKey: "UserData") try values.encodeIfPresent(userData, forKey: "UserData")
try values.encodeIfPresent(video3DFormat, forKey: "Video3DFormat") try values.encodeIfPresent(video3DFormat, forKey: "Video3DFormat")

View File

@ -21,7 +21,7 @@ public struct BaseItemPerson: Codable, Hashable, Identifiable {
/// Gets or sets the role. /// Gets or sets the role.
public var role: String? public var role: String?
/// Gets or sets the type. /// Gets or sets the type.
public var type: String? public var type: PersonKind?
/// Gets or sets the primary image blurhash. /// Gets or sets the primary image blurhash.
public struct ImageBlurHashes: Codable, Hashable { public struct ImageBlurHashes: Codable, Hashable {
@ -110,7 +110,7 @@ public struct BaseItemPerson: Codable, Hashable, Identifiable {
name: String? = nil, name: String? = nil,
primaryImageTag: String? = nil, primaryImageTag: String? = nil,
role: String? = nil, role: String? = nil,
type: String? = nil type: PersonKind? = nil
) { ) {
self.id = id self.id = id
self.imageBlurHashes = imageBlurHashes self.imageBlurHashes = imageBlurHashes
@ -127,7 +127,7 @@ public struct BaseItemPerson: Codable, Hashable, Identifiable {
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decodeIfPresent(String.self, forKey: "Name")
self.primaryImageTag = try values.decodeIfPresent(String.self, forKey: "PrimaryImageTag") self.primaryImageTag = try values.decodeIfPresent(String.self, forKey: "PrimaryImageTag")
self.role = try values.decodeIfPresent(String.self, forKey: "Role") self.role = try values.decodeIfPresent(String.self, forKey: "Role")
self.type = try values.decodeIfPresent(String.self, forKey: "Type") self.type = try values.decodeIfPresent(PersonKind.self, forKey: "Type")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// The cast receiver application model.
public struct CastReceiverApplication: Codable, Hashable, Identifiable {
/// Gets or sets the cast receiver application id.
public var id: String?
/// Gets or sets the cast receiver application name.
public var name: String?
public init(id: String? = nil, name: String? = nil) {
self.id = id
self.name = name
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.id = try values.decodeIfPresent(String.self, forKey: "Id")
self.name = try values.decodeIfPresent(String.self, forKey: "Name")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(id, forKey: "Id")
try values.encodeIfPresent(name, forKey: "Name")
}
}

View File

@ -26,20 +26,20 @@ public struct ClientCapabilities: Codable, Hashable {
/// case it isn't. /// case it isn't.
public var deviceProfile: DeviceProfile? public var deviceProfile: DeviceProfile?
public var iconURL: String? public var iconURL: String?
public var messageCallbackURL: String? public var playableMediaTypes: [MediaType]?
public var playableMediaTypes: [String]?
public var supportedCommands: [GeneralCommandType]? public var supportedCommands: [GeneralCommandType]?
public var isSupportsContentUploading: Bool? /// - warning: Deprecated.
public var isSupportsContentUploading: Bool
public var isSupportsMediaControl: Bool? public var isSupportsMediaControl: Bool?
public var isSupportsPersistentIdentifier: Bool? public var isSupportsPersistentIdentifier: Bool?
public var isSupportsSync: Bool? /// - warning: Deprecated.
public var isSupportsSync: Bool
public init( public init(
appStoreURL: String? = nil, appStoreURL: String? = nil,
deviceProfile: DeviceProfile? = nil, deviceProfile: DeviceProfile? = nil,
iconURL: String? = nil, iconURL: String? = nil,
messageCallbackURL: String? = nil, playableMediaTypes: [MediaType]? = nil,
playableMediaTypes: [String]? = nil,
supportedCommands: [GeneralCommandType]? = nil, supportedCommands: [GeneralCommandType]? = nil,
isSupportsContentUploading: Bool? = nil, isSupportsContentUploading: Bool? = nil,
isSupportsMediaControl: Bool? = nil, isSupportsMediaControl: Bool? = nil,
@ -49,13 +49,12 @@ public struct ClientCapabilities: Codable, Hashable {
self.appStoreURL = appStoreURL self.appStoreURL = appStoreURL
self.deviceProfile = deviceProfile self.deviceProfile = deviceProfile
self.iconURL = iconURL self.iconURL = iconURL
self.messageCallbackURL = messageCallbackURL
self.playableMediaTypes = playableMediaTypes self.playableMediaTypes = playableMediaTypes
self.supportedCommands = supportedCommands self.supportedCommands = supportedCommands
self.isSupportsContentUploading = isSupportsContentUploading self.isSupportsContentUploading = isSupportsContentUploading ?? false
self.isSupportsMediaControl = isSupportsMediaControl self.isSupportsMediaControl = isSupportsMediaControl
self.isSupportsPersistentIdentifier = isSupportsPersistentIdentifier self.isSupportsPersistentIdentifier = isSupportsPersistentIdentifier
self.isSupportsSync = isSupportsSync self.isSupportsSync = isSupportsSync ?? false
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
@ -63,13 +62,12 @@ public struct ClientCapabilities: Codable, Hashable {
self.appStoreURL = try values.decodeIfPresent(String.self, forKey: "AppStoreUrl") self.appStoreURL = try values.decodeIfPresent(String.self, forKey: "AppStoreUrl")
self.deviceProfile = try values.decodeIfPresent(DeviceProfile.self, forKey: "DeviceProfile") self.deviceProfile = try values.decodeIfPresent(DeviceProfile.self, forKey: "DeviceProfile")
self.iconURL = try values.decodeIfPresent(String.self, forKey: "IconUrl") self.iconURL = try values.decodeIfPresent(String.self, forKey: "IconUrl")
self.messageCallbackURL = try values.decodeIfPresent(String.self, forKey: "MessageCallbackUrl") self.playableMediaTypes = try values.decodeIfPresent([MediaType].self, forKey: "PlayableMediaTypes")
self.playableMediaTypes = try values.decodeIfPresent([String].self, forKey: "PlayableMediaTypes")
self.supportedCommands = try values.decodeIfPresent([GeneralCommandType].self, forKey: "SupportedCommands") self.supportedCommands = try values.decodeIfPresent([GeneralCommandType].self, forKey: "SupportedCommands")
self.isSupportsContentUploading = try values.decodeIfPresent(Bool.self, forKey: "SupportsContentUploading") self.isSupportsContentUploading = try values.decodeIfPresent(Bool.self, forKey: "SupportsContentUploading") ?? false
self.isSupportsMediaControl = try values.decodeIfPresent(Bool.self, forKey: "SupportsMediaControl") self.isSupportsMediaControl = try values.decodeIfPresent(Bool.self, forKey: "SupportsMediaControl")
self.isSupportsPersistentIdentifier = try values.decodeIfPresent(Bool.self, forKey: "SupportsPersistentIdentifier") self.isSupportsPersistentIdentifier = try values.decodeIfPresent(Bool.self, forKey: "SupportsPersistentIdentifier")
self.isSupportsSync = try values.decodeIfPresent(Bool.self, forKey: "SupportsSync") self.isSupportsSync = try values.decodeIfPresent(Bool.self, forKey: "SupportsSync") ?? false
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
@ -77,7 +75,6 @@ public struct ClientCapabilities: Codable, Hashable {
try values.encodeIfPresent(appStoreURL, forKey: "AppStoreUrl") try values.encodeIfPresent(appStoreURL, forKey: "AppStoreUrl")
try values.encodeIfPresent(deviceProfile, forKey: "DeviceProfile") try values.encodeIfPresent(deviceProfile, forKey: "DeviceProfile")
try values.encodeIfPresent(iconURL, forKey: "IconUrl") try values.encodeIfPresent(iconURL, forKey: "IconUrl")
try values.encodeIfPresent(messageCallbackURL, forKey: "MessageCallbackUrl")
try values.encodeIfPresent(playableMediaTypes, forKey: "PlayableMediaTypes") try values.encodeIfPresent(playableMediaTypes, forKey: "PlayableMediaTypes")
try values.encodeIfPresent(supportedCommands, forKey: "SupportedCommands") try values.encodeIfPresent(supportedCommands, forKey: "SupportedCommands")
try values.encodeIfPresent(isSupportsContentUploading, forKey: "SupportsContentUploading") try values.encodeIfPresent(isSupportsContentUploading, forKey: "SupportsContentUploading")

View File

@ -29,27 +29,24 @@ public struct ClientCapabilitiesDto: Codable, Hashable {
public var deviceProfile: DeviceProfile? public var deviceProfile: DeviceProfile?
/// Gets or sets the icon url. /// Gets or sets the icon url.
public var iconURL: String? public var iconURL: String?
/// Gets or sets the message callback url.
public var messageCallbackURL: String?
/// Gets or sets the list of playable media types. /// Gets or sets the list of playable media types.
public var playableMediaTypes: [String]? public var playableMediaTypes: [MediaType]?
/// Gets or sets the list of supported commands. /// Gets or sets the list of supported commands.
public var supportedCommands: [GeneralCommandType]? public var supportedCommands: [GeneralCommandType]?
/// Gets or sets a value indicating whether session supports content uploading. /// - warning: Deprecated.
public var isSupportsContentUploading: Bool? public var isSupportsContentUploading: Bool
/// Gets or sets a value indicating whether session supports media control. /// Gets or sets a value indicating whether session supports media control.
public var isSupportsMediaControl: Bool? public var isSupportsMediaControl: Bool?
/// Gets or sets a value indicating whether session supports a persistent identifier. /// Gets or sets a value indicating whether session supports a persistent identifier.
public var isSupportsPersistentIdentifier: Bool? public var isSupportsPersistentIdentifier: Bool?
/// Gets or sets a value indicating whether session supports sync. /// - warning: Deprecated.
public var isSupportsSync: Bool? public var isSupportsSync: Bool
public init( public init(
appStoreURL: String? = nil, appStoreURL: String? = nil,
deviceProfile: DeviceProfile? = nil, deviceProfile: DeviceProfile? = nil,
iconURL: String? = nil, iconURL: String? = nil,
messageCallbackURL: String? = nil, playableMediaTypes: [MediaType]? = nil,
playableMediaTypes: [String]? = nil,
supportedCommands: [GeneralCommandType]? = nil, supportedCommands: [GeneralCommandType]? = nil,
isSupportsContentUploading: Bool? = nil, isSupportsContentUploading: Bool? = nil,
isSupportsMediaControl: Bool? = nil, isSupportsMediaControl: Bool? = nil,
@ -59,13 +56,12 @@ public struct ClientCapabilitiesDto: Codable, Hashable {
self.appStoreURL = appStoreURL self.appStoreURL = appStoreURL
self.deviceProfile = deviceProfile self.deviceProfile = deviceProfile
self.iconURL = iconURL self.iconURL = iconURL
self.messageCallbackURL = messageCallbackURL
self.playableMediaTypes = playableMediaTypes self.playableMediaTypes = playableMediaTypes
self.supportedCommands = supportedCommands self.supportedCommands = supportedCommands
self.isSupportsContentUploading = isSupportsContentUploading self.isSupportsContentUploading = isSupportsContentUploading ?? false
self.isSupportsMediaControl = isSupportsMediaControl self.isSupportsMediaControl = isSupportsMediaControl
self.isSupportsPersistentIdentifier = isSupportsPersistentIdentifier self.isSupportsPersistentIdentifier = isSupportsPersistentIdentifier
self.isSupportsSync = isSupportsSync self.isSupportsSync = isSupportsSync ?? false
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
@ -73,13 +69,12 @@ public struct ClientCapabilitiesDto: Codable, Hashable {
self.appStoreURL = try values.decodeIfPresent(String.self, forKey: "AppStoreUrl") self.appStoreURL = try values.decodeIfPresent(String.self, forKey: "AppStoreUrl")
self.deviceProfile = try values.decodeIfPresent(DeviceProfile.self, forKey: "DeviceProfile") self.deviceProfile = try values.decodeIfPresent(DeviceProfile.self, forKey: "DeviceProfile")
self.iconURL = try values.decodeIfPresent(String.self, forKey: "IconUrl") self.iconURL = try values.decodeIfPresent(String.self, forKey: "IconUrl")
self.messageCallbackURL = try values.decodeIfPresent(String.self, forKey: "MessageCallbackUrl") self.playableMediaTypes = try values.decodeIfPresent([MediaType].self, forKey: "PlayableMediaTypes")
self.playableMediaTypes = try values.decodeIfPresent([String].self, forKey: "PlayableMediaTypes")
self.supportedCommands = try values.decodeIfPresent([GeneralCommandType].self, forKey: "SupportedCommands") self.supportedCommands = try values.decodeIfPresent([GeneralCommandType].self, forKey: "SupportedCommands")
self.isSupportsContentUploading = try values.decodeIfPresent(Bool.self, forKey: "SupportsContentUploading") self.isSupportsContentUploading = try values.decodeIfPresent(Bool.self, forKey: "SupportsContentUploading") ?? false
self.isSupportsMediaControl = try values.decodeIfPresent(Bool.self, forKey: "SupportsMediaControl") self.isSupportsMediaControl = try values.decodeIfPresent(Bool.self, forKey: "SupportsMediaControl")
self.isSupportsPersistentIdentifier = try values.decodeIfPresent(Bool.self, forKey: "SupportsPersistentIdentifier") self.isSupportsPersistentIdentifier = try values.decodeIfPresent(Bool.self, forKey: "SupportsPersistentIdentifier")
self.isSupportsSync = try values.decodeIfPresent(Bool.self, forKey: "SupportsSync") self.isSupportsSync = try values.decodeIfPresent(Bool.self, forKey: "SupportsSync") ?? false
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
@ -87,7 +82,6 @@ public struct ClientCapabilitiesDto: Codable, Hashable {
try values.encodeIfPresent(appStoreURL, forKey: "AppStoreUrl") try values.encodeIfPresent(appStoreURL, forKey: "AppStoreUrl")
try values.encodeIfPresent(deviceProfile, forKey: "DeviceProfile") try values.encodeIfPresent(deviceProfile, forKey: "DeviceProfile")
try values.encodeIfPresent(iconURL, forKey: "IconUrl") try values.encodeIfPresent(iconURL, forKey: "IconUrl")
try values.encodeIfPresent(messageCallbackURL, forKey: "MessageCallbackUrl")
try values.encodeIfPresent(playableMediaTypes, forKey: "PlayableMediaTypes") try values.encodeIfPresent(playableMediaTypes, forKey: "PlayableMediaTypes")
try values.encodeIfPresent(supportedCommands, forKey: "SupportedCommands") try values.encodeIfPresent(supportedCommands, forKey: "SupportedCommands")
try values.encodeIfPresent(isSupportsContentUploading, forKey: "SupportsContentUploading") try values.encodeIfPresent(isSupportsContentUploading, forKey: "SupportsContentUploading")

View File

@ -0,0 +1,26 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Collection type.
public enum CollectionType: String, Codable, CaseIterable {
case unknown
case movies
case tvshows
case music
case musicvideos
case trailers
case homevideos
case boxsets
case books
case photos
case livetv
case playlists
case folders
}

View File

@ -8,13 +8,14 @@
import Foundation import Foundation
/// The collection type options.
public enum CollectionTypeOptions: String, Codable, CaseIterable { public enum CollectionTypeOptions: String, Codable, CaseIterable {
case movies = "Movies" case movies
case tvShows = "TvShows" case tvshows
case music = "Music" case music
case musicVideos = "MusicVideos" case musicvideos
case homeVideos = "HomeVideos" case homevideos
case boxSets = "BoxSets" case boxsets
case books = "Books" case books
case mixed = "Mixed" case mixed
} }

View File

@ -12,33 +12,50 @@ import Foundation
public struct CreatePlaylistDto: Codable, Hashable { public struct CreatePlaylistDto: Codable, Hashable {
/// Gets or sets item ids to add to the playlist. /// Gets or sets item ids to add to the playlist.
public var ids: [String]? public var ids: [String]?
/// Gets or sets a value indicating whether the playlist is public.
public var isPublic: Bool?
/// Gets or sets the media type. /// Gets or sets the media type.
public var mediaType: String? public var mediaType: MediaType?
/// Gets or sets the name of the new playlist. /// Gets or sets the name of the new playlist.
public var name: String? public var name: String?
/// Gets or sets the user id. /// Gets or sets the user id.
public var userID: String? public var userID: String?
/// Gets or sets the playlist users.
public var users: [PlaylistUserPermissions]?
public init(ids: [String]? = nil, mediaType: String? = nil, name: String? = nil, userID: String? = nil) { public init(
ids: [String]? = nil,
isPublic: Bool? = nil,
mediaType: MediaType? = nil,
name: String? = nil,
userID: String? = nil,
users: [PlaylistUserPermissions]? = nil
) {
self.ids = ids self.ids = ids
self.isPublic = isPublic
self.mediaType = mediaType self.mediaType = mediaType
self.name = name self.name = name
self.userID = userID self.userID = userID
self.users = users
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.ids = try values.decodeIfPresent([String].self, forKey: "Ids") self.ids = try values.decodeIfPresent([String].self, forKey: "Ids")
self.mediaType = try values.decodeIfPresent(String.self, forKey: "MediaType") self.isPublic = try values.decodeIfPresent(Bool.self, forKey: "IsPublic")
self.mediaType = try values.decodeIfPresent(MediaType.self, forKey: "MediaType")
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decodeIfPresent(String.self, forKey: "Name")
self.userID = try values.decodeIfPresent(String.self, forKey: "UserId") self.userID = try values.decodeIfPresent(String.self, forKey: "UserId")
self.users = try values.decodeIfPresent([PlaylistUserPermissions].self, forKey: "Users")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(ids, forKey: "Ids") try values.encodeIfPresent(ids, forKey: "Ids")
try values.encodeIfPresent(isPublic, forKey: "IsPublic")
try values.encodeIfPresent(mediaType, forKey: "MediaType") try values.encodeIfPresent(mediaType, forKey: "MediaType")
try values.encodeIfPresent(name, forKey: "Name") try values.encodeIfPresent(name, forKey: "Name")
try values.encodeIfPresent(userID, forKey: "UserId") try values.encodeIfPresent(userID, forKey: "UserId")
try values.encodeIfPresent(users, forKey: "Users")
} }
} }

View File

@ -11,24 +11,24 @@ import Foundation
/// The create user by name request body. /// The create user by name request body.
public struct CreateUserByName: Codable, Hashable { public struct CreateUserByName: Codable, Hashable {
/// Gets or sets the username. /// Gets or sets the username.
public var name: String? public var name: String
/// Gets or sets the password. /// Gets or sets the password.
public var password: String? public var password: String?
public init(name: String? = nil, password: String? = nil) { public init(name: String, password: String? = nil) {
self.name = name self.name = name
self.password = password self.password = password
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decode(String.self, forKey: "Name")
self.password = try values.decodeIfPresent(String.self, forKey: "Password") self.password = try values.decodeIfPresent(String.self, forKey: "Password")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(name, forKey: "Name") try values.encode(name, forKey: "Name")
try values.encodeIfPresent(password, forKey: "Password") try values.encodeIfPresent(password, forKey: "Password")
} }
} }

View File

@ -17,6 +17,7 @@ public struct DeviceInfo: Codable, Hashable, Identifiable {
public var appVersion: String? public var appVersion: String?
/// Gets or sets the capabilities. /// Gets or sets the capabilities.
public var capabilities: ClientCapabilities? public var capabilities: ClientCapabilities?
public var customName: String?
/// Gets or sets the date last modified. /// Gets or sets the date last modified.
public var dateLastActivity: Date? public var dateLastActivity: Date?
public var iconURL: String? public var iconURL: String?
@ -33,6 +34,7 @@ public struct DeviceInfo: Codable, Hashable, Identifiable {
appName: String? = nil, appName: String? = nil,
appVersion: String? = nil, appVersion: String? = nil,
capabilities: ClientCapabilities? = nil, capabilities: ClientCapabilities? = nil,
customName: String? = nil,
dateLastActivity: Date? = nil, dateLastActivity: Date? = nil,
iconURL: String? = nil, iconURL: String? = nil,
id: String? = nil, id: String? = nil,
@ -44,6 +46,7 @@ public struct DeviceInfo: Codable, Hashable, Identifiable {
self.appName = appName self.appName = appName
self.appVersion = appVersion self.appVersion = appVersion
self.capabilities = capabilities self.capabilities = capabilities
self.customName = customName
self.dateLastActivity = dateLastActivity self.dateLastActivity = dateLastActivity
self.iconURL = iconURL self.iconURL = iconURL
self.id = id self.id = id
@ -58,6 +61,7 @@ public struct DeviceInfo: Codable, Hashable, Identifiable {
self.appName = try values.decodeIfPresent(String.self, forKey: "AppName") self.appName = try values.decodeIfPresent(String.self, forKey: "AppName")
self.appVersion = try values.decodeIfPresent(String.self, forKey: "AppVersion") self.appVersion = try values.decodeIfPresent(String.self, forKey: "AppVersion")
self.capabilities = try values.decodeIfPresent(ClientCapabilities.self, forKey: "Capabilities") self.capabilities = try values.decodeIfPresent(ClientCapabilities.self, forKey: "Capabilities")
self.customName = try values.decodeIfPresent(String.self, forKey: "CustomName")
self.dateLastActivity = try values.decodeIfPresent(Date.self, forKey: "DateLastActivity") self.dateLastActivity = try values.decodeIfPresent(Date.self, forKey: "DateLastActivity")
self.iconURL = try values.decodeIfPresent(String.self, forKey: "IconUrl") self.iconURL = try values.decodeIfPresent(String.self, forKey: "IconUrl")
self.id = try values.decodeIfPresent(String.self, forKey: "Id") self.id = try values.decodeIfPresent(String.self, forKey: "Id")
@ -72,6 +76,7 @@ public struct DeviceInfo: Codable, Hashable, Identifiable {
try values.encodeIfPresent(appName, forKey: "AppName") try values.encodeIfPresent(appName, forKey: "AppName")
try values.encodeIfPresent(appVersion, forKey: "AppVersion") try values.encodeIfPresent(appVersion, forKey: "AppVersion")
try values.encodeIfPresent(capabilities, forKey: "Capabilities") try values.encodeIfPresent(capabilities, forKey: "Capabilities")
try values.encodeIfPresent(customName, forKey: "CustomName")
try values.encodeIfPresent(dateLastActivity, forKey: "DateLastActivity") try values.encodeIfPresent(dateLastActivity, forKey: "DateLastActivity")
try values.encodeIfPresent(iconURL, forKey: "IconUrl") try values.encodeIfPresent(iconURL, forKey: "IconUrl")
try values.encodeIfPresent(id, forKey: "Id") try values.encodeIfPresent(id, forKey: "Id")

View File

@ -21,250 +21,82 @@ import Foundation
/// as well as which <see cref="P:MediaBrowser.Model.Dlna.DeviceProfile.TranscodingProfiles">containers/codecs to transcode to</see> in case /// as well as which <see cref="P:MediaBrowser.Model.Dlna.DeviceProfile.TranscodingProfiles">containers/codecs to transcode to</see> in case
/// it isn't. /// it isn't.
public struct DeviceProfile: Codable, Hashable, Identifiable { public struct DeviceProfile: Codable, Hashable, Identifiable {
/// Gets or sets the AlbumArtPn.
public var albumArtPn: String?
/// Gets or sets the codec profiles. /// Gets or sets the codec profiles.
public var codecProfiles: [CodecProfile]? public var codecProfiles: [CodecProfile]?
/// Gets or sets the container profiles. /// Gets or sets the container profiles.
public var containerProfiles: [ContainerProfile]? public var containerProfiles: [ContainerProfile]?
/// Gets or sets the direct play profiles. /// Gets or sets the direct play profiles.
public var directPlayProfiles: [DirectPlayProfile]? public var directPlayProfiles: [DirectPlayProfile]?
/// Gets or sets a value indicating whether EnableAlbumArtInDidl.
public var enableAlbumArtInDidl: Bool
/// Gets or sets a value indicating whether EnableMSMediaReceiverRegistrar.
public var enableMSMediaReceiverRegistrar: Bool
/// Gets or sets a value indicating whether EnableSingleAlbumArtLimit.
public var enableSingleAlbumArtLimit: Bool
/// Gets or sets a value indicating whether EnableSingleSubtitleLimit.
public var enableSingleSubtitleLimit: Bool
/// Gets or sets the friendly name of the device profile, which can be shown to users.
public var friendlyName: String?
/// Gets or sets the Id. /// Gets or sets the Id.
public var id: String? public var id: String?
/// Gets or sets the Identification.
public var identification: DeviceIdentification?
/// Gets or sets a value indicating whether IgnoreTranscodeByteRangeRequests.
public var isIgnoreTranscodeByteRangeRequests: Bool
/// Gets or sets the manufacturer of the device which this profile represents.
public var manufacturer: String?
/// Gets or sets an url for the manufacturer of the device which this profile represents.
public var manufacturerURL: String?
/// Gets or sets the MaxAlbumArtHeight.
public var maxAlbumArtHeight: Int?
/// Gets or sets the MaxAlbumArtWidth.
public var maxAlbumArtWidth: Int?
/// Gets or sets the maximum allowed height of embedded icons.
public var maxIconHeight: Int?
/// Gets or sets the maximum allowed width of embedded icons.
public var maxIconWidth: Int?
/// Gets or sets the maximum allowed bitrate for statically streamed content (= direct played files). /// Gets or sets the maximum allowed bitrate for statically streamed content (= direct played files).
public var maxStaticBitrate: Int? public var maxStaticBitrate: Int?
/// Gets or sets the maximum allowed bitrate for statically streamed (= direct played) music files. /// Gets or sets the maximum allowed bitrate for statically streamed (= direct played) music files.
public var maxStaticMusicBitrate: Int? public var maxStaticMusicBitrate: Int?
/// Gets or sets the maximum allowed bitrate for all streamed content. /// Gets or sets the maximum allowed bitrate for all streamed content.
public var maxStreamingBitrate: Int? public var maxStreamingBitrate: Int?
/// Gets or sets the model description of the device which this profile represents.
public var modelDescription: String?
/// Gets or sets the model name of the device which this profile represents.
public var modelName: String?
/// Gets or sets the model number of the device which this profile represents.
public var modelNumber: String?
/// Gets or sets the ModelUrl.
public var modelURL: String?
/// Gets or sets the maximum allowed bitrate for transcoded music streams. /// Gets or sets the maximum allowed bitrate for transcoded music streams.
public var musicStreamingTranscodingBitrate: Int? public var musicStreamingTranscodingBitrate: Int?
/// Gets or sets the name of this device profile. /// Gets or sets the name of this device profile.
public var name: String? public var name: String?
/// Gets or sets the ProtocolInfo.
public var protocolInfo: String?
/// Gets or sets a value indicating whether RequiresPlainFolders.
public var requiresPlainFolders: Bool
/// Gets or sets a value indicating whether RequiresPlainVideoItems.
public var requiresPlainVideoItems: Bool
/// Gets or sets the ResponseProfiles.
public var responseProfiles: [ResponseProfile]?
/// Gets or sets the serial number of the device which this profile represents.
public var serialNumber: String?
/// Gets or sets the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace.
public var sonyAggregationFlags: String?
/// Gets or sets the subtitle profiles. /// Gets or sets the subtitle profiles.
public var subtitleProfiles: [SubtitleProfile]? public var subtitleProfiles: [SubtitleProfile]?
/// Gets or sets the SupportedMediaTypes.
public var supportedMediaTypes: String?
/// Gets or sets the TimelineOffsetSeconds.
public var timelineOffsetSeconds: Int?
/// Gets or sets the transcoding profiles. /// Gets or sets the transcoding profiles.
public var transcodingProfiles: [TranscodingProfile]? public var transcodingProfiles: [TranscodingProfile]?
/// Gets or sets the UserId.
public var userID: String?
/// Gets or sets the XmlRootAttributes.
public var xmlRootAttributes: [XmlAttribute]?
public init( public init(
albumArtPn: String? = nil,
codecProfiles: [CodecProfile]? = nil, codecProfiles: [CodecProfile]? = nil,
containerProfiles: [ContainerProfile]? = nil, containerProfiles: [ContainerProfile]? = nil,
directPlayProfiles: [DirectPlayProfile]? = nil, directPlayProfiles: [DirectPlayProfile]? = nil,
enableAlbumArtInDidl: Bool? = nil,
enableMSMediaReceiverRegistrar: Bool? = nil,
enableSingleAlbumArtLimit: Bool? = nil,
enableSingleSubtitleLimit: Bool? = nil,
friendlyName: String? = nil,
id: String? = nil, id: String? = nil,
identification: DeviceIdentification? = nil,
isIgnoreTranscodeByteRangeRequests: Bool? = nil,
manufacturer: String? = nil,
manufacturerURL: String? = nil,
maxAlbumArtHeight: Int? = nil,
maxAlbumArtWidth: Int? = nil,
maxIconHeight: Int? = nil,
maxIconWidth: Int? = nil,
maxStaticBitrate: Int? = nil, maxStaticBitrate: Int? = nil,
maxStaticMusicBitrate: Int? = nil, maxStaticMusicBitrate: Int? = nil,
maxStreamingBitrate: Int? = nil, maxStreamingBitrate: Int? = nil,
modelDescription: String? = nil,
modelName: String? = nil,
modelNumber: String? = nil,
modelURL: String? = nil,
musicStreamingTranscodingBitrate: Int? = nil, musicStreamingTranscodingBitrate: Int? = nil,
name: String? = nil, name: String? = nil,
protocolInfo: String? = nil,
requiresPlainFolders: Bool? = nil,
requiresPlainVideoItems: Bool? = nil,
responseProfiles: [ResponseProfile]? = nil,
serialNumber: String? = nil,
sonyAggregationFlags: String? = nil,
subtitleProfiles: [SubtitleProfile]? = nil, subtitleProfiles: [SubtitleProfile]? = nil,
supportedMediaTypes: String? = nil, transcodingProfiles: [TranscodingProfile]? = nil
timelineOffsetSeconds: Int? = nil,
transcodingProfiles: [TranscodingProfile]? = nil,
userID: String? = nil,
xmlRootAttributes: [XmlAttribute]? = nil
) { ) {
self.albumArtPn = albumArtPn
self.codecProfiles = codecProfiles self.codecProfiles = codecProfiles
self.containerProfiles = containerProfiles self.containerProfiles = containerProfiles
self.directPlayProfiles = directPlayProfiles self.directPlayProfiles = directPlayProfiles
self.enableAlbumArtInDidl = enableAlbumArtInDidl ?? false
self.enableMSMediaReceiverRegistrar = enableMSMediaReceiverRegistrar ?? false
self.enableSingleAlbumArtLimit = enableSingleAlbumArtLimit ?? false
self.enableSingleSubtitleLimit = enableSingleSubtitleLimit ?? false
self.friendlyName = friendlyName
self.id = id self.id = id
self.identification = identification
self.isIgnoreTranscodeByteRangeRequests = isIgnoreTranscodeByteRangeRequests ?? false
self.manufacturer = manufacturer
self.manufacturerURL = manufacturerURL
self.maxAlbumArtHeight = maxAlbumArtHeight
self.maxAlbumArtWidth = maxAlbumArtWidth
self.maxIconHeight = maxIconHeight
self.maxIconWidth = maxIconWidth
self.maxStaticBitrate = maxStaticBitrate self.maxStaticBitrate = maxStaticBitrate
self.maxStaticMusicBitrate = maxStaticMusicBitrate self.maxStaticMusicBitrate = maxStaticMusicBitrate
self.maxStreamingBitrate = maxStreamingBitrate self.maxStreamingBitrate = maxStreamingBitrate
self.modelDescription = modelDescription
self.modelName = modelName
self.modelNumber = modelNumber
self.modelURL = modelURL
self.musicStreamingTranscodingBitrate = musicStreamingTranscodingBitrate self.musicStreamingTranscodingBitrate = musicStreamingTranscodingBitrate
self.name = name self.name = name
self.protocolInfo = protocolInfo
self.requiresPlainFolders = requiresPlainFolders ?? false
self.requiresPlainVideoItems = requiresPlainVideoItems ?? false
self.responseProfiles = responseProfiles
self.serialNumber = serialNumber
self.sonyAggregationFlags = sonyAggregationFlags
self.subtitleProfiles = subtitleProfiles self.subtitleProfiles = subtitleProfiles
self.supportedMediaTypes = supportedMediaTypes
self.timelineOffsetSeconds = timelineOffsetSeconds
self.transcodingProfiles = transcodingProfiles self.transcodingProfiles = transcodingProfiles
self.userID = userID
self.xmlRootAttributes = xmlRootAttributes
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.albumArtPn = try values.decodeIfPresent(String.self, forKey: "AlbumArtPn")
self.codecProfiles = try values.decodeIfPresent([CodecProfile].self, forKey: "CodecProfiles") self.codecProfiles = try values.decodeIfPresent([CodecProfile].self, forKey: "CodecProfiles")
self.containerProfiles = try values.decodeIfPresent([ContainerProfile].self, forKey: "ContainerProfiles") self.containerProfiles = try values.decodeIfPresent([ContainerProfile].self, forKey: "ContainerProfiles")
self.directPlayProfiles = try values.decodeIfPresent([DirectPlayProfile].self, forKey: "DirectPlayProfiles") self.directPlayProfiles = try values.decodeIfPresent([DirectPlayProfile].self, forKey: "DirectPlayProfiles")
self.enableAlbumArtInDidl = try values.decodeIfPresent(Bool.self, forKey: "EnableAlbumArtInDidl") ?? false
self.enableMSMediaReceiverRegistrar = try values.decodeIfPresent(Bool.self, forKey: "EnableMSMediaReceiverRegistrar") ?? false
self.enableSingleAlbumArtLimit = try values.decodeIfPresent(Bool.self, forKey: "EnableSingleAlbumArtLimit") ?? false
self.enableSingleSubtitleLimit = try values.decodeIfPresent(Bool.self, forKey: "EnableSingleSubtitleLimit") ?? false
self.friendlyName = try values.decodeIfPresent(String.self, forKey: "FriendlyName")
self.id = try values.decodeIfPresent(String.self, forKey: "Id") self.id = try values.decodeIfPresent(String.self, forKey: "Id")
self.identification = try values.decodeIfPresent(DeviceIdentification.self, forKey: "Identification")
self.isIgnoreTranscodeByteRangeRequests = try values.decodeIfPresent(Bool.self, forKey: "IgnoreTranscodeByteRangeRequests") ?? false
self.manufacturer = try values.decodeIfPresent(String.self, forKey: "Manufacturer")
self.manufacturerURL = try values.decodeIfPresent(String.self, forKey: "ManufacturerUrl")
self.maxAlbumArtHeight = try values.decodeIfPresent(Int.self, forKey: "MaxAlbumArtHeight")
self.maxAlbumArtWidth = try values.decodeIfPresent(Int.self, forKey: "MaxAlbumArtWidth")
self.maxIconHeight = try values.decodeIfPresent(Int.self, forKey: "MaxIconHeight")
self.maxIconWidth = try values.decodeIfPresent(Int.self, forKey: "MaxIconWidth")
self.maxStaticBitrate = try values.decodeIfPresent(Int.self, forKey: "MaxStaticBitrate") self.maxStaticBitrate = try values.decodeIfPresent(Int.self, forKey: "MaxStaticBitrate")
self.maxStaticMusicBitrate = try values.decodeIfPresent(Int.self, forKey: "MaxStaticMusicBitrate") self.maxStaticMusicBitrate = try values.decodeIfPresent(Int.self, forKey: "MaxStaticMusicBitrate")
self.maxStreamingBitrate = try values.decodeIfPresent(Int.self, forKey: "MaxStreamingBitrate") self.maxStreamingBitrate = try values.decodeIfPresent(Int.self, forKey: "MaxStreamingBitrate")
self.modelDescription = try values.decodeIfPresent(String.self, forKey: "ModelDescription")
self.modelName = try values.decodeIfPresent(String.self, forKey: "ModelName")
self.modelNumber = try values.decodeIfPresent(String.self, forKey: "ModelNumber")
self.modelURL = try values.decodeIfPresent(String.self, forKey: "ModelUrl")
self.musicStreamingTranscodingBitrate = try values.decodeIfPresent(Int.self, forKey: "MusicStreamingTranscodingBitrate") self.musicStreamingTranscodingBitrate = try values.decodeIfPresent(Int.self, forKey: "MusicStreamingTranscodingBitrate")
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decodeIfPresent(String.self, forKey: "Name")
self.protocolInfo = try values.decodeIfPresent(String.self, forKey: "ProtocolInfo")
self.requiresPlainFolders = try values.decodeIfPresent(Bool.self, forKey: "RequiresPlainFolders") ?? false
self.requiresPlainVideoItems = try values.decodeIfPresent(Bool.self, forKey: "RequiresPlainVideoItems") ?? false
self.responseProfiles = try values.decodeIfPresent([ResponseProfile].self, forKey: "ResponseProfiles")
self.serialNumber = try values.decodeIfPresent(String.self, forKey: "SerialNumber")
self.sonyAggregationFlags = try values.decodeIfPresent(String.self, forKey: "SonyAggregationFlags")
self.subtitleProfiles = try values.decodeIfPresent([SubtitleProfile].self, forKey: "SubtitleProfiles") self.subtitleProfiles = try values.decodeIfPresent([SubtitleProfile].self, forKey: "SubtitleProfiles")
self.supportedMediaTypes = try values.decodeIfPresent(String.self, forKey: "SupportedMediaTypes")
self.timelineOffsetSeconds = try values.decodeIfPresent(Int.self, forKey: "TimelineOffsetSeconds")
self.transcodingProfiles = try values.decodeIfPresent([TranscodingProfile].self, forKey: "TranscodingProfiles") self.transcodingProfiles = try values.decodeIfPresent([TranscodingProfile].self, forKey: "TranscodingProfiles")
self.userID = try values.decodeIfPresent(String.self, forKey: "UserId")
self.xmlRootAttributes = try values.decodeIfPresent([XmlAttribute].self, forKey: "XmlRootAttributes")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(albumArtPn, forKey: "AlbumArtPn")
try values.encodeIfPresent(codecProfiles, forKey: "CodecProfiles") try values.encodeIfPresent(codecProfiles, forKey: "CodecProfiles")
try values.encodeIfPresent(containerProfiles, forKey: "ContainerProfiles") try values.encodeIfPresent(containerProfiles, forKey: "ContainerProfiles")
try values.encodeIfPresent(directPlayProfiles, forKey: "DirectPlayProfiles") try values.encodeIfPresent(directPlayProfiles, forKey: "DirectPlayProfiles")
try values.encodeIfPresent(enableAlbumArtInDidl, forKey: "EnableAlbumArtInDidl")
try values.encodeIfPresent(enableMSMediaReceiverRegistrar, forKey: "EnableMSMediaReceiverRegistrar")
try values.encodeIfPresent(enableSingleAlbumArtLimit, forKey: "EnableSingleAlbumArtLimit")
try values.encodeIfPresent(enableSingleSubtitleLimit, forKey: "EnableSingleSubtitleLimit")
try values.encodeIfPresent(friendlyName, forKey: "FriendlyName")
try values.encodeIfPresent(id, forKey: "Id") try values.encodeIfPresent(id, forKey: "Id")
try values.encodeIfPresent(identification, forKey: "Identification")
try values.encodeIfPresent(isIgnoreTranscodeByteRangeRequests, forKey: "IgnoreTranscodeByteRangeRequests")
try values.encodeIfPresent(manufacturer, forKey: "Manufacturer")
try values.encodeIfPresent(manufacturerURL, forKey: "ManufacturerUrl")
try values.encodeIfPresent(maxAlbumArtHeight, forKey: "MaxAlbumArtHeight")
try values.encodeIfPresent(maxAlbumArtWidth, forKey: "MaxAlbumArtWidth")
try values.encodeIfPresent(maxIconHeight, forKey: "MaxIconHeight")
try values.encodeIfPresent(maxIconWidth, forKey: "MaxIconWidth")
try values.encodeIfPresent(maxStaticBitrate, forKey: "MaxStaticBitrate") try values.encodeIfPresent(maxStaticBitrate, forKey: "MaxStaticBitrate")
try values.encodeIfPresent(maxStaticMusicBitrate, forKey: "MaxStaticMusicBitrate") try values.encodeIfPresent(maxStaticMusicBitrate, forKey: "MaxStaticMusicBitrate")
try values.encodeIfPresent(maxStreamingBitrate, forKey: "MaxStreamingBitrate") try values.encodeIfPresent(maxStreamingBitrate, forKey: "MaxStreamingBitrate")
try values.encodeIfPresent(modelDescription, forKey: "ModelDescription")
try values.encodeIfPresent(modelName, forKey: "ModelName")
try values.encodeIfPresent(modelNumber, forKey: "ModelNumber")
try values.encodeIfPresent(modelURL, forKey: "ModelUrl")
try values.encodeIfPresent(musicStreamingTranscodingBitrate, forKey: "MusicStreamingTranscodingBitrate") try values.encodeIfPresent(musicStreamingTranscodingBitrate, forKey: "MusicStreamingTranscodingBitrate")
try values.encodeIfPresent(name, forKey: "Name") try values.encodeIfPresent(name, forKey: "Name")
try values.encodeIfPresent(protocolInfo, forKey: "ProtocolInfo")
try values.encodeIfPresent(requiresPlainFolders, forKey: "RequiresPlainFolders")
try values.encodeIfPresent(requiresPlainVideoItems, forKey: "RequiresPlainVideoItems")
try values.encodeIfPresent(responseProfiles, forKey: "ResponseProfiles")
try values.encodeIfPresent(serialNumber, forKey: "SerialNumber")
try values.encodeIfPresent(sonyAggregationFlags, forKey: "SonyAggregationFlags")
try values.encodeIfPresent(subtitleProfiles, forKey: "SubtitleProfiles") try values.encodeIfPresent(subtitleProfiles, forKey: "SubtitleProfiles")
try values.encodeIfPresent(supportedMediaTypes, forKey: "SupportedMediaTypes")
try values.encodeIfPresent(timelineOffsetSeconds, forKey: "TimelineOffsetSeconds")
try values.encodeIfPresent(transcodingProfiles, forKey: "TranscodingProfiles") try values.encodeIfPresent(transcodingProfiles, forKey: "TranscodingProfiles")
try values.encodeIfPresent(userID, forKey: "UserId")
try values.encodeIfPresent(xmlRootAttributes, forKey: "XmlRootAttributes")
} }
} }

View File

@ -13,4 +13,5 @@ public enum DlnaProfileType: String, Codable, CaseIterable {
case video = "Video" case video = "Video"
case photo = "Photo" case photo = "Photo"
case subtitle = "Subtitle" case subtitle = "Subtitle"
case lyric = "Lyric"
} }

View File

@ -0,0 +1,18 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// An enum representing an algorithm to downmix 6ch+ to stereo.
///
/// Algorithms sourced from https://superuser.com/questions/852400/properly-downmix-5-1-to-stereo-using-ffmpeg/1410620#1410620.
public enum DownMixStereoAlgorithms: String, Codable, CaseIterable {
case none = "None"
case dave750 = "Dave750"
case nightmodeDialogue = "NightmodeDialogue"
}

View File

@ -8,54 +8,106 @@
import Foundation import Foundation
/// Class EncodingOptions.
public struct EncodingOptions: Codable, Hashable { public struct EncodingOptions: Codable, Hashable {
/// Gets or sets a value indicating whether AV1 encoding is enabled.
public var allowAv1Encoding: Bool?
/// Gets or sets a value indicating whether HEVC encoding is enabled.
public var allowHevcEncoding: Bool? public var allowHevcEncoding: Bool?
/// Gets or sets the file extensions on-demand metadata based keyframe extraction is enabled for.
public var allowOnDemandMetadataBasedKeyframeExtractionForExtensions: [String]? public var allowOnDemandMetadataBasedKeyframeExtractionForExtensions: [String]?
/// Gets or sets a value indicating whether the framerate is doubled when deinterlacing.
public var isDeinterlaceDoubleRate: Bool? public var isDeinterlaceDoubleRate: Bool?
/// Gets or sets the deinterlace method.
public var deinterlaceMethod: String? public var deinterlaceMethod: String?
/// Gets or sets the audio boost applied when downmixing audio.
public var downMixAudioBoost: Double? public var downMixAudioBoost: Double?
/// Gets or sets the algorithm used for downmixing audio to stereo.
public var downMixStereoAlgorithm: DownMixStereoAlgorithms?
/// Gets or sets a value indicating whether audio VBR is enabled.
public var enableAudioVbr: Bool?
/// Gets or sets a value indicating whether 10bit HEVC decoding is enabled.
public var enableDecodingColorDepth10Hevc: Bool? public var enableDecodingColorDepth10Hevc: Bool?
/// Gets or sets a value indicating whether 10bit VP9 decoding is enabled.
public var enableDecodingColorDepth10Vp9: Bool? public var enableDecodingColorDepth10Vp9: Bool?
/// Gets or sets a value indicating whether the enhanced NVDEC is enabled.
public var enableEnhancedNvdecDecoder: Bool? public var enableEnhancedNvdecDecoder: Bool?
/// Gets or sets a value indicating whether to use the fallback font.
public var enableFallbackFont: Bool? public var enableFallbackFont: Bool?
/// Gets or sets a value indicating whether hardware encoding is enabled.
public var enableHardwareEncoding: Bool? public var enableHardwareEncoding: Bool?
/// Gets or sets a value indicating whether the Intel H264 low-power hardware encoder should be used.
public var enableIntelLowPowerH264HwEncoder: Bool? public var enableIntelLowPowerH264HwEncoder: Bool?
/// Gets or sets a value indicating whether the Intel HEVC low-power hardware encoder should be used.
public var enableIntelLowPowerHevcHwEncoder: Bool? public var enableIntelLowPowerHevcHwEncoder: Bool?
/// Gets or sets a value indicating whether segment deletion is enabled.
public var enableSegmentDeletion: Bool?
/// Gets or sets a value indicating whether subtitle extraction is enabled.
public var enableSubtitleExtraction: Bool? public var enableSubtitleExtraction: Bool?
/// Gets or sets a value indicating whether throttling is enabled.
public var enableThrottling: Bool? public var enableThrottling: Bool?
/// Gets or sets a value indicating whether tonemapping is enabled.
public var enableTonemapping: Bool? public var enableTonemapping: Bool?
/// Gets or sets a value indicating whether videotoolbox tonemapping is enabled.
public var enableVideoToolboxTonemapping: Bool?
/// Gets or sets a value indicating whether VPP tonemapping is enabled.
public var enableVppTonemapping: Bool? public var enableVppTonemapping: Bool?
/// Gets or sets the FFmpeg path as set by the user via the UI. /// Gets or sets the FFmpeg path as set by the user via the UI.
public var encoderAppPath: String? public var encoderAppPath: String?
/// Gets or sets the current FFmpeg path being used by the system and displayed on the transcode page. /// Gets or sets the current FFmpeg path being used by the system and displayed on the transcode page.
public var encoderAppPathDisplay: String? public var encoderAppPathDisplay: String?
/// Gets or sets the encoder preset.
public var encoderPreset: String? public var encoderPreset: String?
/// Gets or sets the thread count used for encoding.
public var encodingThreadCount: Int? public var encodingThreadCount: Int?
/// Gets or sets the path to the fallback font.
public var fallbackFontPath: String? public var fallbackFontPath: String?
/// Gets or sets the H264 CRF.
public var h264Crf: Int? public var h264Crf: Int?
/// Gets or sets the H265 CRF.
public var h265Crf: Int? public var h265Crf: Int?
/// Gets or sets the hardware acceleration type.
public var hardwareAccelerationType: String? public var hardwareAccelerationType: String?
/// Gets or sets the codecs hardware encoding is used for.
public var hardwareDecodingCodecs: [String]? public var hardwareDecodingCodecs: [String]?
/// Gets or sets the maximum size of the muxing queue.
public var maxMuxingQueueSize: Int? public var maxMuxingQueueSize: Int?
/// Gets or sets a value indicating whether the system native hardware decoder should be used.
public var isPreferSystemNativeHwDecoder: Bool? public var isPreferSystemNativeHwDecoder: Bool?
/// Gets or sets seconds for which segments should be kept before being deleted.
public var segmentKeepSeconds: Int?
/// Gets or sets the delay after which throttling happens.
public var throttleDelaySeconds: Int? public var throttleDelaySeconds: Int?
/// Gets or sets the tone-mapping algorithm.
public var tonemappingAlgorithm: String? public var tonemappingAlgorithm: String?
/// Gets or sets the tone-mapping desaturation.
public var tonemappingDesat: Double? public var tonemappingDesat: Double?
/// Gets or sets the tone-mapping mode.
public var tonemappingMode: String? public var tonemappingMode: String?
/// Gets or sets the tone-mapping parameters.
public var tonemappingParam: Double? public var tonemappingParam: Double?
/// Gets or sets the tone-mapping peak.
public var tonemappingPeak: Double? public var tonemappingPeak: Double?
/// Gets or sets the tone-mapping range.
public var tonemappingRange: String? public var tonemappingRange: String?
/// Gets or sets the temporary transcoding path.
public var transcodingTempPath: String? public var transcodingTempPath: String?
/// Gets or sets the VA-API device.
public var vaapiDevice: String? public var vaapiDevice: String?
/// Gets or sets the VPP tone-mapping brightness.
public var vppTonemappingBrightness: Double? public var vppTonemappingBrightness: Double?
/// Gets or sets the VPP tone-mapping contrast.
public var vppTonemappingContrast: Double? public var vppTonemappingContrast: Double?
public init( public init(
allowAv1Encoding: Bool? = nil,
allowHevcEncoding: Bool? = nil, allowHevcEncoding: Bool? = nil,
allowOnDemandMetadataBasedKeyframeExtractionForExtensions: [String]? = nil, allowOnDemandMetadataBasedKeyframeExtractionForExtensions: [String]? = nil,
isDeinterlaceDoubleRate: Bool? = nil, isDeinterlaceDoubleRate: Bool? = nil,
deinterlaceMethod: String? = nil, deinterlaceMethod: String? = nil,
downMixAudioBoost: Double? = nil, downMixAudioBoost: Double? = nil,
downMixStereoAlgorithm: DownMixStereoAlgorithms? = nil,
enableAudioVbr: Bool? = nil,
enableDecodingColorDepth10Hevc: Bool? = nil, enableDecodingColorDepth10Hevc: Bool? = nil,
enableDecodingColorDepth10Vp9: Bool? = nil, enableDecodingColorDepth10Vp9: Bool? = nil,
enableEnhancedNvdecDecoder: Bool? = nil, enableEnhancedNvdecDecoder: Bool? = nil,
@ -63,9 +115,11 @@ public struct EncodingOptions: Codable, Hashable {
enableHardwareEncoding: Bool? = nil, enableHardwareEncoding: Bool? = nil,
enableIntelLowPowerH264HwEncoder: Bool? = nil, enableIntelLowPowerH264HwEncoder: Bool? = nil,
enableIntelLowPowerHevcHwEncoder: Bool? = nil, enableIntelLowPowerHevcHwEncoder: Bool? = nil,
enableSegmentDeletion: Bool? = nil,
enableSubtitleExtraction: Bool? = nil, enableSubtitleExtraction: Bool? = nil,
enableThrottling: Bool? = nil, enableThrottling: Bool? = nil,
enableTonemapping: Bool? = nil, enableTonemapping: Bool? = nil,
enableVideoToolboxTonemapping: Bool? = nil,
enableVppTonemapping: Bool? = nil, enableVppTonemapping: Bool? = nil,
encoderAppPath: String? = nil, encoderAppPath: String? = nil,
encoderAppPathDisplay: String? = nil, encoderAppPathDisplay: String? = nil,
@ -78,6 +132,7 @@ public struct EncodingOptions: Codable, Hashable {
hardwareDecodingCodecs: [String]? = nil, hardwareDecodingCodecs: [String]? = nil,
maxMuxingQueueSize: Int? = nil, maxMuxingQueueSize: Int? = nil,
isPreferSystemNativeHwDecoder: Bool? = nil, isPreferSystemNativeHwDecoder: Bool? = nil,
segmentKeepSeconds: Int? = nil,
throttleDelaySeconds: Int? = nil, throttleDelaySeconds: Int? = nil,
tonemappingAlgorithm: String? = nil, tonemappingAlgorithm: String? = nil,
tonemappingDesat: Double? = nil, tonemappingDesat: Double? = nil,
@ -90,11 +145,14 @@ public struct EncodingOptions: Codable, Hashable {
vppTonemappingBrightness: Double? = nil, vppTonemappingBrightness: Double? = nil,
vppTonemappingContrast: Double? = nil vppTonemappingContrast: Double? = nil
) { ) {
self.allowAv1Encoding = allowAv1Encoding
self.allowHevcEncoding = allowHevcEncoding self.allowHevcEncoding = allowHevcEncoding
self.allowOnDemandMetadataBasedKeyframeExtractionForExtensions = allowOnDemandMetadataBasedKeyframeExtractionForExtensions self.allowOnDemandMetadataBasedKeyframeExtractionForExtensions = allowOnDemandMetadataBasedKeyframeExtractionForExtensions
self.isDeinterlaceDoubleRate = isDeinterlaceDoubleRate self.isDeinterlaceDoubleRate = isDeinterlaceDoubleRate
self.deinterlaceMethod = deinterlaceMethod self.deinterlaceMethod = deinterlaceMethod
self.downMixAudioBoost = downMixAudioBoost self.downMixAudioBoost = downMixAudioBoost
self.downMixStereoAlgorithm = downMixStereoAlgorithm
self.enableAudioVbr = enableAudioVbr
self.enableDecodingColorDepth10Hevc = enableDecodingColorDepth10Hevc self.enableDecodingColorDepth10Hevc = enableDecodingColorDepth10Hevc
self.enableDecodingColorDepth10Vp9 = enableDecodingColorDepth10Vp9 self.enableDecodingColorDepth10Vp9 = enableDecodingColorDepth10Vp9
self.enableEnhancedNvdecDecoder = enableEnhancedNvdecDecoder self.enableEnhancedNvdecDecoder = enableEnhancedNvdecDecoder
@ -102,9 +160,11 @@ public struct EncodingOptions: Codable, Hashable {
self.enableHardwareEncoding = enableHardwareEncoding self.enableHardwareEncoding = enableHardwareEncoding
self.enableIntelLowPowerH264HwEncoder = enableIntelLowPowerH264HwEncoder self.enableIntelLowPowerH264HwEncoder = enableIntelLowPowerH264HwEncoder
self.enableIntelLowPowerHevcHwEncoder = enableIntelLowPowerHevcHwEncoder self.enableIntelLowPowerHevcHwEncoder = enableIntelLowPowerHevcHwEncoder
self.enableSegmentDeletion = enableSegmentDeletion
self.enableSubtitleExtraction = enableSubtitleExtraction self.enableSubtitleExtraction = enableSubtitleExtraction
self.enableThrottling = enableThrottling self.enableThrottling = enableThrottling
self.enableTonemapping = enableTonemapping self.enableTonemapping = enableTonemapping
self.enableVideoToolboxTonemapping = enableVideoToolboxTonemapping
self.enableVppTonemapping = enableVppTonemapping self.enableVppTonemapping = enableVppTonemapping
self.encoderAppPath = encoderAppPath self.encoderAppPath = encoderAppPath
self.encoderAppPathDisplay = encoderAppPathDisplay self.encoderAppPathDisplay = encoderAppPathDisplay
@ -117,6 +177,7 @@ public struct EncodingOptions: Codable, Hashable {
self.hardwareDecodingCodecs = hardwareDecodingCodecs self.hardwareDecodingCodecs = hardwareDecodingCodecs
self.maxMuxingQueueSize = maxMuxingQueueSize self.maxMuxingQueueSize = maxMuxingQueueSize
self.isPreferSystemNativeHwDecoder = isPreferSystemNativeHwDecoder self.isPreferSystemNativeHwDecoder = isPreferSystemNativeHwDecoder
self.segmentKeepSeconds = segmentKeepSeconds
self.throttleDelaySeconds = throttleDelaySeconds self.throttleDelaySeconds = throttleDelaySeconds
self.tonemappingAlgorithm = tonemappingAlgorithm self.tonemappingAlgorithm = tonemappingAlgorithm
self.tonemappingDesat = tonemappingDesat self.tonemappingDesat = tonemappingDesat
@ -132,6 +193,7 @@ public struct EncodingOptions: Codable, Hashable {
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.allowAv1Encoding = try values.decodeIfPresent(Bool.self, forKey: "AllowAv1Encoding")
self.allowHevcEncoding = try values.decodeIfPresent(Bool.self, forKey: "AllowHevcEncoding") self.allowHevcEncoding = try values.decodeIfPresent(Bool.self, forKey: "AllowHevcEncoding")
self.allowOnDemandMetadataBasedKeyframeExtractionForExtensions = try values.decodeIfPresent( self.allowOnDemandMetadataBasedKeyframeExtractionForExtensions = try values.decodeIfPresent(
[String].self, [String].self,
@ -140,6 +202,8 @@ public struct EncodingOptions: Codable, Hashable {
self.isDeinterlaceDoubleRate = try values.decodeIfPresent(Bool.self, forKey: "DeinterlaceDoubleRate") self.isDeinterlaceDoubleRate = try values.decodeIfPresent(Bool.self, forKey: "DeinterlaceDoubleRate")
self.deinterlaceMethod = try values.decodeIfPresent(String.self, forKey: "DeinterlaceMethod") self.deinterlaceMethod = try values.decodeIfPresent(String.self, forKey: "DeinterlaceMethod")
self.downMixAudioBoost = try values.decodeIfPresent(Double.self, forKey: "DownMixAudioBoost") self.downMixAudioBoost = try values.decodeIfPresent(Double.self, forKey: "DownMixAudioBoost")
self.downMixStereoAlgorithm = try values.decodeIfPresent(DownMixStereoAlgorithms.self, forKey: "DownMixStereoAlgorithm")
self.enableAudioVbr = try values.decodeIfPresent(Bool.self, forKey: "EnableAudioVbr")
self.enableDecodingColorDepth10Hevc = try values.decodeIfPresent(Bool.self, forKey: "EnableDecodingColorDepth10Hevc") self.enableDecodingColorDepth10Hevc = try values.decodeIfPresent(Bool.self, forKey: "EnableDecodingColorDepth10Hevc")
self.enableDecodingColorDepth10Vp9 = try values.decodeIfPresent(Bool.self, forKey: "EnableDecodingColorDepth10Vp9") self.enableDecodingColorDepth10Vp9 = try values.decodeIfPresent(Bool.self, forKey: "EnableDecodingColorDepth10Vp9")
self.enableEnhancedNvdecDecoder = try values.decodeIfPresent(Bool.self, forKey: "EnableEnhancedNvdecDecoder") self.enableEnhancedNvdecDecoder = try values.decodeIfPresent(Bool.self, forKey: "EnableEnhancedNvdecDecoder")
@ -147,9 +211,11 @@ public struct EncodingOptions: Codable, Hashable {
self.enableHardwareEncoding = try values.decodeIfPresent(Bool.self, forKey: "EnableHardwareEncoding") self.enableHardwareEncoding = try values.decodeIfPresent(Bool.self, forKey: "EnableHardwareEncoding")
self.enableIntelLowPowerH264HwEncoder = try values.decodeIfPresent(Bool.self, forKey: "EnableIntelLowPowerH264HwEncoder") self.enableIntelLowPowerH264HwEncoder = try values.decodeIfPresent(Bool.self, forKey: "EnableIntelLowPowerH264HwEncoder")
self.enableIntelLowPowerHevcHwEncoder = try values.decodeIfPresent(Bool.self, forKey: "EnableIntelLowPowerHevcHwEncoder") self.enableIntelLowPowerHevcHwEncoder = try values.decodeIfPresent(Bool.self, forKey: "EnableIntelLowPowerHevcHwEncoder")
self.enableSegmentDeletion = try values.decodeIfPresent(Bool.self, forKey: "EnableSegmentDeletion")
self.enableSubtitleExtraction = try values.decodeIfPresent(Bool.self, forKey: "EnableSubtitleExtraction") self.enableSubtitleExtraction = try values.decodeIfPresent(Bool.self, forKey: "EnableSubtitleExtraction")
self.enableThrottling = try values.decodeIfPresent(Bool.self, forKey: "EnableThrottling") self.enableThrottling = try values.decodeIfPresent(Bool.self, forKey: "EnableThrottling")
self.enableTonemapping = try values.decodeIfPresent(Bool.self, forKey: "EnableTonemapping") self.enableTonemapping = try values.decodeIfPresent(Bool.self, forKey: "EnableTonemapping")
self.enableVideoToolboxTonemapping = try values.decodeIfPresent(Bool.self, forKey: "EnableVideoToolboxTonemapping")
self.enableVppTonemapping = try values.decodeIfPresent(Bool.self, forKey: "EnableVppTonemapping") self.enableVppTonemapping = try values.decodeIfPresent(Bool.self, forKey: "EnableVppTonemapping")
self.encoderAppPath = try values.decodeIfPresent(String.self, forKey: "EncoderAppPath") self.encoderAppPath = try values.decodeIfPresent(String.self, forKey: "EncoderAppPath")
self.encoderAppPathDisplay = try values.decodeIfPresent(String.self, forKey: "EncoderAppPathDisplay") self.encoderAppPathDisplay = try values.decodeIfPresent(String.self, forKey: "EncoderAppPathDisplay")
@ -162,6 +228,7 @@ public struct EncodingOptions: Codable, Hashable {
self.hardwareDecodingCodecs = try values.decodeIfPresent([String].self, forKey: "HardwareDecodingCodecs") self.hardwareDecodingCodecs = try values.decodeIfPresent([String].self, forKey: "HardwareDecodingCodecs")
self.maxMuxingQueueSize = try values.decodeIfPresent(Int.self, forKey: "MaxMuxingQueueSize") self.maxMuxingQueueSize = try values.decodeIfPresent(Int.self, forKey: "MaxMuxingQueueSize")
self.isPreferSystemNativeHwDecoder = try values.decodeIfPresent(Bool.self, forKey: "PreferSystemNativeHwDecoder") self.isPreferSystemNativeHwDecoder = try values.decodeIfPresent(Bool.self, forKey: "PreferSystemNativeHwDecoder")
self.segmentKeepSeconds = try values.decodeIfPresent(Int.self, forKey: "SegmentKeepSeconds")
self.throttleDelaySeconds = try values.decodeIfPresent(Int.self, forKey: "ThrottleDelaySeconds") self.throttleDelaySeconds = try values.decodeIfPresent(Int.self, forKey: "ThrottleDelaySeconds")
self.tonemappingAlgorithm = try values.decodeIfPresent(String.self, forKey: "TonemappingAlgorithm") self.tonemappingAlgorithm = try values.decodeIfPresent(String.self, forKey: "TonemappingAlgorithm")
self.tonemappingDesat = try values.decodeIfPresent(Double.self, forKey: "TonemappingDesat") self.tonemappingDesat = try values.decodeIfPresent(Double.self, forKey: "TonemappingDesat")
@ -177,6 +244,7 @@ public struct EncodingOptions: Codable, Hashable {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(allowAv1Encoding, forKey: "AllowAv1Encoding")
try values.encodeIfPresent(allowHevcEncoding, forKey: "AllowHevcEncoding") try values.encodeIfPresent(allowHevcEncoding, forKey: "AllowHevcEncoding")
try values.encodeIfPresent( try values.encodeIfPresent(
allowOnDemandMetadataBasedKeyframeExtractionForExtensions, allowOnDemandMetadataBasedKeyframeExtractionForExtensions,
@ -185,6 +253,8 @@ public struct EncodingOptions: Codable, Hashable {
try values.encodeIfPresent(isDeinterlaceDoubleRate, forKey: "DeinterlaceDoubleRate") try values.encodeIfPresent(isDeinterlaceDoubleRate, forKey: "DeinterlaceDoubleRate")
try values.encodeIfPresent(deinterlaceMethod, forKey: "DeinterlaceMethod") try values.encodeIfPresent(deinterlaceMethod, forKey: "DeinterlaceMethod")
try values.encodeIfPresent(downMixAudioBoost, forKey: "DownMixAudioBoost") try values.encodeIfPresent(downMixAudioBoost, forKey: "DownMixAudioBoost")
try values.encodeIfPresent(downMixStereoAlgorithm, forKey: "DownMixStereoAlgorithm")
try values.encodeIfPresent(enableAudioVbr, forKey: "EnableAudioVbr")
try values.encodeIfPresent(enableDecodingColorDepth10Hevc, forKey: "EnableDecodingColorDepth10Hevc") try values.encodeIfPresent(enableDecodingColorDepth10Hevc, forKey: "EnableDecodingColorDepth10Hevc")
try values.encodeIfPresent(enableDecodingColorDepth10Vp9, forKey: "EnableDecodingColorDepth10Vp9") try values.encodeIfPresent(enableDecodingColorDepth10Vp9, forKey: "EnableDecodingColorDepth10Vp9")
try values.encodeIfPresent(enableEnhancedNvdecDecoder, forKey: "EnableEnhancedNvdecDecoder") try values.encodeIfPresent(enableEnhancedNvdecDecoder, forKey: "EnableEnhancedNvdecDecoder")
@ -192,9 +262,11 @@ public struct EncodingOptions: Codable, Hashable {
try values.encodeIfPresent(enableHardwareEncoding, forKey: "EnableHardwareEncoding") try values.encodeIfPresent(enableHardwareEncoding, forKey: "EnableHardwareEncoding")
try values.encodeIfPresent(enableIntelLowPowerH264HwEncoder, forKey: "EnableIntelLowPowerH264HwEncoder") try values.encodeIfPresent(enableIntelLowPowerH264HwEncoder, forKey: "EnableIntelLowPowerH264HwEncoder")
try values.encodeIfPresent(enableIntelLowPowerHevcHwEncoder, forKey: "EnableIntelLowPowerHevcHwEncoder") try values.encodeIfPresent(enableIntelLowPowerHevcHwEncoder, forKey: "EnableIntelLowPowerHevcHwEncoder")
try values.encodeIfPresent(enableSegmentDeletion, forKey: "EnableSegmentDeletion")
try values.encodeIfPresent(enableSubtitleExtraction, forKey: "EnableSubtitleExtraction") try values.encodeIfPresent(enableSubtitleExtraction, forKey: "EnableSubtitleExtraction")
try values.encodeIfPresent(enableThrottling, forKey: "EnableThrottling") try values.encodeIfPresent(enableThrottling, forKey: "EnableThrottling")
try values.encodeIfPresent(enableTonemapping, forKey: "EnableTonemapping") try values.encodeIfPresent(enableTonemapping, forKey: "EnableTonemapping")
try values.encodeIfPresent(enableVideoToolboxTonemapping, forKey: "EnableVideoToolboxTonemapping")
try values.encodeIfPresent(enableVppTonemapping, forKey: "EnableVppTonemapping") try values.encodeIfPresent(enableVppTonemapping, forKey: "EnableVppTonemapping")
try values.encodeIfPresent(encoderAppPath, forKey: "EncoderAppPath") try values.encodeIfPresent(encoderAppPath, forKey: "EncoderAppPath")
try values.encodeIfPresent(encoderAppPathDisplay, forKey: "EncoderAppPathDisplay") try values.encodeIfPresent(encoderAppPathDisplay, forKey: "EncoderAppPathDisplay")
@ -207,6 +279,7 @@ public struct EncodingOptions: Codable, Hashable {
try values.encodeIfPresent(hardwareDecodingCodecs, forKey: "HardwareDecodingCodecs") try values.encodeIfPresent(hardwareDecodingCodecs, forKey: "HardwareDecodingCodecs")
try values.encodeIfPresent(maxMuxingQueueSize, forKey: "MaxMuxingQueueSize") try values.encodeIfPresent(maxMuxingQueueSize, forKey: "MaxMuxingQueueSize")
try values.encodeIfPresent(isPreferSystemNativeHwDecoder, forKey: "PreferSystemNativeHwDecoder") try values.encodeIfPresent(isPreferSystemNativeHwDecoder, forKey: "PreferSystemNativeHwDecoder")
try values.encodeIfPresent(segmentKeepSeconds, forKey: "SegmentKeepSeconds")
try values.encodeIfPresent(throttleDelaySeconds, forKey: "ThrottleDelaySeconds") try values.encodeIfPresent(throttleDelaySeconds, forKey: "ThrottleDelaySeconds")
try values.encodeIfPresent(tonemappingAlgorithm, forKey: "TonemappingAlgorithm") try values.encodeIfPresent(tonemappingAlgorithm, forKey: "TonemappingAlgorithm")
try values.encodeIfPresent(tonemappingDesat, forKey: "TonemappingDesat") try values.encodeIfPresent(tonemappingDesat, forKey: "TonemappingDesat")

View File

@ -22,4 +22,5 @@ public enum ExternalIDMediaType: String, Codable, CaseIterable {
case season = "Season" case season = "Season"
case series = "Series" case series = "Series"
case track = "Track" case track = "Track"
case book = "Book"
} }

View File

@ -0,0 +1,24 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
public enum ExtraType: String, Codable, CaseIterable {
case unknown = "Unknown"
case clip = "Clip"
case trailer = "Trailer"
case behindTheScenes = "BehindTheScenes"
case deletedScene = "DeletedScene"
case interview = "Interview"
case scene = "Scene"
case sample = "Sample"
case themeSong = "ThemeSong"
case themeVideo = "ThemeVideo"
case featurette = "Featurette"
case short = "Short"
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Force keep alive websocket messages.
public struct ForceKeepAliveMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: Int?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: Int? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(Int.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// General command websocket message.
public struct GeneralCommandMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: GeneralCommand?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: GeneralCommand? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(GeneralCommand.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -52,4 +52,5 @@ public enum GeneralCommandType: String, Codable, CaseIterable {
case toggleOsdMenu = "ToggleOsdMenu" case toggleOsdMenu = "ToggleOsdMenu"
case play = "Play" case play = "Play"
case setMaxStreamingBitrate = "SetMaxStreamingBitrate" case setMaxStreamingBitrate = "SetMaxStreamingBitrate"
case setPlaybackOrder = "SetPlaybackOrder"
} }

View File

@ -99,7 +99,7 @@ public struct GetProgramsDto: Codable, Hashable {
/// Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate. /// Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate.
/// ///
/// Optional. /// Optional.
public var sortBy: [String]? public var sortBy: [ItemSortBy]?
/// Gets or sets sort Order - Ascending,Descending. /// Gets or sets sort Order - Ascending,Descending.
public var sortOrder: [SortOrder]? public var sortOrder: [SortOrder]?
/// Gets or sets the record index to start at. All items with a lower index will be dropped from the results. /// Gets or sets the record index to start at. All items with a lower index will be dropped from the results.
@ -133,7 +133,7 @@ public struct GetProgramsDto: Codable, Hashable {
minEndDate: Date? = nil, minEndDate: Date? = nil,
minStartDate: Date? = nil, minStartDate: Date? = nil,
seriesTimerID: String? = nil, seriesTimerID: String? = nil,
sortBy: [String]? = nil, sortBy: [ItemSortBy]? = nil,
sortOrder: [SortOrder]? = nil, sortOrder: [SortOrder]? = nil,
startIndex: Int? = nil, startIndex: Int? = nil,
userID: String? = nil userID: String? = nil
@ -192,7 +192,7 @@ public struct GetProgramsDto: Codable, Hashable {
self.minEndDate = try values.decodeIfPresent(Date.self, forKey: "MinEndDate") self.minEndDate = try values.decodeIfPresent(Date.self, forKey: "MinEndDate")
self.minStartDate = try values.decodeIfPresent(Date.self, forKey: "MinStartDate") self.minStartDate = try values.decodeIfPresent(Date.self, forKey: "MinStartDate")
self.seriesTimerID = try values.decodeIfPresent(String.self, forKey: "SeriesTimerId") self.seriesTimerID = try values.decodeIfPresent(String.self, forKey: "SeriesTimerId")
self.sortBy = try values.decodeIfPresent([String].self, forKey: "SortBy") self.sortBy = try values.decodeIfPresent([ItemSortBy].self, forKey: "SortBy")
self.sortOrder = try values.decodeIfPresent([SortOrder].self, forKey: "SortOrder") self.sortOrder = try values.decodeIfPresent([SortOrder].self, forKey: "SortOrder")
self.startIndex = try values.decodeIfPresent(Int.self, forKey: "StartIndex") self.startIndex = try values.decodeIfPresent(Int.self, forKey: "StartIndex")
self.userID = try values.decodeIfPresent(String.self, forKey: "UserId") self.userID = try values.decodeIfPresent(String.self, forKey: "UserId")

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class GroupUpdate.
public struct GroupInfoDtoGroupUpdate: Codable, Hashable {
/// Gets the update data.
public var data: GroupInfoDto?
/// Gets the group identifier.
public var groupID: String?
/// Gets the update type.
public var type: GroupUpdateType?
public init(data: GroupInfoDto? = nil, groupID: String? = nil, type: GroupUpdateType? = nil) {
self.data = data
self.groupID = groupID
self.type = type
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(GroupInfoDto.self, forKey: "Data")
self.groupID = try values.decodeIfPresent(String.self, forKey: "GroupId")
self.type = try values.decodeIfPresent(GroupUpdateType.self, forKey: "Type")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(groupID, forKey: "GroupId")
try values.encodeIfPresent(type, forKey: "Type")
}
}

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class GroupStateUpdate.
public struct GroupStateUpdate: Codable, Hashable {
/// Gets the reason of the state change.
public var reason: PlaybackRequestType?
/// Gets the state of the group.
public var state: GroupStateType?
public init(reason: PlaybackRequestType? = nil, state: GroupStateType? = nil) {
self.reason = reason
self.state = state
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.reason = try values.decodeIfPresent(PlaybackRequestType.self, forKey: "Reason")
self.state = try values.decodeIfPresent(GroupStateType.self, forKey: "State")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(reason, forKey: "Reason")
try values.encodeIfPresent(state, forKey: "State")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class GroupUpdate.
public struct GroupStateUpdateGroupUpdate: Codable, Hashable {
/// Gets the update data.
public var data: GroupStateUpdate?
/// Gets the group identifier.
public var groupID: String?
/// Gets the update type.
public var type: GroupUpdateType?
public init(data: GroupStateUpdate? = nil, groupID: String? = nil, type: GroupUpdateType? = nil) {
self.data = data
self.groupID = groupID
self.type = type
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(GroupStateUpdate.self, forKey: "Data")
self.groupID = try values.decodeIfPresent(String.self, forKey: "GroupId")
self.type = try values.decodeIfPresent(GroupUpdateType.self, forKey: "Type")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(groupID, forKey: "GroupId")
try values.encodeIfPresent(type, forKey: "Type")
}
}

View File

@ -0,0 +1,55 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Group update without data.
public enum GroupUpdate: Codable, Hashable {
case groupInfoDtoGroupUpdate(GroupInfoDtoGroupUpdate)
case groupStateUpdateGroupUpdate(GroupStateUpdateGroupUpdate)
case stringGroupUpdate(StringGroupUpdate)
case playQueueUpdateGroupUpdate(PlayQueueUpdateGroupUpdate)
public init(from decoder: Decoder) throws {
struct Discriminator: Decodable {
let _Type: String
}
let container = try decoder.singleValueContainer()
let discriminatorValue = try container.decode(Discriminator.self)._Type
switch discriminatorValue {
case "GroupJoined": self = try .groupInfoDtoGroupUpdate(container.decode(GroupInfoDtoGroupUpdate.self))
case "StateUpdate": self = try .groupStateUpdateGroupUpdate(container.decode(GroupStateUpdateGroupUpdate.self))
case "GroupDoesNotExist": self = try .stringGroupUpdate(container.decode(StringGroupUpdate.self))
case "GroupLeft": self = try .stringGroupUpdate(container.decode(StringGroupUpdate.self))
case "LibraryAccessDenied": self = try .stringGroupUpdate(container.decode(StringGroupUpdate.self))
case "NotInGroup": self = try .stringGroupUpdate(container.decode(StringGroupUpdate.self))
case "UserJoined": self = try .stringGroupUpdate(container.decode(StringGroupUpdate.self))
case "UserLeft": self = try .stringGroupUpdate(container.decode(StringGroupUpdate.self))
case "PlayQueue": self = try .playQueueUpdateGroupUpdate(container.decode(PlayQueueUpdateGroupUpdate.self))
default:
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "Discriminator value '\(discriminatorValue)' does not match any expected values (GroupJoined, StateUpdate, GroupDoesNotExist, GroupLeft, LibraryAccessDenied, NotInGroup, UserJoined, UserLeft, PlayQueue)."
)
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .groupInfoDtoGroupUpdate(value): try container.encode(value)
case let .groupStateUpdateGroupUpdate(value): try container.encode(value)
case let .stringGroupUpdate(value): try container.encode(value)
case let .playQueueUpdateGroupUpdate(value): try container.encode(value)
}
}
}

View File

@ -16,4 +16,5 @@ public enum HardwareEncodingType: String, Codable, CaseIterable {
case v4l2m2m = "V4L2M2M" case v4l2m2m = "V4L2M2M"
case vaapi = "VAAPI" case vaapi = "VAAPI"
case videoToolBox = "VideoToolBox" case videoToolBox = "VideoToolBox"
case rkmpp = "RKMPP"
} }

View File

@ -15,4 +15,5 @@ public enum ImageFormat: String, Codable, CaseIterable {
case jpg = "Jpg" case jpg = "Jpg"
case png = "Png" case png = "Png"
case webp = "Webp" case webp = "Webp"
case svg = "Svg"
} }

View File

@ -0,0 +1,22 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Enum ImageResolution.
public enum ImageResolution: String, Codable, CaseIterable {
case matchSource = "MatchSource"
case p144 = "P144"
case p240 = "P240"
case p360 = "P360"
case p480 = "P480"
case p720 = "P720"
case p1080 = "P1080"
case p1440 = "P1440"
case p2160 = "P2160"
}

View File

@ -0,0 +1,29 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Keep alive websocket messages.
public struct InboundKeepAliveMessage: Codable, Hashable {
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageType: SessionMessageType? = nil) {
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,59 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Represents the list of possible inbound websocket types
public enum InboundWebSocketMessage: Codable, Hashable {
case activityLogEntryStartMessage(ActivityLogEntryStartMessage)
case activityLogEntryStopMessage(ActivityLogEntryStopMessage)
case inboundKeepAliveMessage(InboundKeepAliveMessage)
case scheduledTasksInfoStartMessage(ScheduledTasksInfoStartMessage)
case scheduledTasksInfoStopMessage(ScheduledTasksInfoStopMessage)
case sessionsStartMessage(SessionsStartMessage)
case sessionsStopMessage(SessionsStopMessage)
public init(from decoder: Decoder) throws {
struct Discriminator: Decodable {
let MessageType: String
}
let container = try decoder.singleValueContainer()
let discriminatorValue = try container.decode(Discriminator.self).MessageType
switch discriminatorValue {
case "ActivityLogEntryStart": self = try .activityLogEntryStartMessage(container.decode(ActivityLogEntryStartMessage.self))
case "ActivityLogEntryStop": self = try .activityLogEntryStopMessage(container.decode(ActivityLogEntryStopMessage.self))
case "KeepAlive": self = try .inboundKeepAliveMessage(container.decode(InboundKeepAliveMessage.self))
case "ScheduledTasksInfoStart": self = try .scheduledTasksInfoStartMessage(container.decode(ScheduledTasksInfoStartMessage.self))
case "ScheduledTasksInfoStop": self = try .scheduledTasksInfoStopMessage(container.decode(ScheduledTasksInfoStopMessage.self))
case "SessionsStart": self = try .sessionsStartMessage(container.decode(SessionsStartMessage.self))
case "SessionsStop": self = try .sessionsStopMessage(container.decode(SessionsStopMessage.self))
default:
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "Discriminator value '\(discriminatorValue)' does not match any expected values (ActivityLogEntryStart, ActivityLogEntryStop, KeepAlive, ScheduledTasksInfoStart, ScheduledTasksInfoStop, SessionsStart, SessionsStop)."
)
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .activityLogEntryStartMessage(value): try container.encode(value)
case let .activityLogEntryStopMessage(value): try container.encode(value)
case let .inboundKeepAliveMessage(value): try container.encode(value)
case let .scheduledTasksInfoStartMessage(value): try container.encode(value)
case let .scheduledTasksInfoStopMessage(value): try container.encode(value)
case let .sessionsStartMessage(value): try container.encode(value)
case let .sessionsStopMessage(value): try container.encode(value)
}
}
}

View File

@ -15,6 +15,7 @@ public enum ItemFields: String, Codable, CaseIterable {
case canDownload = "CanDownload" case canDownload = "CanDownload"
case channelInfo = "ChannelInfo" case channelInfo = "ChannelInfo"
case chapters = "Chapters" case chapters = "Chapters"
case trickplay = "Trickplay"
case childCount = "ChildCount" case childCount = "ChildCount"
case cumulativeRunTimeTicks = "CumulativeRunTimeTicks" case cumulativeRunTimeTicks = "CumulativeRunTimeTicks"
case customRating = "CustomRating" case customRating = "CustomRating"
@ -45,8 +46,6 @@ public enum ItemFields: String, Codable, CaseIterable {
case sortName = "SortName" case sortName = "SortName"
case specialEpisodeNumbers = "SpecialEpisodeNumbers" case specialEpisodeNumbers = "SpecialEpisodeNumbers"
case studios = "Studios" case studios = "Studios"
case basicSyncInfo = "BasicSyncInfo"
case syncInfo = "SyncInfo"
case taglines = "Taglines" case taglines = "Taglines"
case tags = "Tags" case tags = "Tags"
case remoteTrailers = "RemoteTrailers" case remoteTrailers = "RemoteTrailers"

View File

@ -0,0 +1,45 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// These represent sort orders.
public enum ItemSortBy: String, Codable, CaseIterable {
case `default` = "Default"
case airedEpisodeOrder = "AiredEpisodeOrder"
case album = "Album"
case albumArtist = "AlbumArtist"
case artist = "Artist"
case dateCreated = "DateCreated"
case officialRating = "OfficialRating"
case datePlayed = "DatePlayed"
case premiereDate = "PremiereDate"
case startDate = "StartDate"
case sortName = "SortName"
case name = "Name"
case random = "Random"
case runtime = "Runtime"
case communityRating = "CommunityRating"
case productionYear = "ProductionYear"
case playCount = "PlayCount"
case criticRating = "CriticRating"
case isFolder = "IsFolder"
case isUnplayed = "IsUnplayed"
case isPlayed = "IsPlayed"
case seriesSortName = "SeriesSortName"
case videoBitRate = "VideoBitRate"
case airTime = "AirTime"
case studio = "Studio"
case isFavoriteOrLiked = "IsFavoriteOrLiked"
case dateLastContentAdded = "DateLastContentAdded"
case seriesDatePlayed = "SeriesDatePlayed"
case parentIndexNumber = "ParentIndexNumber"
case indexNumber = "IndexNumber"
case similarityScore = "SimilarityScore"
case searchScore = "SearchScore"
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Library changed message.
public struct LibraryChangedMessage: Codable, Hashable {
/// Class LibraryUpdateInfo.
public var data: LibraryUpdateInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: LibraryUpdateInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(LibraryUpdateInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -18,12 +18,17 @@ public struct LibraryOptions: Codable, Hashable {
public var enableAutomaticSeriesGrouping: Bool? public var enableAutomaticSeriesGrouping: Bool?
public var enableChapterImageExtraction: Bool? public var enableChapterImageExtraction: Bool?
public var enableEmbeddedEpisodeInfos: Bool? public var enableEmbeddedEpisodeInfos: Bool?
public var enableEmbeddedExtrasTitles: Bool?
public var enableEmbeddedTitles: Bool? public var enableEmbeddedTitles: Bool?
/// - warning: Deprecated. /// - warning: Deprecated.
public var enableInternetProviders: Bool? public var enableInternetProviders: Bool?
public var enableLUFSScan: Bool?
public var enablePhotos: Bool? public var enablePhotos: Bool?
public var enableRealtimeMonitor: Bool? public var enableRealtimeMonitor: Bool?
public var enableTrickplayImageExtraction: Bool?
public var isEnabled: Bool?
public var isExtractChapterImagesDuringLibraryScan: Bool? public var isExtractChapterImagesDuringLibraryScan: Bool?
public var isExtractTrickplayImagesDuringLibraryScan: Bool?
public var localMetadataReaderOrder: [String]? public var localMetadataReaderOrder: [String]?
/// Gets or sets the metadata country code. /// Gets or sets the metadata country code.
public var metadataCountryCode: String? public var metadataCountryCode: String?
@ -33,6 +38,7 @@ public struct LibraryOptions: Codable, Hashable {
public var preferredMetadataLanguage: String? public var preferredMetadataLanguage: String?
public var requirePerfectSubtitleMatch: Bool? public var requirePerfectSubtitleMatch: Bool?
public var isSaveLocalMetadata: Bool? public var isSaveLocalMetadata: Bool?
public var isSaveLyricsWithMedia: Bool
public var isSaveSubtitlesWithMedia: Bool? public var isSaveSubtitlesWithMedia: Bool?
public var seasonZeroDisplayName: String? public var seasonZeroDisplayName: String?
public var isSkipSubtitlesIfAudioTrackMatches: Bool? public var isSkipSubtitlesIfAudioTrackMatches: Bool?
@ -50,11 +56,16 @@ public struct LibraryOptions: Codable, Hashable {
enableAutomaticSeriesGrouping: Bool? = nil, enableAutomaticSeriesGrouping: Bool? = nil,
enableChapterImageExtraction: Bool? = nil, enableChapterImageExtraction: Bool? = nil,
enableEmbeddedEpisodeInfos: Bool? = nil, enableEmbeddedEpisodeInfos: Bool? = nil,
enableEmbeddedExtrasTitles: Bool? = nil,
enableEmbeddedTitles: Bool? = nil, enableEmbeddedTitles: Bool? = nil,
enableInternetProviders: Bool? = nil, enableInternetProviders: Bool? = nil,
enableLUFSScan: Bool? = nil,
enablePhotos: Bool? = nil, enablePhotos: Bool? = nil,
enableRealtimeMonitor: Bool? = nil, enableRealtimeMonitor: Bool? = nil,
enableTrickplayImageExtraction: Bool? = nil,
isEnabled: Bool? = nil,
isExtractChapterImagesDuringLibraryScan: Bool? = nil, isExtractChapterImagesDuringLibraryScan: Bool? = nil,
isExtractTrickplayImagesDuringLibraryScan: Bool? = nil,
localMetadataReaderOrder: [String]? = nil, localMetadataReaderOrder: [String]? = nil,
metadataCountryCode: String? = nil, metadataCountryCode: String? = nil,
metadataSavers: [String]? = nil, metadataSavers: [String]? = nil,
@ -62,6 +73,7 @@ public struct LibraryOptions: Codable, Hashable {
preferredMetadataLanguage: String? = nil, preferredMetadataLanguage: String? = nil,
requirePerfectSubtitleMatch: Bool? = nil, requirePerfectSubtitleMatch: Bool? = nil,
isSaveLocalMetadata: Bool? = nil, isSaveLocalMetadata: Bool? = nil,
isSaveLyricsWithMedia: Bool? = nil,
isSaveSubtitlesWithMedia: Bool? = nil, isSaveSubtitlesWithMedia: Bool? = nil,
seasonZeroDisplayName: String? = nil, seasonZeroDisplayName: String? = nil,
isSkipSubtitlesIfAudioTrackMatches: Bool? = nil, isSkipSubtitlesIfAudioTrackMatches: Bool? = nil,
@ -78,11 +90,16 @@ public struct LibraryOptions: Codable, Hashable {
self.enableAutomaticSeriesGrouping = enableAutomaticSeriesGrouping self.enableAutomaticSeriesGrouping = enableAutomaticSeriesGrouping
self.enableChapterImageExtraction = enableChapterImageExtraction self.enableChapterImageExtraction = enableChapterImageExtraction
self.enableEmbeddedEpisodeInfos = enableEmbeddedEpisodeInfos self.enableEmbeddedEpisodeInfos = enableEmbeddedEpisodeInfos
self.enableEmbeddedExtrasTitles = enableEmbeddedExtrasTitles
self.enableEmbeddedTitles = enableEmbeddedTitles self.enableEmbeddedTitles = enableEmbeddedTitles
self.enableInternetProviders = enableInternetProviders self.enableInternetProviders = enableInternetProviders
self.enableLUFSScan = enableLUFSScan
self.enablePhotos = enablePhotos self.enablePhotos = enablePhotos
self.enableRealtimeMonitor = enableRealtimeMonitor self.enableRealtimeMonitor = enableRealtimeMonitor
self.enableTrickplayImageExtraction = enableTrickplayImageExtraction
self.isEnabled = isEnabled
self.isExtractChapterImagesDuringLibraryScan = isExtractChapterImagesDuringLibraryScan self.isExtractChapterImagesDuringLibraryScan = isExtractChapterImagesDuringLibraryScan
self.isExtractTrickplayImagesDuringLibraryScan = isExtractTrickplayImagesDuringLibraryScan
self.localMetadataReaderOrder = localMetadataReaderOrder self.localMetadataReaderOrder = localMetadataReaderOrder
self.metadataCountryCode = metadataCountryCode self.metadataCountryCode = metadataCountryCode
self.metadataSavers = metadataSavers self.metadataSavers = metadataSavers
@ -90,6 +107,7 @@ public struct LibraryOptions: Codable, Hashable {
self.preferredMetadataLanguage = preferredMetadataLanguage self.preferredMetadataLanguage = preferredMetadataLanguage
self.requirePerfectSubtitleMatch = requirePerfectSubtitleMatch self.requirePerfectSubtitleMatch = requirePerfectSubtitleMatch
self.isSaveLocalMetadata = isSaveLocalMetadata self.isSaveLocalMetadata = isSaveLocalMetadata
self.isSaveLyricsWithMedia = isSaveLyricsWithMedia ?? false
self.isSaveSubtitlesWithMedia = isSaveSubtitlesWithMedia self.isSaveSubtitlesWithMedia = isSaveSubtitlesWithMedia
self.seasonZeroDisplayName = seasonZeroDisplayName self.seasonZeroDisplayName = seasonZeroDisplayName
self.isSkipSubtitlesIfAudioTrackMatches = isSkipSubtitlesIfAudioTrackMatches self.isSkipSubtitlesIfAudioTrackMatches = isSkipSubtitlesIfAudioTrackMatches
@ -109,14 +127,22 @@ public struct LibraryOptions: Codable, Hashable {
self.enableAutomaticSeriesGrouping = try values.decodeIfPresent(Bool.self, forKey: "EnableAutomaticSeriesGrouping") self.enableAutomaticSeriesGrouping = try values.decodeIfPresent(Bool.self, forKey: "EnableAutomaticSeriesGrouping")
self.enableChapterImageExtraction = try values.decodeIfPresent(Bool.self, forKey: "EnableChapterImageExtraction") self.enableChapterImageExtraction = try values.decodeIfPresent(Bool.self, forKey: "EnableChapterImageExtraction")
self.enableEmbeddedEpisodeInfos = try values.decodeIfPresent(Bool.self, forKey: "EnableEmbeddedEpisodeInfos") self.enableEmbeddedEpisodeInfos = try values.decodeIfPresent(Bool.self, forKey: "EnableEmbeddedEpisodeInfos")
self.enableEmbeddedExtrasTitles = try values.decodeIfPresent(Bool.self, forKey: "EnableEmbeddedExtrasTitles")
self.enableEmbeddedTitles = try values.decodeIfPresent(Bool.self, forKey: "EnableEmbeddedTitles") self.enableEmbeddedTitles = try values.decodeIfPresent(Bool.self, forKey: "EnableEmbeddedTitles")
self.enableInternetProviders = try values.decodeIfPresent(Bool.self, forKey: "EnableInternetProviders") self.enableInternetProviders = try values.decodeIfPresent(Bool.self, forKey: "EnableInternetProviders")
self.enableLUFSScan = try values.decodeIfPresent(Bool.self, forKey: "EnableLUFSScan")
self.enablePhotos = try values.decodeIfPresent(Bool.self, forKey: "EnablePhotos") self.enablePhotos = try values.decodeIfPresent(Bool.self, forKey: "EnablePhotos")
self.enableRealtimeMonitor = try values.decodeIfPresent(Bool.self, forKey: "EnableRealtimeMonitor") self.enableRealtimeMonitor = try values.decodeIfPresent(Bool.self, forKey: "EnableRealtimeMonitor")
self.enableTrickplayImageExtraction = try values.decodeIfPresent(Bool.self, forKey: "EnableTrickplayImageExtraction")
self.isEnabled = try values.decodeIfPresent(Bool.self, forKey: "Enabled")
self.isExtractChapterImagesDuringLibraryScan = try values.decodeIfPresent( self.isExtractChapterImagesDuringLibraryScan = try values.decodeIfPresent(
Bool.self, Bool.self,
forKey: "ExtractChapterImagesDuringLibraryScan" forKey: "ExtractChapterImagesDuringLibraryScan"
) )
self.isExtractTrickplayImagesDuringLibraryScan = try values.decodeIfPresent(
Bool.self,
forKey: "ExtractTrickplayImagesDuringLibraryScan"
)
self.localMetadataReaderOrder = try values.decodeIfPresent([String].self, forKey: "LocalMetadataReaderOrder") self.localMetadataReaderOrder = try values.decodeIfPresent([String].self, forKey: "LocalMetadataReaderOrder")
self.metadataCountryCode = try values.decodeIfPresent(String.self, forKey: "MetadataCountryCode") self.metadataCountryCode = try values.decodeIfPresent(String.self, forKey: "MetadataCountryCode")
self.metadataSavers = try values.decodeIfPresent([String].self, forKey: "MetadataSavers") self.metadataSavers = try values.decodeIfPresent([String].self, forKey: "MetadataSavers")
@ -124,6 +150,7 @@ public struct LibraryOptions: Codable, Hashable {
self.preferredMetadataLanguage = try values.decodeIfPresent(String.self, forKey: "PreferredMetadataLanguage") self.preferredMetadataLanguage = try values.decodeIfPresent(String.self, forKey: "PreferredMetadataLanguage")
self.requirePerfectSubtitleMatch = try values.decodeIfPresent(Bool.self, forKey: "RequirePerfectSubtitleMatch") self.requirePerfectSubtitleMatch = try values.decodeIfPresent(Bool.self, forKey: "RequirePerfectSubtitleMatch")
self.isSaveLocalMetadata = try values.decodeIfPresent(Bool.self, forKey: "SaveLocalMetadata") self.isSaveLocalMetadata = try values.decodeIfPresent(Bool.self, forKey: "SaveLocalMetadata")
self.isSaveLyricsWithMedia = try values.decodeIfPresent(Bool.self, forKey: "SaveLyricsWithMedia") ?? false
self.isSaveSubtitlesWithMedia = try values.decodeIfPresent(Bool.self, forKey: "SaveSubtitlesWithMedia") self.isSaveSubtitlesWithMedia = try values.decodeIfPresent(Bool.self, forKey: "SaveSubtitlesWithMedia")
self.seasonZeroDisplayName = try values.decodeIfPresent(String.self, forKey: "SeasonZeroDisplayName") self.seasonZeroDisplayName = try values.decodeIfPresent(String.self, forKey: "SeasonZeroDisplayName")
self.isSkipSubtitlesIfAudioTrackMatches = try values.decodeIfPresent(Bool.self, forKey: "SkipSubtitlesIfAudioTrackMatches") self.isSkipSubtitlesIfAudioTrackMatches = try values.decodeIfPresent(Bool.self, forKey: "SkipSubtitlesIfAudioTrackMatches")
@ -146,11 +173,16 @@ public struct LibraryOptions: Codable, Hashable {
try values.encodeIfPresent(enableAutomaticSeriesGrouping, forKey: "EnableAutomaticSeriesGrouping") try values.encodeIfPresent(enableAutomaticSeriesGrouping, forKey: "EnableAutomaticSeriesGrouping")
try values.encodeIfPresent(enableChapterImageExtraction, forKey: "EnableChapterImageExtraction") try values.encodeIfPresent(enableChapterImageExtraction, forKey: "EnableChapterImageExtraction")
try values.encodeIfPresent(enableEmbeddedEpisodeInfos, forKey: "EnableEmbeddedEpisodeInfos") try values.encodeIfPresent(enableEmbeddedEpisodeInfos, forKey: "EnableEmbeddedEpisodeInfos")
try values.encodeIfPresent(enableEmbeddedExtrasTitles, forKey: "EnableEmbeddedExtrasTitles")
try values.encodeIfPresent(enableEmbeddedTitles, forKey: "EnableEmbeddedTitles") try values.encodeIfPresent(enableEmbeddedTitles, forKey: "EnableEmbeddedTitles")
try values.encodeIfPresent(enableInternetProviders, forKey: "EnableInternetProviders") try values.encodeIfPresent(enableInternetProviders, forKey: "EnableInternetProviders")
try values.encodeIfPresent(enableLUFSScan, forKey: "EnableLUFSScan")
try values.encodeIfPresent(enablePhotos, forKey: "EnablePhotos") try values.encodeIfPresent(enablePhotos, forKey: "EnablePhotos")
try values.encodeIfPresent(enableRealtimeMonitor, forKey: "EnableRealtimeMonitor") try values.encodeIfPresent(enableRealtimeMonitor, forKey: "EnableRealtimeMonitor")
try values.encodeIfPresent(enableTrickplayImageExtraction, forKey: "EnableTrickplayImageExtraction")
try values.encodeIfPresent(isEnabled, forKey: "Enabled")
try values.encodeIfPresent(isExtractChapterImagesDuringLibraryScan, forKey: "ExtractChapterImagesDuringLibraryScan") try values.encodeIfPresent(isExtractChapterImagesDuringLibraryScan, forKey: "ExtractChapterImagesDuringLibraryScan")
try values.encodeIfPresent(isExtractTrickplayImagesDuringLibraryScan, forKey: "ExtractTrickplayImagesDuringLibraryScan")
try values.encodeIfPresent(localMetadataReaderOrder, forKey: "LocalMetadataReaderOrder") try values.encodeIfPresent(localMetadataReaderOrder, forKey: "LocalMetadataReaderOrder")
try values.encodeIfPresent(metadataCountryCode, forKey: "MetadataCountryCode") try values.encodeIfPresent(metadataCountryCode, forKey: "MetadataCountryCode")
try values.encodeIfPresent(metadataSavers, forKey: "MetadataSavers") try values.encodeIfPresent(metadataSavers, forKey: "MetadataSavers")
@ -158,6 +190,7 @@ public struct LibraryOptions: Codable, Hashable {
try values.encodeIfPresent(preferredMetadataLanguage, forKey: "PreferredMetadataLanguage") try values.encodeIfPresent(preferredMetadataLanguage, forKey: "PreferredMetadataLanguage")
try values.encodeIfPresent(requirePerfectSubtitleMatch, forKey: "RequirePerfectSubtitleMatch") try values.encodeIfPresent(requirePerfectSubtitleMatch, forKey: "RequirePerfectSubtitleMatch")
try values.encodeIfPresent(isSaveLocalMetadata, forKey: "SaveLocalMetadata") try values.encodeIfPresent(isSaveLocalMetadata, forKey: "SaveLocalMetadata")
try values.encodeIfPresent(isSaveLyricsWithMedia, forKey: "SaveLyricsWithMedia")
try values.encodeIfPresent(isSaveSubtitlesWithMedia, forKey: "SaveSubtitlesWithMedia") try values.encodeIfPresent(isSaveSubtitlesWithMedia, forKey: "SaveSubtitlesWithMedia")
try values.encodeIfPresent(seasonZeroDisplayName, forKey: "SeasonZeroDisplayName") try values.encodeIfPresent(seasonZeroDisplayName, forKey: "SeasonZeroDisplayName")
try values.encodeIfPresent(isSkipSubtitlesIfAudioTrackMatches, forKey: "SkipSubtitlesIfAudioTrackMatches") try values.encodeIfPresent(isSkipSubtitlesIfAudioTrackMatches, forKey: "SkipSubtitlesIfAudioTrackMatches")

View File

@ -20,6 +20,8 @@ public struct LiveTvOptions: Codable, Hashable {
public var recordingPath: String? public var recordingPath: String?
public var recordingPostProcessor: String? public var recordingPostProcessor: String?
public var recordingPostProcessorArguments: String? public var recordingPostProcessorArguments: String?
public var isSaveRecordingImages: Bool?
public var isSaveRecordingNFO: Bool?
public var seriesRecordingPath: String? public var seriesRecordingPath: String?
public var tunerHosts: [TunerHostInfo]? public var tunerHosts: [TunerHostInfo]?
@ -35,6 +37,8 @@ public struct LiveTvOptions: Codable, Hashable {
recordingPath: String? = nil, recordingPath: String? = nil,
recordingPostProcessor: String? = nil, recordingPostProcessor: String? = nil,
recordingPostProcessorArguments: String? = nil, recordingPostProcessorArguments: String? = nil,
isSaveRecordingImages: Bool? = nil,
isSaveRecordingNFO: Bool? = nil,
seriesRecordingPath: String? = nil, seriesRecordingPath: String? = nil,
tunerHosts: [TunerHostInfo]? = nil tunerHosts: [TunerHostInfo]? = nil
) { ) {
@ -49,6 +53,8 @@ public struct LiveTvOptions: Codable, Hashable {
self.recordingPath = recordingPath self.recordingPath = recordingPath
self.recordingPostProcessor = recordingPostProcessor self.recordingPostProcessor = recordingPostProcessor
self.recordingPostProcessorArguments = recordingPostProcessorArguments self.recordingPostProcessorArguments = recordingPostProcessorArguments
self.isSaveRecordingImages = isSaveRecordingImages
self.isSaveRecordingNFO = isSaveRecordingNFO
self.seriesRecordingPath = seriesRecordingPath self.seriesRecordingPath = seriesRecordingPath
self.tunerHosts = tunerHosts self.tunerHosts = tunerHosts
} }
@ -69,6 +75,8 @@ public struct LiveTvOptions: Codable, Hashable {
self.recordingPath = try values.decodeIfPresent(String.self, forKey: "RecordingPath") self.recordingPath = try values.decodeIfPresent(String.self, forKey: "RecordingPath")
self.recordingPostProcessor = try values.decodeIfPresent(String.self, forKey: "RecordingPostProcessor") self.recordingPostProcessor = try values.decodeIfPresent(String.self, forKey: "RecordingPostProcessor")
self.recordingPostProcessorArguments = try values.decodeIfPresent(String.self, forKey: "RecordingPostProcessorArguments") self.recordingPostProcessorArguments = try values.decodeIfPresent(String.self, forKey: "RecordingPostProcessorArguments")
self.isSaveRecordingImages = try values.decodeIfPresent(Bool.self, forKey: "SaveRecordingImages")
self.isSaveRecordingNFO = try values.decodeIfPresent(Bool.self, forKey: "SaveRecordingNFO")
self.seriesRecordingPath = try values.decodeIfPresent(String.self, forKey: "SeriesRecordingPath") self.seriesRecordingPath = try values.decodeIfPresent(String.self, forKey: "SeriesRecordingPath")
self.tunerHosts = try values.decodeIfPresent([TunerHostInfo].self, forKey: "TunerHosts") self.tunerHosts = try values.decodeIfPresent([TunerHostInfo].self, forKey: "TunerHosts")
} }
@ -86,6 +94,8 @@ public struct LiveTvOptions: Codable, Hashable {
try values.encodeIfPresent(recordingPath, forKey: "RecordingPath") try values.encodeIfPresent(recordingPath, forKey: "RecordingPath")
try values.encodeIfPresent(recordingPostProcessor, forKey: "RecordingPostProcessor") try values.encodeIfPresent(recordingPostProcessor, forKey: "RecordingPostProcessor")
try values.encodeIfPresent(recordingPostProcessorArguments, forKey: "RecordingPostProcessorArguments") try values.encodeIfPresent(recordingPostProcessorArguments, forKey: "RecordingPostProcessorArguments")
try values.encodeIfPresent(isSaveRecordingImages, forKey: "SaveRecordingImages")
try values.encodeIfPresent(isSaveRecordingNFO, forKey: "SaveRecordingNFO")
try values.encodeIfPresent(seriesRecordingPath, forKey: "SeriesRecordingPath") try values.encodeIfPresent(seriesRecordingPath, forKey: "SeriesRecordingPath")
try values.encodeIfPresent(tunerHosts, forKey: "TunerHosts") try values.encodeIfPresent(tunerHosts, forKey: "TunerHosts")
} }

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// LyricResponse model.
public struct LyricDto: Codable, Hashable {
/// Gets or sets a collection of individual lyric lines.
public var lyrics: [LyricLine]?
/// Gets or sets Metadata for the lyrics.
public var metadata: LyricMetadata?
public init(lyrics: [LyricLine]? = nil, metadata: LyricMetadata? = nil) {
self.lyrics = lyrics
self.metadata = metadata
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.lyrics = try values.decodeIfPresent([LyricLine].self, forKey: "Lyrics")
self.metadata = try values.decodeIfPresent(LyricMetadata.self, forKey: "Metadata")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(lyrics, forKey: "Lyrics")
try values.encodeIfPresent(metadata, forKey: "Metadata")
}
}

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Lyric model.
public struct LyricLine: Codable, Hashable {
/// Gets the start time in ticks.
public var start: Int?
/// Gets the text of this lyric line.
public var text: String?
public init(start: Int? = nil, text: String? = nil) {
self.start = start
self.text = text
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.start = try values.decodeIfPresent(Int.self, forKey: "Start")
self.text = try values.decodeIfPresent(String.self, forKey: "Text")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(start, forKey: "Start")
try values.encodeIfPresent(text, forKey: "Text")
}
}

View File

@ -0,0 +1,85 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// LyricMetadata model.
public struct LyricMetadata: Codable, Hashable {
/// Gets or sets the album this song is on.
public var album: String?
/// Gets or sets the song artist.
public var artist: String?
/// Gets or sets the author of the lyric data.
public var author: String?
/// Gets or sets who the LRC file was created by.
public var by: String?
/// Gets or sets the software used to create the LRC file.
public var creator: String?
/// Gets or sets a value indicating whether this lyric is synced.
public var isSynced: Bool?
/// Gets or sets the length of the song in ticks.
public var length: Int?
/// Gets or sets the lyric offset compared to audio in ticks.
public var offset: Int?
/// Gets or sets the title of the song.
public var title: String?
/// Gets or sets the version of the creator used.
public var version: String?
public init(
album: String? = nil,
artist: String? = nil,
author: String? = nil,
by: String? = nil,
creator: String? = nil,
isSynced: Bool? = nil,
length: Int? = nil,
offset: Int? = nil,
title: String? = nil,
version: String? = nil
) {
self.album = album
self.artist = artist
self.author = author
self.by = by
self.creator = creator
self.isSynced = isSynced
self.length = length
self.offset = offset
self.title = title
self.version = version
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.album = try values.decodeIfPresent(String.self, forKey: "Album")
self.artist = try values.decodeIfPresent(String.self, forKey: "Artist")
self.author = try values.decodeIfPresent(String.self, forKey: "Author")
self.by = try values.decodeIfPresent(String.self, forKey: "By")
self.creator = try values.decodeIfPresent(String.self, forKey: "Creator")
self.isSynced = try values.decodeIfPresent(Bool.self, forKey: "IsSynced")
self.length = try values.decodeIfPresent(Int.self, forKey: "Length")
self.offset = try values.decodeIfPresent(Int.self, forKey: "Offset")
self.title = try values.decodeIfPresent(String.self, forKey: "Title")
self.version = try values.decodeIfPresent(String.self, forKey: "Version")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(album, forKey: "Album")
try values.encodeIfPresent(artist, forKey: "Artist")
try values.encodeIfPresent(author, forKey: "Author")
try values.encodeIfPresent(by, forKey: "By")
try values.encodeIfPresent(creator, forKey: "Creator")
try values.encodeIfPresent(isSynced, forKey: "IsSynced")
try values.encodeIfPresent(length, forKey: "Length")
try values.encodeIfPresent(offset, forKey: "Offset")
try values.encodeIfPresent(title, forKey: "Title")
try values.encodeIfPresent(version, forKey: "Version")
}
}

View File

@ -49,7 +49,10 @@ public struct MediaSourceInfo: Codable, Hashable, Identifiable {
public var isSupportsTranscoding: Bool? public var isSupportsTranscoding: Bool?
public var timestamp: TransportStreamTimestamp? public var timestamp: TransportStreamTimestamp?
public var transcodingContainer: String? public var transcodingContainer: String?
public var transcodingSubProtocol: String? /// Media streaming protocol.
///
/// Lowercase for backwards compatibility.
public var transcodingSubProtocol: MediaStreamProtocol?
public var transcodingURL: String? public var transcodingURL: String?
public var type: MediaSourceType? public var type: MediaSourceType?
public var video3DFormat: Video3DFormat? public var video3DFormat: Video3DFormat?
@ -93,7 +96,7 @@ public struct MediaSourceInfo: Codable, Hashable, Identifiable {
isSupportsTranscoding: Bool? = nil, isSupportsTranscoding: Bool? = nil,
timestamp: TransportStreamTimestamp? = nil, timestamp: TransportStreamTimestamp? = nil,
transcodingContainer: String? = nil, transcodingContainer: String? = nil,
transcodingSubProtocol: String? = nil, transcodingSubProtocol: MediaStreamProtocol? = nil,
transcodingURL: String? = nil, transcodingURL: String? = nil,
type: MediaSourceType? = nil, type: MediaSourceType? = nil,
video3DFormat: Video3DFormat? = nil, video3DFormat: Video3DFormat? = nil,
@ -182,7 +185,7 @@ public struct MediaSourceInfo: Codable, Hashable, Identifiable {
self.isSupportsTranscoding = try values.decodeIfPresent(Bool.self, forKey: "SupportsTranscoding") self.isSupportsTranscoding = try values.decodeIfPresent(Bool.self, forKey: "SupportsTranscoding")
self.timestamp = try values.decodeIfPresent(TransportStreamTimestamp.self, forKey: "Timestamp") self.timestamp = try values.decodeIfPresent(TransportStreamTimestamp.self, forKey: "Timestamp")
self.transcodingContainer = try values.decodeIfPresent(String.self, forKey: "TranscodingContainer") self.transcodingContainer = try values.decodeIfPresent(String.self, forKey: "TranscodingContainer")
self.transcodingSubProtocol = try values.decodeIfPresent(String.self, forKey: "TranscodingSubProtocol") self.transcodingSubProtocol = try values.decodeIfPresent(MediaStreamProtocol.self, forKey: "TranscodingSubProtocol")
self.transcodingURL = try values.decodeIfPresent(String.self, forKey: "TranscodingUrl") self.transcodingURL = try values.decodeIfPresent(String.self, forKey: "TranscodingUrl")
self.type = try values.decodeIfPresent(MediaSourceType.self, forKey: "Type") self.type = try values.decodeIfPresent(MediaSourceType.self, forKey: "Type")
self.video3DFormat = try values.decodeIfPresent(Video3DFormat.self, forKey: "Video3DFormat") self.video3DFormat = try values.decodeIfPresent(Video3DFormat.self, forKey: "Video3DFormat")

View File

@ -12,6 +12,8 @@ import Foundation
public struct MediaStream: Codable, Hashable { public struct MediaStream: Codable, Hashable {
/// Gets or sets the aspect ratio. /// Gets or sets the aspect ratio.
public var aspectRatio: String? public var aspectRatio: String?
/// Gets the audio spatial format.
public var audioSpatialFormat: AudioSpatialFormat?
/// Gets or sets the average frame rate. /// Gets or sets the average frame rate.
public var averageFrameRate: Float? public var averageFrameRate: Float?
/// Gets or sets the bit depth. /// Gets or sets the bit depth.
@ -72,6 +74,8 @@ public struct MediaStream: Codable, Hashable {
public var isExternalURL: Bool? public var isExternalURL: Bool?
/// Gets or sets a value indicating whether this instance is forced. /// Gets or sets a value indicating whether this instance is forced.
public var isForced: Bool? public var isForced: Bool?
/// Gets or sets a value indicating whether this instance is for the hearing impaired.
public var isHearingImpaired: Bool?
/// Gets or sets a value indicating whether this instance is interlaced. /// Gets or sets a value indicating whether this instance is interlaced.
public var isInterlaced: Bool? public var isInterlaced: Bool?
public var isTextSubtitleStream: Bool? public var isTextSubtitleStream: Bool?
@ -82,6 +86,7 @@ public struct MediaStream: Codable, Hashable {
public var localizedDefault: String? public var localizedDefault: String?
public var localizedExternal: String? public var localizedExternal: String?
public var localizedForced: String? public var localizedForced: String?
public var localizedHearingImpaired: String?
public var localizedUndefined: String? public var localizedUndefined: String?
public var nalLengthSize: String? public var nalLengthSize: String?
/// Gets or sets the length of the packet. /// Gets or sets the length of the packet.
@ -113,14 +118,15 @@ public struct MediaStream: Codable, Hashable {
/// Gets the video dovi title. /// Gets the video dovi title.
public var videoDoViTitle: String? public var videoDoViTitle: String?
/// Gets the video range. /// Gets the video range.
public var videoRange: String? public var videoRange: VideoRange?
/// Gets the video range type. /// Gets the video range type.
public var videoRangeType: String? public var videoRangeType: VideoRangeType?
/// Gets or sets the width. /// Gets or sets the width.
public var width: Int? public var width: Int?
public init( public init(
aspectRatio: String? = nil, aspectRatio: String? = nil,
audioSpatialFormat: AudioSpatialFormat? = nil,
averageFrameRate: Float? = nil, averageFrameRate: Float? = nil,
bitDepth: Int? = nil, bitDepth: Int? = nil,
bitRate: Int? = nil, bitRate: Int? = nil,
@ -152,6 +158,7 @@ public struct MediaStream: Codable, Hashable {
isExternal: Bool? = nil, isExternal: Bool? = nil,
isExternalURL: Bool? = nil, isExternalURL: Bool? = nil,
isForced: Bool? = nil, isForced: Bool? = nil,
isHearingImpaired: Bool? = nil,
isInterlaced: Bool? = nil, isInterlaced: Bool? = nil,
isTextSubtitleStream: Bool? = nil, isTextSubtitleStream: Bool? = nil,
language: String? = nil, language: String? = nil,
@ -159,6 +166,7 @@ public struct MediaStream: Codable, Hashable {
localizedDefault: String? = nil, localizedDefault: String? = nil,
localizedExternal: String? = nil, localizedExternal: String? = nil,
localizedForced: String? = nil, localizedForced: String? = nil,
localizedHearingImpaired: String? = nil,
localizedUndefined: String? = nil, localizedUndefined: String? = nil,
nalLengthSize: String? = nil, nalLengthSize: String? = nil,
packetLength: Int? = nil, packetLength: Int? = nil,
@ -175,11 +183,12 @@ public struct MediaStream: Codable, Hashable {
title: String? = nil, title: String? = nil,
type: MediaStreamType? = nil, type: MediaStreamType? = nil,
videoDoViTitle: String? = nil, videoDoViTitle: String? = nil,
videoRange: String? = nil, videoRange: VideoRange? = nil,
videoRangeType: String? = nil, videoRangeType: VideoRangeType? = nil,
width: Int? = nil width: Int? = nil
) { ) {
self.aspectRatio = aspectRatio self.aspectRatio = aspectRatio
self.audioSpatialFormat = audioSpatialFormat
self.averageFrameRate = averageFrameRate self.averageFrameRate = averageFrameRate
self.bitDepth = bitDepth self.bitDepth = bitDepth
self.bitRate = bitRate self.bitRate = bitRate
@ -211,6 +220,7 @@ public struct MediaStream: Codable, Hashable {
self.isExternal = isExternal self.isExternal = isExternal
self.isExternalURL = isExternalURL self.isExternalURL = isExternalURL
self.isForced = isForced self.isForced = isForced
self.isHearingImpaired = isHearingImpaired
self.isInterlaced = isInterlaced self.isInterlaced = isInterlaced
self.isTextSubtitleStream = isTextSubtitleStream self.isTextSubtitleStream = isTextSubtitleStream
self.language = language self.language = language
@ -218,6 +228,7 @@ public struct MediaStream: Codable, Hashable {
self.localizedDefault = localizedDefault self.localizedDefault = localizedDefault
self.localizedExternal = localizedExternal self.localizedExternal = localizedExternal
self.localizedForced = localizedForced self.localizedForced = localizedForced
self.localizedHearingImpaired = localizedHearingImpaired
self.localizedUndefined = localizedUndefined self.localizedUndefined = localizedUndefined
self.nalLengthSize = nalLengthSize self.nalLengthSize = nalLengthSize
self.packetLength = packetLength self.packetLength = packetLength
@ -242,6 +253,7 @@ public struct MediaStream: Codable, Hashable {
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.aspectRatio = try values.decodeIfPresent(String.self, forKey: "AspectRatio") self.aspectRatio = try values.decodeIfPresent(String.self, forKey: "AspectRatio")
self.audioSpatialFormat = try values.decodeIfPresent(AudioSpatialFormat.self, forKey: "AudioSpatialFormat")
self.averageFrameRate = try values.decodeIfPresent(Float.self, forKey: "AverageFrameRate") self.averageFrameRate = try values.decodeIfPresent(Float.self, forKey: "AverageFrameRate")
self.bitDepth = try values.decodeIfPresent(Int.self, forKey: "BitDepth") self.bitDepth = try values.decodeIfPresent(Int.self, forKey: "BitDepth")
self.bitRate = try values.decodeIfPresent(Int.self, forKey: "BitRate") self.bitRate = try values.decodeIfPresent(Int.self, forKey: "BitRate")
@ -273,6 +285,7 @@ public struct MediaStream: Codable, Hashable {
self.isExternal = try values.decodeIfPresent(Bool.self, forKey: "IsExternal") self.isExternal = try values.decodeIfPresent(Bool.self, forKey: "IsExternal")
self.isExternalURL = try values.decodeIfPresent(Bool.self, forKey: "IsExternalUrl") self.isExternalURL = try values.decodeIfPresent(Bool.self, forKey: "IsExternalUrl")
self.isForced = try values.decodeIfPresent(Bool.self, forKey: "IsForced") self.isForced = try values.decodeIfPresent(Bool.self, forKey: "IsForced")
self.isHearingImpaired = try values.decodeIfPresent(Bool.self, forKey: "IsHearingImpaired")
self.isInterlaced = try values.decodeIfPresent(Bool.self, forKey: "IsInterlaced") self.isInterlaced = try values.decodeIfPresent(Bool.self, forKey: "IsInterlaced")
self.isTextSubtitleStream = try values.decodeIfPresent(Bool.self, forKey: "IsTextSubtitleStream") self.isTextSubtitleStream = try values.decodeIfPresent(Bool.self, forKey: "IsTextSubtitleStream")
self.language = try values.decodeIfPresent(String.self, forKey: "Language") self.language = try values.decodeIfPresent(String.self, forKey: "Language")
@ -280,6 +293,7 @@ public struct MediaStream: Codable, Hashable {
self.localizedDefault = try values.decodeIfPresent(String.self, forKey: "LocalizedDefault") self.localizedDefault = try values.decodeIfPresent(String.self, forKey: "LocalizedDefault")
self.localizedExternal = try values.decodeIfPresent(String.self, forKey: "LocalizedExternal") self.localizedExternal = try values.decodeIfPresent(String.self, forKey: "LocalizedExternal")
self.localizedForced = try values.decodeIfPresent(String.self, forKey: "LocalizedForced") self.localizedForced = try values.decodeIfPresent(String.self, forKey: "LocalizedForced")
self.localizedHearingImpaired = try values.decodeIfPresent(String.self, forKey: "LocalizedHearingImpaired")
self.localizedUndefined = try values.decodeIfPresent(String.self, forKey: "LocalizedUndefined") self.localizedUndefined = try values.decodeIfPresent(String.self, forKey: "LocalizedUndefined")
self.nalLengthSize = try values.decodeIfPresent(String.self, forKey: "NalLengthSize") self.nalLengthSize = try values.decodeIfPresent(String.self, forKey: "NalLengthSize")
self.packetLength = try values.decodeIfPresent(Int.self, forKey: "PacketLength") self.packetLength = try values.decodeIfPresent(Int.self, forKey: "PacketLength")
@ -296,14 +310,15 @@ public struct MediaStream: Codable, Hashable {
self.title = try values.decodeIfPresent(String.self, forKey: "Title") self.title = try values.decodeIfPresent(String.self, forKey: "Title")
self.type = try values.decodeIfPresent(MediaStreamType.self, forKey: "Type") self.type = try values.decodeIfPresent(MediaStreamType.self, forKey: "Type")
self.videoDoViTitle = try values.decodeIfPresent(String.self, forKey: "VideoDoViTitle") self.videoDoViTitle = try values.decodeIfPresent(String.self, forKey: "VideoDoViTitle")
self.videoRange = try values.decodeIfPresent(String.self, forKey: "VideoRange") self.videoRange = try values.decodeIfPresent(VideoRange.self, forKey: "VideoRange")
self.videoRangeType = try values.decodeIfPresent(String.self, forKey: "VideoRangeType") self.videoRangeType = try values.decodeIfPresent(VideoRangeType.self, forKey: "VideoRangeType")
self.width = try values.decodeIfPresent(Int.self, forKey: "Width") self.width = try values.decodeIfPresent(Int.self, forKey: "Width")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(aspectRatio, forKey: "AspectRatio") try values.encodeIfPresent(aspectRatio, forKey: "AspectRatio")
try values.encodeIfPresent(audioSpatialFormat, forKey: "AudioSpatialFormat")
try values.encodeIfPresent(averageFrameRate, forKey: "AverageFrameRate") try values.encodeIfPresent(averageFrameRate, forKey: "AverageFrameRate")
try values.encodeIfPresent(bitDepth, forKey: "BitDepth") try values.encodeIfPresent(bitDepth, forKey: "BitDepth")
try values.encodeIfPresent(bitRate, forKey: "BitRate") try values.encodeIfPresent(bitRate, forKey: "BitRate")
@ -335,6 +350,7 @@ public struct MediaStream: Codable, Hashable {
try values.encodeIfPresent(isExternal, forKey: "IsExternal") try values.encodeIfPresent(isExternal, forKey: "IsExternal")
try values.encodeIfPresent(isExternalURL, forKey: "IsExternalUrl") try values.encodeIfPresent(isExternalURL, forKey: "IsExternalUrl")
try values.encodeIfPresent(isForced, forKey: "IsForced") try values.encodeIfPresent(isForced, forKey: "IsForced")
try values.encodeIfPresent(isHearingImpaired, forKey: "IsHearingImpaired")
try values.encodeIfPresent(isInterlaced, forKey: "IsInterlaced") try values.encodeIfPresent(isInterlaced, forKey: "IsInterlaced")
try values.encodeIfPresent(isTextSubtitleStream, forKey: "IsTextSubtitleStream") try values.encodeIfPresent(isTextSubtitleStream, forKey: "IsTextSubtitleStream")
try values.encodeIfPresent(language, forKey: "Language") try values.encodeIfPresent(language, forKey: "Language")
@ -342,6 +358,7 @@ public struct MediaStream: Codable, Hashable {
try values.encodeIfPresent(localizedDefault, forKey: "LocalizedDefault") try values.encodeIfPresent(localizedDefault, forKey: "LocalizedDefault")
try values.encodeIfPresent(localizedExternal, forKey: "LocalizedExternal") try values.encodeIfPresent(localizedExternal, forKey: "LocalizedExternal")
try values.encodeIfPresent(localizedForced, forKey: "LocalizedForced") try values.encodeIfPresent(localizedForced, forKey: "LocalizedForced")
try values.encodeIfPresent(localizedHearingImpaired, forKey: "LocalizedHearingImpaired")
try values.encodeIfPresent(localizedUndefined, forKey: "LocalizedUndefined") try values.encodeIfPresent(localizedUndefined, forKey: "LocalizedUndefined")
try values.encodeIfPresent(nalLengthSize, forKey: "NalLengthSize") try values.encodeIfPresent(nalLengthSize, forKey: "NalLengthSize")
try values.encodeIfPresent(packetLength, forKey: "PacketLength") try values.encodeIfPresent(packetLength, forKey: "PacketLength")

View File

@ -0,0 +1,17 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Media streaming protocol.
///
/// Lowercase for backwards compatibility.
public enum MediaStreamProtocol: String, Codable, CaseIterable {
case http
case hls
}

View File

@ -15,4 +15,5 @@ public enum MediaStreamType: String, Codable, CaseIterable {
case subtitle = "Subtitle" case subtitle = "Subtitle"
case embeddedImage = "EmbeddedImage" case embeddedImage = "EmbeddedImage"
case data = "Data" case data = "Data"
case lyric = "Lyric"
} }

View File

@ -0,0 +1,18 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Media types.
public enum MediaType: String, Codable, CaseIterable {
case unknown = "Unknown"
case video = "Video"
case audio = "Audio"
case photo = "Photo"
case book = "Book"
}

View File

@ -9,7 +9,7 @@
import Foundation import Foundation
public struct MetadataEditorInfo: Codable, Hashable { public struct MetadataEditorInfo: Codable, Hashable {
public var contentType: String? public var contentType: CollectionType?
public var contentTypeOptions: [NameValuePair]? public var contentTypeOptions: [NameValuePair]?
public var countries: [CountryInfo]? public var countries: [CountryInfo]?
public var cultures: [CultureDto]? public var cultures: [CultureDto]?
@ -17,7 +17,7 @@ public struct MetadataEditorInfo: Codable, Hashable {
public var parentalRatingOptions: [ParentalRating]? public var parentalRatingOptions: [ParentalRating]?
public init( public init(
contentType: String? = nil, contentType: CollectionType? = nil,
contentTypeOptions: [NameValuePair]? = nil, contentTypeOptions: [NameValuePair]? = nil,
countries: [CountryInfo]? = nil, countries: [CountryInfo]? = nil,
cultures: [CultureDto]? = nil, cultures: [CultureDto]? = nil,
@ -34,7 +34,7 @@ public struct MetadataEditorInfo: Codable, Hashable {
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.contentType = try values.decodeIfPresent(String.self, forKey: "ContentType") self.contentType = try values.decodeIfPresent(CollectionType.self, forKey: "ContentType")
self.contentTypeOptions = try values.decodeIfPresent([NameValuePair].self, forKey: "ContentTypeOptions") self.contentTypeOptions = try values.decodeIfPresent([NameValuePair].self, forKey: "ContentTypeOptions")
self.countries = try values.decodeIfPresent([CountryInfo].self, forKey: "Countries") self.countries = try values.decodeIfPresent([CountryInfo].self, forKey: "Countries")
self.cultures = try values.decodeIfPresent([CultureDto].self, forKey: "Cultures") self.cultures = try values.decodeIfPresent([CultureDto].self, forKey: "Cultures")

View File

@ -8,238 +8,163 @@
import Foundation import Foundation
/// Defines the Jellyfin.Networking.Configuration.NetworkConfiguration. /// Defines the MediaBrowser.Common.Net.NetworkConfiguration.
public struct NetworkConfiguration: Codable, Hashable { public struct NetworkConfiguration: Codable, Hashable {
/// Gets or sets a value indicating whether Autodiscovery is enabled. /// Gets or sets a value indicating whether Autodiscovery is enabled.
public var isAutoDiscovery: Bool? public var isAutoDiscovery: Bool?
/// Gets or sets a value indicating whether Autodiscovery tracing is enabled.
public var isAutoDiscoveryTracing: Bool?
/// Gets or sets a value used to specify the URL prefix that your Jellyfin instance can be accessed at. /// Gets or sets a value used to specify the URL prefix that your Jellyfin instance can be accessed at.
public var baseURL: String? public var baseURL: String?
/// Gets or sets the password required to access the X.509 certificate data in the file specified by /// Gets or sets the password required to access the X.509 certificate data in the file specified by
/// Jellyfin.Networking.Configuration.NetworkConfiguration.CertificatePath. /// MediaBrowser.Common.Net.NetworkConfiguration.CertificatePath.
public var certificatePassword: String? public var certificatePassword: String?
/// Gets or sets the filesystem path of an X.509 certificate to use for SSL. /// Gets or sets the filesystem path of an X.509 certificate to use for SSL.
public var certificatePath: String? public var certificatePath: String?
/// Gets or sets a value indicating whether to use HTTPS. /// Gets or sets a value indicating whether to use HTTPS.
public var enableHTTPS: Bool? public var enableHTTPS: Bool?
/// Gets or sets a value indicating whether gets or sets IPV4 capability. /// Gets or sets a value indicating whether IPv6 is enabled.
public var enableIPV4: Bool? public var enableIPv4: Bool?
/// Gets or sets a value indicating whether gets or sets IPV6 capability. /// Gets or sets a value indicating whether IPv6 is enabled.
public var enableIPV6: Bool? public var enableIPv6: Bool?
/// Gets a value indicating whether multi-socket binding is available.
public var enableMultiSocketBinding: Bool?
/// Gets or sets a value indicating whether the published server uri is based on information in HTTP requests. /// Gets or sets a value indicating whether the published server uri is based on information in HTTP requests.
public var enablePublishedServerUriByRequest: Bool? public var enablePublishedServerUriByRequest: Bool?
/// Gets or sets a value indicating whether access outside of the LAN is permitted. /// Gets or sets a value indicating whether access from outside of the LAN is permitted.
public var enableRemoteAccess: Bool? public var enableRemoteAccess: Bool?
/// Gets or sets a value indicating whether detailed SSDP logs are sent to the console/log.
///
/// "Emby.Dlna": "Debug" must be set in logging.default.json for this property to have any effect.
public var enableSSDPTracing: Bool?
/// Gets or sets a value indicating whether to enable automatic port forwarding. /// Gets or sets a value indicating whether to enable automatic port forwarding.
public var enableUPnP: Bool? public var enableUPnP: Bool?
/// Gets or sets the time (in seconds) between the pings of SSDP gateway monitor. /// Gets or sets a value indicating whether address names that match MediaBrowser.Common.Net.NetworkConfiguration.VirtualInterfaceNames
public var gatewayMonitorPeriod: Int? /// should be ignored for the purposes of binding.
/// Gets or sets the ports that HDHomerun uses.
public var hDHomerunPortRange: String?
/// Gets or sets the HTTP server port number.
public var httpserverPortNumber: Int?
/// Gets or sets the HTTPS server port number.
public var httpsPortNumber: Int?
/// Gets or sets a value indicating whether address names that match
/// Jellyfin.Networking.Configuration.NetworkConfiguration.VirtualInterfaceNames should be Ignore for the purposes of binding.
public var isIgnoreVirtualInterfaces: Bool? public var isIgnoreVirtualInterfaces: Bool?
/// Gets or sets a value indicating whether <seealso cref="P:Jellyfin.Networking.Configuration.NetworkConfiguration.RemoteIPFilter" /> /// Gets or sets the internal HTTP server port.
/// contains a blacklist or a whitelist. Default is a whitelist. public var internalHTTPPort: Int?
/// Gets or sets the internal HTTPS server port.
public var internalHTTPSPort: Int?
/// Gets or sets a value indicating whether <seealso cref="P:MediaBrowser.Common.Net.NetworkConfiguration.RemoteIPFilter" /> contains a
/// blacklist or a whitelist. Default is a whitelist.
public var isRemoteIPFilterBlacklist: Bool? public var isRemoteIPFilterBlacklist: Bool?
/// Gets or sets the known proxies. If the proxy is a network, it's added to the KnownNetworks. /// Gets or sets the known proxies.
public var knownProxies: [String]? public var knownProxies: [String]?
/// Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used. /// Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used.
public var localNetworkAddresses: [String]? public var localNetworkAddresses: [String]?
/// Gets or sets the subnets that are deemed to make up the LAN. /// Gets or sets the subnets that are deemed to make up the LAN.
public var localNetworkSubnets: [String]? public var localNetworkSubnets: [String]?
/// Gets or sets the public HTTP port.
public var publicHTTPPort: Int?
/// Gets or sets the public HTTPS port. /// Gets or sets the public HTTPS port.
public var publicHTTPSPort: Int? public var publicHTTPSPort: Int?
/// Gets or sets the public mapped port.
public var publicPort: Int?
/// Gets or sets the PublishedServerUriBySubnet /// Gets or sets the PublishedServerUriBySubnet
/// ///
/// Gets or sets PublishedServerUri to advertise for specific subnets. /// Gets or sets PublishedServerUri to advertise for specific subnets.
public var publishedServerUriBySubnet: [String]? public var publishedServerUriBySubnet: [String]?
/// Gets or sets the filter for remote IP connectivity. Used in conjuntion with <seealso /// Gets or sets the filter for remote IP connectivity. Used in conjunction with <seealso
/// cref="P:Jellyfin.Networking.Configuration.NetworkConfiguration.IsRemoteIPFilterBlacklist" />. /// cref="P:MediaBrowser.Common.Net.NetworkConfiguration.IsRemoteIPFilterBlacklist" />.
public var remoteIPFilter: [String]? public var remoteIPFilter: [String]?
/// Gets or sets a value indicating whether the server should force connections over HTTPS. /// Gets or sets a value indicating whether the server should force connections over HTTPS.
public var requireHTTPS: Bool? public var requireHTTPS: Bool?
/// Gets or sets the SSDPTracingFilter /// Gets or sets a value indicating the interface name prefixes that should be ignored. The list can be comma separated and values are
/// /// case-insensitive. <seealso cref="P:MediaBrowser.Common.Net.NetworkConfiguration.IgnoreVirtualInterfaces" />.
/// Gets or sets a value indicating whether an IP address is to be used to filter the detailed ssdp logs that are being sent to the public var virtualInterfaceNames: [String]?
/// console/log.
///
/// If the setting "Emby.Dlna": "Debug" msut be set in logging.default.json for this property to work.
public var sSDPTracingFilter: String?
/// Gets or sets a value indicating whether all IPv6 interfaces should be treated as on the internal network.
///
/// Depending on the address range implemented ULA ranges might not be used.
public var isTrustAllIP6Interfaces: Bool?
/// Gets or sets the UDPPortRange.
public var uDPPortRange: String?
/// Gets or sets the number of times SSDP UDP messages are sent.
public var uDPSendCount: Int?
/// Gets or sets the delay between each groups of SSDP messages (in ms).
public var uDPSendDelay: Int?
/// Gets or sets a value indicating whether the http port should be mapped as part of UPnP automatic port forwarding.
public var isUPnPCreateHTTPPortMap: Bool?
/// Gets or sets a value indicating the interfaces that should be ignored. The list can be comma separated. <seealso
/// cref="P:Jellyfin.Networking.Configuration.NetworkConfiguration.IgnoreVirtualInterfaces" />.
public var virtualInterfaceNames: String?
public init( public init(
isAutoDiscovery: Bool? = nil, isAutoDiscovery: Bool? = nil,
isAutoDiscoveryTracing: Bool? = nil,
baseURL: String? = nil, baseURL: String? = nil,
certificatePassword: String? = nil, certificatePassword: String? = nil,
certificatePath: String? = nil, certificatePath: String? = nil,
enableHTTPS: Bool? = nil, enableHTTPS: Bool? = nil,
enableIPV4: Bool? = nil, enableIPv4: Bool? = nil,
enableIPV6: Bool? = nil, enableIPv6: Bool? = nil,
enableMultiSocketBinding: Bool? = nil,
enablePublishedServerUriByRequest: Bool? = nil, enablePublishedServerUriByRequest: Bool? = nil,
enableRemoteAccess: Bool? = nil, enableRemoteAccess: Bool? = nil,
enableSSDPTracing: Bool? = nil,
enableUPnP: Bool? = nil, enableUPnP: Bool? = nil,
gatewayMonitorPeriod: Int? = nil,
hDHomerunPortRange: String? = nil,
httpserverPortNumber: Int? = nil,
httpsPortNumber: Int? = nil,
isIgnoreVirtualInterfaces: Bool? = nil, isIgnoreVirtualInterfaces: Bool? = nil,
internalHTTPPort: Int? = nil,
internalHTTPSPort: Int? = nil,
isRemoteIPFilterBlacklist: Bool? = nil, isRemoteIPFilterBlacklist: Bool? = nil,
knownProxies: [String]? = nil, knownProxies: [String]? = nil,
localNetworkAddresses: [String]? = nil, localNetworkAddresses: [String]? = nil,
localNetworkSubnets: [String]? = nil, localNetworkSubnets: [String]? = nil,
publicHTTPPort: Int? = nil,
publicHTTPSPort: Int? = nil, publicHTTPSPort: Int? = nil,
publicPort: Int? = nil,
publishedServerUriBySubnet: [String]? = nil, publishedServerUriBySubnet: [String]? = nil,
remoteIPFilter: [String]? = nil, remoteIPFilter: [String]? = nil,
requireHTTPS: Bool? = nil, requireHTTPS: Bool? = nil,
sSDPTracingFilter: String? = nil, virtualInterfaceNames: [String]? = nil
isTrustAllIP6Interfaces: Bool? = nil,
uDPPortRange: String? = nil,
uDPSendCount: Int? = nil,
uDPSendDelay: Int? = nil,
isUPnPCreateHTTPPortMap: Bool? = nil,
virtualInterfaceNames: String? = nil
) { ) {
self.isAutoDiscovery = isAutoDiscovery self.isAutoDiscovery = isAutoDiscovery
self.isAutoDiscoveryTracing = isAutoDiscoveryTracing
self.baseURL = baseURL self.baseURL = baseURL
self.certificatePassword = certificatePassword self.certificatePassword = certificatePassword
self.certificatePath = certificatePath self.certificatePath = certificatePath
self.enableHTTPS = enableHTTPS self.enableHTTPS = enableHTTPS
self.enableIPV4 = enableIPV4 self.enableIPv4 = enableIPv4
self.enableIPV6 = enableIPV6 self.enableIPv6 = enableIPv6
self.enableMultiSocketBinding = enableMultiSocketBinding
self.enablePublishedServerUriByRequest = enablePublishedServerUriByRequest self.enablePublishedServerUriByRequest = enablePublishedServerUriByRequest
self.enableRemoteAccess = enableRemoteAccess self.enableRemoteAccess = enableRemoteAccess
self.enableSSDPTracing = enableSSDPTracing
self.enableUPnP = enableUPnP self.enableUPnP = enableUPnP
self.gatewayMonitorPeriod = gatewayMonitorPeriod
self.hDHomerunPortRange = hDHomerunPortRange
self.httpserverPortNumber = httpserverPortNumber
self.httpsPortNumber = httpsPortNumber
self.isIgnoreVirtualInterfaces = isIgnoreVirtualInterfaces self.isIgnoreVirtualInterfaces = isIgnoreVirtualInterfaces
self.internalHTTPPort = internalHTTPPort
self.internalHTTPSPort = internalHTTPSPort
self.isRemoteIPFilterBlacklist = isRemoteIPFilterBlacklist self.isRemoteIPFilterBlacklist = isRemoteIPFilterBlacklist
self.knownProxies = knownProxies self.knownProxies = knownProxies
self.localNetworkAddresses = localNetworkAddresses self.localNetworkAddresses = localNetworkAddresses
self.localNetworkSubnets = localNetworkSubnets self.localNetworkSubnets = localNetworkSubnets
self.publicHTTPPort = publicHTTPPort
self.publicHTTPSPort = publicHTTPSPort self.publicHTTPSPort = publicHTTPSPort
self.publicPort = publicPort
self.publishedServerUriBySubnet = publishedServerUriBySubnet self.publishedServerUriBySubnet = publishedServerUriBySubnet
self.remoteIPFilter = remoteIPFilter self.remoteIPFilter = remoteIPFilter
self.requireHTTPS = requireHTTPS self.requireHTTPS = requireHTTPS
self.sSDPTracingFilter = sSDPTracingFilter
self.isTrustAllIP6Interfaces = isTrustAllIP6Interfaces
self.uDPPortRange = uDPPortRange
self.uDPSendCount = uDPSendCount
self.uDPSendDelay = uDPSendDelay
self.isUPnPCreateHTTPPortMap = isUPnPCreateHTTPPortMap
self.virtualInterfaceNames = virtualInterfaceNames self.virtualInterfaceNames = virtualInterfaceNames
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.isAutoDiscovery = try values.decodeIfPresent(Bool.self, forKey: "AutoDiscovery") self.isAutoDiscovery = try values.decodeIfPresent(Bool.self, forKey: "AutoDiscovery")
self.isAutoDiscoveryTracing = try values.decodeIfPresent(Bool.self, forKey: "AutoDiscoveryTracing")
self.baseURL = try values.decodeIfPresent(String.self, forKey: "BaseUrl") self.baseURL = try values.decodeIfPresent(String.self, forKey: "BaseUrl")
self.certificatePassword = try values.decodeIfPresent(String.self, forKey: "CertificatePassword") self.certificatePassword = try values.decodeIfPresent(String.self, forKey: "CertificatePassword")
self.certificatePath = try values.decodeIfPresent(String.self, forKey: "CertificatePath") self.certificatePath = try values.decodeIfPresent(String.self, forKey: "CertificatePath")
self.enableHTTPS = try values.decodeIfPresent(Bool.self, forKey: "EnableHttps") self.enableHTTPS = try values.decodeIfPresent(Bool.self, forKey: "EnableHttps")
self.enableIPV4 = try values.decodeIfPresent(Bool.self, forKey: "EnableIPV4") self.enableIPv4 = try values.decodeIfPresent(Bool.self, forKey: "EnableIPv4")
self.enableIPV6 = try values.decodeIfPresent(Bool.self, forKey: "EnableIPV6") self.enableIPv6 = try values.decodeIfPresent(Bool.self, forKey: "EnableIPv6")
self.enableMultiSocketBinding = try values.decodeIfPresent(Bool.self, forKey: "EnableMultiSocketBinding")
self.enablePublishedServerUriByRequest = try values.decodeIfPresent(Bool.self, forKey: "EnablePublishedServerUriByRequest") self.enablePublishedServerUriByRequest = try values.decodeIfPresent(Bool.self, forKey: "EnablePublishedServerUriByRequest")
self.enableRemoteAccess = try values.decodeIfPresent(Bool.self, forKey: "EnableRemoteAccess") self.enableRemoteAccess = try values.decodeIfPresent(Bool.self, forKey: "EnableRemoteAccess")
self.enableSSDPTracing = try values.decodeIfPresent(Bool.self, forKey: "EnableSSDPTracing")
self.enableUPnP = try values.decodeIfPresent(Bool.self, forKey: "EnableUPnP") self.enableUPnP = try values.decodeIfPresent(Bool.self, forKey: "EnableUPnP")
self.gatewayMonitorPeriod = try values.decodeIfPresent(Int.self, forKey: "GatewayMonitorPeriod")
self.hDHomerunPortRange = try values.decodeIfPresent(String.self, forKey: "HDHomerunPortRange")
self.httpserverPortNumber = try values.decodeIfPresent(Int.self, forKey: "HttpServerPortNumber")
self.httpsPortNumber = try values.decodeIfPresent(Int.self, forKey: "HttpsPortNumber")
self.isIgnoreVirtualInterfaces = try values.decodeIfPresent(Bool.self, forKey: "IgnoreVirtualInterfaces") self.isIgnoreVirtualInterfaces = try values.decodeIfPresent(Bool.self, forKey: "IgnoreVirtualInterfaces")
self.internalHTTPPort = try values.decodeIfPresent(Int.self, forKey: "InternalHttpPort")
self.internalHTTPSPort = try values.decodeIfPresent(Int.self, forKey: "InternalHttpsPort")
self.isRemoteIPFilterBlacklist = try values.decodeIfPresent(Bool.self, forKey: "IsRemoteIPFilterBlacklist") self.isRemoteIPFilterBlacklist = try values.decodeIfPresent(Bool.self, forKey: "IsRemoteIPFilterBlacklist")
self.knownProxies = try values.decodeIfPresent([String].self, forKey: "KnownProxies") self.knownProxies = try values.decodeIfPresent([String].self, forKey: "KnownProxies")
self.localNetworkAddresses = try values.decodeIfPresent([String].self, forKey: "LocalNetworkAddresses") self.localNetworkAddresses = try values.decodeIfPresent([String].self, forKey: "LocalNetworkAddresses")
self.localNetworkSubnets = try values.decodeIfPresent([String].self, forKey: "LocalNetworkSubnets") self.localNetworkSubnets = try values.decodeIfPresent([String].self, forKey: "LocalNetworkSubnets")
self.publicHTTPPort = try values.decodeIfPresent(Int.self, forKey: "PublicHttpPort")
self.publicHTTPSPort = try values.decodeIfPresent(Int.self, forKey: "PublicHttpsPort") self.publicHTTPSPort = try values.decodeIfPresent(Int.self, forKey: "PublicHttpsPort")
self.publicPort = try values.decodeIfPresent(Int.self, forKey: "PublicPort")
self.publishedServerUriBySubnet = try values.decodeIfPresent([String].self, forKey: "PublishedServerUriBySubnet") self.publishedServerUriBySubnet = try values.decodeIfPresent([String].self, forKey: "PublishedServerUriBySubnet")
self.remoteIPFilter = try values.decodeIfPresent([String].self, forKey: "RemoteIPFilter") self.remoteIPFilter = try values.decodeIfPresent([String].self, forKey: "RemoteIPFilter")
self.requireHTTPS = try values.decodeIfPresent(Bool.self, forKey: "RequireHttps") self.requireHTTPS = try values.decodeIfPresent(Bool.self, forKey: "RequireHttps")
self.sSDPTracingFilter = try values.decodeIfPresent(String.self, forKey: "SSDPTracingFilter") self.virtualInterfaceNames = try values.decodeIfPresent([String].self, forKey: "VirtualInterfaceNames")
self.isTrustAllIP6Interfaces = try values.decodeIfPresent(Bool.self, forKey: "TrustAllIP6Interfaces")
self.uDPPortRange = try values.decodeIfPresent(String.self, forKey: "UDPPortRange")
self.uDPSendCount = try values.decodeIfPresent(Int.self, forKey: "UDPSendCount")
self.uDPSendDelay = try values.decodeIfPresent(Int.self, forKey: "UDPSendDelay")
self.isUPnPCreateHTTPPortMap = try values.decodeIfPresent(Bool.self, forKey: "UPnPCreateHttpPortMap")
self.virtualInterfaceNames = try values.decodeIfPresent(String.self, forKey: "VirtualInterfaceNames")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(isAutoDiscovery, forKey: "AutoDiscovery") try values.encodeIfPresent(isAutoDiscovery, forKey: "AutoDiscovery")
try values.encodeIfPresent(isAutoDiscoveryTracing, forKey: "AutoDiscoveryTracing")
try values.encodeIfPresent(baseURL, forKey: "BaseUrl") try values.encodeIfPresent(baseURL, forKey: "BaseUrl")
try values.encodeIfPresent(certificatePassword, forKey: "CertificatePassword") try values.encodeIfPresent(certificatePassword, forKey: "CertificatePassword")
try values.encodeIfPresent(certificatePath, forKey: "CertificatePath") try values.encodeIfPresent(certificatePath, forKey: "CertificatePath")
try values.encodeIfPresent(enableHTTPS, forKey: "EnableHttps") try values.encodeIfPresent(enableHTTPS, forKey: "EnableHttps")
try values.encodeIfPresent(enableIPV4, forKey: "EnableIPV4") try values.encodeIfPresent(enableIPv4, forKey: "EnableIPv4")
try values.encodeIfPresent(enableIPV6, forKey: "EnableIPV6") try values.encodeIfPresent(enableIPv6, forKey: "EnableIPv6")
try values.encodeIfPresent(enableMultiSocketBinding, forKey: "EnableMultiSocketBinding")
try values.encodeIfPresent(enablePublishedServerUriByRequest, forKey: "EnablePublishedServerUriByRequest") try values.encodeIfPresent(enablePublishedServerUriByRequest, forKey: "EnablePublishedServerUriByRequest")
try values.encodeIfPresent(enableRemoteAccess, forKey: "EnableRemoteAccess") try values.encodeIfPresent(enableRemoteAccess, forKey: "EnableRemoteAccess")
try values.encodeIfPresent(enableSSDPTracing, forKey: "EnableSSDPTracing")
try values.encodeIfPresent(enableUPnP, forKey: "EnableUPnP") try values.encodeIfPresent(enableUPnP, forKey: "EnableUPnP")
try values.encodeIfPresent(gatewayMonitorPeriod, forKey: "GatewayMonitorPeriod")
try values.encodeIfPresent(hDHomerunPortRange, forKey: "HDHomerunPortRange")
try values.encodeIfPresent(httpserverPortNumber, forKey: "HttpServerPortNumber")
try values.encodeIfPresent(httpsPortNumber, forKey: "HttpsPortNumber")
try values.encodeIfPresent(isIgnoreVirtualInterfaces, forKey: "IgnoreVirtualInterfaces") try values.encodeIfPresent(isIgnoreVirtualInterfaces, forKey: "IgnoreVirtualInterfaces")
try values.encodeIfPresent(internalHTTPPort, forKey: "InternalHttpPort")
try values.encodeIfPresent(internalHTTPSPort, forKey: "InternalHttpsPort")
try values.encodeIfPresent(isRemoteIPFilterBlacklist, forKey: "IsRemoteIPFilterBlacklist") try values.encodeIfPresent(isRemoteIPFilterBlacklist, forKey: "IsRemoteIPFilterBlacklist")
try values.encodeIfPresent(knownProxies, forKey: "KnownProxies") try values.encodeIfPresent(knownProxies, forKey: "KnownProxies")
try values.encodeIfPresent(localNetworkAddresses, forKey: "LocalNetworkAddresses") try values.encodeIfPresent(localNetworkAddresses, forKey: "LocalNetworkAddresses")
try values.encodeIfPresent(localNetworkSubnets, forKey: "LocalNetworkSubnets") try values.encodeIfPresent(localNetworkSubnets, forKey: "LocalNetworkSubnets")
try values.encodeIfPresent(publicHTTPPort, forKey: "PublicHttpPort")
try values.encodeIfPresent(publicHTTPSPort, forKey: "PublicHttpsPort") try values.encodeIfPresent(publicHTTPSPort, forKey: "PublicHttpsPort")
try values.encodeIfPresent(publicPort, forKey: "PublicPort")
try values.encodeIfPresent(publishedServerUriBySubnet, forKey: "PublishedServerUriBySubnet") try values.encodeIfPresent(publishedServerUriBySubnet, forKey: "PublishedServerUriBySubnet")
try values.encodeIfPresent(remoteIPFilter, forKey: "RemoteIPFilter") try values.encodeIfPresent(remoteIPFilter, forKey: "RemoteIPFilter")
try values.encodeIfPresent(requireHTTPS, forKey: "RequireHttps") try values.encodeIfPresent(requireHTTPS, forKey: "RequireHttps")
try values.encodeIfPresent(sSDPTracingFilter, forKey: "SSDPTracingFilter")
try values.encodeIfPresent(isTrustAllIP6Interfaces, forKey: "TrustAllIP6Interfaces")
try values.encodeIfPresent(uDPPortRange, forKey: "UDPPortRange")
try values.encodeIfPresent(uDPSendCount, forKey: "UDPSendCount")
try values.encodeIfPresent(uDPSendDelay, forKey: "UDPSendDelay")
try values.encodeIfPresent(isUPnPCreateHTTPPortMap, forKey: "UPnPCreateHttpPortMap")
try values.encodeIfPresent(virtualInterfaceNames, forKey: "VirtualInterfaceNames") try values.encodeIfPresent(virtualInterfaceNames, forKey: "VirtualInterfaceNames")
} }
} }

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Keep alive websocket messages.
public struct OutboundKeepAliveMessage: Codable, Hashable {
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,125 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Represents the list of possible outbound websocket types
public enum OutboundWebSocketMessage: Codable, Hashable {
case activityLogEntryMessage(ActivityLogEntryMessage)
case forceKeepAliveMessage(ForceKeepAliveMessage)
case generalCommandMessage(GeneralCommandMessage)
case libraryChangedMessage(LibraryChangedMessage)
case outboundKeepAliveMessage(OutboundKeepAliveMessage)
case playMessage(PlayMessage)
case playstateMessage(PlaystateMessage)
case pluginInstallationCancelledMessage(PluginInstallationCancelledMessage)
case pluginInstallationCompletedMessage(PluginInstallationCompletedMessage)
case pluginInstallationFailedMessage(PluginInstallationFailedMessage)
case pluginInstallingMessage(PluginInstallingMessage)
case pluginUninstalledMessage(PluginUninstalledMessage)
case refreshProgressMessage(RefreshProgressMessage)
case restartRequiredMessage(RestartRequiredMessage)
case scheduledTaskEndedMessage(ScheduledTaskEndedMessage)
case scheduledTasksInfoMessage(ScheduledTasksInfoMessage)
case seriesTimerCancelledMessage(SeriesTimerCancelledMessage)
case seriesTimerCreatedMessage(SeriesTimerCreatedMessage)
case serverRestartingMessage(ServerRestartingMessage)
case serverShuttingDownMessage(ServerShuttingDownMessage)
case sessionsMessage(SessionsMessage)
case syncPlayCommandMessage(SyncPlayCommandMessage)
case syncPlayGroupUpdateCommandMessage(SyncPlayGroupUpdateCommandMessage)
case timerCancelledMessage(TimerCancelledMessage)
case timerCreatedMessage(TimerCreatedMessage)
case userDataChangedMessage(UserDataChangedMessage)
case userDeletedMessage(UserDeletedMessage)
case userUpdatedMessage(UserUpdatedMessage)
public init(from decoder: Decoder) throws {
struct Discriminator: Decodable {
let MessageType: String
}
let container = try decoder.singleValueContainer()
let discriminatorValue = try container.decode(Discriminator.self).MessageType
switch discriminatorValue {
case "ActivityLogEntry": self = try .activityLogEntryMessage(container.decode(ActivityLogEntryMessage.self))
case "ForceKeepAlive": self = try .forceKeepAliveMessage(container.decode(ForceKeepAliveMessage.self))
case "GeneralCommand": self = try .generalCommandMessage(container.decode(GeneralCommandMessage.self))
case "LibraryChanged": self = try .libraryChangedMessage(container.decode(LibraryChangedMessage.self))
case "KeepAlive": self = try .outboundKeepAliveMessage(container.decode(OutboundKeepAliveMessage.self))
case "Play": self = try .playMessage(container.decode(PlayMessage.self))
case "Playstate": self = try .playstateMessage(container.decode(PlaystateMessage.self))
case "PackageInstallationCancelled": self = try .pluginInstallationCancelledMessage(container
.decode(PluginInstallationCancelledMessage.self))
case "PackageInstallationCompleted": self = try .pluginInstallationCompletedMessage(container
.decode(PluginInstallationCompletedMessage.self))
case "PackageInstallationFailed": self = try .pluginInstallationFailedMessage(container
.decode(PluginInstallationFailedMessage.self))
case "PackageInstalling": self = try .pluginInstallingMessage(container.decode(PluginInstallingMessage.self))
case "PackageUninstalled": self = try .pluginUninstalledMessage(container.decode(PluginUninstalledMessage.self))
case "RefreshProgress": self = try .refreshProgressMessage(container.decode(RefreshProgressMessage.self))
case "RestartRequired": self = try .restartRequiredMessage(container.decode(RestartRequiredMessage.self))
case "ScheduledTaskEnded": self = try .scheduledTaskEndedMessage(container.decode(ScheduledTaskEndedMessage.self))
case "ScheduledTasksInfo": self = try .scheduledTasksInfoMessage(container.decode(ScheduledTasksInfoMessage.self))
case "SeriesTimerCancelled": self = try .seriesTimerCancelledMessage(container.decode(SeriesTimerCancelledMessage.self))
case "SeriesTimerCreated": self = try .seriesTimerCreatedMessage(container.decode(SeriesTimerCreatedMessage.self))
case "ServerRestarting": self = try .serverRestartingMessage(container.decode(ServerRestartingMessage.self))
case "ServerShuttingDown": self = try .serverShuttingDownMessage(container.decode(ServerShuttingDownMessage.self))
case "Sessions": self = try .sessionsMessage(container.decode(SessionsMessage.self))
case "SyncPlayCommand": self = try .syncPlayCommandMessage(container.decode(SyncPlayCommandMessage.self))
case "SyncPlayGroupUpdate": self = try .syncPlayGroupUpdateCommandMessage(container.decode(SyncPlayGroupUpdateCommandMessage.self))
case "TimerCancelled": self = try .timerCancelledMessage(container.decode(TimerCancelledMessage.self))
case "TimerCreated": self = try .timerCreatedMessage(container.decode(TimerCreatedMessage.self))
case "UserDataChanged": self = try .userDataChangedMessage(container.decode(UserDataChangedMessage.self))
case "UserDeleted": self = try .userDeletedMessage(container.decode(UserDeletedMessage.self))
case "UserUpdated": self = try .userUpdatedMessage(container.decode(UserUpdatedMessage.self))
default:
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "Discriminator value '\(discriminatorValue)' does not match any expected values (ActivityLogEntry, ForceKeepAlive, GeneralCommand, LibraryChanged, KeepAlive, Play, Playstate, PackageInstallationCancelled, PackageInstallationCompleted, PackageInstallationFailed, PackageInstalling, PackageUninstalled, RefreshProgress, RestartRequired, ScheduledTaskEnded, ScheduledTasksInfo, SeriesTimerCancelled, SeriesTimerCreated, ServerRestarting, ServerShuttingDown, Sessions, SyncPlayCommand, SyncPlayGroupUpdate, TimerCancelled, TimerCreated, UserDataChanged, UserDeleted, UserUpdated)."
)
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .activityLogEntryMessage(value): try container.encode(value)
case let .forceKeepAliveMessage(value): try container.encode(value)
case let .generalCommandMessage(value): try container.encode(value)
case let .libraryChangedMessage(value): try container.encode(value)
case let .outboundKeepAliveMessage(value): try container.encode(value)
case let .playMessage(value): try container.encode(value)
case let .playstateMessage(value): try container.encode(value)
case let .pluginInstallationCancelledMessage(value): try container.encode(value)
case let .pluginInstallationCompletedMessage(value): try container.encode(value)
case let .pluginInstallationFailedMessage(value): try container.encode(value)
case let .pluginInstallingMessage(value): try container.encode(value)
case let .pluginUninstalledMessage(value): try container.encode(value)
case let .refreshProgressMessage(value): try container.encode(value)
case let .restartRequiredMessage(value): try container.encode(value)
case let .scheduledTaskEndedMessage(value): try container.encode(value)
case let .scheduledTasksInfoMessage(value): try container.encode(value)
case let .seriesTimerCancelledMessage(value): try container.encode(value)
case let .seriesTimerCreatedMessage(value): try container.encode(value)
case let .serverRestartingMessage(value): try container.encode(value)
case let .serverShuttingDownMessage(value): try container.encode(value)
case let .sessionsMessage(value): try container.encode(value)
case let .syncPlayCommandMessage(value): try container.encode(value)
case let .syncPlayGroupUpdateCommandMessage(value): try container.encode(value)
case let .timerCancelledMessage(value): try container.encode(value)
case let .timerCreatedMessage(value): try container.encode(value)
case let .userDataChangedMessage(value): try container.encode(value)
case let .userDeletedMessage(value): try container.encode(value)
case let .userUpdatedMessage(value): try container.encode(value)
}
}
}

View File

@ -0,0 +1,38 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// The person kind.
public enum PersonKind: String, Codable, CaseIterable {
case unknown = "Unknown"
case actor = "Actor"
case director = "Director"
case composer = "Composer"
case writer = "Writer"
case guestStar = "GuestStar"
case producer = "Producer"
case conductor = "Conductor"
case lyricist = "Lyricist"
case arranger = "Arranger"
case engineer = "Engineer"
case mixer = "Mixer"
case remixer = "Remixer"
case creator = "Creator"
case artist = "Artist"
case albumArtist = "AlbumArtist"
case author = "Author"
case illustrator = "Illustrator"
case penciller = "Penciller"
case inker = "Inker"
case colorist = "Colorist"
case letterer = "Letterer"
case coverArtist = "CoverArtist"
case editor = "Editor"
case translator = "Translator"
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Play command websocket message.
public struct PlayMessage: Codable, Hashable {
/// Class PlayRequest.
public var data: PlayRequest?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: PlayRequest? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(PlayRequest.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,73 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class PlayQueueUpdate.
public struct PlayQueueUpdate: Codable, Hashable {
/// Gets a value indicating whether the current item is playing.
public var isPlaying: Bool?
/// Gets the UTC time of the last change to the playing queue.
public var lastUpdate: Date?
/// Gets the playing item index in the playlist.
public var playingItemIndex: Int?
/// Gets the playlist.
public var playlist: [SyncPlayQueueItem]?
/// Gets the request type that originated this update.
public var reason: PlayQueueUpdateReason?
/// Gets the repeat mode.
public var repeatMode: GroupRepeatMode?
/// Gets the shuffle mode.
public var shuffleMode: GroupShuffleMode?
/// Gets the start position ticks.
public var startPositionTicks: Int?
public init(
isPlaying: Bool? = nil,
lastUpdate: Date? = nil,
playingItemIndex: Int? = nil,
playlist: [SyncPlayQueueItem]? = nil,
reason: PlayQueueUpdateReason? = nil,
repeatMode: GroupRepeatMode? = nil,
shuffleMode: GroupShuffleMode? = nil,
startPositionTicks: Int? = nil
) {
self.isPlaying = isPlaying
self.lastUpdate = lastUpdate
self.playingItemIndex = playingItemIndex
self.playlist = playlist
self.reason = reason
self.repeatMode = repeatMode
self.shuffleMode = shuffleMode
self.startPositionTicks = startPositionTicks
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.isPlaying = try values.decodeIfPresent(Bool.self, forKey: "IsPlaying")
self.lastUpdate = try values.decodeIfPresent(Date.self, forKey: "LastUpdate")
self.playingItemIndex = try values.decodeIfPresent(Int.self, forKey: "PlayingItemIndex")
self.playlist = try values.decodeIfPresent([SyncPlayQueueItem].self, forKey: "Playlist")
self.reason = try values.decodeIfPresent(PlayQueueUpdateReason.self, forKey: "Reason")
self.repeatMode = try values.decodeIfPresent(GroupRepeatMode.self, forKey: "RepeatMode")
self.shuffleMode = try values.decodeIfPresent(GroupShuffleMode.self, forKey: "ShuffleMode")
self.startPositionTicks = try values.decodeIfPresent(Int.self, forKey: "StartPositionTicks")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(isPlaying, forKey: "IsPlaying")
try values.encodeIfPresent(lastUpdate, forKey: "LastUpdate")
try values.encodeIfPresent(playingItemIndex, forKey: "PlayingItemIndex")
try values.encodeIfPresent(playlist, forKey: "Playlist")
try values.encodeIfPresent(reason, forKey: "Reason")
try values.encodeIfPresent(repeatMode, forKey: "RepeatMode")
try values.encodeIfPresent(shuffleMode, forKey: "ShuffleMode")
try values.encodeIfPresent(startPositionTicks, forKey: "StartPositionTicks")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class GroupUpdate.
public struct PlayQueueUpdateGroupUpdate: Codable, Hashable {
/// Gets the update data.
public var data: PlayQueueUpdate?
/// Gets the group identifier.
public var groupID: String?
/// Gets the update type.
public var type: GroupUpdateType?
public init(data: PlayQueueUpdate? = nil, groupID: String? = nil, type: GroupUpdateType? = nil) {
self.data = data
self.groupID = groupID
self.type = type
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(PlayQueueUpdate.self, forKey: "Data")
self.groupID = try values.decodeIfPresent(String.self, forKey: "GroupId")
self.type = try values.decodeIfPresent(GroupUpdateType.self, forKey: "Type")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(groupID, forKey: "GroupId")
try values.encodeIfPresent(type, forKey: "Type")
}
}

View File

@ -0,0 +1,23 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Enum PlayQueueUpdateReason.
public enum PlayQueueUpdateReason: String, Codable, CaseIterable {
case newPlaylist = "NewPlaylist"
case setCurrentItem = "SetCurrentItem"
case removeItems = "RemoveItems"
case moveItem = "MoveItem"
case queue = "Queue"
case queueNext = "QueueNext"
case nextItem = "NextItem"
case previousItem = "PreviousItem"
case repeatMode = "RepeatMode"
case shuffleMode = "ShuffleMode"
}

View File

@ -0,0 +1,15 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Enum PlaybackOrder.
public enum PlaybackOrder: String, Codable, CaseIterable {
case `default` = "Default"
case shuffle = "Shuffle"
}

View File

@ -33,6 +33,8 @@ public struct PlaybackProgressInfo: Codable, Hashable {
public var playMethod: PlayMethod? public var playMethod: PlayMethod?
/// Gets or sets the play session identifier. /// Gets or sets the play session identifier.
public var playSessionID: String? public var playSessionID: String?
/// Gets or sets the playback order.
public var playbackOrder: PlaybackOrder?
public var playbackStartTimeTicks: Int? public var playbackStartTimeTicks: Int?
public var playlistItemID: String? public var playlistItemID: String?
/// Gets or sets the position ticks. /// Gets or sets the position ticks.
@ -60,6 +62,7 @@ public struct PlaybackProgressInfo: Codable, Hashable {
nowPlayingQueue: [QueueItem]? = nil, nowPlayingQueue: [QueueItem]? = nil,
playMethod: PlayMethod? = nil, playMethod: PlayMethod? = nil,
playSessionID: String? = nil, playSessionID: String? = nil,
playbackOrder: PlaybackOrder? = nil,
playbackStartTimeTicks: Int? = nil, playbackStartTimeTicks: Int? = nil,
playlistItemID: String? = nil, playlistItemID: String? = nil,
positionTicks: Int? = nil, positionTicks: Int? = nil,
@ -81,6 +84,7 @@ public struct PlaybackProgressInfo: Codable, Hashable {
self.nowPlayingQueue = nowPlayingQueue self.nowPlayingQueue = nowPlayingQueue
self.playMethod = playMethod self.playMethod = playMethod
self.playSessionID = playSessionID self.playSessionID = playSessionID
self.playbackOrder = playbackOrder
self.playbackStartTimeTicks = playbackStartTimeTicks self.playbackStartTimeTicks = playbackStartTimeTicks
self.playlistItemID = playlistItemID self.playlistItemID = playlistItemID
self.positionTicks = positionTicks self.positionTicks = positionTicks
@ -105,6 +109,7 @@ public struct PlaybackProgressInfo: Codable, Hashable {
self.nowPlayingQueue = try values.decodeIfPresent([QueueItem].self, forKey: "NowPlayingQueue") self.nowPlayingQueue = try values.decodeIfPresent([QueueItem].self, forKey: "NowPlayingQueue")
self.playMethod = try values.decodeIfPresent(PlayMethod.self, forKey: "PlayMethod") self.playMethod = try values.decodeIfPresent(PlayMethod.self, forKey: "PlayMethod")
self.playSessionID = try values.decodeIfPresent(String.self, forKey: "PlaySessionId") self.playSessionID = try values.decodeIfPresent(String.self, forKey: "PlaySessionId")
self.playbackOrder = try values.decodeIfPresent(PlaybackOrder.self, forKey: "PlaybackOrder")
self.playbackStartTimeTicks = try values.decodeIfPresent(Int.self, forKey: "PlaybackStartTimeTicks") self.playbackStartTimeTicks = try values.decodeIfPresent(Int.self, forKey: "PlaybackStartTimeTicks")
self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId") self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId")
self.positionTicks = try values.decodeIfPresent(Int.self, forKey: "PositionTicks") self.positionTicks = try values.decodeIfPresent(Int.self, forKey: "PositionTicks")
@ -129,6 +134,7 @@ public struct PlaybackProgressInfo: Codable, Hashable {
try values.encodeIfPresent(nowPlayingQueue, forKey: "NowPlayingQueue") try values.encodeIfPresent(nowPlayingQueue, forKey: "NowPlayingQueue")
try values.encodeIfPresent(playMethod, forKey: "PlayMethod") try values.encodeIfPresent(playMethod, forKey: "PlayMethod")
try values.encodeIfPresent(playSessionID, forKey: "PlaySessionId") try values.encodeIfPresent(playSessionID, forKey: "PlaySessionId")
try values.encodeIfPresent(playbackOrder, forKey: "PlaybackOrder")
try values.encodeIfPresent(playbackStartTimeTicks, forKey: "PlaybackStartTimeTicks") try values.encodeIfPresent(playbackStartTimeTicks, forKey: "PlaybackStartTimeTicks")
try values.encodeIfPresent(playlistItemID, forKey: "PlaylistItemId") try values.encodeIfPresent(playlistItemID, forKey: "PlaylistItemId")
try values.encodeIfPresent(positionTicks, forKey: "PositionTicks") try values.encodeIfPresent(positionTicks, forKey: "PositionTicks")

View File

@ -0,0 +1,30 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Enum PlaybackRequestType.
public enum PlaybackRequestType: String, Codable, CaseIterable {
case play = "Play"
case setPlaylistItem = "SetPlaylistItem"
case removeFromPlaylist = "RemoveFromPlaylist"
case movePlaylistItem = "MovePlaylistItem"
case queue = "Queue"
case unpause = "Unpause"
case pause = "Pause"
case stop = "Stop"
case seek = "Seek"
case buffer = "Buffer"
case ready = "Ready"
case nextItem = "NextItem"
case previousItem = "PreviousItem"
case setRepeatMode = "SetRepeatMode"
case setShuffleMode = "SetShuffleMode"
case ping = "Ping"
case ignoreWait = "IgnoreWait"
}

View File

@ -33,6 +33,8 @@ public struct PlaybackStartInfo: Codable, Hashable {
public var playMethod: PlayMethod? public var playMethod: PlayMethod?
/// Gets or sets the play session identifier. /// Gets or sets the play session identifier.
public var playSessionID: String? public var playSessionID: String?
/// Gets or sets the playback order.
public var playbackOrder: PlaybackOrder?
public var playbackStartTimeTicks: Int? public var playbackStartTimeTicks: Int?
public var playlistItemID: String? public var playlistItemID: String?
/// Gets or sets the position ticks. /// Gets or sets the position ticks.
@ -60,6 +62,7 @@ public struct PlaybackStartInfo: Codable, Hashable {
nowPlayingQueue: [QueueItem]? = nil, nowPlayingQueue: [QueueItem]? = nil,
playMethod: PlayMethod? = nil, playMethod: PlayMethod? = nil,
playSessionID: String? = nil, playSessionID: String? = nil,
playbackOrder: PlaybackOrder? = nil,
playbackStartTimeTicks: Int? = nil, playbackStartTimeTicks: Int? = nil,
playlistItemID: String? = nil, playlistItemID: String? = nil,
positionTicks: Int? = nil, positionTicks: Int? = nil,
@ -81,6 +84,7 @@ public struct PlaybackStartInfo: Codable, Hashable {
self.nowPlayingQueue = nowPlayingQueue self.nowPlayingQueue = nowPlayingQueue
self.playMethod = playMethod self.playMethod = playMethod
self.playSessionID = playSessionID self.playSessionID = playSessionID
self.playbackOrder = playbackOrder
self.playbackStartTimeTicks = playbackStartTimeTicks self.playbackStartTimeTicks = playbackStartTimeTicks
self.playlistItemID = playlistItemID self.playlistItemID = playlistItemID
self.positionTicks = positionTicks self.positionTicks = positionTicks
@ -105,6 +109,7 @@ public struct PlaybackStartInfo: Codable, Hashable {
self.nowPlayingQueue = try values.decodeIfPresent([QueueItem].self, forKey: "NowPlayingQueue") self.nowPlayingQueue = try values.decodeIfPresent([QueueItem].self, forKey: "NowPlayingQueue")
self.playMethod = try values.decodeIfPresent(PlayMethod.self, forKey: "PlayMethod") self.playMethod = try values.decodeIfPresent(PlayMethod.self, forKey: "PlayMethod")
self.playSessionID = try values.decodeIfPresent(String.self, forKey: "PlaySessionId") self.playSessionID = try values.decodeIfPresent(String.self, forKey: "PlaySessionId")
self.playbackOrder = try values.decodeIfPresent(PlaybackOrder.self, forKey: "PlaybackOrder")
self.playbackStartTimeTicks = try values.decodeIfPresent(Int.self, forKey: "PlaybackStartTimeTicks") self.playbackStartTimeTicks = try values.decodeIfPresent(Int.self, forKey: "PlaybackStartTimeTicks")
self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId") self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId")
self.positionTicks = try values.decodeIfPresent(Int.self, forKey: "PositionTicks") self.positionTicks = try values.decodeIfPresent(Int.self, forKey: "PositionTicks")
@ -129,6 +134,7 @@ public struct PlaybackStartInfo: Codable, Hashable {
try values.encodeIfPresent(nowPlayingQueue, forKey: "NowPlayingQueue") try values.encodeIfPresent(nowPlayingQueue, forKey: "NowPlayingQueue")
try values.encodeIfPresent(playMethod, forKey: "PlayMethod") try values.encodeIfPresent(playMethod, forKey: "PlayMethod")
try values.encodeIfPresent(playSessionID, forKey: "PlaySessionId") try values.encodeIfPresent(playSessionID, forKey: "PlaySessionId")
try values.encodeIfPresent(playbackOrder, forKey: "PlaybackOrder")
try values.encodeIfPresent(playbackStartTimeTicks, forKey: "PlaybackStartTimeTicks") try values.encodeIfPresent(playbackStartTimeTicks, forKey: "PlaybackStartTimeTicks")
try values.encodeIfPresent(playlistItemID, forKey: "PlaylistItemId") try values.encodeIfPresent(playlistItemID, forKey: "PlaylistItemId")
try values.encodeIfPresent(positionTicks, forKey: "PositionTicks") try values.encodeIfPresent(positionTicks, forKey: "PositionTicks")

View File

@ -23,6 +23,8 @@ public struct PlayerStateInfo: Codable, Hashable {
public var mediaSourceID: String? public var mediaSourceID: String?
/// Gets or sets the play method. /// Gets or sets the play method.
public var playMethod: PlayMethod? public var playMethod: PlayMethod?
/// Gets or sets the playback order.
public var playbackOrder: PlaybackOrder?
/// Gets or sets the now playing position ticks. /// Gets or sets the now playing position ticks.
public var positionTicks: Int? public var positionTicks: Int?
/// Gets or sets the repeat mode. /// Gets or sets the repeat mode.
@ -40,6 +42,7 @@ public struct PlayerStateInfo: Codable, Hashable {
liveStreamID: String? = nil, liveStreamID: String? = nil,
mediaSourceID: String? = nil, mediaSourceID: String? = nil,
playMethod: PlayMethod? = nil, playMethod: PlayMethod? = nil,
playbackOrder: PlaybackOrder? = nil,
positionTicks: Int? = nil, positionTicks: Int? = nil,
repeatMode: RepeatMode? = nil, repeatMode: RepeatMode? = nil,
subtitleStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil,
@ -52,6 +55,7 @@ public struct PlayerStateInfo: Codable, Hashable {
self.liveStreamID = liveStreamID self.liveStreamID = liveStreamID
self.mediaSourceID = mediaSourceID self.mediaSourceID = mediaSourceID
self.playMethod = playMethod self.playMethod = playMethod
self.playbackOrder = playbackOrder
self.positionTicks = positionTicks self.positionTicks = positionTicks
self.repeatMode = repeatMode self.repeatMode = repeatMode
self.subtitleStreamIndex = subtitleStreamIndex self.subtitleStreamIndex = subtitleStreamIndex
@ -67,6 +71,7 @@ public struct PlayerStateInfo: Codable, Hashable {
self.liveStreamID = try values.decodeIfPresent(String.self, forKey: "LiveStreamId") self.liveStreamID = try values.decodeIfPresent(String.self, forKey: "LiveStreamId")
self.mediaSourceID = try values.decodeIfPresent(String.self, forKey: "MediaSourceId") self.mediaSourceID = try values.decodeIfPresent(String.self, forKey: "MediaSourceId")
self.playMethod = try values.decodeIfPresent(PlayMethod.self, forKey: "PlayMethod") self.playMethod = try values.decodeIfPresent(PlayMethod.self, forKey: "PlayMethod")
self.playbackOrder = try values.decodeIfPresent(PlaybackOrder.self, forKey: "PlaybackOrder")
self.positionTicks = try values.decodeIfPresent(Int.self, forKey: "PositionTicks") self.positionTicks = try values.decodeIfPresent(Int.self, forKey: "PositionTicks")
self.repeatMode = try values.decodeIfPresent(RepeatMode.self, forKey: "RepeatMode") self.repeatMode = try values.decodeIfPresent(RepeatMode.self, forKey: "RepeatMode")
self.subtitleStreamIndex = try values.decodeIfPresent(Int.self, forKey: "SubtitleStreamIndex") self.subtitleStreamIndex = try values.decodeIfPresent(Int.self, forKey: "SubtitleStreamIndex")
@ -82,6 +87,7 @@ public struct PlayerStateInfo: Codable, Hashable {
try values.encodeIfPresent(liveStreamID, forKey: "LiveStreamId") try values.encodeIfPresent(liveStreamID, forKey: "LiveStreamId")
try values.encodeIfPresent(mediaSourceID, forKey: "MediaSourceId") try values.encodeIfPresent(mediaSourceID, forKey: "MediaSourceId")
try values.encodeIfPresent(playMethod, forKey: "PlayMethod") try values.encodeIfPresent(playMethod, forKey: "PlayMethod")
try values.encodeIfPresent(playbackOrder, forKey: "PlaybackOrder")
try values.encodeIfPresent(positionTicks, forKey: "PositionTicks") try values.encodeIfPresent(positionTicks, forKey: "PositionTicks")
try values.encodeIfPresent(repeatMode, forKey: "RepeatMode") try values.encodeIfPresent(repeatMode, forKey: "RepeatMode")
try values.encodeIfPresent(subtitleStreamIndex, forKey: "SubtitleStreamIndex") try values.encodeIfPresent(subtitleStreamIndex, forKey: "SubtitleStreamIndex")

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class to hold data on user permissions for playlists.
public struct PlaylistUserPermissions: Codable, Hashable {
/// Gets or sets a value indicating whether the user has edit permissions.
public var canEdit: Bool?
/// Gets or sets the user id.
public var userID: String?
public init(canEdit: Bool? = nil, userID: String? = nil) {
self.canEdit = canEdit
self.userID = userID
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.canEdit = try values.decodeIfPresent(Bool.self, forKey: "CanEdit")
self.userID = try values.decodeIfPresent(String.self, forKey: "UserId")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(canEdit, forKey: "CanEdit")
try values.encodeIfPresent(userID, forKey: "UserId")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Playstate message.
public struct PlaystateMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: PlaystateRequest?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: PlaystateRequest? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(PlaystateRequest.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Plugin installation cancelled message.
public struct PluginInstallationCancelledMessage: Codable, Hashable {
/// Class InstallationInfo.
public var data: InstallationInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: InstallationInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(InstallationInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Plugin installation completed message.
public struct PluginInstallationCompletedMessage: Codable, Hashable {
/// Class InstallationInfo.
public var data: InstallationInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: InstallationInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(InstallationInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Plugin installation failed message.
public struct PluginInstallationFailedMessage: Codable, Hashable {
/// Class InstallationInfo.
public var data: InstallationInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: InstallationInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(InstallationInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Package installing message.
public struct PluginInstallingMessage: Codable, Hashable {
/// Class InstallationInfo.
public var data: InstallationInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: InstallationInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(InstallationInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Plugin uninstalled message.
public struct PluginUninstalledMessage: Codable, Hashable {
/// This is a serializable stub class that is used by the api to provide information about installed plugins.
public var data: PluginInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: PluginInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(PluginInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,18 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
public enum ProcessPriorityClass: String, Codable, CaseIterable {
case normal = "Normal"
case idle = "Idle"
case high = "High"
case realTime = "RealTime"
case belowNormal = "BelowNormal"
case aboveNormal = "AboveNormal"
}

View File

@ -14,6 +14,8 @@ public struct PublicSystemInfo: Codable, Hashable, Identifiable {
/// Gets or sets the local address. /// Gets or sets the local address.
public var localAddress: String? public var localAddress: String?
/// Gets or sets the operating system. /// Gets or sets the operating system.
///
/// - warning: Deprecated.
public var operatingSystem: String? public var operatingSystem: String?
/// Gets or sets the product name. This is the AssemblyProduct name. /// Gets or sets the product name. This is the AssemblyProduct name.
public var productName: String? public var productName: String?

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Refresh progress message.
public struct RefreshProgressMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: [String: String]?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: [String: String]? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent([String: String].self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// The remote lyric info dto.
public struct RemoteLyricInfoDto: Codable, Hashable, Identifiable {
/// Gets or sets the id for the lyric.
public var id: String?
/// Gets the lyrics.
public var lyrics: LyricDto?
/// Gets the provider name.
public var providerName: String?
public init(id: String? = nil, lyrics: LyricDto? = nil, providerName: String? = nil) {
self.id = id
self.lyrics = lyrics
self.providerName = providerName
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.id = try values.decodeIfPresent(String.self, forKey: "Id")
self.lyrics = try values.decodeIfPresent(LyricDto.self, forKey: "Lyrics")
self.providerName = try values.decodeIfPresent(String.self, forKey: "ProviderName")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(id, forKey: "Id")
try values.encodeIfPresent(lyrics, forKey: "Lyrics")
try values.encodeIfPresent(providerName, forKey: "ProviderName")
}
}

View File

@ -9,39 +9,54 @@
import Foundation import Foundation
public struct RemoteSubtitleInfo: Codable, Hashable, Identifiable { public struct RemoteSubtitleInfo: Codable, Hashable, Identifiable {
public var isAiTranslated: Bool?
public var author: String? public var author: String?
public var comment: String? public var comment: String?
public var communityRating: Float? public var communityRating: Float?
public var dateCreated: Date? public var dateCreated: Date?
public var downloadCount: Int? public var downloadCount: Int?
public var isForced: Bool?
public var format: String? public var format: String?
public var frameRate: Float?
public var isHearingImpaired: Bool?
public var id: String? public var id: String?
public var isHashMatch: Bool? public var isHashMatch: Bool?
public var isMachineTranslated: Bool?
public var name: String? public var name: String?
public var providerName: String? public var providerName: String?
public var threeLetterISOLanguageName: String? public var threeLetterISOLanguageName: String?
public init( public init(
isAiTranslated: Bool? = nil,
author: String? = nil, author: String? = nil,
comment: String? = nil, comment: String? = nil,
communityRating: Float? = nil, communityRating: Float? = nil,
dateCreated: Date? = nil, dateCreated: Date? = nil,
downloadCount: Int? = nil, downloadCount: Int? = nil,
isForced: Bool? = nil,
format: String? = nil, format: String? = nil,
frameRate: Float? = nil,
isHearingImpaired: Bool? = nil,
id: String? = nil, id: String? = nil,
isHashMatch: Bool? = nil, isHashMatch: Bool? = nil,
isMachineTranslated: Bool? = nil,
name: String? = nil, name: String? = nil,
providerName: String? = nil, providerName: String? = nil,
threeLetterISOLanguageName: String? = nil threeLetterISOLanguageName: String? = nil
) { ) {
self.isAiTranslated = isAiTranslated
self.author = author self.author = author
self.comment = comment self.comment = comment
self.communityRating = communityRating self.communityRating = communityRating
self.dateCreated = dateCreated self.dateCreated = dateCreated
self.downloadCount = downloadCount self.downloadCount = downloadCount
self.isForced = isForced
self.format = format self.format = format
self.frameRate = frameRate
self.isHearingImpaired = isHearingImpaired
self.id = id self.id = id
self.isHashMatch = isHashMatch self.isHashMatch = isHashMatch
self.isMachineTranslated = isMachineTranslated
self.name = name self.name = name
self.providerName = providerName self.providerName = providerName
self.threeLetterISOLanguageName = threeLetterISOLanguageName self.threeLetterISOLanguageName = threeLetterISOLanguageName
@ -49,14 +64,19 @@ public struct RemoteSubtitleInfo: Codable, Hashable, Identifiable {
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.isAiTranslated = try values.decodeIfPresent(Bool.self, forKey: "AiTranslated")
self.author = try values.decodeIfPresent(String.self, forKey: "Author") self.author = try values.decodeIfPresent(String.self, forKey: "Author")
self.comment = try values.decodeIfPresent(String.self, forKey: "Comment") self.comment = try values.decodeIfPresent(String.self, forKey: "Comment")
self.communityRating = try values.decodeIfPresent(Float.self, forKey: "CommunityRating") self.communityRating = try values.decodeIfPresent(Float.self, forKey: "CommunityRating")
self.dateCreated = try values.decodeIfPresent(Date.self, forKey: "DateCreated") self.dateCreated = try values.decodeIfPresent(Date.self, forKey: "DateCreated")
self.downloadCount = try values.decodeIfPresent(Int.self, forKey: "DownloadCount") self.downloadCount = try values.decodeIfPresent(Int.self, forKey: "DownloadCount")
self.isForced = try values.decodeIfPresent(Bool.self, forKey: "Forced")
self.format = try values.decodeIfPresent(String.self, forKey: "Format") self.format = try values.decodeIfPresent(String.self, forKey: "Format")
self.frameRate = try values.decodeIfPresent(Float.self, forKey: "FrameRate")
self.isHearingImpaired = try values.decodeIfPresent(Bool.self, forKey: "HearingImpaired")
self.id = try values.decodeIfPresent(String.self, forKey: "Id") self.id = try values.decodeIfPresent(String.self, forKey: "Id")
self.isHashMatch = try values.decodeIfPresent(Bool.self, forKey: "IsHashMatch") self.isHashMatch = try values.decodeIfPresent(Bool.self, forKey: "IsHashMatch")
self.isMachineTranslated = try values.decodeIfPresent(Bool.self, forKey: "MachineTranslated")
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decodeIfPresent(String.self, forKey: "Name")
self.providerName = try values.decodeIfPresent(String.self, forKey: "ProviderName") self.providerName = try values.decodeIfPresent(String.self, forKey: "ProviderName")
self.threeLetterISOLanguageName = try values.decodeIfPresent(String.self, forKey: "ThreeLetterISOLanguageName") self.threeLetterISOLanguageName = try values.decodeIfPresent(String.self, forKey: "ThreeLetterISOLanguageName")
@ -64,14 +84,19 @@ public struct RemoteSubtitleInfo: Codable, Hashable, Identifiable {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self) var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(isAiTranslated, forKey: "AiTranslated")
try values.encodeIfPresent(author, forKey: "Author") try values.encodeIfPresent(author, forKey: "Author")
try values.encodeIfPresent(comment, forKey: "Comment") try values.encodeIfPresent(comment, forKey: "Comment")
try values.encodeIfPresent(communityRating, forKey: "CommunityRating") try values.encodeIfPresent(communityRating, forKey: "CommunityRating")
try values.encodeIfPresent(dateCreated, forKey: "DateCreated") try values.encodeIfPresent(dateCreated, forKey: "DateCreated")
try values.encodeIfPresent(downloadCount, forKey: "DownloadCount") try values.encodeIfPresent(downloadCount, forKey: "DownloadCount")
try values.encodeIfPresent(isForced, forKey: "Forced")
try values.encodeIfPresent(format, forKey: "Format") try values.encodeIfPresent(format, forKey: "Format")
try values.encodeIfPresent(frameRate, forKey: "FrameRate")
try values.encodeIfPresent(isHearingImpaired, forKey: "HearingImpaired")
try values.encodeIfPresent(id, forKey: "Id") try values.encodeIfPresent(id, forKey: "Id")
try values.encodeIfPresent(isHashMatch, forKey: "IsHashMatch") try values.encodeIfPresent(isHashMatch, forKey: "IsHashMatch")
try values.encodeIfPresent(isMachineTranslated, forKey: "MachineTranslated")
try values.encodeIfPresent(name, forKey: "Name") try values.encodeIfPresent(name, forKey: "Name")
try values.encodeIfPresent(providerName, forKey: "ProviderName") try values.encodeIfPresent(providerName, forKey: "ProviderName")
try values.encodeIfPresent(threeLetterISOLanguageName, forKey: "ThreeLetterISOLanguageName") try values.encodeIfPresent(threeLetterISOLanguageName, forKey: "ThreeLetterISOLanguageName")

View File

@ -14,7 +14,7 @@ public struct RemoveFromPlaylistRequestDto: Codable, Hashable {
public var isClearPlayingItem: Bool? public var isClearPlayingItem: Bool?
/// Gets or sets a value indicating whether the entire playlist should be cleared. /// Gets or sets a value indicating whether the entire playlist should be cleared.
public var isClearPlaylist: Bool? public var isClearPlaylist: Bool?
/// Gets or sets the playlist identifiers ot the items. Ignored when clearing the playlist. /// Gets or sets the playlist identifiers of the items. Ignored when clearing the playlist.
public var playlistItemIDs: [String]? public var playlistItemIDs: [String]?
public init(isClearPlayingItem: Bool? = nil, isClearPlaylist: Bool? = nil, playlistItemIDs: [String]? = nil) { public init(isClearPlayingItem: Bool? = nil, isClearPlaylist: Bool? = nil, playlistItemIDs: [String]? = nil) {

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Restart required.
public struct RestartRequiredMessage: Codable, Hashable {
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Scheduled task ended message.
public struct ScheduledTaskEndedMessage: Codable, Hashable {
/// Class TaskExecutionInfo.
public var data: TaskResult?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: TaskResult? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(TaskResult.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Scheduled tasks info message.
public struct ScheduledTasksInfoMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: [TaskInfo]?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: [TaskInfo]? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent([TaskInfo].self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,36 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Scheduled tasks info start message.
///
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
public struct ScheduledTasksInfoStartMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(String.self, forKey: "Data")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,29 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Scheduled tasks info stop message.
public struct ScheduledTasksInfoStopMessage: Codable, Hashable {
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageType: SessionMessageType? = nil) {
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -14,6 +14,7 @@ public struct SearchHint: Codable, Hashable, Identifiable {
public var album: String? public var album: String?
/// Gets or sets the album artist. /// Gets or sets the album artist.
public var albumArtist: String? public var albumArtist: String?
/// Gets or sets the album id.
public var albumID: String? public var albumID: String?
/// Gets or sets the artists. /// Gets or sets the artists.
public var artists: [String]? public var artists: [String]?
@ -25,19 +26,24 @@ public struct SearchHint: Codable, Hashable, Identifiable {
public var channelID: String? public var channelID: String?
/// Gets or sets the name of the channel. /// Gets or sets the name of the channel.
public var channelName: String? public var channelName: String?
/// Gets or sets the end date.
public var endDate: Date? public var endDate: Date?
/// Gets or sets the episode count. /// Gets or sets the episode count.
public var episodeCount: Int? public var episodeCount: Int?
/// Gets or sets the item id.
public var id: String? public var id: String?
/// Gets or sets the index number. /// Gets or sets the index number.
public var indexNumber: Int? public var indexNumber: Int?
/// Gets or sets a value indicating whether this instance is folder.
public var isFolder: Bool? public var isFolder: Bool?
/// Gets or sets the item id. /// Gets or sets the item id.
///
/// - warning: Deprecated.
public var itemID: String? public var itemID: String?
/// Gets or sets the matched term. /// Gets or sets the matched term.
public var matchedTerm: String? public var matchedTerm: String?
/// Gets or sets the type of the media. /// Gets or sets the type of the media.
public var mediaType: String? public var mediaType: MediaType?
/// Gets or sets the name. /// Gets or sets the name.
public var name: String? public var name: String?
/// Gets or sets the parent index number. /// Gets or sets the parent index number.
@ -54,14 +60,16 @@ public struct SearchHint: Codable, Hashable, Identifiable {
public var series: String? public var series: String?
/// Gets or sets the song count. /// Gets or sets the song count.
public var songCount: Int? public var songCount: Int?
/// Gets or sets the start date.
public var startDate: Date? public var startDate: Date?
/// Gets or sets the status.
public var status: String? public var status: String?
/// Gets or sets the thumb image item identifier. /// Gets or sets the thumb image item identifier.
public var thumbImageItemID: String? public var thumbImageItemID: String?
/// Gets or sets the thumb image tag. /// Gets or sets the thumb image tag.
public var thumbImageTag: String? public var thumbImageTag: String?
/// Gets or sets the type. /// Gets or sets the type.
public var type: String? public var type: BaseItemKind?
public init( public init(
album: String? = nil, album: String? = nil,
@ -79,7 +87,7 @@ public struct SearchHint: Codable, Hashable, Identifiable {
isFolder: Bool? = nil, isFolder: Bool? = nil,
itemID: String? = nil, itemID: String? = nil,
matchedTerm: String? = nil, matchedTerm: String? = nil,
mediaType: String? = nil, mediaType: MediaType? = nil,
name: String? = nil, name: String? = nil,
parentIndexNumber: Int? = nil, parentIndexNumber: Int? = nil,
primaryImageAspectRatio: Double? = nil, primaryImageAspectRatio: Double? = nil,
@ -92,7 +100,7 @@ public struct SearchHint: Codable, Hashable, Identifiable {
status: String? = nil, status: String? = nil,
thumbImageItemID: String? = nil, thumbImageItemID: String? = nil,
thumbImageTag: String? = nil, thumbImageTag: String? = nil,
type: String? = nil type: BaseItemKind? = nil
) { ) {
self.album = album self.album = album
self.albumArtist = albumArtist self.albumArtist = albumArtist
@ -142,7 +150,7 @@ public struct SearchHint: Codable, Hashable, Identifiable {
self.isFolder = try values.decodeIfPresent(Bool.self, forKey: "IsFolder") self.isFolder = try values.decodeIfPresent(Bool.self, forKey: "IsFolder")
self.itemID = try values.decodeIfPresent(String.self, forKey: "ItemId") self.itemID = try values.decodeIfPresent(String.self, forKey: "ItemId")
self.matchedTerm = try values.decodeIfPresent(String.self, forKey: "MatchedTerm") self.matchedTerm = try values.decodeIfPresent(String.self, forKey: "MatchedTerm")
self.mediaType = try values.decodeIfPresent(String.self, forKey: "MediaType") self.mediaType = try values.decodeIfPresent(MediaType.self, forKey: "MediaType")
self.name = try values.decodeIfPresent(String.self, forKey: "Name") self.name = try values.decodeIfPresent(String.self, forKey: "Name")
self.parentIndexNumber = try values.decodeIfPresent(Int.self, forKey: "ParentIndexNumber") self.parentIndexNumber = try values.decodeIfPresent(Int.self, forKey: "ParentIndexNumber")
self.primaryImageAspectRatio = try values.decodeIfPresent(Double.self, forKey: "PrimaryImageAspectRatio") self.primaryImageAspectRatio = try values.decodeIfPresent(Double.self, forKey: "PrimaryImageAspectRatio")
@ -155,7 +163,7 @@ public struct SearchHint: Codable, Hashable, Identifiable {
self.status = try values.decodeIfPresent(String.self, forKey: "Status") self.status = try values.decodeIfPresent(String.self, forKey: "Status")
self.thumbImageItemID = try values.decodeIfPresent(String.self, forKey: "ThumbImageItemId") self.thumbImageItemID = try values.decodeIfPresent(String.self, forKey: "ThumbImageItemId")
self.thumbImageTag = try values.decodeIfPresent(String.self, forKey: "ThumbImageTag") self.thumbImageTag = try values.decodeIfPresent(String.self, forKey: "ThumbImageTag")
self.type = try values.decodeIfPresent(String.self, forKey: "Type") self.type = try values.decodeIfPresent(BaseItemKind.self, forKey: "Type")
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {

View File

@ -8,8 +8,9 @@
import Foundation import Foundation
/// Enum SeriesStatus. /// The status of a series.
public enum SeriesStatus: String, Codable, CaseIterable { public enum SeriesStatus: String, Codable, CaseIterable {
case continuing = "Continuing" case continuing = "Continuing"
case ended = "Ended" case ended = "Ended"
case unreleased = "Unreleased"
} }

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Series timer cancelled message.
public struct SeriesTimerCancelledMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: TimerEventInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: TimerEventInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(TimerEventInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Series timer created message.
public struct SeriesTimerCreatedMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: TimerEventInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: TimerEventInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(TimerEventInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -16,12 +16,18 @@ public struct ServerConfiguration: Codable, Hashable {
public var allowClientLogUpload: Bool? public var allowClientLogUpload: Bool?
/// Gets or sets the cache path. /// Gets or sets the cache path.
public var cachePath: String? public var cachePath: String?
/// Gets or sets the list of cast receiver applications.
public var castReceiverApplications: [CastReceiverApplication]?
/// Gets or sets the chapter image resolution.
public var chapterImageResolution: ImageResolution?
public var codecsUsed: [String]? public var codecsUsed: [String]?
public var contentTypes: [NameValuePair]? public var contentTypes: [NameValuePair]?
/// Gets or sets the cors hosts. /// Gets or sets the cors hosts.
public var corsHosts: [String]? public var corsHosts: [String]?
public var isDisableLiveTvChannelUserDataName: Bool? public var isDisableLiveTvChannelUserDataName: Bool?
public var isDisplaySpecialsWithinSeasons: Bool? public var isDisplaySpecialsWithinSeasons: Bool?
/// Gets or sets the dummy chapter duration in seconds, use 0 (zero) or less to disable generation alltogether.
public var dummyChapterDuration: Int?
/// Gets or sets a value indicating whether [enable case sensitive item ids]. /// Gets or sets a value indicating whether [enable case sensitive item ids].
public var enableCaseSensitiveItemIDs: Bool? public var enableCaseSensitiveItemIDs: Bool?
public var enableExternalContentInSuggestions: Bool? public var enableExternalContentInSuggestions: Bool?
@ -35,6 +41,10 @@ public struct ServerConfiguration: Codable, Hashable {
public var imageExtractionTimeoutMs: Int? public var imageExtractionTimeoutMs: Int?
/// Gets or sets the image saving convention. /// Gets or sets the image saving convention.
public var imageSavingConvention: ImageSavingConvention? public var imageSavingConvention: ImageSavingConvention?
/// Gets or sets the threshold in minutes after a inactive session gets closed automatically.
///
/// If set to 0 the check for inactive sessions gets disabled.
public var inactiveSessionThreshold: Int?
/// Gets or sets a value indicating whether this instance is port authorized. /// Gets or sets a value indicating whether this instance is port authorized.
public var isPortAuthorized: Bool? public var isPortAuthorized: Bool?
/// Gets or sets a value indicating whether this instance is first run. /// Gets or sets a value indicating whether this instance is first run.
@ -49,6 +59,9 @@ public struct ServerConfiguration: Codable, Hashable {
public var libraryMonitorDelay: Int? public var libraryMonitorDelay: Int?
/// Gets or sets the how the library scan fans out. /// Gets or sets the how the library scan fans out.
public var libraryScanFanoutConcurrency: Int? public var libraryScanFanoutConcurrency: Int?
/// Gets or sets the duration in seconds that we will wait after a library updated event before executing the library changed
/// notification.
public var libraryUpdateDuration: Int?
/// Gets or sets the number of days we should retain log files. /// Gets or sets the number of days we should retain log files.
public var logFileRetentionDays: Int? public var logFileRetentionDays: Int?
/// Gets or sets the remaining minutes of a book that can be played while still saving playstate. If this percentage is crossed /// Gets or sets the remaining minutes of a book that can be played while still saving playstate. If this percentage is crossed
@ -69,6 +82,8 @@ public struct ServerConfiguration: Codable, Hashable {
public var minResumeDurationSeconds: Int? public var minResumeDurationSeconds: Int?
/// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
public var minResumePct: Int? public var minResumePct: Int?
/// Gets or sets the limit for parallel image encoding.
public var parallelImageEncodingLimit: Int?
public var pathSubstitutions: [PathSubstitution]? public var pathSubstitutions: [PathSubstitution]?
public var pluginRepositories: [RepositoryInfo]? public var pluginRepositories: [RepositoryInfo]?
/// Gets or sets the preferred metadata language. /// Gets or sets the preferred metadata language.
@ -95,17 +110,22 @@ public struct ServerConfiguration: Codable, Hashable {
public var sortRemoveWords: [String]? public var sortRemoveWords: [String]?
/// Gets or sets characters to be replaced with a ' ' in strings to create a sort name. /// Gets or sets characters to be replaced with a ' ' in strings to create a sort name.
public var sortReplaceCharacters: [String]? public var sortReplaceCharacters: [String]?
/// Gets or sets the trickplay options.
public var trickplayOptions: TrickplayOptions?
public var uICulture: String? public var uICulture: String?
public init( public init(
activityLogRetentionDays: Int? = nil, activityLogRetentionDays: Int? = nil,
allowClientLogUpload: Bool? = nil, allowClientLogUpload: Bool? = nil,
cachePath: String? = nil, cachePath: String? = nil,
castReceiverApplications: [CastReceiverApplication]? = nil,
chapterImageResolution: ImageResolution? = nil,
codecsUsed: [String]? = nil, codecsUsed: [String]? = nil,
contentTypes: [NameValuePair]? = nil, contentTypes: [NameValuePair]? = nil,
corsHosts: [String]? = nil, corsHosts: [String]? = nil,
isDisableLiveTvChannelUserDataName: Bool? = nil, isDisableLiveTvChannelUserDataName: Bool? = nil,
isDisplaySpecialsWithinSeasons: Bool? = nil, isDisplaySpecialsWithinSeasons: Bool? = nil,
dummyChapterDuration: Int? = nil,
enableCaseSensitiveItemIDs: Bool? = nil, enableCaseSensitiveItemIDs: Bool? = nil,
enableExternalContentInSuggestions: Bool? = nil, enableExternalContentInSuggestions: Bool? = nil,
enableFolderView: Bool? = nil, enableFolderView: Bool? = nil,
@ -115,11 +135,13 @@ public struct ServerConfiguration: Codable, Hashable {
enableSlowResponseWarning: Bool? = nil, enableSlowResponseWarning: Bool? = nil,
imageExtractionTimeoutMs: Int? = nil, imageExtractionTimeoutMs: Int? = nil,
imageSavingConvention: ImageSavingConvention? = nil, imageSavingConvention: ImageSavingConvention? = nil,
inactiveSessionThreshold: Int? = nil,
isPortAuthorized: Bool? = nil, isPortAuthorized: Bool? = nil,
isStartupWizardCompleted: Bool? = nil, isStartupWizardCompleted: Bool? = nil,
libraryMetadataRefreshConcurrency: Int? = nil, libraryMetadataRefreshConcurrency: Int? = nil,
libraryMonitorDelay: Int? = nil, libraryMonitorDelay: Int? = nil,
libraryScanFanoutConcurrency: Int? = nil, libraryScanFanoutConcurrency: Int? = nil,
libraryUpdateDuration: Int? = nil,
logFileRetentionDays: Int? = nil, logFileRetentionDays: Int? = nil,
maxAudiobookResume: Int? = nil, maxAudiobookResume: Int? = nil,
maxResumePct: Int? = nil, maxResumePct: Int? = nil,
@ -130,6 +152,7 @@ public struct ServerConfiguration: Codable, Hashable {
minAudiobookResume: Int? = nil, minAudiobookResume: Int? = nil,
minResumeDurationSeconds: Int? = nil, minResumeDurationSeconds: Int? = nil,
minResumePct: Int? = nil, minResumePct: Int? = nil,
parallelImageEncodingLimit: Int? = nil,
pathSubstitutions: [PathSubstitution]? = nil, pathSubstitutions: [PathSubstitution]? = nil,
pluginRepositories: [RepositoryInfo]? = nil, pluginRepositories: [RepositoryInfo]? = nil,
preferredMetadataLanguage: String? = nil, preferredMetadataLanguage: String? = nil,
@ -145,16 +168,20 @@ public struct ServerConfiguration: Codable, Hashable {
sortRemoveCharacters: [String]? = nil, sortRemoveCharacters: [String]? = nil,
sortRemoveWords: [String]? = nil, sortRemoveWords: [String]? = nil,
sortReplaceCharacters: [String]? = nil, sortReplaceCharacters: [String]? = nil,
trickplayOptions: TrickplayOptions? = nil,
uICulture: String? = nil uICulture: String? = nil
) { ) {
self.activityLogRetentionDays = activityLogRetentionDays self.activityLogRetentionDays = activityLogRetentionDays
self.allowClientLogUpload = allowClientLogUpload self.allowClientLogUpload = allowClientLogUpload
self.cachePath = cachePath self.cachePath = cachePath
self.castReceiverApplications = castReceiverApplications
self.chapterImageResolution = chapterImageResolution
self.codecsUsed = codecsUsed self.codecsUsed = codecsUsed
self.contentTypes = contentTypes self.contentTypes = contentTypes
self.corsHosts = corsHosts self.corsHosts = corsHosts
self.isDisableLiveTvChannelUserDataName = isDisableLiveTvChannelUserDataName self.isDisableLiveTvChannelUserDataName = isDisableLiveTvChannelUserDataName
self.isDisplaySpecialsWithinSeasons = isDisplaySpecialsWithinSeasons self.isDisplaySpecialsWithinSeasons = isDisplaySpecialsWithinSeasons
self.dummyChapterDuration = dummyChapterDuration
self.enableCaseSensitiveItemIDs = enableCaseSensitiveItemIDs self.enableCaseSensitiveItemIDs = enableCaseSensitiveItemIDs
self.enableExternalContentInSuggestions = enableExternalContentInSuggestions self.enableExternalContentInSuggestions = enableExternalContentInSuggestions
self.enableFolderView = enableFolderView self.enableFolderView = enableFolderView
@ -164,11 +191,13 @@ public struct ServerConfiguration: Codable, Hashable {
self.enableSlowResponseWarning = enableSlowResponseWarning self.enableSlowResponseWarning = enableSlowResponseWarning
self.imageExtractionTimeoutMs = imageExtractionTimeoutMs self.imageExtractionTimeoutMs = imageExtractionTimeoutMs
self.imageSavingConvention = imageSavingConvention self.imageSavingConvention = imageSavingConvention
self.inactiveSessionThreshold = inactiveSessionThreshold
self.isPortAuthorized = isPortAuthorized self.isPortAuthorized = isPortAuthorized
self.isStartupWizardCompleted = isStartupWizardCompleted self.isStartupWizardCompleted = isStartupWizardCompleted
self.libraryMetadataRefreshConcurrency = libraryMetadataRefreshConcurrency self.libraryMetadataRefreshConcurrency = libraryMetadataRefreshConcurrency
self.libraryMonitorDelay = libraryMonitorDelay self.libraryMonitorDelay = libraryMonitorDelay
self.libraryScanFanoutConcurrency = libraryScanFanoutConcurrency self.libraryScanFanoutConcurrency = libraryScanFanoutConcurrency
self.libraryUpdateDuration = libraryUpdateDuration
self.logFileRetentionDays = logFileRetentionDays self.logFileRetentionDays = logFileRetentionDays
self.maxAudiobookResume = maxAudiobookResume self.maxAudiobookResume = maxAudiobookResume
self.maxResumePct = maxResumePct self.maxResumePct = maxResumePct
@ -179,6 +208,7 @@ public struct ServerConfiguration: Codable, Hashable {
self.minAudiobookResume = minAudiobookResume self.minAudiobookResume = minAudiobookResume
self.minResumeDurationSeconds = minResumeDurationSeconds self.minResumeDurationSeconds = minResumeDurationSeconds
self.minResumePct = minResumePct self.minResumePct = minResumePct
self.parallelImageEncodingLimit = parallelImageEncodingLimit
self.pathSubstitutions = pathSubstitutions self.pathSubstitutions = pathSubstitutions
self.pluginRepositories = pluginRepositories self.pluginRepositories = pluginRepositories
self.preferredMetadataLanguage = preferredMetadataLanguage self.preferredMetadataLanguage = preferredMetadataLanguage
@ -194,6 +224,7 @@ public struct ServerConfiguration: Codable, Hashable {
self.sortRemoveCharacters = sortRemoveCharacters self.sortRemoveCharacters = sortRemoveCharacters
self.sortRemoveWords = sortRemoveWords self.sortRemoveWords = sortRemoveWords
self.sortReplaceCharacters = sortReplaceCharacters self.sortReplaceCharacters = sortReplaceCharacters
self.trickplayOptions = trickplayOptions
self.uICulture = uICulture self.uICulture = uICulture
} }
@ -202,11 +233,14 @@ public struct ServerConfiguration: Codable, Hashable {
self.activityLogRetentionDays = try values.decodeIfPresent(Int.self, forKey: "ActivityLogRetentionDays") self.activityLogRetentionDays = try values.decodeIfPresent(Int.self, forKey: "ActivityLogRetentionDays")
self.allowClientLogUpload = try values.decodeIfPresent(Bool.self, forKey: "AllowClientLogUpload") self.allowClientLogUpload = try values.decodeIfPresent(Bool.self, forKey: "AllowClientLogUpload")
self.cachePath = try values.decodeIfPresent(String.self, forKey: "CachePath") self.cachePath = try values.decodeIfPresent(String.self, forKey: "CachePath")
self.castReceiverApplications = try values.decodeIfPresent([CastReceiverApplication].self, forKey: "CastReceiverApplications")
self.chapterImageResolution = try values.decodeIfPresent(ImageResolution.self, forKey: "ChapterImageResolution")
self.codecsUsed = try values.decodeIfPresent([String].self, forKey: "CodecsUsed") self.codecsUsed = try values.decodeIfPresent([String].self, forKey: "CodecsUsed")
self.contentTypes = try values.decodeIfPresent([NameValuePair].self, forKey: "ContentTypes") self.contentTypes = try values.decodeIfPresent([NameValuePair].self, forKey: "ContentTypes")
self.corsHosts = try values.decodeIfPresent([String].self, forKey: "CorsHosts") self.corsHosts = try values.decodeIfPresent([String].self, forKey: "CorsHosts")
self.isDisableLiveTvChannelUserDataName = try values.decodeIfPresent(Bool.self, forKey: "DisableLiveTvChannelUserDataName") self.isDisableLiveTvChannelUserDataName = try values.decodeIfPresent(Bool.self, forKey: "DisableLiveTvChannelUserDataName")
self.isDisplaySpecialsWithinSeasons = try values.decodeIfPresent(Bool.self, forKey: "DisplaySpecialsWithinSeasons") self.isDisplaySpecialsWithinSeasons = try values.decodeIfPresent(Bool.self, forKey: "DisplaySpecialsWithinSeasons")
self.dummyChapterDuration = try values.decodeIfPresent(Int.self, forKey: "DummyChapterDuration")
self.enableCaseSensitiveItemIDs = try values.decodeIfPresent(Bool.self, forKey: "EnableCaseSensitiveItemIds") self.enableCaseSensitiveItemIDs = try values.decodeIfPresent(Bool.self, forKey: "EnableCaseSensitiveItemIds")
self.enableExternalContentInSuggestions = try values.decodeIfPresent(Bool.self, forKey: "EnableExternalContentInSuggestions") self.enableExternalContentInSuggestions = try values.decodeIfPresent(Bool.self, forKey: "EnableExternalContentInSuggestions")
self.enableFolderView = try values.decodeIfPresent(Bool.self, forKey: "EnableFolderView") self.enableFolderView = try values.decodeIfPresent(Bool.self, forKey: "EnableFolderView")
@ -216,11 +250,13 @@ public struct ServerConfiguration: Codable, Hashable {
self.enableSlowResponseWarning = try values.decodeIfPresent(Bool.self, forKey: "EnableSlowResponseWarning") self.enableSlowResponseWarning = try values.decodeIfPresent(Bool.self, forKey: "EnableSlowResponseWarning")
self.imageExtractionTimeoutMs = try values.decodeIfPresent(Int.self, forKey: "ImageExtractionTimeoutMs") self.imageExtractionTimeoutMs = try values.decodeIfPresent(Int.self, forKey: "ImageExtractionTimeoutMs")
self.imageSavingConvention = try values.decodeIfPresent(ImageSavingConvention.self, forKey: "ImageSavingConvention") self.imageSavingConvention = try values.decodeIfPresent(ImageSavingConvention.self, forKey: "ImageSavingConvention")
self.inactiveSessionThreshold = try values.decodeIfPresent(Int.self, forKey: "InactiveSessionThreshold")
self.isPortAuthorized = try values.decodeIfPresent(Bool.self, forKey: "IsPortAuthorized") self.isPortAuthorized = try values.decodeIfPresent(Bool.self, forKey: "IsPortAuthorized")
self.isStartupWizardCompleted = try values.decodeIfPresent(Bool.self, forKey: "IsStartupWizardCompleted") self.isStartupWizardCompleted = try values.decodeIfPresent(Bool.self, forKey: "IsStartupWizardCompleted")
self.libraryMetadataRefreshConcurrency = try values.decodeIfPresent(Int.self, forKey: "LibraryMetadataRefreshConcurrency") self.libraryMetadataRefreshConcurrency = try values.decodeIfPresent(Int.self, forKey: "LibraryMetadataRefreshConcurrency")
self.libraryMonitorDelay = try values.decodeIfPresent(Int.self, forKey: "LibraryMonitorDelay") self.libraryMonitorDelay = try values.decodeIfPresent(Int.self, forKey: "LibraryMonitorDelay")
self.libraryScanFanoutConcurrency = try values.decodeIfPresent(Int.self, forKey: "LibraryScanFanoutConcurrency") self.libraryScanFanoutConcurrency = try values.decodeIfPresent(Int.self, forKey: "LibraryScanFanoutConcurrency")
self.libraryUpdateDuration = try values.decodeIfPresent(Int.self, forKey: "LibraryUpdateDuration")
self.logFileRetentionDays = try values.decodeIfPresent(Int.self, forKey: "LogFileRetentionDays") self.logFileRetentionDays = try values.decodeIfPresent(Int.self, forKey: "LogFileRetentionDays")
self.maxAudiobookResume = try values.decodeIfPresent(Int.self, forKey: "MaxAudiobookResume") self.maxAudiobookResume = try values.decodeIfPresent(Int.self, forKey: "MaxAudiobookResume")
self.maxResumePct = try values.decodeIfPresent(Int.self, forKey: "MaxResumePct") self.maxResumePct = try values.decodeIfPresent(Int.self, forKey: "MaxResumePct")
@ -231,6 +267,7 @@ public struct ServerConfiguration: Codable, Hashable {
self.minAudiobookResume = try values.decodeIfPresent(Int.self, forKey: "MinAudiobookResume") self.minAudiobookResume = try values.decodeIfPresent(Int.self, forKey: "MinAudiobookResume")
self.minResumeDurationSeconds = try values.decodeIfPresent(Int.self, forKey: "MinResumeDurationSeconds") self.minResumeDurationSeconds = try values.decodeIfPresent(Int.self, forKey: "MinResumeDurationSeconds")
self.minResumePct = try values.decodeIfPresent(Int.self, forKey: "MinResumePct") self.minResumePct = try values.decodeIfPresent(Int.self, forKey: "MinResumePct")
self.parallelImageEncodingLimit = try values.decodeIfPresent(Int.self, forKey: "ParallelImageEncodingLimit")
self.pathSubstitutions = try values.decodeIfPresent([PathSubstitution].self, forKey: "PathSubstitutions") self.pathSubstitutions = try values.decodeIfPresent([PathSubstitution].self, forKey: "PathSubstitutions")
self.pluginRepositories = try values.decodeIfPresent([RepositoryInfo].self, forKey: "PluginRepositories") self.pluginRepositories = try values.decodeIfPresent([RepositoryInfo].self, forKey: "PluginRepositories")
self.preferredMetadataLanguage = try values.decodeIfPresent(String.self, forKey: "PreferredMetadataLanguage") self.preferredMetadataLanguage = try values.decodeIfPresent(String.self, forKey: "PreferredMetadataLanguage")
@ -246,6 +283,7 @@ public struct ServerConfiguration: Codable, Hashable {
self.sortRemoveCharacters = try values.decodeIfPresent([String].self, forKey: "SortRemoveCharacters") self.sortRemoveCharacters = try values.decodeIfPresent([String].self, forKey: "SortRemoveCharacters")
self.sortRemoveWords = try values.decodeIfPresent([String].self, forKey: "SortRemoveWords") self.sortRemoveWords = try values.decodeIfPresent([String].self, forKey: "SortRemoveWords")
self.sortReplaceCharacters = try values.decodeIfPresent([String].self, forKey: "SortReplaceCharacters") self.sortReplaceCharacters = try values.decodeIfPresent([String].self, forKey: "SortReplaceCharacters")
self.trickplayOptions = try values.decodeIfPresent(TrickplayOptions.self, forKey: "TrickplayOptions")
self.uICulture = try values.decodeIfPresent(String.self, forKey: "UICulture") self.uICulture = try values.decodeIfPresent(String.self, forKey: "UICulture")
} }
@ -254,11 +292,14 @@ public struct ServerConfiguration: Codable, Hashable {
try values.encodeIfPresent(activityLogRetentionDays, forKey: "ActivityLogRetentionDays") try values.encodeIfPresent(activityLogRetentionDays, forKey: "ActivityLogRetentionDays")
try values.encodeIfPresent(allowClientLogUpload, forKey: "AllowClientLogUpload") try values.encodeIfPresent(allowClientLogUpload, forKey: "AllowClientLogUpload")
try values.encodeIfPresent(cachePath, forKey: "CachePath") try values.encodeIfPresent(cachePath, forKey: "CachePath")
try values.encodeIfPresent(castReceiverApplications, forKey: "CastReceiverApplications")
try values.encodeIfPresent(chapterImageResolution, forKey: "ChapterImageResolution")
try values.encodeIfPresent(codecsUsed, forKey: "CodecsUsed") try values.encodeIfPresent(codecsUsed, forKey: "CodecsUsed")
try values.encodeIfPresent(contentTypes, forKey: "ContentTypes") try values.encodeIfPresent(contentTypes, forKey: "ContentTypes")
try values.encodeIfPresent(corsHosts, forKey: "CorsHosts") try values.encodeIfPresent(corsHosts, forKey: "CorsHosts")
try values.encodeIfPresent(isDisableLiveTvChannelUserDataName, forKey: "DisableLiveTvChannelUserDataName") try values.encodeIfPresent(isDisableLiveTvChannelUserDataName, forKey: "DisableLiveTvChannelUserDataName")
try values.encodeIfPresent(isDisplaySpecialsWithinSeasons, forKey: "DisplaySpecialsWithinSeasons") try values.encodeIfPresent(isDisplaySpecialsWithinSeasons, forKey: "DisplaySpecialsWithinSeasons")
try values.encodeIfPresent(dummyChapterDuration, forKey: "DummyChapterDuration")
try values.encodeIfPresent(enableCaseSensitiveItemIDs, forKey: "EnableCaseSensitiveItemIds") try values.encodeIfPresent(enableCaseSensitiveItemIDs, forKey: "EnableCaseSensitiveItemIds")
try values.encodeIfPresent(enableExternalContentInSuggestions, forKey: "EnableExternalContentInSuggestions") try values.encodeIfPresent(enableExternalContentInSuggestions, forKey: "EnableExternalContentInSuggestions")
try values.encodeIfPresent(enableFolderView, forKey: "EnableFolderView") try values.encodeIfPresent(enableFolderView, forKey: "EnableFolderView")
@ -268,11 +309,13 @@ public struct ServerConfiguration: Codable, Hashable {
try values.encodeIfPresent(enableSlowResponseWarning, forKey: "EnableSlowResponseWarning") try values.encodeIfPresent(enableSlowResponseWarning, forKey: "EnableSlowResponseWarning")
try values.encodeIfPresent(imageExtractionTimeoutMs, forKey: "ImageExtractionTimeoutMs") try values.encodeIfPresent(imageExtractionTimeoutMs, forKey: "ImageExtractionTimeoutMs")
try values.encodeIfPresent(imageSavingConvention, forKey: "ImageSavingConvention") try values.encodeIfPresent(imageSavingConvention, forKey: "ImageSavingConvention")
try values.encodeIfPresent(inactiveSessionThreshold, forKey: "InactiveSessionThreshold")
try values.encodeIfPresent(isPortAuthorized, forKey: "IsPortAuthorized") try values.encodeIfPresent(isPortAuthorized, forKey: "IsPortAuthorized")
try values.encodeIfPresent(isStartupWizardCompleted, forKey: "IsStartupWizardCompleted") try values.encodeIfPresent(isStartupWizardCompleted, forKey: "IsStartupWizardCompleted")
try values.encodeIfPresent(libraryMetadataRefreshConcurrency, forKey: "LibraryMetadataRefreshConcurrency") try values.encodeIfPresent(libraryMetadataRefreshConcurrency, forKey: "LibraryMetadataRefreshConcurrency")
try values.encodeIfPresent(libraryMonitorDelay, forKey: "LibraryMonitorDelay") try values.encodeIfPresent(libraryMonitorDelay, forKey: "LibraryMonitorDelay")
try values.encodeIfPresent(libraryScanFanoutConcurrency, forKey: "LibraryScanFanoutConcurrency") try values.encodeIfPresent(libraryScanFanoutConcurrency, forKey: "LibraryScanFanoutConcurrency")
try values.encodeIfPresent(libraryUpdateDuration, forKey: "LibraryUpdateDuration")
try values.encodeIfPresent(logFileRetentionDays, forKey: "LogFileRetentionDays") try values.encodeIfPresent(logFileRetentionDays, forKey: "LogFileRetentionDays")
try values.encodeIfPresent(maxAudiobookResume, forKey: "MaxAudiobookResume") try values.encodeIfPresent(maxAudiobookResume, forKey: "MaxAudiobookResume")
try values.encodeIfPresent(maxResumePct, forKey: "MaxResumePct") try values.encodeIfPresent(maxResumePct, forKey: "MaxResumePct")
@ -283,6 +326,7 @@ public struct ServerConfiguration: Codable, Hashable {
try values.encodeIfPresent(minAudiobookResume, forKey: "MinAudiobookResume") try values.encodeIfPresent(minAudiobookResume, forKey: "MinAudiobookResume")
try values.encodeIfPresent(minResumeDurationSeconds, forKey: "MinResumeDurationSeconds") try values.encodeIfPresent(minResumeDurationSeconds, forKey: "MinResumeDurationSeconds")
try values.encodeIfPresent(minResumePct, forKey: "MinResumePct") try values.encodeIfPresent(minResumePct, forKey: "MinResumePct")
try values.encodeIfPresent(parallelImageEncodingLimit, forKey: "ParallelImageEncodingLimit")
try values.encodeIfPresent(pathSubstitutions, forKey: "PathSubstitutions") try values.encodeIfPresent(pathSubstitutions, forKey: "PathSubstitutions")
try values.encodeIfPresent(pluginRepositories, forKey: "PluginRepositories") try values.encodeIfPresent(pluginRepositories, forKey: "PluginRepositories")
try values.encodeIfPresent(preferredMetadataLanguage, forKey: "PreferredMetadataLanguage") try values.encodeIfPresent(preferredMetadataLanguage, forKey: "PreferredMetadataLanguage")
@ -298,6 +342,7 @@ public struct ServerConfiguration: Codable, Hashable {
try values.encodeIfPresent(sortRemoveCharacters, forKey: "SortRemoveCharacters") try values.encodeIfPresent(sortRemoveCharacters, forKey: "SortRemoveCharacters")
try values.encodeIfPresent(sortRemoveWords, forKey: "SortRemoveWords") try values.encodeIfPresent(sortRemoveWords, forKey: "SortRemoveWords")
try values.encodeIfPresent(sortReplaceCharacters, forKey: "SortReplaceCharacters") try values.encodeIfPresent(sortReplaceCharacters, forKey: "SortReplaceCharacters")
try values.encodeIfPresent(trickplayOptions, forKey: "TrickplayOptions")
try values.encodeIfPresent(uICulture, forKey: "UICulture") try values.encodeIfPresent(uICulture, forKey: "UICulture")
} }
} }

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Server restarting down message.
public struct ServerRestartingMessage: Codable, Hashable {
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Server shutting down message.
public struct ServerShuttingDownMessage: Codable, Hashable {
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -22,8 +22,6 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
public var deviceName: String? public var deviceName: String?
/// Gets or sets the type of the device. /// Gets or sets the type of the device.
public var deviceType: String? public var deviceType: String?
/// Class BaseItem.
public var fullNowPlayingItem: BaseItem?
public var hasCustomDeviceName: Bool? public var hasCustomDeviceName: Bool?
/// Gets or sets the id. /// Gets or sets the id.
public var id: String? public var id: String?
@ -31,9 +29,13 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
public var isActive: Bool? public var isActive: Bool?
/// Gets or sets the last activity date. /// Gets or sets the last activity date.
public var lastActivityDate: Date? public var lastActivityDate: Date?
/// Gets or sets the last paused date.
public var lastPausedDate: Date?
/// Gets or sets the last playback check in. /// Gets or sets the last playback check in.
public var lastPlaybackCheckIn: Date? public var lastPlaybackCheckIn: Date?
/// Gets or sets the now playing item. /// This is strictly used as a data transfer object from the api layer.
///
/// This holds information about a BaseItem in a format that is convenient for the client.
public var nowPlayingItem: BaseItemDto? public var nowPlayingItem: BaseItemDto?
public var nowPlayingQueue: [QueueItem]? public var nowPlayingQueue: [QueueItem]?
public var nowPlayingQueueFullItems: [BaseItemDto]? public var nowPlayingQueueFullItems: [BaseItemDto]?
@ -43,7 +45,7 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
public var nowViewingItem: BaseItemDto? public var nowViewingItem: BaseItemDto?
public var playState: PlayerStateInfo? public var playState: PlayerStateInfo?
/// Gets the playable media types. /// Gets the playable media types.
public var playableMediaTypes: [String]? public var playableMediaTypes: [MediaType]?
public var playlistItemID: String? public var playlistItemID: String?
/// Gets or sets the remote end point. /// Gets or sets the remote end point.
public var remoteEndPoint: String? public var remoteEndPoint: String?
@ -67,18 +69,18 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
deviceID: String? = nil, deviceID: String? = nil,
deviceName: String? = nil, deviceName: String? = nil,
deviceType: String? = nil, deviceType: String? = nil,
fullNowPlayingItem: BaseItem? = nil,
hasCustomDeviceName: Bool? = nil, hasCustomDeviceName: Bool? = nil,
id: String? = nil, id: String? = nil,
isActive: Bool? = nil, isActive: Bool? = nil,
lastActivityDate: Date? = nil, lastActivityDate: Date? = nil,
lastPausedDate: Date? = nil,
lastPlaybackCheckIn: Date? = nil, lastPlaybackCheckIn: Date? = nil,
nowPlayingItem: BaseItemDto? = nil, nowPlayingItem: BaseItemDto? = nil,
nowPlayingQueue: [QueueItem]? = nil, nowPlayingQueue: [QueueItem]? = nil,
nowPlayingQueueFullItems: [BaseItemDto]? = nil, nowPlayingQueueFullItems: [BaseItemDto]? = nil,
nowViewingItem: BaseItemDto? = nil, nowViewingItem: BaseItemDto? = nil,
playState: PlayerStateInfo? = nil, playState: PlayerStateInfo? = nil,
playableMediaTypes: [String]? = nil, playableMediaTypes: [MediaType]? = nil,
playlistItemID: String? = nil, playlistItemID: String? = nil,
remoteEndPoint: String? = nil, remoteEndPoint: String? = nil,
serverID: String? = nil, serverID: String? = nil,
@ -97,11 +99,11 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
self.deviceID = deviceID self.deviceID = deviceID
self.deviceName = deviceName self.deviceName = deviceName
self.deviceType = deviceType self.deviceType = deviceType
self.fullNowPlayingItem = fullNowPlayingItem
self.hasCustomDeviceName = hasCustomDeviceName self.hasCustomDeviceName = hasCustomDeviceName
self.id = id self.id = id
self.isActive = isActive self.isActive = isActive
self.lastActivityDate = lastActivityDate self.lastActivityDate = lastActivityDate
self.lastPausedDate = lastPausedDate
self.lastPlaybackCheckIn = lastPlaybackCheckIn self.lastPlaybackCheckIn = lastPlaybackCheckIn
self.nowPlayingItem = nowPlayingItem self.nowPlayingItem = nowPlayingItem
self.nowPlayingQueue = nowPlayingQueue self.nowPlayingQueue = nowPlayingQueue
@ -130,18 +132,18 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
self.deviceID = try values.decodeIfPresent(String.self, forKey: "DeviceId") self.deviceID = try values.decodeIfPresent(String.self, forKey: "DeviceId")
self.deviceName = try values.decodeIfPresent(String.self, forKey: "DeviceName") self.deviceName = try values.decodeIfPresent(String.self, forKey: "DeviceName")
self.deviceType = try values.decodeIfPresent(String.self, forKey: "DeviceType") self.deviceType = try values.decodeIfPresent(String.self, forKey: "DeviceType")
self.fullNowPlayingItem = try values.decodeIfPresent(BaseItem.self, forKey: "FullNowPlayingItem")
self.hasCustomDeviceName = try values.decodeIfPresent(Bool.self, forKey: "HasCustomDeviceName") self.hasCustomDeviceName = try values.decodeIfPresent(Bool.self, forKey: "HasCustomDeviceName")
self.id = try values.decodeIfPresent(String.self, forKey: "Id") self.id = try values.decodeIfPresent(String.self, forKey: "Id")
self.isActive = try values.decodeIfPresent(Bool.self, forKey: "IsActive") self.isActive = try values.decodeIfPresent(Bool.self, forKey: "IsActive")
self.lastActivityDate = try values.decodeIfPresent(Date.self, forKey: "LastActivityDate") self.lastActivityDate = try values.decodeIfPresent(Date.self, forKey: "LastActivityDate")
self.lastPausedDate = try values.decodeIfPresent(Date.self, forKey: "LastPausedDate")
self.lastPlaybackCheckIn = try values.decodeIfPresent(Date.self, forKey: "LastPlaybackCheckIn") self.lastPlaybackCheckIn = try values.decodeIfPresent(Date.self, forKey: "LastPlaybackCheckIn")
self.nowPlayingItem = try values.decodeIfPresent(BaseItemDto.self, forKey: "NowPlayingItem") self.nowPlayingItem = try values.decodeIfPresent(BaseItemDto.self, forKey: "NowPlayingItem")
self.nowPlayingQueue = try values.decodeIfPresent([QueueItem].self, forKey: "NowPlayingQueue") self.nowPlayingQueue = try values.decodeIfPresent([QueueItem].self, forKey: "NowPlayingQueue")
self.nowPlayingQueueFullItems = try values.decodeIfPresent([BaseItemDto].self, forKey: "NowPlayingQueueFullItems") self.nowPlayingQueueFullItems = try values.decodeIfPresent([BaseItemDto].self, forKey: "NowPlayingQueueFullItems")
self.nowViewingItem = try values.decodeIfPresent(BaseItemDto.self, forKey: "NowViewingItem") self.nowViewingItem = try values.decodeIfPresent(BaseItemDto.self, forKey: "NowViewingItem")
self.playState = try values.decodeIfPresent(PlayerStateInfo.self, forKey: "PlayState") self.playState = try values.decodeIfPresent(PlayerStateInfo.self, forKey: "PlayState")
self.playableMediaTypes = try values.decodeIfPresent([String].self, forKey: "PlayableMediaTypes") self.playableMediaTypes = try values.decodeIfPresent([MediaType].self, forKey: "PlayableMediaTypes")
self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId") self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId")
self.remoteEndPoint = try values.decodeIfPresent(String.self, forKey: "RemoteEndPoint") self.remoteEndPoint = try values.decodeIfPresent(String.self, forKey: "RemoteEndPoint")
self.serverID = try values.decodeIfPresent(String.self, forKey: "ServerId") self.serverID = try values.decodeIfPresent(String.self, forKey: "ServerId")
@ -163,11 +165,11 @@ public struct SessionInfo: Codable, Hashable, Identifiable {
try values.encodeIfPresent(deviceID, forKey: "DeviceId") try values.encodeIfPresent(deviceID, forKey: "DeviceId")
try values.encodeIfPresent(deviceName, forKey: "DeviceName") try values.encodeIfPresent(deviceName, forKey: "DeviceName")
try values.encodeIfPresent(deviceType, forKey: "DeviceType") try values.encodeIfPresent(deviceType, forKey: "DeviceType")
try values.encodeIfPresent(fullNowPlayingItem, forKey: "FullNowPlayingItem")
try values.encodeIfPresent(hasCustomDeviceName, forKey: "HasCustomDeviceName") try values.encodeIfPresent(hasCustomDeviceName, forKey: "HasCustomDeviceName")
try values.encodeIfPresent(id, forKey: "Id") try values.encodeIfPresent(id, forKey: "Id")
try values.encodeIfPresent(isActive, forKey: "IsActive") try values.encodeIfPresent(isActive, forKey: "IsActive")
try values.encodeIfPresent(lastActivityDate, forKey: "LastActivityDate") try values.encodeIfPresent(lastActivityDate, forKey: "LastActivityDate")
try values.encodeIfPresent(lastPausedDate, forKey: "LastPausedDate")
try values.encodeIfPresent(lastPlaybackCheckIn, forKey: "LastPlaybackCheckIn") try values.encodeIfPresent(lastPlaybackCheckIn, forKey: "LastPlaybackCheckIn")
try values.encodeIfPresent(nowPlayingItem, forKey: "NowPlayingItem") try values.encodeIfPresent(nowPlayingItem, forKey: "NowPlayingItem")
try values.encodeIfPresent(nowPlayingQueue, forKey: "NowPlayingQueue") try values.encodeIfPresent(nowPlayingQueue, forKey: "NowPlayingQueue")

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Sessions message.
public struct SessionsMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: [SessionInfo]?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: [SessionInfo]? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent([SessionInfo].self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,36 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Sessions start message.
///
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
public struct SessionsStartMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(String.self, forKey: "Data")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,29 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Sessions stop message.
public struct SessionsStopMessage: Codable, Hashable {
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(messageType: SessionMessageType? = nil) {
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -19,4 +19,6 @@ public enum SpecialFeatureType: String, Codable, CaseIterable {
case sample = "Sample" case sample = "Sample"
case themeSong = "ThemeSong" case themeSong = "ThemeSong"
case themeVideo = "ThemeVideo" case themeVideo = "ThemeVideo"
case featurette = "Featurette"
case short = "Short"
} }

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class GroupUpdate.
public struct StringGroupUpdate: Codable, Hashable {
/// Gets the update data.
public var data: String?
/// Gets the group identifier.
public var groupID: String?
/// Gets the update type.
public var type: GroupUpdateType?
public init(data: String? = nil, groupID: String? = nil, type: GroupUpdateType? = nil) {
self.data = data
self.groupID = groupID
self.type = type
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(String.self, forKey: "Data")
self.groupID = try values.decodeIfPresent(String.self, forKey: "GroupId")
self.type = try values.decodeIfPresent(GroupUpdateType.self, forKey: "Type")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(groupID, forKey: "GroupId")
try values.encodeIfPresent(type, forKey: "Type")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Sync play command.
public struct SyncPlayCommandMessage: Codable, Hashable {
/// Class SendCommand.
public var data: SendCommand?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: SendCommand? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(SendCommand.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Untyped sync play command.
public struct SyncPlayGroupUpdateCommandMessage: Codable, Hashable {
/// Group update without data.
public var data: GroupUpdate?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: GroupUpdate? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(GroupUpdate.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,34 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Class QueueItem.
public struct SyncPlayQueueItem: Codable, Hashable {
/// Gets the item identifier.
public var itemID: String?
/// Gets the playlist identifier of the item.
public var playlistItemID: String?
public init(itemID: String? = nil, playlistItemID: String? = nil) {
self.itemID = itemID
self.playlistItemID = playlistItemID
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.itemID = try values.decodeIfPresent(String.self, forKey: "ItemId")
self.playlistItemID = try values.decodeIfPresent(String.self, forKey: "PlaylistItemId")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(itemID, forKey: "ItemId")
try values.encodeIfPresent(playlistItemID, forKey: "PlaylistItemId")
}
}

View File

@ -12,21 +12,24 @@ import Foundation
public struct SystemInfo: Codable, Hashable, Identifiable { public struct SystemInfo: Codable, Hashable, Identifiable {
/// Gets or sets the cache path. /// Gets or sets the cache path.
public var cachePath: String? public var cachePath: String?
public var canLaunchWebBrowser: Bool? /// - warning: Deprecated.
public var canLaunchWebBrowser: Bool
/// Gets or sets a value indicating whether this instance can self restart. /// Gets or sets a value indicating whether this instance can self restart.
public var canSelfRestart: Bool?
/// Gets or sets the completed installations.
public var completedInstallations: [InstallationInfo]?
/// Enum describing the location of the FFmpeg tool.
/// ///
/// - warning: Deprecated. /// - warning: Deprecated.
public var encoderLocation: FFmpegLocation? public var canSelfRestart: Bool
/// Gets or sets the list of cast receiver applications.
public var castReceiverApplications: [CastReceiverApplication]?
/// Gets or sets the completed installations.
public var completedInstallations: [InstallationInfo]?
/// - warning: Deprecated.
public var encoderLocation: String?
/// Gets or sets a value indicating whether this instance has pending restart. /// Gets or sets a value indicating whether this instance has pending restart.
public var hasPendingRestart: Bool? public var hasPendingRestart: Bool?
/// Gets or sets a value indicating whether this instance has update available. /// Gets or sets a value indicating whether this instance has update available.
/// ///
/// - warning: Deprecated. /// - warning: Deprecated.
public var hasUpdateAvailable: Bool? public var hasUpdateAvailable: Bool
/// Gets or sets the id. /// Gets or sets the id.
public var id: String? public var id: String?
/// Gets or sets the internal metadata path. /// Gets or sets the internal metadata path.
@ -39,8 +42,12 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
/// Gets or sets the log path. /// Gets or sets the log path.
public var logPath: String? public var logPath: String?
/// Gets or sets the operating system. /// Gets or sets the operating system.
///
/// - warning: Deprecated.
public var operatingSystem: String? public var operatingSystem: String?
/// Gets or sets the display name of the operating system. /// Gets or sets the display name of the operating system.
///
/// - warning: Deprecated.
public var operatingSystemDisplayName: String? public var operatingSystemDisplayName: String?
/// Gets or sets the package name. /// Gets or sets the package name.
public var packageName: String? public var packageName: String?
@ -54,7 +61,8 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
public var isStartupWizardCompleted: Bool? public var isStartupWizardCompleted: Bool?
/// Gets or sets a value indicating whether [supports library monitor]. /// Gets or sets a value indicating whether [supports library monitor].
public var isSupportsLibraryMonitor: Bool? public var isSupportsLibraryMonitor: Bool?
public var systemArchitecture: Architecture? /// - warning: Deprecated.
public var systemArchitecture: String?
/// Gets or sets the transcode path. /// Gets or sets the transcode path.
public var transcodingTempPath: String? public var transcodingTempPath: String?
/// Gets or sets the server version. /// Gets or sets the server version.
@ -68,8 +76,9 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
cachePath: String? = nil, cachePath: String? = nil,
canLaunchWebBrowser: Bool? = nil, canLaunchWebBrowser: Bool? = nil,
canSelfRestart: Bool? = nil, canSelfRestart: Bool? = nil,
castReceiverApplications: [CastReceiverApplication]? = nil,
completedInstallations: [InstallationInfo]? = nil, completedInstallations: [InstallationInfo]? = nil,
encoderLocation: FFmpegLocation? = nil, encoderLocation: String? = nil,
hasPendingRestart: Bool? = nil, hasPendingRestart: Bool? = nil,
hasUpdateAvailable: Bool? = nil, hasUpdateAvailable: Bool? = nil,
id: String? = nil, id: String? = nil,
@ -86,19 +95,20 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
serverName: String? = nil, serverName: String? = nil,
isStartupWizardCompleted: Bool? = nil, isStartupWizardCompleted: Bool? = nil,
isSupportsLibraryMonitor: Bool? = nil, isSupportsLibraryMonitor: Bool? = nil,
systemArchitecture: Architecture? = nil, systemArchitecture: String? = nil,
transcodingTempPath: String? = nil, transcodingTempPath: String? = nil,
version: String? = nil, version: String? = nil,
webPath: String? = nil, webPath: String? = nil,
webSocketPortNumber: Int? = nil webSocketPortNumber: Int? = nil
) { ) {
self.cachePath = cachePath self.cachePath = cachePath
self.canLaunchWebBrowser = canLaunchWebBrowser self.canLaunchWebBrowser = canLaunchWebBrowser ?? false
self.canSelfRestart = canSelfRestart self.canSelfRestart = canSelfRestart ?? true
self.castReceiverApplications = castReceiverApplications
self.completedInstallations = completedInstallations self.completedInstallations = completedInstallations
self.encoderLocation = encoderLocation self.encoderLocation = encoderLocation
self.hasPendingRestart = hasPendingRestart self.hasPendingRestart = hasPendingRestart
self.hasUpdateAvailable = hasUpdateAvailable self.hasUpdateAvailable = hasUpdateAvailable ?? false
self.id = id self.id = id
self.internalMetadataPath = internalMetadataPath self.internalMetadataPath = internalMetadataPath
self.isShuttingDown = isShuttingDown self.isShuttingDown = isShuttingDown
@ -123,12 +133,13 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self) let values = try decoder.container(keyedBy: StringCodingKey.self)
self.cachePath = try values.decodeIfPresent(String.self, forKey: "CachePath") self.cachePath = try values.decodeIfPresent(String.self, forKey: "CachePath")
self.canLaunchWebBrowser = try values.decodeIfPresent(Bool.self, forKey: "CanLaunchWebBrowser") self.canLaunchWebBrowser = try values.decodeIfPresent(Bool.self, forKey: "CanLaunchWebBrowser") ?? false
self.canSelfRestart = try values.decodeIfPresent(Bool.self, forKey: "CanSelfRestart") self.canSelfRestart = try values.decodeIfPresent(Bool.self, forKey: "CanSelfRestart") ?? true
self.castReceiverApplications = try values.decodeIfPresent([CastReceiverApplication].self, forKey: "CastReceiverApplications")
self.completedInstallations = try values.decodeIfPresent([InstallationInfo].self, forKey: "CompletedInstallations") self.completedInstallations = try values.decodeIfPresent([InstallationInfo].self, forKey: "CompletedInstallations")
self.encoderLocation = try values.decodeIfPresent(FFmpegLocation.self, forKey: "EncoderLocation") self.encoderLocation = try values.decodeIfPresent(String.self, forKey: "EncoderLocation")
self.hasPendingRestart = try values.decodeIfPresent(Bool.self, forKey: "HasPendingRestart") self.hasPendingRestart = try values.decodeIfPresent(Bool.self, forKey: "HasPendingRestart")
self.hasUpdateAvailable = try values.decodeIfPresent(Bool.self, forKey: "HasUpdateAvailable") self.hasUpdateAvailable = try values.decodeIfPresent(Bool.self, forKey: "HasUpdateAvailable") ?? false
self.id = try values.decodeIfPresent(String.self, forKey: "Id") self.id = try values.decodeIfPresent(String.self, forKey: "Id")
self.internalMetadataPath = try values.decodeIfPresent(String.self, forKey: "InternalMetadataPath") self.internalMetadataPath = try values.decodeIfPresent(String.self, forKey: "InternalMetadataPath")
self.isShuttingDown = try values.decodeIfPresent(Bool.self, forKey: "IsShuttingDown") self.isShuttingDown = try values.decodeIfPresent(Bool.self, forKey: "IsShuttingDown")
@ -143,7 +154,7 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
self.serverName = try values.decodeIfPresent(String.self, forKey: "ServerName") self.serverName = try values.decodeIfPresent(String.self, forKey: "ServerName")
self.isStartupWizardCompleted = try values.decodeIfPresent(Bool.self, forKey: "StartupWizardCompleted") self.isStartupWizardCompleted = try values.decodeIfPresent(Bool.self, forKey: "StartupWizardCompleted")
self.isSupportsLibraryMonitor = try values.decodeIfPresent(Bool.self, forKey: "SupportsLibraryMonitor") self.isSupportsLibraryMonitor = try values.decodeIfPresent(Bool.self, forKey: "SupportsLibraryMonitor")
self.systemArchitecture = try values.decodeIfPresent(Architecture.self, forKey: "SystemArchitecture") self.systemArchitecture = try values.decodeIfPresent(String.self, forKey: "SystemArchitecture")
self.transcodingTempPath = try values.decodeIfPresent(String.self, forKey: "TranscodingTempPath") self.transcodingTempPath = try values.decodeIfPresent(String.self, forKey: "TranscodingTempPath")
self.version = try values.decodeIfPresent(String.self, forKey: "Version") self.version = try values.decodeIfPresent(String.self, forKey: "Version")
self.webPath = try values.decodeIfPresent(String.self, forKey: "WebPath") self.webPath = try values.decodeIfPresent(String.self, forKey: "WebPath")
@ -155,6 +166,7 @@ public struct SystemInfo: Codable, Hashable, Identifiable {
try values.encodeIfPresent(cachePath, forKey: "CachePath") try values.encodeIfPresent(cachePath, forKey: "CachePath")
try values.encodeIfPresent(canLaunchWebBrowser, forKey: "CanLaunchWebBrowser") try values.encodeIfPresent(canLaunchWebBrowser, forKey: "CanLaunchWebBrowser")
try values.encodeIfPresent(canSelfRestart, forKey: "CanSelfRestart") try values.encodeIfPresent(canSelfRestart, forKey: "CanSelfRestart")
try values.encodeIfPresent(castReceiverApplications, forKey: "CastReceiverApplications")
try values.encodeIfPresent(completedInstallations, forKey: "CompletedInstallations") try values.encodeIfPresent(completedInstallations, forKey: "CompletedInstallations")
try values.encodeIfPresent(encoderLocation, forKey: "EncoderLocation") try values.encodeIfPresent(encoderLocation, forKey: "EncoderLocation")
try values.encodeIfPresent(hasPendingRestart, forKey: "HasPendingRestart") try values.encodeIfPresent(hasPendingRestart, forKey: "HasPendingRestart")

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Timer cancelled message.
public struct TimerCancelledMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: TimerEventInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: TimerEventInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(TimerEventInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

View File

@ -0,0 +1,39 @@
//
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Foundation
/// Timer created message.
public struct TimerCreatedMessage: Codable, Hashable {
/// Gets or sets the data.
public var data: TimerEventInfo?
/// Gets or sets the message id.
public var messageID: String?
/// The different kinds of messages that are used in the WebSocket api.
public var messageType: SessionMessageType?
public init(data: TimerEventInfo? = nil, messageID: String? = nil, messageType: SessionMessageType? = nil) {
self.data = data
self.messageID = messageID
self.messageType = messageType
}
public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decodeIfPresent(TimerEventInfo.self, forKey: "Data")
self.messageID = try values.decodeIfPresent(String.self, forKey: "MessageId")
self.messageType = try values.decodeIfPresent(SessionMessageType.self, forKey: "MessageType")
}
public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(data, forKey: "Data")
try values.encodeIfPresent(messageID, forKey: "MessageId")
try values.encodeIfPresent(messageType, forKey: "MessageType")
}
}

Some files were not shown because too many files have changed in this diff Show More