import type { NativeEventEmitter } from 'react-native'; import type { ChatRoomEventListener } from './ChatEvents'; import { Native } from './__internal__/Native'; import { ChatPageResult } from './common/ChatPageResult'; import { ChatRoom } from './common/ChatRoom'; import { ChatCursorResult } from './common/ChatCursorResult'; /** * The chat room manager class, which manages user joining and exiting the chat room, retrieving the chat room list, and managing member privileges. */ export declare class ChatRoomManager extends Native { private static TAG; constructor(); private _roomListeners; private _roomSubscriptions; setNativeListener(event: NativeEventEmitter): void; private invokeContactListener; /** * Add room event listener. * * @param listener The listener to be added. */ addRoomListener(listener: ChatRoomEventListener): void; /** * Remove room event listener * * @param listener The listener to be deleted. */ removeRoomListener(listener: ChatRoomEventListener): void; /** * Clear all room event listener */ removeAllRoomListener(): void; /** * Joins the chat room. * * To exit the chat room, call {@link #leaveChatRoom(String)}. * * @param roomId The ID of the chat room to join. * * @throws A description of the exception. See {@link ChatError}. */ joinChatRoom(roomId: string): Promise; /** * Leaves the chat room. * * @param roomId The ID of the chat room to leave. * * @throws A description of the exception. See {@link ChatError}. */ leaveChatRoom(roomId: string): Promise; /** * Gets chat room data from the server with pagination. * * @param pageNum The page number, starting from 1. * @param pageSize The number of records per page. * @returns Chat room data. See {@link ChatPageResult}. * * @throws A description of the exception. See {@link ChatError}. */ fetchPublicChatRoomsFromServer(pageNum?: number, pageSize?: number): Promise>; /** * Gets the details of the chat room from the server. * By default, the details do not include the chat room member list. * * @param roomId The chat room ID. * @returns The chat room instance. Returns undefined if the room does not exist. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomInfoFromServer(roomId: string): Promise; /** * Gets the chat room in the cache. * * @param roomId The chat room ID. * @returns The chat room instance. Returns undefined if the room does not exist. * * @throws A description of the exception. See {@link ChatError}. */ getChatRoomWithId(roomId: string): Promise; /** * Creates a chat room. * * @param subject The chat room subject. * @param desc The chat room description. * @param welcomeMsg A welcome message that invites users to join the chat room. * @param members The list of members invited to join the chat room. * @param maxCount The maximum number of members allowed to join the chat room. * @returns The chat room instance. * * @throws A description of the exception. See {@link ChatError}. */ createChatRoom(subject: string, desc?: string, welcomeMsg?: string, members?: Array, maxCount?: number): Promise; /** * Destroys a chat room. * * Only the chat room owner can call this method. * * @param roomId The chat room ID. * * @throws A description of the exception. See {@link ChatError}. */ destroyChatRoom(roomId: string): Promise; /** * Changes the chat room subject. * * Only the chat room owner can call this method. * * @param roomId The chat room ID. * @param subject The new subject of the chat room. * * @throws A description of the exception. See {@link ChatError}. */ changeChatRoomSubject(roomId: string, subject: string): Promise; /** * Modifies the chat room description. * * Only the chat room owner can call this method. * * @param roomId The chat room ID. * @param description The new description of the chat room. * * @throws A description of the exception. See {@link ChatError}. */ changeChatRoomDescription(roomId: string, description: string): Promise; /** * Gets the chat room member list. * * @param roomId The chat room ID. * @param cursor The cursor position from which to start getting data. * @param pageSize The number of members per page. * @returns The list of chat room members. See {@link ChatCursorResult}. If `ChatCursorResult.cursor` is an empty string (""), all data is fetched. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomMembers(roomId: string, cursor?: string, pageSize?: number): Promise>; /** * Mutes the specified members in a chat room. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param muteMembers The list of members to be muted. * @param duration The mute duration in milliseconds. * * @throws A description of the exception. See {@link ChatError}. */ muteChatRoomMembers(roomId: string, muteMembers: Array, duration?: number): Promise; /** * Cancel mutes the specified members in a chat room. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param unMuteMembers The list of members to be unmuted. * * @throws A description of the exception. See {@link ChatError}. */ unMuteChatRoomMembers(roomId: string, unMuteMembers: Array): Promise; /** * Transfers the chat room ownership. * * Only the chat room owner can call this method. * * @param roomId The chat room ID. * @param newOwner The ID of the new chat room owner. * * @throws A description of the exception. See {@link ChatError}. */ changeOwner(roomId: string, newOwner: string): Promise; /** * Adds a chat room admin. * * Only the chat room owner can call this method. * * @param roomId The chat room ID. * @param admin The ID of the chat room admin to be added. * * @throws A description of the exception. See {@link ChatError}. */ addChatRoomAdmin(roomId: string, admin: string): Promise; /** * Removes privileges of a chat room admin. * * @param roomId The chat room ID. * @param admin The ID of admin whose privileges are to be removed. * * @throws A description of the exception. See {@link ChatError}. */ removeChatRoomAdmin(roomId: string, admin: string): Promise; /** * Gets the list of members who are muted in the chat room from the server. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param pageNum The page number, starting from 1. * @param pageSize The number of muted members per page. * @returns The muted member list. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomMuteList(roomId: string, pageNum?: number, pageSize?: number): Promise>; /** * Removes the specified members from a chat room. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param members The list of the members to be removed. * * @throws A description of the exception. See {@link ChatError}. */ removeChatRoomMembers(roomId: string, members: Array): Promise; /** * Adds the specified members to the block list of the chat room. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param members The list of members to be added to block list. * * @throws A description of the exception. See {@link ChatError}. */ blockChatRoomMembers(roomId: string, members: Array): Promise; /** * Removes the specified members from the block list of the chat room. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param members The list of members to be removed from the block list. * * @throws A description of the exception. See {@link ChatError}. */ unBlockChatRoomMembers(roomId: string, members: Array): Promise; /** * Gets the chat room block list with pagination. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param pageNum The page number, starting from 1. * @param pageSize The number of users on the block list per page. * @returns The list of the blocked chat room members. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomBlockList(roomId: string, pageNum?: number, pageSize?: number): Promise>; /** * Updates the chat room announcement. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param announcement The announcement content. * * @throws A description of the exception. See {@link ChatError}. */ updateChatRoomAnnouncement(roomId: string, announcement: string): Promise; /** * Gets the chat room announcement from the server. * * @param roomId The chat room ID. * @returns The chat room announcement. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomAnnouncement(roomId: string): Promise; /** * Gets the allow list from the server. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @returns The chat room allow list. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomWhiteListFromServer(roomId: string): Promise>; /** * Checks whether the member is on the allow list. * * @param roomId The chat room ID. * @returns Whether the member is on the allow list. * * @throws A description of the exception. See {@link ChatError}. */ isMemberInChatRoomWhiteList(roomId: string): Promise; /** * Adds members to the allowlist. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param members The list of members to be added to the allow list. * * @throws A description of the exception. See {@link ChatError}. */ addMembersToChatRoomWhiteList(roomId: string, members: Array): Promise; /** * Removes members from the allow list. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * @param members The list of members to be removed from the allow list. * * @throws A description of the exception. See {@link ChatError}. */ removeMembersFromChatRoomWhiteList(roomId: string, members: Array): Promise; /** * Mutes all members. * * Only the chat room owner or admin can call this method. * * This method does not work for the chat room owner, admin, and members added to the allow list. * * @param roomId The chat room ID. * * @throws A description of the exception. See {@link ChatError}. */ muteAllChatRoomMembers(roomId: string): Promise; /** * Cancel mutes all members. * * Only the chat room owner or admin can call this method. * * @param roomId The chat room ID. * * @throws A description of the exception. See {@link ChatError}. */ unMuteAllChatRoomMembers(roomId: string): Promise; }