To manipulate the current user (as identified by the API key provided), access the me object on the SDK. Through that, you can invoke all user methods mentioned, like this:
const profile = await sdk.me.me()
Read methods
Get current user profile
Fetches the current user's profile based on the API key provided to the Supernova instance.
async me(): Promise<User>
Logout
Invalidates all session keys for the current user, effectively logging them out from all devices.
async logout(): Promise<void>
Create/update methods
Update user profile
Updates the profile of the current user based on the API key provided to the Supernova instance.
async updateProfile(
userId: string,
profile: UserProfileUpdateModel
): Promise<void>
Update user avatar
Updates the avatar of the current user.
async updateAvatar(userId: string, avatar: File): Promise<void>
Delete methods
Delete current user
Deletes the current user based on the API key provided to the Supernova instance. This action also removes all owned workspaces and updates memberships where the user belongs.
async deleteMe(userId: string): Promise<void>
Check if user can be deleted
Checks whether the current user can be deleted. Certain restrictions may apply that will prevent user deletion.
async canDeleteMe(userId: string): Promise<boolean>
Delete user avatar
Deletes the avatar of the current user.
async deleteAvatar(userId: string): Promise<void>