docspring 3.3.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.
Files changed (184) hide show
  1. package/AGENTS.md +79 -19
  2. package/README.md +74 -63
  3. package/dist/ApiClient.js +63 -28
  4. package/dist/RequestSchemas.js +3452 -0
  5. package/dist/RequestValidator.js +494 -0
  6. package/dist/api/Client.js +1769 -921
  7. package/dist/index.js +847 -154
  8. package/dist/model/AddTemplateFieldsRequest.js +132 -0
  9. package/dist/model/AiFieldNamingLanguage.js +64 -0
  10. package/dist/model/{CreateWebhookData.js → AuthenticationCheck.js} +32 -28
  11. package/dist/model/BarcodeSymbology.js +89 -0
  12. package/dist/model/CheckCharacter.js +74 -0
  13. package/dist/model/CombinedFieldType.js +59 -0
  14. package/dist/model/CombinedPdf.js +294 -0
  15. package/dist/model/{MoveFolderData.js → CombinedPdfFiles.js} +27 -27
  16. package/dist/model/CombinedPdfList.js +132 -0
  17. package/dist/model/{ForbiddenErrorResponse.js → CombinedPdfSource.js} +59 -73
  18. package/dist/model/CombinedPdfSourceInput.js +270 -0
  19. package/dist/model/CombinedPdfSourcePdf.js +130 -0
  20. package/dist/model/CombinedPdfSourceType.js +74 -0
  21. package/dist/model/CombinedPdfState.js +74 -0
  22. package/dist/model/{CopyTemplateOptions.js → CopyTemplateRequest.js} +26 -22
  23. package/dist/model/{CombinePdfsData.js → CreateCombinedPdfRequest.js} +69 -53
  24. package/dist/model/{CreateCustomFileData.js → CreateCustomFileFromUploadRequest.js} +25 -23
  25. package/dist/model/{CreateFolderData.js → CreateFolderRequest.js} +47 -28
  26. package/dist/model/{CreateCustomFileResponse.js → CreateSignatureRequestEventRequest.js} +49 -73
  27. package/dist/model/CreateSignatureRequestTokenRequest.js +88 -0
  28. package/dist/model/CreateSubmissionBatchRequest.js +192 -0
  29. package/dist/model/CreateSubmissionRequest.js +226 -0
  30. package/dist/model/CreateTemplateRequest.js +613 -0
  31. package/dist/model/CreateWebhookRequest.js +234 -0
  32. package/dist/model/CustomFile.js +67 -16
  33. package/dist/model/CustomFileList.js +132 -0
  34. package/dist/model/CustomFileSourcePdf.js +130 -0
  35. package/dist/model/ErrorCode.js +154 -0
  36. package/dist/model/{CreateSubmissionResponse.js → ErrorDetail.js} +65 -75
  37. package/dist/model/ErrorInfo.js +211 -0
  38. package/dist/model/ErrorResponse.js +12 -41
  39. package/dist/model/ExpirationInterval.js +64 -0
  40. package/dist/model/Field.js +1230 -0
  41. package/dist/model/FieldComparisonCondition.js +137 -0
  42. package/dist/model/FieldComparisonOperator.js +69 -0
  43. package/dist/model/FieldDependency.js +154 -0
  44. package/dist/model/FieldDependencyInput.js +154 -0
  45. package/dist/model/FieldDisplayType.js +79 -0
  46. package/dist/model/{MultipleErrorsResponse.js → FieldEqualsCondition.js} +48 -52
  47. package/dist/model/FieldEqualsOperator.js +59 -0
  48. package/dist/model/FieldGroup.js +206 -0
  49. package/dist/model/FieldGroupInput.js +180 -0
  50. package/dist/model/FieldGroupType.js +59 -0
  51. package/dist/model/{SuccessMultipleErrorsResponse.js → FieldInCondition.js} +54 -53
  52. package/dist/model/FieldInput.js +1012 -0
  53. package/dist/model/FieldOverride.js +722 -0
  54. package/dist/model/FieldPresenceCondition.js +126 -0
  55. package/dist/model/FieldPresenceOperator.js +59 -0
  56. package/dist/model/FieldRangeCondition.js +148 -0
  57. package/dist/model/FieldReimportState.js +69 -0
  58. package/dist/model/FieldSetupLogic.js +59 -0
  59. package/dist/model/FieldSetupNaming.js +59 -0
  60. package/dist/model/FieldSetupSource.js +64 -0
  61. package/dist/model/FieldType.js +124 -0
  62. package/dist/model/Folder.js +38 -11
  63. package/dist/model/FolderList.js +132 -0
  64. package/dist/model/GenerateFilesFormat.js +54 -0
  65. package/dist/model/GenerateSubmissionFilesRequest.js +115 -0
  66. package/dist/model/GeneratedFile.js +214 -0
  67. package/dist/model/GeneratedFileState.js +64 -0
  68. package/dist/model/HtmlEngineOptions.js +230 -0
  69. package/dist/model/HtmlEngineOptionsInput.js +193 -0
  70. package/dist/model/ImageGravity.js +94 -0
  71. package/dist/model/ImageScaleType.js +64 -0
  72. package/dist/model/ModelCodeLanguage.js +94 -0
  73. package/dist/model/{UpdatePdfTemplate.js → MoveFolderRequest.js} +34 -28
  74. package/dist/model/{MoveTemplateData.js → MoveTemplateRequest.js} +25 -35
  75. package/dist/model/NumberConditionType.js +79 -0
  76. package/dist/model/OutputFormat.js +59 -0
  77. package/dist/model/PageFormat.js +114 -0
  78. package/dist/model/PageImage.js +220 -0
  79. package/dist/model/{TemplateDeleteResponse.js → PageImages.js} +57 -70
  80. package/dist/model/PredefinedField.js +183 -0
  81. package/dist/model/PredefinedFieldInput.js +183 -0
  82. package/dist/model/{PublishVersionData.js → PublishTemplateVersionRequest.js} +33 -33
  83. package/dist/model/{AddFieldsData.js → RemoveTemplateFieldsRequest.js} +32 -30
  84. package/dist/model/{RenameFolderData.js → RenameFolderRequest.js} +25 -23
  85. package/dist/model/ReorderTemplateFieldsRequest.js +114 -0
  86. package/dist/model/{RestoreVersionData.js → RestoreTemplateVersionRequest.js} +25 -23
  87. package/dist/model/ShapeType.js +79 -0
  88. package/dist/model/{SubmissionDataRequestShow.js → SignatureRequest.js} +165 -240
  89. package/dist/model/SignatureRequestAuthSecondFactorType.js +79 -0
  90. package/dist/model/SignatureRequestAuthType.js +84 -0
  91. package/dist/model/{SubmissionDataRequestEvent.js → SignatureRequestEvent.js} +67 -149
  92. package/dist/model/SignatureRequestEventType.js +79 -0
  93. package/dist/model/SignatureRequestInput.js +278 -0
  94. package/dist/model/SignatureRequestMessageType.js +94 -0
  95. package/dist/model/SignatureRequestState.js +64 -0
  96. package/dist/model/SignatureRequestToken.js +195 -0
  97. package/dist/model/SignatureRequestTokenType.js +59 -0
  98. package/dist/model/StringConditionType.js +74 -0
  99. package/dist/model/Submission.js +198 -341
  100. package/dist/model/SubmissionAction.js +30 -115
  101. package/dist/model/SubmissionActionState.js +69 -0
  102. package/dist/model/SubmissionActionType.js +84 -0
  103. package/dist/model/SubmissionBatch.js +74 -55
  104. package/dist/model/SubmissionBatchState.js +64 -0
  105. package/dist/model/SubmissionFiles.js +117 -0
  106. package/dist/model/SubmissionInput.js +218 -0
  107. package/dist/model/{ListSubmissionsResponse.js → SubmissionList.js} +35 -42
  108. package/dist/model/SubmissionSource.js +69 -0
  109. package/dist/model/SubmissionSourcePdf.js +130 -0
  110. package/dist/model/SubmissionState.js +114 -0
  111. package/dist/model/{SubmissionBatchData.js → SubmissionValidation.js} +46 -48
  112. package/dist/model/Template.js +359 -560
  113. package/dist/model/TemplateActor.js +171 -0
  114. package/dist/model/TemplateActorType.js +64 -0
  115. package/dist/model/TemplateDefaults.js +307 -0
  116. package/dist/model/TemplateDefaultsInput.js +305 -0
  117. package/dist/model/TemplateDiff.js +206 -0
  118. package/dist/model/TemplateDiffSummary.js +165 -0
  119. package/dist/model/TemplateDocument.js +280 -0
  120. package/dist/model/TemplateDocumentState.js +84 -0
  121. package/dist/model/TemplateFieldChange.js +146 -0
  122. package/dist/model/TemplateFieldChanges.js +196 -0
  123. package/dist/model/{CreatePdfSubmissionData.js → TemplateFieldDependency.js} +70 -89
  124. package/dist/model/TemplateFieldDependencyAction.js +64 -0
  125. package/dist/model/{TemplatePublishVersionResponse.js → TemplateFieldDependencyCondition.js} +51 -61
  126. package/dist/model/TemplateFieldDependencyConditionInput.js +304 -0
  127. package/dist/model/TemplateFieldDependencyInput.js +182 -0
  128. package/dist/model/TemplateFieldDependencyMatch.js +59 -0
  129. package/dist/model/TemplateFieldDependencyOperator.js +99 -0
  130. package/dist/model/TemplateFieldLogicStatus.js +74 -0
  131. package/dist/model/{CreatePdfTemplate.js → TemplateFieldMove.js} +52 -28
  132. package/dist/model/TemplateFields.js +147 -0
  133. package/dist/model/TemplateFormMode.js +64 -0
  134. package/dist/model/{TemplateModelCodeResponse.js → TemplateModelCode.js} +34 -86
  135. package/dist/model/TemplatePageAiError.js +69 -0
  136. package/dist/model/TemplatePageAiNamingStatus.js +59 -0
  137. package/dist/model/TemplatePageFieldsStatus.js +74 -0
  138. package/dist/model/TemplatePageImageStatus.js +59 -0
  139. package/dist/model/TemplatePageImages.js +158 -0
  140. package/dist/model/TemplatePageProcessingStatus.js +162 -0
  141. package/dist/model/{SubmissionDataRequestToken.js → TemplateSourcePdf.js} +52 -56
  142. package/dist/model/TemplateSummary.js +560 -0
  143. package/dist/model/{SuccessErrorResponse.js → TemplateSummaryList.js} +43 -55
  144. package/dist/model/TemplateType.js +59 -0
  145. package/dist/model/{Submission422Response.js → TemplateVersion.js} +60 -63
  146. package/dist/model/TemplateVersionType.js +64 -0
  147. package/dist/model/TextAlignment.js +69 -0
  148. package/dist/model/TextOverflow.js +59 -0
  149. package/dist/model/TextVerticalAlignment.js +64 -0
  150. package/dist/model/Typeface.js +134 -0
  151. package/dist/model/UpdateSignatureRequestRequest.js +183 -0
  152. package/dist/model/UpdateTemplateDocumentRequest.js +139 -0
  153. package/dist/model/UpdateTemplateFieldsRequest.js +132 -0
  154. package/dist/model/UpdateTemplateRequest.js +523 -0
  155. package/dist/model/UpdateWebhookRequest.js +209 -0
  156. package/dist/model/UploadMethod.js +54 -0
  157. package/dist/model/{UploadPresignResponse.js → UploadPresign.js} +53 -58
  158. package/dist/model/UrlSourcePdf.js +130 -0
  159. package/dist/model/ValidateSubmissionRequest.js +226 -0
  160. package/dist/model/Webhook.js +58 -73
  161. package/dist/model/WebhookEventType.js +174 -0
  162. package/dist/model/WebhookList.js +132 -0
  163. package/dist/model/WebhookMode.js +59 -0
  164. package/package.json +1 -1
  165. package/dist/model/BatchGeneratePdfs201Response.js +0 -194
  166. package/dist/model/CombinedSubmission.js +0 -313
  167. package/dist/model/CombinedSubmissionAction.js +0 -268
  168. package/dist/model/CreateCombinedSubmissionResponse.js +0 -180
  169. package/dist/model/CreateHtmlTemplate.js +0 -108
  170. package/dist/model/CreateSubmissionDataRequestData.js +0 -314
  171. package/dist/model/CreateSubmissionDataRequestEventRequest.js +0 -239
  172. package/dist/model/CreateSubmissionDataRequestEventResponse.js +0 -167
  173. package/dist/model/CreateSubmissionDataRequestResponse.js +0 -167
  174. package/dist/model/CreateSubmissionDataRequestTokenResponse.js +0 -167
  175. package/dist/model/ErrorOrMultipleErrorsResponse.js +0 -153
  176. package/dist/model/JsonSchema.js +0 -205
  177. package/dist/model/SubmissionBatchWithSubmissions.js +0 -228
  178. package/dist/model/SubmissionDataRequest.js +0 -496
  179. package/dist/model/SubmissionPreview.js +0 -509
  180. package/dist/model/TemplateAddFieldsResponse.js +0 -156
  181. package/dist/model/TemplatePreview.js +0 -796
  182. package/dist/model/UpdateHtmlTemplate.js +0 -108
  183. package/dist/model/UpdateSubmissionDataRequestData.js +0 -311
  184. package/dist/model/UpdateWebhookData.js +0 -108
@@ -5,56 +5,63 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
- var _AddFieldsData = _interopRequireDefault(require("../model/AddFieldsData"));
9
- var _BatchGeneratePdfs201Response = _interopRequireDefault(require("../model/BatchGeneratePdfs201Response"));
10
- var _CombinePdfsData = _interopRequireDefault(require("../model/CombinePdfsData"));
11
- var _CombinedSubmission = _interopRequireDefault(require("../model/CombinedSubmission"));
12
- var _CopyTemplateOptions = _interopRequireDefault(require("../model/CopyTemplateOptions"));
13
- var _CreateCombinedSubmissionResponse = _interopRequireDefault(require("../model/CreateCombinedSubmissionResponse"));
14
- var _CreateCustomFileData = _interopRequireDefault(require("../model/CreateCustomFileData"));
15
- var _CreateCustomFileResponse = _interopRequireDefault(require("../model/CreateCustomFileResponse"));
16
- var _CreateFolderData = _interopRequireDefault(require("../model/CreateFolderData"));
17
- var _CreateHtmlTemplate = _interopRequireDefault(require("../model/CreateHtmlTemplate"));
18
- var _CreatePdfSubmissionData = _interopRequireDefault(require("../model/CreatePdfSubmissionData"));
19
- var _CreatePdfTemplate = _interopRequireDefault(require("../model/CreatePdfTemplate"));
20
- var _CreateSubmissionDataRequestEventRequest = _interopRequireDefault(require("../model/CreateSubmissionDataRequestEventRequest"));
21
- var _CreateSubmissionDataRequestEventResponse = _interopRequireDefault(require("../model/CreateSubmissionDataRequestEventResponse"));
22
- var _CreateSubmissionDataRequestResponse = _interopRequireDefault(require("../model/CreateSubmissionDataRequestResponse"));
23
- var _CreateSubmissionDataRequestTokenResponse = _interopRequireDefault(require("../model/CreateSubmissionDataRequestTokenResponse"));
24
- var _CreateSubmissionResponse = _interopRequireDefault(require("../model/CreateSubmissionResponse"));
25
- var _CreateWebhookData = _interopRequireDefault(require("../model/CreateWebhookData"));
26
- var _ErrorOrMultipleErrorsResponse = _interopRequireDefault(require("../model/ErrorOrMultipleErrorsResponse"));
8
+ var _AddTemplateFieldsRequest = _interopRequireDefault(require("../model/AddTemplateFieldsRequest"));
9
+ var _AiFieldNamingLanguage = _interopRequireDefault(require("../model/AiFieldNamingLanguage"));
10
+ var _AuthenticationCheck = _interopRequireDefault(require("../model/AuthenticationCheck"));
11
+ var _CombinedPdf = _interopRequireDefault(require("../model/CombinedPdf"));
12
+ var _CombinedPdfList = _interopRequireDefault(require("../model/CombinedPdfList"));
13
+ var _CopyTemplateRequest = _interopRequireDefault(require("../model/CopyTemplateRequest"));
14
+ var _CreateCombinedPdfRequest = _interopRequireDefault(require("../model/CreateCombinedPdfRequest"));
15
+ var _CreateCustomFileFromUploadRequest = _interopRequireDefault(require("../model/CreateCustomFileFromUploadRequest"));
16
+ var _CreateFolderRequest = _interopRequireDefault(require("../model/CreateFolderRequest"));
17
+ var _CreateSignatureRequestEventRequest = _interopRequireDefault(require("../model/CreateSignatureRequestEventRequest"));
18
+ var _CreateSignatureRequestTokenRequest = _interopRequireDefault(require("../model/CreateSignatureRequestTokenRequest"));
19
+ var _CreateSubmissionBatchRequest = _interopRequireDefault(require("../model/CreateSubmissionBatchRequest"));
20
+ var _CreateSubmissionRequest = _interopRequireDefault(require("../model/CreateSubmissionRequest"));
21
+ var _CreateTemplateRequest = _interopRequireDefault(require("../model/CreateTemplateRequest"));
22
+ var _CreateWebhookRequest = _interopRequireDefault(require("../model/CreateWebhookRequest"));
23
+ var _CustomFile = _interopRequireDefault(require("../model/CustomFile"));
24
+ var _CustomFileList = _interopRequireDefault(require("../model/CustomFileList"));
27
25
  var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse"));
26
+ var _FieldSetupLogic = _interopRequireDefault(require("../model/FieldSetupLogic"));
27
+ var _FieldSetupNaming = _interopRequireDefault(require("../model/FieldSetupNaming"));
28
+ var _FieldSetupSource = _interopRequireDefault(require("../model/FieldSetupSource"));
28
29
  var _Folder = _interopRequireDefault(require("../model/Folder"));
29
- var _ForbiddenErrorResponse = _interopRequireDefault(require("../model/ForbiddenErrorResponse"));
30
- var _JsonSchema = _interopRequireDefault(require("../model/JsonSchema"));
31
- var _ListSubmissionsResponse = _interopRequireDefault(require("../model/ListSubmissionsResponse"));
32
- var _MoveFolderData = _interopRequireDefault(require("../model/MoveFolderData"));
33
- var _MoveTemplateData = _interopRequireDefault(require("../model/MoveTemplateData"));
34
- var _MultipleErrorsResponse = _interopRequireDefault(require("../model/MultipleErrorsResponse"));
35
- var _PublishVersionData = _interopRequireDefault(require("../model/PublishVersionData"));
36
- var _RenameFolderData = _interopRequireDefault(require("../model/RenameFolderData"));
37
- var _RestoreVersionData = _interopRequireDefault(require("../model/RestoreVersionData"));
30
+ var _FolderList = _interopRequireDefault(require("../model/FolderList"));
31
+ var _GenerateSubmissionFilesRequest = _interopRequireDefault(require("../model/GenerateSubmissionFilesRequest"));
32
+ var _ModelCodeLanguage = _interopRequireDefault(require("../model/ModelCodeLanguage"));
33
+ var _MoveFolderRequest = _interopRequireDefault(require("../model/MoveFolderRequest"));
34
+ var _MoveTemplateRequest = _interopRequireDefault(require("../model/MoveTemplateRequest"));
35
+ var _PublishTemplateVersionRequest = _interopRequireDefault(require("../model/PublishTemplateVersionRequest"));
36
+ var _RemoveTemplateFieldsRequest = _interopRequireDefault(require("../model/RemoveTemplateFieldsRequest"));
37
+ var _RenameFolderRequest = _interopRequireDefault(require("../model/RenameFolderRequest"));
38
+ var _ReorderTemplateFieldsRequest = _interopRequireDefault(require("../model/ReorderTemplateFieldsRequest"));
39
+ var _RestoreTemplateVersionRequest = _interopRequireDefault(require("../model/RestoreTemplateVersionRequest"));
40
+ var _SignatureRequest = _interopRequireDefault(require("../model/SignatureRequest"));
41
+ var _SignatureRequestEvent = _interopRequireDefault(require("../model/SignatureRequestEvent"));
42
+ var _SignatureRequestToken = _interopRequireDefault(require("../model/SignatureRequestToken"));
38
43
  var _Submission = _interopRequireDefault(require("../model/Submission"));
39
- var _Submission422Response = _interopRequireDefault(require("../model/Submission422Response"));
40
- var _SubmissionBatchData = _interopRequireDefault(require("../model/SubmissionBatchData"));
41
- var _SubmissionBatchWithSubmissions = _interopRequireDefault(require("../model/SubmissionBatchWithSubmissions"));
42
- var _SubmissionDataRequestShow = _interopRequireDefault(require("../model/SubmissionDataRequestShow"));
43
- var _SubmissionPreview = _interopRequireDefault(require("../model/SubmissionPreview"));
44
- var _SuccessErrorResponse = _interopRequireDefault(require("../model/SuccessErrorResponse"));
45
- var _SuccessMultipleErrorsResponse = _interopRequireDefault(require("../model/SuccessMultipleErrorsResponse"));
44
+ var _SubmissionBatch = _interopRequireDefault(require("../model/SubmissionBatch"));
45
+ var _SubmissionList = _interopRequireDefault(require("../model/SubmissionList"));
46
+ var _SubmissionValidation = _interopRequireDefault(require("../model/SubmissionValidation"));
46
47
  var _Template = _interopRequireDefault(require("../model/Template"));
47
- var _TemplateAddFieldsResponse = _interopRequireDefault(require("../model/TemplateAddFieldsResponse"));
48
- var _TemplateDeleteResponse = _interopRequireDefault(require("../model/TemplateDeleteResponse"));
49
- var _TemplateModelCodeResponse = _interopRequireDefault(require("../model/TemplateModelCodeResponse"));
50
- var _TemplatePreview = _interopRequireDefault(require("../model/TemplatePreview"));
51
- var _TemplatePublishVersionResponse = _interopRequireDefault(require("../model/TemplatePublishVersionResponse"));
52
- var _UpdateHtmlTemplate = _interopRequireDefault(require("../model/UpdateHtmlTemplate"));
53
- var _UpdatePdfTemplate = _interopRequireDefault(require("../model/UpdatePdfTemplate"));
54
- var _UpdateSubmissionDataRequestData = _interopRequireDefault(require("../model/UpdateSubmissionDataRequestData"));
55
- var _UpdateWebhookData = _interopRequireDefault(require("../model/UpdateWebhookData"));
56
- var _UploadPresignResponse = _interopRequireDefault(require("../model/UploadPresignResponse"));
48
+ var _TemplateDiff = _interopRequireDefault(require("../model/TemplateDiff"));
49
+ var _TemplateFields = _interopRequireDefault(require("../model/TemplateFields"));
50
+ var _TemplateModelCode = _interopRequireDefault(require("../model/TemplateModelCode"));
51
+ var _TemplatePageImages = _interopRequireDefault(require("../model/TemplatePageImages"));
52
+ var _TemplateSummaryList = _interopRequireDefault(require("../model/TemplateSummaryList"));
53
+ var _TemplateVersion = _interopRequireDefault(require("../model/TemplateVersion"));
54
+ var _UpdateSignatureRequestRequest = _interopRequireDefault(require("../model/UpdateSignatureRequestRequest"));
55
+ var _UpdateTemplateDocumentRequest = _interopRequireDefault(require("../model/UpdateTemplateDocumentRequest"));
56
+ var _UpdateTemplateFieldsRequest = _interopRequireDefault(require("../model/UpdateTemplateFieldsRequest"));
57
+ var _UpdateTemplateRequest = _interopRequireDefault(require("../model/UpdateTemplateRequest"));
58
+ var _UpdateWebhookRequest = _interopRequireDefault(require("../model/UpdateWebhookRequest"));
59
+ var _UploadPresign = _interopRequireDefault(require("../model/UploadPresign"));
60
+ var _ValidateSubmissionRequest = _interopRequireDefault(require("../model/ValidateSubmissionRequest"));
57
61
  var _Webhook = _interopRequireDefault(require("../model/Webhook"));
62
+ var _WebhookEventType = _interopRequireDefault(require("../model/WebhookEventType"));
63
+ var _WebhookList = _interopRequireDefault(require("../model/WebhookList"));
64
+ var _WebhookMode = _interopRequireDefault(require("../model/WebhookMode"));
58
65
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
59
66
  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); }
60
67
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -63,9 +70,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
63
70
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
64
71
  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); } /**
65
72
  * DocSpring API
66
- * Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures. Requests are rate limited per account, and live PDFs use credits: a request over the limit returns 429 with a Retry-After header, and one your credits can't cover returns 402. See [Credits & Rate Limits](https://docspring.com/docs/api-guide/credits-and-rate-limits/).
73
+ * Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
67
74
  *
68
- * The version of the OpenAPI document: v1
75
+ * The version of the OpenAPI document: v2
69
76
  *
70
77
  *
71
78
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -76,7 +83,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
76
83
  /**
77
84
  * Client service.
78
85
  * @module api/Client
79
- * @version 3.3.0
86
+ * @version 4.1.0
80
87
  */
