@perk-net/perk-pushplus-sdk 1.0.1 → 1.1.1
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 +10 -0
- package/dist/index.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.global.js +12 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +1 -1
- package/src/enums.ts +6 -0
- package/src/index.ts +1 -0
- package/src/models.ts +18 -0
package/dist/index.d.cts
CHANGED
|
@@ -176,7 +176,13 @@ declare enum Template {
|
|
|
176
176
|
/** 路由器插件定制模板。 */
|
|
177
177
|
ROUTE = "route",
|
|
178
178
|
/** 支付成功通知模板。 */
|
|
179
|
-
PAY = "pay"
|
|
179
|
+
PAY = "pay",
|
|
180
|
+
/** 表单格式模板;发送时需传 pushId(表单编码)。 */
|
|
181
|
+
FORM = "form",
|
|
182
|
+
/** 文档格式模板(push 文档);发送时需传 pushId。 */
|
|
183
|
+
DOC = "doc",
|
|
184
|
+
/** 表格格式模板(push 表格);发送时需传 pushId。 */
|
|
185
|
+
EXCEL = "excel"
|
|
180
186
|
}
|
|
181
187
|
/**
|
|
182
188
|
* 消息投递状态。
|
|
@@ -308,6 +314,8 @@ interface SendRequest {
|
|
|
308
314
|
to?: string;
|
|
309
315
|
/** 预处理编码(仅会员)。 */
|
|
310
316
|
pre?: string;
|
|
317
|
+
/** push 编码;template 为 form/doc/excel 时必传。 */
|
|
318
|
+
pushId?: string;
|
|
311
319
|
}
|
|
312
320
|
declare class SendRequestBuilder {
|
|
313
321
|
private req;
|
|
@@ -322,6 +330,7 @@ declare class SendRequestBuilder {
|
|
|
322
330
|
timestamp(v?: number): this;
|
|
323
331
|
to(v?: string): this;
|
|
324
332
|
pre(v?: string): this;
|
|
333
|
+
pushId(v?: string): this;
|
|
325
334
|
build(): SendRequest;
|
|
326
335
|
}
|
|
327
336
|
/**
|
|
@@ -345,6 +354,8 @@ interface BatchSendRequest {
|
|
|
345
354
|
timestamp?: number;
|
|
346
355
|
to?: string;
|
|
347
356
|
pre?: string;
|
|
357
|
+
/** push 编码;template 为 form/doc/excel 时必传。 */
|
|
358
|
+
pushId?: string;
|
|
348
359
|
}
|
|
349
360
|
/**
|
|
350
361
|
* 链式 Builder:支持以 `channel(Channel)` / `option(string)` 形式累积调用,
|
|
@@ -366,6 +377,7 @@ declare class BatchSendRequestBuilder {
|
|
|
366
377
|
timestamp(v?: number): this;
|
|
367
378
|
to(v?: string): this;
|
|
368
379
|
pre(v?: string): this;
|
|
380
|
+
pushId(v?: string): this;
|
|
369
381
|
/** 追加一个 channel。 */
|
|
370
382
|
channel(ch: Channel | string): this;
|
|
371
383
|
/** 追加一个 option,与最近一次 channel() 配对;可传空串。 */
|
|
@@ -441,6 +453,13 @@ interface AccessKeyResult {
|
|
|
441
453
|
/** 过期时间(单位秒)。 */
|
|
442
454
|
expiresIn?: number;
|
|
443
455
|
}
|
|
456
|
+
/** 会员信息。 */
|
|
457
|
+
interface VipInfo {
|
|
458
|
+
/** 是否会员;0-否,1-是。 */
|
|
459
|
+
isVip?: number;
|
|
460
|
+
/** 会员到期日。 */
|
|
461
|
+
lastDay?: string;
|
|
462
|
+
}
|
|
444
463
|
interface UserInfo {
|
|
445
464
|
openId?: string;
|
|
446
465
|
unionId?: string;
|
|
@@ -453,6 +472,10 @@ interface UserInfo {
|
|
|
453
472
|
emailStatus?: number;
|
|
454
473
|
birthday?: string;
|
|
455
474
|
points?: number;
|
|
475
|
+
/** 会员信息。 */
|
|
476
|
+
vipInfo?: VipInfo;
|
|
477
|
+
/** 实名认证状态;0-未实名,1-已实名。 */
|
|
478
|
+
verifyStatus?: number;
|
|
456
479
|
}
|
|
457
480
|
interface SendCount {
|
|
458
481
|
wechatSendCount?: number;
|
|
@@ -1353,4 +1376,4 @@ declare const CallbackParser: {
|
|
|
1353
1376
|
parse: typeof parseCallback;
|
|
1354
1377
|
};
|
|
1355
1378
|
|
|
1356
|
-
export { AbstractApi, AccessKeyApi, AccessKeyManager, type AccessKeyResult, type ApiResponse, type BatchSendRequest, BatchSendRequestBuilder, type BatchSendResult, CallbackEvent, CallbackParser, type CallbackPayload, Channel, ChannelApi, ClawBotApi, type ClawBotInfo, type ClawBotMessage, type ClawBotQrCode, type CpItem, DEFAULT_BASE_URL, ErrorCode, FetchHttpRequester, FriendApi, type FriendInfo, type FriendItem, type FriendQrCode, type HttpRawBody, type HttpRawRequestOptions, type HttpRequestOptions, type HttpRequester, type HttpResponse, ImageApi, type ImageFileInput, type ImageItem, type ImageUploadOptions, type ImageUploadResult, type ImageUploadToken, type MailDetail, type MailItem, MessageApi, type MessageCompleteInfo, type MessageItem, type MessageTokenAddRequest, MessageTokenApi, type MessageTokenEditRequest, type MessageTokenItem, type MessageTokenOption, type MpItem, OpenAbstractApi, OpenMessageApi, type PageQuery, type PageResult, PreApi, type PreDetail, type PreItem, type PreSaveRequest, type PreTestRequest, PushPlusClient, PushPlusClientBuilder, type PushPlusClientOptions, type PushPlusConfig, PushPlusError, PushPlusException, RateLimitGuard, type ResolvedPushPlusConfig, type SendCount, type SendMessageResult, type SendRequest, SendRequestBuilder, SendStatus, SendStatusDescription, SettingApi, Template, type TopicAddRequest, TopicApi, type TopicDetail, type TopicEditRequest, type TopicItem, type TopicListQuery, type TopicQrCode, TopicUserApi, type TopicUserInfo, type TopicUserItem, type TopicUserListQuery, UserApi, type UserDefaultDetail, type UserDefaultItem, type UserDefaultSaveRequest, type UserInfo, type UserLimitTime, WebhookApi, type WebhookItem, type WebhookSaveRequest, WebhookType, WebhookTypeDescription, batchSendRequest, callExecuteRaw, errorCodeFromValue, isRateLimitedCode, isSuccessfulHttpStatus, parseCallback, resolveConfig, sendRequest };
|
|
1379
|
+
export { AbstractApi, AccessKeyApi, AccessKeyManager, type AccessKeyResult, type ApiResponse, type BatchSendRequest, BatchSendRequestBuilder, type BatchSendResult, CallbackEvent, CallbackParser, type CallbackPayload, Channel, ChannelApi, ClawBotApi, type ClawBotInfo, type ClawBotMessage, type ClawBotQrCode, type CpItem, DEFAULT_BASE_URL, ErrorCode, FetchHttpRequester, FriendApi, type FriendInfo, type FriendItem, type FriendQrCode, type HttpRawBody, type HttpRawRequestOptions, type HttpRequestOptions, type HttpRequester, type HttpResponse, ImageApi, type ImageFileInput, type ImageItem, type ImageUploadOptions, type ImageUploadResult, type ImageUploadToken, type MailDetail, type MailItem, MessageApi, type MessageCompleteInfo, type MessageItem, type MessageTokenAddRequest, MessageTokenApi, type MessageTokenEditRequest, type MessageTokenItem, type MessageTokenOption, type MpItem, OpenAbstractApi, OpenMessageApi, type PageQuery, type PageResult, PreApi, type PreDetail, type PreItem, type PreSaveRequest, type PreTestRequest, PushPlusClient, PushPlusClientBuilder, type PushPlusClientOptions, type PushPlusConfig, PushPlusError, PushPlusException, RateLimitGuard, type ResolvedPushPlusConfig, type SendCount, type SendMessageResult, type SendRequest, SendRequestBuilder, SendStatus, SendStatusDescription, SettingApi, Template, type TopicAddRequest, TopicApi, type TopicDetail, type TopicEditRequest, type TopicItem, type TopicListQuery, type TopicQrCode, TopicUserApi, type TopicUserInfo, type TopicUserItem, type TopicUserListQuery, UserApi, type UserDefaultDetail, type UserDefaultItem, type UserDefaultSaveRequest, type UserInfo, type UserLimitTime, type VipInfo, WebhookApi, type WebhookItem, type WebhookSaveRequest, WebhookType, WebhookTypeDescription, batchSendRequest, callExecuteRaw, errorCodeFromValue, isRateLimitedCode, isSuccessfulHttpStatus, parseCallback, resolveConfig, sendRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -176,7 +176,13 @@ declare enum Template {
|
|
|
176
176
|
/** 路由器插件定制模板。 */
|
|
177
177
|
ROUTE = "route",
|
|
178
178
|
/** 支付成功通知模板。 */
|
|
179
|
-
PAY = "pay"
|
|
179
|
+
PAY = "pay",
|
|
180
|
+
/** 表单格式模板;发送时需传 pushId(表单编码)。 */
|
|
181
|
+
FORM = "form",
|
|
182
|
+
/** 文档格式模板(push 文档);发送时需传 pushId。 */
|
|
183
|
+
DOC = "doc",
|
|
184
|
+
/** 表格格式模板(push 表格);发送时需传 pushId。 */
|
|
185
|
+
EXCEL = "excel"
|
|
180
186
|
}
|
|
181
187
|
/**
|
|
182
188
|
* 消息投递状态。
|
|
@@ -308,6 +314,8 @@ interface SendRequest {
|
|
|
308
314
|
to?: string;
|
|
309
315
|
/** 预处理编码(仅会员)。 */
|
|
310
316
|
pre?: string;
|
|
317
|
+
/** push 编码;template 为 form/doc/excel 时必传。 */
|
|
318
|
+
pushId?: string;
|
|
311
319
|
}
|
|
312
320
|
declare class SendRequestBuilder {
|
|
313
321
|
private req;
|
|
@@ -322,6 +330,7 @@ declare class SendRequestBuilder {
|
|
|
322
330
|
timestamp(v?: number): this;
|
|
323
331
|
to(v?: string): this;
|
|
324
332
|
pre(v?: string): this;
|
|
333
|
+
pushId(v?: string): this;
|
|
325
334
|
build(): SendRequest;
|
|
326
335
|
}
|
|
327
336
|
/**
|
|
@@ -345,6 +354,8 @@ interface BatchSendRequest {
|
|
|
345
354
|
timestamp?: number;
|
|
346
355
|
to?: string;
|
|
347
356
|
pre?: string;
|
|
357
|
+
/** push 编码;template 为 form/doc/excel 时必传。 */
|
|
358
|
+
pushId?: string;
|
|
348
359
|
}
|
|
349
360
|
/**
|
|
350
361
|
* 链式 Builder:支持以 `channel(Channel)` / `option(string)` 形式累积调用,
|
|
@@ -366,6 +377,7 @@ declare class BatchSendRequestBuilder {
|
|
|
366
377
|
timestamp(v?: number): this;
|
|
367
378
|
to(v?: string): this;
|
|
368
379
|
pre(v?: string): this;
|
|
380
|
+
pushId(v?: string): this;
|
|
369
381
|
/** 追加一个 channel。 */
|
|
370
382
|
channel(ch: Channel | string): this;
|
|
371
383
|
/** 追加一个 option,与最近一次 channel() 配对;可传空串。 */
|
|
@@ -441,6 +453,13 @@ interface AccessKeyResult {
|
|
|
441
453
|
/** 过期时间(单位秒)。 */
|
|
442
454
|
expiresIn?: number;
|
|
443
455
|
}
|
|
456
|
+
/** 会员信息。 */
|
|
457
|
+
interface VipInfo {
|
|
458
|
+
/** 是否会员;0-否,1-是。 */
|
|
459
|
+
isVip?: number;
|
|
460
|
+
/** 会员到期日。 */
|
|
461
|
+
lastDay?: string;
|
|
462
|
+
}
|
|
444
463
|
interface UserInfo {
|
|
445
464
|
openId?: string;
|
|
446
465
|
unionId?: string;
|
|
@@ -453,6 +472,10 @@ interface UserInfo {
|
|
|
453
472
|
emailStatus?: number;
|
|
454
473
|
birthday?: string;
|
|
455
474
|
points?: number;
|
|
475
|
+
/** 会员信息。 */
|
|
476
|
+
vipInfo?: VipInfo;
|
|
477
|
+
/** 实名认证状态;0-未实名,1-已实名。 */
|
|
478
|
+
verifyStatus?: number;
|
|
456
479
|
}
|
|
457
480
|
interface SendCount {
|
|
458
481
|
wechatSendCount?: number;
|
|
@@ -1353,4 +1376,4 @@ declare const CallbackParser: {
|
|
|
1353
1376
|
parse: typeof parseCallback;
|
|
1354
1377
|
};
|
|
1355
1378
|
|
|
1356
|
-
export { AbstractApi, AccessKeyApi, AccessKeyManager, type AccessKeyResult, type ApiResponse, type BatchSendRequest, BatchSendRequestBuilder, type BatchSendResult, CallbackEvent, CallbackParser, type CallbackPayload, Channel, ChannelApi, ClawBotApi, type ClawBotInfo, type ClawBotMessage, type ClawBotQrCode, type CpItem, DEFAULT_BASE_URL, ErrorCode, FetchHttpRequester, FriendApi, type FriendInfo, type FriendItem, type FriendQrCode, type HttpRawBody, type HttpRawRequestOptions, type HttpRequestOptions, type HttpRequester, type HttpResponse, ImageApi, type ImageFileInput, type ImageItem, type ImageUploadOptions, type ImageUploadResult, type ImageUploadToken, type MailDetail, type MailItem, MessageApi, type MessageCompleteInfo, type MessageItem, type MessageTokenAddRequest, MessageTokenApi, type MessageTokenEditRequest, type MessageTokenItem, type MessageTokenOption, type MpItem, OpenAbstractApi, OpenMessageApi, type PageQuery, type PageResult, PreApi, type PreDetail, type PreItem, type PreSaveRequest, type PreTestRequest, PushPlusClient, PushPlusClientBuilder, type PushPlusClientOptions, type PushPlusConfig, PushPlusError, PushPlusException, RateLimitGuard, type ResolvedPushPlusConfig, type SendCount, type SendMessageResult, type SendRequest, SendRequestBuilder, SendStatus, SendStatusDescription, SettingApi, Template, type TopicAddRequest, TopicApi, type TopicDetail, type TopicEditRequest, type TopicItem, type TopicListQuery, type TopicQrCode, TopicUserApi, type TopicUserInfo, type TopicUserItem, type TopicUserListQuery, UserApi, type UserDefaultDetail, type UserDefaultItem, type UserDefaultSaveRequest, type UserInfo, type UserLimitTime, WebhookApi, type WebhookItem, type WebhookSaveRequest, WebhookType, WebhookTypeDescription, batchSendRequest, callExecuteRaw, errorCodeFromValue, isRateLimitedCode, isSuccessfulHttpStatus, parseCallback, resolveConfig, sendRequest };
|
|
1379
|
+
export { AbstractApi, AccessKeyApi, AccessKeyManager, type AccessKeyResult, type ApiResponse, type BatchSendRequest, BatchSendRequestBuilder, type BatchSendResult, CallbackEvent, CallbackParser, type CallbackPayload, Channel, ChannelApi, ClawBotApi, type ClawBotInfo, type ClawBotMessage, type ClawBotQrCode, type CpItem, DEFAULT_BASE_URL, ErrorCode, FetchHttpRequester, FriendApi, type FriendInfo, type FriendItem, type FriendQrCode, type HttpRawBody, type HttpRawRequestOptions, type HttpRequestOptions, type HttpRequester, type HttpResponse, ImageApi, type ImageFileInput, type ImageItem, type ImageUploadOptions, type ImageUploadResult, type ImageUploadToken, type MailDetail, type MailItem, MessageApi, type MessageCompleteInfo, type MessageItem, type MessageTokenAddRequest, MessageTokenApi, type MessageTokenEditRequest, type MessageTokenItem, type MessageTokenOption, type MpItem, OpenAbstractApi, OpenMessageApi, type PageQuery, type PageResult, PreApi, type PreDetail, type PreItem, type PreSaveRequest, type PreTestRequest, PushPlusClient, PushPlusClientBuilder, type PushPlusClientOptions, type PushPlusConfig, PushPlusError, PushPlusException, RateLimitGuard, type ResolvedPushPlusConfig, type SendCount, type SendMessageResult, type SendRequest, SendRequestBuilder, SendStatus, SendStatusDescription, SettingApi, Template, type TopicAddRequest, TopicApi, type TopicDetail, type TopicEditRequest, type TopicItem, type TopicListQuery, type TopicQrCode, TopicUserApi, type TopicUserInfo, type TopicUserItem, type TopicUserListQuery, UserApi, type UserDefaultDetail, type UserDefaultItem, type UserDefaultSaveRequest, type UserInfo, type UserLimitTime, type VipInfo, WebhookApi, type WebhookItem, type WebhookSaveRequest, WebhookType, WebhookTypeDescription, batchSendRequest, callExecuteRaw, errorCodeFromValue, isRateLimitedCode, isSuccessfulHttpStatus, parseCallback, resolveConfig, sendRequest };
|
package/dist/index.global.js
CHANGED
|
@@ -23,6 +23,9 @@ var PerkPushPlus = (function (exports) {
|
|
|
23
23
|
Template2["JENKINS"] = "jenkins";
|
|
24
24
|
Template2["ROUTE"] = "route";
|
|
25
25
|
Template2["PAY"] = "pay";
|
|
26
|
+
Template2["FORM"] = "form";
|
|
27
|
+
Template2["DOC"] = "doc";
|
|
28
|
+
Template2["EXCEL"] = "excel";
|
|
26
29
|
return Template2;
|
|
27
30
|
})(Template || {});
|
|
28
31
|
var SendStatus = /* @__PURE__ */ ((SendStatus2) => {
|
|
@@ -1136,7 +1139,7 @@ var PerkPushPlus = (function (exports) {
|
|
|
1136
1139
|
logRequest: (_g = cfg.logRequest) != null ? _g : false,
|
|
1137
1140
|
rateLimitGuardEnabled: (_h = cfg.rateLimitGuardEnabled) != null ? _h : true,
|
|
1138
1141
|
rateLimitCooldownMs: (_i = cfg.rateLimitCooldownMs) != null ? _i : 0,
|
|
1139
|
-
userAgent: (_j = cfg.userAgent) != null ? _j : `@perk-net/perk-pushplus-sdk/1.
|
|
1142
|
+
userAgent: (_j = cfg.userAgent) != null ? _j : `@perk-net/perk-pushplus-sdk/1.1.1`
|
|
1140
1143
|
};
|
|
1141
1144
|
}
|
|
1142
1145
|
|
|
@@ -1377,6 +1380,10 @@ var PerkPushPlus = (function (exports) {
|
|
|
1377
1380
|
this.req.pre = v;
|
|
1378
1381
|
return this;
|
|
1379
1382
|
}
|
|
1383
|
+
pushId(v) {
|
|
1384
|
+
this.req.pushId = v;
|
|
1385
|
+
return this;
|
|
1386
|
+
}
|
|
1380
1387
|
build() {
|
|
1381
1388
|
return { ...this.req };
|
|
1382
1389
|
}
|
|
@@ -1426,6 +1433,10 @@ var PerkPushPlus = (function (exports) {
|
|
|
1426
1433
|
this.req.pre = v;
|
|
1427
1434
|
return this;
|
|
1428
1435
|
}
|
|
1436
|
+
pushId(v) {
|
|
1437
|
+
this.req.pushId = v;
|
|
1438
|
+
return this;
|
|
1439
|
+
}
|
|
1429
1440
|
/** 追加一个 channel。 */
|
|
1430
1441
|
channel(ch) {
|
|
1431
1442
|
this.channelList.push(typeof ch === "string" ? ch : ch);
|