49 lines
1.8 KiB
Swift
49 lines
1.8 KiB
Swift
//
|
|
// JellyfinMediaPage.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 page of a paged item query.
|
|
///
|
|
/// `totalRecordCount` describes the whole result set, not this page, so it is what a paginator
|
|
/// should size itself against.
|
|
package struct JellyfinMediaPage: Hashable, Sendable {
|
|
/// The items on this page, in server order.
|
|
package var items: [JellyfinMediaItem]
|
|
/// How many items match the query in total, across every page.
|
|
package var totalRecordCount: Int32?
|
|
/// The offset of this page into the whole result set.
|
|
package var startIndex: Int32?
|
|
|
|
/// Creates a page, defaulting to an empty result set.
|
|
///
|
|
/// - Parameters:
|
|
/// - items: The items on this page.
|
|
/// - totalRecordCount: How many items match the query in total.
|
|
/// - startIndex: The offset of this page into the result set.
|
|
package init(
|
|
items: [JellyfinMediaItem] = [],
|
|
totalRecordCount: Int32? = nil,
|
|
startIndex: Int32? = nil
|
|
) {
|
|
self.items = items
|
|
self.totalRecordCount = totalRecordCount
|
|
self.startIndex = startIndex
|
|
}
|
|
}
|