Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Agora Chat Docs #3834

Merged
merged 10 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<Group> grouplist = ChatClient.getInstance().groupManager().asyncGetJoinedGroupsFromServer(pageIndex, pageSize, needMemberCount, needRole, new ValueCallBack<List<Group>>() {
@Override
public void onSuccess(List<Group> 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<Group> 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<GroupInfo> result = ChatClient.getInstance().groupManager().getPublicGroupsFromServer(pageSize, cursor);
List<GroupInfo> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<Group>>(
Expand All @@ -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<Group> groupList = SDKClient.Instance.GroupManager.GetJoinedGroups();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<Group>>(
Expand All @@ -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<Group> groupList = SDKClient.Instance.GroupManager.GetJoinedGroups();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,30 @@ ChatClient.getInstance()
});
```

```typescript
// convId: Specify the conversation ID which is the peer user ID for one-to-one chat, group ID for group chat, and chat room ID for room chat.
// convType: Set conversation type which is PeerChat for one-to-one chat, GroupChat for group chat, and RoomChat for room chat。
// cursor: The starting message ID for query. Pass in `null` or an empty string at the first call to query from the latest message.
// pageSize The number of messages to retrieve per page. The value range is [1,50], with 10 as the default.
// option: The message query options.
// option.from: The message sender.
// option.msgTypes The message types for query.
// option.startTs: The start time for query.
// option.endTs: The end time for query.
// option.direction: The message direction.
// option.needSave: Whether to save the messages.
ChatClient.getInstance()
.chatManager.fetchHistoryMessagesByOptions(convId, convType, {
cursor: cursor,
pageSize: pageSize,
options: options as ChatFetchMessageOptions,
})
.then((res) => {
console.log("fetchHistoryMessagesByOptions is success.", res);
})
.catch();
```

### Retrieve the count of unread messages in the specified conversation

Refer to the following code example to retrieve the count of unread messages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ Refer to the following code sample to listen for presence status updates:

### Unsubscribe from the presence status of one or more users

You can call `unSubscribe` to unsubscribe from the presence statuses of the specified users, as shown in the following code sample:
You can call `unsubscribe` to unsubscribe from the presence statuses of the specified users, as shown in the following code sample:

```dart
// memberIds: The ID list of users from whom you unsubscribe.
try {
await ChatClient.getInstance.presenceManager.unSubscribe(
await ChatClient.getInstance.presenceManager.unsubscribe(
members: members,
);
} on ChatError catch (e) {
Expand Down
Loading
Loading