Browse Source

chore:update

wx-chevalier 5 years ago
parent
commit
c3ca62c674

+ 23
- 4
packages/cts-api/dist/cjs/api/WsApi.js View File

1
 "use strict";
1
 "use strict";
2
+var __extends = (this && this.__extends) || (function () {
3
+    var extendStatics = function (d, b) {
4
+        extendStatics = Object.setPrototypeOf ||
5
+            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+        return extendStatics(d, b);
8
+    };
9
+    return function (d, b) {
10
+        extendStatics(d, b);
11
+        function __() { this.constructor = d; }
12
+        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+    };
14
+})();
2
 var __assign = (this && this.__assign) || function () {
15
 var __assign = (this && this.__assign) || function () {
3
     __assign = Object.assign || function(t) {
16
     __assign = Object.assign || function(t) {
4
         for (var s, i = 1, n = arguments.length; i < n; i++) {
17
         for (var s, i = 1, n = arguments.length; i < n; i++) {
46
     }
59
     }
47
 };
60
 };
48
 Object.defineProperty(exports, "__esModule", { value: true });
61
 Object.defineProperty(exports, "__esModule", { value: true });
62
+var WebSocketClient_1 = require("./../WebSocketClient");
49
 var CmdMsg_1 = require("../protocol/CmdMsg");
63
 var CmdMsg_1 = require("../protocol/CmdMsg");
50
-var WsApi = (function () {
64
+var WsApi = (function (_super) {
65
+    __extends(WsApi, _super);
51
     function WsApi() {
66
     function WsApi() {
67
+        return _super !== null && _super.apply(this, arguments) || this;
52
     }
68
     }
53
     WsApi.prototype.sendMsg = function (msg) {
69
     WsApi.prototype.sendMsg = function (msg) {
54
         return __awaiter(this, void 0, void 0, function () {
70
         return __awaiter(this, void 0, void 0, function () {
55
             return __generator(this, function (_a) {
71
             return __generator(this, function (_a) {
56
-                console.log(msg);
57
-                return [2];
72
+                return [2, this.sendMessage(msg)];
58
             });
73
             });
59
         });
74
         });
60
     };
75
     };
102
     WsApi.prototype.removeBlackList = function (userIds) {
117
     WsApi.prototype.removeBlackList = function (userIds) {
103
         return this.sendPostCmdMsg('removeBlackList', userIds);
118
         return this.sendPostCmdMsg('removeBlackList', userIds);
104
     };
119
     };
120
+    WsApi.prototype.deleteConversation = function (contactId, delete_message) {
121
+        if (delete_message === void 0) { delete_message = false; }
122
+        return this.request('/v1/delete/conversation', { contact: contactId, delete_message: delete_message });
123
+    };
105
     WsApi.prototype.listGroups = function () {
124
     WsApi.prototype.listGroups = function () {
106
         return this.sendGetCmdMsg('listGroups');
125
         return this.sendGetCmdMsg('listGroups');
107
     };
126
     };
153
         return this.sendPostCmdMsg('quitRoom', [roomId]);
172
         return this.sendPostCmdMsg('quitRoom', [roomId]);
154
     };
173
     };
155
     return WsApi;
174
     return WsApi;
156
-}());
175
+}(WebSocketClient_1.WebSocketClient));
157
 exports.WsApi = WsApi;
176
 exports.WsApi = WsApi;

+ 2
- 0
packages/cts-api/dist/cjs/index.js View File

1
 "use strict";
1
 "use strict";
2
 Object.defineProperty(exports, "__esModule", { value: true });
2
 Object.defineProperty(exports, "__esModule", { value: true });
3
+var WsApi_1 = require("./api/WsApi");
4
+exports.WsApi = WsApi_1.WsApi;
3
 var WebSocketClient_1 = require("./WebSocketClient");
5
 var WebSocketClient_1 = require("./WebSocketClient");
4
 exports.WebSocketClient = WebSocketClient_1.WebSocketClient;
6
 exports.WebSocketClient = WebSocketClient_1.WebSocketClient;

+ 4
- 4
packages/cts-api/dist/index.js
File diff suppressed because it is too large
View File


+ 28
- 26
packages/cts-api/dist/types/api/WsApi.d.ts View File

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

+ 1
- 0
packages/cts-api/dist/types/index.d.ts View File

1
+export { WsApi } from './api/WsApi';
1
 export { WebSocketClient } from './WebSocketClient';
2
 export { WebSocketClient } from './WebSocketClient';

+ 10
- 2
packages/cts-api/src/api/WsApi.ts View File

1
+import { WebSocketClient } from './../WebSocketClient';
1
 import { MsgBase, GroupOption } from '../protocol/MsgBase';
2
 import { MsgBase, GroupOption } from '../protocol/MsgBase';
2
 import { CmdMsg } from '../protocol/CmdMsg';
3
 import { CmdMsg } from '../protocol/CmdMsg';
3
 
4
 
4
 /** WebSocket Api */
5
 /** WebSocket Api */
5
-export class WsApi {
6
+export class WsApi extends WebSocketClient {
6
   // 保存公共的状态信息
7
   // 保存公共的状态信息
7
   token: string;
8
   token: string;
8
   from: string;
9
   from: string;
9
 
10
 
10
   async sendMsg(msg: Partial<MsgBase>) {
11
   async sendMsg(msg: Partial<MsgBase>) {
11
-    console.log(msg);
12
+    return this.sendMessage(msg);
12
   }
13
   }
13
 
14
 
14
   /** @start 好友管理 */
15
   /** @start 好友管理 */
73
 
74
 
74
   /** @end 好友管理 */
75
   /** @end 好友管理 */
75
 
76
 
77
+  /** @start 会话管理 */
78
+  // 删除会话
79
+  deleteConversation(contactId: string, delete_message: boolean = false) {
80
+    return this.request('/v1/delete/conversation', { contact: contactId, delete_message });
81
+  }
82
+  /** @end 会话管理 */
83
+
76
   /** @start 群组管理 */
84
   /** @start 群组管理 */
77
   // 列出所有的群组
85
   // 列出所有的群组
78
   listGroups() {
86
   listGroups() {

+ 1
- 0
packages/cts-api/src/index.ts View File

1
+export { WsApi } from './api/WsApi';
1
 export { WebSocketClient } from './WebSocketClient';
2
 export { WebSocketClient } from './WebSocketClient';