Skip to main content

LowLevelApiClient

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

The HTTP layer under IHighLevelApiClient: one method per endpoint of Alta's web API, which no longer answers. Most methods first refresh the login if needed (throwing AuthorizationException with none), and failed responses throw ApiErrorException, ForbiddenException or HttpException.

Constructors​

MemberWhat it is
LowLevelApiClient(string baseUrl, string userAgent = null, float timeOutInSeconds = 40)Creates a LowLevelApiClient from baseUrl, userAgent and timeOutInSeconds.

Fields​

MemberWhat it is
const string ApiKeyFixed key sent as the x-api-key header on every request.
14 private and internal fields
MemberWhat it is
private const string ApiBaseUriPath prefix api.
private HttpClient authenticationClientHTTP client that carries the refresh token, used to refresh the session.
private HttpClient authorizedClientHTTP client that carries the access token, used for most calls.
private readonly string baseUrlAPI base URL the clients are made with.
private HttpClient defaultClientPlain HTTP client used for file downloads.
private bool isAnalyticsBatchProcessingUnused flag.
private DateTime? lastTimeoutWhen the clients were last reset for a timeout.
private static readonly Logger LoggerNLog logger for this class.
private CancellationTokenSource refreshCancelCancels the scheduled token refresh.
private Task refreshingLoginTaskThe refresh in progress, which other calls wait for.
private readonly float timeOutInSecondsPer-try request timeout (default 40).
private const int TokenExpirationLeewaySeconds before expiry at which a token counts as expired (15).
private readonly string userAgentUser agent sent with each request, as name/version.
private const string XRequestIdName of the X-Request-Id header. Not used in this class.

Properties​

MemberWhat it is
LoginCredentials Credentials { get; private set; }Current access, refresh and identity tokens, or null when logged out.
UserInfoWithPermissions LoggedInUser { get; internal set; }The logged-in user with permissions.
26 private and internal properties
MemberWhat it is
private static string AccountControllerUri { get; }Path api/Account (linked Discord, Oculus and Pico accounts).
private static string BansControllerUri { get; }Path api/Bans.
private static string BatchAnalyticsControllerUri { get; }Path api/analytics/batch, where queued analytics events are sent.
private static string FriendsControllerUri { get; }Path api/Friends.
private static string FutureUserActionsControllerUri { get; }Path api/future-users.
private static string GroupsControllerUri { get; }Path api/groups.
private static string InstancesControllerUri { get; }Path api/Instances.
private static string LauncherControllerUri { get; }Path api/Launcher.
private static string LoginSessionsControllerUri { get; }Path api/Sessions, used to log in and refresh.
private static string MatchMakingControllerUri { get; }Path api/matchmaking.
private static string PlayerReportsControllerUri { get; }Path api/reports.
private string RecentPlayersBatchControllerUri { get; }Path api/recent-players/batch.
private static string RecentPlayersControllerUri { get; }Path api/recent-players.
private static string RegionsControllerUri { get; }Path api/regions.
private static string SecurityControllerUri { get; }Path api/Security.
private static string ServersControllerUri { get; }Path api/servers.
private static string ServicesControllerUri { get; }Path api/Services.
private static string SettingsControllerUri { get; }Path api/settings.
private static string ShopAccountControllerUri { get; }Path api/Shop/Account.
private static string ShopControllerUri { get; }Path api/Shop.
private static string ShopDebugControllerUri { get; }Path api/Shop/Debug.
private static string ShopOculusControllerUri { get; }Path api/Shop/Oculus.
private static string ShopPurchaseControllerUri { get; }Path api/Shop/Purchase.
private static string SignUpCodesControllerUri { get; }Path api/SignupCodes.
private static string UsersControllerUri { get; }Path api/Users.
private static string VoiceControllerUri { get; }Path api/Voice.

Events​

MemberWhat it is
event LoginCredentialsChangedHandler CredentialsChangedRaised with the old and new credentials when new tokens arrive.

Methods​

