浏览代码

update:修正部分接口

adam 3 年前
父节点
当前提交
aa1c37e3eb

+ 6
- 6
package-lock.json 查看文件

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "@bilingo.com/cts",
3
-  "version": "1.0.0",
3
+  "version": "1.0.6",
4 4
   "lockfileVersion": 1,
5 5
   "requires": true,
6 6
   "dependencies": {
@@ -225,9 +225,9 @@
225 225
       }
226 226
     },
227 227
     "@bilingo.com/ts-linker-sdk": {
228
-      "version": "1.0.0",
229
-      "resolved": "https://registry.npmjs.org/@bilingo.com/ts-linker-sdk/-/ts-linker-sdk-1.0.0.tgz",
230
-      "integrity": "sha512-7nCK6/z1elrLWeqgaBngZBoZhvbKmA5+FytSygoNscwbO/YybdhZVN+HtTiWV3AvaHxpE1Bl4YvZmwKmmcACGA==",
228
+      "version": "1.0.4",
229
+      "resolved": "https://registry.npmjs.org/@bilingo.com/ts-linker-sdk/-/ts-linker-sdk-1.0.4.tgz",
230
+      "integrity": "sha512-XGVcszklmz65lIXb3F9v8yy618sp1Fn3a8s4k7eA5hrNqcyZriTvr0Ei+UzTSPtV8F+4SDAyV/snvHAkuW4Q3A==",
231 231
       "requires": {
232 232
         "crypto-js": "^3.1.9-1",
233 233
         "eventemitter3": "^4.0.0",
@@ -4443,8 +4443,8 @@
4443 4443
     },
4444 4444
     "crypto-js": {
4445 4445
       "version": "3.3.0",
4446
-      "resolved": "https://registry.nlark.com/crypto-js/download/crypto-js-3.3.0.tgz?cache=0&sync_timestamp=1626954954639&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcrypto-js%2Fdownload%2Fcrypto-js-3.3.0.tgz",
4447
-      "integrity": "sha1-hG3RzOL2iqz6FWyFePkmpgm3l2s="
4446
+      "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.3.0.tgz",
4447
+      "integrity": "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q=="
4448 4448
     },
4449 4449
     "crypto-random-string": {
4450 4450
       "version": "1.0.0",

+ 2
- 2
package.json 查看文件

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "@bilingo.com/cts",
3
-  "version": "1.0.4",
3
+  "version": "1.0.9",
4 4
   "description": "cts, chat-ts-sdk",
5 5
   "repository": {
6 6
     "type": "git",
@@ -90,7 +90,7 @@
90 90
     "workerize-loader": "^1.0.4"
91 91
   },
92 92
   "dependencies": {
93
-    "@bilingo.com/ts-linker-sdk": "^1.0.3",
93
+    "@bilingo.com/ts-linker-sdk": "^1.0.4",
94 94
     "@types/uuid": "^8.3.1",
95 95
     "uuid": "^8.3.2"
96 96
   }

+ 17
- 3
packages/cts-api/dist/cjs/WebSocketClient.js 查看文件

@@ -121,7 +121,7 @@ var WebSocketClient = (function () {
121 121
                             onClose: function () {
122 122
                                 clearInterval(_this.interval);
123 123
                             }
124
-                        }, binaryType);
124
+                        }, binaryType, true);
125 125
                     })];
126 126
             });
127 127
         });
