@jinshuju/cli 0.14.0 → 0.15.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 CHANGED
@@ -111,7 +111,10 @@ leaves every other change unsent.
111
111
  `setting` travels as is, on create and on edit. Its close rules decide when the
112
112
  form is open; they coexist, and `form get` reads them back in the shape they
113
113
  were written. On edit a rule replaces what was there (`time_periods` is the
114
- whole list) and `{"enabled": false}` removes it.
114
+ whole list). A time-range, daily or entries rule is removed by
115
+ `{"enabled": false}` or by `null`. `manually_close_rule` is a switch rather
116
+ than a rule: `{"closed": false}` reopens the form, and changing `closed` either
117
+ way deletes the other three rules.
115
118
 
116
119
  ```bash
117
120
  # between two instants; either end may be left out
@@ -122,7 +125,9 @@ jinshuju form edit Kp7mQ2 --json '{"setting":{"daily_repeat_close_rule":{"time_p
122
125
  {"start_time":{"hour":17,"minute":0},"end_time":{"hour":18,"minute":30}}]}}}'
123
126
  jinshuju form edit Kp7mQ2 --json '{"setting":{"daily_repeat_close_rule":{"enabled":false}}}'
124
127
  jinshuju form edit Kp7mQ2 --json '{"setting":{"by_entries_close_rule":{"limit":100}}}' # closes after 100 entries
128
+ jinshuju form edit Kp7mQ2 --json '{"setting":{"by_entries_close_rule":null}}' # takes the limit off
125
129
  jinshuju form edit Kp7mQ2 --json '{"setting":{"manually_close_rule":{"closed":true}}}' # stops it now
130
+ jinshuju form edit Kp7mQ2 --json '{"setting":{"manually_close_rule":{"closed":false}}}' # reopens it
126
131
  ```
127
132
 
128
133
  `show_form_before_open` and `show_close_count_down` only hold with a time-range
@@ -139,6 +144,7 @@ jinshuju entry list --form Kp7mQ2
139
144
  jinshuju entry list --table Vn4xR8
140
145
  jinshuju entry get 1 --form Kp7mQ2
141
146
  jinshuju entry list --form Kp7mQ2 --view aB3dE9
147
+ jinshuju folder get Fd2xK8 # the folder a form or table's folder_token names
142
148
  ```
143
149
 
144
150
  Filtering, sorting and paging:
@@ -305,7 +311,7 @@ needs the `submit_entries` scope for these.
305
311
 
306
312
  ## Working with files
307
313
 
308
- Five commands take a file. The CLI uploads with its own credential; there is no
314
+ Seven commands take a file. The CLI uploads with its own credential; there is no
309
315
  ticket to fetch first.
310
316
 
311
317
  ```bash
@@ -316,6 +322,9 @@ jinshuju entry create --form Kp7mQ2 --json '{"field_1":"Alice"}' --attach field_
316
322
  jinshuju form theme set Kp7mQ2 --wallpaper ./bg.png
317
323
  jinshuju opensearch edit Qy7nR3 --header ./banner.png
318
324
  jinshuju form image upload ./venue-map.png # answers with a url for an <img> in a form or field description
325
+ jinshuju sms signature create 小金培训 --license ./license.jpg --company-name 小金培训有限公司 --company-id 91110000MA00000000 \
326
+ --id-card-front ./front.jpg --id-card-back ./back.jpg --id-card-name 张三 --id-card-number 110101199001011234 --mobile 13800000000
327
+ jinshuju sms signature update 6512a1c2d3e4f5a6b7c8d9d3 --license ./license-clear.jpg
319
328
  ```
320
329
 
321
330
  ```bash
@@ -409,6 +418,32 @@ jinshuju field preview-convert --form Kp7mQ2 field_1 --to RadioButton
409
418
  it takes that data along, so it is worth asking first. `preview-convert` reports
410
419
  how much a type conversion would keep and how much it would clear.
411
420
 
421
+ ## SMS signatures and templates
422
+
423
+ An SMS notification needs a signature and a template, and both wait on a
424
+ review, so submit them as early as you can. A template can go in while its
425
+ signature is still under review; `sms status` follows both, with the reason
426
+ when one is rejected.
427
+
428
+ `sms signature list` shows every signature of the account and `sms template list`
429
+ your templates with the ones the account shares; both carry the ids the updates
430
+ and deletes take. A rejected signature, and a template of yours that is not under
431
+ review, can be changed and sent back to review; only the flags given change. The
432
+ same ones can be deleted with `--yes`; deleting a signature takes its templates
433
+ with it.
434
+
435
+ ```bash
436
+ jinshuju sms signature create 小金培训 --license ./license.jpg --company-name 小金培训有限公司 --company-id 91110000MA00000000 \
437
+ --id-card-front ./front.jpg --id-card-back ./back.jpg --id-card-name 张三 --id-card-number 110101199001011234 --mobile 13800000000
438
+ jinshuju sms template create --signature 小金培训 --content "你报名的课程明天上午 9 点开课,请准时参加。"
439
+ jinshuju sms status
440
+ jinshuju sms signature list --status FAIL
441
+ jinshuju sms template list --keyword 开课 --scope owned
442
+ jinshuju sms signature update 6512a1c2d3e4f5a6b7c8d9d3 --license ./license-clear.jpg
443
+ jinshuju sms template update 6512a1c2d3e4f5a6b7c8d9e0 --content "你报名的课程后天上午 9 点开课。"
444
+ jinshuju sms template delete 6512a1c2d3e4f5a6b7c8d9e0 --yes
445
+ ```
446
+
412
447
  ## Odds and ends
