docspring 4.0.0 → 4.1.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 +10 -1
- package/dist/ApiClient.js +2 -2
- package/dist/RequestSchemas.js +1171 -16
- package/dist/api/Client.js +474 -24
- package/dist/index.js +196 -0
- package/dist/model/AddTemplateFieldsRequest.js +132 -0
- package/dist/model/AuthenticationCheck.js +1 -1
- package/dist/model/CombinedPdf.js +1 -1
- package/dist/model/CombinedPdfFiles.js +1 -1
- package/dist/model/CombinedPdfList.js +1 -1
- package/dist/model/CombinedPdfSource.js +1 -1
- package/dist/model/CombinedPdfSourceInput.js +1 -1
- package/dist/model/CombinedPdfSourcePdf.js +1 -1
- package/dist/model/CopyTemplateRequest.js +1 -1
- package/dist/model/CreateCombinedPdfRequest.js +1 -1
- package/dist/model/CreateCustomFileFromUploadRequest.js +1 -1
- package/dist/model/CreateFolderRequest.js +1 -1
- package/dist/model/CreateSignatureRequestEventRequest.js +1 -1
- package/dist/model/CreateSignatureRequestTokenRequest.js +1 -1
- package/dist/model/CreateSubmissionBatchRequest.js +15 -1
- package/dist/model/CreateSubmissionRequest.js +15 -1
- package/dist/model/CreateTemplateRequest.js +71 -3
- package/dist/model/CreateWebhookRequest.js +1 -1
- package/dist/model/CustomFile.js +1 -1
- package/dist/model/CustomFileList.js +1 -1
- package/dist/model/CustomFileSourcePdf.js +1 -1
- package/dist/model/ErrorDetail.js +1 -1
- package/dist/model/ErrorInfo.js +1 -1
- package/dist/model/ErrorResponse.js +1 -1
- package/dist/model/Field.js +1230 -0
- package/dist/model/FieldComparisonCondition.js +1 -1
- package/dist/model/FieldDependency.js +154 -0
- package/dist/model/FieldDependencyInput.js +154 -0
- package/dist/model/FieldEqualsCondition.js +1 -1
- package/dist/model/FieldGroup.js +206 -0
- package/dist/model/FieldGroupInput.js +180 -0
- package/dist/model/FieldGroupType.js +59 -0
- package/dist/model/FieldInCondition.js +1 -1
- package/dist/model/FieldInput.js +1012 -0
- package/dist/model/FieldOverride.js +1 -1
- package/dist/model/FieldPresenceCondition.js +1 -1
- package/dist/model/FieldRangeCondition.js +1 -1
- package/dist/model/FieldType.js +124 -0
- package/dist/model/Folder.js +1 -1
- package/dist/model/FolderList.js +1 -1
- package/dist/model/GenerateFilesFormat.js +54 -0
- package/dist/model/GenerateSubmissionFilesRequest.js +115 -0
- package/dist/model/GeneratedFile.js +1 -1
- package/dist/model/HtmlEngineOptions.js +1 -1
- package/dist/model/HtmlEngineOptionsInput.js +1 -1
- package/dist/model/MoveFolderRequest.js +1 -1
- package/dist/model/MoveTemplateRequest.js +1 -1
- package/dist/model/OutputFormat.js +59 -0
- package/dist/model/PageImage.js +220 -0
- package/dist/model/PageImages.js +155 -0
- package/dist/model/PredefinedField.js +183 -0
- package/dist/model/PredefinedFieldInput.js +183 -0
- package/dist/model/PublishTemplateVersionRequest.js +1 -1
- package/dist/model/RemoveTemplateFieldsRequest.js +114 -0
- package/dist/model/RenameFolderRequest.js +1 -1
- package/dist/model/ReorderTemplateFieldsRequest.js +114 -0
- package/dist/model/RestoreTemplateVersionRequest.js +1 -1
- package/dist/model/SignatureRequest.js +1 -1
- package/dist/model/SignatureRequestEvent.js +1 -1
- package/dist/model/SignatureRequestInput.js +1 -1
- package/dist/model/SignatureRequestToken.js +1 -1
- package/dist/model/Submission.js +23 -7
- package/dist/model/SubmissionAction.js +1 -1
- package/dist/model/SubmissionBatch.js +1 -1
- package/dist/model/SubmissionFiles.js +10 -1
- package/dist/model/SubmissionInput.js +15 -1
- package/dist/model/SubmissionList.js +1 -1
- package/dist/model/SubmissionSourcePdf.js +1 -1
- package/dist/model/SubmissionValidation.js +151 -0
- package/dist/model/Template.js +67 -5
- package/dist/model/TemplateActor.js +1 -1
- package/dist/model/TemplateDefaults.js +1 -1
- package/dist/model/TemplateDefaultsInput.js +1 -1
- package/dist/model/TemplateDiff.js +206 -0
- package/dist/model/TemplateDiffSummary.js +165 -0
- package/dist/model/TemplateDocument.js +7 -7
- package/dist/model/TemplateDocumentState.js +11 -1
- package/dist/model/TemplateFieldChange.js +146 -0
- package/dist/model/TemplateFieldChanges.js +196 -0
- package/dist/model/TemplateFieldDependency.js +3 -3
- package/dist/model/TemplateFieldDependencyCondition.js +1 -1
- package/dist/model/TemplateFieldDependencyConditionInput.js +1 -1
- package/dist/model/TemplateFieldDependencyInput.js +3 -3
- package/dist/model/TemplateFieldMove.js +132 -0
- package/dist/model/TemplateFields.js +147 -0
- package/dist/model/TemplateModelCode.js +1 -1
- package/dist/model/TemplatePageImages.js +158 -0
- package/dist/model/TemplatePageProcessingStatus.js +1 -1
- package/dist/model/TemplateSourcePdf.js +1 -1
- package/dist/model/TemplateSummary.js +1 -1
- package/dist/model/TemplateSummaryList.js +1 -1
- package/dist/model/TemplateVersion.js +1 -1
- package/dist/model/UpdateSignatureRequestRequest.js +1 -1
- package/dist/model/UpdateTemplateDocumentRequest.js +33 -30
- package/dist/model/UpdateTemplateFieldsRequest.js +132 -0
- package/dist/model/UpdateTemplateRequest.js +74 -1
- package/dist/model/UpdateWebhookRequest.js +1 -1
- package/dist/model/UploadPresign.js +1 -1
- package/dist/model/UrlSourcePdf.js +1 -1
- package/dist/model/ValidateSubmissionRequest.js +226 -0
- package/dist/model/Webhook.js +1 -1
- package/dist/model/WebhookList.js +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
|
|
8
8
|
var _FieldOverride = _interopRequireDefault(require("./FieldOverride"));
|
|
9
|
+
var _OutputFormat = _interopRequireDefault(require("./OutputFormat"));
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
11
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
12
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -27,7 +28,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
27
28
|
/**
|
|
28
29
|
* The SubmissionInput model module.
|
|
29
30
|
* @module model/SubmissionInput
|
|
30
|
-
* @version 4.
|
|
31
|
+
* @version 4.1.0
|
|
31
32
|
*/
|
|
32
33
|
var SubmissionInput = /*#__PURE__*/function () {
|
|
33
34
|
/**
|
|
@@ -80,6 +81,9 @@ var SubmissionInput = /*#__PURE__*/function () {
|
|
|
80
81
|
if (data.hasOwnProperty('password')) {
|
|
81
82
|
obj['password'] = _ApiClient["default"].convertToType(data['password'], 'String');
|
|
82
83
|
}
|
|
84
|
+
if (data.hasOwnProperty('output_formats')) {
|
|
85
|
+
obj['output_formats'] = _ApiClient["default"].convertToType(data['output_formats'], [_OutputFormat["default"]]);
|
|
86
|
+
}
|
|
83
87
|
if (data.hasOwnProperty('expires_in')) {
|
|
84
88
|
obj['expires_in'] = _ApiClient["default"].convertToType(data['expires_in'], 'Number');
|
|
85
89
|
}
|
|
@@ -116,6 +120,10 @@ var SubmissionInput = /*#__PURE__*/function () {
|
|
|
116
120
|
if (data['password'] && !(typeof data['password'] === 'string' || data['password'] instanceof String)) {
|
|
117
121
|
throw new Error("Expected the field `password` to be a primitive type in the JSON string but got " + data['password']);
|
|
118
122
|
}
|
|
123
|
+
// ensure the json data is an array
|
|
124
|
+
if (!Array.isArray(data['output_formats'])) {
|
|
125
|
+
throw new Error("Expected the field `output_formats` to be an array in the JSON data but got " + data['output_formats']);
|
|
126
|
+
}
|
|
119
127
|
// ensure the json data is a string
|
|
120
128
|
if (data['html'] && !(typeof data['html'] === 'string' || data['html'] instanceof String)) {
|
|
121
129
|
throw new Error("Expected the field `html` to be a primitive type in the JSON string but got " + data['html']);
|
|
@@ -166,6 +174,12 @@ SubmissionInput.prototype['metadata'] = undefined;
|
|
|
166
174
|
*/
|
|
167
175
|
SubmissionInput.prototype['password'] = undefined;
|
|
168
176
|
|
|
177
|
+
/**
|
|
178
|
+
* What the submission makes: `pdf`, and `png` (an image of each page of the PDF, up to 100 pages) when you ask for it. Default `["pdf"]`. POST /submissions/{submission_id}/generate_files adds `png` to a processed submission.
|
|
179
|
+
* @member {Array.<module:model/OutputFormat>} output_formats
|
|
180
|
+
*/
|
|
181
|
+
SubmissionInput.prototype['output_formats'] = undefined;
|
|
182
|
+
|
|
169
183
|
/**
|
|
170
184
|
* Seconds after the PDF is generated until the submission expires, up to 10 years (315360000). Default the template's expiration setting. A submission that isn't processed, such as one with invalid data, is kept for at least 48 hours.
|
|
171
185
|
* @member {Number} expires_in
|
|
@@ -30,7 +30,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
30
30
|
/**
|
|
31
31
|
* The SubmissionList model module.
|
|
32
32
|
* @module model/SubmissionList
|
|
33
|
-
* @version 4.
|
|
33
|
+
* @version 4.1.0
|
|
34
34
|
*/
|
|
35
35
|
var SubmissionList = /*#__PURE__*/function () {
|
|
36
36
|
/**
|
|
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
29
29
|
/**
|
|
30
30
|
* The SubmissionSourcePdf model module.
|
|
31
31
|
* @module model/SubmissionSourcePdf
|
|
32
|
-
* @version 4.
|
|
32
|
+
* @version 4.1.0
|
|
33
33
|
*/
|
|
34
34
|
var SubmissionSourcePdf = /*#__PURE__*/function () {
|
|
35
35
|
/**
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
|
|
8
|
+
var _ErrorInfo = _interopRequireDefault(require("./ErrorInfo"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); } /**
|
|
19
|
+
* DocSpring API
|
|
20
|
+
* Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
21
|
+
*
|
|
22
|
+
* The version of the OpenAPI document: v2
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
26
|
+
* https://openapi-generator.tech
|
|
27
|
+
* Do not edit the class manually.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* The SubmissionValidation model module.
|
|
32
|
+
* @module model/SubmissionValidation
|
|
33
|
+
* @version 4.1.0
|
|
34
|
+
*/
|
|
35
|
+
var SubmissionValidation = /*#__PURE__*/function () {
|
|
36
|
+
/**
|
|
37
|
+
* Constructs a new <code>SubmissionValidation</code>.
|
|
38
|
+
* Whether creating the submission would succeed, checked without saving it or making any files. `error` is the error that creating it would return (`validation_failed`, or `invalid_data` for data that doesn't match the template's fields), and is left out when `valid` is true.
|
|
39
|
+
* @alias module:model/SubmissionValidation
|
|
40
|
+
* @extends Object
|
|
41
|
+
* @param valid {Boolean} True when creating the submission would succeed.
|
|
42
|
+
* @param template_id {String} The template's ID.
|
|
43
|
+
* @param template_version {String} The published version the request was checked against, such as `1.2.0`. Null for the draft.
|
|
44
|
+
*/
|
|
45
|
+
function SubmissionValidation(valid, template_id, template_version) {
|
|
46
|
+
_classCallCheck(this, SubmissionValidation);
|
|
47
|
+
SubmissionValidation.initialize(this, valid, template_id, template_version);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Initializes the fields of this object.
|
|
52
|
+
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
|
53
|
+
* Only for internal use.
|
|
54
|
+
*/
|
|
55
|
+
return _createClass(SubmissionValidation, null, [{
|
|
56
|
+
key: "initialize",
|
|
57
|
+
value: function initialize(obj, valid, template_id, template_version) {
|
|
58
|
+
obj['valid'] = valid;
|
|
59
|
+
obj['template_id'] = template_id;
|
|
60
|
+
obj['template_version'] = template_version;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Constructs a <code>SubmissionValidation</code> from a plain JavaScript object, optionally creating a new instance.
|
|
65
|
+
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
|
66
|
+
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
|
67
|
+
* @param {module:model/SubmissionValidation} obj Optional instance to populate.
|
|
68
|
+
* @return {module:model/SubmissionValidation} The populated <code>SubmissionValidation</code> instance.
|
|
69
|
+
*/
|
|
70
|
+
}, {
|
|
71
|
+
key: "constructFromObject",
|
|
72
|
+
value: function constructFromObject(data, obj) {
|
|
73
|
+
if (data) {
|
|
74
|
+
obj = obj || new SubmissionValidation();
|
|
75
|
+
_ApiClient["default"].constructFromObject(data, obj, 'Object');
|
|
76
|
+
if (data.hasOwnProperty('valid')) {
|
|
77
|
+
obj['valid'] = _ApiClient["default"].convertToType(data['valid'], 'Boolean');
|
|
78
|
+
}
|
|
79
|
+
if (data.hasOwnProperty('template_id')) {
|
|
80
|
+
obj['template_id'] = _ApiClient["default"].convertToType(data['template_id'], 'String');
|
|
81
|
+
}
|
|
82
|
+
if (data.hasOwnProperty('template_version')) {
|
|
83
|
+
obj['template_version'] = _ApiClient["default"].convertToType(data['template_version'], 'String');
|
|
84
|
+
}
|
|
85
|
+
if (data.hasOwnProperty('error')) {
|
|
86
|
+
obj['error'] = data['error'] === null ? null : _ErrorInfo["default"].constructFromObject(data['error']);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return obj;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Validates the JSON data with respect to <code>SubmissionValidation</code>.
|
|
94
|
+
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
|
95
|
+
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>SubmissionValidation</code>.
|
|
96
|
+
*/
|
|
97
|
+
}, {
|
|
98
|
+
key: "validateJSON",
|
|
99
|
+
value: function validateJSON(data) {
|
|
100
|
+
// check to make sure all required properties are present in the JSON string
|
|
101
|
+
var _iterator = _createForOfIteratorHelper(SubmissionValidation.RequiredProperties),
|
|
102
|
+
_step;
|
|
103
|
+
try {
|
|
104
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
105
|
+
var property = _step.value;
|
|
106
|
+
if (!data.hasOwnProperty(property)) {
|
|
107
|
+
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// ensure the json data is a string
|
|
111
|
+
} catch (err) {
|
|
112
|
+
_iterator.e(err);
|
|
113
|
+
} finally {
|
|
114
|
+
_iterator.f();
|
|
115
|
+
}
|
|
116
|
+
if (data['template_id'] && !(typeof data['template_id'] === 'string' || data['template_id'] instanceof String)) {
|
|
117
|
+
throw new Error("Expected the field `template_id` to be a primitive type in the JSON string but got " + data['template_id']);
|
|
118
|
+
}
|
|
119
|
+
// ensure the json data is a string
|
|
120
|
+
if (data['template_version'] && !(typeof data['template_version'] === 'string' || data['template_version'] instanceof String)) {
|
|
121
|
+
throw new Error("Expected the field `template_version` to be a primitive type in the JSON string but got " + data['template_version']);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}]);
|
|
126
|
+
}();
|
|
127
|
+
SubmissionValidation.RequiredProperties = ["valid", "template_id", "template_version"];
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* True when creating the submission would succeed.
|
|
131
|
+
* @member {Boolean} valid
|
|
132
|
+
*/
|
|
133
|
+
SubmissionValidation.prototype['valid'] = undefined;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The template's ID.
|
|
137
|
+
* @member {String} template_id
|
|
138
|
+
*/
|
|
139
|
+
SubmissionValidation.prototype['template_id'] = undefined;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The published version the request was checked against, such as `1.2.0`. Null for the draft.
|
|
143
|
+
* @member {String} template_version
|
|
144
|
+
*/
|
|
145
|
+
SubmissionValidation.prototype['template_version'] = undefined;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @member {module:model/ErrorInfo} error
|
|
149
|
+
*/
|
|
150
|
+
SubmissionValidation.prototype['error'] = undefined;
|
|
151
|
+
var _default = exports["default"] = SubmissionValidation;
|
package/dist/model/Template.js
CHANGED
|
@@ -7,7 +7,9 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
|
|
8
8
|
var _AiFieldNamingLanguage = _interopRequireDefault(require("./AiFieldNamingLanguage"));
|
|
9
9
|
var _ExpirationInterval = _interopRequireDefault(require("./ExpirationInterval"));
|
|
10
|
+
var _FieldGroup = _interopRequireDefault(require("./FieldGroup"));
|
|
10
11
|
var _HtmlEngineOptions = _interopRequireDefault(require("./HtmlEngineOptions"));
|
|
12
|
+
var _PredefinedField = _interopRequireDefault(require("./PredefinedField"));
|
|
11
13
|
var _TemplateActor = _interopRequireDefault(require("./TemplateActor"));
|
|
12
14
|
var _TemplateDefaults = _interopRequireDefault(require("./TemplateDefaults"));
|
|
13
15
|
var _TemplateDocument = _interopRequireDefault(require("./TemplateDocument"));
|
|
@@ -39,7 +41,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
39
41
|
/**
|
|
40
42
|
* The Template model module.
|
|
41
43
|
* @module model/Template
|
|
42
|
-
* @version 4.
|
|
44
|
+
* @version 4.1.0
|
|
43
45
|
*/
|
|
44
46
|
var Template = /*#__PURE__*/function () {
|
|
45
47
|
/**
|
|
@@ -86,6 +88,9 @@ var Template = /*#__PURE__*/function () {
|
|
|
86
88
|
* @param updated_at {Date} When the template was last updated.
|
|
87
89
|
* @param defaults {module:model/TemplateDefaults}
|
|
88
90
|
* @param field_dependencies {Array.<module:model/TemplateFieldDependency>} Conditional logic: each rule shows or hides its target fields, or makes them required, depending on the values of other fields.
|
|
91
|
+
* @param field_groups {Array.<module:model/FieldGroup>} The groups of the template's fields, with their settings. A field's name puts it in groups: `address/city` is in the group `address`, and `items/0/price` is in the list `items` and its items' group `items/~`.
|
|
92
|
+
* @param predefined_fields {Array.<module:model/PredefinedField>} The field names that people using the embedded template editor choose from, each with the data type and settings a field gets when it's given that name. Setting it replaces the whole list; an empty list turns them off.
|
|
93
|
+
* @param predefined_fields_sample_data {Object.<String, Object>} Sample submission data that sets `predefined_fields`: each value becomes a predefined field, with a type that fits it (`string`, `number`, `boolean`, `date`, `email` or `url`) and `required_in_template` true. Nested objects and arrays become names with `/`, such as `customer/email`. Without `predefined_fields` in the same request, it replaces them; with them, it adds to them and sets the types of the ones it has values for.
|
|
89
94
|
* @param html {String} The HTML of an HTML template, as a Liquid template. Null for PDF templates.
|
|
90
95
|
* @param scss {String} The SCSS of an HTML template.
|
|
91
96
|
* @param header_html {String} The HTML printed at the top of each page of an HTML template.
|
|
@@ -94,9 +99,9 @@ var Template = /*#__PURE__*/function () {
|
|
|
94
99
|
* @param embed_edit_token {String} The token that opens the template in the embedded template editor.
|
|
95
100
|
* @param versions {Array.<module:model/TemplateVersion>} The template's published versions, newest first (up to 100).
|
|
96
101
|
*/
|
|
97
|
-
function Template(id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions) {
|
|
102
|
+
function Template(id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions) {
|
|
98
103
|
_classCallCheck(this, Template);
|
|
99
|
-
Template.initialize(this, id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions);
|
|
104
|
+
Template.initialize(this, id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions);
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
/**
|
|
@@ -106,7 +111,7 @@ var Template = /*#__PURE__*/function () {
|
|
|
106
111
|
*/
|
|
107
112
|
return _createClass(Template, null, [{
|
|
108
113
|
key: "initialize",
|
|
109
|
-
value: function initialize(obj, id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions) {
|
|
114
|
+
value: function initialize(obj, id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions) {
|
|
110
115
|
obj['id'] = id;
|
|
111
116
|
obj['name'] = name;
|
|
112
117
|
obj['description'] = description;
|
|
@@ -146,6 +151,9 @@ var Template = /*#__PURE__*/function () {
|
|
|
146
151
|
obj['updated_at'] = updated_at;
|
|
147
152
|
obj['defaults'] = defaults;
|
|
148
153
|
obj['field_dependencies'] = field_dependencies;
|
|
154
|
+
obj['field_groups'] = field_groups;
|
|
155
|
+
obj['predefined_fields'] = predefined_fields;
|
|
156
|
+
obj['predefined_fields_sample_data'] = predefined_fields_sample_data;
|
|
149
157
|
obj['html'] = html;
|
|
150
158
|
obj['scss'] = scss;
|
|
151
159
|
obj['header_html'] = header_html;
|
|
@@ -285,6 +293,17 @@ var Template = /*#__PURE__*/function () {
|
|
|
285
293
|
if (data.hasOwnProperty('field_dependencies')) {
|
|
286
294
|
obj['field_dependencies'] = _ApiClient["default"].convertToType(data['field_dependencies'], [_TemplateFieldDependency["default"]]);
|
|
287
295
|
}
|
|
296
|
+
if (data.hasOwnProperty('field_groups')) {
|
|
297
|
+
obj['field_groups'] = _ApiClient["default"].convertToType(data['field_groups'], [_FieldGroup["default"]]);
|
|
298
|
+
}
|
|
299
|
+
if (data.hasOwnProperty('predefined_fields')) {
|
|
300
|
+
obj['predefined_fields'] = _ApiClient["default"].convertToType(data['predefined_fields'], [_PredefinedField["default"]]);
|
|
301
|
+
}
|
|
302
|
+
if (data.hasOwnProperty('predefined_fields_sample_data')) {
|
|
303
|
+
obj['predefined_fields_sample_data'] = _ApiClient["default"].convertToType(data['predefined_fields_sample_data'], {
|
|
304
|
+
'String': Object
|
|
305
|
+
});
|
|
306
|
+
}
|
|
288
307
|
if (data.hasOwnProperty('html')) {
|
|
289
308
|
obj['html'] = _ApiClient["default"].convertToType(data['html'], 'String');
|
|
290
309
|
}
|
|
@@ -383,6 +402,31 @@ var Template = /*#__PURE__*/function () {
|
|
|
383
402
|
if (!Array.isArray(data['field_dependencies'])) {
|
|
384
403
|
throw new Error("Expected the field `field_dependencies` to be an array in the JSON data but got " + data['field_dependencies']);
|
|
385
404
|
}
|
|
405
|
+
// ensure the json data is an array
|
|
406
|
+
if (!Array.isArray(data['field_groups'])) {
|
|
407
|
+
throw new Error("Expected the field `field_groups` to be an array in the JSON data but got " + data['field_groups']);
|
|
408
|
+
}
|
|
409
|
+
if (data['predefined_fields']) {
|
|
410
|
+
// data not null
|
|
411
|
+
// ensure the json data is an array
|
|
412
|
+
if (!Array.isArray(data['predefined_fields'])) {
|
|
413
|
+
throw new Error("Expected the field `predefined_fields` to be an array in the JSON data but got " + data['predefined_fields']);
|
|
414
|
+
}
|
|
415
|
+
// validate the optional field `predefined_fields` (array)
|
|
416
|
+
var _iterator2 = _createForOfIteratorHelper(data['predefined_fields']),
|
|
417
|
+
_step2;
|
|
418
|
+
try {
|
|
419
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
420
|
+
var item = _step2.value;
|
|
421
|
+
_PredefinedField["default"].validateJSON(item);
|
|
422
|
+
}
|
|
423
|
+
} catch (err) {
|
|
424
|
+
_iterator2.e(err);
|
|
425
|
+
} finally {
|
|
426
|
+
_iterator2.f();
|
|
427
|
+
}
|
|
428
|
+
;
|
|
429
|
+
}
|
|
386
430
|
// ensure the json data is a string
|
|
387
431
|
if (data['html'] && !(typeof data['html'] === 'string' || data['html'] instanceof String)) {
|
|
388
432
|
throw new Error("Expected the field `html` to be a primitive type in the JSON string but got " + data['html']);
|
|
@@ -416,7 +460,7 @@ var Template = /*#__PURE__*/function () {
|
|
|
416
460
|
}
|
|
417
461
|
}]);
|
|
418
462
|
}();
|
|
419
|
-
Template.RequiredProperties = ["id", "name", "description", "template_type", "ready", "document", "parent_folder_id", "path", "version", "latest_version", "version_published_at", "locked", "add_signature_request_submission_id_footers", "ai_field_naming_language", "allow_additional_properties", "allow_skipping_optional_fields", "default_form_mode", "editable_submissions", "embed_domains", "embed_edit_allow_settings", "embed_edit_allow_versioning", "embed_edit_allow_document_replacement", "encrypt_pdfs", "has_encrypt_pdfs_password", "expire_submissions", "expire_after", "expiration_interval", "merge_audit_trail_pdf", "parse_dates_using_template_date_format", "public_submissions", "public_web_form", "redirect_url", "has_slack_webhook_url", "last_changed_at", "last_changed_by", "created_at", "updated_at", "defaults", "field_dependencies", "html", "scss", "header_html", "footer_html", "html_engine_options", "embed_edit_token", "versions"];
|
|
463
|
+
Template.RequiredProperties = ["id", "name", "description", "template_type", "ready", "document", "parent_folder_id", "path", "version", "latest_version", "version_published_at", "locked", "add_signature_request_submission_id_footers", "ai_field_naming_language", "allow_additional_properties", "allow_skipping_optional_fields", "default_form_mode", "editable_submissions", "embed_domains", "embed_edit_allow_settings", "embed_edit_allow_versioning", "embed_edit_allow_document_replacement", "encrypt_pdfs", "has_encrypt_pdfs_password", "expire_submissions", "expire_after", "expiration_interval", "merge_audit_trail_pdf", "parse_dates_using_template_date_format", "public_submissions", "public_web_form", "redirect_url", "has_slack_webhook_url", "last_changed_at", "last_changed_by", "created_at", "updated_at", "defaults", "field_dependencies", "field_groups", "predefined_fields", "predefined_fields_sample_data", "html", "scss", "header_html", "footer_html", "html_engine_options", "embed_edit_token", "versions"];
|
|
420
464
|
|
|
421
465
|
/**
|
|
422
466
|
* The template's ID.
|
|
@@ -651,6 +695,24 @@ Template.prototype['defaults'] = undefined;
|
|
|
651
695
|
*/
|
|
652
696
|
Template.prototype['field_dependencies'] = undefined;
|
|
653
697
|
|
|
698
|
+
/**
|
|
699
|
+
* The groups of the template's fields, with their settings. A field's name puts it in groups: `address/city` is in the group `address`, and `items/0/price` is in the list `items` and its items' group `items/~`.
|
|
700
|
+
* @member {Array.<module:model/FieldGroup>} field_groups
|
|
701
|
+
*/
|
|
702
|
+
Template.prototype['field_groups'] = undefined;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* The field names that people using the embedded template editor choose from, each with the data type and settings a field gets when it's given that name. Setting it replaces the whole list; an empty list turns them off.
|
|
706
|
+
* @member {Array.<module:model/PredefinedField>} predefined_fields
|
|
707
|
+
*/
|
|
708
|
+
Template.prototype['predefined_fields'] = undefined;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Sample submission data that sets `predefined_fields`: each value becomes a predefined field, with a type that fits it (`string`, `number`, `boolean`, `date`, `email` or `url`) and `required_in_template` true. Nested objects and arrays become names with `/`, such as `customer/email`. Without `predefined_fields` in the same request, it replaces them; with them, it adds to them and sets the types of the ones it has values for.
|
|
712
|
+
* @member {Object.<String, Object>} predefined_fields_sample_data
|
|
713
|
+
*/
|
|
714
|
+
Template.prototype['predefined_fields_sample_data'] = undefined;
|
|
715
|
+
|
|
654
716
|
/**
|
|
655
717
|
* The HTML of an HTML template, as a Liquid template. Null for PDF templates.
|
|
656
718
|
* @member {String} html
|
|
@@ -30,7 +30,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
30
30
|
/**
|
|
31
31
|
* The TemplateActor model module.
|
|
32
32
|
* @module model/TemplateActor
|
|
33
|
-
* @version 4.
|
|
33
|
+
* @version 4.1.0
|
|
34
34
|
*/
|
|
35
35
|
var TemplateActor = /*#__PURE__*/function () {
|
|
36
36
|
/**
|
|
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
29
29
|
/**
|
|
30
30
|
* The TemplateDefaults model module.
|
|
31
31
|
* @module model/TemplateDefaults
|
|
32
|
-
* @version 4.
|
|
32
|
+
* @version 4.1.0
|
|
33
33
|
*/
|
|
34
34
|
var TemplateDefaults = /*#__PURE__*/function () {
|
|
35
35
|
/**
|
|
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
|
|
|
29
29
|
/**
|
|
30
30
|
* The TemplateDefaultsInput model module.
|
|
31
31
|
* @module model/TemplateDefaultsInput
|
|
32
|
-
* @version 4.
|
|
32
|
+
* @version 4.1.0
|
|
33
33
|
*/
|
|
34
34
|
var TemplateDefaultsInput = /*#__PURE__*/function () {
|
|
35
35
|
/**
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
|
|
8
|
+
var _TemplateDiffSummary = _interopRequireDefault(require("./TemplateDiffSummary"));
|
|
9
|
+
var _TemplateFieldChanges = _interopRequireDefault(require("./TemplateFieldChanges"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
17
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); } /**
|
|
20
|
+
* DocSpring API
|
|
21
|
+
* Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
22
|
+
*
|
|
23
|
+
* The version of the OpenAPI document: v2
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
27
|
+
* https://openapi-generator.tech
|
|
28
|
+
* Do not edit the class manually.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* The TemplateDiff model module.
|
|
33
|
+
* @module model/TemplateDiff
|
|
34
|
+
* @version 4.1.0
|
|
35
|
+
*/
|
|
36
|
+
var TemplateDiff = /*#__PURE__*/function () {
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a new <code>TemplateDiff</code>.
|
|
39
|
+
* What changed in a version of a template since the version before it: the draft since the latest published version, or a published version since the one before it. Fields are compared with all their settings, so `y` is measured from the top of each field's page.
|
|
40
|
+
* @alias module:model/TemplateDiff
|
|
41
|
+
* @extends Object
|
|
42
|
+
* @param template_id {String} The template's ID.
|
|
43
|
+
* @param from_version {String} The earlier version, such as `1.1.0`. Null when no version was published before `to_version`: it's compared with a new template, so all of its fields are added.
|
|
44
|
+
* @param to_version {String} The later version, such as `1.2.0`. Null for the draft.
|
|
45
|
+
* @param summary {module:model/TemplateDiffSummary} How many changes of each kind there are.
|
|
46
|
+
* @param fields {module:model/TemplateFieldChanges} The fields that changed.
|
|
47
|
+
* @param changed_settings {Array.<String>} The names of the template's settings that changed, as they're named on the Template (`name`, `html`, `defaults`, `expire_after`, ...). Values aren't included, and secrets like `encrypt_pdfs_password` are named when they change.
|
|
48
|
+
* @param document_changed {Boolean} The template's PDF was replaced (or added, when there's no `from_version`).
|
|
49
|
+
*/
|
|
50
|
+
function TemplateDiff(template_id, from_version, to_version, summary, fields, changed_settings, document_changed) {
|
|
51
|
+
_classCallCheck(this, TemplateDiff);
|
|
52
|
+
TemplateDiff.initialize(this, template_id, from_version, to_version, summary, fields, changed_settings, document_changed);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Initializes the fields of this object.
|
|
57
|
+
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
|
|
58
|
+
* Only for internal use.
|
|
59
|
+
*/
|
|
60
|
+
return _createClass(TemplateDiff, null, [{
|
|
61
|
+
key: "initialize",
|
|
62
|
+
value: function initialize(obj, template_id, from_version, to_version, summary, fields, changed_settings, document_changed) {
|
|
63
|
+
obj['template_id'] = template_id;
|
|
64
|
+
obj['from_version'] = from_version;
|
|
65
|
+
obj['to_version'] = to_version;
|
|
66
|
+
obj['summary'] = summary;
|
|
67
|
+
obj['fields'] = fields;
|
|
68
|
+
obj['changed_settings'] = changed_settings;
|
|
69
|
+
obj['document_changed'] = document_changed;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Constructs a <code>TemplateDiff</code> from a plain JavaScript object, optionally creating a new instance.
|
|
74
|
+
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
|
75
|
+
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
|
76
|
+
* @param {module:model/TemplateDiff} obj Optional instance to populate.
|
|
77
|
+
* @return {module:model/TemplateDiff} The populated <code>TemplateDiff</code> instance.
|
|
78
|
+
*/
|
|
79
|
+
}, {
|
|
80
|
+
key: "constructFromObject",
|
|
81
|
+
value: function constructFromObject(data, obj) {
|
|
82
|
+
if (data) {
|
|
83
|
+
obj = obj || new TemplateDiff();
|
|
84
|
+
_ApiClient["default"].constructFromObject(data, obj, 'Object');
|
|
85
|
+
if (data.hasOwnProperty('template_id')) {
|
|
86
|
+
obj['template_id'] = _ApiClient["default"].convertToType(data['template_id'], 'String');
|
|
87
|
+
}
|
|
88
|
+
if (data.hasOwnProperty('from_version')) {
|
|
89
|
+
obj['from_version'] = _ApiClient["default"].convertToType(data['from_version'], 'String');
|
|
90
|
+
}
|
|
91
|
+
if (data.hasOwnProperty('to_version')) {
|
|
92
|
+
obj['to_version'] = _ApiClient["default"].convertToType(data['to_version'], 'String');
|
|
93
|
+
}
|
|
94
|
+
if (data.hasOwnProperty('summary')) {
|
|
95
|
+
obj['summary'] = _ApiClient["default"].convertToType(data['summary'], _TemplateDiffSummary["default"]);
|
|
96
|
+
}
|
|
97
|
+
if (data.hasOwnProperty('fields')) {
|
|
98
|
+
obj['fields'] = _ApiClient["default"].convertToType(data['fields'], _TemplateFieldChanges["default"]);
|
|
99
|
+
}
|
|
100
|
+
if (data.hasOwnProperty('changed_settings')) {
|
|
101
|
+
obj['changed_settings'] = _ApiClient["default"].convertToType(data['changed_settings'], ['String']);
|
|
102
|
+
}
|
|
103
|
+
if (data.hasOwnProperty('document_changed')) {
|
|
104
|
+
obj['document_changed'] = _ApiClient["default"].convertToType(data['document_changed'], 'Boolean');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return obj;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Validates the JSON data with respect to <code>TemplateDiff</code>.
|
|
112
|
+
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
|
113
|
+
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>TemplateDiff</code>.
|
|
114
|
+
*/
|
|
115
|
+
}, {
|
|
116
|
+
key: "validateJSON",
|
|
117
|
+
value: function validateJSON(data) {
|
|
118
|
+
// check to make sure all required properties are present in the JSON string
|
|
119
|
+
var _iterator = _createForOfIteratorHelper(TemplateDiff.RequiredProperties),
|
|
120
|
+
_step;
|
|
121
|
+
try {
|
|
122
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
123
|
+
var property = _step.value;
|
|
124
|
+
if (!data.hasOwnProperty(property)) {
|
|
125
|
+
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// ensure the json data is a string
|
|
129
|
+
} catch (err) {
|
|
130
|
+
_iterator.e(err);
|
|
131
|
+
} finally {
|
|
132
|
+
_iterator.f();
|
|
133
|
+
}
|
|
134
|
+
if (data['template_id'] && !(typeof data['template_id'] === 'string' || data['template_id'] instanceof String)) {
|
|
135
|
+
throw new Error("Expected the field `template_id` to be a primitive type in the JSON string but got " + data['template_id']);
|
|
136
|
+
}
|
|
137
|
+
// ensure the json data is a string
|
|
138
|
+
if (data['from_version'] && !(typeof data['from_version'] === 'string' || data['from_version'] instanceof String)) {
|
|
139
|
+
throw new Error("Expected the field `from_version` to be a primitive type in the JSON string but got " + data['from_version']);
|
|
140
|
+
}
|
|
141
|
+
// ensure the json data is a string
|
|
142
|
+
if (data['to_version'] && !(typeof data['to_version'] === 'string' || data['to_version'] instanceof String)) {
|
|
143
|
+
throw new Error("Expected the field `to_version` to be a primitive type in the JSON string but got " + data['to_version']);
|
|
144
|
+
}
|
|
145
|
+
// validate the optional field `summary`
|
|
146
|
+
if (data['summary']) {
|
|
147
|
+
// data not null
|
|
148
|
+
_TemplateDiffSummary["default"].validateJSON(data['summary']);
|
|
149
|
+
}
|
|
150
|
+
// validate the optional field `fields`
|
|
151
|
+
if (data['fields']) {
|
|
152
|
+
// data not null
|
|
153
|
+
_TemplateFieldChanges["default"].validateJSON(data['fields']);
|
|
154
|
+
}
|
|
155
|
+
// ensure the json data is an array
|
|
156
|
+
if (!Array.isArray(data['changed_settings'])) {
|
|
157
|
+
throw new Error("Expected the field `changed_settings` to be an array in the JSON data but got " + data['changed_settings']);
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
}]);
|
|
162
|
+
}();
|
|
163
|
+
TemplateDiff.RequiredProperties = ["template_id", "from_version", "to_version", "summary", "fields", "changed_settings", "document_changed"];
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The template's ID.
|
|
167
|
+
* @member {String} template_id
|
|
168
|
+
*/
|
|
169
|
+
TemplateDiff.prototype['template_id'] = undefined;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The earlier version, such as `1.1.0`. Null when no version was published before `to_version`: it's compared with a new template, so all of its fields are added.
|
|
173
|
+
* @member {String} from_version
|
|
174
|
+
*/
|
|
175
|
+
TemplateDiff.prototype['from_version'] = undefined;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The later version, such as `1.2.0`. Null for the draft.
|
|
179
|
+
* @member {String} to_version
|
|
180
|
+
*/
|
|
181
|
+
TemplateDiff.prototype['to_version'] = undefined;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* How many changes of each kind there are.
|
|
185
|
+
* @member {module:model/TemplateDiffSummary} summary
|
|
186
|
+
*/
|
|
187
|
+
TemplateDiff.prototype['summary'] = undefined;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The fields that changed.
|
|
191
|
+
* @member {module:model/TemplateFieldChanges} fields
|
|
192
|
+
*/
|
|
193
|
+
TemplateDiff.prototype['fields'] = undefined;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The names of the template's settings that changed, as they're named on the Template (`name`, `html`, `defaults`, `expire_after`, ...). Values aren't included, and secrets like `encrypt_pdfs_password` are named when they change.
|
|
197
|
+
* @member {Array.<String>} changed_settings
|
|
198
|
+
*/
|
|
199
|
+
TemplateDiff.prototype['changed_settings'] = undefined;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The template's PDF was replaced (or added, when there's no `from_version`).
|
|
203
|
+
* @member {Boolean} document_changed
|
|
204
|
+
*/
|
|
205
|
+
TemplateDiff.prototype['document_changed'] = undefined;
|
|
206
|
+
var _default = exports["default"] = TemplateDiff;
|