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?
options?
Returns
Promise<Profile>
Example
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?
options?
Returns
Promise<ProfileSession[]>
Example
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?
Returns
Promise<void>
Example
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
options?
Returns
Promise<Profile>
Example
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.