Files
Swarm/DysonNetwork.Shared/Services/IAccountService.cs
2025-07-07 21:54:51 +08:00

62 lines
2.5 KiB
C#

using DysonNetwork.Shared.Models;
using MagicOnion;
namespace DysonNetwork.Shared.Services;
public interface IAccountService : IService<IAccountService>
{
/// <summary>
/// Removes all cached data for the specified account
/// </summary>
Task PurgeAccountCache(Account account);
/// <summary>
/// Looks up an account by username or contact information
/// </summary>
/// <param name="probe">Username or contact information to search for</param>
/// <returns>The matching account if found, otherwise null</returns>
Task<Account?> LookupAccount(string probe);
/// <summary>
/// Looks up an account by external authentication provider connection
/// </summary>
/// <param name="identifier">The provider's unique identifier for the user</param>
/// <param name="provider">The name of the authentication provider</param>
/// <returns>The matching account if found, otherwise null</returns>
Task<Account?> LookupAccountByConnection(string identifier, string provider);
/// <summary>
/// Gets the account level for the specified account ID
/// </summary>
/// <param name="accountId">The ID of the account</param>
/// <returns>The account level if found, otherwise null</returns>
Task<int?> GetAccountLevel(Guid accountId);
/// <summary>
/// Creates a new account with the specified details
/// </summary>
/// <param name="name">The account username</param>
/// <param name="nick">The display name/nickname</param>
/// <param name="email">The primary email address</param>
/// <param name="password">The account password (optional, can be set later)</param>
/// <param name="language">The preferred language (defaults to en-US)</param>
/// <param name="isEmailVerified">Whether the email is verified (defaults to false)</param>
/// <param name="isActivated">Whether the account is activated (defaults to false)</param>
/// <returns>The newly created account</returns>
Task<Account> CreateAccount(
string name,
string nick,
string email,
string? password,
string language = "en-US",
bool isEmailVerified = false,
bool isActivated = false
);
/// <summary>
/// Creates a new account using OpenID Connect user information
/// </summary>
/// <param name="userInfo">The OpenID Connect user information</param>
/// <returns>The newly created account</returns>
Task<Account> CreateAccount(OidcUserInfo userInfo);
}