413
448
 
414
449
  ```bash
@@ -18,6 +18,13 @@ export const ACCOUNT = [
18
18
  options: [LIMIT_OPTION],
19
19
  request: (input) => call('listBillingAccountUsers', { query: paging(input) })
20
20
  },
21
+ {
22
+ path: ['account', 'paid-feature', 'list'],
23
+ summary: "List which paid features the account's plan includes",
24
+ description: 'Each paid feature, its name as the product shows it, and whether the plan includes it now. Quotas ' +
25
+ 'left this month, and whether each add-on service can still be used, are in account get.',
26
+ request: () => call('listBillingAccountPaidFeatures')
27
+ },
21
28
  {
22
29
  path: ['account', 'invoice', 'list'],
23
30
  summary: 'List e-invoices, and the amount not invoiced yet',
@@ -8,6 +8,14 @@ export const FOLDER = [
8
8
  options: [LIMIT_OPTION],
9
9
  request: (input) => call('listFolders', { query: paging(input) })
10
10
  },
11
+ {
12
+ path: ['folder', 'get'],
13
+ summary: 'Show a folder: its name and kind',
14
+ description: 'Takes the folder_token a form or table answers with, to say which folder that is.',
15
+ args: [{ name: 'folder', required: true, description: 'Folder token, e.g. Fd2xK8' }],
16
+ request: (input) => call('getFolder', { path: { folder_token: input.args.folder } }),
17
+ examples: ['jinshuju folder get Fd2xK8']
18
+ },
11
19
  {
12
20
  path: ['folder', 'create'],
13
21
  summary: 'Create a folder',
@@ -37,7 +37,9 @@ const FORM_PAYLOAD = [
37
37
  'entries, and manually_close_rule {"closed": true} stops it now. The rules',
38
38
  'coexist. show_form_before_open and show_close_count_down only hold with a',
39
39
  'time-range or daily rule. The same keys go in a `form edit` payload, where',
40
- 'time_periods replaces the list and {"enabled": false} removes a rule.',
40
+ 'time_periods replaces the list and {"enabled": false} or null removes a',
41
+ 'time-range, daily or entries rule. {"closed": false} reopens the form, and',
42
+ 'changing "closed" either way deletes the other three rules.',
41
43
  '',
42
44
  'Reading a form back does not give you something you can send again: a field',
43
45
  'written as "TextField" reads as "single_line_text". `field types` lists the',
@@ -68,7 +68,7 @@ export const RESOURCES = [
68
68
  { name: 'transaction', summary: 'Payment orders placed on payment forms' },
69
69
  { name: 'refund', summary: 'Refunds of payment orders' },
70
70
  { name: 'payout', summary: 'Payouts to the settlement account' },
71
- { name: 'sms', summary: 'SMS signature and template review' },
71
+ { name: 'sms', summary: 'Manage SMS signatures and templates' },
72
72
  { name: 'config', summary: 'Manage CLI configuration' }
73
73
  ];
74
74
  export const COMMANDS = [
@@ -1,9 +1,310 @@
1
- import { call } from '../spec.js';
1
+ import { PAGINATION_OPTIONS, UsageError } from '../options.js';
2
+ import { progress } from '../progress.js';
3
+ import { bodyChoices, call, choices } from '../spec.js';
4
+ import { confirmed, LISTING, paging, YES_OPTION } from './shared.js';
5
+ import { upload } from './upload.js';
6
+ import { basename } from 'node:path';
7
+ /**
8
+ * A signature is applied for with license images, which go up first as the
9
+ * caller's own uploads and are then referred to by id. The review takes a
10
+ * business license and both sides of the ID card of whoever is in charge.
11
+ */
12
+ const SIGNATURE_OPTIONS = [
13
+ {
14
+ name: '--license',
15
+ type: 'string',
16
+ repeatable: true,
17
+ placeholder: '<file>',
18
+ description: 'Business license image (jpg, png or bmp, up to 5 MB), repeatable'
19
+ },
20
+ { name: '--company-name', type: 'string', placeholder: '<name>', description: 'Company name, as on the license' },
21
+ {
22
+ name: '--company-id',
23
+ type: 'string',
24
+ placeholder: '<code>',
25
+ description: 'Unified social credit code, as on the license'
26
+ },
27
+ {
28
+ name: '--id-card-front',
29
+ type: 'string',
30
+ placeholder: '<file>',
31
+ description: 'ID card front (the national emblem side)'
32
+ },
33
+ { name: '--id-card-back', type: 'string', placeholder: '<file>', description: 'ID card back (the portrait side)' },
34
+ { name: '--id-card-name', type: 'string', placeholder: '<name>', description: 'Name on the ID card' },
35
+ { name: '--id-card-number', type: 'string', placeholder: '<number>', description: 'ID card number' },
36
+ { name: '--mobile', type: 'string', placeholder: '<mobile>', description: 'Mobile number of the ID card holder' }
37
+ ];
38
+ /** The flags that go as they are, by the key the API takes each by. */
39
+ const SIGNATURE_TEXT = [
40
+ { key: 'company_name', option: 'company_name', flag: '--company-name <name>' },
41
+ { key: 'company_id', option: 'company_id', flag: '--company-id <code>' },
42
+ { key: 'id_card_name', option: 'id_card_name', flag: '--id-card-name <name>' },
43
+ { key: 'id_card_number', option: 'id_card_number', flag: '--id-card-number <number>' },
44
+ { key: 'identity_mobile', option: 'mobile', flag: '--mobile <mobile>' }
45
+ ];
46
+ /** The flags that name a file, uploaded and then sent by the id it gets. */
47
+ const SIGNATURE_FILES = [
48
+ { key: 'id_card_front_attachment_id', option: 'id_card_front', flag: '--id-card-front <file>' },
49
+ { key: 'id_card_back_attachment_id', option: 'id_card_back', flag: '--id-card-back <file>' }
50
+ ];
51
+ const TEMPLATE_DESCRIPTION_OPTION = {
52
+ name: '--description',
53
+ type: 'string',
54
+ placeholder: '<text>',
55
+ description: 'What the SMS is for, shown to the reviewer'
56
+ };
57
+ function requiredOption(input, key, flag) {
58
+ const value = input.options[key];
59
+ if (!value)
60
+ throw new UsageError(`${flag} is required`);
61
+ return value;
62
+ }
63
+ function licensesOf(input) {
64
+ return input.options.license ?? [];
65
+ }
66
+ async function uploadLicense(client, file) {
67
+ const watching = progress();
68
+ watching.step(`uploading ${basename(file)}…`);
69
+ try {
70
+ const uploaded = await client.request(upload('uploadUserLicenseAttachment', {}, file));
71
+ return uploaded.attachment_id;
72
+ }
73
+ finally {
74
+ watching.done();
75
+ }
76
+ }
77
+ /**
78
+ * The materials the flags give, with their files uploaded. Only the flags that
79
+ * were given are in it, which is what an update needs: what is left out stays.
80
+ */
81
+ async function signatureMaterials(input, client) {
82
+ const body = {};
83
+ for (const { key, option } of SIGNATURE_TEXT) {
84
+ if (input.options[option] !== undefined)
85
+ body[key] = input.options[option];
86
+ }
87
+ const licenses = licensesOf(input);
88
+ if (licenses.length > 0) {
89
+ const ids = [];
90
+ for (const license of licenses)
91
+ ids.push(await uploadLicense(client, license));
92
+ body.license_attachment_ids = ids;
93
+ }
94
+ for (const { key, option } of SIGNATURE_FILES) {
95
+ const file = input.options[option];
96
+ if (file)
97
+ body[key] = await uploadLicense(client, file);
98
+ }
99
+ return body;
100
+ }
101
+ /** Only the keys whose flags were given, so an update leaves the rest as it was. */
102
+ function templateBody(input) {
103
+ const body = {};
104
+ if (input.options.signature !== undefined)
105
+ body.signature = input.options.signature;
106
+ if (input.options.content !== undefined)
107
+ body.content = input.options.content;
108
+ if (input.options.description !== undefined)
109
+ body.apply_description = input.options.description;
110
+ return body;
111
+ }
2
112
  export const SMS = [
3
113
  {
4
114
  path: ['sms', 'status'],
5
115
  summary: 'List SMS signatures and templates with their review status and why a review failed',
6
116
  description: 'Your own signatures and templates, not those of the rest of the account.',
7
117
  request: () => call('listSmsAuditStatuses')
118
+ },
119
+ {
120
+ path: ['sms', 'signature', 'list'],
121
+ summary: "List the account's SMS signatures",
122
+ description: 'Every signature of the account, whoever applied for it, with the ids `sms signature update` and ' +
123
+ '`sms signature delete` take. type says what each signs: notification, SMS sent from templates (channel ' +
124
+ 'normal or marketing), or verification, the verification codes of mobile fields only. Templates can only be ' +
125
+ 'created under a notification one whose channel is normal.',
126
+ options: [
127
+ {
128
+ name: '--status',
129
+ type: 'string',
130
+ choices: choices('listSmsSignatures', 'status'),
131
+ placeholder: '<status>',
132
+ description: 'Only those in this review status, e.g. FAIL for the ones that can be changed or deleted'
133
+ },
134
+ ...PAGINATION_OPTIONS
135
+ ],
136
+ request: (input) => call('listSmsSignatures', { query: { status: input.options.status, ...paging(input) } }),
137
+ paginate: LISTING,
138
+ examples: ['jinshuju sms signature list', 'jinshuju sms signature list --status FAIL']
139
+ },
140
+ {
141
+ path: ['sms', 'signature', 'create'],
142
+ summary: 'Apply for an SMS signature and submit it for review',
143
+ description: 'Uploads the license images and applies with them in one command. Review takes a while: follow it with ' +
144
+ '`sms signature list`. A signature the account already has under review or approved is answered as it is. ' +
145
+ 'For SMS notifications leave --type out. --type verification applies for a signature that only replaces ' +
146
+ 'the default 金数据 signature on the verification-code SMS of mobile fields: it cannot send notifications or ' +
147
+ 'have templates, and verification codes already work without one.',
148
+ args: [{ name: 'signature', required: true, description: 'Signature text, without 【】' }],
149
+ options: [
150
+ {
151
+ name: '--type',
152
+ type: 'string',
153
+ choices: bodyChoices('createSmsSignature', 'type'),
154
+ placeholder: '<type>',
155
+ description: 'notification (SMS notifications, the default) or verification (verification codes of mobile fields only)'
156
+ },
157
+ ...SIGNATURE_OPTIONS
158
+ ],
159
+ run: async (input, client) => {
160
+ if (licensesOf(input).length === 0)
161
+ throw new UsageError('--license <file> is required');
162
+ for (const { option, flag } of [...SIGNATURE_TEXT, ...SIGNATURE_FILES])
163
+ requiredOption(input, option, flag);
164
+ const body = {
165
+ signature: input.args.signature,
166
+ ...(await signatureMaterials(input, client))
167
+ };
168
+ if (input.options.type !== undefined)
169
+ body.type = input.options.type;
170
+ return client.request(call('createSmsSignature', { body }));
171
+ },
172
+ examples: [
173
+ 'jinshuju sms signature create 小金培训 --license ./license.jpg --company-name 小金培训有限公司 ' +
174
+ '--company-id 91110000MA00000000 --id-card-front ./front.jpg --id-card-back ./back.jpg ' +
175
+ '--id-card-name 张三 --id-card-number 110101199001011234 --mobile 13800000000'
176
+ ]
177
+ },
178
+ {
179
+ path: ['sms', 'signature', 'update'],
180
+ summary: 'Change a rejected SMS signature and submit it for review again',
181
+ description: 'Only a rejected signature can be changed. Only the flags given change; with none, it is submitted again ' +
182
+ 'as it is. Its templates go back to review with it, unless --signature changes the text: then each ' +
183
+ 'stays under the old text until `sms template update` sends it again.',
184
+ args: [{ name: 'id', required: true, description: 'Signature id, from `sms signature list`' }],
185
+ options: [
186
+ { name: '--signature', type: 'string', placeholder: '<text>', description: 'New signature text, without 【】' },
187
+ ...SIGNATURE_OPTIONS
188
+ ],
189
+ run: async (input, client) => {
190
+ const body = await signatureMaterials(input, client);
191
+ if (input.options.signature !== undefined)
192
+ body.signature = input.options.signature;
193
+ return client.request(call('updateSmsSignature', { path: { id: input.args.id }, body }));
194
+ },
195
+ examples: ['jinshuju sms signature update 6512a1c2d3e4f5a6b7c8d9d3 --license ./license-clear.jpg']
196
+ },
197
+ {
198
+ path: ['sms', 'signature', 'delete'],
199
+ summary: 'Delete a rejected SMS signature, and every template under it',
200
+ description: 'Only a rejected signature can be deleted. Its templates go with it.',
201
+ args: [{ name: 'id', required: true, description: 'Signature id, from `sms signature list`' }],
202
+ options: [YES_OPTION],
203
+ request: (input) => {
204
+ confirmed(input, `Deleting signature ${input.args.id} and its templates`);
205
+ return call('deleteSmsSignature', { path: { id: input.args.id } });
206
+ },
207
+ examples: ['jinshuju sms signature delete 6512a1c2d3e4f5a6b7c8d9d3 --yes']
208
+ },
209
+ {
210
+ path: ['sms', 'template', 'list'],
211
+ summary: 'List your SMS templates and the ones the account shares',
212
+ description: 'scope owned is yours and can be changed or deleted with the ids it carries; scope shared is shared by ' +
213
+ 'another member and can only be sent.',
214
+ options: [
215
+ {
216
+ name: '--keyword',
217
+ type: 'string',
218
+ placeholder: '<kw>',
219
+ description: 'Match the content or the signature, case-insensitive and partial'
220
+ },
221
+ {
222
+ name: '--scope',
223
+ type: 'string',
224
+ choices: choices('listSmsTemplates', 'scope'),
225
+ placeholder: '<scope>',
226
+ description: 'owned (yours) or shared (shared by another member); both when omitted'
227
+ },
228
+ {
229
+ name: '--signature-id',
230
+ type: 'string',
231
+ placeholder: '<id>',
232
+ description: 'Only templates under this signature, from `sms signature list`'
233
+ },
234
+ {
235
+ name: '--status',
236
+ type: 'string',
237
+ choices: choices('listSmsTemplates', 'status'),
238
+ placeholder: '<status>',
239
+ description: 'Only those in this review status'
240
+ },
241
+ ...PAGINATION_OPTIONS
242
+ ],
243
+ request: (input) => call('listSmsTemplates', {
244
+ query: {
245
+ q: input.options.keyword,
246
+ scope: input.options.scope,
247
+ signature_id: input.options.signature_id,
248
+ status: input.options.status,
249
+ ...paging(input)
250
+ }
251
+ }),
252
+ paginate: LISTING,
253
+ examples: ['jinshuju sms template list --keyword 开课', 'jinshuju sms template list --scope owned --status FAIL']
254
+ },
255
+ {
256
+ path: ['sms', 'template', 'create'],
257
+ summary: 'Submit an SMS template for review',
258
+ description: 'The signature must have been applied for, though it need not be approved yet. Review takes a while: ' +
259
+ 'follow it with `sms status`. Once approved, the template id is what a notification sends.',
260
+ options: [
261
+ { name: '--signature', type: 'string', placeholder: '<signature>', description: 'Signature to send it under' },
262
+ {
263
+ name: '--content',
264
+ type: 'string',
265
+ placeholder: '<text>',
266
+ description: 'Template content, without the signature'
267
+ },
268
+ TEMPLATE_DESCRIPTION_OPTION
269
+ ],
270
+ request: (input) => {
271
+ requiredOption(input, 'signature', '--signature <signature>');
272
+ requiredOption(input, 'content', '--content <text>');
273
+ return call('createSmsTemplate', { body: templateBody(input) });
274
+ },
275
+ examples: [
276
+ 'jinshuju sms template create --signature 小金培训 --content "你报名的课程明天上午 9 点开课,请准时参加。"'
277
+ ]
278
+ },
279
+ {
280
+ path: ['sms', 'template', 'update'],
281
+ summary: 'Change an SMS template and submit it for review again',
282
+ description: 'Not while it is under review. Only the flags given change; with none, it is submitted again as it is. ' +
283
+ 'An approved template goes back to review and cannot be sent until approved again.',
284
+ args: [{ name: 'id', required: true, description: 'Template id, from `sms template list`' }],
285
+ options: [
286
+ {
287
+ name: '--signature',
288
+ type: 'string',
289
+ placeholder: '<signature>',
290
+ description: 'Send it under this signature instead'
291
+ },
292
+ { name: '--content', type: 'string', placeholder: '<text>', description: 'New content, without the signature' },
293
+ TEMPLATE_DESCRIPTION_OPTION
294
+ ],
295
+ request: (input) => call('updateSmsTemplate', { path: { id: input.args.id }, body: templateBody(input) }),
296
+ examples: ['jinshuju sms template update 6512a1c2d3e4f5a6b7c8d9e0 --content "你报名的课程后天上午 9 点开课。"']
297
+ },
298
+ {
299
+ path: ['sms', 'template', 'delete'],
300
+ summary: 'Delete an SMS template',
301
+ description: 'Not while it is under review or being sent. A notification sending it stops sending SMS once it is gone.',
302
+ args: [{ name: 'id', required: true, description: 'Template id, from `sms template list`' }],
303
+ options: [YES_OPTION],
304
+ request: (input) => {
305
+ confirmed(input, `Deleting template ${input.args.id}`);
306
+ return call('deleteSmsTemplate', { path: { id: input.args.id } });
307
+ },
308
+ examples: ['jinshuju sms template delete 6512a1c2d3e4f5a6b7c8d9e0 --yes']
8
309
  }
9
310
  ];
@@ -1,7 +1,7 @@
1
1
  import type { Operation, Schema } from '../spec.js';
2
2
  /** The path every operation's path is relative to, from `servers`. */
3
3
  export declare const BASE_PATH = "/api/v1";
4
- export type OperationId = 'aggregateEntries' | 'aggregateFormViewEntries' | 'aggregateTableEntries' | 'aggregateTableViewEntries' | 'aggregateTradeTransactions' | 'checkFormFieldData' | 'checkTableFieldData' | 'copyForm' | 'countEntries' | 'countEntriesAcrossForms' | 'countFormViewEntries' | 'countTableEntries' | 'countTableViewEntries' | 'createCheckinCampaign' | 'createEntriesBatch' | 'createEntry' | 'createEntryComment' | 'createEntryImport' | 'createEntryLegacy' | 'createFillFormEntry' | 'createFillViewEntry' | 'createFolder' | 'createForm' | 'createFormView' | 'createFormWebhook' | 'createOpensearchQuery' | 'createPredefinedChoicesSet' | 'createTable' | 'createTableEntry' | 'createTableEntryComment' | 'createTableView' | 'createTemplateUsage' | 'createWeixinOauthSession' | 'deleteCheckinCampaign' | 'deleteEntry' | 'deleteEntryComment' | 'deleteFormView' | 'deleteFormWebhook' | 'deletePredefinedChoicesSet' | 'deleteTable' | 'deleteTableEntry' | 'deleteTableEntryComment' | 'deleteTableView' | 'getBillingAccount' | 'getCheckinCampaign' | 'getCurrentUser' | 'getEntry' | 'getEntryImport' | 'getEntryStats' | 'getEvaluationSetting' | 'getExamSetting' | 'getFieldType' | 'getFillFormPage' | 'getFillViewPage' | 'getForm' | 'getFormSetting' | 'getFormView' | 'getManuallyCloseRule' | 'getOpensearchQuery' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'listBillingAccountInvoices' | 'listBillingAccountPaymentHistories' | 'listBillingAccountUsers' | 'listCheckinCampaigns' | 'listContacts' | 'listEntries' | 'listEntryComments' | 'listExtendedAttributes' | 'listFieldRules' | 'listFieldTypes' | 'listFolders' | 'listFormCooperators' | 'listFormViewEntries' | 'listFormViews' | 'listForms' | 'listMyFilledForms' | 'listMySubmittedEntries' | 'listOpensearchQueries' | 'listOpensearchQuerySuggestions' | 'listPredefinedChoicesSets' | 'listSmsAuditStatuses' | 'listTableEntries' | 'listTableEntryComments' | 'listTableViewEntries' | 'listTableViews' | 'listTables' | 'listTradePayouts' | 'listTradeRefunds' | 'listTradeTransactions' | 'moveFormToFolder' | 'moveTableToFolder' | 'patchEntriesBatch' | 'previewFormFieldTypeChange' | 'previewTableFieldTypeChange' | 'replaceEntry' | 'replaceTableEntry' | 'searchEntriesAcrossForms' | 'searchMySubmittedEntries' | 'summarizeEntries' | 'summarizeFormViewEntries' | 'summarizeTableEntries' | 'summarizeTableViewEntries' | 'updateAccessPolicy' | 'updateCheckinCampaign' | 'updateEntry' | 'updateEntryComment' | 'updateEntryViaPost' | 'updateEvaluationSetting' | 'updateExamSetting' | 'updateForm' | 'updateFormSetting' | 'updateFormTheme' | 'updateFormView' | 'updateManuallyCloseRule' | 'updateOpensearchQuery' | 'updatePredefinedChoicesSet' | 'updateTable' | 'updateTableEntry' | 'updateTableEntryComment' | 'updateTableEntryViaPost' | 'updateTableView' | 'uploadEntryAttachment' | 'uploadFormImage' | 'uploadImportFile' | 'verifyRedirectParams';
4
+ export type OperationId = 'aggregateEntries' | 'aggregateFormViewEntries' | 'aggregateTableEntries' | 'aggregateTableViewEntries' | 'aggregateTradeTransactions' | 'checkFormFieldData' | 'checkTableFieldData' | 'copyForm' | 'countEntries' | 'countEntriesAcrossForms' | 'countFormViewEntries' | 'countTableEntries' | 'countTableViewEntries' | 'createCheckinCampaign' | 'createEntriesBatch' | 'createEntry' | 'createEntryComment' | 'createEntryImport' | 'createEntryLegacy' | 'createFillFormEntry' | 'createFillViewEntry' | 'createFolder' | 'createForm' | 'createFormView' | 'createFormWebhook' | 'createOpensearchQuery' | 'createPredefinedChoicesSet' | 'createSmsSignature' | 'createSmsTemplate' | 'createTable' | 'createTableEntry' | 'createTableEntryComment' | 'createTableView' | 'createTemplateUsage' | 'createWeixinOauthSession' | 'deleteCheckinCampaign' | 'deleteEntry' | 'deleteEntryComment' | 'deleteForm' | 'deleteFormView' | 'deleteFormWebhook' | 'deletePredefinedChoicesSet' | 'deleteSmsSignature' | 'deleteSmsTemplate' | 'deleteTable' | 'deleteTableEntry' | 'deleteTableEntryComment' | 'deleteTableView' | 'getBillingAccount' | 'getCheckinCampaign' | 'getCurrentUser' | 'getEntry' | 'getEntryImport' | 'getEntryStats' | 'getEvaluationSetting' | 'getExamSetting' | 'getFieldType' | 'getFillFormPage' | 'getFillViewPage' | 'getFolder' | 'getForm' | 'getFormSetting' | 'getFormView' | 'getManuallyCloseRule' | 'getOpensearchQuery' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'listBillingAccountInvoices' | 'listBillingAccountPaidFeatures' | 'listBillingAccountPaymentHistories' | 'listBillingAccountUsers' | 'listCheckinCampaigns' | 'listContacts' | 'listEntries' | 'listEntryComments' | 'listExtendedAttributes' | 'listFieldRules' | 'listFieldTypes' | 'listFolders' | 'listFormCooperators' | 'listFormViewEntries' | 'listFormViews' | 'listForms' | 'listMyFilledForms' | 'listMySubmittedEntries' | 'listOpensearchQueries' | 'listOpensearchQuerySuggestions' | 'listPredefinedChoicesSets' | 'listSmsAuditStatuses' | 'listSmsSignatures' | 'listSmsTemplates' | 'listTableEntries' | 'listTableEntryComments' | 'listTableViewEntries' | 'listTableViews' | 'listTables' | 'listTradePayouts' | 'listTradeRefunds' | 'listTradeTransactions' | 'moveFormToFolder' | 'moveTableToFolder' | 'patchEntriesBatch' | 'previewFormFieldTypeChange' | 'previewTableFieldTypeChange' | 'replaceEntry' | 'replaceTableEntry' | 'searchEntriesAcrossForms' | 'searchMySubmittedEntries' | 'summarizeEntries' | 'summarizeFormViewEntries' | 'summarizeTableEntries' | 'summarizeTableViewEntries' | 'updateAccessPolicy' | 'updateCheckinCampaign' | 'updateEntry' | 'updateEntryComment' | 'updateEntryViaPost' | 'updateEvaluationSetting' | 'updateExamSetting' | 'updateForm' | 'updateFormSetting' | 'updateFormTheme' | 'updateFormView' | 'updateManuallyCloseRule' | 'updateOpensearchQuery' | 'updatePredefinedChoicesSet' | 'updateSmsSignature' | 'updateSmsTemplate' | 'updateTable' | 'updateTableEntry' | 'updateTableEntryComment' | 'updateTableEntryViaPost' | 'updateTableView' | 'uploadEntryAttachment' | 'uploadFormImage' | 'uploadImportFile' | 'uploadUserLicenseAttachment' | 'verifyRedirectParams';
5
5
  export declare const OPERATIONS: {
6
6
  readonly [id in OperationId]: Operation;
7
7
  };
@@ -367,6 +367,18 @@ export const OPERATIONS = {
367
367
  }
368
368
  }
369
369
  },
370
+ createSmsSignature: {
371
+ method: 'POST',
372
+ path: '/sms/signatures',
373
+ parameters: [],
374
+ body: { required: true, content: { 'application/json': { $ref: 'SMSSignatureCreateInput' } } }
375
+ },
376
+ createSmsTemplate: {
377
+ method: 'POST',
378
+ path: '/sms/templates',
379
+ parameters: [],
380
+ body: { required: true, content: { 'application/json': { $ref: 'SMSTemplateCreateInput' } } }
381
+ },
370
382
  createTable: {
371
383
  method: 'POST',
372
384
  path: '/tables',
@@ -436,6 +448,11 @@ export const OPERATIONS = {
436
448
  { name: 'comment_id', in: 'path', required: true, schema: { type: 'string' } }
437
449
  ]
438
450
  },
451
+ deleteForm: {
452
+ method: 'DELETE',
453
+ path: '/forms/{form_token}',
454
+ parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }]
455
+ },
439
456
  deleteFormView: {
440
457
  method: 'DELETE',
441
458
  path: '/forms/{form_token}/views/{view_token}',
@@ -454,6 +471,16 @@ export const OPERATIONS = {
454
471
  path: '/predefined_choices_sets/{id}',
455
472
  parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }]
456
473
  },
474
+ deleteSmsSignature: {
475
+ method: 'DELETE',
476
+ path: '/sms/signatures/{id}',
477
+ parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }]
478
+ },
479
+ deleteSmsTemplate: {
480
+ method: 'DELETE',
481
+ path: '/sms/templates/{id}',
482
+ parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }]
483
+ },
457
484
  deleteTable: {
458
485
  method: 'DELETE',
459
486
  path: '/tables/{table_token}',
@@ -548,6 +575,11 @@ export const OPERATIONS = {
548
575
  path: '/fill/v/{view_token}',
549
576
  parameters: [{ name: 'view_token', in: 'path', required: true, schema: { type: 'string' } }]
550
577
  },
578
+ getFolder: {
579
+ method: 'GET',
580
+ path: '/folders/{folder_token}',
581
+ parameters: [{ name: 'folder_token', in: 'path', required: true, schema: { type: 'string' } }]
582
+ },
551
583
  getForm: {
552
584
  method: 'GET',
553
585
  path: '/forms/{form_token}',
@@ -611,6 +643,7 @@ export const OPERATIONS = {
611
643
  },
612
644
  getTradeMerchant: { method: 'GET', path: '/trade/merchant', parameters: [] },
613
645
  listBillingAccountInvoices: { method: 'GET', path: '/billing_account/invoices', parameters: [] },
646
+ listBillingAccountPaidFeatures: { method: 'GET', path: '/billing_account/paid_features', parameters: [] },
614
647
  listBillingAccountPaymentHistories: {
615
648
  method: 'GET',
616
649
  path: '/billing_account/payment_histories',
@@ -777,6 +810,29 @@ export const OPERATIONS = {
777
810
  },
778
811
  listPredefinedChoicesSets: { method: 'GET', path: '/predefined_choices_sets', parameters: [] },
779
812
  listSmsAuditStatuses: { method: 'GET', path: '/sms/audit_statuses', parameters: [] },
813
+ listSmsSignatures: {
814
+ method: 'GET',
815
+ path: '/sms/signatures',
816
+ parameters: [
817
+ { name: 'status', in: 'query', schema: { type: 'string', enum: ['CHECKING', 'SUCCESS', 'FAIL'] } },
818
+ { name: 'limit', in: 'query', schema: { type: 'integer' } },
819
+ { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
820
+ { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
821
+ ]
822
+ },
823
+ listSmsTemplates: {
824
+ method: 'GET',
825
+ path: '/sms/templates',
826
+ parameters: [
827
+ { name: 'q', in: 'query', schema: { type: 'string' } },
828
+ { name: 'scope', in: 'query', schema: { type: 'string', enum: ['owned', 'shared'] } },
829
+ { name: 'signature_id', in: 'query', schema: { type: 'string' } },
830
+ { name: 'status', in: 'query', schema: { type: 'string', enum: ['CHECKING', 'SUCCESS', 'FAIL'] } },
831
+ { name: 'limit', in: 'query', schema: { type: 'integer' } },
832
+ { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
833
+ { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
834
+ ]
835
+ },
780
836
  listTableEntries: {
781
837
  method: 'GET',
782
838
  path: '/tables/{table_token}/entries',
@@ -1186,6 +1242,18 @@ export const OPERATIONS = {
1186
1242
  }
1187
1243
  }
1188
1244
  },
1245
+ updateSmsSignature: {
1246
+ method: 'PATCH',
1247
+ path: '/sms/signatures/{id}',
1248
+ parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
1249
+ body: { required: true, content: { 'application/json': { $ref: 'SMSSignatureUpdateInput' } } }
1250
+ },
1251
+ updateSmsTemplate: {
1252
+ method: 'PATCH',
1253
+ path: '/sms/templates/{id}',
1254
+ parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
1255
+ body: { required: true, content: { 'application/json': { $ref: 'SMSTemplateUpdateInput' } } }
1256
+ },
1189
1257
  updateTable: {
1190
1258
  method: 'PATCH',
1191
1259
  path: '/tables/{table_token}',
@@ -1305,6 +1373,22 @@ export const OPERATIONS = {
1305
1373
  }
1306
1374
  }
1307
1375
  },
1376
+ uploadUserLicenseAttachment: {
1377
+ method: 'POST',
1378
+ path: '/user/license_attachments',
1379
+ parameters: [],
1380
+ body: {
1381
+ required: true,
1382
+ content: {
1383
+ 'multipart/form-data': {
1384
+ type: 'object',
1385
+ required: ['file'],
1386
+ properties: { file: { type: 'string' } },
1387
+ additionalProperties: false
1388
+ }
1389
+ }
1390
+ }
1391
+ },
1308
1392
  verifyRedirectParams: {
1309
1393
  method: 'GET',
1310
1394
  path: '/jamr_v',
@@ -2574,12 +2658,12 @@ export const SCHEMAS = {
2574
2658
  },
2575
2659
  by_time_range_close_rule: {
2576
2660
  type: ['object', 'null'],
2577
- properties: { start_time: { type: 'string' }, end_time: { type: 'string' } },
2661
+ properties: { enabled: { type: 'boolean' }, start_time: { type: 'string' }, end_time: { type: 'string' } },
2578
2662
  additionalProperties: false
2579
2663
  },
2580
2664
  by_entries_close_rule: {
2581
2665
  type: ['object', 'null'],
2582
- properties: { limit: { type: 'integer' } },
2666
+ properties: { enabled: { type: 'boolean' }, limit: { type: 'integer' } },
2583
2667
  additionalProperties: false
2584
2668
  },
2585
2669
  fill_frequency: {
@@ -3753,6 +3837,67 @@ export const SCHEMAS = {
3753
3837
  }
3754
3838
  }
3755
3839
  },
3840
+ SMSSignatureCreateInput: {
3841
+ type: 'object',
3842
+ required: [
3843
+ 'signature',
3844
+ 'license_attachment_ids',
3845
+ 'company_name',
3846
+ 'company_id',
3847
+ 'id_card_front_attachment_id',
3848
+ 'id_card_back_attachment_id',
3849
+ 'id_card_name',
3850
+ 'id_card_number',
3851
+ 'identity_mobile'
3852
+ ],
3853
+ properties: {
3854
+ signature: { type: 'string', minLength: 2, maxLength: 20 },
3855
+ type: { type: 'string', enum: ['notification', 'verification'] },
3856
+ company_name: { type: 'string', minLength: 1 },
3857
+ company_id: { type: 'string', minLength: 1 },
3858
+ license_attachment_ids: { type: 'array', minItems: 1, items: { type: 'string' } },
3859
+ id_card_front_attachment_id: { type: 'string' },
3860
+ id_card_back_attachment_id: { type: 'string' },
3861
+ id_card_name: { type: 'string' },
3862
+ id_card_number: { type: 'string' },
3863
+ identity_mobile: { type: 'string' }
3864
+ },
3865
+ additionalProperties: false
3866
+ },
3867
+ SMSSignatureUpdateInput: {
3868
+ type: 'object',
3869
+ properties: {
3870
+ signature: { type: 'string', minLength: 2, maxLength: 20 },
3871
+ company_name: { type: 'string', minLength: 1 },
3872
+ company_id: { type: 'string', minLength: 1 },
3873
+ license_attachment_ids: { type: 'array', minItems: 1, items: { type: 'string' } },
3874
+ id_card_front_attachment_id: { type: 'string' },
3875
+ id_card_back_attachment_id: { type: 'string' },
3876
+ id_card_name: { type: 'string' },
3877
+ id_card_number: { type: 'string' },
3878
+ identity_mobile: { type: 'string' }
3879
+ },
3880
+ additionalProperties: false
3881
+ },
3882
+ SMSTemplateCreateInput: {
3883
+ type: 'object',
3884
+ required: ['signature', 'content'],
3885
+ properties: {
3886
+ signature: { type: 'string' },
3887
+ content: { type: 'string' },
3888
+ apply_description: { type: 'string', maxLength: 200 }
3889
+ },
3890
+ additionalProperties: false
3891
+ },
3892
+ SMSTemplateUpdateInput: {
3893
+ type: 'object',
3894
+ properties: {
3895
+ signature: { type: 'string' },
3896
+ content: { type: 'string' },
3897
+ apply_description: { type: 'string', maxLength: 200 }
3898
+ },
3899
+ additionalProperties: false
3900
+ },
3756
3901
  ScopeCondition: {
3757
3902
  type: 'object',
3758
3903
  required: ['operator'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinshuju/cli",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Command line interface for Jinshuju Open API v1",
5
5
  "homepage": "https://github.com/jinshuju/cli#readme",
6
6
  "bugs": {