45 lines
1.7 KiB
Swift
45 lines
1.7 KiB
Swift
//
|
|
// JellyfinAuthentication.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
|
|
//
|
|
|
|
/// The result of a successful sign-in.
|
|
///
|
|
/// `accessToken` is non-optional: a login that produced no token is a failure, so the service layer
|
|
/// throws rather than handing back a value with a missing token.
|
|
package struct JellyfinAuthentication: Hashable, Sendable {
|
|
/// The bearer token to send on every subsequent request.
|
|
package var accessToken: String
|
|
/// The identifier of the server that issued the token.
|
|
package var serverID: String?
|
|
/// The account the token belongs to.
|
|
package var user: JellyfinUser?
|
|
|
|
/// Creates an authentication result.
|
|
///
|
|
/// - Parameters:
|
|
/// - accessToken: The token issued by the server.
|
|
/// - serverID: The identifier of the issuing server.
|
|
/// - user: The signed-in account.
|
|
package init(accessToken: String, serverID: String? = nil, user: JellyfinUser? = nil) {
|
|
self.accessToken = accessToken
|
|
self.serverID = serverID
|
|
self.user = user
|
|
}
|
|
}
|