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 operations, like joining and leaving the chat room and retrieving the chat room list, and manages member privileges. */ export declare class ChatRoomManager extends Native { private static TAG; constructor(); private _roomListeners; private _roomSubscriptions; setNativeListener(event: NativeEventEmitter): void; private invokeContactListener; /** * Adds a chat room listener. * * @param listener The listener to add. */ addRoomListener(listener: ChatRoomEventListener): void; /** * Removes the chat room listener. * * @param listener The listener to remove. */ removeRoomListener(listener: ChatRoomEventListener): void; /** * Removes all the chat room listeners. */ removeAllRoomListener(): void; /** * Joins the chat room. * * To leave the chat room, you can 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 chat rooms that you expect to get on each page. * @returns The list of obtained chat rooms. 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. The SDK returns `undefined` if the chat room does not exist. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomInfoFromServer(roomId: string): Promise; /** * Gets the chat room by ID from the local database. * * @param roomId The chat room ID. * @returns The chat room instance. The SDK returns `undefined` if the chat 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 name. * @param description The chat room description. * @param welcome A welcome message for new chat room members. * @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, description?: string, welcome?: 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 name. * * Only the chat room owner can call this method. * * @param roomId The chat room ID. * @param subject The new name 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 to get data. * At the first method call, if you set `cursor` as `null` or an empty string, the SDK gets the data in the reverse chronological order of when users join the chat room. * @param pageSize The number of members that you expect to get on each page. * @returns The list of chat room members and the cursor for the next query. See {@link ChatCursorResult}. * * @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 user IDs 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; /** * Unmutes 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 user IDs 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 user 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 user 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 administrative privileges of a chat room admin. * * @param roomId The chat room ID. * @param admin The user ID of the chat room admin whose administrative privileges are to be removed. * * @throws A description of the exception. See {@link ChatError}. */ removeChatRoomAdmin(roomId: string, admin: string): Promise; /** * Uses the pagination to get the list of members who are muted in the chat room. * * This method gets data 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 that you expect to get on each page. * @returns The user IDs of muted members. * * @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 user IDs 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 user IDs of members to be added to block list of the chat room. * * @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 user IDs of members to be removed from the block list of the chat room. * * @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 that you expect to get on each page. * @returns The user IDs of the chat room members on the block list. * * @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 new chat room announcement. * * @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 allow list of the chat room. * * @throws A description of the exception. See {@link ChatError}. */ fetchChatRoomAllowListFromServer(roomId: string): Promise>; /** * Checks whether the member is on the allow list of the chat room. * * @param roomId The chat room ID. * @returns Whether the member is on the allow list of the chat room. * - `true`: Yes. * - `false`: No. * * @throws A description of the exception. See {@link ChatError}. */ isMemberInChatRoomAllowList(roomId: string): Promise; /** * Adds members to the allow 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 user IDs of members to be added to the allow list of the chat room. * * @throws A description of the exception. See {@link ChatError}. */ addMembersToChatRoomAllowList(roomId: string, members: Array): Promise; /** * Removes members from the allow 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 user IDs of members to be removed from the allow list of the chat room. * * @throws A description of the exception. See {@link ChatError}. */ removeMembersFromChatRoomAllowList(roomId: string, members: Array): Promise; /** * Mutes all members. * * Only the chat room owner or admin can call this method. * * The chat room owner, admins, and members added to the allow list cannot be muted. * * @param roomId The chat room ID. * * @throws A description of the exception. See {@link ChatError}. */ muteAllChatRoomMembers(roomId: string): Promise; /** * Unmutes all members of the chat room. * * Only the chat room owner or admins can call this method. * * @param roomId The chat room ID. * * @throws A description of the exception. See {@link ChatError}. */ unMuteAllChatRoomMembers(roomId: string): Promise; }