73 lines
2.9 KiB
Swift
73 lines
2.9 KiB
Swift
//
|
|
// JellyfinUser.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 Foundation
|
|
|
|
/// A Jellyfin user account as Luminate needs it for the login and profile flows.
|
|
///
|
|
/// The server returns a much wider `UserDto`, most of which is administrative policy Luminate does
|
|
/// not act on. Every property is optional because the public user list a server exposes before
|
|
/// login is deliberately sparse.
|
|
package struct JellyfinUser: Hashable, Sendable {
|
|
/// The server-assigned user identifier.
|
|
package var id: String?
|
|
/// The display name shown on the user picker.
|
|
package var name: String?
|
|
/// The identifier of the server this account belongs to.
|
|
package var serverID: String?
|
|
/// The image tag used to fetch the user's avatar, if one is set.
|
|
package var primaryImageTag: String?
|
|
/// Whether the account requires a password.
|
|
package var hasPassword: Bool?
|
|
/// Whether the account has a password configured.
|
|
package var hasConfiguredPassword: Bool?
|
|
/// Whether the account has a numeric Easy PIN configured.
|
|
package var hasConfiguredEasyPassword: Bool?
|
|
/// When the account last signed in.
|
|
package var lastLoginDate: Date?
|
|
/// The aspect ratio of the avatar image.
|
|
package var primaryImageAspectRatio: Double?
|
|
|
|
/// Creates a user, defaulting every unspecified field to `nil`.
|
|
///
|
|
/// Each parameter sets the property of the same name.
|
|
package init(
|
|
id: String? = nil,
|
|
name: String? = nil,
|
|
serverID: String? = nil,
|
|
primaryImageTag: String? = nil,
|
|
hasPassword: Bool? = nil,
|
|
hasConfiguredPassword: Bool? = nil,
|
|
hasConfiguredEasyPassword: Bool? = nil,
|
|
lastLoginDate: Date? = nil,
|
|
primaryImageAspectRatio: Double? = nil
|
|
) {
|
|
self.id = id
|
|
self.name = name
|
|
self.serverID = serverID
|
|
self.primaryImageTag = primaryImageTag
|
|
self.hasPassword = hasPassword
|
|
self.hasConfiguredPassword = hasConfiguredPassword
|
|
self.hasConfiguredEasyPassword = hasConfiguredEasyPassword
|
|
self.lastLoginDate = lastLoginDate
|
|
self.primaryImageAspectRatio = primaryImageAspectRatio
|
|
}
|
|
}
|