Skip to content

SDK API Reference / UserSDK

Class: UserSDK

User API - manage user information

User list is cached locally per-profile to avoid repeated API calls. Cache is automatically refreshed when an unknown ID or email is encountered.

Methods

buildEmailToIdMap()

buildEmailToIdMap(): Promise<Map<string, number>>

Build email-to-ID lookup map

Uses cached user list.

Returns

Promise<Map<string, number>>

Map from lowercase email to user ID


buildIdToEmailMap()

buildIdToEmailMap(): Promise<Map<number, string>>

Build ID-to-email lookup map

Uses cached user list.

Returns

Promise<Map<number, string>>

Map from user ID to email


buildUserMaps()

buildUserMaps(): Promise<{ emailToId: Map<string, number>; idToEmail: Map<number, string>; }>

Build both email-to-ID and ID-to-email lookup maps in one call

More efficient when both maps are needed.

Returns

Promise<{ emailToId: Map<string, number>; idToEmail: Map<number, string>; }>

Object containing both maps


clearCache()

clearCache(): void

Clear the user cache for this profile

Returns

void


findByEmail()

findByEmail(email): Promise<UserInfo | undefined>

Find user by email (case-insensitive)

Parameters

email

string

Email address to search for

Returns

Promise<UserInfo | undefined>

User information if found, undefined otherwise


findById()

findById(id): Promise<UserInfo | undefined>

Find user by ID

Parameters

id

number

User ID to search for

Returns

Promise<UserInfo | undefined>

User information if found, undefined otherwise


getCurrent()

getCurrent(): Promise<UserInfo>

Get current authenticated user information

Returns

Promise<UserInfo>

User information including email, name, and permissions


list()

list(refresh): Promise<UserInfo[]>

List all users in the account

Uses cached data if available. Use refresh=true to force API call.

Parameters

refresh

boolean = false

Force refresh from API (default: false)

Returns

Promise<UserInfo[]>

Array of user information