UNPKG

agora-edu-core

Version:

Core APIs for building an online classroom

265 lines (264 loc) 6.25 kB
import { EduStoreBase } from '../base'; import { GroupDetail, GroupState, GroupUser, PatchGroup } from './type'; /** * `GroupStore` 类提供分组讨论功能相关的能力。 */ /** @en * The `GroupStore` class provides abilities related to breakout rooms. */ export declare class GroupStore extends EduStoreBase { /** * @internal */ /** @en * @internal */ static readonly MAX_GROUP_COUNT = 20; /** * @internal */ /** @en * @internal */ static readonly MIN_GROUP_COUNT = 2; /** * @internal */ /** @en * @internal */ static readonly MAX_PER_GROUP_PERSON = 15; /** * @internal */ /** @en * @internal */ static readonly CMD_PROCESS_PREFIX = "groups-"; private _currentGroupUuid?; private _inviting; private _disposers; private _operationQueue; /** * 分组状态 */ /** @en * The current state of grouping */ state: GroupState; /** * 分组详情 */ /** @en * Details of groups */ groupDetails: Map<string, GroupDetail>; /** Methods */ private _handleRoomPropertiesChange; private _getProgress; private _setDetails; private _checkSubRoom; /** * 新建小组 * @param groupDetail 分组配置 **/ /** @en * Creates a group * @param groupDetail the grouping options */ addGroups(groupDetails: (GroupDetail & { groupUuid?: string; })[], inProgress?: boolean): Promise<void>; /** * 移除小组 * @param groups 小组 ID 列表 **/ /** @en * Removes groups * @param groups A list of group IDs */ removeGroups(groups: string[]): Promise<void>; /** * 更新分组配置 * @param groups 分组配置数组 **/ /** @en * Updates the grouping options * @param groups An array of the grouping options */ updateGroupInfo(groups: PatchGroup[]): Promise<void>; /** * 开启分组讨论 * @param groupDetails 分组配置数组 **/ /** @en * Starts the breakout session * @param groupDetails An array of the grouping options */ startGroup(groupDetails: GroupDetail[], syncBoardScenes?: boolean): Promise<void>; /** * 结束分组讨论 **/ /** @en * Stops the breakout session */ stopGroup(): Promise<void>; /** * 更新小组成员列表 * @param patches 更新配置 * @param sendInvitation 是否发送邀请 **/ /** @en * Updates the grouping options * @param patches The update options * @param sendInvitation Whether to send an invitation */ updateGroupUsers(patches: PatchGroup[], sendInvitation?: boolean): Promise<void>; /** * 将用户从小组中移除 * @param fromGroupUuid 组 ID * @param users 用户 ID 列表 **/ /** @en * Removes users from a group * @param fromGroupUuid The group ID * @param users A list of user IDs * */ removeGroupUsers(fromGroupUuid: string, users: string[]): Promise<void>; /** * * 将用户从某小组移入另一小组 * @param fromGroupUuid 原组 ID * @param toGroupUuid 目标组 ID * @param users 用户 ID 列表 **/ /** @en * Moves users from a group to another group * @param fromGroupUuid The ID of the group from which the users are * @param toGroupUuid The ID of the group to which the users are moved * @param users A list of user IDs */ moveUsersToGroup(fromGroupUuid: string, toGroupUuid: string, users: string[]): Promise<void>; /** * * 接受加入小组的邀请 * @param groupUuid 组 ID * **/ /** @en * Accepts the invitation of joining a group * @param groupUuid The group ID */ acceptGroupInvite(groupUuid: string): Promise<void>; /** * * 拒绝加入小组的邀请 * @param groupUuid 组 ID **/ /** @en * Rejects the invitation of joining a group * @param groupUuid The group ID * */ rejectGroupInvite(groupUuid: string): Promise<void>; /** * * 进入子房间 * @param groupUuid 组 ID **/ /** @en * Joins a group * @param groupUuid The group ID */ joinSubRoom(groupUuid: string): void; /** * * 用户主动从某房间移动至另一房间 * @param fromGroupUuid 原组 ID * @param toGroupUuid 目标组 ID * **/ /** @en * A user moves from a group to another group * @param fromGroupUuid The ID of the group from which the user is * @param toGroupUuid The ID of the group to which the user moves */ moveIntoSubRoom(fromGroupUuid: string, toGroupUuid: string): void; /** * 离开小组 **/ /** @en * Leaves the group */ leaveSubRoom(): void; /** * * 发送全体消息 * @param messageText 消息 * **/ /** @en * Sends a broadcast message * @param messageText The message text */ broadcastMessage(messageText: string): void; /** * 执行队列任务 * @returns */ private _run; /** * @internal * @deprecated * * 是否发送邀请 **/ /** @en * @internal * @deprecated * * Whether to send an invitation */ get inviting(): boolean; /** * 当前所在小组 * **/ /** @en * The current group */ get currentSubRoom(): string | undefined; /** * * 用户所在组 ID 映射关系 **/ /** @en * The mapping relation between the group ID and the user ID */ get groupUuidByUserUuid(): Map<string, string>; /** * * 返回 userUuid 组成的 map 数据 **/ /** @en * The map data by userUuid */ get userByUuid(): Map<string, GroupUser>; private _addEventHandlers; private _removeEventHandlers; /** * @internal */ /** @en * @internal */ onInstall(): void; /** * @internal */ /** @en * @internal */ onDestroy(): void; }