289 lines
10 KiB
Swift
289 lines
10 KiB
Swift
//
|
|
// JellyfinResponsePayload.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
|
|
//
|
|
|
|
import LuminateAPI
|
|
|
|
// Collapses the redundant JSON content-type cases the Jellyfin specification produces.
|
|
//
|
|
// Jellyfin advertises three equivalent response content types for every JSON endpoint --
|
|
// `application/json`, `application/json; profile="camelcase"`, and
|
|
// `application/json; profile="pascalcase"` -- so the generator emits three cases carrying the
|
|
// identical payload. Which one arrives depends on content negotiation and never on anything
|
|
// Luminate cares about, so every call site reads `body.payload` instead of switching three ways.
|
|
//
|
|
// The generated shorthand accessors (`output.ok`, `body.json`) are deliberately unused: they throw
|
|
// `OpenAPIRuntime.RuntimeError`, which is internal to the runtime, so a caller can neither match
|
|
// nor translate it. Switching the output explicitly keeps every failure expressible as a
|
|
// `JellyfinClientError`.
|
|
//
|
|
// These enums are `@frozen`, so each switch is exhaustive without a `default`.
|
|
|
|
extension Operations.GetPublicSystemInfo.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.PublicSystemInfo {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetSystemInfo.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.SystemInfo {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetPublicUsers.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: [Components.Schemas.UserDto] {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.AuthenticateUserByName.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.AuthenticationResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.AuthenticateWithQuickConnect.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.AuthenticationResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetQuickConnectEnabled.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Swift.Bool {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.InitiateQuickConnect.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.QuickConnectResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetQuickConnectState.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.QuickConnectResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetUserViews.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDtoQueryResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetItems.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDtoQueryResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetItem.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDto {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetResumeItems.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDtoQueryResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetNextUp.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDtoQueryResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetLatestMedia.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: [Components.Schemas.BaseItemDto] {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetSeasons.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDtoQueryResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetEpisodes.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.BaseItemDtoQueryResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.GetSearchHints.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.SearchHintResult {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.MarkPlayedItem.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.UserItemDataDto {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.MarkUnplayedItem.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.UserItemDataDto {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.MarkFavoriteItem.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.UserItemDataDto {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Operations.UnmarkFavoriteItem.Output.Ok.Body {
|
|
/// The decoded body, whichever JSON profile the server negotiated.
|
|
var payload: Components.Schemas.UserItemDataDto {
|
|
switch self {
|
|
case .json(let value),
|
|
.applicationJsonProfile_Quot_camelcase_quot_(let value),
|
|
.applicationJsonProfile_Quot_pascalcase_quot_(let value):
|
|
value
|
|
}
|
|
}
|
|
}
|