@verdocs/js-sdk 3.10.5 → 3.10.7

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.
@@ -230,7 +230,12 @@ export interface IListEnvelopesParams {
230
230
  * ```typescript
231
231
  * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
232
232
  *
233
- * await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created)at' });
233
+ * const {totals, envelopes} = await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' });
234
234
  * ```
235
235
  */
236
- export declare const listEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesParams) => Promise<IEnvelope[]>;
236
+ export declare const listEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesParams) => Promise<{
237
+ total: number;
238
+ rows: number;
239
+ page: number;
240
+ envelopes: IEnvelope[];
241
+ }>;
@@ -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
  *
@@ -151,7 +141,7 @@ export interface ITimePeriod {
151
141
  start_time: string;
152
142
  end_time: string;
153
143
  }
154
- declare enum SortOptions {
144
+ export declare enum SortOptions {
155
145
  CREATED_AT = "created_at",
156
146
  UPDATED_AT = "updated_at",
157
147
  NAME = "name",
@@ -233,4 +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>;
236
- export {};
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
  *
@@ -173,7 +181,7 @@ export var deleteTemplate = function (endpoint, templateId) {
173
181
  .delete("/templates/".concat(templateId))
174
182
  .then(function (r) { return r.data; });
175
183
  };
176
- var SortOptions;
184
+ export var SortOptions;
177
185
  (function (SortOptions) {
178
186
  SortOptions["CREATED_AT"] = "created_at";
179
187
  SortOptions["UPDATED_AT"] = "updated_at";
@@ -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.5",
3
+ "version": "3.10.7",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",