namespace Cleanuparr.Infrastructure.Features.Auth;
public sealed record PlexPinResult
{
public required int PinId { get; init; }
public required string PinCode { get; init; }
public required string AuthUrl { get; init; }
}
public sealed record PlexPinCheckResult
{
public required bool Completed { get; init; }
public string? AuthToken { get; init; }
}
public sealed record PlexAccountInfo
{
public required string AccountId { get; init; }
public required string Username { get; init; }
public string? Email { get; init; }
}
public interface IPlexAuthService
{
///
/// Creates a Plex authentication PIN and builds the URL the user is sent to in order to authorize.
///
///
/// Optional URL Plex redirects the browser back to after authorization. When omitted, no redirect
/// is added and the caller is expected to poll instead.
///
Task RequestPin(string? forwardUrl = null);
///
/// Checks whether a PIN has been authorized, returning the Plex auth token once it has.
///
Task CheckPin(int pinId);
///
/// Retrieves the Plex account associated with the given auth token.
///
Task GetAccount(string authToken);
}