docspring 4.3.0 → 4.4.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.
Files changed (141) hide show
  1. package/README.md +20 -1
  2. package/dist/ApiClient.js +2 -2
  3. package/dist/RequestSchemas.js +1118 -93
  4. package/dist/RequestValidator.js +4 -0
  5. package/dist/api/Client.js +1360 -206
  6. package/dist/index.js +196 -0
  7. package/dist/model/AddTemplateFieldsRequest.js +3 -3
  8. package/dist/model/AuthenticationCheck.js +1 -1
  9. package/dist/model/CombinedPdf.js +1 -1
  10. package/dist/model/CombinedPdfFiles.js +1 -1
  11. package/dist/model/CombinedPdfList.js +1 -1
  12. package/dist/model/CombinedPdfSource.js +2 -2
  13. package/dist/model/CombinedPdfSourceInput.js +2 -2
  14. package/dist/model/CombinedPdfSourcePdf.js +1 -1
  15. package/dist/model/CopyTemplateRequest.js +1 -1
  16. package/dist/model/CreateAccountEmailActionRequest.js +306 -0
  17. package/dist/model/CreateCombinedPdfRequest.js +1 -1
  18. package/dist/model/CreateCustomFileFromUploadRequest.js +1 -1
  19. package/dist/model/CreateEmailActionRequest.js +280 -0
  20. package/dist/model/CreateEmailDomainRequest.js +114 -0
  21. package/dist/model/CreateFolderRequest.js +1 -1
  22. package/dist/model/CreateSignatureRequestEventRequest.js +1 -1
  23. package/dist/model/CreateSignatureRequestTokenRequest.js +1 -1
  24. package/dist/model/CreateSubmissionBatchRequest.js +4 -4
  25. package/dist/model/CreateSubmissionRequest.js +112 -4
  26. package/dist/model/CreateTemplatePreviewRequest.js +1 -1
  27. package/dist/model/CreateTemplateRequest.js +103 -8
  28. package/dist/model/CreateWebhookRequest.js +1 -1
  29. package/dist/model/CustomFile.js +1 -1
  30. package/dist/model/CustomFileList.js +1 -1
  31. package/dist/model/CustomFileSourcePdf.js +1 -1
  32. package/dist/model/DnsRecordType.js +64 -0
  33. package/dist/model/EmailAction.js +510 -0
  34. package/dist/model/EmailActionConditions.js +142 -0
  35. package/dist/model/EmailActionConditionsInput.js +142 -0
  36. package/dist/model/EmailActionCustomization.js +222 -0
  37. package/dist/model/EmailActionDelivery.js +59 -0
  38. package/dist/model/EmailActionFileFormats.js +69 -0
  39. package/dist/model/EmailActionList.js +132 -0
  40. package/dist/model/EmailActionSetting.js +119 -0
  41. package/dist/model/EmailActionSubmissionType.js +64 -0
  42. package/dist/model/EmailActionTestEmail.js +116 -0
  43. package/dist/model/EmailDomain.js +245 -0
  44. package/dist/model/EmailDomainDnsRecord.js +155 -0
  45. package/dist/model/EmailDomainDnsRecordPurpose.js +64 -0
  46. package/dist/model/EmailDomainList.js +132 -0
  47. package/dist/model/EmailDomainRecordState.js +64 -0
  48. package/dist/model/EmailDomainState.js +64 -0
  49. package/dist/model/ErrorCode.js +10 -0
  50. package/dist/model/ErrorDetail.js +1 -1
  51. package/dist/model/ErrorInfo.js +46 -7
  52. package/dist/model/ErrorResponse.js +1 -1
  53. package/dist/model/Field.js +3 -3
  54. package/dist/model/FieldComparisonCondition.js +1 -1
  55. package/dist/model/FieldDependency.js +1 -1
  56. package/dist/model/FieldDependencyInput.js +1 -1
  57. package/dist/model/FieldEqualsCondition.js +1 -1
  58. package/dist/model/FieldGroup.js +1 -1
  59. package/dist/model/FieldGroupInput.js +1 -1
  60. package/dist/model/FieldInCondition.js +1 -1
  61. package/dist/model/FieldInput.js +2 -2
  62. package/dist/model/FieldOverride.js +1 -1
  63. package/dist/model/FieldPresenceCondition.js +1 -1
  64. package/dist/model/FieldRangeCondition.js +1 -1
  65. package/dist/model/Folder.js +1 -1
  66. package/dist/model/FolderList.js +1 -1
  67. package/dist/model/GenerateSubmissionFilesRequest.js +1 -1
  68. package/dist/model/GeneratedFile.js +1 -1
  69. package/dist/model/HtmlEngineOptions.js +3 -3
  70. package/dist/model/HtmlEngineOptionsInput.js +2 -2
  71. package/dist/model/MoveFolderRequest.js +1 -1
  72. package/dist/model/MoveTemplateRequest.js +1 -1
  73. package/dist/model/PageImage.js +1 -1
  74. package/dist/model/PageImages.js +1 -1
  75. package/dist/model/PredefinedField.js +1 -1
  76. package/dist/model/PredefinedFieldInput.js +1 -1
  77. package/dist/model/PublishTemplateVersionRequest.js +1 -1
  78. package/dist/model/RemoveTemplateFieldsRequest.js +1 -1
  79. package/dist/model/RenameFolderRequest.js +1 -1
  80. package/dist/model/ReorderTemplateFieldsRequest.js +1 -1
  81. package/dist/model/RestoreTemplateVersionRequest.js +1 -1
  82. package/dist/model/SendAccountEmailActionTestEmailRequest.js +91 -0
  83. package/dist/model/SignatureRequest.js +52 -7
  84. package/dist/model/SignatureRequestEmailAttachments.js +59 -0
  85. package/dist/model/SignatureRequestEmailStatus.js +89 -0
  86. package/dist/model/SignatureRequestEvent.js +1 -1
  87. package/dist/model/SignatureRequestEventType.js +11 -1
  88. package/dist/model/SignatureRequestInput.js +24 -8
  89. package/dist/model/SignatureRequestReminders.js +121 -0
  90. package/dist/model/SignatureRequestToken.js +1 -1
  91. package/dist/model/SigningOrder.js +59 -0
  92. package/dist/model/StringConditionType.js +36 -1
  93. package/dist/model/Submission.js +21 -9
  94. package/dist/model/SubmissionAction.js +27 -12
  95. package/dist/model/SubmissionBatch.js +1 -1
  96. package/dist/model/SubmissionFiles.js +1 -1
  97. package/dist/model/SubmissionInput.js +4 -4
  98. package/dist/model/SubmissionList.js +1 -1
  99. package/dist/model/SubmissionSourcePdf.js +1 -1
  100. package/dist/model/SubmissionSummary.js +3 -3
  101. package/dist/model/SubmissionValidation.js +1 -1
  102. package/dist/model/Template.js +130 -19
  103. package/dist/model/TemplateActor.js +1 -1
  104. package/dist/model/TemplateDefaults.js +1 -1
  105. package/dist/model/TemplateDefaultsInput.js +1 -1
  106. package/dist/model/TemplateDiff.js +1 -1
  107. package/dist/model/TemplateDiffSummary.js +1 -1
  108. package/dist/model/TemplateDocument.js +1 -1
  109. package/dist/model/TemplateDocumentSummary.js +1 -1
  110. package/dist/model/TemplateFieldChange.js +1 -1
  111. package/dist/model/TemplateFieldChanges.js +1 -1
  112. package/dist/model/TemplateFieldDependency.js +1 -1
  113. package/dist/model/TemplateFieldDependencyCondition.js +1 -1
  114. package/dist/model/TemplateFieldDependencyConditionInput.js +1 -1
  115. package/dist/model/TemplateFieldDependencyInput.js +1 -1
  116. package/dist/model/TemplateFieldMove.js +1 -1
  117. package/dist/model/TemplateFields.js +1 -1
  118. package/dist/model/TemplateModelCode.js +1 -1
  119. package/dist/model/TemplatePageImages.js +1 -1
  120. package/dist/model/TemplatePageProcessingStatus.js +1 -1
  121. package/dist/model/TemplatePreview.js +1 -1
  122. package/dist/model/TemplateSourcePdf.js +2 -2
  123. package/dist/model/TemplateSummary.js +9 -9
  124. package/dist/model/TemplateSummaryList.js +1 -1
  125. package/dist/model/TemplateType.js +6 -1
  126. package/dist/model/TemplateVersion.js +1 -1
  127. package/dist/model/UpdateAccountEmailActionRequest.js +306 -0
  128. package/dist/model/UpdateEmailActionCustomizationRequest.js +258 -0
  129. package/dist/model/UpdateEmailActionRequest.js +280 -0
  130. package/dist/model/UpdateSignatureRequestRequest.js +1 -1
  131. package/dist/model/UpdateTemplateDocumentRequest.js +2 -2
  132. package/dist/model/UpdateTemplateFieldsRequest.js +1 -1
  133. package/dist/model/UpdateTemplateRequest.js +100 -5
  134. package/dist/model/UpdateWebhookRequest.js +1 -1
  135. package/dist/model/UploadPresign.js +1 -1
  136. package/dist/model/UrlSourcePdf.js +1 -1
  137. package/dist/model/ValidateSubmissionRequest.js +112 -4
  138. package/dist/model/Webhook.js +1 -1
  139. package/dist/model/WebhookEventType.js +10 -0
  140. package/dist/model/WebhookList.js +1 -1
  141. package/package.json +1 -1
