Skip to main content

AccountHub

WebSocket hub for account operations. All operations are scoped to the authenticated user's account.

Endpoint: /accountHub

Authorization: All methods require authentication ([Authorize])

Methods

GetAccount

Get the authenticated user's account info including unlocked cosmetics and achievements.

public async Task<Account> GetAccount()

Returns: Account

{
accountId: string; // GUID
unlockedCosmetics: string[]; // Cosmetic IDs
unlockedAchievements: string[]; // Achievement IDs
}

Example:

const account = await connection.invoke("GetAccount");
console.log(`Account: ${account.accountId}`);
console.log(`Cosmetics: ${account.unlockedCosmetics.length}`);

GetCharacters

Get all characters for the authenticated user's account across all seasons.

public async Task<IReadOnlyList<CharacterSummary>> GetCharacters()

Returns: CharacterSummary[]

{
characterId: string; // GUID
seasonId: string; // Season identifier
name: string;
level: number;
restrictions: CharacterRestrictions; // None = 0, Hardcore = 1, SoloSelfFound = 2
isDead: boolean;
createdAt: string; // ISO 8601
}

Example:

const characters = await connection.invoke("GetCharacters");
characters.forEach(c => {
console.log(`${c.name} (Level ${c.level}) - ${c.seasonId}`);
});

CreateCharacter

Create a new character for the authenticated user in a specific season.

public async Task<CharacterSummary> CreateCharacter(
string seasonId,
string name,
CharacterRestrictions restrictions = CharacterRestrictions.None)

Parameters:

NameTypeDescription
seasonIdstringTarget season (e.g., "standard", "season-1")
namestringCharacter name (max 50 chars)
restrictionsCharacterRestrictionsOptional restrictions (default: None)

CharacterRestrictions Enum:

enum CharacterRestrictions {
None = 0,
Hardcore = 1, // Permadeath (migrates to permanent on death)
SoloSelfFound = 2 // Cannot trade with other players
}

Returns: CharacterSummary

Example:

// Create a hardcore character
const character = await connection.invoke(
"CreateCharacter",
"season-1",
"IronMan",
1 // Hardcore
);

Errors:

  • "Season '{seasonId}' not found." - Invalid season ID
  • "Cannot create characters in season..." - Season not Active or Upcoming

HasCosmetic

Check if a cosmetic is unlocked for the authenticated user.

public async Task<bool> HasCosmetic(string cosmeticId)

Parameters:

NameTypeDescription
cosmeticIdstringCosmetic identifier

Returns: boolean


UnlockCosmetic

Unlock a cosmetic for the authenticated user's account.

public async Task UnlockCosmetic(string cosmeticId)

Parameters:

NameTypeDescription
cosmeticIdstringCosmetic identifier

HasAchievement

Check if an achievement is unlocked for the authenticated user.

public async Task<bool> HasAchievement(string achievementId)

UnlockAchievement

Unlock an achievement for the authenticated user's account.

public async Task UnlockAchievement(string achievementId)

Account Structure

Ownership Model

  • The AccountHub operates exclusively on the authenticated user's account
  • No account ID parameter is needed - the user ID comes from the JWT token
  • Characters are owned by accounts and verified via AccountGrain.GetCharactersAsync()