MemberAPI¶
Interface MemberAPIExperimental
deleteMemberProfileEntry(key: string): Promise<void>;
getMemberName(): string;
getMembers(): number[];
requestMemberActions(memberId: number): Promise<MemberAction[]>;
requestMemberProperties(memberId: number): Promise<MemberProperties>;
setMemberName(name: string): void;
setMemberProfileEntry(key: string, value: Serializable): Promise<void>;
useMemberAction<A extends MemberAction>(
memberId: number,
action: A,
options?: MemberActionsToOptionsMap[A],
): Promise<void>;
}
Hierarchy (View Summary)
- MemberAPI
Methods
delete Member Profile Entry
ExperimentalDeletes a profile entry of the local member.
Triggers a MemberProfileEntryChangedEvent if successful.
Parameters
- key: string
The key of the profile entry to delete.
Returns Promise<void>
A promise that resolves when the profile entry has been deleted.
- key: string
get Member Name
ExperimentalGets the name of the local member.
Returns string
The name of the local member, or undefined if not set.
get Members
ExperimentalGets a list of all member IDs in the current space. The first entry of the list is always the local member (i.e. the client itself).
Returns number[]
An array of member IDs.
request Member Actions
ExperimentalRequests the actions available on a member.
Get notified about changes to available actions on a member via the MemberActionAddedEvent and MemberActionRemovedEvent.
Parameters
- memberId: number
The ID of the member to request actions for.
Returns Promise<MemberAction[]>
A promise that resolves to an array of member actions.
- memberId: number
request Member Properties
ExperimentalRequests the properties of a member.
Parameters
- memberId: number
The ID of the member to request the properties for.
Returns Promise<MemberProperties>
A promise that resolves to the member properties, or undefined if the member does not exist.
- memberId: number
set Member Name
ExperimentalSets the name of the local member.
Triggers a MemberChangedEvent if the name changes.
Parameters
- name: string
The new name for the local member.
Returns void
- name: string
set Member Profile Entry
ExperimentalSets a profile entry of the local member.
Triggers a MemberProfileEntryChangedEvent if the profile entry changes or is created.
Parameters
- key: string
The key of the profile entry to set.
- value: Serializable
The value to set for the profile entry.
Returns Promise<void>
A promise that resolves when the profile entry has been set.
- key: string
use Member Action
- useMemberAction<A extends MemberAction>(
memberId: number,
action: A,
options?: MemberActionsToOptionsMap[A],
): Promise<void>ExperimentalUses an action on a member.
Get notified about changes to available actions on a member via the MemberActionAddedEvent and MemberActionRemovedEvent.
Type Parameters
- A extends MemberAction
Parameters
- memberId: number
The ID of the member to use the action on.
- action: A
The action to use.
Optionaloptions: MemberActionsToOptionsMap[A]Optional parameters for the action.
Returns Promise<void>
A promise that resolves when the action has been used.
Member API
Overview
The Member API provides methods to interact with members in the current space for live collaboration. Members represent clients connected to the space. You can retrieve information about members, manage custom data associated with them, and perform actions on them.
Quick Start
Member IDs
Every member has an ID, which is a randomly generated unique number. The member IDs can be obtained by calling getMembers. The first entry of the members list is always the local member (i.e. the client itself).
Custom member data
You can manage custom data at the profile entries of a member using the setMemberProfileEntry and deleteMemberProfileEntry methods. This data is stored in the
profilefield of the MemberProperties object and will be synced with other members in the same space. Other members can subscribe to changes of the profile entries of a member via the MemberProfileEntryChangedEvent.Member actions
You can request and use actions available on a member using the requestMemberActions and useMemberAction methods. Member actions allow you to perform predefined operations on members, see MemberAction for a list of available actions. Members can subscribe to changes of available actions on a member via the MemberActionAddedEvent and MemberActionRemovedEvent.
Events
The Member API emits the following events: