Skip to content

Commit 1625f9d

Browse files
committed
docs(uniapp): align English conversation guides with Wasm
1 parent fd0a1fd commit 1625f9d

34 files changed

Lines changed: 530 additions & 73 deletions

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/add-conversations-to-groups.mdx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,26 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/add-conversations-to-groups'
1212
---
1313

14+
`addConversationsToGroups()` <span className="enterprise-field-badge">Commercial</span> updates membership using explicit sets of conversation IDs and group IDs.
15+
16+
## Parameters
17+
18+
| Parameter | Type | Required | Description |
19+
| --- | --- | --- | --- |
20+
| `conversationIDs` | `string[]` | Yes | Conversations to add. |
21+
| `conversationGroupIDs` | `string[]` | Yes | Target groups. Every conversation is added to every target group. |
22+
1423
```uts
1524
import { addConversationsToGroups } from '@/uni_modules/unix-openim-sdk'
1625
17-
await addConversationsToGroups({ conversationGroupIDList, conversationIDList })
26+
await addConversationsToGroups({
27+
conversationIDs: [conversationID],
28+
conversationGroupIDs: ['group_a'],
29+
})
1830
```
1931

20-
This <span className="enterprise-field-badge">Commercial</span> batch adds explicit conversations to explicit groups. Deduplicate both arrays and confirm membership from events or a new snapshot.
32+
Both arrays must be non-empty. Remove blank values and duplicates before calling. One conversation can belong to several groups; this operation does not alter its messages or remove its other group memberships.
33+
34+
## Return result
35+
36+
The Promise resolves directly to Core's string result, meaning the membership request completed. It does not mean that the local group-member event has arrived. Confirm final membership through `onConversationGroupMemberAdded` or a new query, and never retain a local-only membership after failure. See [Conversation groups overview](/sdk/uniapp/conversation/managing-conversation-groups/overview-conversation-groups) for the complete raw-event handling.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/create-conversation-group.mdx‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,34 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/create-conversation-group'
1212
---
1313

14+
`createConversationGroup()` <span className="enterprise-field-badge">Commercial</span> creates a custom group and can add one initial conversation.
15+
16+
## Parameters
17+
18+
| Parameter | Type | Required | Description |
19+
| --- | --- | --- | --- |
20+
| `name` | `string` | Yes | Group name. Validate blank values and length according to product rules. |
21+
| `order` | `number` | Yes | Sort value. Use one consistent direction throughout the product. |
22+
| `conversationGroupType` | `OpenIMConversationGroupType` | Yes | Group type allowed by the plugin contract. |
23+
| `conversationID` | `string` or `null` | No | Initial conversation added during creation. |
24+
| `ex` | `string` or `null` | No | Extension string. It is a complete value and is not merged as JSON. |
25+
1426
```uts
1527
import { createConversationGroup } from '@/uni_modules/unix-openim-sdk'
1628
17-
const group = await createConversationGroup({ groupName: 'Priority', conversationIDList })
29+
const result = await createConversationGroup({
30+
name: 'Priority',
31+
order: 100,
32+
conversationGroupType: 0,
33+
conversationID,
34+
ex: '',
35+
})
36+
37+
const group = result?.conversationGroup
1838
```
1939

20-
This is <span className="enterprise-field-badge">Commercial</span>. Use non-empty unique conversation IDs and merge the returned group/event by its stable ID.
40+
## Return result
41+
42+
The Promise resolves directly to `OpenIMCreateConversationGroupResult` or `null`. Its `conversationGroup` is the new snapshot and can itself be `null`; add it to the local index only after validating a non-empty `conversationGroupID`.
43+
44+
Promise completion and `onConversationGroupAdded` are separate stages. Requery after the raw event to reconcile the final list. If `conversationID` was provided, reconcile that membership from the query as well.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/delete-conversation-group.mdx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/delete-conversation-group'
1212
---
1313

14+
`deleteConversationGroup()` <span className="enterprise-field-badge">Commercial</span> deletes one conversation group. The required `conversationGroupID` must come from the current account's group snapshot, not a name or array index.
15+
1416
```uts
1517
import { deleteConversationGroup } from '@/uni_modules/unix-openim-sdk'
1618
17-
await deleteConversationGroup(conversationGroupID)
19+
await deleteConversationGroup({ conversationGroupID: groupID })
1820
```
1921

20-
Deleting a <span className="enterprise-field-badge">Commercial</span> group does not delete its conversations or messages. Confirm destructive UI and remove the group only after the event or refreshed snapshot.
22+
## Return result
23+
24+
The Promise resolves directly to a string result, meaning the deletion request completed. Deleting a group does not delete its conversations, messages, or the underlying conversation records.
25+
26+
Ask for confirmation in the UI. After success, use `onConversationGroupDeleted` or a new query to remove the local group and membership indexes by `conversationGroupID`. Do not hide the group before a failed Promise, and prefer a new snapshot when event and local state disagree.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-by-conversation-id.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/get-conversat
1414
```uts
1515
import { getConversationGroupByConversationID } from '@/uni_modules/unix-openim-sdk'
1616
17-
const result = await getConversationGroupByConversationID(conversationID)
17+
const result = await getConversationGroupByConversationID({ conversationID })
18+
const groups = result?.conversationGroups ?? []
1819
```
1920

20-
This <span className="enterprise-field-badge">Commercial</span> operation returns the group association for one conversation. Use the returned group ID rather than inferring membership from UI order.
21+
This <span className="enterprise-field-badge">Commercial</span> operation returns every group containing one conversation. A conversation can belong to several groups, so do not read only the first item. Deduplicate by `conversationGroupID`; an empty array means that the conversation currently belongs to no group, not that the query failed.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-info-with-conversations.mdx‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,33 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-info-with-conversations'
1212
---
1313

14+
`getConversationGroupInfoWithConversations()` <span className="enterprise-field-badge">Commercial</span> returns group metadata, the total conversation count, and one page of conversations.
15+
16+
## Parameters
17+
18+
| Parameter | Type | Required | Description |
19+
| --- | --- | --- | --- |
20+
| `conversationGroupID` | `string` | Yes | Group to query. |
21+
| `pagination.pageNumber` | `number` | Yes | Page number; this contract example starts at `1`. |
22+
| `pagination.showNumber` | `number` | Yes | Conversations requested per page. |
23+
1424
```uts
1525
import { getConversationGroupInfoWithConversations } from '@/uni_modules/unix-openim-sdk'
1626
17-
const result = await getConversationGroupInfoWithConversations(conversationGroupID)
27+
const result = await getConversationGroupInfoWithConversations({
28+
conversationGroupID: groupID,
29+
pagination: { pageNumber: 1, showNumber: 100 },
30+
})
1831
```
1932

20-
The <span className="enterprise-field-badge">Commercial</span> result combines group metadata with member conversations. Treat it as a snapshot and merge later group/membership events by stable IDs.
33+
## Return result
34+
35+
The Promise resolves directly to `OpenIMGetConversationGroupInfoWithConversationsResult` or `null`:
36+
37+
| Field | Type | Description |
38+
| --- | --- | --- |
39+
| `conversationGroup` | `OpenIMConversationGroupItem` or `null` | Group metadata. Do not continue paging if it is `null`. |
40+
| `ConversationTotal` | `number` or `null` (optional) | Total conversations. The initial uppercase `C` is part of the contract. |
41+
| `conversations` | `OpenIMConversationItem[]` | Current page. |
42+
43+
Membership can change while pages load. Deduplicate by `conversationID`, and rebuild pagination on the first page or after a membership event. Do not replace `ConversationTotal` with the current array length.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-groups.mdx‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,36 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-groups'
1212
---
1313

14+
`getConversationGroups()` <span className="enterprise-field-badge">Commercial</span> queries groups by `conversationGroupType`.
15+
16+
`conversationGroupType` is a required `OpenIMConversationGroupQueryType`. Use the contract value for normal custom groups when rendering the normal grouping UI, or the contract value that queries all types when the product needs a complete snapshot. Do not mix a creation type, UI tab index, or local enum with the query type.
17+
1418
```uts
1519
import { getConversationGroups } from '@/uni_modules/unix-openim-sdk'
1620
17-
const result = await getConversationGroups()
18-
replaceConversationGroups(result?.groups ?? [])
21+
const result = await getConversationGroups({ conversationGroupType: 0 })
22+
const groups = result?.conversationGroups ?? []
1923
```
2024

21-
This <span className="enterprise-field-badge">Commercial</span> snapshot is ordered by server/Core state. Merge later group events and reload after account or synchronization changes.
25+
## Return result
26+
27+
The Promise resolves directly to `OpenIMGetConversationGroupsResult` or `null`. Read the snapshot from `conversationGroups`, deduplicate valid IDs, and sort by `order`.
28+
29+
### Conversation-group fields
30+
31+
Every `OpenIMConversationGroupItem` field can be absent:
32+
33+
| Field | Type | Description |
34+
| --- | --- | --- |
35+
| `conversationGroupID` | `string` or `null` | Stable group ID and merge key for group events. Validate it before caching. |
36+
| `name` | `string` or `null` | Display name. |
37+
| `order` | `number` or `null` | Server/Core sort value. |
38+
| `conversationGroupType` | `number` or `null` | Group type. |
39+
| `conversationIDs` | `string[]` or `null` | Conversation IDs included in this snapshot, not complete conversation objects. |
40+
| `hidden` | `boolean` or `null` | Whether the group is hidden. |
41+
| `unreadCount` | `number` or `null` | Aggregate unread-count snapshot. |
42+
| `ex` | `string` or `null` | Application extension string; parse only a confirmed format. |
43+
44+
The item stores conversation IDs rather than complete conversation details. Use [Get a group with its conversations](/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-info-with-conversations) when member conversation objects, pages, and the total count are needed.
45+
46+
This operation only establishes a snapshot and does not trigger a group event. Merge later incremental events and query again to reconcile after reconnect, account change, or an event gap. See [Conversation groups overview](/sdk/uniapp/conversation/managing-conversation-groups/overview-conversation-groups) for the event list.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/overview-conversation-groups.mdx‎

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,49 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/overview-conversation-groups'
1212
---
1313

14-
Conversation groups are <span className="enterprise-field-badge">Commercial</span>. Keep group and membership stores synchronized from snapshots plus five events.
14+
Conversation groups are <span className="enterprise-field-badge">Commercial</span>. They organize conversations into custom groups with a name, order, hidden state, unread snapshot, and member conversation IDs.
15+
16+
## Group types
17+
18+
Creation uses `OpenIMConversationGroupType`; queries use `OpenIMConversationGroupQueryType`. They belong to different operation contracts. Do not pass a UI tab index directly as either SDK type.
19+
20+
One conversation can belong to several groups. Groups organize conversation entry points; they do not copy or move message data. Deleting a group or removing membership does not delete the underlying conversation.
21+
22+
## Group data
23+
24+
Every `OpenIMConversationGroupItem` field is optional:
25+
26+
| Field | Type | Description |
27+
| --- | --- | --- |
28+
| `conversationGroupID` | `string` or `null` | Stable group identifier. Cache only after validating it. |
29+
| `name` | `string` or `null` | Group name. |
30+
| `order` | `number` or `null` | Sort value. |
31+
| `ex` | `string` or `null` | Application extension; parse only a confirmed format. |
32+
| `conversationGroupType` | `number` or `null` | Group type. |
33+
| `hidden` | `boolean` or `null` | Whether the group is hidden. |
34+
| `unreadCount` | `number` or `null` | Group-level unread snapshot. |
35+
| `conversationIDs` | `string[]` or `null` | Member IDs included in this response; it might not be a complete paginated set. |
36+
37+
Use a non-empty `conversationGroupID` as the index key. Names, order, and hidden state can change. Query [group information with conversations](/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-info-with-conversations) when complete membership, conversation objects, and total count are needed.
38+
39+
## Available operations
40+
41+
| Task | Page |
42+
| --- | --- |
43+
| Create a group and optionally add one initial conversation | [Create a conversation group](/sdk/uniapp/conversation/managing-conversation-groups/create-conversation-group) |
44+
| Query groups | [Get conversation groups](/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-groups) |
45+
| Query group metadata, members, and total count | [Get a group with its conversations](/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-info-with-conversations) |
46+
| Query all groups containing one conversation | [Get groups for a conversation](/sdk/uniapp/conversation/managing-conversation-groups/get-conversation-group-by-conversation-id) |
47+
| Add or remove membership | [Add conversations to groups](/sdk/uniapp/conversation/managing-conversation-groups/add-conversations-to-groups), [Remove conversations from groups](/sdk/uniapp/conversation/managing-conversation-groups/remove-conversations-from-groups) |
48+
| Update name, extension, or hidden state | [Update a conversation group](/sdk/uniapp/conversation/managing-conversation-groups/update-conversation-group) |
49+
| Change group ordering | [Set conversation-group order](/sdk/uniapp/conversation/managing-conversation-groups/set-conversation-group-order) |
50+
| Delete a group | [Delete a conversation group](/sdk/uniapp/conversation/managing-conversation-groups/delete-conversation-group) |
51+
52+
Query a snapshot when the page opens. After a mutation Promise succeeds, continue to wait for an event or requery. When raw event fields are not frozen, never replace a query result with guessed local state.
53+
54+
## Listen for group changes
55+
56+
The five group events return opaque JSON strings rather than typed objects:
1557