@@ -0,0 +1,64 @@
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
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
+ 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); }
10
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
+ 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); } }
12
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ 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); } /**
16
+ * DocSpring API
17
+ * Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
18
+ *
19
+ * The version of the OpenAPI document: v2
20
+ *
21
+ *
22
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
23
+ * https://openapi-generator.tech
24
+ * Do not edit the class manually.
25
+ *
26
+ */
27
+ /**
28
+ * Enum class DnsRecordType.
29
+ * @enum {}
30
+ * @readonly
31
+ */
32
+ var DnsRecordType = exports["default"] = /*#__PURE__*/function () {
33
+ function DnsRecordType() {
34
+ _classCallCheck(this, DnsRecordType);
35
+ }
36
+ return _createClass(DnsRecordType, null, [{
37
+ key: "constructFromObject",
38
+ value:
39
+ /**
40
+ * Returns a <code>DnsRecordType</code> enum value from a Javascript object name.
41
+ * @param {Object} data The plain JavaScript object containing the name of the enum value.
42
+ * @return {module:model/DnsRecordType} The enum <code>DnsRecordType</code> value.
43
+ */
44
+ function constructFromObject(object) {
45
+ // Any value, including one added to the API after this client was released
46
+ return object;
47
+ }
48
+ }]);
49
+ }();
50
+ /**
51
+ * value: "CNAME"
52
+ * @const
53
+ */
54
+ _defineProperty(DnsRecordType, "CNAME", "CNAME");
55
+ /**
56
+ * value: "MX"
57
+ * @const
58
+ */
59
+ _defineProperty(DnsRecordType, "MX", "MX");
60
+ /**
61
+ * value: "TXT"
62
+ * @const
63
+ */
64
+ _defineProperty(DnsRecordType, "TXT", "TXT");
@@ -0,0 +1,510 @@
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 _EmailActionConditions = _interopRequireDefault(require("./EmailActionConditions"));
9
+ var _EmailActionCustomization = _interopRequireDefault(require("./EmailActionCustomization"));
10
+ var _EmailActionDelivery = _interopRequireDefault(require("./EmailActionDelivery"));
11
+ var _EmailActionFileFormats = _interopRequireDefault(require("./EmailActionFileFormats"));
12
+ var _EmailActionSubmissionType = _interopRequireDefault(require("./EmailActionSubmissionType"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
14
+ 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); }
15
+ 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; } } }; }
16
+ 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; } }
17
+ 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; }
18
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
+ 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); } }
20
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
+ 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); } /**
23
+ * DocSpring API
24
+ * Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
25
+ *
26
+ * The version of the OpenAPI document: v2
27
+ *
28
+ *
29
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
30
+ * https://openapi-generator.tech
31
+ * Do not edit the class manually.
32
+ *
33
+ */
34
+ /**
35
+ * The EmailAction model module.
36
+ * @module model/EmailAction
37
+ * @version 4.4.0
38
+ */
39
+ var EmailAction = /*#__PURE__*/function () {
40
+ /**
41
+ * Constructs a new <code>EmailAction</code>.
42
+ * Emails each submission's files (its PDF, and a Word template's Word document and OpenDocument file) to people when the submission has been processed. An email action belongs to a template's draft, or to your account (an account email action, with no `template_id`), which sends for every template or for the templates and folders it lists. Each template can turn an account email action off or change its settings for that template only (`customization`). Email actions email anyone on a paid plan (Starter or higher); without one, they only email your team (test emails, and test submissions). They send from DocSpring's shared address or from one of your verified email domains.
43
+ * @alias module:model/EmailAction
44
+ * @extends Object
45
+ * @param id {String} The email action's ID.
46
+ * @param template_id {String} The ID of the template it belongs to. Null for an account email action, which sends for many templates.
47
+ * @param template_ids {Array.<String>} For an account email action: the IDs of the templates it sends for. With `folder_ids`, it sends for a template that either list includes. Both empty sends for every template. Always empty for a template's own email action.
48
+ * @param folder_ids {Array.<String>} For an account email action: the IDs of folders whose templates it sends for, including the templates in the folders inside them. Always empty for a template's own email action.
49
+ * @param name {String} A name for the email action, shown in the dashboard. Null shows its recipients instead.
50
+ * @param enabled {Boolean} Whether it sends emails. DocSpring turns an email action off after 3 days of failed emails, or straight away when one of the addresses in `to`, `cc` or `bcc` (not one from a field or metadata) bounces or marks an email as spam.
51
+ * @param to {Array.<String>} Who gets each email: email addresses, and tags for an address that each submission gives, from one of the template's text or email fields (`{{ data.client_email }}`, or `{{ data["client email"] }}` for a name with spaces) or from its metadata (`{{ metadata.agent_email }}`, or `{{ metadata.agent.email }}` for a value in an object). A tag whose value is blank or isn't a valid address is skipped for that submission, and so is a field an account email action names that the template doesn't have. `{{ signer.email }}` sends each of the submission's signers their own email, to them alone, and everyone else in `to`, `cc` and `bcc` one email together, without the signers. An email needs at least one entry in `to`, `cc` or `bcc`, and at most 10 across them.
52
+ * @param cc {Array.<String>} Who is copied on each email, as in `to` (but not `{{ signer.email }}`).
53
+ * @param bcc {Array.<String>} Who is blind-copied on each email, as in `to` (but not `{{ signer.email }}`).
54
+ * @param from_name {String} The sender's name. Null uses your account's name. From DocSpring's shared address, the name is followed by "via DocSpring".
55
+ * @param from_address {String} The sender's address, at one of your verified email domains. Null sends from DocSpring's shared address.
56
+ * @param reply_to {String} Where replies go: a team member's email address, or an address at one of your verified email domains. Null sends without a reply address.
57
+ * @param subject {String} The subject line, a Liquid template with the variables `account.name`, `template.name`, `template.id`, `submission.id`, the submission's values as `data.<field name>` (`data["field name"]` for a name with spaces) and its metadata as `metadata.<key>`, such as `Your {{ template.name }}`. Null uses the template's name followed by the file it sends, such as "Lease PDF", or by "files" when it sends several.
58
+ * @param message {String} The email's text, a Liquid template with the same variables as `subject`. `if`, `unless` and `case` tags work. Line breaks are kept. Null uses a short message that says the files are attached or ready to download.
59
+ * @param file_name {String} The attached files' name, a Liquid template with the same variables as `subject`, such as `{{ data.last_name }} lease`. Each file's extension (`.pdf`, `.docx` or `.odt`) is added. Null uses the submission's `pdf_filename` metadata when it has one, and otherwise the template's name. A download link's files have the names their other downloads have: the submission's `pdf_filename`, or its ID.
60
+ * @param file_formats {module:model/EmailActionFileFormats} Which of the submission's files the email sends: `all` sends every file the submission made (its PDF, and a Word template's Word document and OpenDocument file when it made them), and `docx`, `odt` or `pdf` sends only that file. A submission that made none of them sends nothing, and its email shows as skipped. Only Word templates make Word documents and OpenDocument files, so another template's email action takes `pdf` or `all`.
61
+ * @param delivery {module:model/EmailActionDelivery} `attachment` attaches the files, or sends a download link when together they're larger than `max_attachment_mb`. `link` sends a download link, which works for 7 days. Accounts with a BAA start with `link`.
62
+ * @param max_attachment_mb {Number} With `delivery` `attachment`, files larger than this many megabytes in all (1 MB is 1,000,000 bytes) are sent as a download link instead. Emailing a file makes it about 38% larger, and many company mail servers refuse emails over 10 MB, so the default is 7. Raise it only when every recipient's mail server accepts larger emails, such as Microsoft 365 (up to 36 MB) or Gmail (50 MB).
63
+ * @param submission_type {module:model/EmailActionSubmissionType} Which submissions send emails: `live`, `test` or `all`. Test submissions only email your team's members, and skip every other recipient.
64
+ * @param send_when {module:model/EmailActionConditions} Sends the email only when the submission's values meet these conditions, which work as a conditional logic rule's do. The values are the ones the PDF has: formulas worked out, and blank for a field that a rule hides. A field the template doesn't have (in an account email action's conditions) counts as blank. A submission that doesn't meet them sends nothing, and its email shows as skipped. Null sends for every submission.
65
+ * @param failure_notifications_enabled {Boolean} Whether the account's owner gets an email when the email action's emails keep failing.
66
+ * @param consecutive_failures {Number} How many emails in a row have failed.
67
+ * @param failing_since {Date} When the current run of failures started. Null when the last email was sent.
68
+ * @param last_failure_at {Date} When an email last failed.
69
+ * @param last_failure_message {String} Why the last failed email failed.
70
+ * @param disabled_at {Date} When the email action was turned off. Null while it is on.
71
+ * @param disabled_reason {String} Why DocSpring turned the email action off, such as after 3 days of failed emails or an address that bounced.
72
+ * @param customization {module:model/EmailActionCustomization} In a template's list of email actions, its changes to an account email action, or null when it changes nothing. The email action's settings are then the ones it sends for that template. Null everywhere else.
73
+ * @param created_at {Date} When the email action was created.
74
+ * @param updated_at {Date} When the email action was last changed.
75
+ */
76
+ function EmailAction(id, template_id, template_ids, folder_ids, name, enabled, to, cc, bcc, from_name, from_address, reply_to, subject, message, file_name, file_formats, delivery, max_attachment_mb, submission_type, send_when, failure_notifications_enabled, consecutive_failures, failing_since, last_failure_at, last_failure_message, disabled_at, disabled_reason, customization, created_at, updated_at) {
77
+ _classCallCheck(this, EmailAction);
78
+ EmailAction.initialize(this, id, template_id, template_ids, folder_ids, name, enabled, to, cc, bcc, from_name, from_address, reply_to, subject, message, file_name, file_formats, delivery, max_attachment_mb, submission_type, send_when, failure_notifications_enabled, consecutive_failures, failing_since, last_failure_at, last_failure_message, disabled_at, disabled_reason, customization, created_at, updated_at);
79
+ }
80
+
81
+ /**
82
+ * Initializes the fields of this object.
83
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
84
+ * Only for internal use.
85
+ */
86
+ return _createClass(EmailAction, null, [{
87
+ key: "initialize",
88
+ value: function initialize(obj, id, template_id, template_ids, folder_ids, name, enabled, to, cc, bcc, from_name, from_address, reply_to, subject, message, file_name, file_formats, delivery, max_attachment_mb, submission_type, send_when, failure_notifications_enabled, consecutive_failures, failing_since, last_failure_at, last_failure_message, disabled_at, disabled_reason, customization, created_at, updated_at) {
89
+ obj['id'] = id;
90
+ obj['template_id'] = template_id;
91
+ obj['template_ids'] = template_ids;
92
+ obj['folder_ids'] = folder_ids;
93
+ obj['name'] = name;
94
+ obj['enabled'] = enabled;
95
+ obj['to'] = to;
96
+ obj['cc'] = cc;
97
+ obj['bcc'] = bcc;
98
+ obj['from_name'] = from_name;
99
+ obj['from_address'] = from_address;
100
+ obj['reply_to'] = reply_to;
101
+ obj['subject'] = subject;
102
+ obj['message'] = message;
103
+ obj['file_name'] = file_name;
104
+ obj['file_formats'] = file_formats;
105
+ obj['delivery'] = delivery;
106
+ obj['max_attachment_mb'] = max_attachment_mb;
107
+ obj['submission_type'] = submission_type;
108
+ obj['send_when'] = send_when;
109
+ obj['failure_notifications_enabled'] = failure_notifications_enabled;
110
+ obj['consecutive_failures'] = consecutive_failures;
111
+ obj['failing_since'] = failing_since;
112
+ obj['last_failure_at'] = last_failure_at;
113
+ obj['last_failure_message'] = last_failure_message;
114
+ obj['disabled_at'] = disabled_at;
115
+ obj['disabled_reason'] = disabled_reason;
116
+ obj['customization'] = customization;
117
+ obj['created_at'] = created_at;
118
+ obj['updated_at'] = updated_at;
119
+ }
120
+
121
+ /**
122
+ * Constructs a <code>EmailAction</code> from a plain JavaScript object, optionally creating a new instance.
123
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
124
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
125
+ * @param {module:model/EmailAction} obj Optional instance to populate.
126
+ * @return {module:model/EmailAction} The populated <code>EmailAction</code> instance.
127
+ */
128
+ }, {
129
+ key: "constructFromObject",
130
+ value: function constructFromObject(data, obj) {
131
+ if (data) {
132
+ obj = obj || new EmailAction();
133
+ _ApiClient["default"].constructFromObject(data, obj, 'Object');
134
+ if (data.hasOwnProperty('id')) {
135
+ obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String');
136
+ }
137
+ if (data.hasOwnProperty('template_id')) {
138
+ obj['template_id'] = _ApiClient["default"].convertToType(data['template_id'], 'String');
139
+ }
140
+ if (data.hasOwnProperty('template_ids')) {
141
+ obj['template_ids'] = _ApiClient["default"].convertToType(data['template_ids'], ['String']);
142
+ }
143
+ if (data.hasOwnProperty('folder_ids')) {
144
+ obj['folder_ids'] = _ApiClient["default"].convertToType(data['folder_ids'], ['String']);
145
+ }
146
+ if (data.hasOwnProperty('name')) {
147
+ obj['name'] = _ApiClient["default"].convertToType(data['name'], 'String');
148
+ }
149
+ if (data.hasOwnProperty('enabled')) {
150
+ obj['enabled'] = _ApiClient["default"].convertToType(data['enabled'], 'Boolean');
151
+ }
152
+ if (data.hasOwnProperty('to')) {
153
+ obj['to'] = _ApiClient["default"].convertToType(data['to'], ['String']);
154
+ }
155
+ if (data.hasOwnProperty('cc')) {
156
+ obj['cc'] = _ApiClient["default"].convertToType(data['cc'], ['String']);
157
+ }
158
+ if (data.hasOwnProperty('bcc')) {
159
+ obj['bcc'] = _ApiClient["default"].convertToType(data['bcc'], ['String']);
160
+ }
161
+ if (data.hasOwnProperty('from_name')) {
162
+ obj['from_name'] = _ApiClient["default"].convertToType(data['from_name'], 'String');
163
+ }
164
+ if (data.hasOwnProperty('from_address')) {
165
+ obj['from_address'] = _ApiClient["default"].convertToType(data['from_address'], 'String');
166
+ }
167
+ if (data.hasOwnProperty('reply_to')) {
168
+ obj['reply_to'] = _ApiClient["default"].convertToType(data['reply_to'], 'String');
169
+ }
170
+ if (data.hasOwnProperty('subject')) {
171
+ obj['subject'] = _ApiClient["default"].convertToType(data['subject'], 'String');
172
+ }
173
+ if (data.hasOwnProperty('message')) {
174
+ obj['message'] = _ApiClient["default"].convertToType(data['message'], 'String');
175
+ }
176
+ if (data.hasOwnProperty('file_name')) {
177
+ obj['file_name'] = _ApiClient["default"].convertToType(data['file_name'], 'String');
178
+ }
179
+ if (data.hasOwnProperty('file_formats')) {
180
+ obj['file_formats'] = _ApiClient["default"].convertToType(data['file_formats'], _EmailActionFileFormats["default"]);
181
+ }
182
+ if (data.hasOwnProperty('delivery')) {
183
+ obj['delivery'] = _ApiClient["default"].convertToType(data['delivery'], _EmailActionDelivery["default"]);
184
+ }
185
+ if (data.hasOwnProperty('max_attachment_mb')) {
186
+ obj['max_attachment_mb'] = _ApiClient["default"].convertToType(data['max_attachment_mb'], 'Number');
187
+ }
188
+ if (data.hasOwnProperty('submission_type')) {
189
+ obj['submission_type'] = _ApiClient["default"].convertToType(data['submission_type'], _EmailActionSubmissionType["default"]);
190
+ }
191
+ if (data.hasOwnProperty('send_when')) {
192
+ obj['send_when'] = _ApiClient["default"].convertToType(data['send_when'], _EmailActionConditions["default"]);
193
+ }
194
+ if (data.hasOwnProperty('failure_notifications_enabled')) {
195
+ obj['failure_notifications_enabled'] = _ApiClient["default"].convertToType(data['failure_notifications_enabled'], 'Boolean');
196
+ }
197
+ if (data.hasOwnProperty('consecutive_failures')) {
198
+ obj['consecutive_failures'] = _ApiClient["default"].convertToType(data['consecutive_failures'], 'Number');
199
+ }
200
+ if (data.hasOwnProperty('failing_since')) {
201
+ obj['failing_since'] = _ApiClient["default"].convertToType(data['failing_since'], 'Date');
202
+ }
203
+ if (data.hasOwnProperty('last_failure_at')) {
204
+ obj['last_failure_at'] = _ApiClient["default"].convertToType(data['last_failure_at'], 'Date');
205
+ }
206
+ if (data.hasOwnProperty('last_failure_message')) {
207
+ obj['last_failure_message'] = _ApiClient["default"].convertToType(data['last_failure_message'], 'String');
208
+ }
209
+ if (data.hasOwnProperty('disabled_at')) {
210
+ obj['disabled_at'] = _ApiClient["default"].convertToType(data['disabled_at'], 'Date');
211
+ }
212
+ if (data.hasOwnProperty('disabled_reason')) {
213
+ obj['disabled_reason'] = _ApiClient["default"].convertToType(data['disabled_reason'], 'String');
214
+ }
215
+ if (data.hasOwnProperty('customization')) {
216
+ obj['customization'] = _ApiClient["default"].convertToType(data['customization'], _EmailActionCustomization["default"]);
217
+ }
218
+ if (data.hasOwnProperty('created_at')) {
219
+ obj['created_at'] = _ApiClient["default"].convertToType(data['created_at'], 'Date');
220
+ }
221
+ if (data.hasOwnProperty('updated_at')) {
222
+ obj['updated_at'] = _ApiClient["default"].convertToType(data['updated_at'], 'Date');
223
+ }
224
+ }
225
+ return obj;
226
+ }
227
+
228
+ /**
229
+ * Validates the JSON data with respect to <code>EmailAction</code>.
230
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
231
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>EmailAction</code>.
232
+ */
233
+ }, {
234
+ key: "validateJSON",
235
+ value: function validateJSON(data) {
236
+ // check to make sure all required properties are present in the JSON string
237
+ var _iterator = _createForOfIteratorHelper(EmailAction.RequiredProperties),
238
+ _step;
239
+ try {
240
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
241
+ var property = _step.value;
242
+ if (!data.hasOwnProperty(property)) {
243
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
244
+ }
245
+ }
246
+ // ensure the json data is a string
247
+ } catch (err) {
248
+ _iterator.e(err);
249
+ } finally {
250
+ _iterator.f();
251
+ }
252
+ if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) {
253
+ throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']);
254
+ }
255
+ // ensure the json data is a string
256
+ if (data['template_id'] && !(typeof data['template_id'] === 'string' || data['template_id'] instanceof String)) {
257
+ throw new Error("Expected the field `template_id` to be a primitive type in the JSON string but got " + data['template_id']);
258
+ }
259
+ // ensure the json data is an array
260
+ if (!Array.isArray(data['template_ids'])) {
261
+ throw new Error("Expected the field `template_ids` to be an array in the JSON data but got " + data['template_ids']);
262
+ }
263
+ // ensure the json data is an array
264
+ if (!Array.isArray(data['folder_ids'])) {
265
+ throw new Error("Expected the field `folder_ids` to be an array in the JSON data but got " + data['folder_ids']);
266
+ }
267
+ // ensure the json data is a string
268
+ if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
269
+ throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
270
+ }
271
+ // ensure the json data is an array
272
+ if (!Array.isArray(data['to'])) {
273
+ throw new Error("Expected the field `to` to be an array in the JSON data but got " + data['to']);
274
+ }
275
+ // ensure the json data is an array
276
+ if (!Array.isArray(data['cc'])) {
277
+ throw new Error("Expected the field `cc` to be an array in the JSON data but got " + data['cc']);
278
+ }
279
+ // ensure the json data is an array
280
+ if (!Array.isArray(data['bcc'])) {
281
+ throw new Error("Expected the field `bcc` to be an array in the JSON data but got " + data['bcc']);
282
+ }
283
+ // ensure the json data is a string
284
+ if (data['from_name'] && !(typeof data['from_name'] === 'string' || data['from_name'] instanceof String)) {
285
+ throw new Error("Expected the field `from_name` to be a primitive type in the JSON string but got " + data['from_name']);
286
+ }
287
+ // ensure the json data is a string
288
+ if (data['from_address'] && !(typeof data['from_address'] === 'string' || data['from_address'] instanceof String)) {
289
+ throw new Error("Expected the field `from_address` to be a primitive type in the JSON string but got " + data['from_address']);
290
+ }
291
+ // ensure the json data is a string
292
+ if (data['reply_to'] && !(typeof data['reply_to'] === 'string' || data['reply_to'] instanceof String)) {
293
+ throw new Error("Expected the field `reply_to` to be a primitive type in the JSON string but got " + data['reply_to']);
294
+ }
295
+ // ensure the json data is a string
296
+ if (data['subject'] && !(typeof data['subject'] === 'string' || data['subject'] instanceof String)) {
297
+ throw new Error("Expected the field `subject` to be a primitive type in the JSON string but got " + data['subject']);
298
+ }
299
+ // ensure the json data is a string
300
+ if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) {
301
+ throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']);
302
+ }
303
+ // ensure the json data is a string
304
+ if (data['file_name'] && !(typeof data['file_name'] === 'string' || data['file_name'] instanceof String)) {
305
+ throw new Error("Expected the field `file_name` to be a primitive type in the JSON string but got " + data['file_name']);
306
+ }
307
+ // validate the optional field `send_when`
308
+ if (data['send_when']) {
309
+ // data not null
310
+ _EmailActionConditions["default"].validateJSON(data['send_when']);
311
+ }
312
+ // ensure the json data is a string
313
+ if (data['last_failure_message'] && !(typeof data['last_failure_message'] === 'string' || data['last_failure_message'] instanceof String)) {
314
+ throw new Error("Expected the field `last_failure_message` to be a primitive type in the JSON string but got " + data['last_failure_message']);
315
+ }
316
+ // ensure the json data is a string
317
+ if (data['disabled_reason'] && !(typeof data['disabled_reason'] === 'string' || data['disabled_reason'] instanceof String)) {
318
+ throw new Error("Expected the field `disabled_reason` to be a primitive type in the JSON string but got " + data['disabled_reason']);
319
+ }
320
+ // validate the optional field `customization`
321
+ if (data['customization']) {
322
+ // data not null
323
+ _EmailActionCustomization["default"].validateJSON(data['customization']);
324
+ }
325
+ return true;
326
+ }
327
+ }]);
328
+ }();
329
+ EmailAction.RequiredProperties = ["id", "template_id", "template_ids", "folder_ids", "name", "enabled", "to", "cc", "bcc", "from_name", "from_address", "reply_to", "subject", "message", "file_name", "file_formats", "delivery", "max_attachment_mb", "submission_type", "send_when", "failure_notifications_enabled", "consecutive_failures", "failing_since", "last_failure_at", "last_failure_message", "disabled_at", "disabled_reason", "customization", "created_at", "updated_at"];
330
+
331
+ /**
332
+ * The email action's ID.
333
+ * @member {String} id
334
+ */
335
+ EmailAction.prototype['id'] = undefined;
336
+
337
+ /**
338
+ * The ID of the template it belongs to. Null for an account email action, which sends for many templates.
339
+ * @member {String} template_id
340
+ */
341
+ EmailAction.prototype['template_id'] = undefined;
342
+
343
+ /**
344
+ * For an account email action: the IDs of the templates it sends for. With `folder_ids`, it sends for a template that either list includes. Both empty sends for every template. Always empty for a template's own email action.
345
+ * @member {Array.<String>} template_ids
346
+ */
347
+ EmailAction.prototype['template_ids'] = undefined;
348
+
349
+ /**
350
+ * For an account email action: the IDs of folders whose templates it sends for, including the templates in the folders inside them. Always empty for a template's own email action.
351
+ * @member {Array.<String>} folder_ids
352
+ */
353
+ EmailAction.prototype['folder_ids'] = undefined;
354
+
355
+ /**
356
+ * A name for the email action, shown in the dashboard. Null shows its recipients instead.
357
+ * @member {String} name
358
+ */
359
+ EmailAction.prototype['name'] = undefined;
360
+
361
+ /**
362
+ * Whether it sends emails. DocSpring turns an email action off after 3 days of failed emails, or straight away when one of the addresses in `to`, `cc` or `bcc` (not one from a field or metadata) bounces or marks an email as spam.
363
+ * @member {Boolean} enabled
364
+ */
365
+ EmailAction.prototype['enabled'] = undefined;
366
+
367
+ /**
368
+ * Who gets each email: email addresses, and tags for an address that each submission gives, from one of the template's text or email fields (`{{ data.client_email }}`, or `{{ data["client email"] }}` for a name with spaces) or from its metadata (`{{ metadata.agent_email }}`, or `{{ metadata.agent.email }}` for a value in an object). A tag whose value is blank or isn't a valid address is skipped for that submission, and so is a field an account email action names that the template doesn't have. `{{ signer.email }}` sends each of the submission's signers their own email, to them alone, and everyone else in `to`, `cc` and `bcc` one email together, without the signers. An email needs at least one entry in `to`, `cc` or `bcc`, and at most 10 across them.
369
+ * @member {Array.<String>} to
370
+ */
371
+ EmailAction.prototype['to'] = undefined;
372
+
373
+ /**
374
+ * Who is copied on each email, as in `to` (but not `{{ signer.email }}`).
375
+ * @member {Array.<String>} cc
376
+ */
377
+ EmailAction.prototype['cc'] = undefined;
378
+
379
+ /**
380
+ * Who is blind-copied on each email, as in `to` (but not `{{ signer.email }}`).
381
+ * @member {Array.<String>} bcc
382
+ */
383
+ EmailAction.prototype['bcc'] = undefined;
384
+
385
+ /**
386
+ * The sender's name. Null uses your account's name. From DocSpring's shared address, the name is followed by "via DocSpring".
387
+ * @member {String} from_name
388
+ */
389
+ EmailAction.prototype['from_name'] = undefined;
390
+
391
+ /**
392
+ * The sender's address, at one of your verified email domains. Null sends from DocSpring's shared address.
393
+ * @member {String} from_address
394
+ */
395
+ EmailAction.prototype['from_address'] = undefined;
396
+
397
+ /**
398
+ * Where replies go: a team member's email address, or an address at one of your verified email domains. Null sends without a reply address.
399
+ * @member {String} reply_to
400
+ */
401
+ EmailAction.prototype['reply_to'] = undefined;
402
+
403
+ /**
404
+ * The subject line, a Liquid template with the variables `account.name`, `template.name`, `template.id`, `submission.id`, the submission's values as `data.<field name>` (`data["field name"]` for a name with spaces) and its metadata as `metadata.<key>`, such as `Your {{ template.name }}`. Null uses the template's name followed by the file it sends, such as "Lease PDF", or by "files" when it sends several.
405
+ * @member {String} subject
406
+ */
407
+ EmailAction.prototype['subject'] = undefined;
408
+
409
+ /**
410
+ * The email's text, a Liquid template with the same variables as `subject`. `if`, `unless` and `case` tags work. Line breaks are kept. Null uses a short message that says the files are attached or ready to download.
411
+ * @member {String} message
412
+ */
413
+ EmailAction.prototype['message'] = undefined;
414
+
415
+ /**
416
+ * The attached files' name, a Liquid template with the same variables as `subject`, such as `{{ data.last_name }} lease`. Each file's extension (`.pdf`, `.docx` or `.odt`) is added. Null uses the submission's `pdf_filename` metadata when it has one, and otherwise the template's name. A download link's files have the names their other downloads have: the submission's `pdf_filename`, or its ID.
417
+ * @member {String} file_name
418
+ */
419
+ EmailAction.prototype['file_name'] = undefined;
420
+
421
+ /**
422
+ * Which of the submission's files the email sends: `all` sends every file the submission made (its PDF, and a Word template's Word document and OpenDocument file when it made them), and `docx`, `odt` or `pdf` sends only that file. A submission that made none of them sends nothing, and its email shows as skipped. Only Word templates make Word documents and OpenDocument files, so another template's email action takes `pdf` or `all`.
423
+ * @member {module:model/EmailActionFileFormats} file_formats
424
+ */
425
+ EmailAction.prototype['file_formats'] = undefined;
426
+
427
+ /**
428
+ * `attachment` attaches the files, or sends a download link when together they're larger than `max_attachment_mb`. `link` sends a download link, which works for 7 days. Accounts with a BAA start with `link`.
429
+ * @member {module:model/EmailActionDelivery} delivery
430
+ */
431
+ EmailAction.prototype['delivery'] = undefined;
432
+
433
+ /**
434
+ * With `delivery` `attachment`, files larger than this many megabytes in all (1 MB is 1,000,000 bytes) are sent as a download link instead. Emailing a file makes it about 38% larger, and many company mail servers refuse emails over 10 MB, so the default is 7. Raise it only when every recipient's mail server accepts larger emails, such as Microsoft 365 (up to 36 MB) or Gmail (50 MB).
435
+ * @member {Number} max_attachment_mb
436
+ */
437
+ EmailAction.prototype['max_attachment_mb'] = undefined;
438
+
439
+ /**
440
+ * Which submissions send emails: `live`, `test` or `all`. Test submissions only email your team's members, and skip every other recipient.
441
+ * @member {module:model/EmailActionSubmissionType} submission_type
442
+ */
443
+ EmailAction.prototype['submission_type'] = undefined;
444
+
445
+ /**
446
+ * Sends the email only when the submission's values meet these conditions, which work as a conditional logic rule's do. The values are the ones the PDF has: formulas worked out, and blank for a field that a rule hides. A field the template doesn't have (in an account email action's conditions) counts as blank. A submission that doesn't meet them sends nothing, and its email shows as skipped. Null sends for every submission.
447
+ * @member {module:model/EmailActionConditions} send_when
448
+ */
449
+ EmailAction.prototype['send_when'] = undefined;
450
+
451
+ /**
452
+ * Whether the account's owner gets an email when the email action's emails keep failing.
453
+ * @member {Boolean} failure_notifications_enabled
454
+ */
455
+ EmailAction.prototype['failure_notifications_enabled'] = undefined;
456
+
457
+ /**
458
+ * How many emails in a row have failed.
459
+ * @member {Number} consecutive_failures
460
+ */
461
+ EmailAction.prototype['consecutive_failures'] = undefined;
462
+
463
+ /**
464
+ * When the current run of failures started. Null when the last email was sent.
465
+ * @member {Date} failing_since
466
+ */
467
+ EmailAction.prototype['failing_since'] = undefined;
468
+
469
+ /**
470
+ * When an email last failed.
471
+ * @member {Date} last_failure_at
472
+ */
473
+ EmailAction.prototype['last_failure_at'] = undefined;
474
+
475
+ /**
476
+ * Why the last failed email failed.
477
+ * @member {String} last_failure_message
478
+ */
479
+ EmailAction.prototype['last_failure_message'] = undefined;
480
+
481
+ /**
482
+ * When the email action was turned off. Null while it is on.
483
+ * @member {Date} disabled_at
484
+ */
485
+ EmailAction.prototype['disabled_at'] = undefined;
486
+
487
+ /**
488
+ * Why DocSpring turned the email action off, such as after 3 days of failed emails or an address that bounced.
489
+ * @member {String} disabled_reason
490
+ */
491
+ EmailAction.prototype['disabled_reason'] = undefined;
492
+
493
+ /**
494
+ * In a template's list of email actions, its changes to an account email action, or null when it changes nothing. The email action's settings are then the ones it sends for that template. Null everywhere else.
495
+ * @member {module:model/EmailActionCustomization} customization
496
+ */
497
+ EmailAction.prototype['customization'] = undefined;
498
+
499
+ /**
500
+ * When the email action was created.
501
+ * @member {Date} created_at
502
+ */
503
+ EmailAction.prototype['created_at'] = undefined;
504
+
505
+ /**
506
+ * When the email action was last changed.
507
+ * @member {Date} updated_at
508
+ */
509
+ EmailAction.prototype['updated_at'] = undefined;
510
+ var _default = exports["default"] = EmailAction;