import type { NativeEventEmitter } from 'react-native'; import type { ChatGroupEventListener } from './ChatEvents'; import { ChatGroupSharedFile, ChatGroup, ChatGroupOptions, ChatGroupInfo, ChatGroupFileStatusCallback } from './common/ChatGroup'; import { ChatCursorResult } from './common/ChatCursorResult'; import { BaseManager } from './__internal__/Base'; /** * The group manager class, which defines how to manage groups, like group creation and destruction and member management. */ export declare class ChatGroupManager extends BaseManager { protected static TAG: string; private _groupListeners; private _groupSubscriptions; constructor(); setNativeListener(event: NativeEventEmitter): void; private invokeGroupListener; private static handleUploadFileCallback; private static handleDownloadFileCallback; /** * Gets the group instance from the memory by group ID. * * @param groupId The group ID. * @returns The group instance. The SDK returns `undefined` if the group does not exist. * * @throws A description of the exception. See {@link ChatError}. */ getGroupWithId(groupId: string): Promise; /** * Gets the list of groups that the current user has joined. * * This method gets data from the local database. * * @returns The group list. * * @throws A description of the exception. See {@link ChatError}. */ getJoinedGroups(): Promise>; /** * Gets the list of groups that the current user has joined. * * This method gets data from the server. * * This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call {@link #fetchMemberListFromServer}. * * @param pageSize The number of groups that you expect to return on each page. * @param pageNum The page number, starting from 1. * @returns The list of groups that the current user joins. * * @throws A description of the exception. See {@link ChatError}. */ fetchJoinedGroupsFromServer(pageSize: number, pageNum: number): Promise>; /** * Gets public groups from the server with pagination. * * @param pageSize The number of public groups that you expect on each page. * @param cursor The cursor position from which to start to get data. At the first method call, if you set `cursor` as `null`, the SDK gets the data in the reverse chronological order of when groups are created. * @returns The group list and the cursor for the next query. See {@link ChatCursorResult}. * * @throws A description of the exception. See {@link ChatError}. */ fetchPublicGroupsFromServer(pageSize: number, cursor?: string): Promise>; /** * Creates a group instance. * * After the group is created, the data in the memory and database will be updated and multiple devices will receive the notification event and update the group to the memory and database. * * You can set {@link ChatGroupEventListener} to listen for the event. * * @param options The options for creating a group. They are optional and cannot be `null`. See {@link ChatGroupOptions}. * The options are as follows: * - The maximum number of members allowed in the group. The default value is 200. * - The group style. See {@link ChatGroupStyle}. The default value is {@link ChatGroupStyle#PrivateOnlyOwnerInvite}. * - Whether to ask for permission when inviting a user to join the group. The default value is `false`, indicating that invitees are automatically added to the group without their permission. * - The extension of group details. * @param groupName The group name. It is optional. Pass `null` if you do not want to set this parameter. * @param desc The group description. It is optional. Pass `null` if you do not want to set this parameter. * @param inviteMembers The group member array. The group owner ID is optional. This parameter cannot be `null`. * @param inviteReason The group joining invitation. It is optional. Pass `null` if you do not want to set this parameter. * @returns The created group instance. * * @throws A description of the exception. See {@link ChatError}. */ createGroup(options: ChatGroupOptions, groupName: string, desc?: string, inviteMembers?: Array, inviteReason?: string): Promise; /** * Gets the group information from the server. * * @param groupId The group ID. * @param isFetchMembers Whether to get group member information: * - `true`: Yes. This method can return information of at most 200 group members. To get information of all group members, you can call {@link #fetchMemberListFromServer}. * - `false`: No. * @returns The group instance. The SDK returns `undefined` if the group does not exist. * * @throws A description of the exception. See {@link ChatError}. */ fetchGroupInfoFromServer(groupId: string, isFetchMembers?: boolean): Promise; /** * Uses the pagination to get the member list of the group from the server. * * @param groupId The group ID. * @param pageSize The number of group members that you expect to get on each page. * @param cursor The cursor position from which to start to get data. At the first method call, if you set `cursor` as `null`, the SDK gets the data in the reverse chronological order of when users join the group. * @returns The group member list and the cursor for the next query. See {@link ChatCursorResult}. * * @throws A description of the exception. See {@link ChatError}. */ fetchMemberListFromServer(groupId: string, pageSize?: number, cursor?: string): Promise>; /** * Uses the pagination to get the group block list from the server. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param pageSize The number of group members on the block list that you expect to get on each page. * @param pageNum The page number, starting from 1. * @returns The group block list. * * @throws A description of the exception. See {@link ChatError}. */ fetchBlockListFromServer(groupId: string, pageSize?: number, pageNum?: number): Promise>; /** * Uses the pagination to get the mute list of the group from the server. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param pageSize The number of muted members that you expect to get on each page. * @param pageNum The page number, starting from 1. * @returns The group mute list. * * @throws A description of the exception. See {@link ChatError}. */ fetchMuteListFromServer(groupId: string, pageSize?: number, pageNum?: number): Promise>; /** * Uses the pagination to get the allow list of the group from the server. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @returns The allow list of the group. * * @throws A description of the exception. See {@link ChatError}. */ fetchAllowListFromServer(groupId: string): Promise>; /** * Gets whether the member is on the allow list of the group. * * @param groupId The group ID. * @returns Whether the current user is on the allow list of the group. * - `true`: Yes. * - `false`: No. * * @throws A description of the exception. See {@link ChatError}. */ isMemberInAllowListFromServer(groupId: string): Promise; /** * Uses the pagination to get the shared files of the group from the server. * * @param groupId The group ID. * @param pageSize The number of shared files that you get on each page. * @param pageNum The page number, starting from 1. * @returns The shared file list. * * @throws A description of the exception. See {@link ChatError}. */ fetchGroupFileListFromServer(groupId: string, pageSize?: number, pageNum?: number): Promise>; /** * Gets the group announcement from the server. * * All group members can call this method. * * @param groupId The group ID. * @returns The group announcement. * * @throws A description of the exception. See {@link ChatError}. */ fetchAnnouncementFromServer(groupId: string): Promise; /** * Adds users to the group. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The array of new members to add. * @param welcome (optional) The welcome message. * * @throws A description of the exception. See {@link ChatError}. */ addMembers(groupId: string, members: Array, welcome?: string): Promise; /** * Invites users to join the group. * * This method works only for groups with the following styles: * - `PrivateOnlyOwnerInvite` style: Only the group owner can invite users to join the group. * - `PrivateMemberCanInvite` style: Each group member can invite users to join the group. * - `PublicJoinNeedApproval` style: Each group member can invite users to join the group and users can join a group only after getting approval from the group owner or admins. * * @param groupId The group ID. * @param members The array of user IDs of new members to invite. * @param reason The invitation reason. * * @throws A description of the exception. See {@link ChatError}. */ inviterUser(groupId: string, members: Array, reason?: string): Promise; /** * Removes a member from the group. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The user ID of the member to be removed. * * @throws A description of the exception. See {@link ChatError}. */ removeMembers(groupId: string, members: Array): Promise; /** * Adds the user to the block list of the group. * * Users will be first removed from the group they have joined before being added to the block list of the group. The users on the group block list cannot join the group again. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The array of user IDs of members to be added to the block list. * * @throws A description of the exception. See {@link ChatError}. */ blockMembers(groupId: string, members: Array): Promise; /** * Removes users from the group block list. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The user IDs of members to be removed from the group block list. * * @throws A description of the exception. See {@link ChatError}. */ unblockMembers(groupId: string, members: Array): Promise; /** * Changes the group name. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param groupName The new group name. * * @throws A description of the exception. See {@link ChatError}. */ changeGroupName(groupId: string, groupName: string): Promise; /** * Modifies the group description. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param description The new group description. * * @throws A description of the exception. See {@link ChatError}. */ changeGroupDescription(groupId: string, description: string): Promise; /** * Leaves a group. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ leaveGroup(groupId: string): Promise; /** * Destroys the group instance. * * Only the group owner can call this method. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ destroyGroup(groupId: string): Promise; /** * Blocks group messages. * * The user that blocks group messages is still a group member, but cannot receive group messages. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ blockGroup(groupId: string): Promise; /** * Unblocks group messages. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ unblockGroup(groupId: string): Promise; /** * Transfers the group ownership. * * Only the group owner can call this method. * * @param groupId The group ID. * @param newOwner The user ID of the new group owner. * * @throws A description of the exception. See {@link ChatError}. */ changeOwner(groupId: string, newOwner: string): Promise; /** * Adds a group admin. * * Only the group owner can call this method and group admins cannot. * * @param groupId The group ID. * @param admin The user ID of the admin to add. * * @throws A description of the exception. See {@link ChatError}. */ addAdmin(groupId: string, admin: string): Promise; /** * Removes a group admin. * * Only the group owner can call this method. * * @param groupId The group ID. * @param admin The user ID of the group admin to remove. * * @throws A description of the exception. See {@link ChatError}. */ removeAdmin(groupId: string, admin: string): Promise; /** * Mutes group members. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The list of user IDs of members to mute. * @param duration The mute duration in milliseconds. It is a reserved parameter. * * @throws A description of the exception. See {@link ChatError}. */ muteMembers(groupId: string, members: Array, duration?: number): Promise; /** * Unmutes group members. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The array of user IDs of members to be unmuted. * * @throws A description of the exception. See {@link ChatError}. */ unMuteMembers(groupId: string, members: Array): Promise; /** * Mutes all members. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ muteAllMembers(groupId: string): Promise; /** * Unmutes all group members. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ unMuteAllMembers(groupId: string): Promise; /** * Adds members to the allow list of the group. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The user IDs of members to be added to the allow list of the group. * * @throws A description of the exception. See {@link ChatError}. */ addAllowList(groupId: string, members: Array): Promise; /** * Removes members from the allow list of the group. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param members The user IDs of members to be removed from the allow list of the group. * * @throws A description of the exception. See {@link ChatError}. */ removeAllowList(groupId: string, members: Array): Promise; /** * Uploads the shared file to the group. * * When a shared file is uploaded, the upload progress callback will be triggered. * * @param groupId The group ID. * @param filePath The local path of the shared file. * @param callback (Optional) The file upload result callback. * * @throws A description of the exception. See {@link ChatError}. */ uploadGroupSharedFile(groupId: string, filePath: string, callback?: ChatGroupFileStatusCallback): Promise; /** * Downloads the shared file of the group. * * @param groupId The group ID. * @param fileId The ID of the shared file. * @param savePath The local path of the shared file. * @param callback (Optional) The file upload result callback. * * @throws A description of the exception. See {@link ChatError}. */ downloadGroupSharedFile(groupId: string, fileId: string, savePath: string, callback?: ChatGroupFileStatusCallback): Promise; /** * Removes a shared file of the group. * * Group members can delete their own uploaded files. The group owner or admin can delete all shared files. * * @param groupId The group ID. * @param fileId The ID of the shared file. * * @throws A description of the exception. See {@link ChatError}. */ removeGroupSharedFile(groupId: string, fileId: string): Promise; /** * Updates the group announcement. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param announcement The group announcement. * * @throws A description of the exception. See {@link ChatError}. */ updateGroupAnnouncement(groupId: string, announcement: string): Promise; /** * Updates the group extension field. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param extension The updated group extension field. * * @throws A description of the exception. See {@link ChatError}. */ updateGroupExtension(groupId: string, extension: string): Promise; /** * Joins a public group. * * For a group that requires no authentication,users can join it freely without obtaining permissions from the group owner or admin. * * For a group that requires authentication, users need to wait for the group owner or admin to agree before joining the group. For details, see {@link ChatGroupStyle}. * * @param groupId The group ID. * * @throws A description of the exception. See {@link ChatError}. */ joinPublicGroup(groupId: string): Promise; /** * Requests to join a group. * * You can call this method to only join public groups requiring authentication, i.e., groups with the style of {@link ChatGroupStyle#PublicJoinNeedApproval}. * * @param groupId The group ID. * @param reason The reason for requesting to join the group. * * @throws A description of the exception. See {@link ChatError}. */ requestToJoinPublicGroup(groupId: string, reason?: string): Promise; /** * Accepts a join request. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param username The ID of the user who sends a request to join the group. * * @throws A description of the exception. See {@link ChatError}. */ acceptJoinApplication(groupId: string, username: string): Promise; /** * Declines a join request. * * Only the group owner or admin can call this method. * * @param groupId The group ID. * @param username The ID of the user who sends a request to join the group. * @param reason The reason of declining the join request. * * @throws A description of the exception. See {@link ChatError}. */ declineJoinApplication(groupId: string, username: string, reason?: string): Promise; /** * Accepts a group invitation. * * @param groupId The group ID. * @param inviter The user ID of the inviter. * * @throws A description of the exception. See {@link ChatError}. */ acceptInvitation(groupId: string, inviter: string): Promise; /** * Declines a group invitation. * * @param groupId The group ID. * @param inviter The user ID of the inviter. * @param reason The reason for declining the invitation. * * @throws A description of the exception. See {@link ChatError}. */ declineInvitation(groupId: string, inviter: string, reason?: string): Promise; /** * Adds a group listener. * * @param listener The group listener to add. */ addGroupListener(listener: ChatGroupEventListener): void; /** * Removes the group listener. * * @param listener The group listener to remove. */ removeGroupListener(listener: ChatGroupEventListener): void; /** * Clears all group listeners. */ removeAllGroupListener(): void; }