1658
```uts
1759
import {
@@ -23,12 +65,26 @@ import {
2365
onConversationGroupMemberDeleted,
2466
} from '@/uni_modules/unix-openim-sdk'
2567
26-
const subscriptions = [
27-
onConversationGroupAdded(upsertGroup), onConversationGroupChanged(upsertGroup),
28-
onConversationGroupDeleted(removeGroup), onConversationGroupMemberAdded(mergeMembers),
29-
onConversationGroupMemberDeleted(removeMembers),
68+
function refreshFromRawGroupEvent(payload : string) {
69+
try {
70+
const value = JSON.parseObject<UTSJSONObject>(payload)
71+
if (value != null) refreshConversationGroups()
72+
} catch (_) {
73+
console.error('Invalid conversation group event payload')
74+
}
75+
}
76+
77+
const addedSubscription = onConversationGroupAdded(refreshFromRawGroupEvent)
78+
const subscriptions : Array<OpenIMSDKEventSubscription> = [
79+
addedSubscription,
80+
onConversationGroupChanged(refreshFromRawGroupEvent),
81+
onConversationGroupDeleted(refreshFromRawGroupEvent),
82+
onConversationGroupMemberAdded(refreshFromRawGroupEvent),
83+
onConversationGroupMemberDeleted(refreshFromRawGroupEvent),
3084
]
3185
subscriptions.forEach((subscription) => off(subscription))
3286
```
3387

34-
Merge by group and conversation IDs, preserve ordering, and reload snapshots after login or synchronization gaps.
88+
The added, changed, and deleted events describe group objects; the member-added and member-deleted events describe membership. Because the raw payload has no frozen DTO, validate only that it is valid JSON and then requery the related snapshot.
89+
90+
Do not depend on unfrozen fields after JSON validation. Handlers should return quickly and isolate refresh tasks by the current logged-in user. Stop old-account writes before releasing each handle on account switch or dispose. Never log a complete payload because `ex` and other fields can contain application data.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/remove-conversations-from-groups.mdx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,26 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/remove-conversations-from-groups'
1212
---
1313

14+
`removeConversationsFromGroups()` <span className="enterprise-field-badge">Commercial</span> uses the same membership parameters as the add operation.
15+
16+
## Parameters
17+
18+
| Parameter | Type | Required | Description |
19+
| --- | --- | --- | --- |
20+
| `conversationIDs` | `string[]` | Yes | Conversations to remove. |
21+
| `conversationGroupIDs` | `string[]` | Yes | Groups from which to remove them. |
22+
1423
```uts
1524
import { removeConversationsFromGroups } from '@/uni_modules/unix-openim-sdk'
1625
17-
await removeConversationsFromGroups({ conversationGroupIDList, conversationIDList })
26+
await removeConversationsFromGroups({
27+
conversationIDs: [conversationID],
28+
conversationGroupIDs: ['group_a'],
29+
})
1830
```
1931

20-
This <span className="enterprise-field-badge">Commercial</span> batch changes group membership only; it does not hide or delete conversations. Refresh membership after partial or failed operations.
32+
Both arrays must be non-empty and deduplicated. Removing membership does not delete a conversation or its messages and does not affect that conversation's membership in other groups.
33+
34+
## Return result
35+
36+
The Promise resolves directly to a string result, meaning the request completed rather than proving that the local snapshot is updated. Process `onConversationGroupMemberDeleted` or requery the group. Let the server's final state handle a repeated removal; do not retry forever or fabricate local success after failure.

‎content/docs/chat/sdk/uniapp/conversation/managing-conversation-groups/set-conversation-group-order.mdx‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,30 @@ platform: 'uniapp'
1111
sourcePath: '/sdk/uniapp/conversation/managing-conversation-groups/set-conversation-group-order'
1212
---
1313

14+
`setConversationGroupOrder()` <span className="enterprise-field-badge">Commercial</span> submits group IDs with their new sort values in one batch.
15+
16+
## Parameters
17+
18+
`conversationGroupOrders` is a non-empty array. Every item contains:
19+
20+
| Parameter | Type | Required | Description |
21+
| --- | --- | --- | --- |
22+
| `conversationGroupID` | `string` | Yes | Group to reorder. |
23+
| `order` | `number` | Yes | New sort value. Avoid duplicate values or unstable ordering rules in one batch. |
24+
1425
```uts
1526
import { setConversationGroupOrder } from '@/uni_modules/unix-openim-sdk'
1627
17-
await setConversationGroupOrder(conversationGroupIDList)
28+
await setConversationGroupOrder({
29+
conversationGroupOrders: [
30+
{ conversationGroupID: 'group_a', order: 100 },
31+
{ conversationGroupID: 'group_b', order: 200 },
32+
],
33+
})
1834
```
1935

20-
Send the complete desired unique group-ID order for this <span className="enterprise-field-badge">Commercial</span> operation. Serialize concurrent reorder requests and refresh after failure.
36+
Submit the complete affected set once when dragging ends rather than issuing one request per movement. Deduplicate by `conversationGroupID` and calculate all affected values with a stable algorithm.
37+
38+
## Return result
39+
40+
The Promise resolves directly to a string result, meaning the reorder request completed. Requery groups or await the group-change event to confirm final ordering. If several clients edit concurrently, use the final server `order` rather than retaining only the local drag order.

0 commit comments

Comments
 (0)