瀏覽代碼

chore: update

wxyyxc1992 5 年之前
父節點
當前提交
f850f011e4

+ 210
- 0
packages/cts-api/dist/cjs/WebSocketClient.js 查看文件

@@ -207,6 +207,216 @@ var WebSocketClient = (function () {
207 207
             });
208 208
         });
209 209
     };
210
+    WebSocketClient.prototype.updateStatus = function (data) {
211
+        return __awaiter(this, void 0, void 0, function () {
212
+            return __generator(this, function (_a) {
213
+                return [2, this.request('/v1/session/status', data)];
214
+            });
215
+        });
216
+    };
217
+    WebSocketClient.prototype.getSessionLists = function () {
218
+        return __awaiter(this, void 0, void 0, function () {
219
+            return __generator(this, function (_a) {
220
+                return [2, this.request('/v1/session/lists', {})];
221
+            });
222
+        });
223
+    };
224
+    WebSocketClient.prototype.getAllConversations = function (data) {
225
+        return __awaiter(this, void 0, void 0, function () {
226
+            return __generator(this, function (_a) {
227
+                return [2, this.request('/v1/get/all/conversation', data)];
228
+            });
229
+        });
230
+    };
231
+    WebSocketClient.prototype.getAllContact = function (data) {
232
+        return __awaiter(this, void 0, void 0, function () {
233
+            return __generator(this, function (_a) {
234
+                return [2, this.request('/v1/get/all/contact', data)];
235
+            });
236
+        });
237
+    };
238
+    WebSocketClient.prototype.addContact = function (data) {
239
+        return __awaiter(this, void 0, void 0, function () {
240
+            return __generator(this, function (_a) {
241
+                return [2, this.request('/v1/add/contact', data)];
242
+            });
243
+        });
244
+    };
245
+    WebSocketClient.prototype.deleteContact = function (data) {
246
+        return __awaiter(this, void 0, void 0, function () {
247
+            return __generator(this, function (_a) {
248
+                return [2, this.request('/v1/delete/contact', data)];
249
+            });
250
+        });
251
+    };
252
+    WebSocketClient.prototype.maskingContact = function (data) {
253
+        return __awaiter(this, void 0, void 0, function () {
254
+            return __generator(this, function (_a) {
255
+                return [2, this.request('/v1/add/contact/masking', data)];
256
+            });
257
+        });
258
+    };
259
+    WebSocketClient.prototype.removeMaskingContact = function (data) {
260
+        return __awaiter(this, void 0, void 0, function () {
261
+            return __generator(this, function (_a) {
262
+                return [2, this.request('/v1/remove/contact/masking', data)];
263
+            });
264
+        });
265
+    };
266
+    WebSocketClient.prototype.stickingContact = function (data) {
267
+        return __awaiter(this, void 0, void 0, function () {
268
+            return __generator(this, function (_a) {
269
+                return [2, this.request('/v1/add/contact/stick', data)];
270
+            });
271
+        });
272
+    };
273
+    WebSocketClient.prototype.removeStickContact = function (data) {
274
+        return __awaiter(this, void 0, void 0, function () {
275
+            return __generator(this, function (_a) {
276
+                return [2, this.request('/v1/remove/contact/stick', data)];
277
+            });
278
+        });
279
+    };
280
+    WebSocketClient.prototype.setNoDisturbing = function (data) {
281
+        return __awaiter(this, void 0, void 0, function () {
282
+            return __generator(this, function (_a) {
283
+                return [2, this.request('/v1/add/contact/no/disturbing', data)];
284
+            });
285
+        });
286
+    };
287
+    WebSocketClient.prototype.removeNoDisturbing = function (data) {
288
+        return __awaiter(this, void 0, void 0, function () {
289
+            return __generator(this, function (_a) {
290
+                return [2, this.request('/v1/remove/contact/no/disturbing', data)];
291
+            });
292
+        });
293
+    };
294
+    WebSocketClient.prototype.agreeAddContact = function (data) {
295
+        return __awaiter(this, void 0, void 0, function () {
296
+            return __generator(this, function (_a) {
297
+                return [2, this.request('/v1/add/contact/agree', data)];
298
+            });
299
+        });
300
+    };
301
+    WebSocketClient.prototype.rejectAddContact = function (data) {
302
+        return __awaiter(this, void 0, void 0, function () {
303
+            return __generator(this, function (_a) {
304
+                return [2, this.request('/v1/add/contact/reject', data)];
305
+            });
306
+        });
307
+    };
308
+    WebSocketClient.prototype.addContactServiced = function (data) {
309
+        return __awaiter(this, void 0, void 0, function () {
310
+            return __generator(this, function (_a) {
311
+                return [2, this.request('/v1/add/contact/serviced', data)];
312
+            });
313
+        });
314
+    };
315
+    WebSocketClient.prototype.createChatroom = function (data) {
316
+        return __awaiter(this, void 0, void 0, function () {
317
+            return __generator(this, function (_a) {
318
+                return [2, this.request('/v1/create/chatroom', data)];
319
+            });
320
+        });
321
+    };
322
+    WebSocketClient.prototype.destroyChatroom = function (data) {
323
+        return __awaiter(this, void 0, void 0, function () {
324
+            return __generator(this, function (_a) {
325
+                return [2, this.request('/v1/destroy/chatroom', data)];
326
+            });
327
+        });
328
+    };
329
+    WebSocketClient.prototype.leaveChatroom = function (data) {
330
+        return __awaiter(this, void 0, void 0, function () {
331
+            return __generator(this, function (_a) {
332
+                return [2, this.request('/v1/leave/chatroom', data)];
333
+            });
334
+        });
335
+    };
336
+    WebSocketClient.prototype.getChatroomProfile = function (data) {
337
+        return __awaiter(this, void 0, void 0, function () {
338
+            return __generator(this, function (_a) {
339
+                return [2, this.request('/v1/get/chatroom/profile', data)];
340
+            });
341
+        });
342
+    };
343
+    WebSocketClient.prototype.updateChatroomSubject = function (data) {
344
+        return __awaiter(this, void 0, void 0, function () {
345
+            return __generator(this, function (_a) {
346
+                return [2, this.request('/v1/update/chatroom/subject', data)];
347
+            });
348
+        });
349
+    };
350
+    WebSocketClient.prototype.updateChatroomDescription = function (data) {
351
+        return __awaiter(this, void 0, void 0, function () {
352
+            return __generator(this, function (_a) {
353
+                return [2, this.request('/v1/update/chatroom/description', data)];
354
+            });
355
+        });
356
+    };
357
+    WebSocketClient.prototype.addChatroomAdmin = function (data) {
358
+        return __awaiter(this, void 0, void 0, function () {
359
+            return __generator(this, function (_a) {
360
+                return [2, this.request('/v1/add/chatroom/admin', data)];
361
+            });
362
+        });
363
+    };
364
+    WebSocketClient.prototype.removeChatroomAdmin = function (data) {
365
+        return __awaiter(this, void 0, void 0, function () {
366
+            return __generator(this, function (_a) {
367
+                return [2, this.request('/v1/remove/chatroom/admin', data)];
368
+            });
369
+        });
370
+    };
371
+    WebSocketClient.prototype.addChatroomAdmins = function (data) {
372
+        return __awaiter(this, void 0, void 0, function () {
373
+            return __generator(this, function (_a) {
374
+                return [2, this.request('/v1/add/chatroom/admins', data)];
375
+            });
376
+        });
377
+    };
378
+    WebSocketClient.prototype.removeChatroomAdmins = function (data) {
379
+        return __awaiter(this, void 0, void 0, function () {
380
+            return __generator(this, function (_a) {
381
+                return [2, this.request('/v1/remove/chatroom/admins', data)];
382
+            });
383
+        });
384
+    };
385
+    WebSocketClient.prototype.joinChatroom = function (data) {
386
+        return __awaiter(this, void 0, void 0, function () {
387
+            return __generator(this, function (_a) {
388
+                return [2, this.request('/v1/join/chatroom', data)];
389
+            });
390
+        });
391
+    };
392
+    WebSocketClient.prototype.removeChatroomMember = function (data) {
393
+        return __awaiter(this, void 0, void 0, function () {
394
+            return __generator(this, function (_a) {
395
+                return [2, this.request('/v1/remove/chatroom/member', data)];
396
+            });
397
+        });
398
+    };
399
+    WebSocketClient.prototype.fetchStickChatroom = function (data) {
400
+        return __awaiter(this, void 0, void 0, function () {
401
+            return __generator(this, function (_a) {
402
+                return [2, this.request('/v1/fetch/stick/chatroom', data)];
403
+            });
404
+        });
405
+    };
406
+    WebSocketClient.prototype.fetchChatroomMembers = function (data) {
407
+        return __awaiter(this, void 0, void 0, function () {
408
+            return __generator(this, function (_a) {
409
+                return [2, this.request('/v1/fetch/chatroom/members', data)];
410
+            });
411
+        });
412
+    };
413
+    WebSocketClient.prototype.searchHistoryMessage = function (data) {
414
+        return __awaiter(this, void 0, void 0, function () {
415
+            return __generator(this, function (_a) {
416
+                return [2, this.request('/v1/search/history/message', data)];
417
+            });
418
+        });
419
+    };
210 420
     return WebSocketClient;
