63 lines
2.5 KiB
Swift
63 lines
2.5 KiB
Swift
//
|
|
// JellyfinLibrary.swift
|
|
//
|
|
// Copyright 2026 Brendan Szymanski <hello@bscubed.dev>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
//
|
|
|
|
/// A top-level library a user can browse.
|
|
///
|
|
/// Deliberately narrower than ``JellyfinMediaItem``: a library row needs a name, artwork, and a
|
|
/// collection type, and nothing else. A `nil` ``collectionType`` means the server reported a
|
|
/// library type Luminate does not support, which is how music and book libraries are filtered out.
|
|
package struct JellyfinLibrary: Hashable, Sendable {
|
|
/// The server-assigned library identifier, used as the parent identifier when browsing.
|
|
package var id: String?
|
|
/// The display name of the library.
|
|
package var name: String?
|
|
/// What kind of media the library holds.
|
|
package var collectionType: JellyfinCollectionType?
|
|
/// The library description, when the server has one.
|
|
package var overview: String?
|
|
/// The image tag used to fetch the library's poster.
|
|
package var primaryImageTag: String?
|
|
/// The tags of the library's backdrop images, in server order.
|
|
package var backdropImageTags: [String]
|
|
/// How many items the library directly contains.
|
|
package var childCount: Int32?
|
|
|
|
/// Creates a library, defaulting every unspecified field to `nil` or empty.
|
|
///
|
|
/// Each parameter sets the property of the same name.
|
|
package init(
|
|
id: String? = nil,
|
|
name: String? = nil,
|
|
collectionType: JellyfinCollectionType? = nil,
|
|
overview: String? = nil,
|
|
primaryImageTag: String? = nil,
|
|
backdropImageTags: [String] = [],
|
|
childCount: Int32? = nil
|
|
) {
|
|
self.id = id
|
|
self.name = name
|
|
self.collectionType = collectionType
|
|
self.overview = overview
|
|
self.primaryImageTag = primaryImageTag
|
|
self.backdropImageTags = backdropImageTags
|
|
self.childCount = childCount
|
|
}
|
|
}
|