81
88
  var Client = exports["default"] = /*#__PURE__*/function () {
82
89
  /**
@@ -93,13 +100,23 @@ var Client = exports["default"] = /*#__PURE__*/function () {
93
100
  if (options && options.constructor && options.constructor.name === 'ApiClient') {
94
101
  this.apiClient = options;
95
102
  } else {
96
- var _env$DOCSPRING_TOKEN_, _env$DOCSPRING_TOKEN_2;
97
- var apiClient = options.apiClient || _ApiClient["default"].instance;
103
+ // A client given credentials, a host or a region gets its own ApiClient, so two clients don't change each
104
+ // other's. Without them it uses the shared ApiClient.instance.
105
+ var ownApiClient = ['apiTokenId', 'apiTokenSecret', 'host', 'region'].some(function (key) {
106
+ return options[key] !== undefined;
107
+ });
108
+ var apiClient = options.apiClient || (ownApiClient ? new _ApiClient["default"]() : _ApiClient["default"].instance);
98
109
  var env = typeof process !== 'undefined' && process.env ? process.env : {};
99
- var apiTokenId = options.apiTokenId !== undefined ? options.apiTokenId : (_env$DOCSPRING_TOKEN_ = env.DOCSPRING_TOKEN_ID) !== null && _env$DOCSPRING_TOKEN_ !== void 0 ? _env$DOCSPRING_TOKEN_ : null;
100
- var apiTokenSecret = options.apiTokenSecret !== undefined ? options.apiTokenSecret : (_env$DOCSPRING_TOKEN_2 = env.DOCSPRING_TOKEN_SECRET) !== null && _env$DOCSPRING_TOKEN_2 !== void 0 ? _env$DOCSPRING_TOKEN_2 : null;
101
- if (apiTokenId != null && apiTokenSecret != null) {
110
+
111
+ // Use the credentials passed in, or the environment variables. An empty string counts as not set.
112
+ var apiTokenId = options.apiTokenId || env.DOCSPRING_TOKEN_ID || null;
113
+ var apiTokenSecret = options.apiTokenSecret || env.DOCSPRING_TOKEN_SECRET || null;
114
+
115
+ // Without credentials the client is still created, and the API's 401 response says what's missing
116
+ if (apiTokenId != null) {
102
117
  apiClient.authentications['api_token_basic'].username = apiTokenId;
118
+ }
119
+ if (apiTokenSecret != null) {
103
120
  apiClient.authentications['api_token_basic'].password = apiTokenSecret;
104
121
  }
105
122
 
@@ -114,7 +131,8 @@ var Client = exports["default"] = /*#__PURE__*/function () {
114
131
  var url = String(host).trim();
115
132
  if (!/^https?:\/\//i.test(url)) url = "https://".concat(url);
116
133
  url = url.replace(/\/+$/, '');
117
- if (!/\/api\/v1$/i.test(url)) url = "".concat(url, "/api/v1");
134
+ // Any API version's path (such as /api/v1 from a 3.x setup) becomes /api/v2
135
+ url = "".concat(url.replace(/\/api\/v\d+$/i, ''), "/api/v2");
118
136
  apiClient.basePath = url;
119
137
  }
120
138
  this.apiClient = apiClient;
@@ -122,32 +140,23 @@ var Client = exports["default"] = /*#__PURE__*/function () {
122
140
  }
123
141
 
124
142
  /**
125
- * Callback function to receive the result of the addFieldsToTemplate operation.
126
- * @callback module:api/Client~addFieldsToTemplateCallback
127
- * @param {String} error Error message, if any.
128
- * @param {module:model/TemplateAddFieldsResponse} data The data returned by the service call.
129
- * @param {String} response The complete HTTP response.
130
- */
131
-
132
- /**
133
- * Add new fields to a Template
134
- * Adds fields to a PDF template. Configure field types, positions, defaults, and formatting options.
135
- * @param {String} template_id
136
- * @param {module:model/AddFieldsData} data
137
- * @param {module:api/Client~addFieldsToTemplateCallback} callback The callback function, accepting three arguments: error, data, response
138
- * data is of type: {@link module:model/TemplateAddFieldsResponse}
143
+ * Add fields to a template
144
+ * Adds fields to a template's draft and returns all of its fields. Publish a version for submissions of published versions to have them.
145
+ * @param {String} template_id The template's ID.
146
+ * @param {module:model/AddTemplateFieldsRequest} body The fields to add to the template's draft.
147
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateFields} and HTTP response
139
148
  */
140
149
  return _createClass(Client, [{
141
- key: "addFieldsToTemplate",
142
- value: function addFieldsToTemplate(template_id, data, callback) {
143
- var postBody = data;
150
+ key: "addTemplateFieldsWithHttpInfo",
151
+ value: function addTemplateFieldsWithHttpInfo(template_id, body) {
152
+ var postBody = body;
144
153
  // verify the required parameter 'template_id' is set
145
154
  if (template_id === undefined || template_id === null) {
146
- throw new Error("Missing the required parameter 'template_id' when calling addFieldsToTemplate");
155
+ throw new Error("Missing the required parameter 'template_id' when calling addTemplateFields");
147
156
  }
148
- // verify the required parameter 'data' is set
149
- if (data === undefined || data === null) {
150
- throw new Error("Missing the required parameter 'data' when calling addFieldsToTemplate");
157
+ // verify the required parameter 'body' is set
158
+ if (body === undefined || body === null) {
159
+ throw new Error("Missing the required parameter 'body' when calling addTemplateFields");
151
160
  }
152
161
  var pathParams = {
153
162
  'template_id': template_id
@@ -158,144 +167,169 @@ var Client = exports["default"] = /*#__PURE__*/function () {
158
167
  var authNames = ['api_token_basic'];
159
168
  var contentTypes = ['application/json'];
160
169
  var accepts = ['application/json'];
161
- var returnType = _TemplateAddFieldsResponse["default"];
162
- return this.apiClient.callApi('/templates/{template_id}/add_fields', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
170
+ var returnType = _TemplateFields["default"];
171
+ return this.apiClient.callApi('/templates/{template_id}/fields', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
163
172
  }
164
173
 
165
174
  /**
166
- * Callback function to receive the result of the batchGeneratePdfs operation.
167
- * @callback module:api/Client~batchGeneratePdfsCallback
168
- * @param {String} error Error message, if any.
169
- * @param {module:model/BatchGeneratePdfs201Response} data The data returned by the service call.
170
- * @param {String} response The complete HTTP response.
175
+ * Add fields to a template
176
+ * Adds fields to a template's draft and returns all of its fields. Publish a version for submissions of published versions to have them.
177
+ * @param {String} template_id The template's ID.
178
+ * @param {module:model/AddTemplateFieldsRequest} body The fields to add to the template's draft.
179
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateFields}
171
180
  */
181
+ }, {
182
+ key: "addTemplateFields",
183
+ value: function addTemplateFields(template_id, body) {
184
+ return this.addTemplateFieldsWithHttpInfo(template_id, body).then(function (response_and_data) {
185
+ return response_and_data.data;
186
+ });
187
+ }
172
188
 
173
189
  /**
174
- * Generate multiple PDFs
175
- * Generates up to 50 PDFs in a single request. Each submission can use a different template and data. Supports both synchronous (wait for all PDFs) and asynchronous processing. More efficient than individual requests when creating multiple PDFs. Live PDFs use credits. If any live submission is waiting for credits, the API returns 402 and the others are still processed: check each submission's `state`. See [Credits & Rate Limits](https://docspring.com/docs/api-guide/credits-and-rate-limits/). See also: - [Batch Generate PDFs](https://docspring.com/docs/api-guide/generate-pdfs/batch-generate-pdfs/) - Request format, responses, and limits
176
- * @param {module:model/SubmissionBatchData} data
190
+ * Copy a template
191
+ * Copies a template (its draft, or a published version) into a new template.
192
+ * @param {String} template_id The template's ID.
177
193
  * @param {Object} opts Optional parameters
178
- * @param {Boolean} [wait = true)] Wait for submission batch to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
179
- * @param {module:api/Client~batchGeneratePdfsCallback} callback The callback function, accepting three arguments: error, data, response
180
- * data is of type: {@link module:model/BatchGeneratePdfs201Response}
194
+ * @param {module:model/CopyTemplateRequest} [body] Settings for the copy.
195
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
181
196
  */
182
197
  }, {
183
- key: "batchGeneratePdfs",
184
- value: function batchGeneratePdfs(data, opts, callback) {
198
+ key: "copyTemplateWithHttpInfo",
199
+ value: function copyTemplateWithHttpInfo(template_id, opts) {
185
200
  opts = opts || {};
186
- var postBody = data;
187
- // verify the required parameter 'data' is set
188
- if (data === undefined || data === null) {
189
- throw new Error("Missing the required parameter 'data' when calling batchGeneratePdfs");
201
+ var postBody = opts['body'];
202
+ // verify the required parameter 'template_id' is set
203
+ if (template_id === undefined || template_id === null) {
204
+ throw new Error("Missing the required parameter 'template_id' when calling copyTemplate");
190
205
  }
191
- var pathParams = {};
192
- var queryParams = {
193
- 'wait': opts['wait']
206
+ var pathParams = {
207
+ 'template_id': template_id
194
208
  };
209
+ var queryParams = {};
195
210
  var headerParams = {};
196
211
  var formParams = {};
197
212
  var authNames = ['api_token_basic'];
198
213
  var contentTypes = ['application/json'];
199
214
  var accepts = ['application/json'];
200
- var returnType = _BatchGeneratePdfs201Response["default"];
201
- return this.apiClient.callApi('/submissions/batches', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
215
+ var returnType = _Template["default"];
216
+ return this.apiClient.callApi('/templates/{template_id}/copy', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
202
217
  }
203
218
 
204
219
  /**
205
- * Callback function to receive the result of the combinePdfs operation.
206
- * @callback module:api/Client~combinePdfsCallback
207
- * @param {String} error Error message, if any.
208
- * @param {module:model/CreateCombinedSubmissionResponse} data The data returned by the service call.
209
- * @param {String} response The complete HTTP response.
220
+ * Copy a template
221
+ * Copies a template (its draft, or a published version) into a new template.
222
+ * @param {String} template_id The template's ID.
223
+ * @param {Object} opts Optional parameters
224
+ * @param {module:model/CopyTemplateRequest} opts.body Settings for the copy.
225
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
210
226
  */
227
+ }, {
228
+ key: "copyTemplate",
229
+ value: function copyTemplate(template_id, opts) {
230
+ return this.copyTemplateWithHttpInfo(template_id, opts).then(function (response_and_data) {
231
+ return response_and_data.data;
232
+ });
233
+ }
211
234
 
212
235
  /**
213
- * Merge submission PDFs, template PDFs, or custom files
214
- * Combines multiple PDFs from various sources into a single PDF file. Supports merging submission PDFs, template PDFs, custom files, other merged PDFs, and PDFs from URLs. Merges the PDFs in the order provided. Combining uses credits (4 per source PDF, plus 4 per unit of the combined PDF), even with a test API token or watermarked source PDFs. If your balance can't cover it, the API returns 402 and the combined submission waits in the `insufficient_credits` state until you add credits. See [Credits & Rate Limits](https://docspring.com/docs/api-guide/credits-and-rate-limits/).
215
- * @param {module:model/CombinePdfsData} data
216
- * @param {module:api/Client~combinePdfsCallback} callback The callback function, accepting three arguments: error, data, response
217
- * data is of type: {@link module:model/CreateCombinedSubmissionResponse}
236
+ * Combine PDFs
237
+ * Merges PDFs into one: submissions, other combined PDFs, templates, custom files (POST /custom_files) and PDFs from URLs, in the order of `source_pdfs`. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass `wait=false`), otherwise poll GET /combined_pdfs/{combined_pdf_id} until `state` isn't `pending`. A template source merges the template's processed PDF by default: the PDF submissions are filled in on, decrypted and with its form fields removed. Pass `processed: false` to merge the PDF as it was uploaded.
238
+ * @param {module:model/CreateCombinedPdfRequest} body The PDFs to merge, and the combined PDF's settings.
239
+ * @param {Object} opts Optional parameters
240
+ * @param {Boolean} [wait] Wait until the PDF has been generated before responding. Default true on sync.api hosts.
241
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdf} and HTTP response
218
242
  */
219
243
  }, {
220
- key: "combinePdfs",
221
- value: function combinePdfs(data, callback) {
222
- var postBody = data;
223
- // verify the required parameter 'data' is set
224
- if (data === undefined || data === null) {
225
- throw new Error("Missing the required parameter 'data' when calling combinePdfs");
244
+ key: "createCombinedPdfWithHttpInfo",
245
+ value: function createCombinedPdfWithHttpInfo(body, opts) {
246
+ opts = opts || {};
247
+ var postBody = body;
248
+ // verify the required parameter 'body' is set
249
+ if (body === undefined || body === null) {
250
+ throw new Error("Missing the required parameter 'body' when calling createCombinedPdf");
226
251
  }
227
252
  var pathParams = {};
228
- var queryParams = {};
253
+ var queryParams = {
254
+ 'wait': opts['wait']
255
+ };
229
256
  var headerParams = {};
230
257
  var formParams = {};
231
258
  var authNames = ['api_token_basic'];
232
259
  var contentTypes = ['application/json'];
233
260
  var accepts = ['application/json'];
234
- var returnType = _CreateCombinedSubmissionResponse["default"];
235
- return this.apiClient.callApi('/combined_submissions', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
261
+ var returnType = _CombinedPdf["default"];
262
+ return this.apiClient.callApi('/combined_pdfs', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
236
263
  }
237
264
 
238
265
  /**
239
- * Callback function to receive the result of the copyTemplate operation.
240
- * @callback module:api/Client~copyTemplateCallback
241
- * @param {String} error Error message, if any.
242
- * @param {module:model/TemplatePreview} data The data returned by the service call.
243
- * @param {String} response The complete HTTP response.
266
+ * Combine PDFs
267
+ * Merges PDFs into one: submissions, other combined PDFs, templates, custom files (POST /custom_files) and PDFs from URLs, in the order of `source_pdfs`. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass `wait=false`), otherwise poll GET /combined_pdfs/{combined_pdf_id} until `state` isn't `pending`. A template source merges the template's processed PDF by default: the PDF submissions are filled in on, decrypted and with its form fields removed. Pass `processed: false` to merge the PDF as it was uploaded.
268
+ * @param {module:model/CreateCombinedPdfRequest} body The PDFs to merge, and the combined PDF's settings.
269
+ * @param {Object} opts Optional parameters
270
+ * @param {Boolean} opts.wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
271
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdf}
244
272
  */
273
+ }, {
274
+ key: "createCombinedPdf",
275
+ value: function createCombinedPdf(body, opts) {
276
+ return this.createCombinedPdfWithHttpInfo(body, opts).then(function (response_and_data) {
277
+ return response_and_data.data;
278
+ });
279
+ }
245
280
 
246
281
  /**
247
- * Copy a template
248
- * Creates a copy of an existing template with all its fields and configuration. Optionally specify a new name and target folder. The copied template starts as a new draft that can be modified independently of the original.
249
- * @param {String} template_id
250
- * @param {Object} opts Optional parameters
251
- * @param {module:model/CopyTemplateOptions} [options]
252
- * @param {module:api/Client~copyTemplateCallback} callback The callback function, accepting three arguments: error, data, response
253
- * data is of type: {@link module:model/TemplatePreview}
282
+ * Create a custom file from an upload
283
+ * Creates a custom file from a PDF you uploaded, so you can merge it with other PDFs. Upload the file with the presigned upload (GET /uploads/presign) first, then pass its `fields.key` as `cache_id`.
284
+ * @param {module:model/CreateCustomFileFromUploadRequest} body The uploaded file to create the custom file from.
285
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFile} and HTTP response
254
286
  */
255
287
  }, {
256
- key: "copyTemplate",
257
- value: function copyTemplate(template_id, opts, callback) {
258
- opts = opts || {};
259
- var postBody = opts['options'];
260
- // verify the required parameter 'template_id' is set
261
- if (template_id === undefined || template_id === null) {
262
- throw new Error("Missing the required parameter 'template_id' when calling copyTemplate");
288
+ key: "createCustomFileFromUploadWithHttpInfo",
289
+ value: function createCustomFileFromUploadWithHttpInfo(body) {
290
+ var postBody = body;
291
+ // verify the required parameter 'body' is set
292
+ if (body === undefined || body === null) {
293
+ throw new Error("Missing the required parameter 'body' when calling createCustomFileFromUpload");
263
294
  }
264
- var pathParams = {
265
- 'template_id': template_id
266
- };
295
+ var pathParams = {};
267
296
  var queryParams = {};
268
297
  var headerParams = {};
269
298
  var formParams = {};
270
299
  var authNames = ['api_token_basic'];
271
300
  var contentTypes = ['application/json'];
272
301
  var accepts = ['application/json'];
273
- var returnType = _TemplatePreview["default"];
274
- return this.apiClient.callApi('/templates/{template_id}/copy', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
302
+ var returnType = _CustomFile["default"];
303
+ return this.apiClient.callApi('/custom_files', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
275
304
  }
276
305
 
277
306
  /**
278
- * Callback function to receive the result of the createCustomFileFromUpload operation.
279
- * @callback module:api/Client~createCustomFileFromUploadCallback
280
- * @param {String} error Error message, if any.
281
- * @param {module:model/CreateCustomFileResponse} data The data returned by the service call.
282
- * @param {String} response The complete HTTP response.
307
+ * Create a custom file from an upload
308
+ * Creates a custom file from a PDF you uploaded, so you can merge it with other PDFs. Upload the file with the presigned upload (GET /uploads/presign) first, then pass its `fields.key` as `cache_id`.
309
+ * @param {module:model/CreateCustomFileFromUploadRequest} body The uploaded file to create the custom file from.
310
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFile}
283
311
  */
312
+ }, {
313
+ key: "createCustomFileFromUpload",
314
+ value: function createCustomFileFromUpload(body) {
315
+ return this.createCustomFileFromUploadWithHttpInfo(body).then(function (response_and_data) {
316
+ return response_and_data.data;
317
+ });
318
+ }
284
319
 
285
320
  /**
286
- * Create a new custom file from a cached S3 upload
287
- * The Custom Files API endpoint allows you to upload PDFs to DocSpring and then merge them with other PDFs. First upload your file using the presigned URL endpoint, then use the returned cache_id to create the custom file.
288
- * @param {module:model/CreateCustomFileData} data
289
- * @param {module:api/Client~createCustomFileFromUploadCallback} callback The callback function, accepting three arguments: error, data, response
290
- * data is of type: {@link module:model/CreateCustomFileResponse}
321
+ * Create a folder
322
+ * Creates a folder for organizing templates. Pass `parent_folder_id` to create it inside another folder. Folder names are unique within their parent folder.
323
+ * @param {module:model/CreateFolderRequest} body The folder to create.
324
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
291
325
  */
292
326
  }, {
293
- key: "createCustomFileFromUpload",
294
- value: function createCustomFileFromUpload(data, callback) {
295
- var postBody = data;
296
- // verify the required parameter 'data' is set
297
- if (data === undefined || data === null) {
298
- throw new Error("Missing the required parameter 'data' when calling createCustomFileFromUpload");
327
+ key: "createFolderWithHttpInfo",
328
+ value: function createFolderWithHttpInfo(body) {
329
+ var postBody = body;
330
+ // verify the required parameter 'body' is set
331
+ if (body === undefined || body === null) {
332
+ throw new Error("Missing the required parameter 'body' when calling createFolder");
299
333
  }
300
334
  var pathParams = {};
301
335
  var queryParams = {};
@@ -304,40 +338,45 @@ var Client = exports["default"] = /*#__PURE__*/function () {
304
338
  var authNames = ['api_token_basic'];
305
339
  var contentTypes = ['application/json'];
306
340
  var accepts = ['application/json'];
307
- var returnType = _CreateCustomFileResponse["default"];
308
- return this.apiClient.callApi('/custom_files', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
341
+ var returnType = _Folder["default"];
342
+ return this.apiClient.callApi('/folders', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
309
343
  }
310
344
 
311
345
  /**
312
- * Callback function to receive the result of the createDataRequestEvent operation.
313
- * @callback module:api/Client~createDataRequestEventCallback
314
- * @param {String} error Error message, if any.
315
- * @param {module:model/CreateSubmissionDataRequestEventResponse} data The data returned by the service call.
316
- * @param {String} response The complete HTTP response.
346
+ * Create a folder
347
+ * Creates a folder for organizing templates. Pass `parent_folder_id` to create it inside another folder. Folder names are unique within their parent folder.
348
+ * @param {module:model/CreateFolderRequest} body The folder to create.
349
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
317
350
  */
351
+ }, {
352
+ key: "createFolder",
353
+ value: function createFolder(body) {
354
+ return this.createFolderWithHttpInfo(body).then(function (response_and_data) {
355
+ return response_and_data.data;
356
+ });
357
+ }
318
358
 
319
359
  /**
320
- * Create a new event for emailing a signee a request for signature
321
- * Records user notification events for data requests. Use this to create an audit trail showing when and how users were notified about data request forms. Supports email, SMS, and other notification types. Records the notification time for compliance tracking. See also: - [Embedded Data Requests Guide](https://docspring.com/docs/guides/embedded-forms/embedded-data-requests/) - User notification workflow
322
- * @param {String} data_request_id
323
- * @param {module:model/CreateSubmissionDataRequestEventRequest} event
324
- * @param {module:api/Client~createDataRequestEventCallback} callback The callback function, accepting three arguments: error, data, response
325
- * data is of type: {@link module:model/CreateSubmissionDataRequestEventResponse}
360
+ * Record a signature request event
361
+ * Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
362
+ * @param {String} signature_request_id The signature request's ID.
363
+ * @param {module:model/CreateSignatureRequestEventRequest} body The event to record.
364
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequestEvent} and HTTP response
326
365
  */
327
366
  }, {
328
- key: "createDataRequestEvent",
329
- value: function createDataRequestEvent(data_request_id, event, callback) {
330
- var postBody = event;
331
- // verify the required parameter 'data_request_id' is set
332
- if (data_request_id === undefined || data_request_id === null) {
333
- throw new Error("Missing the required parameter 'data_request_id' when calling createDataRequestEvent");
367
+ key: "createSignatureRequestEventWithHttpInfo",
368
+ value: function createSignatureRequestEventWithHttpInfo(signature_request_id, body) {
369
+ var postBody = body;
370
+ // verify the required parameter 'signature_request_id' is set
371
+ if (signature_request_id === undefined || signature_request_id === null) {
372
+ throw new Error("Missing the required parameter 'signature_request_id' when calling createSignatureRequestEvent");
334
373
  }
335
- // verify the required parameter 'event' is set
336
- if (event === undefined || event === null) {
337
- throw new Error("Missing the required parameter 'event' when calling createDataRequestEvent");
374
+ // verify the required parameter 'body' is set
375
+ if (body === undefined || body === null) {
376
+ throw new Error("Missing the required parameter 'body' when calling createSignatureRequestEvent");
338
377
  }
339
378
  var pathParams = {
340
- 'data_request_id': data_request_id
379
+ 'signature_request_id': signature_request_id
341
380
  };
342
381
  var queryParams = {};
343
382
  var headerParams = {};
@@ -345,192 +384,233 @@ var Client = exports["default"] = /*#__PURE__*/function () {
345
384
  var authNames = ['api_token_basic'];
346
385
  var contentTypes = ['application/json'];
347
386
  var accepts = ['application/json'];
348
- var returnType = _CreateSubmissionDataRequestEventResponse["default"];
349
- return this.apiClient.callApi('/data_requests/{data_request_id}/events', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
387
+ var returnType = _SignatureRequestEvent["default"];
388
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}/events', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
350
389
  }
351
390
 
352
391
  /**
353
- * Callback function to receive the result of the createDataRequestToken operation.
354
- * @callback module:api/Client~createDataRequestTokenCallback
355
- * @param {String} error Error message, if any.
356
- * @param {module:model/CreateSubmissionDataRequestTokenResponse} data The data returned by the service call.
357
- * @param {String} response The complete HTTP response.
392
+ * Record a signature request event
393
+ * Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
394
+ * @param {String} signature_request_id The signature request's ID.
395
+ * @param {module:model/CreateSignatureRequestEventRequest} body The event to record.
396
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequestEvent}
358
397
  */
398
+ }, {
399
+ key: "createSignatureRequestEvent",
400
+ value: function createSignatureRequestEvent(signature_request_id, body) {
401
+ return this.createSignatureRequestEventWithHttpInfo(signature_request_id, body).then(function (response_and_data) {
402
+ return response_and_data.data;
403
+ });
404
+ }
359
405
 
360
406
  /**
361
- * Create a new data request token for form authentication
362
- * Creates an authentication token for accessing a data request form. Returns a token and a pre-authenticated URL for the data request form. The token remains valid until the data request is completed. See also: - [Embedded Data Requests Guide](https://docspring.com/docs/guides/embedded-forms/embedded-data-requests/)
363
- * @param {String} data_request_id
407
+ * Create a signature request token
408
+ * Creates a token that opens the signature request without signing in, in a form embedded in your app or from a link you send. The response is the only time the token's secret is returned. The link works for 24 hours, or 7 days for an `email` token, and a signing page that opened in time keeps working for 7 more days. A test API token can't create a token for a live signature request.
409
+ * @param {String} signature_request_id The signature request's ID.
364
410
  * @param {Object} opts Optional parameters
365
- * @param {module:model/String} [type]
366
- * @param {module:api/Client~createDataRequestTokenCallback} callback The callback function, accepting three arguments: error, data, response
367
- * data is of type: {@link module:model/CreateSubmissionDataRequestTokenResponse}
411
+ * @param {module:model/CreateSignatureRequestTokenRequest} [body] The kind of link to make. Send no body for an `api` token.
412
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequestToken} and HTTP response
368
413
  */
369
414
  }, {
370
- key: "createDataRequestToken",
371
- value: function createDataRequestToken(data_request_id, opts, callback) {
415
+ key: "createSignatureRequestTokenWithHttpInfo",
416
+ value: function createSignatureRequestTokenWithHttpInfo(signature_request_id, opts) {
372
417
  opts = opts || {};
373
- var postBody = null;
374
- // verify the required parameter 'data_request_id' is set
375
- if (data_request_id === undefined || data_request_id === null) {
376
- throw new Error("Missing the required parameter 'data_request_id' when calling createDataRequestToken");
418
+ var postBody = opts['body'];
419
+ // verify the required parameter 'signature_request_id' is set
420
+ if (signature_request_id === undefined || signature_request_id === null) {
421
+ throw new Error("Missing the required parameter 'signature_request_id' when calling createSignatureRequestToken");
377
422
  }
378
423
  var pathParams = {
379
- 'data_request_id': data_request_id
380
- };
381
- var queryParams = {
382
- 'type': opts['type']
424
+ 'signature_request_id': signature_request_id
383
425
  };
426
+ var queryParams = {};
384
427
  var headerParams = {};
385
428
  var formParams = {};
386
429
  var authNames = ['api_token_basic'];
387
- var contentTypes = [];
430
+ var contentTypes = ['application/json'];
388
431
  var accepts = ['application/json'];
389
- var returnType = _CreateSubmissionDataRequestTokenResponse["default"];
390
- return this.apiClient.callApi('/data_requests/{data_request_id}/tokens', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
432
+ var returnType = _SignatureRequestToken["default"];
433
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}/tokens', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
391
434
  }
392
435
 
393
436
  /**
394
- * Callback function to receive the result of the createFolder operation.
395
- * @callback module:api/Client~createFolderCallback
396
- * @param {String} error Error message, if any.
397
- * @param {module:model/Folder} data The data returned by the service call.
398
- * @param {String} response The complete HTTP response.
437
+ * Create a signature request token
438
+ * Creates a token that opens the signature request without signing in, in a form embedded in your app or from a link you send. The response is the only time the token's secret is returned. The link works for 24 hours, or 7 days for an `email` token, and a signing page that opened in time keeps working for 7 more days. A test API token can't create a token for a live signature request.
439
+ * @param {String} signature_request_id The signature request's ID.
440
+ * @param {Object} opts Optional parameters
441
+ * @param {module:model/CreateSignatureRequestTokenRequest} opts.body The kind of link to make. Send no body for an `api` token.
442
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequestToken}
399
443
  */
444
+ }, {
445
+ key: "createSignatureRequestToken",
446
+ value: function createSignatureRequestToken(signature_request_id, opts) {
447
+ return this.createSignatureRequestTokenWithHttpInfo(signature_request_id, opts).then(function (response_and_data) {
448
+ return response_and_data.data;
449
+ });
450
+ }
400
451
 
401
452
  /**
402
- * Create a folder
403
- * Creates a new folder for organizing templates. Folders can be nested within other folders by providing a `parent_folder_id`. Folder names must be unique within the same parent.
404
- * @param {module:model/CreateFolderData} data
405
- * @param {module:api/Client~createFolderCallback} callback The callback function, accepting three arguments: error, data, response
406
- * data is of type: {@link module:model/Folder}
453
+ * Generate a PDF
454
+ * Creates a submission: fills in a template with your data and generates a PDF. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until `state` isn't `pending`. Data that doesn't match the template's fields returns a 422 with an `invalid_data` error. The submission is still saved, with its errors, so you can find it in DocSpring: the error's `submission_id` is its ID.
455
+ * @param {String} template_id The template's ID.
456
+ * @param {module:model/CreateSubmissionRequest} body The submission's data and settings.
457
+ * @param {Object} opts Optional parameters
458
+ * @param {String} [version] The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
459
+ * @param {Boolean} [wait] Wait until the files have been generated before responding. Default true on sync.api hosts.
460
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
407
461
  */
408
462
  }, {
409
- key: "createFolder",
410
- value: function createFolder(data, callback) {
411
- var postBody = data;
412
- // verify the required parameter 'data' is set
413
- if (data === undefined || data === null) {
414
- throw new Error("Missing the required parameter 'data' when calling createFolder");
463
+ key: "createSubmissionWithHttpInfo",
464
+ value: function createSubmissionWithHttpInfo(template_id, body, opts) {
465
+ opts = opts || {};
466
+ var postBody = body;
467
+ // verify the required parameter 'template_id' is set
468
+ if (template_id === undefined || template_id === null) {
469
+ throw new Error("Missing the required parameter 'template_id' when calling createSubmission");
415
470
  }
416
- var pathParams = {};
417
- var queryParams = {};
471
+ // verify the required parameter 'body' is set
472
+ if (body === undefined || body === null) {
473
+ throw new Error("Missing the required parameter 'body' when calling createSubmission");
474
+ }
475
+ var pathParams = {
476
+ 'template_id': template_id
477
+ };
478
+ var queryParams = {
479
+ 'version': opts['version'],
480
+ 'wait': opts['wait']
481
+ };
418
482
  var headerParams = {};
419
483
  var formParams = {};
420
484
  var authNames = ['api_token_basic'];
421
485
  var contentTypes = ['application/json'];
422
486
  var accepts = ['application/json'];
423
- var returnType = _Folder["default"];
424
- return this.apiClient.callApi('/folders/', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
487
+ var returnType = _Submission["default"];
488
+ return this.apiClient.callApi('/templates/{template_id}/submissions', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
425
489
  }
426
490
 
427
491
  /**
428
- * Callback function to receive the result of the createHtmlTemplate operation.
429
- * @callback module:api/Client~createHtmlTemplateCallback
430
- * @param {String} error Error message, if any.
431
- * @param {module:model/TemplatePreview} data The data returned by the service call.
432
- * @param {String} response The complete HTTP response.
492
+ * Generate a PDF
493
+ * Creates a submission: fills in a template with your data and generates a PDF. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until `state` isn't `pending`. Data that doesn't match the template's fields returns a 422 with an `invalid_data` error. The submission is still saved, with its errors, so you can find it in DocSpring: the error's `submission_id` is its ID.
494
+ * @param {String} template_id The template's ID.
495
+ * @param {module:model/CreateSubmissionRequest} body The submission's data and settings.
496
+ * @param {Object} opts Optional parameters
497
+ * @param {String} opts.version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
498
+ * @param {Boolean} opts.wait Wait until the files have been generated before responding. Default true on sync.api hosts.
499
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
433
500
  */
501
+ }, {
502
+ key: "createSubmission",
503
+ value: function createSubmission(template_id, body, opts) {
504
+ return this.createSubmissionWithHttpInfo(template_id, body, opts).then(function (response_and_data) {
505
+ return response_and_data.data;
506
+ });
507
+ }
434
508
 
435
509
  /**
436
- * Create a new HTML template
437
- * Creates a new HTML template using HTML, CSS/SCSS, and Liquid templating. Allows complete control over PDF layout and styling. Supports headers, footers, and dynamic content using Liquid syntax for field values, conditions, loops, and filters.
438
- * @param {module:model/CreateHtmlTemplate} data
439
- * @param {module:api/Client~createHtmlTemplateCallback} callback The callback function, accepting three arguments: error, data, response
440
- * data is of type: {@link module:model/TemplatePreview}
510
+ * Generate PDFs in a batch
511
+ * Creates up to 50 submissions in one request, from one template or several. The PDFs are only generated when every submission is valid. On sync.api hosts the request waits until every PDF has been generated (unless you pass `wait=false`), otherwise poll GET /submissions/batches/{submission_batch_id} until `processed_at` is set. When any submission is invalid, nothing is generated and the request returns a 422. Submissions whose data doesn't match their template's fields are still saved with their errors (an `invalid_data` error, with each one's `submission_id` in its details), so you can find them in DocSpring. The other submissions aren't saved.
512
+ * @param {module:model/CreateSubmissionBatchRequest} body The submissions to create, and the settings they share.
513
+ * @param {Object} opts Optional parameters
514
+ * @param {Boolean} [wait] Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
515
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionBatch} and HTTP response
441
516
  */
442
517
  }, {
443
- key: "createHtmlTemplate",
444
- value: function createHtmlTemplate(data, callback) {
445
- var postBody = data;
446
- // verify the required parameter 'data' is set
447
- if (data === undefined || data === null) {
448
- throw new Error("Missing the required parameter 'data' when calling createHtmlTemplate");
518
+ key: "createSubmissionBatchWithHttpInfo",
519
+ value: function createSubmissionBatchWithHttpInfo(body, opts) {
520
+ opts = opts || {};
521
+ var postBody = body;
522
+ // verify the required parameter 'body' is set
523
+ if (body === undefined || body === null) {
524
+ throw new Error("Missing the required parameter 'body' when calling createSubmissionBatch");
449
525
  }
450
526
  var pathParams = {};
451
- var queryParams = {};
527
+ var queryParams = {
528
+ 'wait': opts['wait']
529
+ };
452
530
  var headerParams = {};
453
531
  var formParams = {};
454
532
  var authNames = ['api_token_basic'];
455
533
  var contentTypes = ['application/json'];
456
534
  var accepts = ['application/json'];
457
- var returnType = _TemplatePreview["default"];
458
- return this.apiClient.callApi('/templates?endpoint_variant=create_html_template', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
535
+ var returnType = _SubmissionBatch["default"];
536
+ return this.apiClient.callApi('/submissions/batches', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
459
537
  }
460
538
 
461
539
  /**
462
- * Callback function to receive the result of the createPdfTemplate operation.
463
- * @callback module:api/Client~createPdfTemplateCallback
464
- * @param {String} error Error message, if any.
465
- * @param {module:model/TemplatePreview} data The data returned by the service call.
466
- * @param {String} response The complete HTTP response.
540
+ * Generate PDFs in a batch
541
+ * Creates up to 50 submissions in one request, from one template or several. The PDFs are only generated when every submission is valid. On sync.api hosts the request waits until every PDF has been generated (unless you pass `wait=false`), otherwise poll GET /submissions/batches/{submission_batch_id} until `processed_at` is set. When any submission is invalid, nothing is generated and the request returns a 422. Submissions whose data doesn't match their template's fields are still saved with their errors (an `invalid_data` error, with each one's `submission_id` in its details), so you can find them in DocSpring. The other submissions aren't saved.
542
+ * @param {module:model/CreateSubmissionBatchRequest} body The submissions to create, and the settings they share.
543
+ * @param {Object} opts Optional parameters
544
+ * @param {Boolean} opts.wait Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
545
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionBatch}
467
546
  */
547
+ }, {
548
+ key: "createSubmissionBatch",
549
+ value: function createSubmissionBatch(body, opts) {
550
+ return this.createSubmissionBatchWithHttpInfo(body, opts).then(function (response_and_data) {
551
+ return response_and_data.data;
552
+ });
553
+ }
468
554
 
469
555
  /**
470
- * Create a new PDF template with a form POST file upload
471
- * Creates a new PDF template by uploading a PDF file. The uploaded PDF becomes the foundation for your template, and you can then add fillable fields using the template editor. Use the wait parameter to control whether the request waits for document processing to complete.
472
- * @param {File} template_document
473
- * @param {String} template_name
556
+ * Create a template
557
+ * Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
558
+ * @param {module:model/CreateTemplateRequest} body The template to create.
474
559
  * @param {Object} opts Optional parameters
475
- * @param {Boolean} [wait = true)] Wait for template document to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
476
- * @param {String} [template_description]
477
- * @param {String} [template_parent_folder_id]
478
- * @param {module:api/Client~createPdfTemplateCallback} callback The callback function, accepting three arguments: error, data, response
479
- * data is of type: {@link module:model/TemplatePreview}
560
+ * @param {Boolean} [wait] Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
561
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
480
562
  */
481
563
  }, {
482
- key: "createPdfTemplate",
483
- value: function createPdfTemplate(template_document, template_name, opts, callback) {
564
+ key: "createTemplateWithHttpInfo",
565
+ value: function createTemplateWithHttpInfo(body, opts) {
484
566
  opts = opts || {};
485
- var postBody = null;
486
- // verify the required parameter 'template_document' is set
487
- if (template_document === undefined || template_document === null) {
488
- throw new Error("Missing the required parameter 'template_document' when calling createPdfTemplate");
489
- }
490
- // verify the required parameter 'template_name' is set
491
- if (template_name === undefined || template_name === null) {
492
- throw new Error("Missing the required parameter 'template_name' when calling createPdfTemplate");
567
+ var postBody = body;
568
+ // verify the required parameter 'body' is set
569
+ if (body === undefined || body === null) {
570
+ throw new Error("Missing the required parameter 'body' when calling createTemplate");
493
571
  }
494
572
  var pathParams = {};
495
573
  var queryParams = {
496
574
  'wait': opts['wait']
497
575
  };
498
576
  var headerParams = {};
499
- var formParams = {
500
- 'template[document]': template_document,
501
- 'template[name]': template_name,
502
- 'template[description]': opts['template_description'],
503
- 'template[parent_folder_id]': opts['template_parent_folder_id']
504
- };
577
+ var formParams = {};
505
578
  var authNames = ['api_token_basic'];
506
- var contentTypes = ['multipart/form-data'];
579
+ var contentTypes = ['application/json'];
507
580
  var accepts = ['application/json'];
508
- var returnType = _TemplatePreview["default"];
509
- return this.apiClient.callApi('/templates', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
581
+ var returnType = _Template["default"];
582
+ return this.apiClient.callApi('/templates', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
510
583
  }
511
584
 
512
585
  /**
513
- * Callback function to receive the result of the createPdfTemplateFromUpload operation.
514
- * @callback module:api/Client~createPdfTemplateFromUploadCallback
515
- * @param {String} error Error message, if any.
516
- * @param {module:model/TemplatePreview} data The data returned by the service call.
517
- * @param {String} response The complete HTTP response.
586
+ * Create a template
587
+ * Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
588
+ * @param {module:model/CreateTemplateRequest} body The template to create.
589
+ * @param {Object} opts Optional parameters
590
+ * @param {Boolean} opts.wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
591
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
518
592
  */
593
+ }, {
594
+ key: "createTemplate",
595
+ value: function createTemplate(body, opts) {
596
+ return this.createTemplateWithHttpInfo(body, opts).then(function (response_and_data) {
597
+ return response_and_data.data;
598
+ });
599
+ }
519
600
 
520
601
  /**
521
- * Create a new PDF template from a cached S3 file upload
522
- * Creates a new PDF template from a file previously uploaded to S3 using a presigned URL. This two-step process allows for more reliable large file uploads by first uploading the file to S3, then creating the template using the cached upload ID.
523
- * @param {module:model/CreatePdfTemplate} data
524
- * @param {module:api/Client~createPdfTemplateFromUploadCallback} callback The callback function, accepting three arguments: error, data, response
525
- * data is of type: {@link module:model/TemplatePreview}
602
+ * Create a webhook
603
+ * Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.
604
+ * @param {module:model/CreateWebhookRequest} body The webhook to create.
605
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
526
606
  */
527
607
  }, {
528
- key: "createPdfTemplateFromUpload",
529
- value: function createPdfTemplateFromUpload(data, callback) {
530
- var postBody = data;
531
- // verify the required parameter 'data' is set
532
- if (data === undefined || data === null) {
533
- throw new Error("Missing the required parameter 'data' when calling createPdfTemplateFromUpload");
608
+ key: "createWebhookWithHttpInfo",
609
+ value: function createWebhookWithHttpInfo(body) {
610
+ var postBody = body;
611
+ // verify the required parameter 'body' is set
612
+ if (body === undefined || body === null) {
613
+ throw new Error("Missing the required parameter 'body' when calling createWebhook");
534
614
  }
535
615
  var pathParams = {};
536
616
  var queryParams = {};
@@ -539,62 +619,74 @@ var Client = exports["default"] = /*#__PURE__*/function () {
539
619
  var authNames = ['api_token_basic'];
540
620
  var contentTypes = ['application/json'];
541
621
  var accepts = ['application/json'];
542
- var returnType = _TemplatePreview["default"];
543
- return this.apiClient.callApi('/templates?endpoint_variant=create_template_from_cached_upload', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
622
+ var returnType = _Webhook["default"];
623
+ return this.apiClient.callApi('/webhooks', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
544
624
  }
545
625
 
546
626
  /**
547
- * Callback function to receive the result of the createWebhook operation.
548
- * @callback module:api/Client~createWebhookCallback
549
- * @param {String} error Error message, if any.
550
- * @param {module:model/Webhook} data The data returned by the service call.
551
- * @param {String} response The complete HTTP response.
627
+ * Create a webhook
628
+ * Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.
629
+ * @param {module:model/CreateWebhookRequest} body The webhook to create.
630
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
552
631
  */
632
+ }, {
633
+ key: "createWebhook",
634
+ value: function createWebhook(body) {
635
+ return this.createWebhookWithHttpInfo(body).then(function (response_and_data) {
636
+ return response_and_data.data;
637
+ });
638
+ }
553
639
 
554
640
  /**
555
- * Create a webhook
556
- * Creates a webhook that delivers a POST request to your endpoint whenever a subscribed event occurs. Optionally scope the webhook to specific API tokens, templates, or folders.
557
- * @param {module:model/CreateWebhookData} data
558
- * @param {module:api/Client~createWebhookCallback} callback The callback function, accepting three arguments: error, data, response
559
- * data is of type: {@link module:model/Webhook}
641
+ * Delete a custom file
642
+ * Deletes a custom file and returns it. Use a live API token: test tokens can't delete custom files.
643
+ * @param {String} custom_file_id The custom file's ID.
644
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFile} and HTTP response
560
645
  */
561
646
  }, {
562
- key: "createWebhook",
563
- value: function createWebhook(data, callback) {
564
- var postBody = data;
565
- // verify the required parameter 'data' is set
566
- if (data === undefined || data === null) {
567
- throw new Error("Missing the required parameter 'data' when calling createWebhook");
647
+ key: "deleteCustomFileWithHttpInfo",
648
+ value: function deleteCustomFileWithHttpInfo(custom_file_id) {
649
+ var postBody = null;
650
+ // verify the required parameter 'custom_file_id' is set
651
+ if (custom_file_id === undefined || custom_file_id === null) {
652
+ throw new Error("Missing the required parameter 'custom_file_id' when calling deleteCustomFile");
568
653
  }
569
- var pathParams = {};
654
+ var pathParams = {
655
+ 'custom_file_id': custom_file_id
656
+ };
570
657
  var queryParams = {};
571
658
  var headerParams = {};
572
659
  var formParams = {};
573
660
  var authNames = ['api_token_basic'];
574
- var contentTypes = ['application/json'];
661
+ var contentTypes = [];
575
662
  var accepts = ['application/json'];
576
- var returnType = _Webhook["default"];
577
- return this.apiClient.callApi('/webhooks', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
663
+ var returnType = _CustomFile["default"];
664
+ return this.apiClient.callApi('/custom_files/{custom_file_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
578
665
  }
579
666
 
580
667
  /**
581
- * Callback function to receive the result of the deleteFolder operation.
582
- * @callback module:api/Client~deleteFolderCallback
583
- * @param {String} error Error message, if any.
584
- * @param {module:model/Folder} data The data returned by the service call.
585
- * @param {String} response The complete HTTP response.
668
+ * Delete a custom file
669
+ * Deletes a custom file and returns it. Use a live API token: test tokens can't delete custom files.
670
+ * @param {String} custom_file_id The custom file's ID.
671
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFile}
586
672
  */
673
+ }, {
674
+ key: "deleteCustomFile",
675
+ value: function deleteCustomFile(custom_file_id) {
676
+ return this.deleteCustomFileWithHttpInfo(custom_file_id).then(function (response_and_data) {
677
+ return response_and_data.data;
678
+ });
679
+ }
587
680
 
588
681
  /**
589
682
  * Delete a folder
590
- * Deletes an empty folder. The folder must not contain any templates or subfolders. Move or delete all contents before attempting to delete the folder.
591
- * @param {String} folder_id
592
- * @param {module:api/Client~deleteFolderCallback} callback The callback function, accepting three arguments: error, data, response
593
- * data is of type: {@link module:model/Folder}
683
+ * Deletes an empty folder and returns it. A folder that still has templates or folders in it can't be deleted.
684
+ * @param {String} folder_id The folder's ID.
685
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
594
686
  */
595
687
  }, {
596
- key: "deleteFolder",
597
- value: function deleteFolder(folder_id, callback) {
688
+ key: "deleteFolderWithHttpInfo",
689
+ value: function deleteFolderWithHttpInfo(folder_id) {
598
690
  var postBody = null;
599
691
  // verify the required parameter 'folder_id' is set
600
692
  if (folder_id === undefined || folder_id === null) {
@@ -610,29 +702,34 @@ var Client = exports["default"] = /*#__PURE__*/function () {
610
702
  var contentTypes = [];
611
703
  var accepts = ['application/json'];
612
704
  var returnType = _Folder["default"];
613
- return this.apiClient.callApi('/folders/{folder_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
705
+ return this.apiClient.callApi('/folders/{folder_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
614
706
  }
615
707
 
616
708
  /**
617
- * Callback function to receive the result of the deleteTemplate operation.
618
- * @callback module:api/Client~deleteTemplateCallback
619
- * @param {String} error Error message, if any.
620
- * @param {module:model/TemplateDeleteResponse} data The data returned by the service call.
621
- * @param {String} response The complete HTTP response.
709
+ * Delete a folder
710
+ * Deletes an empty folder and returns it. A folder that still has templates or folders in it can't be deleted.
711
+ * @param {String} folder_id The folder's ID.
712
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
622
713
  */
714
+ }, {
715
+ key: "deleteFolder",
716
+ value: function deleteFolder(folder_id) {
717
+ return this.deleteFolderWithHttpInfo(folder_id).then(function (response_and_data) {
718
+ return response_and_data.data;
719
+ });
720
+ }
623
721
 
624
722
  /**
625
723
  * Delete a template
626
- * Deletes a template or a specific template version. When no version is specified, deletes the entire template including all versions. When a version is specified, deletes only that version while preserving others. Returns remaining version information.
627
- * @param {String} template_id
724
+ * Deletes a template's draft and all of its published versions, or one published version (`version`). Returns the template as it was before it was deleted.
725
+ * @param {String} template_id The template's ID.
628
726
  * @param {Object} opts Optional parameters
629
- * @param {String} [version]
630
- * @param {module:api/Client~deleteTemplateCallback} callback The callback function, accepting three arguments: error, data, response
631
- * data is of type: {@link module:model/TemplateDeleteResponse}
727
+ * @param {String} [version] Delete only this published version (`1.2.0`) or the draft (`draft`, when no version has been published). Without it, the draft and every published version are deleted.
728
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
632
729
  */
633
730
  }, {
634
- key: "deleteTemplate",
635
- value: function deleteTemplate(template_id, opts, callback) {
731
+ key: "deleteTemplateWithHttpInfo",
732
+ value: function deleteTemplateWithHttpInfo(template_id, opts) {
636
733
  opts = opts || {};
637
734
  var postBody = null;
638
735
  // verify the required parameter 'template_id' is set
@@ -650,28 +747,35 @@ var Client = exports["default"] = /*#__PURE__*/function () {
650
747
  var authNames = ['api_token_basic'];
651
748
  var contentTypes = [];
652
749
  var accepts = ['application/json'];
653
- var returnType = _TemplateDeleteResponse["default"];
654
- return this.apiClient.callApi('/templates/{template_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
750
+ var returnType = _Template["default"];
751
+ return this.apiClient.callApi('/templates/{template_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
655
752
  }
656
753
 
657
754
  /**
658
- * Callback function to receive the result of the deleteWebhook operation.
659
- * @callback module:api/Client~deleteWebhookCallback
660
- * @param {String} error Error message, if any.
661
- * @param {module:model/Webhook} data The data returned by the service call.
662
- * @param {String} response The complete HTTP response.
755
+ * Delete a template
756
+ * Deletes a template's draft and all of its published versions, or one published version (`version`). Returns the template as it was before it was deleted.
757
+ * @param {String} template_id The template's ID.
758
+ * @param {Object} opts Optional parameters
759
+ * @param {String} opts.version Delete only this published version (`1.2.0`) or the draft (`draft`, when no version has been published). Without it, the draft and every published version are deleted.
760
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
663
761
  */
762
+ }, {
763
+ key: "deleteTemplate",
764
+ value: function deleteTemplate(template_id, opts) {
765
+ return this.deleteTemplateWithHttpInfo(template_id, opts).then(function (response_and_data) {
766
+ return response_and_data.data;
767
+ });
768
+ }
664
769
 
665
770
  /**
666
771
  * Delete a webhook
667
- * Permanently deletes a webhook so it stops receiving events, and returns the deleted webhook.
668
- * @param {String} webhook_id
669
- * @param {module:api/Client~deleteWebhookCallback} callback The callback function, accepting three arguments: error, data, response
670
- * data is of type: {@link module:model/Webhook}
772
+ * Deletes a webhook so it stops receiving events, and returns it.
773
+ * @param {String} webhook_id The webhook's ID.
774
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
671
775
  */
672
776
  }, {
673
- key: "deleteWebhook",
674
- value: function deleteWebhook(webhook_id, callback) {
777
+ key: "deleteWebhookWithHttpInfo",
778
+ value: function deleteWebhookWithHttpInfo(webhook_id) {
675
779
  var postBody = null;
676
780
  // verify the required parameter 'webhook_id' is set
677
781
  if (webhook_id === undefined || webhook_id === null) {
@@ -687,34 +791,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
687
791
  var contentTypes = [];
688
792
  var accepts = ['application/json'];
689
793
  var returnType = _Webhook["default"];
690
- return this.apiClient.callApi('/webhooks/{webhook_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
794
+ return this.apiClient.callApi('/webhooks/{webhook_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
691
795
  }
692
796
 
693
797
  /**
694
- * Callback function to receive the result of the expireCombinedSubmission operation.
695
- * @callback module:api/Client~expireCombinedSubmissionCallback
696
- * @param {String} error Error message, if any.
697
- * @param {module:model/CombinedSubmission} data The data returned by the service call.
698
- * @param {String} response The complete HTTP response.
798
+ * Delete a webhook
799
+ * Deletes a webhook so it stops receiving events, and returns it.
800
+ * @param {String} webhook_id The webhook's ID.
801
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
699
802
  */
803
+ }, {
804
+ key: "deleteWebhook",
805
+ value: function deleteWebhook(webhook_id) {
806
+ return this.deleteWebhookWithHttpInfo(webhook_id).then(function (response_and_data) {
807
+ return response_and_data.data;
808
+ });
809
+ }
700
810
 
701
811
  /**
702
- * Expire a combined submission
703
- * Expiring a combined submission deletes the PDF from our system. This is useful for invalidating sensitive documents.
704
- * @param {String} combined_submission_id
705
- * @param {module:api/Client~expireCombinedSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
706
- * data is of type: {@link module:model/CombinedSubmission}
812
+ * Expire a combined PDF
813
+ * Deletes a combined PDF's PDF and returns the expired combined PDF.
814
+ * @param {String} combined_pdf_id The combined PDF's ID.
815
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdf} and HTTP response
707
816
  */
708
817
  }, {
709
- key: "expireCombinedSubmission",
710
- value: function expireCombinedSubmission(combined_submission_id, callback) {
818
+ key: "expireCombinedPdfWithHttpInfo",
819
+ value: function expireCombinedPdfWithHttpInfo(combined_pdf_id) {
711
820
  var postBody = null;
712
- // verify the required parameter 'combined_submission_id' is set
713
- if (combined_submission_id === undefined || combined_submission_id === null) {
714
- throw new Error("Missing the required parameter 'combined_submission_id' when calling expireCombinedSubmission");
821
+ // verify the required parameter 'combined_pdf_id' is set
822
+ if (combined_pdf_id === undefined || combined_pdf_id === null) {
823
+ throw new Error("Missing the required parameter 'combined_pdf_id' when calling expireCombinedPdf");
715
824
  }
716
825
  var pathParams = {
717
- 'combined_submission_id': combined_submission_id
826
+ 'combined_pdf_id': combined_pdf_id
718
827
  };
719
828
  var queryParams = {};
720
829
  var headerParams = {};
@@ -722,28 +831,33 @@ var Client = exports["default"] = /*#__PURE__*/function () {
722
831
  var authNames = ['api_token_basic'];
723
832
  var contentTypes = [];
724
833
  var accepts = ['application/json'];
725
- var returnType = _CombinedSubmission["default"];
726
- return this.apiClient.callApi('/combined_submissions/{combined_submission_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
834
+ var returnType = _CombinedPdf["default"];
835
+ return this.apiClient.callApi('/combined_pdfs/{combined_pdf_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
727
836
  }
728
837
 
729
838
  /**
730
- * Callback function to receive the result of the expireSubmission operation.
731
- * @callback module:api/Client~expireSubmissionCallback
732
- * @param {String} error Error message, if any.
733
- * @param {module:model/SubmissionPreview} data The data returned by the service call.
734
- * @param {String} response The complete HTTP response.
839
+ * Expire a combined PDF
840
+ * Deletes a combined PDF's PDF and returns the expired combined PDF.
841
+ * @param {String} combined_pdf_id The combined PDF's ID.
842
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdf}
735
843
  */
844
+ }, {
845
+ key: "expireCombinedPdf",
846
+ value: function expireCombinedPdf(combined_pdf_id) {
847
+ return this.expireCombinedPdfWithHttpInfo(combined_pdf_id).then(function (response_and_data) {
848
+ return response_and_data.data;
849
+ });
850
+ }
736
851
 
737
852
  /**
738
- * Expire a PDF submission
739
- * Expiring a PDF submission deletes the PDF and removes the data from our database. This is useful for invalidating sensitive documents after they've been downloaded. You can also [configure a data retention policy for your submissions](https://docspring.com/docs/template-editor/settings/#expire-submissions) so that they automatically expire.
740
- * @param {String} submission_id
741
- * @param {module:api/Client~expireSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
742
- * data is of type: {@link module:model/SubmissionPreview}
853
+ * Expire a submission
854
+ * Deletes a submission's data and PDF now, and returns the expired submission.
855
+ * @param {String} submission_id The submission's ID.
856
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
743
857
  */
744
858
  }, {
745
- key: "expireSubmission",
746
- value: function expireSubmission(submission_id, callback) {
859
+ key: "expireSubmissionWithHttpInfo",
860
+ value: function expireSubmissionWithHttpInfo(submission_id) {
747
861
  var postBody = null;
748
862
  // verify the required parameter 'submission_id' is set
749
863
  if (submission_id === undefined || submission_id === null) {
@@ -758,43 +872,48 @@ var Client = exports["default"] = /*#__PURE__*/function () {
758
872
  var authNames = ['api_token_basic'];
759
873
  var contentTypes = [];
760
874
  var accepts = ['application/json'];
761
- var returnType = _SubmissionPreview["default"];
762
- return this.apiClient.callApi('/submissions/{submission_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
875
+ var returnType = _Submission["default"];
876
+ return this.apiClient.callApi('/submissions/{submission_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
763
877
  }
764
878
 
765
879
  /**
766
- * Callback function to receive the result of the generatePdf operation.
767
- * @callback module:api/Client~generatePdfCallback
768
- * @param {String} error Error message, if any.
769
- * @param {module:model/CreateSubmissionResponse} data The data returned by the service call.
770
- * @param {String} response The complete HTTP response.
880
+ * Expire a submission
881
+ * Deletes a submission's data and PDF now, and returns the expired submission.
882
+ * @param {String} submission_id The submission's ID.
883
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
771
884
  */
885
+ }, {
886
+ key: "expireSubmission",
887
+ value: function expireSubmission(submission_id) {
888
+ return this.expireSubmissionWithHttpInfo(submission_id).then(function (response_and_data) {
889
+ return response_and_data.data;
890
+ });
891
+ }
772
892
 
773
893
  /**
774
- * Generate a PDF
775
- * Creates a PDF submission by filling in a template with data. Supports both synchronous (default) and asynchronous processing. Add the `wait=false` query parameter to return immediately. Live PDFs use credits; test PDFs (`test: true`) are free and watermarked. If your balance can't cover a live PDF, the API returns 402 and the submission waits in the `insufficient_credits` state until you add credits. See [Credits & Rate Limits](https://docspring.com/docs/api-guide/credits-and-rate-limits/). See also: - [Customize the PDF Title and Filename](https://docspring.com/docs/api-guide/generate-pdfs/customize-pdf-title-and-filename/) - Set custom metadata - [Handling Truncated Text](https://docspring.com/docs/api-guide/generate-pdfs/handle-truncated-text/) - Handle text that doesn't fit in fields
776
- * @param {String} template_id
777
- * @param {module:model/CreatePdfSubmissionData} submission
894
+ * Generate more files
895
+ * Adds formats to a processed submission's files, in the background: `png`, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
896
+ * @param {String} submission_id The submission's ID.
897
+ * @param {module:model/GenerateSubmissionFilesRequest} body The formats to make.
778
898
  * @param {Object} opts Optional parameters
779
- * @param {Boolean} [wait = true)] Wait for submission to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
780
- * @param {module:api/Client~generatePdfCallback} callback The callback function, accepting three arguments: error, data, response
781
- * data is of type: {@link module:model/CreateSubmissionResponse}
899
+ * @param {Boolean} [wait] Wait until the files have been generated before responding. Default true on sync.api hosts.
900
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
782
901
  */
783
902
  }, {
784
- key: "generatePdf",
785
- value: function generatePdf(template_id, submission, opts, callback) {
903
+ key: "generateSubmissionFilesWithHttpInfo",
904
+ value: function generateSubmissionFilesWithHttpInfo(submission_id, body, opts) {
786
905
  opts = opts || {};
787
- var postBody = submission;
788
- // verify the required parameter 'template_id' is set
789
- if (template_id === undefined || template_id === null) {
790
- throw new Error("Missing the required parameter 'template_id' when calling generatePdf");
906
+ var postBody = body;
907
+ // verify the required parameter 'submission_id' is set
908
+ if (submission_id === undefined || submission_id === null) {
909
+ throw new Error("Missing the required parameter 'submission_id' when calling generateSubmissionFiles");
791
910
  }
792
- // verify the required parameter 'submission' is set
793
- if (submission === undefined || submission === null) {
794
- throw new Error("Missing the required parameter 'submission' when calling generatePdf");
911
+ // verify the required parameter 'body' is set
912
+ if (body === undefined || body === null) {
913
+ throw new Error("Missing the required parameter 'body' when calling generateSubmissionFiles");
795
914
  }
796
915
  var pathParams = {
797
- 'template_id': template_id
916
+ 'submission_id': submission_id
798
917
  };
799
918
  var queryParams = {
800
919
  'wait': opts['wait']
@@ -804,32 +923,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
804
923
  var authNames = ['api_token_basic'];
805
924
  var contentTypes = ['application/json'];
806
925
  var accepts = ['application/json'];
807
- var returnType = _CreateSubmissionResponse["default"];
808
- return this.apiClient.callApi('/templates/{template_id}/submissions', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
926
+ var returnType = _Submission["default"];
927
+ return this.apiClient.callApi('/submissions/{submission_id}/generate_files', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
809
928
  }
810
929
 
811
930
  /**
812
- * Callback function to receive the result of the generatePreview operation.
813
- * @callback module:api/Client~generatePreviewCallback
814
- * @param {String} error Error message, if any.
815
- * @param {module:model/SuccessErrorResponse} data The data returned by the service call.
816
- * @param {String} response The complete HTTP response.
931
+ * Generate more files
932
+ * Adds formats to a processed submission's files, in the background: `png`, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
933
+ * @param {String} submission_id The submission's ID.
934
+ * @param {module:model/GenerateSubmissionFilesRequest} body The formats to make.
935
+ * @param {Object} opts Optional parameters
936
+ * @param {Boolean} opts.wait Wait until the files have been generated before responding. Default true on sync.api hosts.
937
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
817
938
  */
939
+ }, {
940
+ key: "generateSubmissionFiles",
941
+ value: function generateSubmissionFiles(submission_id, body, opts) {
942
+ return this.generateSubmissionFilesWithHttpInfo(submission_id, body, opts).then(function (response_and_data) {
943
+ return response_and_data.data;
944
+ });
945
+ }
818
946
 
819
947
  /**
820
- * Generate a preview PDF for partially completed data requests
821
- * Generates a preview PDF for a submission with partially completed data requests. Useful for showing users what the final document will look like before all signatures or data have been collected. The preview includes any data collected so far.
822
- * @param {String} submission_id
823
- * @param {module:api/Client~generatePreviewCallback} callback The callback function, accepting three arguments: error, data, response
824
- * data is of type: {@link module:model/SuccessErrorResponse}
948
+ * Generate a preview PDF
949
+ * Generates a preview of a submission's PDF in the background, such as for a submission still waiting for its signature requests. It's in `files.preview` once `preview_generated_at` changes.
950
+ * @param {String} submission_id The submission's ID.
951
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
825
952
  */
826
953
  }, {
827
- key: "generatePreview",
828
- value: function generatePreview(submission_id, callback) {
954
+ key: "generateSubmissionPreviewWithHttpInfo",
955
+ value: function generateSubmissionPreviewWithHttpInfo(submission_id) {
829
956
  var postBody = null;
830
957
  // verify the required parameter 'submission_id' is set
831
958
  if (submission_id === undefined || submission_id === null) {
832
- throw new Error("Missing the required parameter 'submission_id' when calling generatePreview");
959
+ throw new Error("Missing the required parameter 'submission_id' when calling generateSubmissionPreview");
833
960
  }
834
961
  var pathParams = {
835
962
  'submission_id': submission_id
@@ -840,35 +967,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
840
967
  var authNames = ['api_token_basic'];
841
968
  var contentTypes = [];
842
969
  var accepts = ['application/json'];
843
- var returnType = _SuccessErrorResponse["default"];
844
- return this.apiClient.callApi('/submissions/{submission_id}/generate_preview', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
970
+ var returnType = _Submission["default"];
971
+ return this.apiClient.callApi('/submissions/{submission_id}/generate_preview', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
845
972
  }
846
973
 
847
974
  /**
848
- * Callback function to receive the result of the getCombinedSubmission operation.
849
- * @callback module:api/Client~getCombinedSubmissionCallback
850
- * @param {String} error Error message, if any.
851
- * @param {module:model/CombinedSubmission} data The data returned by the service call.
852
- * @param {String} response The complete HTTP response.
975
+ * Generate a preview PDF
976
+ * Generates a preview of a submission's PDF in the background, such as for a submission still waiting for its signature requests. It's in `files.preview` once `preview_generated_at` changes.
977
+ * @param {String} submission_id The submission's ID.
978
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
853
979
  */
980
+ }, {
981
+ key: "generateSubmissionPreview",
982
+ value: function generateSubmissionPreview(submission_id) {
983
+ return this.generateSubmissionPreviewWithHttpInfo(submission_id).then(function (response_and_data) {
984
+ return response_and_data.data;
985
+ });
986
+ }
854
987
 
855
988
  /**
856
- * Check the status of a combined submission (merged PDFs)
857
- * Retrieves the details and status of a combined submission. Returns processing state, download URL (if processed), metadata, and information about any integrated actions (e.g., S3 uploads). `insufficient_credits` means the combined submission is waiting for credits and is processed once you add them. If it's still waiting after 30 days, it moves to `error`.
858
- * @param {String} combined_submission_id
859
- * @param {module:api/Client~getCombinedSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
860
- * data is of type: {@link module:model/CombinedSubmission}
989
+ * Get a combined PDF
990
+ * Returns a combined PDF, with a temporary link to download it once it has been generated.
991
+ * @param {String} combined_pdf_id The combined PDF's ID.
992
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdf} and HTTP response
861
993
  */
862
994
  }, {
863
- key: "getCombinedSubmission",
864
- value: function getCombinedSubmission(combined_submission_id, callback) {
995
+ key: "getCombinedPdfWithHttpInfo",
996
+ value: function getCombinedPdfWithHttpInfo(combined_pdf_id) {
865
997
  var postBody = null;
866
- // verify the required parameter 'combined_submission_id' is set
867
- if (combined_submission_id === undefined || combined_submission_id === null) {
868
- throw new Error("Missing the required parameter 'combined_submission_id' when calling getCombinedSubmission");
998
+ // verify the required parameter 'combined_pdf_id' is set
999
+ if (combined_pdf_id === undefined || combined_pdf_id === null) {
1000
+ throw new Error("Missing the required parameter 'combined_pdf_id' when calling getCombinedPdf");
869
1001
  }
870
1002
  var pathParams = {
871
- 'combined_submission_id': combined_submission_id
1003
+ 'combined_pdf_id': combined_pdf_id
872
1004
  };
873
1005
  var queryParams = {};
874
1006
  var headerParams = {};
@@ -876,35 +1008,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
876
1008
  var authNames = ['api_token_basic'];
877
1009
  var contentTypes = [];
878
1010
  var accepts = ['application/json'];
879
- var returnType = _CombinedSubmission["default"];
880
- return this.apiClient.callApi('/combined_submissions/{combined_submission_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1011
+ var returnType = _CombinedPdf["default"];
1012
+ return this.apiClient.callApi('/combined_pdfs/{combined_pdf_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
881
1013
  }
882
1014
 
883
1015
  /**
884
- * Callback function to receive the result of the getDataRequest operation.
885
- * @callback module:api/Client~getDataRequestCallback
886
- * @param {String} error Error message, if any.
887
- * @param {module:model/SubmissionDataRequestShow} data The data returned by the service call.
888
- * @param {String} response The complete HTTP response.
1016
+ * Get a combined PDF
1017
+ * Returns a combined PDF, with a temporary link to download it once it has been generated.
1018
+ * @param {String} combined_pdf_id The combined PDF's ID.
1019
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdf}
889
1020
  */
1021
+ }, {
1022
+ key: "getCombinedPdf",
1023
+ value: function getCombinedPdf(combined_pdf_id) {
1024
+ return this.getCombinedPdfWithHttpInfo(combined_pdf_id).then(function (response_and_data) {
1025
+ return response_and_data.data;
1026
+ });
1027
+ }
890
1028
 
891
1029
  /**
892
- * Look up a submission data request
893
- * Retrieves the details and status of a data request. Returns information about the request state (pending, viewed, completed), authentication details, and metadata. Includes audit information like IP address, browseruser agent, and timestamps. See also: - [Embedded Data Requests Guide](https://docspring.com/docs/guides/embedded-forms/embedded-data-requests/) - Complete guide to data request workflow
894
- * @param {String} data_request_id
895
- * @param {module:api/Client~getDataRequestCallback} callback The callback function, accepting three arguments: error, data, response
896
- * data is of type: {@link module:model/SubmissionDataRequestShow}
1030
+ * Get a custom file
1031
+ * Returns a custom file, with a temporary URL to download it.
1032
+ * @param {String} custom_file_id The custom file's ID.
1033
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFile} and HTTP response
897
1034
  */
898
1035
  }, {
899
- key: "getDataRequest",
900
- value: function getDataRequest(data_request_id, callback) {
1036
+ key: "getCustomFileWithHttpInfo",
1037
+ value: function getCustomFileWithHttpInfo(custom_file_id) {
901
1038
  var postBody = null;
902
- // verify the required parameter 'data_request_id' is set
903
- if (data_request_id === undefined || data_request_id === null) {
904
- throw new Error("Missing the required parameter 'data_request_id' when calling getDataRequest");
1039
+ // verify the required parameter 'custom_file_id' is set
1040
+ if (custom_file_id === undefined || custom_file_id === null) {
1041
+ throw new Error("Missing the required parameter 'custom_file_id' when calling getCustomFile");
905
1042
  }
906
1043
  var pathParams = {
907
- 'data_request_id': data_request_id
1044
+ 'custom_file_id': custom_file_id
908
1045
  };
909
1046
  var queryParams = {};
910
1047
  var headerParams = {};
@@ -912,35 +1049,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
912
1049
  var authNames = ['api_token_basic'];
913
1050
  var contentTypes = [];
914
1051
  var accepts = ['application/json'];
915
- var returnType = _SubmissionDataRequestShow["default"];
916
- return this.apiClient.callApi('/data_requests/{data_request_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1052
+ var returnType = _CustomFile["default"];
1053
+ return this.apiClient.callApi('/custom_files/{custom_file_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
917
1054
  }
918
1055
 
919
1056
  /**
920
- * Callback function to receive the result of the getFullTemplate operation.
921
- * @callback module:api/Client~getFullTemplateCallback
922
- * @param {String} error Error message, if any.
923
- * @param {module:model/Template} data The data returned by the service call.
924
- * @param {String} response The complete HTTP response.
1057
+ * Get a custom file
1058
+ * Returns a custom file, with a temporary URL to download it.
1059
+ * @param {String} custom_file_id The custom file's ID.
1060
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFile}
925
1061
  */
1062
+ }, {
1063
+ key: "getCustomFile",
1064
+ value: function getCustomFile(custom_file_id) {
1065
+ return this.getCustomFileWithHttpInfo(custom_file_id).then(function (response_and_data) {
1066
+ return response_and_data.data;
1067
+ });
1068
+ }
926
1069
 
927
1070
  /**
928
- * Fetch the full attributes for a PDF template
929
- * Retrieves complete template information including fields, defaults, settings, and HTML/SCSS content. Use this to get all template data needed for automated updates or analysis. Returns more detailed information than the basic `getTemplate` endpoint.
930
- * @param {String} template_id
931
- * @param {module:api/Client~getFullTemplateCallback} callback The callback function, accepting three arguments: error, data, response
932
- * data is of type: {@link module:model/Template}
1071
+ * Get a folder
1072
+ * Returns a folder.
1073
+ * @param {String} folder_id The folder's ID.
1074
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
933
1075
  */
934
1076
  }, {
935
- key: "getFullTemplate",
936
- value: function getFullTemplate(template_id, callback) {
1077
+ key: "getFolderWithHttpInfo",
1078
+ value: function getFolderWithHttpInfo(folder_id) {
937
1079
  var postBody = null;
938
- // verify the required parameter 'template_id' is set
939
- if (template_id === undefined || template_id === null) {
940
- throw new Error("Missing the required parameter 'template_id' when calling getFullTemplate");
1080
+ // verify the required parameter 'folder_id' is set
1081
+ if (folder_id === undefined || folder_id === null) {
1082
+ throw new Error("Missing the required parameter 'folder_id' when calling getFolder");
941
1083
  }
942
1084
  var pathParams = {
943
- 'template_id': template_id
1085
+ 'folder_id': folder_id
944
1086
  };
945
1087
  var queryParams = {};
946
1088
  var headerParams = {};
@@ -948,27 +1090,32 @@ var Client = exports["default"] = /*#__PURE__*/function () {
948
1090
  var authNames = ['api_token_basic'];
949
1091
  var contentTypes = [];
950
1092
  var accepts = ['application/json'];
951
- var returnType = _Template["default"];
952
- return this.apiClient.callApi('/templates/{template_id}?full=true', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1093
+ var returnType = _Folder["default"];
1094
+ return this.apiClient.callApi('/folders/{folder_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
953
1095
  }
954
1096
 
955
1097
  /**
956
- * Callback function to receive the result of the getPresignUrl operation.
957
- * @callback module:api/Client~getPresignUrlCallback
958
- * @param {String} error Error message, if any.
959
- * @param {module:model/UploadPresignResponse} data The data returned by the service call.
960
- * @param {String} response The complete HTTP response.
1098
+ * Get a folder
1099
+ * Returns a folder.
1100
+ * @param {String} folder_id The folder's ID.
1101
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
961
1102
  */
1103
+ }, {
1104
+ key: "getFolder",
1105
+ value: function getFolder(folder_id) {
1106
+ return this.getFolderWithHttpInfo(folder_id).then(function (response_and_data) {
1107
+ return response_and_data.data;
1108
+ });
1109
+ }
962
1110
 
963
1111
  /**
964
- * Get a presigned S3 URL for direct file upload
965
- * Returns a presigned S3 URL for uploading files directly to our S3 bucket. Use this endpoint to upload large files before creating templates or custom files. S3 will respond with a JSON object that you can include in your DocSpring API request. Uploaded files can be used to: - [Create templates](https://docspring.com/docs/api/#tag/templates/post/templates?endpoint_variant=create_template_from_cached_upload) - [Update templates](https://docspring.com/docs/api/#tag/templates/put/templates/{template_id}?endpoint_variant=update_template_pdf_with_cached_upload) - [Create custom files](https://docspring.com/docs/api/#tag/custom-files/post/custom_files) and then [merge them with other PDFs](https://docspring.com/docs/api/#tag/combine-pdfs/post/combined_submissions)
966
- * @param {module:api/Client~getPresignUrlCallback} callback The callback function, accepting three arguments: error, data, response
967
- * data is of type: {@link module:model/UploadPresignResponse}
1112
+ * Get a presigned URL to upload a file
1113
+ * Returns a presigned S3 form for uploading a file directly to DocSpring, for files too large to send in a request body. POST the `fields` and the file (as `file`) to `url` as multipart/form-data, then pass `fields.key` as the `cache_id` when you create a custom file.
1114
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UploadPresign} and HTTP response
968
1115
  */
969
1116
  }, {
970
- key: "getPresignUrl",
971
- value: function getPresignUrl(callback) {
1117
+ key: "getPresignUrlWithHttpInfo",
1118
+ value: function getPresignUrlWithHttpInfo() {
972
1119
  var postBody = null;
973
1120
  var pathParams = {};
974
1121
  var queryParams = {};
@@ -977,31 +1124,73 @@ var Client = exports["default"] = /*#__PURE__*/function () {
977
1124
  var authNames = ['api_token_basic'];
978
1125
  var contentTypes = [];
979
1126
  var accepts = ['application/json'];
980
- var returnType = _UploadPresignResponse["default"];
981
- return this.apiClient.callApi('/uploads/presign', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1127
+ var returnType = _UploadPresign["default"];
1128
+ return this.apiClient.callApi('/uploads/presign', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
982
1129
  }
983
1130
 
984
1131
  /**
985
- * Callback function to receive the result of the getSubmission operation.
986
- * @callback module:api/Client~getSubmissionCallback
987
- * @param {String} error Error message, if any.
988
- * @param {module:model/Submission} data The data returned by the service call.
989
- * @param {String} response The complete HTTP response.
1132
+ * Get a presigned URL to upload a file
1133
+ * Returns a presigned S3 form for uploading a file directly to DocSpring, for files too large to send in a request body. POST the `fields` and the file (as `file`) to `url` as multipart/form-data, then pass `fields.key` as the `cache_id` when you create a custom file.
1134
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UploadPresign}
990
1135
  */
1136
+ }, {
1137
+ key: "getPresignUrl",
1138
+ value: function getPresignUrl() {
1139
+ return this.getPresignUrlWithHttpInfo().then(function (response_and_data) {
1140
+ return response_and_data.data;
1141
+ });
1142
+ }
991
1143
 
992
1144
  /**
993
- * Check the status of a PDF
994
- * Retrieves the details and status of a PDF submission. Returns processing state, download URL (if processed), metadata, submission data (optional), and information about any integrated actions. Use this to poll for completion when using asynchronous processing. `insufficient_credits` means the submission is waiting for credits and is processed once you add them. If it's still waiting after 30 days, it moves to `error`.
995
- * @param {String} submission_id
996
- * @param {Object} opts Optional parameters
997
- * @param {Boolean} [include_data]
998
- * @param {module:api/Client~getSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
999
- * data is of type: {@link module:model/Submission}
1145
+ * Get a signature request
1146
+ * Returns a signature request, with the values the person has entered so far.
1147
+ * @param {String} signature_request_id The signature request's ID.
1148
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequest} and HTTP response
1000
1149
  */
1001
1150
  }, {
1002
- key: "getSubmission",
1003
- value: function getSubmission(submission_id, opts, callback) {
1004
- opts = opts || {};
1151
+ key: "getSignatureRequestWithHttpInfo",
1152
+ value: function getSignatureRequestWithHttpInfo(signature_request_id) {
1153
+ var postBody = null;
1154
+ // verify the required parameter 'signature_request_id' is set
1155
+ if (signature_request_id === undefined || signature_request_id === null) {
1156
+ throw new Error("Missing the required parameter 'signature_request_id' when calling getSignatureRequest");
1157
+ }
1158
+ var pathParams = {
1159
+ 'signature_request_id': signature_request_id
1160
+ };
1161
+ var queryParams = {};
1162
+ var headerParams = {};
1163
+ var formParams = {};
1164
+ var authNames = ['api_token_basic'];
1165
+ var contentTypes = [];
1166
+ var accepts = ['application/json'];
1167
+ var returnType = _SignatureRequest["default"];
1168
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1169
+ }
1170
+
1171
+ /**
1172
+ * Get a signature request
1173
+ * Returns a signature request, with the values the person has entered so far.
1174
+ * @param {String} signature_request_id The signature request's ID.
1175
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequest}
1176
+ */
1177
+ }, {
1178
+ key: "getSignatureRequest",
1179
+ value: function getSignatureRequest(signature_request_id) {
1180
+ return this.getSignatureRequestWithHttpInfo(signature_request_id).then(function (response_and_data) {
1181
+ return response_and_data.data;
1182
+ });
1183
+ }
1184
+
1185
+ /**
1186
+ * Get a submission
1187
+ * Returns a submission, with its data and links to download its PDF.
1188
+ * @param {String} submission_id The submission's ID.
1189
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
1190
+ */
1191
+ }, {
1192
+ key: "getSubmissionWithHttpInfo",
1193
+ value: function getSubmissionWithHttpInfo(submission_id) {
1005
1194
  var postBody = null;
1006
1195
  // verify the required parameter 'submission_id' is set
1007
1196
  if (submission_id === undefined || submission_id === null) {
@@ -1010,38 +1199,41 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1010
1199
  var pathParams = {
1011
1200
  'submission_id': submission_id
1012
1201
  };
1013
- var queryParams = {
1014
- 'include_data': opts['include_data']
1015
- };
1202
+ var queryParams = {};
1016
1203
  var headerParams = {};
1017
1204
  var formParams = {};
1018
1205
  var authNames = ['api_token_basic'];
1019
1206
  var contentTypes = [];
1020
1207
  var accepts = ['application/json'];
1021
1208
  var returnType = _Submission["default"];
1022
- return this.apiClient.callApi('/submissions/{submission_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1209
+ return this.apiClient.callApi('/submissions/{submission_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1023
1210
  }
1024
1211
 
1025
1212
  /**
1026
- * Callback function to receive the result of the getSubmissionBatch operation.
1027
- * @callback module:api/Client~getSubmissionBatchCallback
1028
- * @param {String} error Error message, if any.
1029
- * @param {module:model/SubmissionBatchWithSubmissions} data The data returned by the service call.
1030
- * @param {String} response The complete HTTP response.
1213
+ * Get a submission
1214
+ * Returns a submission, with its data and links to download its PDF.
1215
+ * @param {String} submission_id The submission's ID.
1216
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
1031
1217
  */
1218
+ }, {
1219
+ key: "getSubmission",
1220
+ value: function getSubmission(submission_id) {
1221
+ return this.getSubmissionWithHttpInfo(submission_id).then(function (response_and_data) {
1222
+ return response_and_data.data;
1223
+ });
1224
+ }
1032
1225
 
1033
1226
  /**
1034
- * Check the status of a submission batch job
1035
- * Retrieves the status and results of a batch PDF generation job. Returns processing state, completion statistics, and optionally includes all individual submission details. Use this to poll for completion when using asynchronous batch processing. Submissions waiting for credits are in the `insufficient_credits` state and count as pending, so the batch stays `pending` until you add credits or they stop waiting after 30 days.
1036
- * @param {String} submission_batch_id
1227
+ * Get a batch
1228
+ * Returns a batch with its submissions. The batch has finished once `processed_at` is set: its `state` is `processed` when every PDF was generated, or `error` when any submission failed.
1229
+ * @param {String} submission_batch_id The batch's ID.
1037
1230
  * @param {Object} opts Optional parameters
1038
- * @param {Boolean} [include_submissions]
1039
- * @param {module:api/Client~getSubmissionBatchCallback} callback The callback function, accepting three arguments: error, data, response
1040
- * data is of type: {@link module:model/SubmissionBatchWithSubmissions}
1231
+ * @param {Boolean} [include_data] Include each submission's `data` (null without it).
1232
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionBatch} and HTTP response
1041
1233
  */
1042
1234
  }, {
1043
- key: "getSubmissionBatch",
1044
- value: function getSubmissionBatch(submission_batch_id, opts, callback) {
1235
+ key: "getSubmissionBatchWithHttpInfo",
1236
+ value: function getSubmissionBatchWithHttpInfo(submission_batch_id, opts) {
1045
1237
  opts = opts || {};
1046
1238
  var postBody = null;
1047
1239
  // verify the required parameter 'submission_batch_id' is set
@@ -1052,35 +1244,45 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1052
1244
  'submission_batch_id': submission_batch_id
1053
1245
  };
1054
1246
  var queryParams = {
1055
- 'include_submissions': opts['include_submissions']
1247
+ 'include_data': opts['include_data']
1056
1248
  };
1057
1249
  var headerParams = {};
1058
1250
  var formParams = {};
1059
1251
  var authNames = ['api_token_basic'];
1060
1252
  var contentTypes = [];
1061
1253
  var accepts = ['application/json'];
1062
- var returnType = _SubmissionBatchWithSubmissions["default"];
1063
- return this.apiClient.callApi('/submissions/batches/{submission_batch_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1254
+ var returnType = _SubmissionBatch["default"];
1255
+ return this.apiClient.callApi('/submissions/batches/{submission_batch_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1064
1256
  }
1065
1257
 
1066
1258
  /**
1067
- * Callback function to receive the result of the getTemplate operation.
1068
- * @callback module:api/Client~getTemplateCallback
1069
- * @param {String} error Error message, if any.
1070
- * @param {module:model/TemplatePreview} data The data returned by the service call.
1071
- * @param {String} response The complete HTTP response.
1259
+ * Get a batch
1260
+ * Returns a batch with its submissions. The batch has finished once `processed_at` is set: its `state` is `processed` when every PDF was generated, or `error` when any submission failed.
1261
+ * @param {String} submission_batch_id The batch's ID.
1262
+ * @param {Object} opts Optional parameters
1263
+ * @param {Boolean} opts.include_data Include each submission's `data` (null without it).
1264
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionBatch}
1072
1265
  */
1266
+ }, {
1267
+ key: "getSubmissionBatch",
1268
+ value: function getSubmissionBatch(submission_batch_id, opts) {
1269
+ return this.getSubmissionBatchWithHttpInfo(submission_batch_id, opts).then(function (response_and_data) {
1270
+ return response_and_data.data;
1271
+ });
1272
+ }
1073
1273
 
1074
1274
  /**
1075
- * Check the status of an uploaded template
1076
- * Retrieves information about a template including processing status and document URL. Use this to check if template is ready to view in the template editor or generate PDFs.
1077
- * @param {String} template_id
1078
- * @param {module:api/Client~getTemplateCallback} callback The callback function, accepting three arguments: error, data, response
1079
- * data is of type: {@link module:model/TemplatePreview}
1275
+ * Get a template
1276
+ * Returns a template: its draft, or one of its published versions.
1277
+ * @param {String} template_id The template's ID.
1278
+ * @param {Object} opts Optional parameters
1279
+ * @param {String} [version] A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1280
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1080
1281
  */
1081
1282
  }, {
1082
- key: "getTemplate",
1083
- value: function getTemplate(template_id, callback) {
1283
+ key: "getTemplateWithHttpInfo",
1284
+ value: function getTemplateWithHttpInfo(template_id, opts) {
1285
+ opts = opts || {};
1084
1286
  var postBody = null;
1085
1287
  // verify the required parameter 'template_id' is set
1086
1288
  if (template_id === undefined || template_id === null) {
@@ -1089,113 +1291,244 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1089
1291
  var pathParams = {
1090
1292
  'template_id': template_id
1091
1293
  };
1092
- var queryParams = {};
1294
+ var queryParams = {
1295
+ 'version': opts['version']
1296
+ };
1093
1297
  var headerParams = {};
1094
1298
  var formParams = {};
1095
1299
  var authNames = ['api_token_basic'];
1096
1300
  var contentTypes = [];
1097
1301
  var accepts = ['application/json'];
1098
- var returnType = _TemplatePreview["default"];
1099
- return this.apiClient.callApi('/templates/{template_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1302
+ var returnType = _Template["default"];
1303
+ return this.apiClient.callApi('/templates/{template_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1100
1304
  }
1101
1305
 
1102
1306
  /**
1103
- * Callback function to receive the result of the getTemplateModelCode operation.
1104
- * @callback module:api/Client~getTemplateModelCodeCallback
1105
- * @param {String} error Error message, if any.
1106
- * @param {module:model/TemplateModelCodeResponse} data The data returned by the service call.
1107
- * @param {String} response The complete HTTP response.
1307
+ * Get a template
1308
+ * Returns a template: its draft, or one of its published versions.
1309
+ * @param {String} template_id The template's ID.
1310
+ * @param {Object} opts Optional parameters
1311
+ * @param {String} opts.version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1312
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1108
1313
  */
1314
+ }, {
1315
+ key: "getTemplate",
1316
+ value: function getTemplate(template_id, opts) {
1317
+ return this.getTemplateWithHttpInfo(template_id, opts).then(function (response_and_data) {
1318
+ return response_and_data.data;
1319
+ });
1320
+ }
1109
1321
 
1110
1322
  /**
1111
- * Generate typed model code for a template
1112
- * Generates typed model code for a template's submission data from its JSON schema, in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go. Build your submission data with the generated types so your app catches mistakes before it calls the API. `root_type_name` is the type that describes the whole submission data object, qualified with its namespace or package where there is one. Java returns every class in `code`, each under a `// ClassName.java` comment: split them into one file per class. A template with no named fields returns 422, since there are no types to generate. See also: - [Generate Model Code](https://docspring.com/docs/template-editor/generate-model-code/) - Use the generated types
1113
- * @param {String} template_id
1114
- * @param {module:model/String} lang The language to generate code for
1115
- * @param {module:api/Client~getTemplateModelCodeCallback} callback The callback function, accepting three arguments: error, data, response
1116
- * data is of type: {@link module:model/TemplateModelCodeResponse}
1323
+ * Compare a version of a template with the one before it
1324
+ * Returns what changed in the template's draft since its latest published version (or in a published version since the one before it): fields added, removed, changed and moved, the settings that changed, and whether the document was replaced. Check it before you publish a version.
1325
+ * @param {String} template_id The template's ID.
1326
+ * @param {Object} opts Optional parameters
1327
+ * @param {String} [version] A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1328
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateDiff} and HTTP response
1117
1329
  */
1118
1330
  }, {
1119
- key: "getTemplateModelCode",
1120
- value: function getTemplateModelCode(template_id, lang, callback) {
1331
+ key: "getTemplateDiffWithHttpInfo",
1332
+ value: function getTemplateDiffWithHttpInfo(template_id, opts) {
1333
+ opts = opts || {};
1121
1334
  var postBody = null;
1122
1335
  // verify the required parameter 'template_id' is set
1123
1336
  if (template_id === undefined || template_id === null) {
1124
- throw new Error("Missing the required parameter 'template_id' when calling getTemplateModelCode");
1125
- }
1126
- // verify the required parameter 'lang' is set
1127
- if (lang === undefined || lang === null) {
1128
- throw new Error("Missing the required parameter 'lang' when calling getTemplateModelCode");
1337
+ throw new Error("Missing the required parameter 'template_id' when calling getTemplateDiff");
1129
1338
  }
1130
1339
  var pathParams = {
1131
1340
  'template_id': template_id
1132
1341
  };
1133
1342
  var queryParams = {
1134
- 'lang': lang
1343
+ 'version': opts['version']
1135
1344
  };
1136
1345
  var headerParams = {};
1137
1346
  var formParams = {};
1138
1347
  var authNames = ['api_token_basic'];
1139
1348
  var contentTypes = [];
1140
1349
  var accepts = ['application/json'];
1141
- var returnType = _TemplateModelCodeResponse["default"];
1142
- return this.apiClient.callApi('/templates/{template_id}/model_code', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1350
+ var returnType = _TemplateDiff["default"];
1351
+ return this.apiClient.callApi('/templates/{template_id}/diff', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1143
1352
  }
1144
1353
 
1145
1354
  /**
1146
- * Callback function to receive the result of the getTemplateSchema operation.
1147
- * @callback module:api/Client~getTemplateSchemaCallback
1148
- * @param {String} error Error message, if any.
1149
- * @param {module:model/JsonSchema} data The data returned by the service call.
1150
- * @param {String} response The complete HTTP response.
1355
+ * Compare a version of a template with the one before it
1356
+ * Returns what changed in the template's draft since its latest published version (or in a published version since the one before it): fields added, removed, changed and moved, the settings that changed, and whether the document was replaced. Check it before you publish a version.
1357
+ * @param {String} template_id The template's ID.
1358
+ * @param {Object} opts Optional parameters
1359
+ * @param {String} opts.version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1360
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateDiff}
1151
1361
  */
1362
+ }, {
1363
+ key: "getTemplateDiff",
1364
+ value: function getTemplateDiff(template_id, opts) {
1365
+ return this.getTemplateDiffWithHttpInfo(template_id, opts).then(function (response_and_data) {
1366
+ return response_and_data.data;
1367
+ });
1368
+ }
1152
1369
 
1153
1370
  /**
1154
- * Fetch the JSON schema for a template
1155
- * Retrieves the JSON Schema definition for a template's fields. Use this to validate data before submitting it for PDF generation, or to build dynamic forms that match the template's field structure and validation requirements. See also: - [Generate PDFs Guide](https://docspring.com/docs/api-guide/generate-pdfs/generate-pdfs-via-api/) - Use schema to validate submission data
1156
- * @param {String} template_id
1157
- * @param {module:api/Client~getTemplateSchemaCallback} callback The callback function, accepting three arguments: error, data, response
1158
- * data is of type: {@link module:model/JsonSchema}
1371
+ * Generate typed code for a template's submission data
1372
+ * Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
1373
+ * @param {String} template_id The template's ID.
1374
+ * @param {module:model/ModelCodeLanguage} lang The language to generate the code in.
1375
+ * @param {Object} opts Optional parameters
1376
+ * @param {String} [version] The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
1377
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateModelCode} and HTTP response
1159
1378
  */
1160
1379
  }, {
1161
- key: "getTemplateSchema",
1162
- value: function getTemplateSchema(template_id, callback) {
1380
+ key: "getTemplateModelCodeWithHttpInfo",
1381
+ value: function getTemplateModelCodeWithHttpInfo(template_id, lang, opts) {
1382
+ opts = opts || {};
1163
1383
  var postBody = null;
1164
1384
  // verify the required parameter 'template_id' is set
1165
1385
  if (template_id === undefined || template_id === null) {
1166
- throw new Error("Missing the required parameter 'template_id' when calling getTemplateSchema");
1386
+ throw new Error("Missing the required parameter 'template_id' when calling getTemplateModelCode");
1387
+ }
1388
+ // verify the required parameter 'lang' is set
1389
+ if (lang === undefined || lang === null) {
1390
+ throw new Error("Missing the required parameter 'lang' when calling getTemplateModelCode");
1167
1391
  }
1168
1392
  var pathParams = {
1169
1393
  'template_id': template_id
1170
1394
  };
1171
- var queryParams = {};
1395
+ var queryParams = {
1396
+ 'version': opts['version'],
1397
+ 'lang': lang
1398
+ };
1172
1399
  var headerParams = {};
1173
1400
  var formParams = {};
1174
1401
  var authNames = ['api_token_basic'];
1175
1402
  var contentTypes = [];
1176
1403
  var accepts = ['application/json'];
1177
- var returnType = _JsonSchema["default"];
1178
- return this.apiClient.callApi('/templates/{template_id}/schema', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1404
+ var returnType = _TemplateModelCode["default"];
1405
+ return this.apiClient.callApi('/templates/{template_id}/model_code', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1179
1406
  }
1180
1407
 
1181
1408
  /**
1182
- * Callback function to receive the result of the getWebhook operation.
1183
- * @callback module:api/Client~getWebhookCallback
1184
- * @param {String} error Error message, if any.
1185
- * @param {module:model/Webhook} data The data returned by the service call.
1186
- * @param {String} response The complete HTTP response.
1409
+ * Generate typed code for a template's submission data
1410
+ * Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
1411
+ * @param {String} template_id The template's ID.
1412
+ * @param {module:model/ModelCodeLanguage} lang The language to generate the code in.
1413
+ * @param {Object} opts Optional parameters
1414
+ * @param {String} opts.version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
1415
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateModelCode}
1187
1416
  */
1188
-
1417
+ }, {
1418
+ key: "getTemplateModelCode",
1419
+ value: function getTemplateModelCode(template_id, lang, opts) {
1420
+ return this.getTemplateModelCodeWithHttpInfo(template_id, lang, opts).then(function (response_and_data) {
1421
+ return response_and_data.data;
1422
+ });
1423
+ }
1424
+
1425
+ /**
1426
+ * Get images of a template's pages
1427
+ * Returns a JPEG image of each page of a PDF template's PDF, with temporary links to download them: the draft's PDF, or a published version's. Use them to see the pages that fields are placed on.
1428
+ * @param {String} template_id The template's ID.
1429
+ * @param {Object} opts Optional parameters
1430
+ * @param {String} [version] A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1431
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplatePageImages} and HTTP response
1432
+ */
1433
+ }, {
1434
+ key: "getTemplatePageImagesWithHttpInfo",
1435
+ value: function getTemplatePageImagesWithHttpInfo(template_id, opts) {
1436
+ opts = opts || {};
1437
+ var postBody = null;
1438
+ // verify the required parameter 'template_id' is set
1439
+ if (template_id === undefined || template_id === null) {
1440
+ throw new Error("Missing the required parameter 'template_id' when calling getTemplatePageImages");
1441
+ }
1442
+ var pathParams = {
1443
+ 'template_id': template_id
1444
+ };
1445
+ var queryParams = {
1446
+ 'version': opts['version']
1447
+ };
1448
+ var headerParams = {};
1449
+ var formParams = {};
1450
+ var authNames = ['api_token_basic'];
1451
+ var contentTypes = [];
1452
+ var accepts = ['application/json'];
1453
+ var returnType = _TemplatePageImages["default"];
1454
+ return this.apiClient.callApi('/templates/{template_id}/page_images', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1455
+ }
1456
+
1457
+ /**
1458
+ * Get images of a template's pages
1459
+ * Returns a JPEG image of each page of a PDF template's PDF, with temporary links to download them: the draft's PDF, or a published version's. Use them to see the pages that fields are placed on.
1460
+ * @param {String} template_id The template's ID.
1461
+ * @param {Object} opts Optional parameters
1462
+ * @param {String} opts.version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1463
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplatePageImages}
1464
+ */
1465
+ }, {
1466
+ key: "getTemplatePageImages",
1467
+ value: function getTemplatePageImages(template_id, opts) {
1468
+ return this.getTemplatePageImagesWithHttpInfo(template_id, opts).then(function (response_and_data) {
1469
+ return response_and_data.data;
1470
+ });
1471
+ }
1472
+
1473
+ /**
1474
+ * Get the JSON Schema of a template's submission data
1475
+ * Returns the JSON Schema that a submission's `data` must match. Use it to check data before you create submissions, or to build a form for the template's fields.
1476
+ * @param {String} template_id The template's ID.
1477
+ * @param {Object} opts Optional parameters
1478
+ * @param {String} [version] The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
1479
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object.<String, {String: Object}>} and HTTP response
1480
+ */
1481
+ }, {
1482
+ key: "getTemplateSchemaWithHttpInfo",
1483
+ value: function getTemplateSchemaWithHttpInfo(template_id, opts) {
1484
+ opts = opts || {};
1485
+ var postBody = null;
1486
+ // verify the required parameter 'template_id' is set
1487
+ if (template_id === undefined || template_id === null) {
1488
+ throw new Error("Missing the required parameter 'template_id' when calling getTemplateSchema");
1489
+ }
1490
+ var pathParams = {
1491
+ 'template_id': template_id
1492
+ };
1493
+ var queryParams = {
1494
+ 'version': opts['version']
1495
+ };
1496
+ var headerParams = {};
1497
+ var formParams = {};
1498
+ var authNames = ['api_token_basic'];
1499
+ var contentTypes = [];
1500
+ var accepts = ['application/json'];
1501
+ var returnType = {
1502
+ 'String': Object
1503
+ };
1504
+ return this.apiClient.callApi('/templates/{template_id}/schema', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1505
+ }
1506
+
1507
+ /**
1508
+ * Get the JSON Schema of a template's submission data
1509
+ * Returns the JSON Schema that a submission's `data` must match. Use it to check data before you create submissions, or to build a form for the template's fields.
1510
+ * @param {String} template_id The template's ID.
1511
+ * @param {Object} opts Optional parameters
1512
+ * @param {String} opts.version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
1513
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object.<String, {String: Object}>}
1514
+ */
1515
+ }, {
1516
+ key: "getTemplateSchema",
1517
+ value: function getTemplateSchema(template_id, opts) {
1518
+ return this.getTemplateSchemaWithHttpInfo(template_id, opts).then(function (response_and_data) {
1519
+ return response_and_data.data;
1520
+ });
1521
+ }
1522
+
1189
1523
  /**
1190
1524
  * Get a webhook
1191
- * Retrieves a single webhook by its ID.
1192
- * @param {String} webhook_id
1193
- * @param {module:api/Client~getWebhookCallback} callback The callback function, accepting three arguments: error, data, response
1194
- * data is of type: {@link module:model/Webhook}
1525
+ * Returns a webhook.
1526
+ * @param {String} webhook_id The webhook's ID.
1527
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
1195
1528
  */
1196
1529
  }, {
1197
- key: "getWebhook",
1198
- value: function getWebhook(webhook_id, callback) {
1530
+ key: "getWebhookWithHttpInfo",
1531
+ value: function getWebhookWithHttpInfo(webhook_id) {
1199
1532
  var postBody = null;
1200
1533
  // verify the required parameter 'webhook_id' is set
1201
1534
  if (webhook_id === undefined || webhook_id === null) {
@@ -1211,148 +1544,277 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1211
1544
  var contentTypes = [];
1212
1545
  var accepts = ['application/json'];
1213
1546
  var returnType = _Webhook["default"];
1214
- return this.apiClient.callApi('/webhooks/{webhook_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1547
+ return this.apiClient.callApi('/webhooks/{webhook_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1215
1548
  }
1216
1549
 
1217
1550
  /**
1218
- * Callback function to receive the result of the listCombinedSubmissions operation.
1219
- * @callback module:api/Client~listCombinedSubmissionsCallback
1220
- * @param {String} error Error message, if any.
1221
- * @param {Array.<module:model/CombinedSubmission>} data The data returned by the service call.
1222
- * @param {String} response The complete HTTP response.
1551
+ * Get a webhook
1552
+ * Returns a webhook.
1553
+ * @param {String} webhook_id The webhook's ID.
1554
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
1223
1555
  */
1556
+ }, {
1557
+ key: "getWebhook",
1558
+ value: function getWebhook(webhook_id) {
1559
+ return this.getWebhookWithHttpInfo(webhook_id).then(function (response_and_data) {
1560
+ return response_and_data.data;
1561
+ });
1562
+ }
1224
1563
 
1225
1564
  /**
1226
- * Get a list of all combined submissions
1227
- * Returns a paginated list of combined submissions (merged PDFs) for your account. Includes processing status, expiration details, and download URLs for processed PDFs.
1565
+ * List combined PDFs
1566
+ * Returns the combined PDFs in your account, newest first, one page at a time.
1228
1567
  * @param {Object} opts Optional parameters
1229
- * @param {Number} [page] Default: 1
1230
- * @param {Number} [per_page] Default: 50
1231
- * @param {module:api/Client~listCombinedSubmissionsCallback} callback The callback function, accepting three arguments: error, data, response
1232
- * data is of type: {@link Array.<module:model/CombinedSubmission>}
1568
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1569
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1570
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdfList} and HTTP response
1233
1571
  */
1234
1572
  }, {
1235
- key: "listCombinedSubmissions",
1236
- value: function listCombinedSubmissions(opts, callback) {
1573
+ key: "listCombinedPdfsWithHttpInfo",
1574
+ value: function listCombinedPdfsWithHttpInfo(opts) {
1237
1575
  opts = opts || {};
1238
1576
  var postBody = null;
1239
1577
  var pathParams = {};
1240
1578
  var queryParams = {
1241
- 'page': opts['page'],
1242
- 'per_page': opts['per_page']
1579
+ 'limit': opts['limit'],
1580
+ 'cursor': opts['cursor']
1243
1581
  };
1244
1582
  var headerParams = {};
1245
1583
  var formParams = {};
1246
1584
  var authNames = ['api_token_basic'];
1247
1585
  var contentTypes = [];
1248
1586
  var accepts = ['application/json'];
1249
- var returnType = [_CombinedSubmission["default"]];
1250
- return this.apiClient.callApi('/combined_submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1587
+ var returnType = _CombinedPdfList["default"];
1588
+ return this.apiClient.callApi('/combined_pdfs', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1251
1589
  }
1252
1590
 
1253
1591
  /**
1254
- * Callback function to receive the result of the listFolders operation.
1255
- * @callback module:api/Client~listFoldersCallback
1256
- * @param {String} error Error message, if any.
1257
- * @param {Array.<module:model/Folder>} data The data returned by the service call.
1258
- * @param {String} response The complete HTTP response.
1592
+ * List combined PDFs
1593
+ * Returns the combined PDFs in your account, newest first, one page at a time.
1594
+ * @param {Object} opts Optional parameters
1595
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1596
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1597
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdfList}
1259
1598
  */
1599
+ }, {
1600
+ key: "listCombinedPdfs",
1601
+ value: function listCombinedPdfs(opts) {
1602
+ return this.listCombinedPdfsWithHttpInfo(opts).then(function (response_and_data) {
1603
+ return response_and_data.data;
1604
+ });
1605
+ }
1260
1606
 
1261
1607
  /**
1262
- * Get a list of all folders
1263
- * Returns a list of folders in your account. Can be filtered by parent folder ID to retrieve subfolders. Folders help organize templates and maintain a hierarchical structure.
1608
+ * List custom files
1609
+ * Returns the custom files in your account, newest first, one page at a time.
1264
1610
  * @param {Object} opts Optional parameters
1265
- * @param {String} [parent_folder_id] Filter By Folder Id
1266
- * @param {module:api/Client~listFoldersCallback} callback The callback function, accepting three arguments: error, data, response
1267
- * data is of type: {@link Array.<module:model/Folder>}
1611
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1612
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1613
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFileList} and HTTP response
1268
1614
  */
1269
1615
  }, {
1270
- key: "listFolders",
1271
- value: function listFolders(opts, callback) {
1616
+ key: "listCustomFilesWithHttpInfo",
1617
+ value: function listCustomFilesWithHttpInfo(opts) {
1272
1618
  opts = opts || {};
1273
1619
  var postBody = null;
1274
1620
  var pathParams = {};
1275
1621
  var queryParams = {
1276
- 'parent_folder_id': opts['parent_folder_id']
1622
+ 'limit': opts['limit'],
1623
+ 'cursor': opts['cursor']
1277
1624
  };
1278
1625
  var headerParams = {};
1279
1626
  var formParams = {};
1280
1627
  var authNames = ['api_token_basic'];
1281
1628
  var contentTypes = [];
1282
1629
  var accepts = ['application/json'];
1283
- var returnType = [_Folder["default"]];
1284
- return this.apiClient.callApi('/folders/', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1630
+ var returnType = _CustomFileList["default"];
1631
+ return this.apiClient.callApi('/custom_files', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1285
1632
  }
1286
1633
 
1287
1634
  /**
1288
- * Callback function to receive the result of the listSubmissions operation.
1289
- * @callback module:api/Client~listSubmissionsCallback
1290
- * @param {String} error Error message, if any.
1291
- * @param {module:model/ListSubmissionsResponse} data The data returned by the service call.
1292
- * @param {String} response The complete HTTP response.
1635
+ * List custom files
1636
+ * Returns the custom files in your account, newest first, one page at a time.
1637
+ * @param {Object} opts Optional parameters
1638
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1639
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1640
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFileList}
1293
1641
  */
1642
+ }, {
1643
+ key: "listCustomFiles",
1644
+ value: function listCustomFiles(opts) {
1645
+ return this.listCustomFilesWithHttpInfo(opts).then(function (response_and_data) {
1646
+ return response_and_data.data;
1647
+ });
1648
+ }
1294
1649
 
1295
1650
  /**
1296
- * List all submissions
1297
- * Returns a paginated list of all PDF submissions across all templates in your account. Can be filtered by date range and submission type (test/live). Supports cursor-based pagination and optionally includes submission data for each result.
1651
+ * List folders
1652
+ * Returns the folders in your account, newest first, one page at a time. Pass `parent_folder_id` to list the folders in one folder.
1298
1653
  * @param {Object} opts Optional parameters
1299
- * @param {String} [cursor]
1300
- * @param {Number} [limit]
1301
- * @param {String} [created_after]
1302
- * @param {String} [created_before]
1303
- * @param {String} [type]
1304
- * @param {Boolean} [include_data]
1305
- * @param {module:api/Client~listSubmissionsCallback} callback The callback function, accepting three arguments: error, data, response
1306
- * data is of type: {@link module:model/ListSubmissionsResponse}
1654
+ * @param {String} [parent_folder_id] Only list the folders in this folder. Without it, the list has every folder, at any depth.
1655
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1656
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1657
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/FolderList} and HTTP response
1307
1658
  */
1308
1659
  }, {
1309
- key: "listSubmissions",
1310
- value: function listSubmissions(opts, callback) {
1660
+ key: "listFoldersWithHttpInfo",
1661
+ value: function listFoldersWithHttpInfo(opts) {
1311
1662
  opts = opts || {};
1312
1663
  var postBody = null;
1313
1664
  var pathParams = {};
1314
1665
  var queryParams = {
1315
- 'cursor': opts['cursor'],
1666
+ 'parent_folder_id': opts['parent_folder_id'],
1316
1667
  'limit': opts['limit'],
1668
+ 'cursor': opts['cursor']
1669
+ };
1670
+ var headerParams = {};
1671
+ var formParams = {};
1672
+ var authNames = ['api_token_basic'];
1673
+ var contentTypes = [];
1674
+ var accepts = ['application/json'];
1675
+ var returnType = _FolderList["default"];
1676
+ return this.apiClient.callApi('/folders', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1677
+ }
1678
+
1679
+ /**
1680
+ * List folders
1681
+ * Returns the folders in your account, newest first, one page at a time. Pass `parent_folder_id` to list the folders in one folder.
1682
+ * @param {Object} opts Optional parameters
1683
+ * @param {String} opts.parent_folder_id Only list the folders in this folder. Without it, the list has every folder, at any depth.
1684
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1685
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1686
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/FolderList}
1687
+ */
1688
+ }, {
1689
+ key: "listFolders",
1690
+ value: function listFolders(opts) {
1691
+ return this.listFoldersWithHttpInfo(opts).then(function (response_and_data) {
1692
+ return response_and_data.data;
1693
+ });
1694
+ }
1695
+
1696
+ /**
1697
+ * List submissions
1698
+ * Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
1699
+ * @param {Object} opts Optional parameters
1700
+ * @param {String} [template_id] Only list this template's submissions.
1701
+ * @param {Boolean} [test] Only list test submissions (true) or live submissions (false).
1702
+ * @param {Date} [created_after] Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1703
+ * @param {Date} [created_before] Only list submissions created before this time.
1704
+ * @param {Boolean} [include_data] Include each submission's `data` (null without it).
1705
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1706
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1707
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionList} and HTTP response
1708
+ */
1709
+ }, {
1710
+ key: "listSubmissionsWithHttpInfo",
1711
+ value: function listSubmissionsWithHttpInfo(opts) {
1712
+ opts = opts || {};
1713
+ var postBody = null;
1714
+ var pathParams = {};
1715
+ var queryParams = {
1716
+ 'template_id': opts['template_id'],
1717
+ 'test': opts['test'],
1317
1718
  'created_after': opts['created_after'],
1318
1719
  'created_before': opts['created_before'],
1319
- 'type': opts['type'],
1320
- 'include_data': opts['include_data']
1720
+ 'include_data': opts['include_data'],
1721
+ 'limit': opts['limit'],
1722
+ 'cursor': opts['cursor']
1321
1723
  };
1322
1724
  var headerParams = {};
1323
1725
  var formParams = {};
1324
1726
  var authNames = ['api_token_basic'];
1325
1727
  var contentTypes = [];
1326
1728
  var accepts = ['application/json'];
1327
- var returnType = _ListSubmissionsResponse["default"];
1328
- return this.apiClient.callApi('/submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1729
+ var returnType = _SubmissionList["default"];
1730
+ return this.apiClient.callApi('/submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1329
1731
  }
1330
1732
 
1331
1733
  /**
1332
- * Callback function to receive the result of the listTemplateSubmissions operation.
1333
- * @callback module:api/Client~listTemplateSubmissionsCallback
1334
- * @param {String} error Error message, if any.
1335
- * @param {module:model/ListSubmissionsResponse} data The data returned by the service call.
1336
- * @param {String} response The complete HTTP response.
1734
+ * List submissions
1735
+ * Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
1736
+ * @param {Object} opts Optional parameters
1737
+ * @param {String} opts.template_id Only list this template's submissions.
1738
+ * @param {Boolean} opts.test Only list test submissions (true) or live submissions (false).
1739
+ * @param {Date} opts.created_after Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1740
+ * @param {Date} opts.created_before Only list submissions created before this time.
1741
+ * @param {Boolean} opts.include_data Include each submission's `data` (null without it).
1742
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1743
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1744
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionList}
1337
1745
  */
1746
+ }, {
1747
+ key: "listSubmissions",
1748
+ value: function listSubmissions(opts) {
1749
+ return this.listSubmissionsWithHttpInfo(opts).then(function (response_and_data) {
1750
+ return response_and_data.data;
1751
+ });
1752
+ }
1338
1753
 
1339
1754
  /**
1340
- * List all submissions for a given template
1341
- * Returns a paginated list of all submissions for a specific template. Can be filtered by date range, submission type (test/live), and optionally include submission data. Supports cursor-based pagination for efficient retrieval of large result sets.
1342
- * @param {String} template_id
1755
+ * List a template's fields
1756
+ * Returns a template's fields with all of their settings, page by page: the draft's fields, or a published version's. A PDF template's fields are placed on its pages: GET /templates/{template_id}/page_images has images of the pages.
1757
+ * @param {String} template_id The template's ID.
1343
1758
  * @param {Object} opts Optional parameters
1344
- * @param {String} [cursor]
1345
- * @param {Number} [limit]
1346
- * @param {String} [created_after]
1347
- * @param {String} [created_before]
1348
- * @param {String} [type]
1349
- * @param {Boolean} [include_data]
1350
- * @param {module:api/Client~listTemplateSubmissionsCallback} callback The callback function, accepting three arguments: error, data, response
1351
- * data is of type: {@link module:model/ListSubmissionsResponse}
1759
+ * @param {String} [version] A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1760
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateFields} and HTTP response
1352
1761
  */
1353
1762
  }, {
1354
- key: "listTemplateSubmissions",
1355
- value: function listTemplateSubmissions(template_id, opts, callback) {
1763
+ key: "listTemplateFieldsWithHttpInfo",
1764
+ value: function listTemplateFieldsWithHttpInfo(template_id, opts) {
1765
+ opts = opts || {};
1766
+ var postBody = null;
1767
+ // verify the required parameter 'template_id' is set
1768
+ if (template_id === undefined || template_id === null) {
1769
+ throw new Error("Missing the required parameter 'template_id' when calling listTemplateFields");
1770
+ }
1771
+ var pathParams = {
1772
+ 'template_id': template_id
1773
+ };
1774
+ var queryParams = {
1775
+ 'version': opts['version']
1776
+ };
1777
+ var headerParams = {};
1778
+ var formParams = {};
1779
+ var authNames = ['api_token_basic'];
1780
+ var contentTypes = [];
1781
+ var accepts = ['application/json'];
1782
+ var returnType = _TemplateFields["default"];
1783
+ return this.apiClient.callApi('/templates/{template_id}/fields', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1784
+ }
1785
+
1786
+ /**
1787
+ * List a template's fields
1788
+ * Returns a template's fields with all of their settings, page by page: the draft's fields, or a published version's. A PDF template's fields are placed on its pages: GET /templates/{template_id}/page_images has images of the pages.
1789
+ * @param {String} template_id The template's ID.
1790
+ * @param {Object} opts Optional parameters
1791
+ * @param {String} opts.version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1792
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateFields}
1793
+ */
1794
+ }, {
1795
+ key: "listTemplateFields",
1796
+ value: function listTemplateFields(template_id, opts) {
1797
+ return this.listTemplateFieldsWithHttpInfo(template_id, opts).then(function (response_and_data) {
1798
+ return response_and_data.data;
1799
+ });
1800
+ }
1801
+
1802
+ /**
1803
+ * List a template's submissions
1804
+ * Returns a template's submissions (from every version of the template), newest first.
1805
+ * @param {String} template_id The template's ID.
1806
+ * @param {Object} opts Optional parameters
1807
+ * @param {Boolean} [test] Only list test submissions (true) or live submissions (false).
1808
+ * @param {Date} [created_after] Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1809
+ * @param {Date} [created_before] Only list submissions created before this time.
1810
+ * @param {Boolean} [include_data] Include each submission's `data` (null without it).
1811
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1812
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1813
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionList} and HTTP response
1814
+ */
1815
+ }, {
1816
+ key: "listTemplateSubmissionsWithHttpInfo",
1817
+ value: function listTemplateSubmissionsWithHttpInfo(template_id, opts) {
1356
1818
  opts = opts || {};
1357
1819
  var postBody = null;
1358
1820
  // verify the required parameter 'template_id' is set
@@ -1363,135 +1825,168 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1363
1825
  'template_id': template_id
1364
1826
  };
1365
1827
  var queryParams = {
1366
- 'cursor': opts['cursor'],
1367
- 'limit': opts['limit'],
1828
+ 'test': opts['test'],
1368
1829
  'created_after': opts['created_after'],
1369
1830
  'created_before': opts['created_before'],
1370
- 'type': opts['type'],
1371
- 'include_data': opts['include_data']
1831
+ 'include_data': opts['include_data'],
1832
+ 'limit': opts['limit'],
1833
+ 'cursor': opts['cursor']
1372
1834
  };
1373
1835
  var headerParams = {};
1374
1836
  var formParams = {};
1375
1837
  var authNames = ['api_token_basic'];
1376
1838
  var contentTypes = [];
1377
1839
  var accepts = ['application/json'];
1378
- var returnType = _ListSubmissionsResponse["default"];
1379
- return this.apiClient.callApi('/templates/{template_id}/submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1840
+ var returnType = _SubmissionList["default"];
1841
+ return this.apiClient.callApi('/templates/{template_id}/submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1380
1842
  }
1381
1843
 
1382
1844
  /**
1383
- * Callback function to receive the result of the listTemplates operation.
1384
- * @callback module:api/Client~listTemplatesCallback
1385
- * @param {String} error Error message, if any.
1386
- * @param {Array.<module:model/TemplatePreview>} data The data returned by the service call.
1387
- * @param {String} response The complete HTTP response.
1845
+ * List a template's submissions
1846
+ * Returns a template's submissions (from every version of the template), newest first.
1847
+ * @param {String} template_id The template's ID.
1848
+ * @param {Object} opts Optional parameters
1849
+ * @param {Boolean} opts.test Only list test submissions (true) or live submissions (false).
1850
+ * @param {Date} opts.created_after Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1851
+ * @param {Date} opts.created_before Only list submissions created before this time.
1852
+ * @param {Boolean} opts.include_data Include each submission's `data` (null without it).
1853
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1854
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1855
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionList}
1388
1856
  */
1857
+ }, {
1858
+ key: "listTemplateSubmissions",
1859
+ value: function listTemplateSubmissions(template_id, opts) {
1860
+ return this.listTemplateSubmissionsWithHttpInfo(template_id, opts).then(function (response_and_data) {
1861
+ return response_and_data.data;
1862
+ });
1863
+ }
1389
1864
 
1390
1865
  /**
1391
- * Get a list of all templates
1392
- * Retrieves a list of your templates with search, filtering, and pagination options. Returns basic template information including ID, name, type (PDF or HTML), and folder location. Supports text search by name and filtering by parent folder.
1866
+ * List templates
1867
+ * Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
1393
1868
  * @param {Object} opts Optional parameters
1394
- * @param {String} [query] Search By Name
1395
- * @param {String} [parent_folder_id] Filter By Folder Id
1396
- * @param {Number} [page] Default: 1
1397
- * @param {Number} [per_page] Default: 50
1398
- * @param {module:api/Client~listTemplatesCallback} callback The callback function, accepting three arguments: error, data, response
1399
- * data is of type: {@link Array.<module:model/TemplatePreview>}
1869
+ * @param {String} [query] Only list templates whose name contains this text (ignoring case).
1870
+ * @param {String} [parent_folder_id] Only list the templates in this folder (not in its subfolders).
1871
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1872
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1873
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateSummaryList} and HTTP response
1400
1874
  */
1401
1875
  }, {
1402
- key: "listTemplates",
1403
- value: function listTemplates(opts, callback) {
1876
+ key: "listTemplatesWithHttpInfo",
1877
+ value: function listTemplatesWithHttpInfo(opts) {
1404
1878
  opts = opts || {};
1405
1879
  var postBody = null;
1406
1880
  var pathParams = {};
1407
1881
  var queryParams = {
1408
1882
  'query': opts['query'],
1409
1883
  'parent_folder_id': opts['parent_folder_id'],
1410
- 'page': opts['page'],
1411
- 'per_page': opts['per_page']
1884
+ 'limit': opts['limit'],
1885
+ 'cursor': opts['cursor']
1412
1886
  };
1413
1887
  var headerParams = {};
1414
1888
  var formParams = {};
1415
1889
  var authNames = ['api_token_basic'];
1416
1890
  var contentTypes = [];
1417
1891
  var accepts = ['application/json'];
1418
- var returnType = [_TemplatePreview["default"]];
1419
- return this.apiClient.callApi('/templates', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1892
+ var returnType = _TemplateSummaryList["default"];
1893
+ return this.apiClient.callApi('/templates', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1420
1894
  }
1421
1895
 
1422
1896
  /**
1423
- * Callback function to receive the result of the listWebhooks operation.
1424
- * @callback module:api/Client~listWebhooksCallback
1425
- * @param {String} error Error message, if any.
1426
- * @param {Array.<module:model/Webhook>} data The data returned by the service call.
1427
- * @param {String} response The complete HTTP response.
1897
+ * List templates
1898
+ * Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
1899
+ * @param {Object} opts Optional parameters
1900
+ * @param {String} opts.query Only list templates whose name contains this text (ignoring case).
1901
+ * @param {String} opts.parent_folder_id Only list the templates in this folder (not in its subfolders).
1902
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1903
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1904
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateSummaryList}
1428
1905
  */
1906
+ }, {
1907
+ key: "listTemplates",
1908
+ value: function listTemplates(opts) {
1909
+ return this.listTemplatesWithHttpInfo(opts).then(function (response_and_data) {
1910
+ return response_and_data.data;
1911
+ });
1912
+ }
1429
1913
 
1430
1914
  /**
1431
- * Get a list of all webhooks
1432
- * Returns a list of the webhooks configured for your account. Supports pagination and filtering by event type, mode, and the API token, template, or folder a webhook is scoped to.
1915
+ * List webhooks
1916
+ * Returns the webhooks in your account, newest first, one page at a time. Filter them by event type, mode, or the API token, template or folder they're scoped to.
1433
1917
  * @param {Object} opts Optional parameters
1434
- * @param {Number} [page] Default: 1
1435
- * @param {Number} [per_page] Default: 50
1436
- * @param {String} [event_type] Filter by a subscribed event type
1437
- * @param {String} [mode] Filter by mode (test or live)
1438
- * @param {String} [template_id] Filter by a scoped template ID
1439
- * @param {String} [folder_id] Filter by a scoped folder ID
1440
- * @param {String} [api_token_id] Filter by a scoped API token ID
1441
- * @param {module:api/Client~listWebhooksCallback} callback The callback function, accepting three arguments: error, data, response
1442
- * data is of type: {@link Array.<module:model/Webhook>}
1918
+ * @param {module:model/WebhookEventType} [event_type] Only list webhooks that subscribe to this event.
1919
+ * @param {module:model/WebhookMode} [mode] Only list webhooks set to this mode.
1920
+ * @param {String} [template_id] Only list webhooks scoped to this template.
1921
+ * @param {String} [folder_id] Only list webhooks scoped to this folder.
1922
+ * @param {String} [api_token_id] Only list webhooks scoped to this API token.
1923
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1924
+ * @param {String} [cursor] The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1925
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WebhookList} and HTTP response
1443
1926
  */
1444
1927
  }, {
1445
- key: "listWebhooks",
1446
- value: function listWebhooks(opts, callback) {
1928
+ key: "listWebhooksWithHttpInfo",
1929
+ value: function listWebhooksWithHttpInfo(opts) {
1447
1930
  opts = opts || {};
1448
1931
  var postBody = null;
1449
1932
  var pathParams = {};
1450
1933
  var queryParams = {
1451
- 'page': opts['page'],
1452
- 'per_page': opts['per_page'],
1453
1934
  'event_type': opts['event_type'],
1454
1935
  'mode': opts['mode'],
1455
1936
  'template_id': opts['template_id'],
1456
1937
  'folder_id': opts['folder_id'],
1457
- 'api_token_id': opts['api_token_id']
1938
+ 'api_token_id': opts['api_token_id'],
1939
+ 'limit': opts['limit'],
1940
+ 'cursor': opts['cursor']
1458
1941
  };
1459
1942
  var headerParams = {};
1460
1943
  var formParams = {};
1461
1944
  var authNames = ['api_token_basic'];
1462
1945
  var contentTypes = [];
1463
1946
  var accepts = ['application/json'];
1464
- var returnType = [_Webhook["default"]];
1465
- return this.apiClient.callApi('/webhooks', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1947
+ var returnType = _WebhookList["default"];
1948
+ return this.apiClient.callApi('/webhooks', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1466
1949
  }
1467
1950
 
1468
1951
  /**
1469
- * Callback function to receive the result of the moveFolderToFolder operation.
1470
- * @callback module:api/Client~moveFolderToFolderCallback
1471
- * @param {String} error Error message, if any.
1472
- * @param {module:model/Folder} data The data returned by the service call.
1473
- * @param {String} response The complete HTTP response.
1952
+ * List webhooks
1953
+ * Returns the webhooks in your account, newest first, one page at a time. Filter them by event type, mode, or the API token, template or folder they're scoped to.
1954
+ * @param {Object} opts Optional parameters
1955
+ * @param {module:model/WebhookEventType} opts.event_type Only list webhooks that subscribe to this event.
1956
+ * @param {module:model/WebhookMode} opts.mode Only list webhooks set to this mode.
1957
+ * @param {String} opts.template_id Only list webhooks scoped to this template.
1958
+ * @param {String} opts.folder_id Only list webhooks scoped to this folder.
1959
+ * @param {String} opts.api_token_id Only list webhooks scoped to this API token.
1960
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1961
+ * @param {String} opts.cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
1962
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WebhookList}
1474
1963
  */
1964
+ }, {
1965
+ key: "listWebhooks",
1966
+ value: function listWebhooks(opts) {
1967
+ return this.listWebhooksWithHttpInfo(opts).then(function (response_and_data) {
1968
+ return response_and_data.data;
1969
+ });
1970
+ }
1475
1971
 
1476
1972
  /**
1477
1973
  * Move a folder
1478
- * Moves a folder to a new parent folder or to the root level. All templates and subfolders within the folder are moved together. Cannot move a folder into one of its own subfolders.
1479
- * @param {String} folder_id
1480
- * @param {module:model/MoveFolderData} data
1481
- * @param {module:api/Client~moveFolderToFolderCallback} callback The callback function, accepting three arguments: error, data, response
1482
- * data is of type: {@link module:model/Folder}
1974
+ * Moves a folder into another folder, or to the root with `parent_folder_id: null`. Its templates and folders move with it. A folder can't move into itself or one of its own folders.
1975
+ * @param {String} folder_id The folder's ID.
1976
+ * @param {module:model/MoveFolderRequest} body Where to move the folder.
1977
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
1483
1978
  */
1484
1979
  }, {
1485
- key: "moveFolderToFolder",
1486
- value: function moveFolderToFolder(folder_id, data, callback) {
1487
- var postBody = data;
1980
+ key: "moveFolderWithHttpInfo",
1981
+ value: function moveFolderWithHttpInfo(folder_id, body) {
1982
+ var postBody = body;
1488
1983
  // verify the required parameter 'folder_id' is set
1489
1984
  if (folder_id === undefined || folder_id === null) {
1490
- throw new Error("Missing the required parameter 'folder_id' when calling moveFolderToFolder");
1985
+ throw new Error("Missing the required parameter 'folder_id' when calling moveFolder");
1491
1986
  }
1492
- // verify the required parameter 'data' is set
1493
- if (data === undefined || data === null) {
1494
- throw new Error("Missing the required parameter 'data' when calling moveFolderToFolder");
1987
+ // verify the required parameter 'body' is set
1988
+ if (body === undefined || body === null) {
1989
+ throw new Error("Missing the required parameter 'body' when calling moveFolder");
1495
1990
  }
1496
1991
  var pathParams = {
1497
1992
  'folder_id': folder_id
@@ -1503,36 +1998,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1503
1998
  var contentTypes = ['application/json'];
1504
1999
  var accepts = ['application/json'];
1505
2000
  var returnType = _Folder["default"];
1506
- return this.apiClient.callApi('/folders/{folder_id}/move', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2001
+ return this.apiClient.callApi('/folders/{folder_id}/move', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1507
2002
  }
1508
2003
 
1509
2004
  /**
1510
- * Callback function to receive the result of the moveTemplateToFolder operation.
1511
- * @callback module:api/Client~moveTemplateToFolderCallback
1512
- * @param {String} error Error message, if any.
1513
- * @param {module:model/TemplatePreview} data The data returned by the service call.
1514
- * @param {String} response The complete HTTP response.
2005
+ * Move a folder
2006
+ * Moves a folder into another folder, or to the root with `parent_folder_id: null`. Its templates and folders move with it. A folder can't move into itself or one of its own folders.
2007
+ * @param {String} folder_id The folder's ID.
2008
+ * @param {module:model/MoveFolderRequest} body Where to move the folder.
2009
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
1515
2010
  */
2011
+ }, {
2012
+ key: "moveFolder",
2013
+ value: function moveFolder(folder_id, body) {
2014
+ return this.moveFolderWithHttpInfo(folder_id, body).then(function (response_and_data) {
2015
+ return response_and_data.data;
2016
+ });
2017
+ }
1516
2018
 
1517
2019
  /**
1518
- * Move Template to folder
1519
- * Moves a template to a different folder or to the root level. Use this to organize templates within your folders. Provide a folder ID to move to a specific folder, or `null` to move to the root level.
1520
- * @param {String} template_id
1521
- * @param {module:model/MoveTemplateData} data
1522
- * @param {module:api/Client~moveTemplateToFolderCallback} callback The callback function, accepting three arguments: error, data, response
1523
- * data is of type: {@link module:model/TemplatePreview}
2020
+ * Move a template to a folder
2021
+ * Moves a template and all of its published versions to a folder, or to the root (`null`).
2022
+ * @param {String} template_id The template's ID.
2023
+ * @param {module:model/MoveTemplateRequest} body Where to move the template.
2024
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1524
2025
  */
1525
2026
  }, {
1526
- key: "moveTemplateToFolder",
1527
- value: function moveTemplateToFolder(template_id, data, callback) {
1528
- var postBody = data;
2027
+ key: "moveTemplateWithHttpInfo",
2028
+ value: function moveTemplateWithHttpInfo(template_id, body) {
2029
+ var postBody = body;
1529
2030
  // verify the required parameter 'template_id' is set
1530
2031
  if (template_id === undefined || template_id === null) {
1531
- throw new Error("Missing the required parameter 'template_id' when calling moveTemplateToFolder");
2032
+ throw new Error("Missing the required parameter 'template_id' when calling moveTemplate");
1532
2033
  }
1533
- // verify the required parameter 'data' is set
1534
- if (data === undefined || data === null) {
1535
- throw new Error("Missing the required parameter 'data' when calling moveTemplateToFolder");
2034
+ // verify the required parameter 'body' is set
2035
+ if (body === undefined || body === null) {
2036
+ throw new Error("Missing the required parameter 'body' when calling moveTemplate");
1536
2037
  }
1537
2038
  var pathParams = {
1538
2039
  'template_id': template_id
@@ -1543,37 +2044,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1543
2044
  var authNames = ['api_token_basic'];
1544
2045
  var contentTypes = ['application/json'];
1545
2046
  var accepts = ['application/json'];
1546
- var returnType = _TemplatePreview["default"];
1547
- return this.apiClient.callApi('/templates/{template_id}/move', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2047
+ var returnType = _Template["default"];
2048
+ return this.apiClient.callApi('/templates/{template_id}/move', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1548
2049
  }
1549
2050
 
1550
2051
  /**
1551
- * Callback function to receive the result of the publishTemplateVersion operation.
1552
- * @callback module:api/Client~publishTemplateVersionCallback
1553
- * @param {String} error Error message, if any.
1554
- * @param {module:model/TemplatePublishVersionResponse} data The data returned by the service call.
1555
- * @param {String} response The complete HTTP response.
2052
+ * Move a template to a folder
2053
+ * Moves a template and all of its published versions to a folder, or to the root (`null`).
2054
+ * @param {String} template_id The template's ID.
2055
+ * @param {module:model/MoveTemplateRequest} body Where to move the template.
2056
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1556
2057
  */
2058
+ }, {
2059
+ key: "moveTemplate",
2060
+ value: function moveTemplate(template_id, body) {
2061
+ return this.moveTemplateWithHttpInfo(template_id, body).then(function (response_and_data) {
2062
+ return response_and_data.data;
2063
+ });
2064
+ }
1557
2065
 
1558
2066
  /**
1559
2067
  * Publish a template version
1560
- * Publishes the current draft version of a template and creates a new immutable version with semantic versioning (major.minor.patch).
1561
- * @param {String} template_id
1562
- * @param {module:model/PublishVersionData} data
1563
- * @param {module:api/Client~publishTemplateVersionCallback} callback The callback function, accepting three arguments: error, data, response
1564
- * data is of type: {@link module:model/TemplatePublishVersionResponse}
2068
+ * Publishes the template's draft as a new version that doesn't change. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
2069
+ * @param {String} template_id The template's ID.
2070
+ * @param {module:model/PublishTemplateVersionRequest} body The version to publish.
2071
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateVersion} and HTTP response
1565
2072
  */
1566
2073
  }, {
1567
- key: "publishTemplateVersion",
1568
- value: function publishTemplateVersion(template_id, data, callback) {
1569
- var postBody = data;
2074
+ key: "publishTemplateVersionWithHttpInfo",
2075
+ value: function publishTemplateVersionWithHttpInfo(template_id, body) {
2076
+ var postBody = body;
1570
2077
  // verify the required parameter 'template_id' is set
1571
2078
  if (template_id === undefined || template_id === null) {
1572
2079
  throw new Error("Missing the required parameter 'template_id' when calling publishTemplateVersion");
1573
2080
  }
1574
- // verify the required parameter 'data' is set
1575
- if (data === undefined || data === null) {
1576
- throw new Error("Missing the required parameter 'data' when calling publishTemplateVersion");
2081
+ // verify the required parameter 'body' is set
2082
+ if (body === undefined || body === null) {
2083
+ throw new Error("Missing the required parameter 'body' when calling publishTemplateVersion");
1577
2084
  }
1578
2085
  var pathParams = {
1579
2086
  'template_id': template_id
@@ -1584,37 +2091,90 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1584
2091
  var authNames = ['api_token_basic'];
1585
2092
  var contentTypes = ['application/json'];
1586
2093
  var accepts = ['application/json'];
1587
- var returnType = _TemplatePublishVersionResponse["default"];
1588
- return this.apiClient.callApi('/templates/{template_id}/publish_version', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2094
+ var returnType = _TemplateVersion["default"];
2095
+ return this.apiClient.callApi('/templates/{template_id}/publish_version', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1589
2096
  }
1590
2097
 
1591
2098
  /**
1592
- * Callback function to receive the result of the renameFolder operation.
1593
- * @callback module:api/Client~renameFolderCallback
1594
- * @param {String} error Error message, if any.
1595
- * @param {module:model/Folder} data The data returned by the service call.
1596
- * @param {String} response The complete HTTP response.
2099
+ * Publish a template version
2100
+ * Publishes the template's draft as a new version that doesn't change. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
2101
+ * @param {String} template_id The template's ID.
2102
+ * @param {module:model/PublishTemplateVersionRequest} body The version to publish.
2103
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateVersion}
1597
2104
  */
2105
+ }, {
2106
+ key: "publishTemplateVersion",
2107
+ value: function publishTemplateVersion(template_id, body) {
2108
+ return this.publishTemplateVersionWithHttpInfo(template_id, body).then(function (response_and_data) {
2109
+ return response_and_data.data;
2110
+ });
2111
+ }
2112
+
2113
+ /**
2114
+ * Remove fields from a template
2115
+ * Removes fields from a template's draft and returns the fields that are left. Conditional logic that used only the removed fields is removed too.
2116
+ * @param {String} template_id The template's ID.
2117
+ * @param {module:model/RemoveTemplateFieldsRequest} body The fields to remove from the template's draft.
2118
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateFields} and HTTP response
2119
+ */
2120
+ }, {
2121
+ key: "removeTemplateFieldsWithHttpInfo",
2122
+ value: function removeTemplateFieldsWithHttpInfo(template_id, body) {
2123
+ var postBody = body;
2124
+ // verify the required parameter 'template_id' is set
2125
+ if (template_id === undefined || template_id === null) {
2126
+ throw new Error("Missing the required parameter 'template_id' when calling removeTemplateFields");
2127
+ }
2128
+ // verify the required parameter 'body' is set
2129
+ if (body === undefined || body === null) {
2130
+ throw new Error("Missing the required parameter 'body' when calling removeTemplateFields");
2131
+ }
2132
+ var pathParams = {
2133
+ 'template_id': template_id
2134
+ };
2135
+ var queryParams = {};
2136
+ var headerParams = {};
2137
+ var formParams = {};
2138
+ var authNames = ['api_token_basic'];
2139
+ var contentTypes = ['application/json'];
2140
+ var accepts = ['application/json'];
2141
+ var returnType = _TemplateFields["default"];
2142
+ return this.apiClient.callApi('/templates/{template_id}/fields/remove', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2143
+ }
2144
+
2145
+ /**
2146
+ * Remove fields from a template
2147
+ * Removes fields from a template's draft and returns the fields that are left. Conditional logic that used only the removed fields is removed too.
2148
+ * @param {String} template_id The template's ID.
2149
+ * @param {module:model/RemoveTemplateFieldsRequest} body The fields to remove from the template's draft.
2150
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateFields}
2151
+ */
2152
+ }, {
2153
+ key: "removeTemplateFields",
2154
+ value: function removeTemplateFields(template_id, body) {
2155
+ return this.removeTemplateFieldsWithHttpInfo(template_id, body).then(function (response_and_data) {
2156
+ return response_and_data.data;
2157
+ });
2158
+ }
1598
2159
 
1599
2160
  /**
1600
2161
  * Rename a folder
1601
- * Renames an existing folder. The new name must be unique within the same parent folder. This operation only changes the folder name, not its location or contents.
1602
- * @param {String} folder_id
1603
- * @param {module:model/RenameFolderData} data
1604
- * @param {module:api/Client~renameFolderCallback} callback The callback function, accepting three arguments: error, data, response
1605
- * data is of type: {@link module:model/Folder}
2162
+ * Renames a folder. The name must be unique within its parent folder.
2163
+ * @param {String} folder_id The folder's ID.
2164
+ * @param {module:model/RenameFolderRequest} body The folder's new name.
2165
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
1606
2166
  */
1607
2167
  }, {
1608
- key: "renameFolder",
1609
- value: function renameFolder(folder_id, data, callback) {
1610
- var postBody = data;
2168
+ key: "renameFolderWithHttpInfo",
2169
+ value: function renameFolderWithHttpInfo(folder_id, body) {
2170
+ var postBody = body;
1611
2171
  // verify the required parameter 'folder_id' is set
1612
2172
  if (folder_id === undefined || folder_id === null) {
1613
2173
  throw new Error("Missing the required parameter 'folder_id' when calling renameFolder");
1614
2174
  }
1615
- // verify the required parameter 'data' is set
1616
- if (data === undefined || data === null) {
1617
- throw new Error("Missing the required parameter 'data' when calling renameFolder");
2175
+ // verify the required parameter 'body' is set
2176
+ if (body === undefined || body === null) {
2177
+ throw new Error("Missing the required parameter 'body' when calling renameFolder");
1618
2178
  }
1619
2179
  var pathParams = {
1620
2180
  'folder_id': folder_id
@@ -1626,36 +2186,89 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1626
2186
  var contentTypes = ['application/json'];
1627
2187
  var accepts = ['application/json'];
1628
2188
  var returnType = _Folder["default"];
1629
- return this.apiClient.callApi('/folders/{folder_id}/rename', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2189
+ return this.apiClient.callApi('/folders/{folder_id}/rename', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2190
+ }
2191
+
2192
+ /**
2193
+ * Rename a folder
2194
+ * Renames a folder. The name must be unique within its parent folder.
2195
+ * @param {String} folder_id The folder's ID.
2196
+ * @param {module:model/RenameFolderRequest} body The folder's new name.
2197
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
2198
+ */
2199
+ }, {
2200
+ key: "renameFolder",
2201
+ value: function renameFolder(folder_id, body) {
2202
+ return this.renameFolderWithHttpInfo(folder_id, body).then(function (response_and_data) {
2203
+ return response_and_data.data;
2204
+ });
2205
+ }
2206
+
2207
+ /**
2208
+ * Reorder a template's fields
2209
+ * Changes the order of the fields in a template's draft and returns them in their new order. Send every field's ID: each field stays on its page, and a page's fields are printed in this order, so a later field prints over an earlier one where they overlap. Their values are in this order in the template's data schema and forms.
2210
+ * @param {String} template_id The template's ID.
2211
+ * @param {module:model/ReorderTemplateFieldsRequest} body The new order of the fields in the template's draft.
2212
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateFields} and HTTP response
2213
+ */
2214
+ }, {
2215
+ key: "reorderTemplateFieldsWithHttpInfo",
2216
+ value: function reorderTemplateFieldsWithHttpInfo(template_id, body) {
2217
+ var postBody = body;
2218
+ // verify the required parameter 'template_id' is set
2219
+ if (template_id === undefined || template_id === null) {
2220
+ throw new Error("Missing the required parameter 'template_id' when calling reorderTemplateFields");
2221
+ }
2222
+ // verify the required parameter 'body' is set
2223
+ if (body === undefined || body === null) {
2224
+ throw new Error("Missing the required parameter 'body' when calling reorderTemplateFields");
2225
+ }
2226
+ var pathParams = {
2227
+ 'template_id': template_id
2228
+ };
2229
+ var queryParams = {};
2230
+ var headerParams = {};
2231
+ var formParams = {};
2232
+ var authNames = ['api_token_basic'];
2233
+ var contentTypes = ['application/json'];
2234
+ var accepts = ['application/json'];
2235
+ var returnType = _TemplateFields["default"];
2236
+ return this.apiClient.callApi('/templates/{template_id}/fields/reorder', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1630
2237
  }
1631
2238
 
1632
2239
  /**
1633
- * Callback function to receive the result of the restoreTemplateVersion operation.
1634
- * @callback module:api/Client~restoreTemplateVersionCallback
1635
- * @param {String} error Error message, if any.
1636
- * @param {module:model/SuccessErrorResponse} data The data returned by the service call.
1637
- * @param {String} response The complete HTTP response.
2240
+ * Reorder a template's fields
2241
+ * Changes the order of the fields in a template's draft and returns them in their new order. Send every field's ID: each field stays on its page, and a page's fields are printed in this order, so a later field prints over an earlier one where they overlap. Their values are in this order in the template's data schema and forms.
2242
+ * @param {String} template_id The template's ID.
2243
+ * @param {module:model/ReorderTemplateFieldsRequest} body The new order of the fields in the template's draft.
2244
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateFields}
1638
2245
  */
2246
+ }, {
2247
+ key: "reorderTemplateFields",
2248
+ value: function reorderTemplateFields(template_id, body) {
2249
+ return this.reorderTemplateFieldsWithHttpInfo(template_id, body).then(function (response_and_data) {
2250
+ return response_and_data.data;
2251
+ });
2252
+ }
1639
2253
 
1640
2254
  /**
1641
2255
  * Restore a template version
1642
- * Restores your template to a previously published version, copying that version's content and configuration to the current draft. Use this to revert changes or recover from an unwanted modification.
1643
- * @param {String} template_id
1644
- * @param {module:model/RestoreVersionData} data
1645
- * @param {module:api/Client~restoreTemplateVersionCallback} callback The callback function, accepting three arguments: error, data, response
1646
- * data is of type: {@link module:model/SuccessErrorResponse}
2256
+ * Replaces the template's draft with a copy of one of its published versions.
2257
+ * @param {String} template_id The template's ID.
2258
+ * @param {module:model/RestoreTemplateVersionRequest} body The version to restore.
2259
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1647
2260
  */
1648
2261
  }, {
1649
- key: "restoreTemplateVersion",
1650
- value: function restoreTemplateVersion(template_id, data, callback) {
1651
- var postBody = data;
2262
+ key: "restoreTemplateVersionWithHttpInfo",
2263
+ value: function restoreTemplateVersionWithHttpInfo(template_id, body) {
2264
+ var postBody = body;
1652
2265
  // verify the required parameter 'template_id' is set
1653
2266
  if (template_id === undefined || template_id === null) {
1654
2267
  throw new Error("Missing the required parameter 'template_id' when calling restoreTemplateVersion");
1655
2268
  }
1656
- // verify the required parameter 'data' is set
1657
- if (data === undefined || data === null) {
1658
- throw new Error("Missing the required parameter 'data' when calling restoreTemplateVersion");
2269
+ // verify the required parameter 'body' is set
2270
+ if (body === undefined || body === null) {
2271
+ throw new Error("Missing the required parameter 'body' when calling restoreTemplateVersion");
1659
2272
  }
1660
2273
  var pathParams = {
1661
2274
  'template_id': template_id
@@ -1666,27 +2279,33 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1666
2279
  var authNames = ['api_token_basic'];
1667
2280
  var contentTypes = ['application/json'];
1668
2281
  var accepts = ['application/json'];
1669
- var returnType = _SuccessErrorResponse["default"];
1670
- return this.apiClient.callApi('/templates/{template_id}/restore_version', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2282
+ var returnType = _Template["default"];
2283
+ return this.apiClient.callApi('/templates/{template_id}/restore_version', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1671
2284
  }
1672
2285
 
1673
2286
  /**
1674
- * Callback function to receive the result of the testAuthentication operation.
1675
- * @callback module:api/Client~testAuthenticationCallback
1676
- * @param {String} error Error message, if any.
1677
- * @param {module:model/SuccessErrorResponse} data The data returned by the service call.
1678
- * @param {String} response The complete HTTP response.
2287
+ * Restore a template version
2288
+ * Replaces the template's draft with a copy of one of its published versions.
2289
+ * @param {String} template_id The template's ID.
2290
+ * @param {module:model/RestoreTemplateVersionRequest} body The version to restore.
2291
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1679
2292
  */
2293
+ }, {
2294
+ key: "restoreTemplateVersion",
2295
+ value: function restoreTemplateVersion(template_id, body) {
2296
+ return this.restoreTemplateVersionWithHttpInfo(template_id, body).then(function (response_and_data) {
2297
+ return response_and_data.data;
2298
+ });
2299
+ }
1680
2300
 
1681
2301
  /**
1682
2302
  * Test authentication
1683
- * Checks whether your API token is valid by making an authenticated request. Returns a success response if authentication passes. This endpoint is useful for verifying credentials during setup or troubleshooting issues.
1684
- * @param {module:api/Client~testAuthenticationCallback} callback The callback function, accepting three arguments: error, data, response
1685
- * data is of type: {@link module:model/SuccessErrorResponse}
2303
+ * Checks whether your API token is valid by making an authenticated request. This endpoint is useful for verifying credentials during setup or troubleshooting issues.
2304
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AuthenticationCheck} and HTTP response
1686
2305
  */
1687
2306
  }, {
1688
- key: "testAuthentication",
1689
- value: function testAuthentication(callback) {
2307
+ key: "testAuthenticationWithHttpInfo",
2308
+ value: function testAuthenticationWithHttpInfo() {
1690
2309
  var postBody = null;
1691
2310
  var pathParams = {};
1692
2311
  var queryParams = {};
@@ -1695,40 +2314,44 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1695
2314
  var authNames = ['api_token_basic'];
1696
2315
  var contentTypes = [];
1697
2316
  var accepts = ['application/json'];
1698
- var returnType = _SuccessErrorResponse["default"];
1699
- return this.apiClient.callApi('/authentication', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2317
+ var returnType = _AuthenticationCheck["default"];
2318
+ return this.apiClient.callApi('/authentication', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1700
2319
  }
1701
2320
 
1702
2321
  /**
1703
- * Callback function to receive the result of the updateDataRequest operation.
1704
- * @callback module:api/Client~updateDataRequestCallback
1705
- * @param {String} error Error message, if any.
1706
- * @param {module:model/CreateSubmissionDataRequestResponse} data The data returned by the service call.
1707
- * @param {String} response The complete HTTP response.
2322
+ * Test authentication
2323
+ * Checks whether your API token is valid by making an authenticated request. This endpoint is useful for verifying credentials during setup or troubleshooting issues.
2324
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AuthenticationCheck}
1708
2325
  */
2326
+ }, {
2327
+ key: "testAuthentication",
2328
+ value: function testAuthentication() {
2329
+ return this.testAuthenticationWithHttpInfo().then(function (response_and_data) {
2330
+ return response_and_data.data;
2331
+ });
2332
+ }
1709
2333
 
1710
2334
  /**
1711
- * Update a submission data request
1712
- * Updates authentication details for a data request. Use this when a user logs in to record their authentication method, provider, session information, and hashed identifiers. Updates metadata and tracks authentication state changes for auditing and compliance.
1713
- * @param {String} data_request_id
1714
- * @param {module:model/UpdateSubmissionDataRequestData} data
1715
- * @param {module:api/Client~updateDataRequestCallback} callback The callback function, accepting three arguments: error, data, response
1716
- * data is of type: {@link module:model/CreateSubmissionDataRequestResponse}
2335
+ * Update a signature request
2336
+ * Changes a pending signature request's metadata, or how your app authenticated the person (for the audit trail). Once the person has opened it, only its metadata can be changed, and a completed or declined signature request can't be changed.
2337
+ * @param {String} signature_request_id The signature request's ID.
2338
+ * @param {module:model/UpdateSignatureRequestRequest} body The settings to change. Properties left out keep their values.
2339
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequest} and HTTP response
1717
2340
  */
1718
2341
  }, {
1719
- key: "updateDataRequest",
1720
- value: function updateDataRequest(data_request_id, data, callback) {
1721
- var postBody = data;
1722
- // verify the required parameter 'data_request_id' is set
1723
- if (data_request_id === undefined || data_request_id === null) {
1724
- throw new Error("Missing the required parameter 'data_request_id' when calling updateDataRequest");
2342
+ key: "updateSignatureRequestWithHttpInfo",
2343
+ value: function updateSignatureRequestWithHttpInfo(signature_request_id, body) {
2344
+ var postBody = body;
2345
+ // verify the required parameter 'signature_request_id' is set
2346
+ if (signature_request_id === undefined || signature_request_id === null) {
2347
+ throw new Error("Missing the required parameter 'signature_request_id' when calling updateSignatureRequest");
1725
2348
  }
1726
- // verify the required parameter 'data' is set
1727
- if (data === undefined || data === null) {
1728
- throw new Error("Missing the required parameter 'data' when calling updateDataRequest");
2349
+ // verify the required parameter 'body' is set
2350
+ if (body === undefined || body === null) {
2351
+ throw new Error("Missing the required parameter 'body' when calling updateSignatureRequest");
1729
2352
  }
1730
2353
  var pathParams = {
1731
- 'data_request_id': data_request_id
2354
+ 'signature_request_id': signature_request_id
1732
2355
  };
1733
2356
  var queryParams = {};
1734
2357
  var headerParams = {};
@@ -1736,37 +2359,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1736
2359
  var authNames = ['api_token_basic'];
1737
2360
  var contentTypes = ['application/json'];
1738
2361
  var accepts = ['application/json'];
1739
- var returnType = _CreateSubmissionDataRequestResponse["default"];
1740
- return this.apiClient.callApi('/data_requests/{data_request_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2362
+ var returnType = _SignatureRequest["default"];
2363
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1741
2364
  }
1742
2365
 
1743
2366
  /**
1744
- * Callback function to receive the result of the updateTemplate operation.
1745
- * @callback module:api/Client~updateTemplateCallback
1746
- * @param {String} error Error message, if any.
1747
- * @param {module:model/SuccessMultipleErrorsResponse} data The data returned by the service call.
1748
- * @param {String} response The complete HTTP response.
2367
+ * Update a signature request
2368
+ * Changes a pending signature request's metadata, or how your app authenticated the person (for the audit trail). Once the person has opened it, only its metadata can be changed, and a completed or declined signature request can't be changed.
2369
+ * @param {String} signature_request_id The signature request's ID.
2370
+ * @param {module:model/UpdateSignatureRequestRequest} body The settings to change. Properties left out keep their values.
2371
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequest}
1749
2372
  */
2373
+ }, {
2374
+ key: "updateSignatureRequest",
2375
+ value: function updateSignatureRequest(signature_request_id, body) {
2376
+ return this.updateSignatureRequestWithHttpInfo(signature_request_id, body).then(function (response_and_data) {
2377
+ return response_and_data.data;
2378
+ });
2379
+ }
1750
2380
 
1751
2381
  /**
1752
- * Update a Template
1753
- * Updates template content and properties. For HTML templates, you can modify the HTML, SCSS, headers, footers, name, and description. Changes are applied to your draft template and do not affect published template versions. The exception is `parent_folder_id`: moving the template to another folder moves its published versions too.
1754
- * @param {String} template_id
1755
- * @param {module:model/UpdateHtmlTemplate} data
1756
- * @param {module:api/Client~updateTemplateCallback} callback The callback function, accepting three arguments: error, data, response
1757
- * data is of type: {@link module:model/SuccessMultipleErrorsResponse}
2382
+ * Update a template
2383
+ * Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Setting `parent_folder_id` moves the template and all of its published versions.
2384
+ * @param {String} template_id The template's ID.
2385
+ * @param {module:model/UpdateTemplateRequest} body The settings to change. Properties left out keep their values.
2386
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1758
2387
  */
1759
2388
  }, {
1760
- key: "updateTemplate",
1761
- value: function updateTemplate(template_id, data, callback) {
1762
- var postBody = data;
2389
+ key: "updateTemplateWithHttpInfo",
2390
+ value: function updateTemplateWithHttpInfo(template_id, body) {
2391
+ var postBody = body;
1763
2392
  // verify the required parameter 'template_id' is set
1764
2393
  if (template_id === undefined || template_id === null) {
1765
2394
  throw new Error("Missing the required parameter 'template_id' when calling updateTemplate");
1766
2395
  }
1767
- // verify the required parameter 'data' is set
1768
- if (data === undefined || data === null) {
1769
- throw new Error("Missing the required parameter 'data' when calling updateTemplate");
2396
+ // verify the required parameter 'body' is set
2397
+ if (body === undefined || body === null) {
2398
+ throw new Error("Missing the required parameter 'body' when calling updateTemplate");
1770
2399
  }
1771
2400
  var pathParams = {
1772
2401
  'template_id': template_id
@@ -1777,84 +2406,97 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1777
2406
  var authNames = ['api_token_basic'];
1778
2407
  var contentTypes = ['application/json'];
1779
2408
  var accepts = ['application/json'];
1780
- var returnType = _SuccessMultipleErrorsResponse["default"];
1781
- return this.apiClient.callApi('/templates/{template_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2409
+ var returnType = _Template["default"];
2410
+ return this.apiClient.callApi('/templates/{template_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1782
2411
  }
1783
2412
 
1784
2413
  /**
1785
- * Callback function to receive the result of the updateTemplateDocument operation.
1786
- * @callback module:api/Client~updateTemplateDocumentCallback
1787
- * @param {String} error Error message, if any.
1788
- * @param {module:model/SuccessMultipleErrorsResponse} data The data returned by the service call.
1789
- * @param {String} response The complete HTTP response.
2414
+ * Update a template
2415
+ * Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Setting `parent_folder_id` moves the template and all of its published versions.
2416
+ * @param {String} template_id The template's ID.
2417
+ * @param {module:model/UpdateTemplateRequest} body The settings to change. Properties left out keep their values.
2418
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1790
2419
  */
2420
+ }, {
2421
+ key: "updateTemplate",
2422
+ value: function updateTemplate(template_id, body) {
2423
+ return this.updateTemplateWithHttpInfo(template_id, body).then(function (response_and_data) {
2424
+ return response_and_data.data;
2425
+ });
2426
+ }
1791
2427
 
1792
2428
  /**
1793
- * Update a template's document with a form POST file upload
1794
- * Upload a new PDF file to update a PDF template's document. This replaces the template's PDF while preserving all of the existing fields. If you upload a PDF with fewer pages than the current document, any fields on the removed pages will be deleted.
1795
- * @param {String} template_id
1796
- * @param {File} template_document
2429
+ * Replace a template's PDF
2430
+ * Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
2431
+ * @param {String} template_id The template's ID.
2432
+ * @param {module:model/UpdateTemplateDocumentRequest} body The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
1797
2433
  * @param {Object} opts Optional parameters
1798
- * @param {String} [template_name]
1799
- * @param {module:api/Client~updateTemplateDocumentCallback} callback The callback function, accepting three arguments: error, data, response
1800
- * data is of type: {@link module:model/SuccessMultipleErrorsResponse}
2434
+ * @param {Boolean} [wait] Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
2435
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1801
2436
  */
1802
2437
  }, {
1803
- key: "updateTemplateDocument",
1804
- value: function updateTemplateDocument(template_id, template_document, opts, callback) {
2438
+ key: "updateTemplateDocumentWithHttpInfo",
2439
+ value: function updateTemplateDocumentWithHttpInfo(template_id, body, opts) {
1805
2440
  opts = opts || {};
1806
- var postBody = null;
2441
+ var postBody = body;
1807
2442
  // verify the required parameter 'template_id' is set
1808
2443
  if (template_id === undefined || template_id === null) {
1809
2444
  throw new Error("Missing the required parameter 'template_id' when calling updateTemplateDocument");
1810
2445
  }
1811
- // verify the required parameter 'template_document' is set
1812
- if (template_document === undefined || template_document === null) {
1813
- throw new Error("Missing the required parameter 'template_document' when calling updateTemplateDocument");
2446
+ // verify the required parameter 'body' is set
2447
+ if (body === undefined || body === null) {
2448
+ throw new Error("Missing the required parameter 'body' when calling updateTemplateDocument");
1814
2449
  }
1815
2450
  var pathParams = {
1816
2451
  'template_id': template_id
1817
2452
  };
1818
- var queryParams = {};
1819
- var headerParams = {};
1820
- var formParams = {
1821
- 'template[document]': template_document,
1822
- 'template[name]': opts['template_name']
2453
+ var queryParams = {
2454
+ 'wait': opts['wait']
1823
2455
  };
2456
+ var headerParams = {};
2457
+ var formParams = {};
1824
2458
  var authNames = ['api_token_basic'];
1825
- var contentTypes = ['multipart/form-data'];
2459
+ var contentTypes = ['application/json'];
1826
2460
  var accepts = ['application/json'];
1827
- var returnType = _SuccessMultipleErrorsResponse["default"];
1828
- return this.apiClient.callApi('/templates/{template_id}?endpoint_variant=update_template_pdf_with_form_post', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2461
+ var returnType = _Template["default"];
2462
+ return this.apiClient.callApi('/templates/{template_id}/document', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1829
2463
  }
1830
2464
 
1831
2465
  /**
1832
- * Callback function to receive the result of the updateTemplateDocumentFromUpload operation.
1833
- * @callback module:api/Client~updateTemplateDocumentFromUploadCallback
1834
- * @param {String} error Error message, if any.
1835
- * @param {module:model/SuccessMultipleErrorsResponse} data The data returned by the service call.
1836
- * @param {String} response The complete HTTP response.
2466
+ * Replace a template's PDF
2467
+ * Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
2468
+ * @param {String} template_id The template's ID.
2469
+ * @param {module:model/UpdateTemplateDocumentRequest} body The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
2470
+ * @param {Object} opts Optional parameters
2471
+ * @param {Boolean} opts.wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
2472
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1837
2473
  */
2474
+ }, {
2475
+ key: "updateTemplateDocument",
2476
+ value: function updateTemplateDocument(template_id, body, opts) {
2477
+ return this.updateTemplateDocumentWithHttpInfo(template_id, body, opts).then(function (response_and_data) {
2478
+ return response_and_data.data;
2479
+ });
2480
+ }
1838
2481
 
1839
2482
  /**
1840
- * Update a template's document with a cached S3 file upload
1841
- * Updates a PDF template's document using a cached file upload. This is a three-step process: First, request a presigned URL to upload your PDF file to our S3 bucket. Then, use that URL to upload your PDF file. Finally, submit the ID of the uploaded file to replace the template's document.
1842
- * @param {String} template_id
1843
- * @param {module:model/UpdatePdfTemplate} data
1844
- * @param {module:api/Client~updateTemplateDocumentFromUploadCallback} callback The callback function, accepting three arguments: error, data, response
1845
- * data is of type: {@link module:model/SuccessMultipleErrorsResponse}
2483
+ * Update a template's fields
2484
+ * Changes fields of a template's draft and returns all of its fields. Settings left out keep their values. A shared setting (`type`, `required`, `default`, ...) changes for every field with the same name.
2485
+ * @param {String} template_id The template's ID.
2486
+ * @param {module:model/UpdateTemplateFieldsRequest} body The fields to change in the template's draft.
2487
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateFields} and HTTP response
1846
2488
  */
1847
2489
  }, {
1848
- key: "updateTemplateDocumentFromUpload",
1849
- value: function updateTemplateDocumentFromUpload(template_id, data, callback) {
1850
- var postBody = data;
2490
+ key: "updateTemplateFieldsWithHttpInfo",
2491
+ value: function updateTemplateFieldsWithHttpInfo(template_id, body) {
2492
+ var postBody = body;
1851
2493
  // verify the required parameter 'template_id' is set
1852
2494
  if (template_id === undefined || template_id === null) {
1853
- throw new Error("Missing the required parameter 'template_id' when calling updateTemplateDocumentFromUpload");
2495
+ throw new Error("Missing the required parameter 'template_id' when calling updateTemplateFields");
1854
2496
  }
1855
- // verify the required parameter 'data' is set
1856
- if (data === undefined || data === null) {
1857
- throw new Error("Missing the required parameter 'data' when calling updateTemplateDocumentFromUpload");
2497
+ // verify the required parameter 'body' is set
2498
+ if (body === undefined || body === null) {
2499
+ throw new Error("Missing the required parameter 'body' when calling updateTemplateFields");
1858
2500
  }
1859
2501
  var pathParams = {
1860
2502
  'template_id': template_id
@@ -1865,37 +2507,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1865
2507
  var authNames = ['api_token_basic'];
1866
2508
  var contentTypes = ['application/json'];
1867
2509
  var accepts = ['application/json'];
1868
- var returnType = _SuccessMultipleErrorsResponse["default"];
1869
- return this.apiClient.callApi('/templates/{template_id}?endpoint_variant=update_template_pdf_with_cached_upload', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2510
+ var returnType = _TemplateFields["default"];
2511
+ return this.apiClient.callApi('/templates/{template_id}/fields', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1870
2512
  }
1871
2513
 
1872
2514
  /**
1873
- * Callback function to receive the result of the updateWebhook operation.
1874
- * @callback module:api/Client~updateWebhookCallback
1875
- * @param {String} error Error message, if any.
1876
- * @param {module:model/Webhook} data The data returned by the service call.
1877
- * @param {String} response The complete HTTP response.
2515
+ * Update a template's fields
2516
+ * Changes fields of a template's draft and returns all of its fields. Settings left out keep their values. A shared setting (`type`, `required`, `default`, ...) changes for every field with the same name.
2517
+ * @param {String} template_id The template's ID.
2518
+ * @param {module:model/UpdateTemplateFieldsRequest} body The fields to change in the template's draft.
2519
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateFields}
1878
2520
  */
2521
+ }, {
2522
+ key: "updateTemplateFields",
2523
+ value: function updateTemplateFields(template_id, body) {
2524
+ return this.updateTemplateFieldsWithHttpInfo(template_id, body).then(function (response_and_data) {
2525
+ return response_and_data.data;
2526
+ });
2527
+ }
1879
2528
 
1880
2529
  /**
1881
2530
  * Update a webhook
1882
- * Updates the configuration of an existing webhook.
1883
- * @param {String} webhook_id
1884
- * @param {module:model/UpdateWebhookData} data
1885
- * @param {module:api/Client~updateWebhookCallback} callback The callback function, accepting three arguments: error, data, response
1886
- * data is of type: {@link module:model/Webhook}
2531
+ * Updates a webhook. Only the properties you send change.
2532
+ * @param {String} webhook_id The webhook's ID.
2533
+ * @param {module:model/UpdateWebhookRequest} body The settings to change. Properties left out keep their values.
2534
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
1887
2535
  */
1888
2536
  }, {
1889
- key: "updateWebhook",
1890
- value: function updateWebhook(webhook_id, data, callback) {
1891
- var postBody = data;
2537
+ key: "updateWebhookWithHttpInfo",
2538
+ value: function updateWebhookWithHttpInfo(webhook_id, body) {
2539
+ var postBody = body;
1892
2540
  // verify the required parameter 'webhook_id' is set
1893
2541
  if (webhook_id === undefined || webhook_id === null) {
1894
2542
  throw new Error("Missing the required parameter 'webhook_id' when calling updateWebhook");
1895
2543
  }
1896
- // verify the required parameter 'data' is set
1897
- if (data === undefined || data === null) {
1898
- throw new Error("Missing the required parameter 'data' when calling updateWebhook");
2544
+ // verify the required parameter 'body' is set
2545
+ if (body === undefined || body === null) {
2546
+ throw new Error("Missing the required parameter 'body' when calling updateWebhook");
1899
2547
  }
1900
2548
  var pathParams = {
1901
2549
  'webhook_id': webhook_id
@@ -1907,7 +2555,207 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1907
2555
  var contentTypes = ['application/json'];
1908
2556
  var accepts = ['application/json'];
1909
2557
  var returnType = _Webhook["default"];
1910
- return this.apiClient.callApi('/webhooks/{webhook_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2558
+ return this.apiClient.callApi('/webhooks/{webhook_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2559
+ }
2560
+
2561
+ /**
2562
+ * Update a webhook
2563
+ * Updates a webhook. Only the properties you send change.
2564
+ * @param {String} webhook_id The webhook's ID.
2565
+ * @param {module:model/UpdateWebhookRequest} body The settings to change. Properties left out keep their values.
2566
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
2567
+ */
2568
+ }, {
2569
+ key: "updateWebhook",
2570
+ value: function updateWebhook(webhook_id, body) {
2571
+ return this.updateWebhookWithHttpInfo(webhook_id, body).then(function (response_and_data) {
2572
+ return response_and_data.data;
2573
+ });
2574
+ }
2575
+
2576
+ /**
2577
+ * Create a PDF template from an uploaded PDF
2578
+ * Creates a PDF template from a PDF sent with the request (`multipart/form-data`). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
2579
+ * @param {File} document The PDF.
2580
+ * @param {Object} opts Optional parameters
2581
+ * @param {Boolean} [wait] Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
2582
+ * @param {String} [name] The template's name.
2583
+ * @param {String} [description] The template's description.
2584
+ * @param {String} [parent_folder_id] The folder to put the template in. Left out, it's created at the root.
2585
+ * @param {module:model/AiFieldNamingLanguage} [ai_field_naming_language] The language AI field setup names fields in: `auto` uses the form's language when it's written in the Latin alphabet without accents, and English otherwise; `english` always uses English; `form_language` uses the form's language and script. Default: your account's template settings.
2586
+ * @param {Boolean} [detect_fields] Set up the PDF's fields as DocSpring's "Automatically detect fields" upload option does: import or detect the fields, name them with AI, and set up conditional logic. `field_source`, `field_naming` and `field_logic` choose how. Default false. `document.page_processing_statuses` and `document.field_logic_status` show how it's going, and `document.state` becomes `processed` once every page's fields are set up.
2587
+ * @param {module:model/FieldSetupSource} [field_source] With `detect_fields`, where the fields come from. `auto` (the default) imports the form fields of a fillable PDF and detects the fields of a PDF without them; `pdf_detection` detects the fields from the page layout, even on a fillable PDF; `pdf_form_fields` only imports the PDF's form fields.
2588
+ * @param {module:model/FieldSetupNaming} [field_naming] With `detect_fields`, how the fields are named. `ai` (the default) names them and sets their types and settings with AI; `preserve` keeps the names of the PDF's form fields, and AI only names the fields it detected. `preserve` needs `field_source` `auto` or `pdf_form_fields`.
2589
+ * @param {module:model/FieldSetupLogic} [field_logic] With `detect_fields`, whether AI reads the whole form once the fields are named and sets up conditional logic and required fields (`ai`) or not (`none`). Default: your account's template settings.
2590
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
2591
+ */
2592
+ }, {
2593
+ key: "uploadTemplateWithHttpInfo",
2594
+ value: function uploadTemplateWithHttpInfo(document, opts) {
2595
+ opts = opts || {};
2596
+ var postBody = null;
2597
+ // verify the required parameter 'document' is set
2598
+ if (document === undefined || document === null) {
2599
+ throw new Error("Missing the required parameter 'document' when calling uploadTemplate");
2600
+ }
2601
+ var pathParams = {};
2602
+ var queryParams = {
2603
+ 'wait': opts['wait']
2604
+ };
2605
+ var headerParams = {};
2606
+ var formParams = {
2607
+ 'document': document,
2608
+ 'name': opts['name'],
2609
+ 'description': opts['description'],
2610
+ 'parent_folder_id': opts['parent_folder_id'],
2611
+ 'ai_field_naming_language': opts['ai_field_naming_language'],
2612
+ 'detect_fields': opts['detect_fields'],
2613
+ 'field_source': opts['field_source'],
2614
+ 'field_naming': opts['field_naming'],
2615
+ 'field_logic': opts['field_logic']
2616
+ };
2617
+ var authNames = ['api_token_basic'];
2618
+ var contentTypes = ['multipart/form-data'];
2619
+ var accepts = ['application/json'];
2620
+ var returnType = _Template["default"];
2621
+ return this.apiClient.callApi('/templates/upload', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2622
+ }
2623
+
2624
+ /**
2625
+ * Create a PDF template from an uploaded PDF
2626
+ * Creates a PDF template from a PDF sent with the request (`multipart/form-data`). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
2627
+ * @param {File} document The PDF.
2628
+ * @param {Object} opts Optional parameters
2629
+ * @param {Boolean} opts.wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
2630
+ * @param {String} opts.name The template's name.
2631
+ * @param {String} opts.description The template's description.
2632
+ * @param {String} opts.parent_folder_id The folder to put the template in. Left out, it's created at the root.
2633
+ * @param {module:model/AiFieldNamingLanguage} opts.ai_field_naming_language The language AI field setup names fields in: `auto` uses the form's language when it's written in the Latin alphabet without accents, and English otherwise; `english` always uses English; `form_language` uses the form's language and script. Default: your account's template settings.
2634
+ * @param {Boolean} opts.detect_fields Set up the PDF's fields as DocSpring's "Automatically detect fields" upload option does: import or detect the fields, name them with AI, and set up conditional logic. `field_source`, `field_naming` and `field_logic` choose how. Default false. `document.page_processing_statuses` and `document.field_logic_status` show how it's going, and `document.state` becomes `processed` once every page's fields are set up.
2635
+ * @param {module:model/FieldSetupSource} opts.field_source With `detect_fields`, where the fields come from. `auto` (the default) imports the form fields of a fillable PDF and detects the fields of a PDF without them; `pdf_detection` detects the fields from the page layout, even on a fillable PDF; `pdf_form_fields` only imports the PDF's form fields.
2636
+ * @param {module:model/FieldSetupNaming} opts.field_naming With `detect_fields`, how the fields are named. `ai` (the default) names them and sets their types and settings with AI; `preserve` keeps the names of the PDF's form fields, and AI only names the fields it detected. `preserve` needs `field_source` `auto` or `pdf_form_fields`.
2637
+ * @param {module:model/FieldSetupLogic} opts.field_logic With `detect_fields`, whether AI reads the whole form once the fields are named and sets up conditional logic and required fields (`ai`) or not (`none`). Default: your account's template settings.
2638
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
2639
+ */
2640
+ }, {
2641
+ key: "uploadTemplate",
2642
+ value: function uploadTemplate(document, opts) {
2643
+ return this.uploadTemplateWithHttpInfo(document, opts).then(function (response_and_data) {
2644
+ return response_and_data.data;
2645
+ });
2646
+ }
2647
+
2648
+ /**
2649
+ * Replace a template's PDF with an uploaded PDF
2650
+ * Replaces a PDF template's PDF with one sent with the request (`multipart/form-data`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields.
2651
+ * @param {String} template_id The template's ID.
2652
+ * @param {File} document The new PDF.
2653
+ * @param {Object} opts Optional parameters
2654
+ * @param {Boolean} [wait] Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
2655
+ * @param {Boolean} [reimport_fields] Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
2656
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
2657
+ */
2658
+ }, {
2659
+ key: "uploadTemplateDocumentWithHttpInfo",
2660
+ value: function uploadTemplateDocumentWithHttpInfo(template_id, document, opts) {
2661
+ opts = opts || {};
2662
+ var postBody = null;
2663
+ // verify the required parameter 'template_id' is set
2664
+ if (template_id === undefined || template_id === null) {
2665
+ throw new Error("Missing the required parameter 'template_id' when calling uploadTemplateDocument");
2666
+ }
2667
+ // verify the required parameter 'document' is set
2668
+ if (document === undefined || document === null) {
2669
+ throw new Error("Missing the required parameter 'document' when calling uploadTemplateDocument");
2670
+ }
2671
+ var pathParams = {
2672
+ 'template_id': template_id
2673
+ };
2674
+ var queryParams = {
2675
+ 'wait': opts['wait']
2676
+ };
2677
+ var headerParams = {};
2678
+ var formParams = {
2679
+ 'document': document,
2680
+ 'reimport_fields': opts['reimport_fields']
2681
+ };
2682
+ var authNames = ['api_token_basic'];
2683
+ var contentTypes = ['multipart/form-data'];
2684
+ var accepts = ['application/json'];
2685
+ var returnType = _Template["default"];
2686
+ return this.apiClient.callApi('/templates/{template_id}/document/upload', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2687
+ }
2688
+
2689
+ /**
2690
+ * Replace a template's PDF with an uploaded PDF
2691
+ * Replaces a PDF template's PDF with one sent with the request (`multipart/form-data`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields.
2692
+ * @param {String} template_id The template's ID.
2693
+ * @param {File} document The new PDF.
2694
+ * @param {Object} opts Optional parameters
2695
+ * @param {Boolean} opts.wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
2696
+ * @param {Boolean} opts.reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
2697
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
2698
+ */
2699
+ }, {
2700
+ key: "uploadTemplateDocument",
2701
+ value: function uploadTemplateDocument(template_id, document, opts) {
2702
+ return this.uploadTemplateDocumentWithHttpInfo(template_id, document, opts).then(function (response_and_data) {
2703
+ return response_and_data.data;
2704
+ });
2705
+ }
2706
+
2707
+ /**
2708
+ * Check a submission without creating it
2709
+ * Checks a submission as creating it would (its data against the template's fields, its settings and signature requests) without saving it, generating anything or using credits. It doesn't check your account's credits. The response says whether the submission is valid, and if not, has the error that creating it would return.
2710
+ * @param {String} template_id The template's ID.
2711
+ * @param {module:model/ValidateSubmissionRequest} body The submission's data and settings.
2712
+ * @param {Object} opts Optional parameters
2713
+ * @param {String} [version] The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
2714
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionValidation} and HTTP response
2715
+ */
2716
+ }, {
2717
+ key: "validateSubmissionWithHttpInfo",
2718
+ value: function validateSubmissionWithHttpInfo(template_id, body, opts) {
2719
+ opts = opts || {};
2720
+ var postBody = body;
2721
+ // verify the required parameter 'template_id' is set
2722
+ if (template_id === undefined || template_id === null) {
2723
+ throw new Error("Missing the required parameter 'template_id' when calling validateSubmission");
2724
+ }
2725
+ // verify the required parameter 'body' is set
2726
+ if (body === undefined || body === null) {
2727
+ throw new Error("Missing the required parameter 'body' when calling validateSubmission");
2728
+ }
2729
+ var pathParams = {
2730
+ 'template_id': template_id
2731
+ };
2732
+ var queryParams = {
2733
+ 'version': opts['version']
2734
+ };
2735
+ var headerParams = {};
2736
+ var formParams = {};
2737
+ var authNames = ['api_token_basic'];
2738
+ var contentTypes = ['application/json'];
2739
+ var accepts = ['application/json'];
2740
+ var returnType = _SubmissionValidation["default"];
2741
+ return this.apiClient.callApi('/templates/{template_id}/submissions/validate', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2742
+ }
2743
+
2744
+ /**
2745
+ * Check a submission without creating it
2746
+ * Checks a submission as creating it would (its data against the template's fields, its settings and signature requests) without saving it, generating anything or using credits. It doesn't check your account's credits. The response says whether the submission is valid, and if not, has the error that creating it would return.
2747
+ * @param {String} template_id The template's ID.
2748
+ * @param {module:model/ValidateSubmissionRequest} body The submission's data and settings.
2749
+ * @param {Object} opts Optional parameters
2750
+ * @param {String} opts.version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
2751
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionValidation}
2752
+ */
2753
+ }, {
2754
+ key: "validateSubmission",
2755
+ value: function validateSubmission(template_id, body, opts) {
2756
+ return this.validateSubmissionWithHttpInfo(template_id, body, opts).then(function (response_and_data) {
2757
+ return response_and_data.data;
2758
+ });
1911
2759
  }
1912
2760
  }]);
1913
2761
  }();