@@ -156,7 +156,7 @@ var WebSocketClient = (function () {
156 156
                         if (this.extendOpts && this.extendOpts.connectOptions) {
157 157
                             param = __assign({}, param, this.extendOpts.connectOptions);
158 158
                         }
159
-                        return [4, this.request('/v1/session/start', __assign({}, this.chatToken, meta))];
159
+                        return [4, this.request('/v1/session/start', __assign({}, param))];
160 160
                     case 1:
161 161
                         data = _a.sent();
162 162
                         if (data && data.value) {
@@ -247,7 +247,7 @@ var WebSocketClient = (function () {
247 247
     WebSocketClient.prototype.getAllContact = function (data) {
248 248
         return __awaiter(this, void 0, void 0, function () {
249 249
             return __generator(this, function (_a) {
250
-                return [2, this.request('/v1/get/all/contact', data)];
250
+                return [2, this.request('/v1/users/friends', data)];
251 251
             });
252 252
         });
253 253
     };
@@ -426,6 +426,13 @@ var WebSocketClient = (function () {
426 426
             });
427 427
         });
428 428
     };
429
+    WebSocketClient.prototype.setConversationIsTop = function (data) {
430
+        return __awaiter(this, void 0, void 0, function () {
431
+            return __generator(this, function (_a) {
432
+                return [2, this.request('/v1/set/conversation/is/top/request', data)];
433
+            });
434
+        });
435
+    };
429 436
     WebSocketClient.prototype.searchHistoryMessage = function (data) {
430 437
         return __awaiter(this, void 0, void 0, function () {
431 438
             return __generator(this, function (_a) {
@@ -433,6 +440,13 @@ var WebSocketClient = (function () {
433 440
             });
434 441
         });
435 442
     };
443
+    WebSocketClient.prototype.startGroupChat = function (data) {
444
+        return __awaiter(this, void 0, void 0, function () {
445
+            return __generator(this, function (_a) {
446
+                return [2, this.request('/v1/create/group/request', data)];
447
+            });
448
+        });
449
+    };
436 450
     return WebSocketClient;
437 451
 }());
438 452
 exports.WebSocketClient = WebSocketClient;

+ 3
- 2
packages/cts-api/dist/cjs/api/WsApi.js 查看文件

@@ -124,9 +124,10 @@ var WsApi = (function (_super) {
124 124
             delete_message: deleteMessage
125 125
         });
126 126
     };
127
-    WsApi.prototype.markMessageRead = function (contactId) {
127
+    WsApi.prototype.markMessageRead = function (contactId, chatType) {
128 128
         return this.request('/v1/mark/messages/read', {
129
-            contact: contactId
129
+            contact: contactId,
130
+            msg_type: chatType,
130 131
         });
131 132
     };
132 133
     WsApi.prototype.listGroups = function () {

+ 2
- 2
packages/cts-api/dist/index.js
文件差异内容过多而无法显示
查看文件


+ 52
- 40
packages/cts-api/dist/types/WebSocketClient.d.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 import { Client } from '@bilingo.com/ts-linker-sdk';
2
-import { ContactMsg, ContactAddMsg, ChatroomMsg } from './messages';
2
+import { ContactMsg, ContactAddMsg, ChatroomMsg, ConversationTop } from './messages';
3 3
 export interface WebSocketClientStatus {
4 4
     created: boolean;
5 5
     connected: boolean;
@@ -24,73 +24,85 @@ export declare class WebSocketClient {
24 24
     create(): Promise<{}>;
25 25
     on(url: string, callback: (data: WebSocketResp) => void): void;
26 26
     off(url: string): void;
27
-    request(url: string, data: object): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
28
-    connect(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
29
-    ping(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
30
-    authentication(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
27
+    request(url: string, data: object): Promise<any>;
28
+    connect(): Promise<any>;
29
+    ping(): Promise<any>;
30
+    authentication(): Promise<any>;
31 31
     onMessage(callback: ListenerCallback): Promise<void>;
32
-    sendMessage(data: object): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
32
+    sendMessage(data: object): Promise<any>;
33 33
     markServiced(data: {
34 34
         msg_id: string;
35
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
35
+    }): Promise<any>;
36 36
     messageReaded(data: {
37 37
         msg_id: string;
38
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
38
+    }): Promise<any>;
39 39
     getHistoryMessage(data: {
40 40
         contact_id: string;
41 41
         chat_type: string;
42 42
         start_time: number;
43 43
         limit: number;
44
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
44
+    }): Promise<any>;
45 45
     updateStatus(data: {
46 46
         status: 'on' | 'off' | 'busy';
47
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
48
-    getSessionLists(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
47
+    }): Promise<any>;
48
+    getSessionLists(): Promise<any>;
49 49
     getAllConversations(data: {
50 50
         last_pull: number;
51
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
51
+    }): Promise<any>;
52 52
     getAllContact(data: {
53
-        last_pull: number;
54
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
53
+        page: number;
54
+        limit: number;
55
+    }): Promise<any>;
55 56
     addContact(data: {
56 57
         to_add_username: string;
57 58
         reason: string;
58
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
59
-    deleteContact(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
60
-    maskingContact(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
61
-    removeMaskingContact(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
62
-    stickingContact(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
63
-    removeStickContact(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
64
-    setNoDisturbing(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
65
-    removeNoDisturbing(data: ContactMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
66
-    agreeAddContact(data: ContactAddMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
67
-    rejectAddContact(data: ContactAddMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
68
-    addContactServiced(data: ContactAddMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
59
+    }): Promise<any>;
60
+    deleteContact(data: ContactMsg): Promise<any>;
61
+    maskingContact(data: ContactMsg): Promise<any>;
62
+    removeMaskingContact(data: ContactMsg): Promise<any>;
63
+    stickingContact(data: ContactMsg): Promise<any>;
64
+    removeStickContact(data: ContactMsg): Promise<any>;
65
+    setNoDisturbing(data: ContactMsg): Promise<any>;
66
+    removeNoDisturbing(data: ContactMsg): Promise<any>;
67
+    agreeAddContact(data: ContactAddMsg): Promise<any>;
68
+    rejectAddContact(data: ContactAddMsg): Promise<any>;
69
+    addContactServiced(data: ContactAddMsg): Promise<any>;
69 70
     createChatroom(data: {
70 71
         subject: string;
71 72
         description: string;
72 73
         welcome_message: string;
73 74
         max: number;
74
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
75
-    destroyChatroom(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
76
-    leaveChatroom(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
77
-    getChatroomProfile(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
78
-    updateChatroomSubject(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
79
-    updateChatroomDescription(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
80
-    addChatroomAdmin(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
81
-    removeChatroomAdmin(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
82
-    addChatroomAdmins(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
83
-    removeChatroomAdmins(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
84
-    joinChatroom(data: {}): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
85
-    removeChatroomMember(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
75
+    }): Promise<any>;
76
+    destroyChatroom(data: ChatroomMsg): Promise<any>;
77
+    leaveChatroom(data: ChatroomMsg): Promise<any>;
78
+    getChatroomProfile(data: ChatroomMsg): Promise<any>;
79
+    updateChatroomSubject(data: ChatroomMsg): Promise<any>;
80
+    updateChatroomDescription(data: ChatroomMsg): Promise<any>;
81
+    addChatroomAdmin(data: ChatroomMsg): Promise<any>;
82
+    removeChatroomAdmin(data: ChatroomMsg): Promise<any>;
83
+    addChatroomAdmins(data: ChatroomMsg): Promise<any>;
84
+    removeChatroomAdmins(data: ChatroomMsg): Promise<any>;
85
+    joinChatroom(data: {}): Promise<any>;
86
+    removeChatroomMember(data: ChatroomMsg): Promise<any>;
86 87
     fetchStickChatroom(data: {
87 88
         cache_time: number;
88
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
89
-    fetchChatroomMembers(data: ChatroomMsg): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
89
+    }): Promise<any>;
90
+    fetchChatroomMembers(data: ChatroomMsg): Promise<any>;
91
+    setConversationIsTop(data: ConversationTop): Promise<any>;
90 92
     searchHistoryMessage(data: {
91 93
         contact_id: string;
92 94
         chat_type: string;
93 95
         keyword: string;
94 96
         limit: number;
95
-    }): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
97
+    }): Promise<any>;
98
+    startGroupChat(data: {
99
+        subject: string;
100
+        description?: string;
101
+        contact_list: {
102
+            id: string;
103
+            source: string;
104
+        }[];
105
+        welcome_message?: string;
106
+        group_type: number;
107
+    }): Promise<any>;
96 108
 }

+ 27
- 27
packages/cts-api/dist/types/api/WsApi.d.ts 查看文件

@@ -3,31 +3,31 @@ import { MsgBase, GroupOption } from '../protocol/MsgBase';
3 3
 export declare class WsApi extends WebSocketClient {
4 4
     token: string;
5 5
     from: string;
6
-    sendMsg(msg: Partial<MsgBase>): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
7
-    sendGetCmdMsg(action: string, extra?: {}): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
8
-    sendPostCmdMsg(action: string, userIds: string[] | null, extra?: {}): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
9
-    getRoster(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
10
-    addFriends(userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
11
-    agreeFriends(userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
12
-    rejectFriends(userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
13
-    removeFriends(userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
14
-    getBlacklist(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
15
-    addToBlackList(userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
16
-    removeBlackList(userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
17
-    deleteConversation(contactId: string, deleteMessage?: boolean): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
18
-    markMessageRead(contactId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
19
-    listGroups(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
20
-    queryGroupInfo(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
21
-    queryRoomMember(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
22
-    getGroupBlackList(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
23
-    createGroup(groupOption: GroupOption): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
24
-    changeGroupInfo(groupOption: GroupOption): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
25
-    addGroupMembers(roomId: string, userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
26
-    addToGroupBlackList(roomId: string, userIds: string[]): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
27
-    destroyGroup(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
28
-    leaveGroup(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
29
-    createRoom(groupOption: GroupOption): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
30
-    listRooms(): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
31
-    joinRoom(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
32
-    quitRoom(roomId: string): Promise<import("@bilingo.com/ts-linker-sdk/dist/types/types").WebSocketResp>;
6
+    sendMsg(msg: Partial<MsgBase>): Promise<any>;
7
+    sendGetCmdMsg(action: string, extra?: {}): Promise<any>;
8
+    sendPostCmdMsg(action: string, userIds: string[] | null, extra?: {}): Promise<any>;
9
+    getRoster(): Promise<any>;
10
+    addFriends(userIds: string[]): Promise<any>;
11
+    agreeFriends(userIds: string[]): Promise<any>;
12
+    rejectFriends(userIds: string[]): Promise<any>;
13
+    removeFriends(userIds: string[]): Promise<any>;
14
+    getBlacklist(): Promise<any>;
15
+    addToBlackList(userIds: string[]): Promise<any>;
16
+    removeBlackList(userIds: string[]): Promise<any>;
17
+    deleteConversation(contactId: string, deleteMessage?: boolean): Promise<any>;
18
+    markMessageRead(contactId: string, chatType: string): Promise<any>;
19
+    listGroups(): Promise<any>;
20
+    queryGroupInfo(roomId: string): Promise<any>;
21
+    queryRoomMember(roomId: string): Promise<any>;
22
+    getGroupBlackList(roomId: string): Promise<any>;
23
+    createGroup(groupOption: GroupOption): Promise<any>;
24
+    changeGroupInfo(groupOption: GroupOption): Promise<any>;
25
+    addGroupMembers(roomId: string, userIds: string[]): Promise<any>;
26
+    addToGroupBlackList(roomId: string, userIds: string[]): Promise<any>;
27
+    destroyGroup(roomId: string): Promise<any>;
28
+    leaveGroup(roomId: string): Promise<any>;
29
+    createRoom(groupOption: GroupOption): Promise<any>;
30
+    listRooms(): Promise<any>;
31
+    joinRoom(roomId: string): Promise<any>;
32
+    quitRoom(roomId: string): Promise<any>;
33 33
 }

+ 5
- 0
packages/cts-api/dist/types/messages.d.ts 查看文件

@@ -26,3 +26,8 @@ export interface ChatMsg {
26 26
     msg_id?: string;
27 27
     ext?: Record<string, string>;
28 28
 }
29
+export interface ConversationTop {
30
+    to: string;
31
+    is_top: boolean;
32
+    type: string;
33
+}

+ 1
- 1
packages/cts-api/package.json 查看文件

@@ -35,7 +35,7 @@
35 35
     "start": "npm run dev"
36 36
   },
37 37
   "dependencies": {
38
-    "@bilingo.com/ts-linker-sdk": "^1.0.0",
38
+    "@bilingo.com/ts-linker-sdk": "^1.0.4",
39 39
     "@types/uuid": "^8.3.1",
40 40
     "uuid": "^8.3.2"
41 41
   },

+ 25
- 6
packages/cts-api/src/WebSocketClient.ts 查看文件

@@ -1,6 +1,6 @@
1 1
 import { Client } from '@bilingo.com/ts-linker-sdk';
2 2
 
3
-import { ContactMsg, ContactAddMsg, ChatroomMsg } from './messages';
3
+import { ContactMsg, ContactAddMsg, ChatroomMsg, ConversationTop } from './messages';
4 4
 import { getMetaData } from './meta';
5 5
 
6 6
 export interface WebSocketClientStatus {
@@ -84,7 +84,7 @@ export class WebSocketClient {
84 84
         onClose: () => {
85 85
           clearInterval(this.interval);
86 86
         }
87
-      }, binaryType as BinaryType);
87
+      }, binaryType as BinaryType, true);
88 88
     });
89 89
   }
90 90
 
@@ -122,8 +122,7 @@ export class WebSocketClient {
122 122
     }
123 123
 
124 124
     const data = await this.request('/v1/session/start', {
125
-      ...this.chatToken,
126
-      ...meta
125
+      ...param,
127 126
     });
128 127
 
129 128
     if (data && data.value) {
@@ -191,9 +190,10 @@ export class WebSocketClient {
191 190
 
192 191
   /** 获取联系人列表 */
193 192
   async getAllContact(data: {
194
-    last_pull: number; // 最后一次获取的时间 0的话是全量获取
193
+    page: number;
194
+    limit: number;
195 195
   }) {
196
-    return this.request('/v1/get/all/contact', data);
196
+    return this.request('/v1/users/friends', data);
197 197
   }
198 198
 
199 199
   /** 添加联系人 */
@@ -326,6 +326,11 @@ export class WebSocketClient {
326 326
     return this.request('/v1/fetch/chatroom/members', data);
327 327
   }
328 328
 
329
+  /** 置顶/取消置顶会话消息 */
330
+  async setConversationIsTop(data: ConversationTop) {
331
+    return this.request('/v1/set/conversation/is/top/request', data);
332
+  }
333
+
329 334
   /** 搜索聊天室历史消息 */
330 335
   async searchHistoryMessage(data: {
331 336
     contact_id: string;
@@ -335,4 +340,18 @@ export class WebSocketClient {
335 340
   }) {
336 341
     return this.request('/v1/search/history/message', data);
337 342
   }
343
+
344
+  /** 发起群聊 */
345
+  async startGroupChat(data: {
346
+    subject: string,
347
+    description?: string,
348
+    contact_list: {
349
+      id: string,
350
+      source: string,
351
+    }[],
352
+    welcome_message?: string,
353
+    group_type: number,
354
+  }) {
355
+    return this.request('/v1/create/group/request', data)
356
+  }
338 357
 }

+ 3
- 2
packages/cts-api/src/api/WsApi.ts 查看文件

@@ -84,9 +84,10 @@ export class WsApi extends WebSocketClient {
84 84
   }
85 85
 
86 86
   // 标记会话消息为已读
87
-  markMessageRead(contactId: string) {
87
+  markMessageRead(contactId: string, chatType: string) {
88 88
     return this.request('/v1/mark/messages/read', {
89
-      contact: contactId
89
+      contact: contactId,
90
+      msg_type: chatType,
90 91
     });
91 92
   }
92 93
   /** @end 会话管理 */

+ 6
- 0
packages/cts-api/src/messages.ts 查看文件

@@ -37,3 +37,9 @@ export interface ChatMsg {
37 37
   msg_id?: string;
38 38
   ext?: Record<string, string>;
39 39
 }
40
+
41
+export interface ConversationTop {
42
+  to: string; // 会话id
43
+  is_top: boolean; // 是否置顶
44
+  type: string; // 会话类型 群、聊天室、个人、推送消息
45
+}