diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md index 63666ca304a..769d4bcb9c7 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md @@ -84,6 +84,42 @@ ChatClient.getInstance().groupManager().joinGroup(groupId); ChatClient.getInstance().groupManager().leaveGroup(groupId); ``` +### Retrieve the chat group list + +Users can call `getJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined. + +```java +// It is an asynchronous method. The synchronous method is getJoinedGroupsFromServer(int, int, boolean, boolean). +// pageIndex: The current page number, starting from 0. +// pageSize: The number of groups to retrieve per page. The value range is [1,20]. +List grouplist = ChatClient.getInstance().groupManager().asyncGetJoinedGroupsFromServer(pageIndex, pageSize, needMemberCount, needRole, new ValueCallBack>() { + @Override + public void onSuccess(List value) { + + } + + @Override + public void onError(int error, String errorMsg) { + + } + }); +``` + +- Users can call `getAllGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. + +```java +List grouplist = ChatClient.getInstance().groupManager().getAllGroups(); +``` + +- Users can call `getPublicGroupsFromServer` to retrieve the list of public groups: + +```java +// It is a synchronous method and may block the current thread. The asynchronous method is asyncGetPublicGroupsFromServer(int, String, ValueCallBack). +CursorResult result = ChatClient.getInstance().groupManager().getPublicGroupsFromServer(pageSize, cursor); +List groupsList = result.getData(); +String cursor = result.getCursor(); +``` + ### Retrieve the member list of a chat group - When a group has less than 200 members, you can call the `getGroupFromServer` method to retrieve the group member list that contains the group owner, admins, and regular members. diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md index d100c4b125c..c0050f4e559 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md @@ -176,7 +176,7 @@ try { ### Retrieve the chat group list -Users can call `fetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server with pagination, as shown in the following code sample: +Users can call `fetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```dart try { @@ -186,7 +186,7 @@ try { } ``` -Users can call `getJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `getJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```dart try { diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md index c83318b4d7d..fa68a3d1adf 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md @@ -142,6 +142,34 @@ do { } while (result && result.list < pageSize); ``` +### Retrieve the chat group list + +Users can call `getJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined. + +```swift +// It is an asynchronous method. +AgoraChatClient.shared().groupManager?.getJoinedGroupsFromServer(withPage: 0, pageSize: 20, needMemberCount: true, needRole: true, completion: { groups, err in + // group list + }) +``` + +- Users can call `getJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. + +```swift +// It is a synchronous method. +let groups = AgoraChatClient.shared().groupManager?.getJoinedGroups() +``` + +- Users can call `getPublicGroupsFromServerWithCursor` to retrieve the list of public groups: + +```swift +AgoraChatClient.shared().groupManager?.getPublicGroupsFromServer(withCursor: "", pageSize: 20, completion: { result, err in + if let groups = result?.list { + // got groups + } + }) +``` + ### Block and unblock a chat group All chat group members can block and unblock a chat group. Once members block a chat group, they no longer receive messages from this chat group. diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md index 57377080be4..d8e30474315 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md @@ -209,12 +209,12 @@ ChatClient.getInstance() ### Retrieve the chat group list -Users can call `fetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server with pagination, as shown in the following code sample: +Users can call `fetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```typescript -// The maximum number of chat groups to retrieve with pagination. +// The number of groups to retrieve per page. The value range is [1,20]. const pageSize = 10; -// The page number from which to start getting data. +// The current page number, starting from 0. const pageNum = 1; ChatClient.getInstance() .groupManager.fetchJoinedGroupsFromServer(pageSize, pageNum) @@ -226,7 +226,7 @@ ChatClient.getInstance() }); ``` -Users can call `getJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `getJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```typescript ChatClient.getInstance() diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md index d67b87e6cdc..f4f6a1deb05 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md @@ -184,7 +184,7 @@ SDKClient.Instance.GroupManager.GetGroupMemberListFromServer(groupId, pageSize, ### Retrieve the chat group list -Users can call `FetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server, as shown in the following code sample: +Users can call `FetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```c# SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueCallBack>( @@ -196,7 +196,7 @@ SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueC )); ``` -Users can call `GetJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `GetJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```c# List groupList = SDKClient.Instance.GroupManager.GetJoinedGroups(); diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md index 8a3b4bb9af4..6094fda8f0f 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md @@ -112,6 +112,28 @@ let option = { conn.leaveGroup(option).then(res => console.log(res)) ``` +### Retrieve the chat group list + +Users can call `getJoinedGroups` to retrieve from the server the list of chat groups that they created and joined: + +```javascript +conn.getJoinedGroups({ + pageNum: 0, + pageSize: 20, + needAffiliations: true, + needRole: true, +}); +``` + +- Users can also call `getPublicGroups` to retrieve list of public chat groups from the server with pagination: + +```javascript +let option = { + limit: 20, + cursor: cursor, +}; +conn.getPublicGroups(option).then((res) => console.log(res)); +``` ### Retrieve the member list of a chat group diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md index a30b1414e3e..d9bc448adee 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md @@ -184,7 +184,7 @@ SDKClient.Instance.GroupManager.GetGroupMemberListFromServer(groupId, pageSize, ### Retrieve the chat group list -Users can call `FetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server, as shown in the following code sample: +Users can call `FetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```c# SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueCallBack>( @@ -196,7 +196,7 @@ SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueC )); ``` -Users can call `GetJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `GetJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```c# List groupList = SDKClient.Instance.GroupManager.GetJoinedGroups();