import type { NativeEventEmitter } from 'react-native'; import { BaseManager } from './__internal__/Base'; import type { ChatGroupEventListener } from './ChatEvents'; import { ChatCursorResult } from './common/ChatCursorResult'; import { ChatGroup, type ChatGroupConfigs, type ChatGroupConfigsType, type ChatGroupFileStatusCallback, ChatGroupMember, ChatGroupSharedFile } from './common/ChatGroup'; /** * 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>; /** * 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 configs The configs for creating a group. See {@link ChatGroupConfigs}. * The configs are as follows: * - The maximum number of members allowed in the group. The default value is 200. * - Whether the group is a public group. The default value is `false`. * - Whether joining the group requires the approval of the group owner or an admin. The default value is `false`. * - Whether group members are allowed to invite other users to join the group. The default value is `false`. * - 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. * @param groupAvatar The group avatar. * @param desc The group description. * @param inviteMembers The group member array. * @param inviteReason The group joining invitation. * @returns The created group instance. * * @throws A description of the exception. See {@link ChatError}. */ createGroupEx(params: { configs: ChatGroupConfigs; groupName: string; groupAvatar?: string; desc?: string; inviteMembers?: Array; inviteReason?: string; }): Promise; /** * Updates the configs of a group. * * Only the group owner and admins can call this method. * * @param groupId The group ID. * @param types The types of the configs to update. It is a bitmask of {@link ChatGroupConfigsType}. Only the configs specified by this parameter are updated. * @param configs The new group configs. See {@link ChatGroupConfigs}. * @returns The updated group instance. * * @throws A description of the exception. See {@link ChatError}. */ updateGroupConfigs(groupId: string, types: ChatGroupConfigsType, configs: ChatGroupConfigs): Promise; /** * Gets the group information from the server. * * @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}. */ fetchGroupInfoWithoutMembersFromServer(groupId: string): 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 member information list of the group from the server. * * @param groupId The group ID. * @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. * @param limit The number of group members that you expect to get on each page. The default value is 200. * @returns The group member information list and the cursor for the next query. See {@link ChatCursorResult}. * * @throws A description of the exception. See {@link ChatError}. */ fetchMemberInfoListFromServer(groupId: string, cursor: string, limit?: number): 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. * * @platform android The Android SDK async API does not accept the `welcome` * message, so this parameter is not passed through on Android. iOS is not * affected. * * @throws A description of the exception. See {@link ChatError}. */ addMembers(groupId: string, members: Array, welcome?: string): Promise; /** * Updates the namecard of the current user in the group. * * @param groupId The group ID. * @param namecard (optional) The new namecard. If this parameter is not set or set to `null`, the namecard is cleared. * * @throws A description of the exception. See {@link ChatError}. */ updateGroupNamecard(groupId: string, namecard?: string): Promise; /** * Gets the namecard of a member in the group. * * @param groupId The group ID. * @param userId The user ID of the member. * @returns The namecard of the member if the method succeeds; otherwise, `undefined`. * * @throws A description of the exception. See {@link ChatError}. */ getGroupNamecard(groupId: string, userId: 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}. */ inviteUser(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 avatar. * * @param groupId The group ID. * @param avatar The new group avatar. * * @throws A description of the exception. See {@link ChatError}. */ updateGroupAvatar(groupId: string, avatar: 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 ChatGroupConfigs.joinApprovalRequired}. * * @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 {@link ChatGroupConfigs.joinApprovalRequired} set to `true`. * * @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 userId 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, userId: 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; /** * Sets custom attributes of a group member. * * @param groupId The group ID. * @param member The array of user IDs of group members whose custom attributes are retrieved.(limitation is ten. More than callback error. ) * @param attribute The map of custom attributes in key-value format. In a key-value pair, if the value is set to an empty string, the custom attribute will be deleted. * * @throws A description of the exception. See {@link ChatError}. */ setMemberAttribute(groupId: string, member: string, attributes: Record): Promise; /** * Gets all custom attributes of a group member. * * @param groupId The group ID. * @param member The user ID of the group member whose all custom attributes are retrieved. * * @returns The user attributes. * * @throws A description of the exception. See {@link ChatError}. */ fetchMemberAttributes(groupId: string, member: string): Promise | undefined>; /** * Gets custom attributes of multiple group members by attribute key. * * @param groupId The group ID. * @param members The array of user IDs of group members whose custom attributes are retrieved.(limitation is ten. More than callback error. ) * @param attributeKeys The array of keys of custom attributes to be retrieved. * * @returns The users attributes. * * @throws A description of the exception. See {@link ChatError}. */ fetchMembersAttributes(groupId: string, members: string[], attributeKeys?: string[]): Promise>>; /** * Gets the number of groups joined by the current user. * * @returns The list of joined groups of the current user. * * @throws A description of the exception. See {@link ChatError}. */ fetchJoinedGroupCount(): 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; } //# sourceMappingURL=ChatGroupManager.d.ts.map