Skip to main content

UserApiClient

A class in Alta.Api.Client, Alta.Api.Client.HighLevel.

High-level Alta API calls about user accounts: user info, verification, username and password changes, roles and cosmetic presets. Thin wrapper over the low-level API client.

Constructors​

1 private and internal constructor
MemberWhat it is
internal UserApiClient(IHighLevelApiClientManager clientManager)Creates an UserApiClient from clientManager.

Fields​

1 private and internal field
MemberWhat it is
private static Logger loggerClass logger.

Properties​

MemberWhat it is
UserInfoWithPermissions LoggedInUserInfo { get; set; }Info and permissions of the user this client is logged in as.

Methods​

MemberWhat it is
async Task ChangeEmail(string email)Asks the API to change the logged-in user's email address.
async Task ChangeUsernameAsync(string newUsername, string passwordHash)Changes the logged-in user's username. Needs the password hash to confirm.
Task<UserPresetDataInfo> CreateCosmeticsPreset(int presetId, uint[] data, int byteSize)Saves a cosmetics preset (packed uint data plus its byte size) under a preset id.
Task DeleteCosmeticPreset(int presetId)Deletes the logged-in user's cosmetics preset with the given id.
Task<IEnumerable<UserPresetDataInfo>> GetAllCosmeticsPresets()Fetches all of the logged-in user's saved cosmetics presets.
async Task<MembershipStatusResponse> GetMembershipStatus(int userIdentifer)Fetches a user's membership (subscription) status.
async Task<PersonalUserInfoResponse> GetPersonalUserInfo(int userIdentifier)Fetches a user's private account info as a PersonalUserInfoResponse.
Task<UserInfo> GetUserInfoAsync(int userId)Fetches a user's public info, either by user id or by username.
async Task<UserInfo> GetUserInfoAsync(string username)Fetches a user's public info, either by user id or by username.
Task<UserInfoWithPermissions> GetUserInfoWithPermissionsAsync(int userId)Fetches a user's info together with their permissions.
Task<UserStatistics> GetUserStatisticsAsync(int userIdentifier)Fetches a user's play statistics.
async Task GiveUserRoleAsync(int userIdentifer, AssignableRoles role)Gives a user one of the AssignableRoles roles.
async Task<bool> IsUserVerifiedAsync()Asks whether the logged-in user has verified their email, and marks LoggedInUserInfo verified if so.
void Logout()Logs the low-level client out.
async Task RefreshLoginAsync()Refreshes the login tokens.
async Task RequestUserVerificationEmailAsync(string email)Asks the API to send a verification email for the logged-in user to the given address.
async Task UpdatePasswordAsync(string oldPasswordHash, string newPasswordHash)Changes the logged-in user's password, from old hash to new hash.
async Task ValidateEmail(string email)Checks an email address with the API before sign-up; throws if it isn't accepted.
async Task<string> ValidateUsername(string username)Checks a username with the API before sign-up and returns the API's answer.
async Task VerifyUsersMemberShip(int userId)Asks the API to recheck a user's membership.