import { NEResult, Controller } from './commonTypes' export type NESeatRequestItem = { /** 麦位位置 */ index: number /** 申请人的用户ID */ user: string /** 申请人的用户名 */ userName?: string /** 麦位图标 */ icon?: string /** 扩展字段 */ ext?: string } export type NESeatInvitationItem = { /** 邀请人的用户ID */ user: string /** 邀请的麦位位置 */ index: number } export type NESeatItem = { /** 麦位位置 */ index: number /** 麦位状态 */ status: number /** 麦位上的用户ID */ user?: string /** 麦位上的用户名 */ userName?: string /** 麦位图标 */ icon?: string /** 麦位类型 */ onSeatType: number /** 更新时间 */ updated: number /** 扩展字段 */ ext?: string } export type NESeatInfo = { /** 麦位创建者 */ creator: string /** 麦位管理员 */ managers: string[] /** 麦位列表 */ seatItems: NESeatItem[] } export interface NESeatEventListener { /** * 麦位管理员新增。 * @param managers 新增的麦位管理员列表。 */ onSeatManagerAdded?: (managers: string[]) => void /** * 麦位管理员移除。 * @param managers 移除的麦位管理员列表。 */ onSeatManagerRemoved?: (managers: string[]) => void /** * 成员[user]提交了位置为[seatIndex]的麦位申请。 * @param seatIndex 麦位位置,**-1**表示未指定位置。 * @param user 申请人的用户ID。 * @param ext 扩展字段。 */ onSeatRequestSubmitted?: ( seatIndex: number, user: string, ext?: string ) => void /** * 成员[user]取消了位置为[seatIndex]的麦位申请。 * @param seatIndex 麦位位置,**-1**表示未指定位置。 * @param user 申请人的用户ID。 * @param ext 扩展字段。 */ onSeatRequestCancelled?: ( seatIndex: number, user: string, ext?: string ) => void /** * 管理员通过了成员[user]的麦位申请,位置为[seatIndex]。 * @param seatIndex 麦位位置。 * @param user 申请人的用户ID。 * @param operateBy 同意该申请的用户ID。 * @param isAutoAgree 是否为自动通过邀请。当关闭麦位申请的审批模式时,该值为true。 * @param ext 扩展字段。 */ onSeatRequestApproved?: ( seatIndex: number, user: string, operateBy: string, isAutoAgree: boolean, ext?: string ) => void /** * 管理员拒绝了成员[user]的麦位申请,位置为[seatIndex]。 * @param seatIndex 麦位位置,**-1**表示未指定位置。 * @param user 申请人的用户ID。 * @param operateBy 拒绝该申请的用户ID。 * @param ext 扩展字段。 */ onSeatRequestRejected?: ( seatIndex: number, user: string, operateBy: string, ext?: string ) => void /** * [operateBy]向成员[user]发送上麦邀请,位置为[seatIndex]。 * @param seatIndex 麦位位置,**-1**表示未指定位置。 * @param user 被邀请人。 * @param operateBy 操作人。 */ onSeatInvitationReceived?: ( seatIndex: number, user: string, operateBy: string ) => void /** * [operateBy]取消了对成员[user]的上麦邀请,位置为[seatIndex]。 * @param seatIndex 麦位位置,**-1**表示未指定位置。 * @param user 被邀请人。 * @param operateBy 操作人。 */ onSeatInvitationCancelled?: ( seatIndex: number, user: string, operateBy: string ) => void /** * 成员[user]接受了位置为[seatIndex]的上麦邀请。 * @param seatIndex 麦位位置。 * @param user 被邀请人。 * @param isAutoAgree 是否为自动接收邀请。当关闭麦位邀请的确认模式时,该值为true。 */ onSeatInvitationAccepted?: ( seatIndex: number, user: string, isAutoAgree: boolean ) => void /** * 成员[user]拒绝了位置为[seatIndex]的上麦邀请。 * @param seatIndex 麦位位置,**-1**表示未指定位置。 * @param user 被邀请人。 */ onSeatInvitationRejected?: (seatIndex: number, user: string) => void /** * 成员下麦,位置为[seatIndex]。 * @param seatIndex 麦位位置。 * @param user 下麦成员。 */ onSeatLeave?: (seatIndex: number, user: string) => void /** * 成员[user]被[operateBy]从位置为[seatIndex]的麦位踢掉。 * @param seatIndex 麦位位置。 * @param user 成员。 * @param operateBy 操作人。 */ onSeatKicked?: (seatIndex: number, user: string, operateBy: string) => void /** * 麦位变更通知。 * @param seatItems 麦位列表。 */ onSeatListChanged?: (seatItems: NESeatItem[]) => void } export interface NERoomSeatController extends Controller { /** * 成员申请指定位置为seatIndex的麦位,位置从1开始。 如果当前成员为管理员,则会自动通过申请 * @param seatIndex 麦位位置 * @param exclusive 是否独占麦位,如果麦位为独占模式,则在管理员处理该请求之前,其他人无法申请该麦位 * @param ext 扩展字段 */ submitSeatRequest: ( seatIndex?: number, exclusive?: boolean, ext?: string ) => Promise> /** * 成员取消申请麦位 */ cancelSeatRequest: () => Promise> /** * 成员主动下麦 */ leaveSeat: () => Promise> /** * 管理员批准成员user的上麦请求,非管理员执行该操作会失败 * @param user 被批准的用户ID */ approveSeatRequest: (user: string) => Promise> /** * 管理员拒绝成员user的上麦请求,非管理员执行该操作会失败 * @param user 申请人的用户ID */ rejectSeatRequest: (user: string) => Promise> /** * 管理员踢出麦位上的成员 * @param user 被踢出的用户ID */ kickSeat: (user: string) => Promise> /** * 管理员向成员[user]发送上麦邀请,指定位置为[seatIndex],非管理员执行该操作会失败。 * @param seatIndex 麦位位置 * @param exclusive 是否独占麦位。如果麦位为独占模式,则在管理员处理该请求之前,其他人无法申请该麦位 * @param user 麦上的用户ID */ sendSeatInvitation: ( seatIndex?: number, exclusive?: boolean, user?: string ) => Promise> /** * 管理员取消对成员user的上麦邀请,非管理员执行该操作会失败 * @param user 被取消邀请的用户ID */ cancelSeatInvitation: (user: string) => Promise> /** * 成员接受管理员的上麦邀请 */ acceptSeatInvitation: () => Promise> /** * 成员拒绝管理员的上麦邀请 */ rejectSeatInvitation: () => Promise> /** * 管理员关闭指定位置的麦位,非管理员执行该操作会失败 * @param seatIndices 待关闭的麦位位置列表 */ closeSeats: (seatIndices: number[]) => Promise> /** * 管理员打开指定位置的麦位,非管理员执行该操作会失败 * @param seatIndices 待打开的麦位位置列表 */ openSeats: (seatIndices: number[]) => Promise> /** * 切换麦位 * @param seatIndex 麦位位置 */ changeSeatIndex: (seatIndex: number) => Promise> /** * 添加麦位管理员 * @param user 管理员用户ID */ addManager: (user: string) => Promise> /** * 移除麦位管理员 * @param user 管理员用户ID */ removeManager: (user: string) => Promise> /** * 获取麦位状态 */ getSeatInfo: () => Promise> /** * 获取麦位申请列表 */ getSeatRequestList: () => Promise> /** * 获取麦位邀请列表 */ getSeatInvitationList: () => Promise> /** * 添加麦位事件监听器。 * @param listener 监听器。 */ addSeatEventListener: (listener: NESeatEventListener) => void /** * 移除麦位事件监听器。 * @param listener 监听器。 */ removeSeatEventListener: (listener: NESeatEventListener) => void }