MemberWhat it is
async Task<GroupMemberInfo> AcceptGroupInvite(int groupIdentifier)Accepts an invite to a group (POST api/groups/invites/{id}).
async Task<GroupMemberInfo> AcceptGroupJoinRequest(int groupIdentifier, int userIdentifier)Accepts a user's request to join a group (PUT on the group's requests).
async Task<FriendRequestResult> AddFriend(int friendIdentifier)Sends a friend request to a user (POST api/Friends/{id}).
async Task AddImageToItemAsync(int itemId, ImageType imageType, string imagePath)Uploads an image file for a shop item as multipart form data.
async Task<AllocationResult> AllocateServerForMigration(AllocationRequest allocationRequest)Asks the API to allocate a server for a migration.
async Task<BanInfo> BanUserAsync(BanRequest banRequest)Creates an account ban (POST api/Bans).
async Task<GroupMemberInfo> BanUserFromGroup(int userIdentifier, int groupIdentifier)Bans a user from a group.
void CancelLoginTimer()Cancels the scheduled automatic token refresh.
async Task<CreateCheckResponse> CanCreateGroups()Asks whether the logged-in user may create groups.
async Task ChangeEmail(VerificationEmailRequest verificationRequest)Changes the logged-in user's email (PATCH api/Users/me/email).
async Task ChangePasswordAsync(ChangePasswordRequest passwordRequest)Changes the logged-in user's password.
async Task ChangeUsernameAsync(ChangeUsernameRequest usernameRequest)Changes the logged-in user's username.
async Task<GroupMemberInfo> ChangeUsersRoleInGroup(int userIdentifier, int groupIdentifier, int roleIdentifier)Gives a group member a different role.
async Task<SubscriptionRefreshResult> CheckForSubscriptionRewardsAsync()Checks the logged-in user's subscription rewards (api/Shop/account/rewards).
async Task<ServerJoinResult> ConnectConsole(int serverIdentifier, JoinServerRequest request)Asks the API for connection details for a server's remote console.
async Task<ClaimOculusItemsResponse> ConsumeAllOculusPurchases(string userToken)Claims all Oculus store purchases for the given user token.
async Task<UserPresetDataInfo> CreateCosmeticPreset(CreatePresetRequest request)Saves a new cosmetic preset for the logged-in user.
async Task CreateEfsMigrationRecordForServer(int serverId)Records an EFS storage migration for a server.
async Task<FriendRequestResult> CreateFriendship(int userIdentifier, int friendIdentifier)Creates a friendship between two given users.
async Task CreateFutureUserActions(FutureUserActionCreateRequest request)Queues actions to apply to a user later (api/future-users/actions).
async Task<GameServerInfo> CreateServer(GameServerCreateRequest createServerRequest)Creates a server record (POST api/servers).
async Task<ShopItemDetailed> CreateShopItemAsync(ShopItemDetailed itemToCreate)Creates a shop item.
async Task<ShopItemSet> CreateShopItemSetAsync(ItemSetRequest request)Creates a shop item set.
async Task DeleteBanAsync(int banIdentifier)Removes an account ban by its identifier.
async Task DeleteCosmeticPreset(int presetId)Deletes one of the logged-in user's cosmetic presets.
async Task DeleteItem(int userIdentifier, int itemIdentifier)Debug endpoint: removes an owned item from a user.
async Task DeleteShopItemAsync(int itemIdentifier)Deletes a shop item.
async Task DeleteShopItemGroupAsync(int groupIdentifier)Deletes a shop item group.
async Task DeleteShopItemSetAsync(string setSku)Deletes a shop item set by SKU.
async Task<IEnumerable<GameServerInfo>> DiscoverServers()Lists servers for the discovery screen (api/servers/discover).
async Task<Stream> DownloadFile(string url)Opens a download stream from any URL, without the API headers.
async Task EnqueueAnalyticsEvent(AnalyticsEventData data)Queues an analytics event for the batch analytics endpoint. Mods often stub it out.
async Task<SimpleTokenResultResponse> GenerateIdentityTokenAsync(IdentityTokenRequest request)Requests a short-lived identity token.
async Task<PlayerAchievementResponse> GetAchievementForUserAsync(int userId)Gets a user's achievements.
async Task<PlayerActionStatResponse> GetActionStatsForUserAsync(int userId)Gets a user's action stats.
async Task<IEnumerable<BanInfo>> GetAllBans()Lists all account bans.
async Task<IEnumerable<BanInfo>> GetAllBansForModerator(int moderatorIdentifier)Lists the bans a given moderator created.
async Task<IEnumerable<BanInfo>> GetAllBansForUser(int userIdentifier)Lists the bans on a given user.
async Task<IEnumerable<UserPresetDataInfo>> GetAllCosmetics()Lists the logged-in user's cosmetic presets.
async Task<IEnumerable<LauncherGameInfoShort>> GetAllLauncherGames()Lists the games the launcher knows about.
async Task<IEnumerable<RegionInfo>> GetAllRegions()Lists the hosting regions.
async Task<IEnumerable<InstanceInfo>> GetAllRunningInstances(string region = null, string fleet = null, bool? onlyGetVisibleRegions = null)Lists running server instances, optionally filtered by region, fleet and visibility.
async Task<GameServerInfo> GetBestServer(MatchMakingRequirements request)Matchmaking: asks for the best server for the given requirements.
async Task<IEnumerable<GameServerInfo>> GetControllableServers()Lists servers the logged-in user can control.
async Task<ShopPageConfiguration> GetCurrentShopConfiguration()Gets the current shop page layout.
async Task<IEnumerable<ShopItemDetailedForUser>> GetCurrentShopConfigurationForUser()Gets the shop items with details for the logged-in user.
async Task<ShopPageConfigurationWithBanner> GetCurrentShopConfigurationWithBanner()Gets the shop page layout including its banner.
async Task<LinkedAccountInfo> GetDiscordAccount()Gets the Discord account linked to the logged-in user or to a given user.
async Task<LinkedAccountInfo> GetDiscordAccount(int userIdentifier)Gets the Discord account linked to the logged-in user or to a given user.
PagedResult<FriendshipInfo> GetFriendRequests(PagedConfig config = null)Paged list of friend requests received.
PagedResult<FriendshipInfo> GetFriends(PagedConfig config = null)Paged list of the logged-in user's friends.
PagedResult<FriendshipInfo> GetFriendsForUser(int userIdentifier, PagedConfig config = null)Paged list of a given user's friends.
async Task<FriendshipInfo> GetFriendship(int userIdentifier, int friendIdentifier)Gets the friendship between two users, or null if there is none.
async Task<IEnumerable<ShopItem>> GetFullItemDescriptions(IEnumerable<int> itemIdentifiers)Gets full shop item details for a list of item identifiers.
PagedResult<GroupMemberInfo> GetGroupBans(int groupIdentifier, PagedConfig config = null)Paged list of users banned from a group.
async Task<GroupInfoDetailed> GetGroupByIdentifier(int groupIdentifier)Gets a group's detailed info.
PagedResult<InvitedGroupInfo> GetGroupInvites(PagedConfig config = null)Paged list of groups that invited the logged-in user.
PagedResult<GroupMemberInfo> GetGroupJoinRequests(int groupIdentifier, PagedConfig config = null)Paged list of pending join requests for a group.
async Task<GroupMemberInfo> GetGroupMemberInfo(int groupIdentifier, int userIdentifier)Gets one member's info in a group.
PagedResult<GroupMemberInfo> GetGroupMembers(int groupIdentifier, PagedConfig config = null)Paged list of a group's members.
PagedResult<GroupInfo> GetGroupsByType(GroupType type, PagedConfig config = null)Paged list of groups of a given GroupType.
PagedResult<GroupMemberInfo> GetInvitesInGroup(int groupIdentifier, PagedConfig config = null)Paged list of outstanding invites sent by a group.
PagedResult<JoinedGroupInfo> GetJoinedGroups(PagedConfig config = null)Paged list of groups the logged-in user is in.
async Task<IEnumerable<GameServerInfo>> GetJoinedServers()Lists servers the logged-in user has joined.
async Task<MigrationDetailsResponse> GetLatestEfsMigrationForServer(int serverId)Gets the latest EFS migration details for a server.
async Task<LauncherGameInfoFull> GetLauncherGame(int gameIdentifier)Gets full launcher info for one game.
async Task<UserInfo> GetLinkedAccountForOculusUser(AccountRequestBase request)Gets the Alta account linked to an Oculus user, or null if none.
async Task<UserInfo> GetLinkedAccountForPicoUser(AccountRequestBase request)Gets the Alta account linked to a Pico user, or null if none.
async Task<MembershipStatusResponse> GetMembershipStatus(int userIdentifer)Gets a user's membership status.
async Task<IEnumerable<OculusFriendInfo>> GetOculusFriendships(OculusFriendsList request)Matches a list of Oculus friends to Alta accounts.
async Task<IEnumerable<GameServerInfo>> GetOnlineServers()Lists online servers.
async Task<IEnumerable<GameServerInfo>> GetOpenServers()Lists open servers.
async Task<IEnumerable<OwnedShopItem>> GetOwnedItems()Lists the shop items the logged-in user owns.
async Task<IPAddress> GetPublicIpAddressAsync()Asks the API for the caller's public IP address. Dead now, so it waits for the timeout.
async Task<IEnumerable<GameServerInfo>> GetPublicServers()Lists public servers.
PagedResult<GroupInfo> GetRequestedGroups(PagedConfig config = null)Paged list of groups the logged-in user asked to join.
PagedResult<FriendshipInfo> GetSentFriendRequests(PagedConfig config = null)Paged list of friend requests the logged-in user sent.
async Task<GameServerInfo> GetServerInfo(int serverIdentifier)Gets one server's GameServerInfo.
async Task<IEnumerable<GameServerInfo>> GetServersByName(string name)Searches servers by name.
async Task<IEnumerable<GameServerInfo>> GetServersWithPlayer(int playerId)Lists servers a given player is on.
async Task<Settings> GetSettings(string name)Gets a named settings blob from the API, or null if not found.
async Task<ShopAccountInfo> GetShopAccountDetailsAsync()Gets shop account details for the logged-in user or a given user.
async Task<ShopAccountInfo> GetShopAccountDetailsAsync(int userIdentifier)Gets shop account details for the logged-in user or a given user.
async Task<ShopItemDetailed> GetShopItemAsync(int itemIdentifier)Gets one shop item's details.
async Task<ShopItemSet> GetShopItemSetAsync(string setSku)Gets one shop item set by SKU.
async Task<ShopTokenResponse> GetShopTokenAsync(RequestShopTokenRequest requestShopToken)Requests a shop token.
async Task<T> GetUserAsync<T>(int userIdentifier)Gets a user's info as the given UserInfo type, or null if not found.
async Task<UserInfo> GetUserByUsernameAsync(SearchByUsernameRequest request)Finds a user by username, or null if not found.
async Task<IEnumerable<GroupPermissions>> GetUserPermissionsForGroup(int groupIdentifier, int userIdentifier)Gets a user's permissions in a group.
async Task<IEnumerable<GroupPermissions>> GetUserPermissionsForServer(int serverIdentifier, int userIdentifier)Gets a user's permissions on a server.
async Task<UserStatistics> GetUsersStatistics(int userIdentifer)Gets a user's statistics.
async Task<UserInfoWithPermissions> GetUserWithPermissionsAsync(int userIdentifier)Gets a user with their permissions, or null if not found.
async Task<string> GetVoiceTokenAsync(VoiceChatTokenRequest request)Requests a voice chat token.
async Task<GiftResult> GiftItem(int userIdentifier, string itemSku)Gives a shop item to a user by SKU, with the comment "Gift".
async Task GiveUserRoleAsync(int userIdentifer, GiveRoleRequest giveRoleRequest)Gives a user an account role.
static async Task<Exception> HandleForbiddenOrOtherHttpStatus(HttpResponseMessage response)Logs a failed response and builds a ForbiddenException for 403 or an HttpException otherwise.
UserInfoWithPermissions HandleNewAuthenticationTokens(TokenResultResponse tokens, bool isCallingEvents = true)Uses a set of tokens as the login: sets the auth headers, stores the credentials and schedules a refresh.
static async Task<T> HandleResponse<T>(HttpResponseMessage response)Reads a successful response as JSON, or throws the matching API exception.
async Task<BooleanResponse> HasLinkedAccountForOculusUser(ulong otherAccountId, AccountRequestBase request)Asks whether an Oculus user has a linked Alta account.
async Task<BooleanResponse> HasLinkedAccountForPicoUser(ulong otherAccountId, AccountRequestBase request)Asks whether a Pico user has a linked Alta account.
async Task<BooleanResponse> HasPermissionsInGroup(int groupIdentifier, int userIdentifier, GroupPermissionsCheckRequest request)Asks whether a user has given permissions in a group.
async Task<BooleanResponse> HasPermissionsInServer(int serverIdentifier, int userIdentifier, GroupPermissionsCheckRequest request)Asks whether a user has given permissions on a server.
async Task<GroupMemberInfo> InviteUserToGroup(int groupIdentifier, int userIdentifier)Invites a user to a group.
async Task<bool> IsUserVerifiedAsync(int userIdentifer)Asks whether a user's email is verified.
async Task<ServerJoinResult> JoinServer(int serverIdentifier, JoinServerRequest request)Asks the API to join a server and returns the connection result.
async Task KickUserFromGroup(int userIdentifier, int groupIdentifier)Removes a member from a group.
async Task LeaveGroup(int groupIdentifier)Leaves a group as the logged-in user.
async Task LinkDiscordAccount(LinkAccountRequest request)Links a Discord account to the logged-in user.
async Task LinkLoggedInAccountToOculusUser(AccountRequestBase request)Links the logged-in account to an Oculus user.
async Task LinkLoggedInAccountToPicoUser(AccountRequestBase request)Links the logged-in account to a Pico user.
async Task<UserInfoWithPermissions> LoginAsync(string cachedRefreshToken)Logs in with a username and password request, or refreshes from a cached refresh token string.
async Task<UserInfoWithPermissions> LoginAsync(LoginRequest loginRequest)Logs in with a username and password request, or refreshes from a cached refresh token string.
async Task<UserInfoWithPermissions> LoginWithEmailAsync(LoginWithEmailRequest loginRequest)Logs in with an email and password.
async Task<UserInfoWithPermissions> LoginWithOculusUser(LoginViaLinkedAccountRequest request)Logs in through a linked Oculus account.
async Task<UserInfoWithPermissions> LoginWithPicoUser(LoginViaLinkedAccountRequest request)Logs in through a linked Pico account.
async Task<UserInfoWithPermissions> LoginWithTokenAsync(ClientTokenConfig clientTokenConfig)Logs in with client credentials against accounts.townshiptale.com.
void Logout()Clears the credentials and stops the refresh timer. Makes no request.
async Task PingServerSession(int serverIdentifier, int serverSession)Keeps a server session alive.
async Task<PurchaseResult> PurchaseItem(PurchaseItemTokenRequest request)Buys a shop item with shards.
async Task<QuickCreateResponse> QuickCreateGroupAndServer(CreateGroupAndServerRequest request)Creates a group and its server in one call.
async Task<UserInfoWithPermissions> RefreshLoginAsync()Gets new tokens with the refresh token (PUT api/Sessions).
async Task<UserInfo> RegisterAsync(RegisterRequest registerRequest)Registers a new account.
async Task<GroupMemberInfo> RejectGroupInvite(int groupIdentifier)Declines an invite to a group.
async Task<GroupMemberInfo> RejectGroupJoinRequest(int groupIdentifier, int userIdentifier)Declines a user's request to join a group.
async Task RemoveFriend(int friendIdentifier)Removes a friend.
async Task RequestBufferChange(BufferChangeRequest bufferChangeRequest)Sends a buffer change request to the servers endpoint.
async Task RequestPasswordResetAsync(RequestPasswordResetRequest resetRequest)Asks for a password reset email.
async Task RequestSignupCode(GenerateSignUpCodeRequest signupRequest)Asks for a signup code.
async Task<GroupMemberInfo> RequestToJoinGroup(int groupIdentifier)Asks to join a group.
async Task ResetPasswordAsync(int userId, ResetPasswordRequest resetRequest)Resets a user's password with a reset request.
async Task<GroupMemberInfo> RevokeGroupInvite(int groupIdentifier, int userIdentifier)Cancels an invite a group sent to a user.
async Task<GroupMemberInfo> RevokeGroupJoinRequest(int groupIdentifier)Cancels the logged-in user's request to join a group.
async Task<GroupMemberInfo> RevokeUserBanInGroup(int userIdentifier, int groupIdentifier)Lifts a user's ban from a group.
async Task SendUserVerificationEmailAsync(int userIdentifier, VerificationEmailRequest verificationRequest)Sends a verification email to a user.
async Task SetOnlinePlayers(int serverIdentifier, SetServersOnlinePlayersRequest onlineRequest)Tells the API who is online on a server.
async Task SetServerOffline(int serverIdentifier, bool isForced)Marks a server as stopped, optionally forced.
async Task SetServerOnline(int serverIdentifier)Marks a server as started.
async Task SetSettings(string name, string content)Stores a named settings blob on the API.
async Task<StartServerSessionResponse> StartLocalServer(int serverIdentifier, LaunchLocalServerRequest request)Registers a locally hosted server session.
async Task<StartServerSessionResponse> StartServerSession(int serverIdentifier, string gameVersion)Starts a server session for a game version.
async Task StopLocalServer(int serverIdentifier)Ends a locally hosted server session.
async Task StopServerSession(int serverIdentifier, int serverSession, ShutdownReason endReason)Ends a server session with a shutdown reason.
async Task<string> TestAsync()Calls the API's test endpoint.
async Task UnLinkDiscordAccount(UnlinkAccountRequest request)Unlinks a Discord account.
async Task UnlinkLoggedInAccountToOculusUser(AccountRequestBase request)Always throws NotSupportedException.
async Task UnlinkLoggedInAccountToPicoUser(AccountRequestBase request)Always throws NotSupportedException.
async Task UpdateAchievementForUserAsync(int userId, UpdateAchievementRequest request)Updates a user's achievement progress.
async Task UpdateActionStatForUserAsync(int userId, UpdateActionStatRequest request)Updates a user's action stat.
async Task<GroupInfoDetailed> UpdateGroupInfo(int groupIdentifier, EditGroupRequest request)Edits a group's info (PATCH).
async Task<ShopItemDetailed> UpdateShopItemAsync(int itemIdentifier, ShopItemDetailed itemToUpdate)Updates a shop item.
async Task<ShopItemSet> UpdateShopItemSetAsync(string setSku, ItemSetRequest request)Updates a shop item set by SKU.
async Task UploadFileAsync(string uploadUrl, FileStream file, string fileName)Uploads a file with PUT to a given upload URL.
async Task ValidateEmail(EmailValidationRequest request)Checks an email address is acceptable.
async Task<BooleanResponse> ValidateIdentityToken(string token)Asks whether a short-lived identity token is valid. The server's join check uses it.
async Task<BooleanResponse> ValidateIdentityTokenAsync(IdentityTokenValidationRequest validationRequest)Validates an identity token through api/Security/validate.
async Task<ValidateItemOwnershipResponse> ValidateItemsOwnershipAsync(ValidateItemOwnershipRequest validateItemOwnershipRequest)Checks that a user owns the given shop items.
async Task<string> ValidateUsername(UsernameValidationRequest request)Checks a username is acceptable.
async Task<UserInfo> VerifyUserAsync(int userIdentifer, VerifyUserRequest verifyRequest)Posts a verification request for a user and returns the updated user.
async Task VerifyUsersMemberShip(int userId)Calls the membership verify endpoint for a user.
28 private and internal methods
MemberWhat it is
private void CancelRefreshRoutine()Cancels the scheduled refresh token renewal, if one is pending.
private static async Task<ApiErrorException> CreateApiErrorExceptionAsync(HttpResponseMessage response)Reads an error response body as an ApiError and wraps it in an ApiErrorException; falls back to the raw text if it can't be parsed.
private HttpClient CreateHttpClient(string baseUrl, float timeOutInSeconds)Makes an HttpClient with the retry handler, base URL, a timeout four times the per-try timeout, the JSON accept header, the x-api-key header and the user agent.
internal async Task EnqueueRecentPlayerInteraction(RecentPlayerInteractionRequest request)Queues a recent player interaction for the batched api/recent-players/batch call.
private async Task EnsureLoggedInAsync()Run before every authorized call: waits for any refresh in progress, throws if not logged in, and refreshes the session when the access token has 15 seconds or less left.
private void GenerateHttpClients()Disposes and recreates the default, authorized and authentication HTTP clients.
internal async Task<IEnumerable<RecentPlayerInteractionInfo>> GetAllRecentPlayerInteractions(int limit = 25)Gets the logged-in user's recent player interactions, up to limit (default 25).
internal async Task<IEnumerable<RecentPlayerInteractionInfo>> GetAllRecentPlayerInteractionsOnServer(int serverId, int limit = 25)Gets recent player interactions on one server, up to limit (default 25).
private async Task<HttpResponseMessage> GetFriendRequestsInternal(PagedConfig config)Fetches one page of friend requests received, for GetFriendRequests.
private async Task<HttpResponseMessage> GetFriendsForUserInternal(int userIdentifier, PagedConfig config = null)Fetches one page of another user's friends, for GetFriendsForUser.
private async Task<HttpResponseMessage> GetFriendsInternal(PagedConfig config = null)Fetches one page of the logged-in user's friends, for GetFriends.
internal async Task<IEnumerable<PlayerReportInfo>> GetPlayerReports(ReportStatus? statusFilter = null, int? serverFilter = null)Gets player reports, optionally filtered by status and server.
private async Task<HttpResponseMessage> GetSentFriendRequestsInternal(PagedConfig config)Fetches one page of friend requests sent, for GetSentFriendRequests.
private static async Task HandleEmptyResponse(HttpResponseMessage response)Returns on success; otherwise throws a forbidden or HTTP status exception.
private static async Task HandleEmptyResponseWithBadRequest(HttpResponseMessage response)Returns on success; throws an ApiErrorException on 400, otherwise a forbidden or HTTP status exception.
private static async Task HandleEmptyResponseWithBadRequestOrNotFound(HttpResponseMessage response)Returns on success; throws an ApiErrorException on 400 or 404, otherwise a forbidden or HTTP status exception.
private static Exception HandleForbiddenOrOtherHttpStatus(HttpWebResponse response)Logs a failed response and builds a ForbiddenException for 403 or an HttpException otherwise.
private async Task<UserInfoWithPermissions> HandleRefreshTokenResponseAsync(HttpResponseMessage response)Stores the new tokens from a successful refresh response, or throws.
private static async Task<T> HandleResponseWithBadRequestOrNotFound<T>(HttpResponseMessage response)Reads the JSON body on success; throws an ApiErrorException on 400 or 404, otherwise a forbidden or HTTP status exception.
private void HandleTimeout(HttpRequestMessage request)On a request timeout, recreates the HTTP clients and keeps their auth headers, unless it already did so within five timeouts' time.
private async Task<UserInfoWithPermissions> HandleTokenResponseAsync(HttpResponseMessage response)Stores the tokens from a successful login response; throws an ApiErrorException on 400 or another exception otherwise.
internal async Task<PlayerReportInfo> ModifyPlayerReport(Guid reportIdentifer, ModifyReportRequest request)Patches a player report by its identifier.
private void OnNewCredentials(LoginCredentials newCredentials, bool isCallingEvents = true)Stores new credentials, optionally raises CredentialsChanged, and schedules a refresh one hour before the refresh token expires.
private async Task<UserInfoWithPermissions> RefreshLoginSessionUsingTokenAsync(JwtSecurityToken refreshToken)Refreshes the session, throwing if the refresh token has 15 seconds or less left.
internal async Task<PlayerReportInfo> ReportPlayer(CreateReportRequest request)Files a player report.
private async void ScheduleAction(Action action, DateTime executionTime, CancellationToken cancelToken)Runs an action at a UTC time unless cancelled first, waiting in chunks for long delays; logs a warning if the time has passed.
private void SetAuthenticationHeaderOnAuthenticationClient(string refreshTokenString)Sets the refresh token as the bearer token on the authentication client.
private async void UpdateRefreshTokenAsync()Scheduled callback that refreshes the login.

Used in​

Members of other types that take, return or hold a LowLevelApiClient: