// Copyright Epic Games, Inc. All Rights Reserved. using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using EpicGames.Horde.Accounts; using HordeServer.Users; namespace HordeServer.Accounts { /// /// Interface for a collection of accounts /// public interface IAccountCollection { /// /// Adds a new account to the collection /// /// Options for the new account /// Cancellation token for the operation Task CreateAsync(CreateAccountOptions options, CancellationToken cancellationToken = default); /// /// Searches service accounts /// /// Index of the first account /// Number of results to return /// Cancellation token for the operation /// The service account Task> FindAsync(int? index = null, int? count = null, CancellationToken cancellationToken = default); /// /// Get an account via login ID /// /// Login or username to use for searching /// Cancellation token for the operation /// The service account Task FindByLoginAsync(string login, CancellationToken cancellationToken = default); /// /// Get service account via ID /// /// The unique service account id /// Cancellation token for the operation /// The service account Task GetAsync(AccountId id, CancellationToken cancellationToken = default); /// /// Delete a service account from the collection /// /// The service account /// Cancellation token for the operation /// Async task Task DeleteAsync(AccountId id, CancellationToken cancellationToken = default); /// /// Creates the admin account when using Horde authentication /// /// /// /// ValueTask CreateAdminAccountAsync(string password, CancellationToken cancellationToken); } /// /// Options for a new account /// /// Name of the account (for example a given full name or name of service) /// Login ID or username /// Optional list of claims /// Optional description /// Optional e-mail address /// Optional password for interactive login /// Whether the account should be enabled public record class CreateAccountOptions( string Name, string Login, IReadOnlyList? Claims = null, string? Description = null, string? Email = null, string? Password = null, bool? Enabled = null); }