@verdocs/js-sdk 2.0.17 → 2.0.20

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.
@@ -93,7 +93,9 @@ export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActi
93
93
  */
94
94
  export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
95
95
  /**
96
- * Get (binary download) a file attached to a Document.
96
+ * Get (binary download) a file attached to a Document. It is important to use this method
97
+ * rather than a direct A HREF or similar link to set the authorization headers for the
98
+ * request.
97
99
  */
98
100
  export declare const getDocumentFile: (endpoint: VerdocsEndpoint, documentId: string, envelopeDocumentId: string) => Promise<string>;
99
101
  /**
@@ -174,7 +174,9 @@ export var userCanAct = function (email, recipientsWithActions) {
174
174
  return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);
175
175
  };
176
176
  /**
177
- * Get (binary download) a file attached to a Document.
177
+ * Get (binary download) a file attached to a Document. It is important to use this method
178
+ * rather than a direct A HREF or similar link to set the authorization headers for the
179
+ * request.
178
180
  */
179
181
  export var getDocumentFile = function (endpoint, documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
180
182
  return __generator(this, function (_a) {
@@ -45,3 +45,15 @@ export declare const getTemplateDocument: (endpoint: VerdocsEndpoint, templateId
45
45
  * ```
46
46
  */
47
47
  export declare const deleteTemplateDocument: (endpoint: VerdocsEndpoint, templateId: string, documentId: string) => Promise<any>;
48
+ /**
49
+ * Get (binary download) a file attached to a Template. It is important to use this method
50
+ * rather than a direct A HREF or similar link to set the authorization headers for the
51
+ * request.
52
+ */
53
+ export declare const getTemplateDocumentFile: (endpoint: VerdocsEndpoint, templateId: string, documentId: string) => Promise<string>;
54
+ /**
55
+ * Get (binary download) a file attached to a Template. It is important to use this method
56
+ * rather than a direct A HREF or similar link to set the authorization headers for the
57
+ * request.
58
+ */
59
+ export declare const getTemplateDocumentThumbnail: (endpoint: VerdocsEndpoint, templateId: string, documentId: string) => Promise<string>;
@@ -3,6 +3,42 @@
3
3
  *
4
4
  * @module
5
5
  */
6
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ });
14
+ };
15
+ var __generator = (this && this.__generator) || function (thisArg, body) {
16
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
17
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
18
+ function verb(n) { return function (v) { return step([n, v]); }; }
19
+ function step(op) {
20
+ if (f) throw new TypeError("Generator is already executing.");
21
+ while (_) try {
22
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
23
+ if (y = 0, t) op = [op[0] & 2, t.value];
24
+ switch (op[0]) {
25
+ case 0: case 1: t = op; break;
26
+ case 4: _.label++; return { value: op[1], done: false };
27
+ case 5: _.label++; y = op[1]; op = [0]; continue;
28
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
29
+ default:
30
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
31
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
32
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
34
+ if (t[2]) _.ops.pop();
35
+ _.trys.pop(); continue;
36
+ }
37
+ op = body.call(thisArg, _);
38
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
39
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
40
+ }
41
+ };
6
42
  /**
7
43
  * Get all the Template Documents associated to a particular Template.
8
44
  *
@@ -59,3 +95,31 @@ export var deleteTemplateDocument = function (endpoint, templateId, documentId)
59
95
  .delete("/templates/".concat(templateId, "/documents/").concat(documentId))
60
96
  .then(function (r) { return r.data; });
61
97
  };
98
+ /**
99
+ * Get (binary download) a file attached to a Template. It is important to use this method
100
+ * rather than a direct A HREF or similar link to set the authorization headers for the
101
+ * request.
102
+ */
103
+ export var getTemplateDocumentFile = function (endpoint, templateId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
104
+ return __generator(this, function (_a) {
105
+ return [2 /*return*/, endpoint.api //
106
+ .get("/templates/".concat(templateId, "/documents/").concat(documentId, "?file=true"), {
107
+ responseType: 'arraybuffer',
108
+ })
109
+ .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
110
+ });
111
+ }); };
112
+ /**
113
+ * Get (binary download) a file attached to a Template. It is important to use this method
114
+ * rather than a direct A HREF or similar link to set the authorization headers for the
115
+ * request.
116
+ */
117
+ export var getTemplateDocumentThumbnail = function (endpoint, templateId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
118
+ return __generator(this, function (_a) {
119
+ return [2 /*return*/, endpoint.api //
120
+ .get("/templates/".concat(templateId, "/documents/").concat(documentId, "?thumbnail=true"), {
121
+ responseType: 'arraybuffer',
122
+ })
123
+ .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
124
+ });
125
+ }); };
@@ -54,7 +54,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
54
54
  */
55
55
  export var getTemplates = function (endpoint, params) {
56
56
  return endpoint.api //
57
- .get('/templates', { params: params })
57
+ .post('/templates', { params: params })
58
58
  .then(function (r) { return r.data; });
59
59
  };
60
60
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "2.0.17",
3
+ "version": "2.0.20",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",