90 lines
3.5 KiB
Swift
90 lines
3.5 KiB
Swift
//
|
|
// JellyfinSearchHint.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
|
|
//
|
|
|
|
/// One suggestion from the server's search-as-you-type endpoint.
|
|
///
|
|
/// A hint is not a full ``JellyfinMediaItem``: it carries just enough to draw a result row and then
|
|
/// navigate, using ``itemID`` to fetch the real item.
|
|
package struct JellyfinSearchHint: Hashable, Sendable {
|
|
/// The identifier of the item the hint points at.
|
|
package var itemID: String?
|
|
/// The hint's own identifier, which the server keeps distinct from the item identifier.
|
|
package var id: String?
|
|
/// The display title.
|
|
package var name: String?
|
|
/// The portion of the item's metadata that matched the search term.
|
|
package var matchedTerm: String?
|
|
/// What kind of item the hint points at.
|
|
package var kind: JellyfinMediaKind?
|
|
/// The year of production.
|
|
package var productionYear: Int32?
|
|
/// The episode number within its season.
|
|
package var indexNumber: Int32?
|
|
/// The season number, for episodes.
|
|
package var parentIndexNumber: Int32?
|
|
/// The image tag used to fetch the poster.
|
|
package var primaryImageTag: String?
|
|
/// The image tag used to fetch the landscape thumbnail.
|
|
package var thumbImageTag: String?
|
|
/// The image tag used to fetch the backdrop.
|
|
package var backdropImageTag: String?
|
|
/// Whether the hint points at a folder rather than a playable item.
|
|
package var isFolder: Bool?
|
|
/// The total duration, in 100-nanosecond ticks.
|
|
package var runTimeTicks: Int64?
|
|
/// The title of the parent series, for episodes.
|
|
package var series: String?
|
|
|
|
/// Creates a search hint, defaulting every unspecified field to `nil`.
|
|
///
|
|
/// Each parameter sets the property of the same name.
|
|
package init(
|
|
itemID: String? = nil,
|
|
id: String? = nil,
|
|
name: String? = nil,
|
|
matchedTerm: String? = nil,
|
|
kind: JellyfinMediaKind? = nil,
|
|
productionYear: Int32? = nil,
|
|
indexNumber: Int32? = nil,
|
|
parentIndexNumber: Int32? = nil,
|
|
primaryImageTag: String? = nil,
|
|
thumbImageTag: String? = nil,
|
|
backdropImageTag: String? = nil,
|
|
isFolder: Bool? = nil,
|
|
runTimeTicks: Int64? = nil,
|
|
series: String? = nil
|
|
) {
|
|
self.itemID = itemID
|
|
self.id = id
|
|
self.name = name
|
|
self.matchedTerm = matchedTerm
|
|
self.kind = kind
|
|
self.productionYear = productionYear
|
|
self.indexNumber = indexNumber
|
|
self.parentIndexNumber = parentIndexNumber
|
|
self.primaryImageTag = primaryImageTag
|
|
self.thumbImageTag = thumbImageTag
|
|
self.backdropImageTag = backdropImageTag
|
|
self.isFolder = isFolder
|
|
self.runTimeTicks = runTimeTicks
|
|
self.series = series
|
|
}
|
|
}
|