Skip to main content

EnkaClient

class EnkaClient

constructor

new EnkaClient(options)
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
optionsPartial<EnkaClientOptions>✔️{}Options for the client

Properties

options

The options the client was instantiated with

Type: EnkaClientOptions


cachedAssetsManager

The genshin cache data manager of the client

Type: CachedAssetsManager


Methods

fetchUser

async

Returns: Promise<User | DetailedUser>

  • DetailedUser if collapse is false, User if collapse is true
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
uidnumber | stringIn-game UID of the user
collapse✔️falseWhether to fetch rough user information (Very fast)

fetchEnkaProfile

async

Returns: Promise<EnkaProfile>

  • the Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname

fetchAllEnkaUsers

async

Returns: Promise<EnkaUser[]>

  • the all game accounts added to the Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname
hoyoTypeHoyoType | null✔️null

fetchGenshinEnkaUsers

async

Returns: Promise<EnkaUser[]>

  • the genshin accounts added to the Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname

fetchStarRailEnkaUsers

async

Returns: Promise<EnkaUser[]>

  • the starrail accounts added to the Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname

fetchEnkaUser

async

Returns: Promise<EnkaUser>

  • the game account added to the Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname
hashstringEnkaUser hash

fetchEnkaUserBuilds

async

This requires this instance with starrailClient.
And the starrailClient option in EnkaClientOptions must be an instance of StarRail from starrail.js.
TSUnknownKeyword or unknown type in the return type can be replaced with StarRailCharacterBuild.

Returns: Promise<{[characterId: string]: (GenshinCharacterBuild | TSUnknownKeyword)[]}>

  • the genshin and starrail character builds including saved builds in Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname
hashstringEnkaUser hash

fetchEnkaUserGenshinBuilds

async

Returns: Promise<{[characterId: string]: GenshinCharacterBuild[]}>

  • the genshin character builds including saved builds in Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname
hashstringEnkaUser hash

fetchEnkaUserStarRailBuilds

async

This requires this instance with starrailClient.
And the starrailClient option in EnkaClientOptions must be an instance of StarRail from starrail.js.
TSUnknownKeyword or unknown type in the return type can be replaced with StarRailCharacterBuild.

Returns: Promise<{[characterId: string]: TSUnknownKeyword[]}>

  • the starrail character builds including saved builds in Enka.Network account
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
usernamestringenka.network username, not in-game nickname
hashstringEnkaUser hash

getAllCharacters

Returns: CharacterData[]

  • all playable character data

getCharacterById

Returns: CharacterData

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of the character
skillDepotIdnumber | string✔️Specifies one or zero elements for Traveler

getAllWeapons

Returns: WeaponData[]

  • all weapon data
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
excludeInvalidWeapons✔️true

getWeaponById

Returns: WeaponData

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of the weapon

getAllCostumes

Returns: Costume[]

  • all costume data
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
includeDefaults✔️falseWhether to include default costumes

getCostumeById

Returns: Costume

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of the costume

getAllMaterials

Returns: Material[]

  • all material data

getMaterialById

Returns: Material

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of the material

getAllNameCards

Returns: NameCard[]

  • all name card data

getNameCardById

Returns: NameCard

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of the name card

getAllArtifacts

Returns: ArtifactData[]

  • all artifact data
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
highestRarityOnly✔️falseWhether to return only the rarest of artifacts of the same type

getArtifactById

Returns: ArtifactData

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of the artifact

getAllArtifactSets

Returns: ArtifactSet[]

  • all artifact set data

getArtifactSetById

Returns: ArtifactSet

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber | stringThe id of artifact set

close

Clear all running tasks in the client.

Returns: void