This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk / ProfileApi

ProfileApi ​

The player's profile and sessions. All methods require login.

Methods ​

get() ​

get(params?, options?): Promise<Profile>

The logged-in player's profile.

Parameters ​

params? ​

NoParams

options? ​

CallOptions

Returns ​

Promise<Profile>

Example ​

ts
const me = await enginex.profile.get()
console.log(me.displayName, me.cpf) // 'Ana S.', '***.456.789-**'

Throws ​

UNAUTHENTICATED without a session (or if it cannot be renewed).


listSessions() ​

listSessions(params?, options?): Promise<ProfileSession[]>

The player's login sessions.

Parameters ​

params? ​

NoParams

options? ​

CallOptions

Returns ​

Promise<ProfileSession[]>

Example ​

ts
const sessions = await enginex.profile.listSessions()
const others = sessions.filter((s) => !s.current)

Throws ​

UNAUTHENTICATED without a session.


revokeSession() ​

revokeSession(input, options?): Promise<void>

Ends a login session (another device).

Parameters ​

input ​
sessionId ​

string

options? ​

CallOptions

Returns ​

Promise<void>

Example ​

ts
await enginex.profile.revokeSession({ sessionId: session.id })

Throws ​

UNAUTHENTICATED without a session; NOT_FOUND if the id does not exist.


update() ​

update(input, options?): Promise<Profile>

Updates username and/or displayName and returns the complete, already updated profile.

Parameters ​

input ​

UpdateProfileInput

options? ​

CallOptions

Returns ​

Promise<Profile>

Example ​

ts
const me = await enginex.profile.update({ displayName: 'Ana S.' })

Throws ​

INVALID_ARGUMENT (400) for an empty field or invalid body; UNAUTHENTICATED without a session; gateway errors for a username already in use.