211 421
 }());
212 422
 exports.WebSocketClient = WebSocketClient;

+ 2
- 0
packages/cts-api/dist/cjs/messages.js 查看文件

@@ -0,0 +1,2 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });

+ 4
- 4
packages/cts-api/dist/index.js
文件差異過大導致無法顯示
查看文件


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

@@ -1,3 +1,4 @@
1
+import { ContactMsg, ContactAddMsg, ChatroomMsg } from './messages';
1 2
 import { Client } from 'ts-linker-sdk';
2 3
 export interface WebSocketClientStatus {
3 4
     created: boolean;
@@ -28,6 +29,64 @@ export declare class WebSocketClient {
28 29
     authentication(): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
29 30
     onMessage(callback: ListenerCallback): Promise<void>;
30 31
     sendMessage(data: object): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
31
-    markServiced(data: object): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
32
-    getHistoryMessage(data: object): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
32
+    markServiced(data: {
33
+        msg_id: string;
34
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
35
+    getHistoryMessage(data: {
36
+        contact_id: string;
37
+        chat_type: string;
38
+        start_time: number;
39
+        limit: number;
40
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
41
+    updateStatus(data: {
42
+        status: 'on' | 'off' | 'busy';
43
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
44
+    getSessionLists(): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
45
+    getAllConversations(data: {
46
+        last_pull: number;
47
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
48
+    getAllContact(data: {
49
+        last_pull: number;
50
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
51
+    addContact(data: {
52
+        to_add_username: string;
53
+        reason: string;
54
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
55
+    deleteContact(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
56
+    maskingContact(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
57
+    removeMaskingContact(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
58
+    stickingContact(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
59
+    removeStickContact(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
60
+    setNoDisturbing(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
61
+    removeNoDisturbing(data: ContactMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
62
+    agreeAddContact(data: ContactAddMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
63
+    rejectAddContact(data: ContactAddMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
64
+    addContactServiced(data: ContactAddMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
65
+    createChatroom(data: {
66
+        subject: string;
67
+        description: string;
68
+        welcome_message: string;
69
+        max: number;
70
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
71
+    destroyChatroom(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
72
+    leaveChatroom(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
73
+    getChatroomProfile(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
74
+    updateChatroomSubject(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
75
+    updateChatroomDescription(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
76
+    addChatroomAdmin(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
77
+    removeChatroomAdmin(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
78
+    addChatroomAdmins(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
79
+    removeChatroomAdmins(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
80
+    joinChatroom(data: {}): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
81
+    removeChatroomMember(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
82
+    fetchStickChatroom(data: {
83
+        cache_time: number;
84
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
85
+    fetchChatroomMembers(data: ChatroomMsg): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
86
+    searchHistoryMessage(data: {
87
+        contact_id: string;
88
+        chat_type: string;
89
+        keyword: string;
90
+        limit: number;
91
+    }): Promise<import("ts-linker-sdk/dist/types/types").WebSocketResp>;
33 92
 }

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

@@ -0,0 +1,14 @@
1
+export interface ContactMsg {
2
+    fid: string;
3
+}
4
+export interface ContactAddMsg {
5
+    id: string;
6
+    to: string;
7
+}
8
+export interface ChatroomMsg {
9
+    room_id: string;
10
+    admin_id?: string;
11
+    admins_id?: string[];
12
+    member: string;
13
+    authority?: number;
14
+}

+ 22
- 21
packages/cts-api/src/WebSocketClient.ts 查看文件

@@ -1,3 +1,4 @@
1
+import { ContactMsg, ContactAddMsg, ChatroomMsg } from './messages';
1 2
 import { Client } from 'ts-linker-sdk';
2 3
 import { getMetaData } from './meta';
3 4
 
@@ -179,52 +180,52 @@ export class WebSocketClient {
179 180
   }
180 181
 
181 182
   /** 删除联系人 */
182
-  async deleteContact(data: { fid: string }) {
183
+  async deleteContact(data: ContactMsg) {
183 184
     return this.request('/v1/delete/contact', data);
184 185
   }
185 186
 
186 187
   /** 屏蔽联系人 */
187
-  async maskingContact(data: { fid: string }) {
188
+  async maskingContact(data: ContactMsg) {
188 189
     return this.request('/v1/add/contact/masking', data);
189 190
   }
190 191
 
191 192
   /** 取消联系人 */
192
-  async removeMaskingContact(data: { fid: string }) {
193
+  async removeMaskingContact(data: ContactMsg) {
193 194
     return this.request('/v1/remove/contact/masking', data);
194 195
   }
195 196
 
196 197
   /** 置顶联系人 */
197
-  async stickingContact(data: { fid: string }) {
198
+  async stickingContact(data: ContactMsg) {
198 199
     return this.request('/v1/add/contact/stick', data);
199 200
   }
200 201
 
201 202
   /** 解除置顶联系人 */
202
-  async removeStickContact(data: { fid: string }) {
203
+  async removeStickContact(data: ContactMsg) {
203 204
     return this.request('/v1/remove/contact/stick', data);
204 205
   }
205 206
 
206 207
   /** 消息免打扰 */
207
-  async setNoDisturbing(data: { fid: string }) {
208
+  async setNoDisturbing(data: ContactMsg) {
208 209
     return this.request('/v1/add/contact/no/disturbing', data);
209 210
   }
210 211
 
211 212
   /** 取消消息免打扰 */
212
-  async removeNoDisturbing(data: { fid: string }) {
213
+  async removeNoDisturbing(data: ContactMsg) {
213 214
     return this.request('/v1/remove/contact/no/disturbing', data);
214 215
   }
215 216
 
216 217
   /** 同意添加好友 */
217
-  async agreeAddContact(data: { id: string; to: string }) {
218
+  async agreeAddContact(data: ContactAddMsg) {
218 219
     return this.request('/v1/add/contact/agree', data);
219 220
   }
220 221
 
221 222
   /** 拒绝添加好友 */
222
-  async rejectAddContact(data: { id: string; to: string }) {
223
+  async rejectAddContact(data: ContactAddMsg) {
223 224
     return this.request('/v1/add/contact/reject', data);
224 225
   }
225 226
 
226 227
   /** 标记好友申请已发送 */
227
-  async addContactServiced(data: { id: string; to: string }) {
228
+  async addContactServiced(data: ContactAddMsg) {
228 229
     return this.request('/v1/add/contact/serviced', data);
229 230
   }
230 231
 
@@ -239,47 +240,47 @@ export class WebSocketClient {
239 240
   }
240 241
 
241 242
   /** 销毁聊天室 */
242
-  async destroyChatroom(data: { room_id: string }) {
243
+  async destroyChatroom(data: ChatroomMsg) {
243 244
     return this.request('/v1/destroy/chatroom', data);
244 245
   }
245 246
 
246 247
   /** 离开聊天室 */
247
-  async leaveChatroom(data: { room_id: string }) {
248
+  async leaveChatroom(data: ChatroomMsg) {
248 249
     return this.request('/v1/leave/chatroom', data);
249 250
   }
250 251
 
251 252
   /** 获取聊天室详情 */
252
-  async getChatroomProfile(data: { room_id: string }) {
253
+  async getChatroomProfile(data: ChatroomMsg) {
253 254
     return this.request('/v1/get/chatroom/profile', data);
254 255
   }
255 256
 
256 257
   /** 修改聊天室名称 */
257
-  async updateChatroomSubject(data: { room_id: string }) {
258
+  async updateChatroomSubject(data: ChatroomMsg) {
258 259
     return this.request('/v1/update/chatroom/subject', data);
259 260
   }
260 261
 
261 262
   /** 修改聊天室描述信息 */
262
-  async updateChatroomDescription(data: { room_id: string }) {
263
+  async updateChatroomDescription(data: ChatroomMsg) {
263 264
     return this.request('/v1/update/chatroom/description', data);
264 265
   }
265 266
 
266 267
   /** 添加管理员 */
267
-  async addChatroomAdmin(data: { room_id: string; admin_id: string }) {
268
+  async addChatroomAdmin(data: ChatroomMsg) {
268 269
     return this.request('/v1/add/chatroom/admin', data);
269 270
   }
270 271
 
271 272
   /** 移除管理员 */
272
-  async removeChatroomAdmin(data: { room_id: string; admin_id: string }) {
273
+  async removeChatroomAdmin(data: ChatroomMsg) {
273 274
     return this.request('/v1/remove/chatroom/admin', data);
274 275
   }
275 276
 
276 277
   /** 批量添加管理员 */
277
-  async addChatroomAdmins(data: { room_id: string; admins_id: string[] }) {
278
+  async addChatroomAdmins(data: ChatroomMsg) {
278 279
     return this.request('/v1/add/chatroom/admins', data);
279 280
   }
280 281
 
281 282
   /** 批量移除管理员 */
282
-  async removeChatroomAdmins(data: { room_id: string; admins_id: string[] }) {
283
+  async removeChatroomAdmins(data: ChatroomMsg) {
283 284
     return this.request('/v1/remove/chatroom/admins', data);
284 285
   }
285 286
 
@@ -289,7 +290,7 @@ export class WebSocketClient {
289 290
   }
290 291
 
291 292
   /** 删除聊天室成员 */
292
-  async removeChatroomMember(data: { room_id: string; member: string }) {
293
+  async removeChatroomMember(data: ChatroomMsg) {
293 294
     return this.request('/v1/remove/chatroom/member', data);
294 295
   }
295 296
 
@@ -299,7 +300,7 @@ export class WebSocketClient {
299 300
   }
300 301
 
301 302
   /** 获取聊天室成员 */
302
-  async fetchChatroomMembers(data: { room_id: string; authority: number }) {
303
+  async fetchChatroomMembers(data: ChatroomMsg) {
303 304
     return this.request('/v1/fetch/chatroom/members', data);
304 305
   }
305 306
 

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

@@ -0,0 +1,24 @@
1
+/** 对于消息类型的定义 */
2
+export interface ContactMsg {
3
+  fid: string;
4
+}
5
+
6
+export interface ContactAddMsg {
7
+  id: string;
8
+  to: string;
9
+}
10
+
11
+export interface ChatroomMsg {
12
+  room_id: string;
13
+
14
+  // 管理与编号
15
+  admin_id?: string;
16
+
17
+  // 管理与列表
18
+  admins_id?: string[];
19
+
20
+  // 成员 ID
21
+  member: string;
22
+
23
+  authority?: number;
24
+}