@perk-net/perk-pushplus-sdk 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -2
- package/dist/index.d.ts +97 -2
- package/dist/index.global.js +52 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +52 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/qqbot-api.ts +75 -0
- package/src/client.ts +3 -0
- package/src/enums.ts +2 -0
- package/src/index.ts +7 -0
- package/src/models.ts +77 -0
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var Channel = /* @__PURE__ */ ((Channel2) => {
|
|
|
9
9
|
Channel2["EXTENSION"] = "extension";
|
|
10
10
|
Channel2["APP"] = "app";
|
|
11
11
|
Channel2["CLAWBOT"] = "clawbot";
|
|
12
|
+
Channel2["QQ"] = "qq";
|
|
12
13
|
return Channel2;
|
|
13
14
|
})(Channel || {});
|
|
14
15
|
var Template = /* @__PURE__ */ ((Template2) => {
|
|
@@ -1324,6 +1325,55 @@ var PreApi = class extends OpenAbstractApi {
|
|
|
1324
1325
|
}
|
|
1325
1326
|
};
|
|
1326
1327
|
|
|
1328
|
+
// src/api/qqbot-api.ts
|
|
1329
|
+
var SEND_TYPE_QQ_GROUP = 2;
|
|
1330
|
+
var QqBotApi = class extends OpenAbstractApi {
|
|
1331
|
+
constructor(config, http, mgr) {
|
|
1332
|
+
super(config, http, mgr);
|
|
1333
|
+
}
|
|
1334
|
+
/** 1. 获取绑定链接与绑定码;refresh 为 true 时旧绑定码失效并重新生成。 */
|
|
1335
|
+
getBindLink(refresh = false) {
|
|
1336
|
+
const path = refresh ? this.appendQuery("/api/open/qqBot/getBindLink", { refresh: true }) : "/api/open/qqBot/getBindLink";
|
|
1337
|
+
return this.executeOpen("GET", path);
|
|
1338
|
+
}
|
|
1339
|
+
/** 2. 查询绑定状态。 */
|
|
1340
|
+
botInfo() {
|
|
1341
|
+
return this.executeOpen("GET", "/api/open/qqBot/botInfo");
|
|
1342
|
+
}
|
|
1343
|
+
/** 3. 解绑 QQ 机器人。 */
|
|
1344
|
+
async unbind() {
|
|
1345
|
+
await this.executeOpen("GET", "/api/open/qqBot/unbind");
|
|
1346
|
+
}
|
|
1347
|
+
/** 4. 获取机器人已加入的 QQ 群列表。 */
|
|
1348
|
+
async groupList() {
|
|
1349
|
+
var _a;
|
|
1350
|
+
return (_a = await this.executeOpen("GET", "/api/open/qqBot/groupList")) != null ? _a : [];
|
|
1351
|
+
}
|
|
1352
|
+
/** 5. 获取 QQ 机器人渠道配置列表。 */
|
|
1353
|
+
list(q) {
|
|
1354
|
+
return this.executeOpen("POST", "/api/open/qqBot/list", q != null ? q : {});
|
|
1355
|
+
}
|
|
1356
|
+
/** 6. 新增渠道配置,用于把消息发送到指定 QQ 群;发给自己无需创建配置。 */
|
|
1357
|
+
async add(req) {
|
|
1358
|
+
await this.executeOpen("POST", "/api/open/qqBot/add", withDefaultSendType(req));
|
|
1359
|
+
}
|
|
1360
|
+
/** 7. 修改渠道配置;配置编码不可修改。 */
|
|
1361
|
+
async edit(req) {
|
|
1362
|
+
await this.executeOpen("POST", "/api/open/qqBot/edit", withDefaultSendType(req));
|
|
1363
|
+
}
|
|
1364
|
+
/** 8. 删除渠道配置。 */
|
|
1365
|
+
async delete(id) {
|
|
1366
|
+
await this.executeOpen(
|
|
1367
|
+
"DELETE",
|
|
1368
|
+
this.appendQuery("/api/open/qqBot/delete", { id })
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
function withDefaultSendType(req) {
|
|
1373
|
+
var _a;
|
|
1374
|
+
return { ...req, sendType: (_a = req.sendType) != null ? _a : SEND_TYPE_QQ_GROUP };
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1327
1377
|
// src/api/setting-api.ts
|
|
1328
1378
|
var SettingApi = class extends OpenAbstractApi {
|
|
1329
1379
|
constructor(config, http, mgr) {
|
|
@@ -1667,6 +1717,7 @@ var PushPlusClient = class _PushPlusClient {
|
|
|
1667
1717
|
this.webhook = new WebhookApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
1668
1718
|
this.channel = new ChannelApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
1669
1719
|
this.clawBot = new ClawBotApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
1720
|
+
this.qqBot = new QqBotApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
1670
1721
|
this.setting = new SettingApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
1671
1722
|
this.pre = new PreApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
1672
1723
|
this.image = new ImageApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
@@ -1906,6 +1957,6 @@ function batchSendRequest() {
|
|
|
1906
1957
|
return new BatchSendRequestBuilder();
|
|
1907
1958
|
}
|
|
1908
1959
|
|
|
1909
|
-
export { AbstractApi, AccessKeyApi, AccessKeyManager, BatchSendRequestBuilder, CallbackEvent, CallbackParser, Channel, ChannelApi, ClawBotApi, DEFAULT_BASE_URL, DocApi, ErrorCode, ExcelApi, FetchHttpRequester, FormApi, FormStatus, FormStatusDescription, FriendApi, ImageApi, MessageApi, MessageTokenApi, OpenAbstractApi, OpenMessageApi, PreApi, PushPlusClient, PushPlusClientBuilder, PushPlusError, PushPlusException, RateLimitGuard, SendRequestBuilder, SendStatus, SendStatusDescription, SettingApi, ShareLogin, SharePerm, Template, TopicApi, TopicUserApi, UserApi, WebhookApi, WebhookType, WebhookTypeDescription, batchSendRequest, callExecuteRaw, errorCodeFromValue, isRateLimitedCode, isSuccessfulHttpStatus, parseCallback, resolveConfig, sendRequest };
|
|
1960
|
+
export { AbstractApi, AccessKeyApi, AccessKeyManager, BatchSendRequestBuilder, CallbackEvent, CallbackParser, Channel, ChannelApi, ClawBotApi, DEFAULT_BASE_URL, DocApi, ErrorCode, ExcelApi, FetchHttpRequester, FormApi, FormStatus, FormStatusDescription, FriendApi, ImageApi, MessageApi, MessageTokenApi, OpenAbstractApi, OpenMessageApi, PreApi, PushPlusClient, PushPlusClientBuilder, PushPlusError, PushPlusException, QqBotApi, RateLimitGuard, SendRequestBuilder, SendStatus, SendStatusDescription, SettingApi, ShareLogin, SharePerm, Template, TopicApi, TopicUserApi, UserApi, WebhookApi, WebhookType, WebhookTypeDescription, batchSendRequest, callExecuteRaw, errorCodeFromValue, isRateLimitedCode, isSuccessfulHttpStatus, parseCallback, resolveConfig, sendRequest };
|
|
1910
1961
|
//# sourceMappingURL=index.js.map
|
|
1911
1962
|
//# sourceMappingURL=index.js.map
|