@perk-net/perk-pushplus-sdk 1.1.0 → 1.2.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/README.md +28 -1
- package/dist/index.cjs +246 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +314 -4
- package/dist/index.d.ts +314 -4
- package/dist/index.global.js +246 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +240 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/doc-api.ts +77 -0
- package/src/api/excel-api.ts +114 -0
- package/src/api/form-api.ts +92 -0
- package/src/client.ts +9 -0
- package/src/config.ts +1 -1
- package/src/enums.ts +41 -0
- package/src/index.ts +25 -0
- package/src/models.ts +196 -2
package/package.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AccessKeyManager } from '../access-key-manager';
|
|
2
|
+
import { ResolvedPushPlusConfig } from '../config';
|
|
3
|
+
import { HttpRequester } from '../http';
|
|
4
|
+
import { DocContent, DocListItem, DocListQuery, DocVo, PageResult } from '../models';
|
|
5
|
+
import { OpenAbstractApi } from './open-base';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 开放接口 - push 文档。
|
|
9
|
+
*
|
|
10
|
+
* 文档:https://www.pushplus.plus/doc/ecosystem/doc/
|
|
11
|
+
* 基础路径:`/push/api/open/doc`
|
|
12
|
+
*/
|
|
13
|
+
export class DocApi extends OpenAbstractApi {
|
|
14
|
+
constructor(config: ResolvedPushPlusConfig, http: HttpRequester, mgr: AccessKeyManager) {
|
|
15
|
+
super(config, http, mgr);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 我的文档分页。 */
|
|
19
|
+
list(query?: DocListQuery): Promise<PageResult<DocListItem>> {
|
|
20
|
+
return this.executeOpen<PageResult<DocListItem>>(
|
|
21
|
+
'POST',
|
|
22
|
+
'/push/api/open/doc/list',
|
|
23
|
+
query ?? {},
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 创建空白文档。 */
|
|
28
|
+
create(title: string): Promise<DocVo> {
|
|
29
|
+
return this.executeOpen<DocVo>('POST', '/push/api/open/doc/create', { title });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 获取文档元信息与 HTML 草稿正文。 */
|
|
33
|
+
content(docCode: string): Promise<DocContent> {
|
|
34
|
+
return this.executeOpen<DocContent>(
|
|
35
|
+
'GET',
|
|
36
|
+
this.appendQuery('/push/api/open/doc/content', { docCode }),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 保存 HTML 草稿(不影响分享页,需再 publish)。 */
|
|
41
|
+
saveContent(docCode: string, content: string): Promise<DocVo> {
|
|
42
|
+
return this.executeOpen<DocVo>('POST', '/push/api/open/doc/saveContent', { docCode, content });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 将草稿同步为分享页快照。 */
|
|
46
|
+
publish(docCode: string): Promise<DocVo> {
|
|
47
|
+
return this.executeOpen<DocVo>(
|
|
48
|
+
'POST',
|
|
49
|
+
this.appendQuery('/push/api/open/doc/publish', { docCode }),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 重命名。 */
|
|
54
|
+
async rename(docCode: string, title: string): Promise<void> {
|
|
55
|
+
await this.executeOpen<unknown>('POST', '/push/api/open/doc/rename', { docCode, title });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** 删除文档。 */
|
|
59
|
+
async delete(docCode: string): Promise<void> {
|
|
60
|
+
await this.executeOpen<unknown>(
|
|
61
|
+
'POST',
|
|
62
|
+
this.appendQuery('/push/api/open/doc/delete', { docCode }),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 更新分享设置。
|
|
68
|
+
*
|
|
69
|
+
* @param sharePerm 0 关闭 / 1 开启(仅可查看)
|
|
70
|
+
* @param shareLogin 0 免登录 / 1 需登录;不传则沿用原值
|
|
71
|
+
*/
|
|
72
|
+
updateShare(docCode: string, sharePerm: number, shareLogin?: number): Promise<DocVo> {
|
|
73
|
+
const body: Record<string, unknown> = { docCode, sharePerm };
|
|
74
|
+
if (shareLogin != null) body.shareLogin = shareLogin;
|
|
75
|
+
return this.executeOpen<DocVo>('POST', '/push/api/open/doc/updateShare', body);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { AccessKeyManager } from '../access-key-manager';
|
|
2
|
+
import { ResolvedPushPlusConfig } from '../config';
|
|
3
|
+
import { PushPlusError } from '../exception';
|
|
4
|
+
import { HttpRequester } from '../http';
|
|
5
|
+
import { DocListItem, DocListQuery, ExcelContent, ExcelVo, PageResult } from '../models';
|
|
6
|
+
import { OpenAbstractApi } from './open-base';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 开放接口 - push 表格。
|
|
10
|
+
*
|
|
11
|
+
* 文档:https://www.pushplus.plus/doc/ecosystem/sheet/
|
|
12
|
+
* 基础路径:`/push/api/open/excel`
|
|
13
|
+
*/
|
|
14
|
+
export class ExcelApi extends OpenAbstractApi {
|
|
15
|
+
constructor(config: ResolvedPushPlusConfig, http: HttpRequester, mgr: AccessKeyManager) {
|
|
16
|
+
super(config, http, mgr);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 我的表格分页。 */
|
|
20
|
+
list(query?: DocListQuery): Promise<PageResult<DocListItem>> {
|
|
21
|
+
return this.executeOpen<PageResult<DocListItem>>(
|
|
22
|
+
'POST',
|
|
23
|
+
'/push/api/open/excel/list',
|
|
24
|
+
query ?? {},
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 创建空白表格。 */
|
|
29
|
+
create(title: string): Promise<ExcelVo> {
|
|
30
|
+
return this.executeOpen<ExcelVo>('POST', '/push/api/open/excel/create', { title });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 获取表格元信息与整表 JSON 草稿。 */
|
|
34
|
+
content(docCode: string): Promise<ExcelContent> {
|
|
35
|
+
return this.executeOpen<ExcelContent>(
|
|
36
|
+
'GET',
|
|
37
|
+
this.appendQuery('/push/api/open/excel/content', { docCode }),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 整表覆盖保存草稿。
|
|
43
|
+
*
|
|
44
|
+
* `content` 可为 JSON 字符串,或工作簿对象(SDK 会序列化)。
|
|
45
|
+
*/
|
|
46
|
+
saveContent(docCode: string, content: string | object): Promise<ExcelVo> {
|
|
47
|
+
return this.executeOpen<ExcelVo>('POST', '/push/api/open/excel/saveContent', {
|
|
48
|
+
docCode,
|
|
49
|
+
content: stringifyJsonContent(content),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 从指定起始单元格起,按二维数组向右向下写入(草稿)。
|
|
55
|
+
*
|
|
56
|
+
* @param range 起始单元格,如 A1
|
|
57
|
+
* @param values 外层为行、内层为列
|
|
58
|
+
* @param sheetName 工作表名称;不传则写入活动表 / 第一张表
|
|
59
|
+
*/
|
|
60
|
+
writeCells(
|
|
61
|
+
docCode: string,
|
|
62
|
+
range: string,
|
|
63
|
+
values: unknown[][],
|
|
64
|
+
sheetName?: string,
|
|
65
|
+
): Promise<ExcelVo> {
|
|
66
|
+
const body: Record<string, unknown> = { docCode, range, values };
|
|
67
|
+
if (sheetName != null) body.sheetName = sheetName;
|
|
68
|
+
return this.executeOpen<ExcelVo>('POST', '/push/api/open/excel/writeCells', body);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 将草稿同步为分享页快照。 */
|
|
72
|
+
publish(docCode: string): Promise<ExcelVo> {
|
|
73
|
+
return this.executeOpen<ExcelVo>(
|
|
74
|
+
'POST',
|
|
75
|
+
this.appendQuery('/push/api/open/excel/publish', { docCode }),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 重命名。 */
|
|
80
|
+
async rename(docCode: string, title: string): Promise<void> {
|
|
81
|
+
await this.executeOpen<unknown>('POST', '/push/api/open/excel/rename', { docCode, title });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** 删除表格。 */
|
|
85
|
+
async delete(docCode: string): Promise<void> {
|
|
86
|
+
await this.executeOpen<unknown>(
|
|
87
|
+
'POST',
|
|
88
|
+
this.appendQuery('/push/api/open/excel/delete', { docCode }),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 更新分享设置。
|
|
94
|
+
*
|
|
95
|
+
* @param sharePerm 0 关闭 / 1 开启(仅可查看)
|
|
96
|
+
* @param shareLogin 0 免登录 / 1 需登录;不传则沿用原值
|
|
97
|
+
*/
|
|
98
|
+
updateShare(docCode: string, sharePerm: number, shareLogin?: number): Promise<ExcelVo> {
|
|
99
|
+
const body: Record<string, unknown> = { docCode, sharePerm };
|
|
100
|
+
if (shareLogin != null) body.shareLogin = shareLogin;
|
|
101
|
+
return this.executeOpen<ExcelVo>('POST', '/push/api/open/excel/updateShare', body);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function stringifyJsonContent(content: string | object): string {
|
|
106
|
+
if (typeof content === 'string') {
|
|
107
|
+
return content;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
return JSON.stringify(content);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
throw new PushPlusError(`序列化表格内容失败: ${(e as Error).message}`, -1, { cause: e });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AccessKeyManager } from '../access-key-manager';
|
|
2
|
+
import { ResolvedPushPlusConfig } from '../config';
|
|
3
|
+
import { HttpRequester } from '../http';
|
|
4
|
+
import {
|
|
5
|
+
FormDetail,
|
|
6
|
+
FormListItem,
|
|
7
|
+
FormListQuery,
|
|
8
|
+
FormPublishDiff,
|
|
9
|
+
FormPublishResult,
|
|
10
|
+
FormSaveRequest,
|
|
11
|
+
PageResult,
|
|
12
|
+
} from '../models';
|
|
13
|
+
import { OpenAbstractApi } from './open-base';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 开放接口 - push 表单。
|
|
17
|
+
*
|
|
18
|
+
* 文档:https://www.pushplus.plus/doc/ecosystem/form/
|
|
19
|
+
* 基础路径:`/push/api/open/form`
|
|
20
|
+
*/
|
|
21
|
+
export class FormApi extends OpenAbstractApi {
|
|
22
|
+
constructor(config: ResolvedPushPlusConfig, http: HttpRequester, mgr: AccessKeyManager) {
|
|
23
|
+
super(config, http, mgr);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 我的表单分页。 */
|
|
27
|
+
list(query?: FormListQuery): Promise<PageResult<FormListItem>> {
|
|
28
|
+
return this.executeOpen<PageResult<FormListItem>>(
|
|
29
|
+
'POST',
|
|
30
|
+
'/push/api/open/form/list',
|
|
31
|
+
query ?? {},
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 创建空白表单(草稿)。 */
|
|
36
|
+
create(title: string): Promise<FormListItem> {
|
|
37
|
+
return this.executeOpen<FormListItem>('POST', '/push/api/open/form/create', { title });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 基于已有表单复制一份新草稿。 */
|
|
41
|
+
copy(id: number): Promise<FormListItem> {
|
|
42
|
+
return this.executeOpen<FormListItem>(
|
|
43
|
+
'POST',
|
|
44
|
+
this.appendQuery('/push/api/open/form/copy', { id }),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 保存表单设计(仅更新草稿;已发布需再调用 publish)。 */
|
|
49
|
+
async save(req: FormSaveRequest): Promise<void> {
|
|
50
|
+
await this.executeOpen<unknown>('POST', '/push/api/open/form/save', req);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 表单详情(含草稿题目、主题、设置)。 */
|
|
54
|
+
detail(id: number): Promise<FormDetail> {
|
|
55
|
+
return this.executeOpen<FormDetail>(
|
|
56
|
+
'GET',
|
|
57
|
+
this.appendQuery('/push/api/open/form/detail', { id }),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 草稿与发布快照的题目差异。 */
|
|
62
|
+
publishDiff(id: number): Promise<FormPublishDiff> {
|
|
63
|
+
return this.executeOpen<FormPublishDiff>(
|
|
64
|
+
'GET',
|
|
65
|
+
this.appendQuery('/push/api/open/form/publishDiff', { id }),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 发布表单,开始收集。 */
|
|
70
|
+
publish(id: number): Promise<FormPublishResult> {
|
|
71
|
+
return this.executeOpen<FormPublishResult>(
|
|
72
|
+
'POST',
|
|
73
|
+
this.appendQuery('/push/api/open/form/publish', { id }),
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 停止收集。 */
|
|
78
|
+
async stop(id: number): Promise<void> {
|
|
79
|
+
await this.executeOpen<unknown>(
|
|
80
|
+
'POST',
|
|
81
|
+
this.appendQuery('/push/api/open/form/stop', { id }),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** 删除表单(不可恢复)。 */
|
|
86
|
+
async delete(id: number): Promise<void> {
|
|
87
|
+
await this.executeOpen<unknown>(
|
|
88
|
+
'POST',
|
|
89
|
+
this.appendQuery('/push/api/open/form/delete', { id }),
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { AccessKeyManager } from './access-key-manager';
|
|
|
2
2
|
import { AccessKeyApi } from './api/access-key-api';
|
|
3
3
|
import { ChannelApi } from './api/channel-api';
|
|
4
4
|
import { ClawBotApi } from './api/clawbot-api';
|
|
5
|
+
import { DocApi } from './api/doc-api';
|
|
6
|
+
import { ExcelApi } from './api/excel-api';
|
|
7
|
+
import { FormApi } from './api/form-api';
|
|
5
8
|
import { FriendApi } from './api/friend-api';
|
|
6
9
|
import { ImageApi } from './api/image-api';
|
|
7
10
|
import { MessageApi } from './api/message-api';
|
|
@@ -67,6 +70,9 @@ export class PushPlusClient {
|
|
|
67
70
|
readonly setting: SettingApi;
|
|
68
71
|
readonly pre: PreApi;
|
|
69
72
|
readonly image: ImageApi;
|
|
73
|
+
readonly form: FormApi;
|
|
74
|
+
readonly doc: DocApi;
|
|
75
|
+
readonly excel: ExcelApi;
|
|
70
76
|
|
|
71
77
|
constructor(options: PushPlusClientOptions = {}) {
|
|
72
78
|
this.config = resolveConfig(options);
|
|
@@ -89,6 +95,9 @@ export class PushPlusClient {
|
|
|
89
95
|
this.setting = new SettingApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
90
96
|
this.pre = new PreApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
91
97
|
this.image = new ImageApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
98
|
+
this.form = new FormApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
99
|
+
this.doc = new DocApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
100
|
+
this.excel = new ExcelApi(this.config, this.httpRequester, this.accessKeyManager);
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
/** 与 Java SDK 风格一致的 Builder 入口。 */
|
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.
|
|
90
|
+
userAgent: cfg.userAgent ?? `@perk-net/perk-pushplus-sdk/1.2.0`,
|
|
91
91
|
};
|
|
92
92
|
}
|
package/src/enums.ts
CHANGED
|
@@ -46,6 +46,10 @@ export enum Template {
|
|
|
46
46
|
PAY = 'pay',
|
|
47
47
|
/** 表单格式模板;发送时需传 pushId(表单编码)。 */
|
|
48
48
|
FORM = 'form',
|
|
49
|
+
/** 文档格式模板(push 文档);发送时需传 pushId。 */
|
|
50
|
+
DOC = 'doc',
|
|
51
|
+
/** 表格格式模板(push 表格);发送时需传 pushId。 */
|
|
52
|
+
EXCEL = 'excel',
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
/**
|
|
@@ -114,6 +118,43 @@ export const WebhookTypeDescription: Record<number, string> = {
|
|
|
114
118
|
[WebhookType.CUSTOM]: '自定义',
|
|
115
119
|
};
|
|
116
120
|
|
|
121
|
+
/**
|
|
122
|
+
* push 表单状态。
|
|
123
|
+
*
|
|
124
|
+
* 0-草稿,1-收集中,2-已停止。
|
|
125
|
+
*/
|
|
126
|
+
export enum FormStatus {
|
|
127
|
+
DRAFT = 0,
|
|
128
|
+
COLLECTING = 1,
|
|
129
|
+
STOPPED = 2,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const FormStatusDescription: Record<FormStatus, string> = {
|
|
133
|
+
[FormStatus.DRAFT]: '草稿',
|
|
134
|
+
[FormStatus.COLLECTING]: '收集中',
|
|
135
|
+
[FormStatus.STOPPED]: '已停止',
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* push 文档 / 表格分享权限。
|
|
140
|
+
*
|
|
141
|
+
* 0-关闭分享,1-开启分享(仅可查看)。
|
|
142
|
+
*/
|
|
143
|
+
export enum SharePerm {
|
|
144
|
+
CLOSED = 0,
|
|
145
|
+
VIEW = 1,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* push 文档 / 表格打开分享页是否需要登录。
|
|
150
|
+
*
|
|
151
|
+
* 0-免登录,1-需登录。
|
|
152
|
+
*/
|
|
153
|
+
export enum ShareLogin {
|
|
154
|
+
ANONYMOUS = 0,
|
|
155
|
+
REQUIRED = 1,
|
|
156
|
+
};
|
|
157
|
+
|
|
117
158
|
/**
|
|
118
159
|
* PushPlus 接口业务返回码语义。
|
|
119
160
|
*
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,10 @@ export {
|
|
|
25
25
|
CallbackEvent,
|
|
26
26
|
WebhookType,
|
|
27
27
|
WebhookTypeDescription,
|
|
28
|
+
FormStatus,
|
|
29
|
+
FormStatusDescription,
|
|
30
|
+
SharePerm,
|
|
31
|
+
ShareLogin,
|
|
28
32
|
ErrorCode,
|
|
29
33
|
errorCodeFromValue,
|
|
30
34
|
isRateLimitedCode,
|
|
@@ -58,6 +62,7 @@ export type {
|
|
|
58
62
|
FriendInfo,
|
|
59
63
|
AccessKeyResult,
|
|
60
64
|
UserInfo,
|
|
65
|
+
VipInfo,
|
|
61
66
|
SendCount,
|
|
62
67
|
UserLimitTime,
|
|
63
68
|
MessageItem,
|
|
@@ -95,6 +100,23 @@ export type {
|
|
|
95
100
|
ImageUploadToken,
|
|
96
101
|
ImageUploadResult,
|
|
97
102
|
ImageItem,
|
|
103
|
+
FormListQuery,
|
|
104
|
+
FormCover,
|
|
105
|
+
FormTheme,
|
|
106
|
+
FormSettings,
|
|
107
|
+
FormItem,
|
|
108
|
+
FormListItem,
|
|
109
|
+
FormSaveRequest,
|
|
110
|
+
FormDetail,
|
|
111
|
+
FormPublishDiff,
|
|
112
|
+
FormPublishResult,
|
|
113
|
+
DocListQuery,
|
|
114
|
+
DocListItem,
|
|
115
|
+
DocVo,
|
|
116
|
+
DocContent,
|
|
117
|
+
ExcelVo,
|
|
118
|
+
ExcelContent,
|
|
119
|
+
ExcelWriteCellsRequest,
|
|
98
120
|
} from './models';
|
|
99
121
|
|
|
100
122
|
export {
|
|
@@ -125,3 +147,6 @@ export {
|
|
|
125
147
|
type ImageFileInput,
|
|
126
148
|
type ImageUploadOptions,
|
|
127
149
|
} from './api/image-api';
|
|
150
|
+
export { FormApi } from './api/form-api';
|
|
151
|
+
export { DocApi } from './api/doc-api';
|
|
152
|
+
export { ExcelApi } from './api/excel-api';
|
package/src/models.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface SendRequest {
|
|
|
56
56
|
to?: string;
|
|
57
57
|
/** 预处理编码(仅会员)。 */
|
|
58
58
|
pre?: string;
|
|
59
|
-
/** push
|
|
59
|
+
/** push 编码;template 为 form/doc/excel 时必传。 */
|
|
60
60
|
pushId?: string;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -107,7 +107,7 @@ export interface BatchSendRequest {
|
|
|
107
107
|
timestamp?: number;
|
|
108
108
|
to?: string;
|
|
109
109
|
pre?: string;
|
|
110
|
-
/** push
|
|
110
|
+
/** push 编码;template 为 form/doc/excel 时必传。 */
|
|
111
111
|
pushId?: string;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -239,6 +239,14 @@ export interface AccessKeyResult {
|
|
|
239
239
|
|
|
240
240
|
/* ============================== 开放接口 - user ============================== */
|
|
241
241
|
|
|
242
|
+
/** 会员信息。 */
|
|
243
|
+
export interface VipInfo {
|
|
244
|
+
/** 是否会员;0-否,1-是。 */
|
|
245
|
+
isVip?: number;
|
|
246
|
+
/** 会员到期日。 */
|
|
247
|
+
lastDay?: string;
|
|
248
|
+
}
|
|
249
|
+
|
|
242
250
|
export interface UserInfo {
|
|
243
251
|
openId?: string;
|
|
244
252
|
unionId?: string;
|
|
@@ -251,6 +259,10 @@ export interface UserInfo {
|
|
|
251
259
|
emailStatus?: number;
|
|
252
260
|
birthday?: string;
|
|
253
261
|
points?: number;
|
|
262
|
+
/** 会员信息。 */
|
|
263
|
+
vipInfo?: VipInfo;
|
|
264
|
+
/** 实名认证状态;0-未实名,1-已实名。 */
|
|
265
|
+
verifyStatus?: number;
|
|
254
266
|
}
|
|
255
267
|
|
|
256
268
|
export interface SendCount {
|
|
@@ -646,3 +658,185 @@ export interface ImageItem {
|
|
|
646
658
|
/** 创建时间。 */
|
|
647
659
|
createTime?: string;
|
|
648
660
|
}
|
|
661
|
+
|
|
662
|
+
/* ============================== 开放接口 - form(push 表单) ============================== */
|
|
663
|
+
|
|
664
|
+
/** 我的表单分页查询。 */
|
|
665
|
+
export interface FormListQuery {
|
|
666
|
+
/** 页码,从 1 开始。 */
|
|
667
|
+
pageNum?: number;
|
|
668
|
+
/** 每页条数。 */
|
|
669
|
+
pageSize?: number;
|
|
670
|
+
/** 按标题关键词搜索。 */
|
|
671
|
+
keyword?: string;
|
|
672
|
+
/** 表单状态:0草稿 / 1收集中 / 2已停止。 */
|
|
673
|
+
status?: number;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** 表单封面页配置。 */
|
|
677
|
+
export interface FormCover {
|
|
678
|
+
enabled?: boolean;
|
|
679
|
+
image?: string;
|
|
680
|
+
buttonText?: string;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** 表单主题外观。 */
|
|
684
|
+
export interface FormTheme {
|
|
685
|
+
primaryColor?: string;
|
|
686
|
+
backgroundColor?: string;
|
|
687
|
+
headerImage?: string;
|
|
688
|
+
backgroundImage?: string;
|
|
689
|
+
cover?: FormCover;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** 表单收集 / 展示设置。 */
|
|
693
|
+
export interface FormSettings {
|
|
694
|
+
endTime?: string | null;
|
|
695
|
+
maxResponses?: number | null;
|
|
696
|
+
oncePerUser?: boolean;
|
|
697
|
+
allowAnonymous?: boolean;
|
|
698
|
+
password?: string;
|
|
699
|
+
showQuestionNumber?: boolean;
|
|
700
|
+
onePerPage?: boolean;
|
|
701
|
+
showPrevButton?: boolean;
|
|
702
|
+
hideTitle?: boolean;
|
|
703
|
+
hideCopyright?: boolean;
|
|
704
|
+
hideAd?: boolean;
|
|
705
|
+
showOutline?: boolean;
|
|
706
|
+
thankText?: string;
|
|
707
|
+
redirectEnabled?: boolean;
|
|
708
|
+
redirectUrl?: string;
|
|
709
|
+
allowEdit?: boolean;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* 表单题目。不同题型字段不同,除常用字段外可携带任意扩展属性。
|
|
714
|
+
*
|
|
715
|
+
* type 常用取值:input / textarea / radio / checkbox / select / number / date / rate 等。
|
|
716
|
+
*/
|
|
717
|
+
export interface FormItem {
|
|
718
|
+
id?: string;
|
|
719
|
+
type?: string;
|
|
720
|
+
alias?: string;
|
|
721
|
+
label?: string;
|
|
722
|
+
description?: string;
|
|
723
|
+
required?: boolean;
|
|
724
|
+
placeholder?: string;
|
|
725
|
+
options?: unknown[];
|
|
726
|
+
rows?: unknown[];
|
|
727
|
+
columns?: unknown[];
|
|
728
|
+
allowOther?: boolean;
|
|
729
|
+
[key: string]: unknown;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/** 表单列表项 / 创建、复制结果(不含题目明细)。 */
|
|
733
|
+
export interface FormListItem {
|
|
734
|
+
id?: number;
|
|
735
|
+
formCode?: string;
|
|
736
|
+
fillUrl?: string;
|
|
737
|
+
title?: string;
|
|
738
|
+
description?: string;
|
|
739
|
+
status?: number;
|
|
740
|
+
responseCount?: number;
|
|
741
|
+
publishTime?: string;
|
|
742
|
+
createTime?: string;
|
|
743
|
+
updateTime?: string;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/** 保存表单设计请求。 */
|
|
747
|
+
export interface FormSaveRequest {
|
|
748
|
+
id: number;
|
|
749
|
+
title: string;
|
|
750
|
+
description?: string;
|
|
751
|
+
items?: FormItem[];
|
|
752
|
+
theme?: FormTheme;
|
|
753
|
+
settings?: FormSettings;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/** 表单详情(含草稿题目、主题、设置)。 */
|
|
757
|
+
export interface FormDetail extends FormListItem {
|
|
758
|
+
items?: FormItem[];
|
|
759
|
+
theme?: FormTheme;
|
|
760
|
+
settings?: FormSettings;
|
|
761
|
+
publishDirty?: boolean;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/** 草稿题目与发布快照差异。 */
|
|
765
|
+
export interface FormPublishDiff {
|
|
766
|
+
dirty?: boolean;
|
|
767
|
+
breaking?: boolean;
|
|
768
|
+
responseCount?: number;
|
|
769
|
+
added?: string[];
|
|
770
|
+
removed?: string[];
|
|
771
|
+
typeChanged?: string[];
|
|
772
|
+
optionChanged?: string[];
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/** 发布表单结果。 */
|
|
776
|
+
export interface FormPublishResult {
|
|
777
|
+
id?: number;
|
|
778
|
+
formCode?: string;
|
|
779
|
+
fillUrl?: string;
|
|
780
|
+
title?: string;
|
|
781
|
+
status?: number;
|
|
782
|
+
previousStatus?: number;
|
|
783
|
+
publishDirty?: boolean;
|
|
784
|
+
publishTime?: string;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/* ============================== 开放接口 - doc / excel 共用查询 ============================== */
|
|
788
|
+
|
|
789
|
+
/** 文档 / 表格分页查询。 */
|
|
790
|
+
export interface DocListQuery {
|
|
791
|
+
pageNum?: number;
|
|
792
|
+
pageSize?: number;
|
|
793
|
+
keyword?: string;
|
|
794
|
+
/** true 时仅返回已开启分享的记录。 */
|
|
795
|
+
shareEnabled?: boolean;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** 文档 / 表格列表项。 */
|
|
799
|
+
export interface DocListItem {
|
|
800
|
+
docCode?: string;
|
|
801
|
+
shareUrl?: string;
|
|
802
|
+
title?: string;
|
|
803
|
+
sharePerm?: number;
|
|
804
|
+
shareLogin?: number;
|
|
805
|
+
perm?: number;
|
|
806
|
+
published?: boolean;
|
|
807
|
+
publishTime?: string;
|
|
808
|
+
createTime?: string;
|
|
809
|
+
updateTime?: string;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/** 文档信息(不含正文)。 */
|
|
813
|
+
export interface DocVo extends DocListItem {
|
|
814
|
+
publishDirty?: boolean;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/** 文档内容(HTML 草稿)。 */
|
|
818
|
+
export interface DocContent extends DocVo {
|
|
819
|
+
content?: string;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/** 表格信息(不含正文)。与文档结构相同,独立类型便于区分。 */
|
|
823
|
+
export interface ExcelVo extends DocListItem {
|
|
824
|
+
publishDirty?: boolean;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/** 表格内容(整表 JSON 字符串草稿)。 */
|
|
828
|
+
export interface ExcelContent extends ExcelVo {
|
|
829
|
+
/** 整表草稿 JSON 字符串。 */
|
|
830
|
+
content?: string;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/** 按区域写入单元格请求。 */
|
|
834
|
+
export interface ExcelWriteCellsRequest {
|
|
835
|
+
docCode: string;
|
|
836
|
+
/** 工作表名称;不传则写入活动表 / 第一张表。 */
|
|
837
|
+
sheetName?: string;
|
|
838
|
+
/** 起始单元格,如 A1。 */
|
|
839
|
+
range: string;
|
|
840
|
+
/** 二维数组,外层为行、内层为列。 */
|
|
841
|
+
values: unknown[][];
|
|
842
|
+
}
|