@verdocs/js-sdk 3.10.6 → 3.10.8

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.
@@ -214,8 +214,9 @@ export interface ITimeRange {
214
214
  end: string;
215
215
  }
216
216
  export interface IListEnvelopesParams {
217
- status?: string[];
217
+ view?: 'inbox' | 'sent' | 'action' | 'waiting' | 'completed';
218
218
  q?: string;
219
+ status?: string[];
219
220
  created_at?: ITimeRange;
220
221
  is_owner?: boolean;
221
222
  sort_by?: 'name' | 'created_at' | 'updated_at' | 'canceled_at' | 'status';
@@ -230,7 +231,7 @@ export interface IListEnvelopesParams {
230
231
  * ```typescript
231
232
  * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
232
233
  *
233
- * await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created)at' });
234
+ * const {totals, envelopes} = await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' });
234
235
  * ```
235
236
  */
236
237
  export declare const listEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesParams) => Promise<{
@@ -333,7 +333,7 @@ export var throttledGetEnvelope = function (endpoint, envelopeId) {
333
333
  * ```typescript
334
334
  * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
335
335
  *
336
- * await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created)at' });
336
+ * const {totals, envelopes} = await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' });
337
337
  * ```
338
338
  */
339
339
  export var listEnvelopes = function (endpoint, params) {
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- import { IRole, ITemplate, ITemplateField, ITemplateOwnerInfo, ITemplateSummaries, ITemplateSummary, TTemplateSender } from './Types';
7
+ import { IRole, ITemplate, ITemplateField, ITemplateOwnerInfo, ITemplateSummary, TTemplateSender } from './Types';
8
8
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
9
9
  export interface IGetTemplatesParams {
10
10
  is_starred?: boolean;
@@ -24,15 +24,6 @@ export interface IGetTemplatesParams {
24
24
  * ```
25
25
  */
26
26
  export declare const getTemplates: (endpoint: VerdocsEndpoint, params?: IGetTemplatesParams) => Promise<ITemplate[]>;
27
- export interface IListTemplatesParams {
28
- name?: string;
29
- sharing?: 'all' | 'personal' | 'shared' | 'public';
30
- starred?: 'all' | 'starred' | 'unstarred';
31
- sort?: 'name' | 'created_at' | 'updated_at' | 'last_used_at' | 'counter' | 'star_counter';
32
- direction?: 'asc' | 'desc';
33
- page?: number;
34
- rows?: number;
35
- }
36
27
  /**
37
28
  * Lists all templates accessible by the caller, with optional filters.
38
29
  *
@@ -42,7 +33,6 @@ export interface IListTemplatesParams {
42
33
  * await Templates.listTemplates((VerdocsEndpoint.getDefault(), { sharing: 'personal', sort: 'last_used_at' });
43
34
  * ```
44
35
  */
45
- export declare const listTemplates: (endpoint: VerdocsEndpoint, params?: IListTemplatesParams) => Promise<ITemplateSummaries>;
46
36
  /**
47
37
  * Get one template by its ID.
48
38
  *
@@ -233,3 +223,28 @@ export declare const getSummary: (endpoint: VerdocsEndpoint, params?: IGetTempla
233
223
  * to avoid unnecessary repeat server calls.
234
224
  */
235
225
  export declare const throttledGetTemplate: (endpoint: VerdocsEndpoint, templateId: string) => ITemplate | Promise<ITemplate>;
226
+ export interface ITemplateListParams {
227
+ status?: string[];
228
+ q?: string;
229
+ created_at?: ITimePeriod;
230
+ is_personal?: boolean;
231
+ is_public?: boolean;
232
+ sort_by?: SortOptions;
233
+ ascending?: boolean;
234
+ rows?: number;
235
+ page?: number;
236
+ }
237
+ /**
238
+ * List templates.
239
+ *
240
+ * ```typescript
241
+ * import {Templates} from '@verdocs/js-sdk/Templates';
242
+ *
243
+ * const {totals, templates} = await Templates.listTemplates((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' }); * ```
244
+ */
245
+ export declare const listTemplates: (endpoint: VerdocsEndpoint, params?: ITemplateListParams) => Promise<{
246
+ total: number;
247
+ rows: number;
248
+ page: number;
249
+ templates: ITemplate[];
250
+ }>;
@@ -57,6 +57,15 @@ export var getTemplates = function (endpoint, params) {
57
57
  .post('/templates', { params: params })
58
58
  .then(function (r) { return r.data; });
59
59
  };
60
+ // export interface IListTemplatesParams {
61
+ // name?: string;
62
+ // sharing?: 'all' | 'personal' | 'shared' | 'public';
63
+ // starred?: 'all' | 'starred' | 'unstarred';
64
+ // sort?: 'name' | 'created_at' | 'updated_at' | 'last_used_at' | 'counter' | 'star_counter';
65
+ // direction?: 'asc' | 'desc';
66
+ // page?: number;
67
+ // rows?: number;
68
+ // }
60
69
  /**
61
70
  * Lists all templates accessible by the caller, with optional filters.
62
71
  *
@@ -66,11 +75,10 @@ export var getTemplates = function (endpoint, params) {
66
75
  * await Templates.listTemplates((VerdocsEndpoint.getDefault(), { sharing: 'personal', sort: 'last_used_at' });
67
76
  * ```
68
77
  */
69
- export var listTemplates = function (endpoint, params) {
70
- return endpoint.api //
71
- .post('/templates/list', params, { baseURL: endpoint.getBaseURLv2() })
72
- .then(function (r) { return r.data; });
73
- };
78
+ // export const listTemplates = (endpoint: VerdocsEndpoint, params?: IListTemplatesParams) =>
79
+ // endpoint.api //
80
+ // .post<ITemplateSummaries>('/templates/list', params, {baseURL: endpoint.getBaseURLv2()})
81
+ // .then((r) => r.data);
74
82
  /**
75
83
  * Get one template by its ID.
76
84
  *
@@ -232,3 +240,21 @@ export var throttledGetTemplate = function (endpoint, templateId) {
232
240
  return template;
233
241
  });
234
242
  };
243
+ /**
244
+ * List templates.
245
+ *
246
+ * ```typescript
247
+ * import {Templates} from '@verdocs/js-sdk/Templates';
248
+ *
249
+ * const {totals, templates} = await Templates.listTemplates((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' }); * ```
250
+ */
251
+ export var listTemplates = function (endpoint, params) {
252
+ if (params === void 0) { params = {}; }
253
+ return __awaiter(void 0, void 0, void 0, function () {
254
+ return __generator(this, function (_a) {
255
+ return [2 /*return*/, endpoint.api //
256
+ .post('/templates/list', params)
257
+ .then(function (r) { return r.data; })];
258
+ });
259
+ });
260
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "3.10.6",
3
+ "version": "3.10.8",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",