@perk-net/perk-pushplus-sdk 1.0.1 → 1.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perk-net/perk-pushplus-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "pushplus(推送加) 官方接口 JavaScript/TypeScript SDK,可在 Node.js 与浏览器中使用",
5
5
  "keywords": [
6
6
  "pushplus",
package/src/config.ts CHANGED
@@ -87,6 +87,6 @@ export function resolveConfig(input: PushPlusConfig | undefined | null): Resolve
87
87
  logRequest: cfg.logRequest ?? false,
88
88
  rateLimitGuardEnabled: cfg.rateLimitGuardEnabled ?? true,
89
89
  rateLimitCooldownMs: cfg.rateLimitCooldownMs ?? 0,
90
- userAgent: cfg.userAgent ?? `@perk-net/perk-pushplus-sdk/1.0.1`,
90
+ userAgent: cfg.userAgent ?? `@perk-net/perk-pushplus-sdk/1.1.0`,
91
91
  };
92
92
  }
package/src/enums.ts CHANGED
@@ -44,6 +44,8 @@ export enum Template {
44
44
  ROUTE = 'route',
45
45
  /** 支付成功通知模板。 */
46
46
  PAY = 'pay',
47
+ /** 表单格式模板;发送时需传 pushId(表单编码)。 */
48
+ FORM = 'form',
47
49
  }
48
50
 
49
51
  /**
package/src/models.ts CHANGED
@@ -56,6 +56,8 @@ export interface SendRequest {
56
56
  to?: string;
57
57
  /** 预处理编码(仅会员)。 */
58
58
  pre?: string;
59
+ /** push 表单编码;template 为 form 时必传。 */
60
+ pushId?: string;
59
61
  }
60
62
 
61
63
  export class SendRequestBuilder {
@@ -72,6 +74,7 @@ export class SendRequestBuilder {
72
74
  timestamp(v?: number): this { this.req.timestamp = v; return this; }
73
75
  to(v?: string): this { this.req.to = v; return this; }
74
76
  pre(v?: string): this { this.req.pre = v; return this; }
77
+ pushId(v?: string): this { this.req.pushId = v; return this; }
75
78
 
76
79
  build(): SendRequest {
77
80
  return { ...this.req };
@@ -104,6 +107,8 @@ export interface BatchSendRequest {
104
107
  timestamp?: number;
105
108
  to?: string;
106
109
  pre?: string;
110
+ /** push 表单编码;template 为 form 时必传。 */
111
+ pushId?: string;
107
112
  }
108
113
 
109
114
  /**
@@ -127,6 +132,7 @@ export class BatchSendRequestBuilder {
127
132
  timestamp(v?: number): this { this.req.timestamp = v; return this; }
128
133
  to(v?: string): this { this.req.to = v; return this; }
129
134
  pre(v?: string): this { this.req.pre = v; return this; }
135
+ pushId(v?: string): this { this.req.pushId = v; return this; }
130
136
 
131
137
  /** 追加一个 channel。 */
132
138
  channel(ch: Channel | string): this {