docspring 3.3.0 → 4.0.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 (158) hide show
  1. package/AGENTS.md +79 -19
  2. package/README.md +65 -63
  3. package/dist/ApiClient.js +63 -28
  4. package/dist/RequestSchemas.js +2297 -0
  5. package/dist/RequestValidator.js +494 -0
  6. package/dist/api/Client.js +1346 -948
  7. package/dist/index.js +651 -154
  8. package/dist/model/AiFieldNamingLanguage.js +64 -0
  9. package/dist/model/{CreateWebhookData.js → AuthenticationCheck.js} +32 -28
  10. package/dist/model/BarcodeSymbology.js +89 -0
  11. package/dist/model/CheckCharacter.js +74 -0
  12. package/dist/model/CombinedFieldType.js +59 -0
  13. package/dist/model/CombinedPdf.js +294 -0
  14. package/dist/model/{MoveFolderData.js → CombinedPdfFiles.js} +27 -27
  15. package/dist/model/CombinedPdfList.js +132 -0
  16. package/dist/model/{ForbiddenErrorResponse.js → CombinedPdfSource.js} +59 -73
  17. package/dist/model/CombinedPdfSourceInput.js +270 -0
  18. package/dist/model/CombinedPdfSourcePdf.js +130 -0
  19. package/dist/model/CombinedPdfSourceType.js +74 -0
  20. package/dist/model/CombinedPdfState.js +74 -0
  21. package/dist/model/{CopyTemplateOptions.js → CopyTemplateRequest.js} +26 -22
  22. package/dist/model/{CombinePdfsData.js → CreateCombinedPdfRequest.js} +69 -53
  23. package/dist/model/{CreateCustomFileData.js → CreateCustomFileFromUploadRequest.js} +25 -23
  24. package/dist/model/{CreateFolderData.js → CreateFolderRequest.js} +47 -28
  25. package/dist/model/{TemplateDeleteResponse.js → CreateSignatureRequestEventRequest.js} +49 -74
  26. package/dist/model/CreateSignatureRequestTokenRequest.js +88 -0
  27. package/dist/model/{SubmissionBatchData.js → CreateSubmissionBatchRequest.js} +67 -42
  28. package/dist/model/CreateSubmissionRequest.js +212 -0
  29. package/dist/model/CreateTemplateRequest.js +545 -0
  30. package/dist/model/CreateWebhookRequest.js +234 -0
  31. package/dist/model/CustomFile.js +67 -16
  32. package/dist/model/CustomFileList.js +132 -0
  33. package/dist/model/CustomFileSourcePdf.js +130 -0
  34. package/dist/model/ErrorCode.js +154 -0
  35. package/dist/model/{CreateSubmissionResponse.js → ErrorDetail.js} +65 -75
  36. package/dist/model/ErrorInfo.js +211 -0
  37. package/dist/model/ErrorResponse.js +12 -41
  38. package/dist/model/ExpirationInterval.js +64 -0
  39. package/dist/model/FieldComparisonCondition.js +137 -0
  40. package/dist/model/FieldComparisonOperator.js +69 -0
  41. package/dist/model/FieldDisplayType.js +79 -0
  42. package/dist/model/{MultipleErrorsResponse.js → FieldEqualsCondition.js} +48 -52
  43. package/dist/model/FieldEqualsOperator.js +59 -0
  44. package/dist/model/{SuccessMultipleErrorsResponse.js → FieldInCondition.js} +54 -53
  45. package/dist/model/FieldOverride.js +722 -0
  46. package/dist/model/FieldPresenceCondition.js +126 -0
  47. package/dist/model/FieldPresenceOperator.js +59 -0
  48. package/dist/model/FieldRangeCondition.js +148 -0
  49. package/dist/model/FieldReimportState.js +69 -0
  50. package/dist/model/FieldSetupLogic.js +59 -0
  51. package/dist/model/FieldSetupNaming.js +59 -0
  52. package/dist/model/FieldSetupSource.js +64 -0
  53. package/dist/model/Folder.js +38 -11
  54. package/dist/model/FolderList.js +132 -0
  55. package/dist/model/GeneratedFile.js +214 -0
  56. package/dist/model/GeneratedFileState.js +64 -0
  57. package/dist/model/HtmlEngineOptions.js +230 -0
  58. package/dist/model/HtmlEngineOptionsInput.js +193 -0
  59. package/dist/model/ImageGravity.js +94 -0
  60. package/dist/model/ImageScaleType.js +64 -0
  61. package/dist/model/ModelCodeLanguage.js +94 -0
  62. package/dist/model/{UpdatePdfTemplate.js → MoveFolderRequest.js} +34 -28
  63. package/dist/model/{MoveTemplateData.js → MoveTemplateRequest.js} +25 -35
  64. package/dist/model/NumberConditionType.js +79 -0
  65. package/dist/model/PageFormat.js +114 -0
  66. package/dist/model/{PublishVersionData.js → PublishTemplateVersionRequest.js} +33 -33
  67. package/dist/model/{RenameFolderData.js → RenameFolderRequest.js} +25 -23
  68. package/dist/model/{RestoreVersionData.js → RestoreTemplateVersionRequest.js} +25 -23
  69. package/dist/model/ShapeType.js +79 -0
  70. package/dist/model/{SubmissionDataRequestShow.js → SignatureRequest.js} +165 -240
  71. package/dist/model/SignatureRequestAuthSecondFactorType.js +79 -0
  72. package/dist/model/SignatureRequestAuthType.js +84 -0
  73. package/dist/model/{SubmissionDataRequestEvent.js → SignatureRequestEvent.js} +67 -149
  74. package/dist/model/SignatureRequestEventType.js +79 -0
  75. package/dist/model/SignatureRequestInput.js +278 -0
  76. package/dist/model/SignatureRequestMessageType.js +94 -0
  77. package/dist/model/SignatureRequestState.js +64 -0
  78. package/dist/model/SignatureRequestToken.js +195 -0
  79. package/dist/model/SignatureRequestTokenType.js +59 -0
  80. package/dist/model/StringConditionType.js +74 -0
  81. package/dist/model/Submission.js +186 -345
  82. package/dist/model/SubmissionAction.js +30 -115
  83. package/dist/model/SubmissionActionState.js +69 -0
  84. package/dist/model/SubmissionActionType.js +84 -0
  85. package/dist/model/SubmissionBatch.js +74 -55
  86. package/dist/model/SubmissionBatchState.js +64 -0
  87. package/dist/model/SubmissionFiles.js +108 -0
  88. package/dist/model/SubmissionInput.js +204 -0
  89. package/dist/model/{ListSubmissionsResponse.js → SubmissionList.js} +35 -42
  90. package/dist/model/SubmissionSource.js +69 -0
  91. package/dist/model/SubmissionSourcePdf.js +130 -0
  92. package/dist/model/SubmissionState.js +114 -0
  93. package/dist/model/Template.js +310 -573
  94. package/dist/model/TemplateActor.js +171 -0
  95. package/dist/model/TemplateActorType.js +64 -0
  96. package/dist/model/TemplateDefaults.js +307 -0
  97. package/dist/model/TemplateDefaultsInput.js +305 -0
  98. package/dist/model/TemplateDocument.js +280 -0
  99. package/dist/model/TemplateDocumentState.js +74 -0
  100. package/dist/model/{CreatePdfSubmissionData.js → TemplateFieldDependency.js} +70 -89
  101. package/dist/model/TemplateFieldDependencyAction.js +64 -0
  102. package/dist/model/{TemplatePublishVersionResponse.js → TemplateFieldDependencyCondition.js} +51 -61
  103. package/dist/model/TemplateFieldDependencyConditionInput.js +304 -0
  104. package/dist/model/TemplateFieldDependencyInput.js +182 -0
  105. package/dist/model/TemplateFieldDependencyMatch.js +59 -0
  106. package/dist/model/TemplateFieldDependencyOperator.js +99 -0
  107. package/dist/model/TemplateFieldLogicStatus.js +74 -0
  108. package/dist/model/TemplateFormMode.js +64 -0
  109. package/dist/model/{TemplateModelCodeResponse.js → TemplateModelCode.js} +34 -86
  110. package/dist/model/TemplatePageAiError.js +69 -0
  111. package/dist/model/TemplatePageAiNamingStatus.js +59 -0
  112. package/dist/model/TemplatePageFieldsStatus.js +74 -0
  113. package/dist/model/TemplatePageImageStatus.js +59 -0
  114. package/dist/model/TemplatePageProcessingStatus.js +162 -0
  115. package/dist/model/{SubmissionDataRequestToken.js → TemplateSourcePdf.js} +52 -56
  116. package/dist/model/TemplateSummary.js +560 -0
  117. package/dist/model/{SuccessErrorResponse.js → TemplateSummaryList.js} +43 -55
  118. package/dist/model/TemplateType.js +59 -0
  119. package/dist/model/{Submission422Response.js → TemplateVersion.js} +60 -63
  120. package/dist/model/TemplateVersionType.js +64 -0
  121. package/dist/model/TextAlignment.js +69 -0
  122. package/dist/model/TextOverflow.js +59 -0
  123. package/dist/model/TextVerticalAlignment.js +64 -0
  124. package/dist/model/Typeface.js +134 -0
  125. package/dist/model/UpdateSignatureRequestRequest.js +183 -0
  126. package/dist/model/UpdateTemplateDocumentRequest.js +136 -0
  127. package/dist/model/UpdateTemplateRequest.js +450 -0
  128. package/dist/model/UpdateWebhookRequest.js +209 -0
  129. package/dist/model/UploadMethod.js +54 -0
  130. package/dist/model/{UploadPresignResponse.js → UploadPresign.js} +53 -58
  131. package/dist/model/{AddFieldsData.js → UrlSourcePdf.js} +49 -31
  132. package/dist/model/Webhook.js +58 -73
  133. package/dist/model/WebhookEventType.js +174 -0
  134. package/dist/model/WebhookList.js +132 -0
  135. package/dist/model/WebhookMode.js +59 -0
  136. package/package.json +1 -1
  137. package/dist/model/BatchGeneratePdfs201Response.js +0 -194
  138. package/dist/model/CombinedSubmission.js +0 -313
  139. package/dist/model/CombinedSubmissionAction.js +0 -268
  140. package/dist/model/CreateCombinedSubmissionResponse.js +0 -180
  141. package/dist/model/CreateCustomFileResponse.js +0 -167
  142. package/dist/model/CreateHtmlTemplate.js +0 -108
  143. package/dist/model/CreatePdfTemplate.js +0 -108
  144. package/dist/model/CreateSubmissionDataRequestData.js +0 -314
  145. package/dist/model/CreateSubmissionDataRequestEventRequest.js +0 -239
  146. package/dist/model/CreateSubmissionDataRequestEventResponse.js +0 -167
  147. package/dist/model/CreateSubmissionDataRequestResponse.js +0 -167
  148. package/dist/model/CreateSubmissionDataRequestTokenResponse.js +0 -167
  149. package/dist/model/ErrorOrMultipleErrorsResponse.js +0 -153
  150. package/dist/model/JsonSchema.js +0 -205
  151. package/dist/model/SubmissionBatchWithSubmissions.js +0 -228
  152. package/dist/model/SubmissionDataRequest.js +0 -496
  153. package/dist/model/SubmissionPreview.js +0 -509
  154. package/dist/model/TemplateAddFieldsResponse.js +0 -156
  155. package/dist/model/TemplatePreview.js +0 -796
  156. package/dist/model/UpdateHtmlTemplate.js +0 -108
  157. package/dist/model/UpdateSubmissionDataRequestData.js +0 -311
  158. package/dist/model/UpdateWebhookData.js +0 -108
@@ -5,56 +5,53 @@ 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 _AiFieldNamingLanguage = _interopRequireDefault(require("../model/AiFieldNamingLanguage"));
9
+ var _AuthenticationCheck = _interopRequireDefault(require("../model/AuthenticationCheck"));
10
+ var _CombinedPdf = _interopRequireDefault(require("../model/CombinedPdf"));
11
+ var _CombinedPdfList = _interopRequireDefault(require("../model/CombinedPdfList"));
12
+ var _CopyTemplateRequest = _interopRequireDefault(require("../model/CopyTemplateRequest"));
13
+ var _CreateCombinedPdfRequest = _interopRequireDefault(require("../model/CreateCombinedPdfRequest"));
14
+ var _CreateCustomFileFromUploadRequest = _interopRequireDefault(require("../model/CreateCustomFileFromUploadRequest"));
15
+ var _CreateFolderRequest = _interopRequireDefault(require("../model/CreateFolderRequest"));
16
+ var _CreateSignatureRequestEventRequest = _interopRequireDefault(require("../model/CreateSignatureRequestEventRequest"));
17
+ var _CreateSignatureRequestTokenRequest = _interopRequireDefault(require("../model/CreateSignatureRequestTokenRequest"));
18
+ var _CreateSubmissionBatchRequest = _interopRequireDefault(require("../model/CreateSubmissionBatchRequest"));
19
+ var _CreateSubmissionRequest = _interopRequireDefault(require("../model/CreateSubmissionRequest"));
20
+ var _CreateTemplateRequest = _interopRequireDefault(require("../model/CreateTemplateRequest"));
21
+ var _CreateWebhookRequest = _interopRequireDefault(require("../model/CreateWebhookRequest"));
22
+ var _CustomFile = _interopRequireDefault(require("../model/CustomFile"));
23
+ var _CustomFileList = _interopRequireDefault(require("../model/CustomFileList"));
27
24
  var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse"));
25
+ var _FieldSetupLogic = _interopRequireDefault(require("../model/FieldSetupLogic"));
26
+ var _FieldSetupNaming = _interopRequireDefault(require("../model/FieldSetupNaming"));
27
+ var _FieldSetupSource = _interopRequireDefault(require("../model/FieldSetupSource"));
28
28
  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"));
29
+ var _FolderList = _interopRequireDefault(require("../model/FolderList"));
30
+ var _ModelCodeLanguage = _interopRequireDefault(require("../model/ModelCodeLanguage"));
31
+ var _MoveFolderRequest = _interopRequireDefault(require("../model/MoveFolderRequest"));
32
+ var _MoveTemplateRequest = _interopRequireDefault(require("../model/MoveTemplateRequest"));
33
+ var _PublishTemplateVersionRequest = _interopRequireDefault(require("../model/PublishTemplateVersionRequest"));
34
+ var _RenameFolderRequest = _interopRequireDefault(require("../model/RenameFolderRequest"));
35
+ var _RestoreTemplateVersionRequest = _interopRequireDefault(require("../model/RestoreTemplateVersionRequest"));
36
+ var _SignatureRequest = _interopRequireDefault(require("../model/SignatureRequest"));
37
+ var _SignatureRequestEvent = _interopRequireDefault(require("../model/SignatureRequestEvent"));
38
+ var _SignatureRequestToken = _interopRequireDefault(require("../model/SignatureRequestToken"));
38
39
  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"));
40
+ var _SubmissionBatch = _interopRequireDefault(require("../model/SubmissionBatch"));
41
+ var _SubmissionList = _interopRequireDefault(require("../model/SubmissionList"));
46
42
  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"));
43
+ var _TemplateModelCode = _interopRequireDefault(require("../model/TemplateModelCode"));
44
+ var _TemplateSummaryList = _interopRequireDefault(require("../model/TemplateSummaryList"));
45
+ var _TemplateVersion = _interopRequireDefault(require("../model/TemplateVersion"));
46
+ var _UpdateSignatureRequestRequest = _interopRequireDefault(require("../model/UpdateSignatureRequestRequest"));
47
+ var _UpdateTemplateDocumentRequest = _interopRequireDefault(require("../model/UpdateTemplateDocumentRequest"));
48
+ var _UpdateTemplateRequest = _interopRequireDefault(require("../model/UpdateTemplateRequest"));
49
+ var _UpdateWebhookRequest = _interopRequireDefault(require("../model/UpdateWebhookRequest"));
50
+ var _UploadPresign = _interopRequireDefault(require("../model/UploadPresign"));
57
51
  var _Webhook = _interopRequireDefault(require("../model/Webhook"));
52
+ var _WebhookEventType = _interopRequireDefault(require("../model/WebhookEventType"));
53
+ var _WebhookList = _interopRequireDefault(require("../model/WebhookList"));
54
+ var _WebhookMode = _interopRequireDefault(require("../model/WebhookMode"));
58
55
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
59
56
  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
57
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -63,9 +60,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
63
60
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
64
61
  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
62
  * 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/).
63
+ * Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
67
64
  *
68
- * The version of the OpenAPI document: v1
65
+ * The version of the OpenAPI document: v2
69
66
  *
70
67
  *
71
68
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -76,7 +73,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
76
73
  /**
77
74
  * Client service.
78
75
  * @module api/Client
79
- * @version 3.3.0
76
+ * @version 4.0.0
80
77
  */
81
78
  var Client = exports["default"] = /*#__PURE__*/function () {
82
79
  /**
@@ -93,13 +90,23 @@ var Client = exports["default"] = /*#__PURE__*/function () {
93
90
  if (options && options.constructor && options.constructor.name === 'ApiClient') {
94
91
  this.apiClient = options;
95
92
  } else {
96
- var _env$DOCSPRING_TOKEN_, _env$DOCSPRING_TOKEN_2;
97
- var apiClient = options.apiClient || _ApiClient["default"].instance;
93
+ // A client given credentials, a host or a region gets its own ApiClient, so two clients don't change each
94
+ // other's. Without them it uses the shared ApiClient.instance.
95
+ var ownApiClient = ['apiTokenId', 'apiTokenSecret', 'host', 'region'].some(function (key) {
96
+ return options[key] !== undefined;
97
+ });
98
+ var apiClient = options.apiClient || (ownApiClient ? new _ApiClient["default"]() : _ApiClient["default"].instance);
98
99
  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) {
100
+
101
+ // Use the credentials passed in, or the environment variables. An empty string counts as not set.
102
+ var apiTokenId = options.apiTokenId || env.DOCSPRING_TOKEN_ID || null;
103
+ var apiTokenSecret = options.apiTokenSecret || env.DOCSPRING_TOKEN_SECRET || null;
104
+
105
+ // Without credentials the client is still created, and the API's 401 response says what's missing
106
+ if (apiTokenId != null) {
102
107
  apiClient.authentications['api_token_basic'].username = apiTokenId;
108
+ }
109
+ if (apiTokenSecret != null) {
103
110
  apiClient.authentications['api_token_basic'].password = apiTokenSecret;
104
111
  }
105
112
 
@@ -114,7 +121,8 @@ var Client = exports["default"] = /*#__PURE__*/function () {
114
121
  var url = String(host).trim();
115
122
  if (!/^https?:\/\//i.test(url)) url = "https://".concat(url);
116
123
  url = url.replace(/\/+$/, '');
117
- if (!/\/api\/v1$/i.test(url)) url = "".concat(url, "/api/v1");
124
+ // Any API version's path (such as /api/v1 from a 3.x setup) becomes /api/v2
125
+ url = "".concat(url.replace(/\/api\/v\d+$/i, ''), "/api/v2");
118
126
  apiClient.basePath = url;
119
127
  }
120
128
  this.apiClient = apiClient;
@@ -122,32 +130,21 @@ var Client = exports["default"] = /*#__PURE__*/function () {
122
130
  }
123
131
 
124
132
  /**
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}
133
+ * Copy a template
134
+ * Copies a template (its draft, or a published version) into a new template.
135
+ * @param {String} template_id The template's ID.
136
+ * @param {Object} opts Optional parameters
137
+ * @param {module:model/CopyTemplateRequest} [body] Settings for the copy.
138
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
139
139
  */
140
140
  return _createClass(Client, [{
141
- key: "addFieldsToTemplate",
142
- value: function addFieldsToTemplate(template_id, data, callback) {
143
- var postBody = data;
141
+ key: "copyTemplateWithHttpInfo",
142
+ value: function copyTemplateWithHttpInfo(template_id, opts) {
143
+ opts = opts || {};
144
+ var postBody = opts['body'];
144
145
  // verify the required parameter 'template_id' is set
145
146
  if (template_id === undefined || template_id === null) {
146
- throw new Error("Missing the required parameter 'template_id' when calling addFieldsToTemplate");
147
- }
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");
147
+ throw new Error("Missing the required parameter 'template_id' when calling copyTemplate");
151
148
  }
152
149
  var pathParams = {
153
150
  'template_id': template_id
@@ -158,35 +155,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
158
155
  var authNames = ['api_token_basic'];
159
156
  var contentTypes = ['application/json'];
160
157
  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);
158
+ var returnType = _Template["default"];
159
+ return this.apiClient.callApi('/templates/{template_id}/copy', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
163
160
  }
164
161
 
165
162
  /**
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.
163
+ * Copy a template
164
+ * Copies a template (its draft, or a published version) into a new template.
165
+ * @param {String} template_id The template's ID.
166
+ * @param {Object} opts Optional parameters
167
+ * @param {module:model/CopyTemplateRequest} opts.body Settings for the copy.
168
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
171
169
  */
170
+ }, {
171
+ key: "copyTemplate",
172
+ value: function copyTemplate(template_id, opts) {
173
+ return this.copyTemplateWithHttpInfo(template_id, opts).then(function (response_and_data) {
174
+ return response_and_data.data;
175
+ });
176
+ }
172
177
 
173
178
  /**
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
179
+ * Combine PDFs
180
+ * 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.
181
+ * @param {module:model/CreateCombinedPdfRequest} body The PDFs to merge, and the combined PDF's settings.
177
182
  * @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}
183
+ * @param {Boolean} [wait] Wait until the PDF has been generated before responding. Default true on sync.api hosts.
184
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdf} and HTTP response
181
185
  */
182
186
  }, {
183
- key: "batchGeneratePdfs",
184
- value: function batchGeneratePdfs(data, opts, callback) {
187
+ key: "createCombinedPdfWithHttpInfo",
188
+ value: function createCombinedPdfWithHttpInfo(body, opts) {
185
189
  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");
190
+ var postBody = body;
191
+ // verify the required parameter 'body' is set
192
+ if (body === undefined || body === null) {
193
+ throw new Error("Missing the required parameter 'body' when calling createCombinedPdf");
190
194
  }
191
195
  var pathParams = {};
192
196
  var queryParams = {
@@ -197,32 +201,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
197
201
  var authNames = ['api_token_basic'];
198
202
  var contentTypes = ['application/json'];
199
203
  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);
204
+ var returnType = _CombinedPdf["default"];
205
+ return this.apiClient.callApi('/combined_pdfs', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
202
206
  }
203
207
 
204
208
  /**
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.
209
+ * Combine PDFs
210
+ * 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.
211
+ * @param {module:model/CreateCombinedPdfRequest} body The PDFs to merge, and the combined PDF's settings.
212
+ * @param {Object} opts Optional parameters
213
+ * @param {Boolean} opts.wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
214
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdf}
210
215
  */
216
+ }, {
217
+ key: "createCombinedPdf",
218
+ value: function createCombinedPdf(body, opts) {
219
+ return this.createCombinedPdfWithHttpInfo(body, opts).then(function (response_and_data) {
220
+ return response_and_data.data;
221
+ });
222
+ }
211
223
 
212
224
  /**
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}
225
+ * Create a custom file from an upload
226
+ * 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`.
227
+ * @param {module:model/CreateCustomFileFromUploadRequest} body The uploaded file to create the custom file from.
228
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFile} and HTTP response
218
229
  */
219
230
  }, {
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");
231
+ key: "createCustomFileFromUploadWithHttpInfo",
232
+ value: function createCustomFileFromUploadWithHttpInfo(body) {
233
+ var postBody = body;
234
+ // verify the required parameter 'body' is set
235
+ if (body === undefined || body === null) {
236
+ throw new Error("Missing the required parameter 'body' when calling createCustomFileFromUpload");
226
237
  }
227
238
  var pathParams = {};
228
239
  var queryParams = {};
@@ -231,113 +242,129 @@ var Client = exports["default"] = /*#__PURE__*/function () {
231
242
  var authNames = ['api_token_basic'];
232
243
  var contentTypes = ['application/json'];
233
244
  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);
245
+ var returnType = _CustomFile["default"];
246
+ return this.apiClient.callApi('/custom_files', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
236
247
  }
237
248
 
238
249
  /**
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.
250
+ * Create a custom file from an upload
251
+ * 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`.
252
+ * @param {module:model/CreateCustomFileFromUploadRequest} body The uploaded file to create the custom file from.
253
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFile}
244
254
  */
255
+ }, {
256
+ key: "createCustomFileFromUpload",
257
+ value: function createCustomFileFromUpload(body) {
258
+ return this.createCustomFileFromUploadWithHttpInfo(body).then(function (response_and_data) {
259
+ return response_and_data.data;
260
+ });
261
+ }
245
262
 
246
263
  /**
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}
264
+ * Create a folder
265
+ * Creates a folder for organizing templates. Pass `parent_folder_id` to create it inside another folder. Folder names are unique within their parent folder.
266
+ * @param {module:model/CreateFolderRequest} body The folder to create.
267
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
254
268
  */
255
269
  }, {
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");
270
+ key: "createFolderWithHttpInfo",
271
+ value: function createFolderWithHttpInfo(body) {
272
+ var postBody = body;
273
+ // verify the required parameter 'body' is set
274
+ if (body === undefined || body === null) {
275
+ throw new Error("Missing the required parameter 'body' when calling createFolder");
263
276
  }
264
- var pathParams = {
265
- 'template_id': template_id
266
- };
277
+ var pathParams = {};
267
278
  var queryParams = {};
268
279
  var headerParams = {};
269
280
  var formParams = {};
270
281
  var authNames = ['api_token_basic'];
271
282
  var contentTypes = ['application/json'];
272
283
  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);
284
+ var returnType = _Folder["default"];
285
+ return this.apiClient.callApi('/folders', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
275
286
  }
276
287
 
277
288
  /**
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.
289
+ * Create a folder
290
+ * Creates a folder for organizing templates. Pass `parent_folder_id` to create it inside another folder. Folder names are unique within their parent folder.
291
+ * @param {module:model/CreateFolderRequest} body The folder to create.
292
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
283
293
  */
294
+ }, {
295
+ key: "createFolder",
296
+ value: function createFolder(body) {
297
+ return this.createFolderWithHttpInfo(body).then(function (response_and_data) {
298
+ return response_and_data.data;
299
+ });
300
+ }
284
301
 
285
302
  /**
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}
303
+ * Record a signature request event
304
+ * 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.
305
+ * @param {String} signature_request_id The signature request's ID.
306
+ * @param {module:model/CreateSignatureRequestEventRequest} body The event to record.
307
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequestEvent} and HTTP response
291
308
  */
292
309
  }, {
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");
310
+ key: "createSignatureRequestEventWithHttpInfo",
311
+ value: function createSignatureRequestEventWithHttpInfo(signature_request_id, body) {
312
+ var postBody = body;
313
+ // verify the required parameter 'signature_request_id' is set
314
+ if (signature_request_id === undefined || signature_request_id === null) {
315
+ throw new Error("Missing the required parameter 'signature_request_id' when calling createSignatureRequestEvent");
299
316
  }
300
- var pathParams = {};
317
+ // verify the required parameter 'body' is set
318
+ if (body === undefined || body === null) {
319
+ throw new Error("Missing the required parameter 'body' when calling createSignatureRequestEvent");
320
+ }
321
+ var pathParams = {
322
+ 'signature_request_id': signature_request_id
323
+ };
301
324
  var queryParams = {};
302
325
  var headerParams = {};
303
326
  var formParams = {};
304
327
  var authNames = ['api_token_basic'];
305
328
  var contentTypes = ['application/json'];
306
329
  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);
330
+ var returnType = _SignatureRequestEvent["default"];
331
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}/events', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
309
332
  }
310
333
 
311
334
  /**
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.
335
+ * Record a signature request event
336
+ * 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.
337
+ * @param {String} signature_request_id The signature request's ID.
338
+ * @param {module:model/CreateSignatureRequestEventRequest} body The event to record.
339
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequestEvent}
317
340
  */
341
+ }, {
342
+ key: "createSignatureRequestEvent",
343
+ value: function createSignatureRequestEvent(signature_request_id, body) {
344
+ return this.createSignatureRequestEventWithHttpInfo(signature_request_id, body).then(function (response_and_data) {
345
+ return response_and_data.data;
346
+ });
347
+ }
318
348
 
319
349
  /**
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}
350
+ * Create a signature request token
351
+ * 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.
352
+ * @param {String} signature_request_id The signature request's ID.
353
+ * @param {Object} opts Optional parameters
354
+ * @param {module:model/CreateSignatureRequestTokenRequest} [body] The kind of link to make. Send no body for an `api` token.
355
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequestToken} and HTTP response
326
356
  */
327
357
  }, {
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");
334
- }
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");
358
+ key: "createSignatureRequestTokenWithHttpInfo",
359
+ value: function createSignatureRequestTokenWithHttpInfo(signature_request_id, opts) {
360
+ opts = opts || {};
361
+ var postBody = opts['body'];
362
+ // verify the required parameter 'signature_request_id' is set
363
+ if (signature_request_id === undefined || signature_request_id === null) {
364
+ throw new Error("Missing the required parameter 'signature_request_id' when calling createSignatureRequestToken");
338
365
  }
339
366
  var pathParams = {
340
- 'data_request_id': data_request_id
367
+ 'signature_request_id': signature_request_id
341
368
  };
342
369
  var queryParams = {};
343
370
  var headerParams = {};
@@ -345,192 +372,188 @@ var Client = exports["default"] = /*#__PURE__*/function () {
345
372
  var authNames = ['api_token_basic'];
346
373
  var contentTypes = ['application/json'];
347
374
  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);
375
+ var returnType = _SignatureRequestToken["default"];
376
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}/tokens', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
350
377
  }
351
378
 
352
379
  /**
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.
380
+ * Create a signature request token
381
+ * 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.
382
+ * @param {String} signature_request_id The signature request's ID.
383
+ * @param {Object} opts Optional parameters
384
+ * @param {module:model/CreateSignatureRequestTokenRequest} opts.body The kind of link to make. Send no body for an `api` token.
385
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequestToken}
358
386
  */
387
+ }, {
388
+ key: "createSignatureRequestToken",
389
+ value: function createSignatureRequestToken(signature_request_id, opts) {
390
+ return this.createSignatureRequestTokenWithHttpInfo(signature_request_id, opts).then(function (response_and_data) {
391
+ return response_and_data.data;
392
+ });
393
+ }
359
394
 
360
395
  /**
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
396
+ * Generate a PDF
397
+ * 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.
398
+ * @param {String} template_id The template's ID.
399
+ * @param {module:model/CreateSubmissionRequest} body The submission's data and settings.
364
400
  * @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}
401
+ * @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).
402
+ * @param {Boolean} [wait] Wait until the PDF has been generated before responding. Default true on sync.api hosts.
403
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
368
404
  */
369
405
  }, {
370
- key: "createDataRequestToken",
371
- value: function createDataRequestToken(data_request_id, opts, callback) {
406
+ key: "createSubmissionWithHttpInfo",
407
+ value: function createSubmissionWithHttpInfo(template_id, body, opts) {
372
408
  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");
409
+ var postBody = body;
410
+ // verify the required parameter 'template_id' is set
411
+ if (template_id === undefined || template_id === null) {
412
+ throw new Error("Missing the required parameter 'template_id' when calling createSubmission");
413
+ }
414
+ // verify the required parameter 'body' is set
415
+ if (body === undefined || body === null) {
416
+ throw new Error("Missing the required parameter 'body' when calling createSubmission");
377
417
  }
378
418
  var pathParams = {
379
- 'data_request_id': data_request_id
419
+ 'template_id': template_id
380
420
  };
381
421
  var queryParams = {
382
- 'type': opts['type']
422
+ 'version': opts['version'],
423
+ 'wait': opts['wait']
383
424
  };
384
425
  var headerParams = {};
385
426
  var formParams = {};
386
427
  var authNames = ['api_token_basic'];
387
- var contentTypes = [];
428
+ var contentTypes = ['application/json'];
388
429
  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);
430
+ var returnType = _Submission["default"];
431
+ return this.apiClient.callApi('/templates/{template_id}/submissions', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
391
432
  }
392
433
 
393
434
  /**
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.
399
- */
400
-
401
- /**
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}
435
+ * Generate a PDF
436
+ * 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.
437
+ * @param {String} template_id The template's ID.
438
+ * @param {module:model/CreateSubmissionRequest} body The submission's data and settings.
439
+ * @param {Object} opts Optional parameters
440
+ * @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).
441
+ * @param {Boolean} opts.wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
442
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
407
443
  */
408
444
  }, {
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");
415
- }
416
- var pathParams = {};
417
- var queryParams = {};
418
- var headerParams = {};
419
- var formParams = {};
420
- var authNames = ['api_token_basic'];
421
- var contentTypes = ['application/json'];
422
- 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);
445
+ key: "createSubmission",
446
+ value: function createSubmission(template_id, body, opts) {
447
+ return this.createSubmissionWithHttpInfo(template_id, body, opts).then(function (response_and_data) {
448
+ return response_and_data.data;
449
+ });
425
450
  }
426
451
 
427
452
  /**
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.
433
- */
434
-
435
- /**
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}
453
+ * Generate PDFs in a batch
454
+ * 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.
455
+ * @param {module:model/CreateSubmissionBatchRequest} body The submissions to create, and the settings they share.
456
+ * @param {Object} opts Optional parameters
457
+ * @param {Boolean} [wait] Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
458
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionBatch} and HTTP response
441
459
  */
442
460
  }, {
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");
461
+ key: "createSubmissionBatchWithHttpInfo",
462
+ value: function createSubmissionBatchWithHttpInfo(body, opts) {
463
+ opts = opts || {};
464
+ var postBody = body;
465
+ // verify the required parameter 'body' is set
466
+ if (body === undefined || body === null) {
467
+ throw new Error("Missing the required parameter 'body' when calling createSubmissionBatch");
449
468
  }
450
469
  var pathParams = {};
451
- var queryParams = {};
470
+ var queryParams = {
471
+ 'wait': opts['wait']
472
+ };
452
473
  var headerParams = {};
453
474
  var formParams = {};
454
475
  var authNames = ['api_token_basic'];
455
476
  var contentTypes = ['application/json'];
456
477
  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);
478
+ var returnType = _SubmissionBatch["default"];
479
+ return this.apiClient.callApi('/submissions/batches', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
459
480
  }
460
481
 
461
482
  /**
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.
483
+ * Generate PDFs in a batch
484
+ * 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.
485
+ * @param {module:model/CreateSubmissionBatchRequest} body The submissions to create, and the settings they share.
486
+ * @param {Object} opts Optional parameters
487
+ * @param {Boolean} opts.wait Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
488
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionBatch}
467
489
  */
490
+ }, {
491
+ key: "createSubmissionBatch",
492
+ value: function createSubmissionBatch(body, opts) {
493
+ return this.createSubmissionBatchWithHttpInfo(body, opts).then(function (response_and_data) {
494
+ return response_and_data.data;
495
+ });
496
+ }
468
497
 
469
498
  /**
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
499
+ * Create a template
500
+ * 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`.
501
+ * @param {module:model/CreateTemplateRequest} body The template to create.
474
502
  * @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}
503
+ * @param {Boolean} [wait] Wait until the PDF has been processed before responding. Default true on sync.api hosts.
504
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
480
505
  */
481
506
  }, {
482
- key: "createPdfTemplate",
483
- value: function createPdfTemplate(template_document, template_name, opts, callback) {
507
+ key: "createTemplateWithHttpInfo",
508
+ value: function createTemplateWithHttpInfo(body, opts) {
484
509
  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");
510
+ var postBody = body;
511
+ // verify the required parameter 'body' is set
512
+ if (body === undefined || body === null) {
513
+ throw new Error("Missing the required parameter 'body' when calling createTemplate");
493
514
  }
494
515
  var pathParams = {};
495
516
  var queryParams = {
496
517
  'wait': opts['wait']
497
518
  };
498
519
  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
- };
520
+ var formParams = {};
505
521
  var authNames = ['api_token_basic'];
506
- var contentTypes = ['multipart/form-data'];
522
+ var contentTypes = ['application/json'];
507
523
  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);
524
+ var returnType = _Template["default"];
525
+ return this.apiClient.callApi('/templates', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
510
526
  }
511
527
 
512
528
  /**
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.
529
+ * Create a template
530
+ * 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`.
531
+ * @param {module:model/CreateTemplateRequest} body The template to create.
532
+ * @param {Object} opts Optional parameters
533
+ * @param {Boolean} opts.wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
534
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
518
535
  */
536
+ }, {
537
+ key: "createTemplate",
538
+ value: function createTemplate(body, opts) {
539
+ return this.createTemplateWithHttpInfo(body, opts).then(function (response_and_data) {
540
+ return response_and_data.data;
541
+ });
542
+ }
519
543
 
520
544
  /**
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}
545
+ * Create a webhook
546
+ * 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.
547
+ * @param {module:model/CreateWebhookRequest} body The webhook to create.
548
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
526
549
  */
527
550
  }, {
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");
551
+ key: "createWebhookWithHttpInfo",
552
+ value: function createWebhookWithHttpInfo(body) {
553
+ var postBody = body;
554
+ // verify the required parameter 'body' is set
555
+ if (body === undefined || body === null) {
556
+ throw new Error("Missing the required parameter 'body' when calling createWebhook");
534
557
  }
535
558
  var pathParams = {};
536
559
  var queryParams = {};
@@ -539,62 +562,74 @@ var Client = exports["default"] = /*#__PURE__*/function () {
539
562
  var authNames = ['api_token_basic'];
540
563
  var contentTypes = ['application/json'];
541
564
  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);
565
+ var returnType = _Webhook["default"];
566
+ return this.apiClient.callApi('/webhooks', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
544
567
  }
545
568
 
546
569
  /**
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.
570
+ * Create a webhook
571
+ * 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.
572
+ * @param {module:model/CreateWebhookRequest} body The webhook to create.
573
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
552
574
  */
575
+ }, {
576
+ key: "createWebhook",
577
+ value: function createWebhook(body) {
578
+ return this.createWebhookWithHttpInfo(body).then(function (response_and_data) {
579
+ return response_and_data.data;
580
+ });
581
+ }
553
582
 
554
583
  /**
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}
584
+ * Delete a custom file
585
+ * Deletes a custom file and returns it. Use a live API token: test tokens can't delete custom files.
586
+ * @param {String} custom_file_id The custom file's ID.
587
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFile} and HTTP response
560
588
  */
561
589
  }, {
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");
590
+ key: "deleteCustomFileWithHttpInfo",
591
+ value: function deleteCustomFileWithHttpInfo(custom_file_id) {
592
+ var postBody = null;
593
+ // verify the required parameter 'custom_file_id' is set
594
+ if (custom_file_id === undefined || custom_file_id === null) {
595
+ throw new Error("Missing the required parameter 'custom_file_id' when calling deleteCustomFile");
568
596
  }
569
- var pathParams = {};
597
+ var pathParams = {
598
+ 'custom_file_id': custom_file_id
599
+ };
570
600
  var queryParams = {};
571
601
  var headerParams = {};
572
602
  var formParams = {};
573
603
  var authNames = ['api_token_basic'];
574
- var contentTypes = ['application/json'];
604
+ var contentTypes = [];
575
605
  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);
606
+ var returnType = _CustomFile["default"];
607
+ return this.apiClient.callApi('/custom_files/{custom_file_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
578
608
  }
579
609
 
580
610
  /**
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.
611
+ * Delete a custom file
612
+ * Deletes a custom file and returns it. Use a live API token: test tokens can't delete custom files.
613
+ * @param {String} custom_file_id The custom file's ID.
614
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFile}
586
615
  */
616
+ }, {
617
+ key: "deleteCustomFile",
618
+ value: function deleteCustomFile(custom_file_id) {
619
+ return this.deleteCustomFileWithHttpInfo(custom_file_id).then(function (response_and_data) {
620
+ return response_and_data.data;
621
+ });
622
+ }
587
623
 
588
624
  /**
589
625
  * 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}
626
+ * Deletes an empty folder and returns it. A folder that still has templates or folders in it can't be deleted.
627
+ * @param {String} folder_id The folder's ID.
628
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
594
629
  */
595
630
  }, {
596
- key: "deleteFolder",
597
- value: function deleteFolder(folder_id, callback) {
631
+ key: "deleteFolderWithHttpInfo",
632
+ value: function deleteFolderWithHttpInfo(folder_id) {
598
633
  var postBody = null;
599
634
  // verify the required parameter 'folder_id' is set
600
635
  if (folder_id === undefined || folder_id === null) {
@@ -610,29 +645,34 @@ var Client = exports["default"] = /*#__PURE__*/function () {
610
645
  var contentTypes = [];
611
646
  var accepts = ['application/json'];
612
647
  var returnType = _Folder["default"];
613
- return this.apiClient.callApi('/folders/{folder_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
648
+ return this.apiClient.callApi('/folders/{folder_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
614
649
  }
615
650
 
616
651
  /**
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.
652
+ * Delete a folder
653
+ * Deletes an empty folder and returns it. A folder that still has templates or folders in it can't be deleted.
654
+ * @param {String} folder_id The folder's ID.
655
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
622
656
  */
657
+ }, {
658
+ key: "deleteFolder",
659
+ value: function deleteFolder(folder_id) {
660
+ return this.deleteFolderWithHttpInfo(folder_id).then(function (response_and_data) {
661
+ return response_and_data.data;
662
+ });
663
+ }
623
664
 
624
665
  /**
625
666
  * 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
667
+ * 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.
668
+ * @param {String} template_id The template's ID.
628
669
  * @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}
670
+ * @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.
671
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
632
672
  */
633
673
  }, {
634
- key: "deleteTemplate",
635
- value: function deleteTemplate(template_id, opts, callback) {
674
+ key: "deleteTemplateWithHttpInfo",
675
+ value: function deleteTemplateWithHttpInfo(template_id, opts) {
636
676
  opts = opts || {};
637
677
  var postBody = null;
638
678
  // verify the required parameter 'template_id' is set
@@ -650,28 +690,35 @@ var Client = exports["default"] = /*#__PURE__*/function () {
650
690
  var authNames = ['api_token_basic'];
651
691
  var contentTypes = [];
652
692
  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);
693
+ var returnType = _Template["default"];
694
+ return this.apiClient.callApi('/templates/{template_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
655
695
  }
656
696
 
657
697
  /**
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.
698
+ * Delete a template
699
+ * 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.
700
+ * @param {String} template_id The template's ID.
701
+ * @param {Object} opts Optional parameters
702
+ * @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.
703
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
663
704
  */
705
+ }, {
706
+ key: "deleteTemplate",
707
+ value: function deleteTemplate(template_id, opts) {
708
+ return this.deleteTemplateWithHttpInfo(template_id, opts).then(function (response_and_data) {
709
+ return response_and_data.data;
710
+ });
711
+ }
664
712
 
665
713
  /**
666
714
  * 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}
715
+ * Deletes a webhook so it stops receiving events, and returns it.
716
+ * @param {String} webhook_id The webhook's ID.
717
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
671
718
  */
672
719
  }, {
673
- key: "deleteWebhook",
674
- value: function deleteWebhook(webhook_id, callback) {
720
+ key: "deleteWebhookWithHttpInfo",
721
+ value: function deleteWebhookWithHttpInfo(webhook_id) {
675
722
  var postBody = null;
676
723
  // verify the required parameter 'webhook_id' is set
677
724
  if (webhook_id === undefined || webhook_id === null) {
@@ -687,34 +734,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
687
734
  var contentTypes = [];
688
735
  var accepts = ['application/json'];
689
736
  var returnType = _Webhook["default"];
690
- return this.apiClient.callApi('/webhooks/{webhook_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
737
+ return this.apiClient.callApi('/webhooks/{webhook_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
691
738
  }
692
739
 
693
740
  /**
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.
741
+ * Delete a webhook
742
+ * Deletes a webhook so it stops receiving events, and returns it.
743
+ * @param {String} webhook_id The webhook's ID.
744
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
699
745
  */
746
+ }, {
747
+ key: "deleteWebhook",
748
+ value: function deleteWebhook(webhook_id) {
749
+ return this.deleteWebhookWithHttpInfo(webhook_id).then(function (response_and_data) {
750
+ return response_and_data.data;
751
+ });
752
+ }
700
753
 
701
754
  /**
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}
755
+ * Expire a combined PDF
756
+ * Deletes a combined PDF's PDF and returns the expired combined PDF.
757
+ * @param {String} combined_pdf_id The combined PDF's ID.
758
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdf} and HTTP response
707
759
  */
708
760
  }, {
709
- key: "expireCombinedSubmission",
710
- value: function expireCombinedSubmission(combined_submission_id, callback) {
761
+ key: "expireCombinedPdfWithHttpInfo",
762
+ value: function expireCombinedPdfWithHttpInfo(combined_pdf_id) {
711
763
  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");
764
+ // verify the required parameter 'combined_pdf_id' is set
765
+ if (combined_pdf_id === undefined || combined_pdf_id === null) {
766
+ throw new Error("Missing the required parameter 'combined_pdf_id' when calling expireCombinedPdf");
715
767
  }
716
768
  var pathParams = {
717
- 'combined_submission_id': combined_submission_id
769
+ 'combined_pdf_id': combined_pdf_id
718
770
  };
719
771
  var queryParams = {};
720
772
  var headerParams = {};
@@ -722,28 +774,33 @@ var Client = exports["default"] = /*#__PURE__*/function () {
722
774
  var authNames = ['api_token_basic'];
723
775
  var contentTypes = [];
724
776
  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);
777
+ var returnType = _CombinedPdf["default"];
778
+ return this.apiClient.callApi('/combined_pdfs/{combined_pdf_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
727
779
  }
728
780
 
729
781
  /**
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.
782
+ * Expire a combined PDF
783
+ * Deletes a combined PDF's PDF and returns the expired combined PDF.
784
+ * @param {String} combined_pdf_id The combined PDF's ID.
785
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdf}
735
786
  */
787
+ }, {
788
+ key: "expireCombinedPdf",
789
+ value: function expireCombinedPdf(combined_pdf_id) {
790
+ return this.expireCombinedPdfWithHttpInfo(combined_pdf_id).then(function (response_and_data) {
791
+ return response_and_data.data;
792
+ });
793
+ }
736
794
 
737
795
  /**
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}
796
+ * Expire a submission
797
+ * Deletes a submission's data and PDF now, and returns the expired submission.
798
+ * @param {String} submission_id The submission's ID.
799
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
743
800
  */
744
801
  }, {
745
- key: "expireSubmission",
746
- value: function expireSubmission(submission_id, callback) {
802
+ key: "expireSubmissionWithHttpInfo",
803
+ value: function expireSubmissionWithHttpInfo(submission_id) {
747
804
  var postBody = null;
748
805
  // verify the required parameter 'submission_id' is set
749
806
  if (submission_id === undefined || submission_id === null) {
@@ -758,81 +815,81 @@ var Client = exports["default"] = /*#__PURE__*/function () {
758
815
  var authNames = ['api_token_basic'];
759
816
  var contentTypes = [];
760
817
  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);
818
+ var returnType = _Submission["default"];
819
+ return this.apiClient.callApi('/submissions/{submission_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
763
820
  }
764
821
 
765
822
  /**
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.
823
+ * Expire a submission
824
+ * Deletes a submission's data and PDF now, and returns the expired submission.
825
+ * @param {String} submission_id The submission's ID.
826
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
771
827
  */
828
+ }, {
829
+ key: "expireSubmission",
830
+ value: function expireSubmission(submission_id) {
831
+ return this.expireSubmissionWithHttpInfo(submission_id).then(function (response_and_data) {
832
+ return response_and_data.data;
833
+ });
834
+ }
772
835
 
773
836
  /**
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
778
- * @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}
837
+ * Generate a preview PDF
838
+ * 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.
839
+ * @param {String} submission_id The submission's ID.
840
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
782
841
  */
783
842
  }, {
784
- key: "generatePdf",
785
- value: function generatePdf(template_id, submission, opts, callback) {
786
- 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");
791
- }
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");
843
+ key: "generateSubmissionPreviewWithHttpInfo",
844
+ value: function generateSubmissionPreviewWithHttpInfo(submission_id) {
845
+ var postBody = null;
846
+ // verify the required parameter 'submission_id' is set
847
+ if (submission_id === undefined || submission_id === null) {
848
+ throw new Error("Missing the required parameter 'submission_id' when calling generateSubmissionPreview");
795
849
  }
796
850
  var pathParams = {
797
- 'template_id': template_id
798
- };
799
- var queryParams = {
800
- 'wait': opts['wait']
851
+ 'submission_id': submission_id
801
852
  };
853
+ var queryParams = {};
802
854
  var headerParams = {};
803
855
  var formParams = {};
804
856
  var authNames = ['api_token_basic'];
805
- var contentTypes = ['application/json'];
857
+ var contentTypes = [];
806
858
  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);
859
+ var returnType = _Submission["default"];
860
+ return this.apiClient.callApi('/submissions/{submission_id}/generate_preview', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
809
861
  }
810
862
 
811
863
  /**
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.
864
+ * Generate a preview PDF
865
+ * 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.
866
+ * @param {String} submission_id The submission's ID.
867
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
817
868
  */
869
+ }, {
870
+ key: "generateSubmissionPreview",
871
+ value: function generateSubmissionPreview(submission_id) {
872
+ return this.generateSubmissionPreviewWithHttpInfo(submission_id).then(function (response_and_data) {
873
+ return response_and_data.data;
874
+ });
875
+ }
818
876
 
819
877
  /**
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}
878
+ * Get a combined PDF
879
+ * Returns a combined PDF, with a temporary link to download it once it has been generated.
880
+ * @param {String} combined_pdf_id The combined PDF's ID.
881
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdf} and HTTP response
825
882
  */
826
883
  }, {
827
- key: "generatePreview",
828
- value: function generatePreview(submission_id, callback) {
884
+ key: "getCombinedPdfWithHttpInfo",
885
+ value: function getCombinedPdfWithHttpInfo(combined_pdf_id) {
829
886
  var postBody = null;
830
- // verify the required parameter 'submission_id' is set
831
- if (submission_id === undefined || submission_id === null) {
832
- throw new Error("Missing the required parameter 'submission_id' when calling generatePreview");
887
+ // verify the required parameter 'combined_pdf_id' is set
888
+ if (combined_pdf_id === undefined || combined_pdf_id === null) {
889
+ throw new Error("Missing the required parameter 'combined_pdf_id' when calling getCombinedPdf");
833
890
  }
834
891
  var pathParams = {
835
- 'submission_id': submission_id
892
+ 'combined_pdf_id': combined_pdf_id
836
893
  };
837
894
  var queryParams = {};
838
895
  var headerParams = {};
@@ -840,35 +897,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
840
897
  var authNames = ['api_token_basic'];
841
898
  var contentTypes = [];
842
899
  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);
900
+ var returnType = _CombinedPdf["default"];
901
+ return this.apiClient.callApi('/combined_pdfs/{combined_pdf_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
845
902
  }
846
903
 
847
904
  /**
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.
905
+ * Get a combined PDF
906
+ * Returns a combined PDF, with a temporary link to download it once it has been generated.
907
+ * @param {String} combined_pdf_id The combined PDF's ID.
908
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdf}
853
909
  */
910
+ }, {
911
+ key: "getCombinedPdf",
912
+ value: function getCombinedPdf(combined_pdf_id) {
913
+ return this.getCombinedPdfWithHttpInfo(combined_pdf_id).then(function (response_and_data) {
914
+ return response_and_data.data;
915
+ });
916
+ }
854
917
 
855
918
  /**
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}
919
+ * Get a custom file
920
+ * Returns a custom file, with a temporary URL to download it.
921
+ * @param {String} custom_file_id The custom file's ID.
922
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFile} and HTTP response
861
923
  */
862
924
  }, {
863
- key: "getCombinedSubmission",
864
- value: function getCombinedSubmission(combined_submission_id, callback) {
925
+ key: "getCustomFileWithHttpInfo",
926
+ value: function getCustomFileWithHttpInfo(custom_file_id) {
865
927
  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");
928
+ // verify the required parameter 'custom_file_id' is set
929
+ if (custom_file_id === undefined || custom_file_id === null) {
930
+ throw new Error("Missing the required parameter 'custom_file_id' when calling getCustomFile");
869
931
  }
870
932
  var pathParams = {
871
- 'combined_submission_id': combined_submission_id
933
+ 'custom_file_id': custom_file_id
872
934
  };
873
935
  var queryParams = {};
874
936
  var headerParams = {};
@@ -876,35 +938,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
876
938
  var authNames = ['api_token_basic'];
877
939
  var contentTypes = [];
878
940
  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);
941
+ var returnType = _CustomFile["default"];
942
+ return this.apiClient.callApi('/custom_files/{custom_file_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
881
943
  }
882
944
 
883
945
  /**
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.
946
+ * Get a custom file
947
+ * Returns a custom file, with a temporary URL to download it.
948
+ * @param {String} custom_file_id The custom file's ID.
949
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFile}
889
950
  */
951
+ }, {
952
+ key: "getCustomFile",
953
+ value: function getCustomFile(custom_file_id) {
954
+ return this.getCustomFileWithHttpInfo(custom_file_id).then(function (response_and_data) {
955
+ return response_and_data.data;
956
+ });
957
+ }
890
958
 
891
959
  /**
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}
960
+ * Get a folder
961
+ * Returns a folder.
962
+ * @param {String} folder_id The folder's ID.
963
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
897
964
  */
898
965
  }, {
899
- key: "getDataRequest",
900
- value: function getDataRequest(data_request_id, callback) {
966
+ key: "getFolderWithHttpInfo",
967
+ value: function getFolderWithHttpInfo(folder_id) {
901
968
  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");
969
+ // verify the required parameter 'folder_id' is set
970
+ if (folder_id === undefined || folder_id === null) {
971
+ throw new Error("Missing the required parameter 'folder_id' when calling getFolder");
905
972
  }
906
973
  var pathParams = {
907
- 'data_request_id': data_request_id
974
+ 'folder_id': folder_id
908
975
  };
909
976
  var queryParams = {};
910
977
  var headerParams = {};
@@ -912,96 +979,107 @@ var Client = exports["default"] = /*#__PURE__*/function () {
912
979
  var authNames = ['api_token_basic'];
913
980
  var contentTypes = [];
914
981
  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);
982
+ var returnType = _Folder["default"];
983
+ return this.apiClient.callApi('/folders/{folder_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
917
984
  }
918
985
 
919
986
  /**
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.
987
+ * Get a folder
988
+ * Returns a folder.
989
+ * @param {String} folder_id The folder's ID.
990
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
925
991
  */
992
+ }, {
993
+ key: "getFolder",
994
+ value: function getFolder(folder_id) {
995
+ return this.getFolderWithHttpInfo(folder_id).then(function (response_and_data) {
996
+ return response_and_data.data;
997
+ });
998
+ }
926
999
 
927
1000
  /**
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}
1001
+ * Get a presigned URL to upload a file
1002
+ * 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.
1003
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UploadPresign} and HTTP response
933
1004
  */
934
1005
  }, {
935
- key: "getFullTemplate",
936
- value: function getFullTemplate(template_id, callback) {
1006
+ key: "getPresignUrlWithHttpInfo",
1007
+ value: function getPresignUrlWithHttpInfo() {
937
1008
  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");
941
- }
942
- var pathParams = {
943
- 'template_id': template_id
944
- };
1009
+ var pathParams = {};
945
1010
  var queryParams = {};
946
1011
  var headerParams = {};
947
1012
  var formParams = {};
948
1013
  var authNames = ['api_token_basic'];
949
1014
  var contentTypes = [];
950
1015
  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);
1016
+ var returnType = _UploadPresign["default"];
1017
+ return this.apiClient.callApi('/uploads/presign', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
953
1018
  }
954
1019
 
955
1020
  /**
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.
1021
+ * Get a presigned URL to upload a file
1022
+ * 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.
1023
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UploadPresign}
961
1024
  */
1025
+ }, {
1026
+ key: "getPresignUrl",
1027
+ value: function getPresignUrl() {
1028
+ return this.getPresignUrlWithHttpInfo().then(function (response_and_data) {
1029
+ return response_and_data.data;
1030
+ });
1031
+ }
962
1032
 
963
1033
  /**
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}
1034
+ * Get a signature request
1035
+ * Returns a signature request, with the values the person has entered so far.
1036
+ * @param {String} signature_request_id The signature request's ID.
1037
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequest} and HTTP response
968
1038
  */
969
1039
  }, {
970
- key: "getPresignUrl",
971
- value: function getPresignUrl(callback) {
1040
+ key: "getSignatureRequestWithHttpInfo",
1041
+ value: function getSignatureRequestWithHttpInfo(signature_request_id) {
972
1042
  var postBody = null;
973
- var pathParams = {};
1043
+ // verify the required parameter 'signature_request_id' is set
1044
+ if (signature_request_id === undefined || signature_request_id === null) {
1045
+ throw new Error("Missing the required parameter 'signature_request_id' when calling getSignatureRequest");
1046
+ }
1047
+ var pathParams = {
1048
+ 'signature_request_id': signature_request_id
1049
+ };
974
1050
  var queryParams = {};
975
1051
  var headerParams = {};
976
1052
  var formParams = {};
977
1053
  var authNames = ['api_token_basic'];
978
1054
  var contentTypes = [];
979
1055
  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);
1056
+ var returnType = _SignatureRequest["default"];
1057
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
982
1058
  }
983
1059
 
984
1060
  /**
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.
1061
+ * Get a signature request
1062
+ * Returns a signature request, with the values the person has entered so far.
1063
+ * @param {String} signature_request_id The signature request's ID.
1064
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequest}
990
1065
  */
1066
+ }, {
1067
+ key: "getSignatureRequest",
1068
+ value: function getSignatureRequest(signature_request_id) {
1069
+ return this.getSignatureRequestWithHttpInfo(signature_request_id).then(function (response_and_data) {
1070
+ return response_and_data.data;
1071
+ });
1072
+ }
991
1073
 
992
1074
  /**
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}
1075
+ * Get a submission
1076
+ * Returns a submission, with its data and links to download its PDF.
1077
+ * @param {String} submission_id The submission's ID.
1078
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Submission} and HTTP response
1000
1079
  */
1001
1080
  }, {
1002
- key: "getSubmission",
1003
- value: function getSubmission(submission_id, opts, callback) {
1004
- opts = opts || {};
1081
+ key: "getSubmissionWithHttpInfo",
1082
+ value: function getSubmissionWithHttpInfo(submission_id) {
1005
1083
  var postBody = null;
1006
1084
  // verify the required parameter 'submission_id' is set
1007
1085
  if (submission_id === undefined || submission_id === null) {
@@ -1010,38 +1088,41 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1010
1088
  var pathParams = {
1011
1089
  'submission_id': submission_id
1012
1090
  };
1013
- var queryParams = {
1014
- 'include_data': opts['include_data']
1015
- };
1091
+ var queryParams = {};
1016
1092
  var headerParams = {};
1017
1093
  var formParams = {};
1018
1094
  var authNames = ['api_token_basic'];
1019
1095
  var contentTypes = [];
1020
1096
  var accepts = ['application/json'];
1021
1097
  var returnType = _Submission["default"];
1022
- return this.apiClient.callApi('/submissions/{submission_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1098
+ return this.apiClient.callApi('/submissions/{submission_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1023
1099
  }
1024
1100
 
1025
1101
  /**
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.
1102
+ * Get a submission
1103
+ * Returns a submission, with its data and links to download its PDF.
1104
+ * @param {String} submission_id The submission's ID.
1105
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Submission}
1031
1106
  */
1107
+ }, {
1108
+ key: "getSubmission",
1109
+ value: function getSubmission(submission_id) {
1110
+ return this.getSubmissionWithHttpInfo(submission_id).then(function (response_and_data) {
1111
+ return response_and_data.data;
1112
+ });
1113
+ }
1032
1114
 
1033
1115
  /**
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
1116
+ * Get a batch
1117
+ * 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.
1118
+ * @param {String} submission_batch_id The batch's ID.
1037
1119
  * @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}
1120
+ * @param {Boolean} [include_data] Include each submission's `data` (null without it).
1121
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionBatch} and HTTP response
1041
1122
  */
1042
1123
  }, {
1043
- key: "getSubmissionBatch",
1044
- value: function getSubmissionBatch(submission_batch_id, opts, callback) {
1124
+ key: "getSubmissionBatchWithHttpInfo",
1125
+ value: function getSubmissionBatchWithHttpInfo(submission_batch_id, opts) {
1045
1126
  opts = opts || {};
1046
1127
  var postBody = null;
1047
1128
  // verify the required parameter 'submission_batch_id' is set
@@ -1052,35 +1133,45 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1052
1133
  'submission_batch_id': submission_batch_id
1053
1134
  };
1054
1135
  var queryParams = {
1055
- 'include_submissions': opts['include_submissions']
1136
+ 'include_data': opts['include_data']
1056
1137
  };
1057
1138
  var headerParams = {};
1058
1139
  var formParams = {};
1059
1140
  var authNames = ['api_token_basic'];
1060
1141
  var contentTypes = [];
1061
1142
  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);
1143
+ var returnType = _SubmissionBatch["default"];
1144
+ return this.apiClient.callApi('/submissions/batches/{submission_batch_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1064
1145
  }
1065
1146
 
1066
1147
  /**
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.
1148
+ * Get a batch
1149
+ * 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.
1150
+ * @param {String} submission_batch_id The batch's ID.
1151
+ * @param {Object} opts Optional parameters
1152
+ * @param {Boolean} opts.include_data Include each submission's `data` (null without it).
1153
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionBatch}
1072
1154
  */
1155
+ }, {
1156
+ key: "getSubmissionBatch",
1157
+ value: function getSubmissionBatch(submission_batch_id, opts) {
1158
+ return this.getSubmissionBatchWithHttpInfo(submission_batch_id, opts).then(function (response_and_data) {
1159
+ return response_and_data.data;
1160
+ });
1161
+ }
1073
1162
 
1074
1163
  /**
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}
1164
+ * Get a template
1165
+ * Returns a template: its draft, or one of its published versions.
1166
+ * @param {String} template_id The template's ID.
1167
+ * @param {Object} opts Optional parameters
1168
+ * @param {String} [version] A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1169
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1080
1170
  */
1081
1171
  }, {
1082
- key: "getTemplate",
1083
- value: function getTemplate(template_id, callback) {
1172
+ key: "getTemplateWithHttpInfo",
1173
+ value: function getTemplateWithHttpInfo(template_id, opts) {
1174
+ opts = opts || {};
1084
1175
  var postBody = null;
1085
1176
  // verify the required parameter 'template_id' is set
1086
1177
  if (template_id === undefined || template_id === null) {
@@ -1089,35 +1180,47 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1089
1180
  var pathParams = {
1090
1181
  'template_id': template_id
1091
1182
  };
1092
- var queryParams = {};
1183
+ var queryParams = {
1184
+ 'version': opts['version']
1185
+ };
1093
1186
  var headerParams = {};
1094
1187
  var formParams = {};
1095
1188
  var authNames = ['api_token_basic'];
1096
1189
  var contentTypes = [];
1097
1190
  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);
1191
+ var returnType = _Template["default"];
1192
+ return this.apiClient.callApi('/templates/{template_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1100
1193
  }
1101
1194
 
1102
1195
  /**
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.
1196
+ * Get a template
1197
+ * Returns a template: its draft, or one of its published versions.
1198
+ * @param {String} template_id The template's ID.
1199
+ * @param {Object} opts Optional parameters
1200
+ * @param {String} opts.version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1201
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1108
1202
  */
1203
+ }, {
1204
+ key: "getTemplate",
1205
+ value: function getTemplate(template_id, opts) {
1206
+ return this.getTemplateWithHttpInfo(template_id, opts).then(function (response_and_data) {
1207
+ return response_and_data.data;
1208
+ });
1209
+ }
1109
1210
 
1110
1211
  /**
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}
1212
+ * Generate typed code for a template's submission data
1213
+ * 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.
1214
+ * @param {String} template_id The template's ID.
1215
+ * @param {module:model/ModelCodeLanguage} lang The language to generate the code in.
1216
+ * @param {Object} opts Optional parameters
1217
+ * @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.
1218
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateModelCode} and HTTP response
1117
1219
  */
1118
1220
  }, {
1119
- key: "getTemplateModelCode",
1120
- value: function getTemplateModelCode(template_id, lang, callback) {
1221
+ key: "getTemplateModelCodeWithHttpInfo",
1222
+ value: function getTemplateModelCodeWithHttpInfo(template_id, lang, opts) {
1223
+ opts = opts || {};
1121
1224
  var postBody = null;
1122
1225
  // verify the required parameter 'template_id' is set
1123
1226
  if (template_id === undefined || template_id === null) {
@@ -1131,6 +1234,7 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1131
1234
  'template_id': template_id
1132
1235
  };
1133
1236
  var queryParams = {
1237
+ 'version': opts['version'],
1134
1238
  'lang': lang
1135
1239
  };
1136
1240
  var headerParams = {};
@@ -1138,28 +1242,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1138
1242
  var authNames = ['api_token_basic'];
1139
1243
  var contentTypes = [];
1140
1244
  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);
1245
+ var returnType = _TemplateModelCode["default"];
1246
+ return this.apiClient.callApi('/templates/{template_id}/model_code', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1143
1247
  }
1144
1248
 
1145
1249
  /**
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.
1250
+ * Generate typed code for a template's submission data
1251
+ * 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.
1252
+ * @param {String} template_id The template's ID.
1253
+ * @param {module:model/ModelCodeLanguage} lang The language to generate the code in.
1254
+ * @param {Object} opts Optional parameters
1255
+ * @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.
1256
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateModelCode}
1151
1257
  */
1258
+ }, {
1259
+ key: "getTemplateModelCode",
1260
+ value: function getTemplateModelCode(template_id, lang, opts) {
1261
+ return this.getTemplateModelCodeWithHttpInfo(template_id, lang, opts).then(function (response_and_data) {
1262
+ return response_and_data.data;
1263
+ });
1264
+ }
1152
1265
 
1153
1266
  /**
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}
1267
+ * Get the JSON Schema of a template's submission data
1268
+ * 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.
1269
+ * @param {String} template_id The template's ID.
1270
+ * @param {Object} opts Optional parameters
1271
+ * @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.
1272
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object.<String, {String: Object}>} and HTTP response
1159
1273
  */
1160
1274
  }, {
1161
- key: "getTemplateSchema",
1162
- value: function getTemplateSchema(template_id, callback) {
1275
+ key: "getTemplateSchemaWithHttpInfo",
1276
+ value: function getTemplateSchemaWithHttpInfo(template_id, opts) {
1277
+ opts = opts || {};
1163
1278
  var postBody = null;
1164
1279
  // verify the required parameter 'template_id' is set
1165
1280
  if (template_id === undefined || template_id === null) {
@@ -1168,34 +1283,45 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1168
1283
  var pathParams = {
1169
1284
  'template_id': template_id
1170
1285
  };
1171
- var queryParams = {};
1286
+ var queryParams = {
1287
+ 'version': opts['version']
1288
+ };
1172
1289
  var headerParams = {};
1173
1290
  var formParams = {};
1174
1291
  var authNames = ['api_token_basic'];
1175
1292
  var contentTypes = [];
1176
1293
  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);
1294
+ var returnType = {
1295
+ 'String': Object
1296
+ };
1297
+ return this.apiClient.callApi('/templates/{template_id}/schema', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1179
1298
  }
1180
1299
 
1181
1300
  /**
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.
1301
+ * Get the JSON Schema of a template's submission data
1302
+ * 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.
1303
+ * @param {String} template_id The template's ID.
1304
+ * @param {Object} opts Optional parameters
1305
+ * @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.
1306
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object.<String, {String: Object}>}
1187
1307
  */
1308
+ }, {
1309
+ key: "getTemplateSchema",
1310
+ value: function getTemplateSchema(template_id, opts) {
1311
+ return this.getTemplateSchemaWithHttpInfo(template_id, opts).then(function (response_and_data) {
1312
+ return response_and_data.data;
1313
+ });
1314
+ }
1188
1315
 
1189
1316
  /**
1190
1317
  * 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}
1318
+ * Returns a webhook.
1319
+ * @param {String} webhook_id The webhook's ID.
1320
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
1195
1321
  */
1196
1322
  }, {
1197
- key: "getWebhook",
1198
- value: function getWebhook(webhook_id, callback) {
1323
+ key: "getWebhookWithHttpInfo",
1324
+ value: function getWebhookWithHttpInfo(webhook_id) {
1199
1325
  var postBody = null;
1200
1326
  // verify the required parameter 'webhook_id' is set
1201
1327
  if (webhook_id === undefined || webhook_id === null) {
@@ -1211,148 +1337,229 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1211
1337
  var contentTypes = [];
1212
1338
  var accepts = ['application/json'];
1213
1339
  var returnType = _Webhook["default"];
1214
- return this.apiClient.callApi('/webhooks/{webhook_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
1340
+ return this.apiClient.callApi('/webhooks/{webhook_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1215
1341
  }
1216
1342
 
1217
1343
  /**
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.
1344
+ * Get a webhook
1345
+ * Returns a webhook.
1346
+ * @param {String} webhook_id The webhook's ID.
1347
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
1223
1348
  */
1349
+ }, {
1350
+ key: "getWebhook",
1351
+ value: function getWebhook(webhook_id) {
1352
+ return this.getWebhookWithHttpInfo(webhook_id).then(function (response_and_data) {
1353
+ return response_and_data.data;
1354
+ });
1355
+ }
1224
1356
 
1225
1357
  /**
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.
1358
+ * List combined PDFs
1359
+ * Returns the combined PDFs in your account, newest first, one page at a time.
1228
1360
  * @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>}
1361
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1362
+ * @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.
1363
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CombinedPdfList} and HTTP response
1233
1364
  */
1234
1365
  }, {
1235
- key: "listCombinedSubmissions",
1236
- value: function listCombinedSubmissions(opts, callback) {
1366
+ key: "listCombinedPdfsWithHttpInfo",
1367
+ value: function listCombinedPdfsWithHttpInfo(opts) {
1237
1368
  opts = opts || {};
1238
1369
  var postBody = null;
1239
1370
  var pathParams = {};
1240
1371
  var queryParams = {
1241
- 'page': opts['page'],
1242
- 'per_page': opts['per_page']
1372
+ 'limit': opts['limit'],
1373
+ 'cursor': opts['cursor']
1243
1374
  };
1244
1375
  var headerParams = {};
1245
1376
  var formParams = {};
1246
1377
  var authNames = ['api_token_basic'];
1247
1378
  var contentTypes = [];
1248
1379
  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);
1380
+ var returnType = _CombinedPdfList["default"];
1381
+ return this.apiClient.callApi('/combined_pdfs', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1251
1382
  }
1252
1383
 
1253
1384
  /**
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.
1385
+ * List combined PDFs
1386
+ * Returns the combined PDFs in your account, newest first, one page at a time.
1387
+ * @param {Object} opts Optional parameters
1388
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1389
+ * @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.
1390
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CombinedPdfList}
1259
1391
  */
1392
+ }, {
1393
+ key: "listCombinedPdfs",
1394
+ value: function listCombinedPdfs(opts) {
1395
+ return this.listCombinedPdfsWithHttpInfo(opts).then(function (response_and_data) {
1396
+ return response_and_data.data;
1397
+ });
1398
+ }
1260
1399
 
1261
1400
  /**
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.
1401
+ * List custom files
1402
+ * Returns the custom files in your account, newest first, one page at a time.
1264
1403
  * @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>}
1404
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1405
+ * @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.
1406
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CustomFileList} and HTTP response
1268
1407
  */
1269
1408
  }, {
1270
- key: "listFolders",
1271
- value: function listFolders(opts, callback) {
1409
+ key: "listCustomFilesWithHttpInfo",
1410
+ value: function listCustomFilesWithHttpInfo(opts) {
1272
1411
  opts = opts || {};
1273
1412
  var postBody = null;
1274
1413
  var pathParams = {};
1275
1414
  var queryParams = {
1276
- 'parent_folder_id': opts['parent_folder_id']
1415
+ 'limit': opts['limit'],
1416
+ 'cursor': opts['cursor']
1277
1417
  };
1278
1418
  var headerParams = {};
1279
1419
  var formParams = {};
1280
1420
  var authNames = ['api_token_basic'];
1281
1421
  var contentTypes = [];
1282
1422
  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);
1423
+ var returnType = _CustomFileList["default"];
1424
+ return this.apiClient.callApi('/custom_files', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1285
1425
  }
1286
1426
 
1287
1427
  /**
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.
1428
+ * List custom files
1429
+ * Returns the custom files in your account, newest first, one page at a time.
1430
+ * @param {Object} opts Optional parameters
1431
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1432
+ * @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.
1433
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CustomFileList}
1293
1434
  */
1435
+ }, {
1436
+ key: "listCustomFiles",
1437
+ value: function listCustomFiles(opts) {
1438
+ return this.listCustomFilesWithHttpInfo(opts).then(function (response_and_data) {
1439
+ return response_and_data.data;
1440
+ });
1441
+ }
1294
1442
 
1295
1443
  /**
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.
1444
+ * List folders
1445
+ * 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
1446
  * @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}
1447
+ * @param {String} [parent_folder_id] Only list the folders in this folder. Without it, the list has every folder, at any depth.
1448
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1449
+ * @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.
1450
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/FolderList} and HTTP response
1307
1451
  */
1308
1452
  }, {
1309
- key: "listSubmissions",
1310
- value: function listSubmissions(opts, callback) {
1453
+ key: "listFoldersWithHttpInfo",
1454
+ value: function listFoldersWithHttpInfo(opts) {
1311
1455
  opts = opts || {};
1312
1456
  var postBody = null;
1313
1457
  var pathParams = {};
1314
1458
  var queryParams = {
1315
- 'cursor': opts['cursor'],
1459
+ 'parent_folder_id': opts['parent_folder_id'],
1316
1460
  'limit': opts['limit'],
1461
+ 'cursor': opts['cursor']
1462
+ };
1463
+ var headerParams = {};
1464
+ var formParams = {};
1465
+ var authNames = ['api_token_basic'];
1466
+ var contentTypes = [];
1467
+ var accepts = ['application/json'];
1468
+ var returnType = _FolderList["default"];
1469
+ return this.apiClient.callApi('/folders', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1470
+ }
1471
+
1472
+ /**
1473
+ * List folders
1474
+ * Returns the folders in your account, newest first, one page at a time. Pass `parent_folder_id` to list the folders in one folder.
1475
+ * @param {Object} opts Optional parameters
1476
+ * @param {String} opts.parent_folder_id Only list the folders in this folder. Without it, the list has every folder, at any depth.
1477
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1478
+ * @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.
1479
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/FolderList}
1480
+ */
1481
+ }, {
1482
+ key: "listFolders",
1483
+ value: function listFolders(opts) {
1484
+ return this.listFoldersWithHttpInfo(opts).then(function (response_and_data) {
1485
+ return response_and_data.data;
1486
+ });
1487
+ }
1488
+
1489
+ /**
1490
+ * List submissions
1491
+ * 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`.
1492
+ * @param {Object} opts Optional parameters
1493
+ * @param {String} [template_id] Only list this template's submissions.
1494
+ * @param {Boolean} [test] Only list test submissions (true) or live submissions (false).
1495
+ * @param {Date} [created_after] Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1496
+ * @param {Date} [created_before] Only list submissions created before this time.
1497
+ * @param {Boolean} [include_data] Include each submission's `data` (null without it).
1498
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1499
+ * @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.
1500
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionList} and HTTP response
1501
+ */
1502
+ }, {
1503
+ key: "listSubmissionsWithHttpInfo",
1504
+ value: function listSubmissionsWithHttpInfo(opts) {
1505
+ opts = opts || {};
1506
+ var postBody = null;
1507
+ var pathParams = {};
1508
+ var queryParams = {
1509
+ 'template_id': opts['template_id'],
1510
+ 'test': opts['test'],
1317
1511
  'created_after': opts['created_after'],
1318
1512
  'created_before': opts['created_before'],
1319
- 'type': opts['type'],
1320
- 'include_data': opts['include_data']
1513
+ 'include_data': opts['include_data'],
1514
+ 'limit': opts['limit'],
1515
+ 'cursor': opts['cursor']
1321
1516
  };
1322
1517
  var headerParams = {};
1323
1518
  var formParams = {};
1324
1519
  var authNames = ['api_token_basic'];
1325
1520
  var contentTypes = [];
1326
1521
  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);
1522
+ var returnType = _SubmissionList["default"];
1523
+ return this.apiClient.callApi('/submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1329
1524
  }
1330
1525
 
1331
1526
  /**
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.
1527
+ * List submissions
1528
+ * 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`.
1529
+ * @param {Object} opts Optional parameters
1530
+ * @param {String} opts.template_id Only list this template's submissions.
1531
+ * @param {Boolean} opts.test Only list test submissions (true) or live submissions (false).
1532
+ * @param {Date} opts.created_after Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1533
+ * @param {Date} opts.created_before Only list submissions created before this time.
1534
+ * @param {Boolean} opts.include_data Include each submission's `data` (null without it).
1535
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1536
+ * @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.
1537
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionList}
1337
1538
  */
1539
+ }, {
1540
+ key: "listSubmissions",
1541
+ value: function listSubmissions(opts) {
1542
+ return this.listSubmissionsWithHttpInfo(opts).then(function (response_and_data) {
1543
+ return response_and_data.data;
1544
+ });
1545
+ }
1338
1546
 
1339
1547
  /**
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
1548
+ * List a template's submissions
1549
+ * Returns a template's submissions (from every version of the template), newest first.
1550
+ * @param {String} template_id The template's ID.
1343
1551
  * @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}
1552
+ * @param {Boolean} [test] Only list test submissions (true) or live submissions (false).
1553
+ * @param {Date} [created_after] Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1554
+ * @param {Date} [created_before] Only list submissions created before this time.
1555
+ * @param {Boolean} [include_data] Include each submission's `data` (null without it).
1556
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1557
+ * @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.
1558
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubmissionList} and HTTP response
1352
1559
  */
1353
1560
  }, {
1354
- key: "listTemplateSubmissions",
1355
- value: function listTemplateSubmissions(template_id, opts, callback) {
1561
+ key: "listTemplateSubmissionsWithHttpInfo",
1562
+ value: function listTemplateSubmissionsWithHttpInfo(template_id, opts) {
1356
1563
  opts = opts || {};
1357
1564
  var postBody = null;
1358
1565
  // verify the required parameter 'template_id' is set
@@ -1363,135 +1570,168 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1363
1570
  'template_id': template_id
1364
1571
  };
1365
1572
  var queryParams = {
1366
- 'cursor': opts['cursor'],
1367
- 'limit': opts['limit'],
1573
+ 'test': opts['test'],
1368
1574
  'created_after': opts['created_after'],
1369
1575
  'created_before': opts['created_before'],
1370
- 'type': opts['type'],
1371
- 'include_data': opts['include_data']
1576
+ 'include_data': opts['include_data'],
1577
+ 'limit': opts['limit'],
1578
+ 'cursor': opts['cursor']
1372
1579
  };
1373
1580
  var headerParams = {};
1374
1581
  var formParams = {};
1375
1582
  var authNames = ['api_token_basic'];
1376
1583
  var contentTypes = [];
1377
1584
  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);
1585
+ var returnType = _SubmissionList["default"];
1586
+ return this.apiClient.callApi('/templates/{template_id}/submissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1380
1587
  }
1381
1588
 
1382
1589
  /**
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.
1590
+ * List a template's submissions
1591
+ * Returns a template's submissions (from every version of the template), newest first.
1592
+ * @param {String} template_id The template's ID.
1593
+ * @param {Object} opts Optional parameters
1594
+ * @param {Boolean} opts.test Only list test submissions (true) or live submissions (false).
1595
+ * @param {Date} opts.created_after Only list submissions created after this time (RFC 3339, such as `2025-01-31T09:00:00Z`).
1596
+ * @param {Date} opts.created_before Only list submissions created before this time.
1597
+ * @param {Boolean} opts.include_data Include each submission's `data` (null without it).
1598
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1599
+ * @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.
1600
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubmissionList}
1388
1601
  */
1602
+ }, {
1603
+ key: "listTemplateSubmissions",
1604
+ value: function listTemplateSubmissions(template_id, opts) {
1605
+ return this.listTemplateSubmissionsWithHttpInfo(template_id, opts).then(function (response_and_data) {
1606
+ return response_and_data.data;
1607
+ });
1608
+ }
1389
1609
 
1390
1610
  /**
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.
1611
+ * List templates
1612
+ * 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
1613
  * @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>}
1614
+ * @param {String} [query] Only list templates whose name contains this text (ignoring case).
1615
+ * @param {String} [parent_folder_id] Only list the templates in this folder (not in its subfolders).
1616
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1617
+ * @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.
1618
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateSummaryList} and HTTP response
1400
1619
  */
1401
1620
  }, {
1402
- key: "listTemplates",
1403
- value: function listTemplates(opts, callback) {
1621
+ key: "listTemplatesWithHttpInfo",
1622
+ value: function listTemplatesWithHttpInfo(opts) {
1404
1623
  opts = opts || {};
1405
1624
  var postBody = null;
1406
1625
  var pathParams = {};
1407
1626
  var queryParams = {
1408
1627
  'query': opts['query'],
1409
1628
  'parent_folder_id': opts['parent_folder_id'],
1410
- 'page': opts['page'],
1411
- 'per_page': opts['per_page']
1629
+ 'limit': opts['limit'],
1630
+ 'cursor': opts['cursor']
1412
1631
  };
1413
1632
  var headerParams = {};
1414
1633
  var formParams = {};
1415
1634
  var authNames = ['api_token_basic'];
1416
1635
  var contentTypes = [];
1417
1636
  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);
1637
+ var returnType = _TemplateSummaryList["default"];
1638
+ return this.apiClient.callApi('/templates', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1420
1639
  }
1421
1640
 
1422
1641
  /**
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.
1642
+ * List templates
1643
+ * 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.
1644
+ * @param {Object} opts Optional parameters
1645
+ * @param {String} opts.query Only list templates whose name contains this text (ignoring case).
1646
+ * @param {String} opts.parent_folder_id Only list the templates in this folder (not in its subfolders).
1647
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1648
+ * @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.
1649
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateSummaryList}
1428
1650
  */
1651
+ }, {
1652
+ key: "listTemplates",
1653
+ value: function listTemplates(opts) {
1654
+ return this.listTemplatesWithHttpInfo(opts).then(function (response_and_data) {
1655
+ return response_and_data.data;
1656
+ });
1657
+ }
1429
1658
 
1430
1659
  /**
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.
1660
+ * List webhooks
1661
+ * 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
1662
  * @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>}
1663
+ * @param {module:model/WebhookEventType} [event_type] Only list webhooks that subscribe to this event.
1664
+ * @param {module:model/WebhookMode} [mode] Only list webhooks set to this mode.
1665
+ * @param {String} [template_id] Only list webhooks scoped to this template.
1666
+ * @param {String} [folder_id] Only list webhooks scoped to this folder.
1667
+ * @param {String} [api_token_id] Only list webhooks scoped to this API token.
1668
+ * @param {Number} [limit = 50)] How many items to return (1-100, default 50).
1669
+ * @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.
1670
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WebhookList} and HTTP response
1443
1671
  */
1444
1672
  }, {
1445
- key: "listWebhooks",
1446
- value: function listWebhooks(opts, callback) {
1673
+ key: "listWebhooksWithHttpInfo",
1674
+ value: function listWebhooksWithHttpInfo(opts) {
1447
1675
  opts = opts || {};
1448
1676
  var postBody = null;
1449
1677
  var pathParams = {};
1450
1678
  var queryParams = {
1451
- 'page': opts['page'],
1452
- 'per_page': opts['per_page'],
1453
1679
  'event_type': opts['event_type'],
1454
1680
  'mode': opts['mode'],
1455
1681
  'template_id': opts['template_id'],
1456
1682
  'folder_id': opts['folder_id'],
1457
- 'api_token_id': opts['api_token_id']
1683
+ 'api_token_id': opts['api_token_id'],
1684
+ 'limit': opts['limit'],
1685
+ 'cursor': opts['cursor']
1458
1686
  };
1459
1687
  var headerParams = {};
1460
1688
  var formParams = {};
1461
1689
  var authNames = ['api_token_basic'];
1462
1690
  var contentTypes = [];
1463
1691
  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);
1692
+ var returnType = _WebhookList["default"];
1693
+ return this.apiClient.callApi('/webhooks', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1466
1694
  }
1467
1695
 
1468
1696
  /**
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.
1697
+ * List webhooks
1698
+ * 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.
1699
+ * @param {Object} opts Optional parameters
1700
+ * @param {module:model/WebhookEventType} opts.event_type Only list webhooks that subscribe to this event.
1701
+ * @param {module:model/WebhookMode} opts.mode Only list webhooks set to this mode.
1702
+ * @param {String} opts.template_id Only list webhooks scoped to this template.
1703
+ * @param {String} opts.folder_id Only list webhooks scoped to this folder.
1704
+ * @param {String} opts.api_token_id Only list webhooks scoped to this API token.
1705
+ * @param {Number} opts.limit How many items to return (1-100, default 50). (default to 50)
1706
+ * @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.
1707
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WebhookList}
1474
1708
  */
1709
+ }, {
1710
+ key: "listWebhooks",
1711
+ value: function listWebhooks(opts) {
1712
+ return this.listWebhooksWithHttpInfo(opts).then(function (response_and_data) {
1713
+ return response_and_data.data;
1714
+ });
1715
+ }
1475
1716
 
1476
1717
  /**
1477
1718
  * 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}
1719
+ * 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.
1720
+ * @param {String} folder_id The folder's ID.
1721
+ * @param {module:model/MoveFolderRequest} body Where to move the folder.
1722
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
1483
1723
  */
1484
1724
  }, {
1485
- key: "moveFolderToFolder",
1486
- value: function moveFolderToFolder(folder_id, data, callback) {
1487
- var postBody = data;
1725
+ key: "moveFolderWithHttpInfo",
1726
+ value: function moveFolderWithHttpInfo(folder_id, body) {
1727
+ var postBody = body;
1488
1728
  // verify the required parameter 'folder_id' is set
1489
1729
  if (folder_id === undefined || folder_id === null) {
1490
- throw new Error("Missing the required parameter 'folder_id' when calling moveFolderToFolder");
1730
+ throw new Error("Missing the required parameter 'folder_id' when calling moveFolder");
1491
1731
  }
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");
1732
+ // verify the required parameter 'body' is set
1733
+ if (body === undefined || body === null) {
1734
+ throw new Error("Missing the required parameter 'body' when calling moveFolder");
1495
1735
  }
1496
1736
  var pathParams = {
1497
1737
  'folder_id': folder_id
@@ -1503,36 +1743,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1503
1743
  var contentTypes = ['application/json'];
1504
1744
  var accepts = ['application/json'];
1505
1745
  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);
1746
+ return this.apiClient.callApi('/folders/{folder_id}/move', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1507
1747
  }
1508
1748
 
1509
1749
  /**
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.
1750
+ * Move a folder
1751
+ * 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.
1752
+ * @param {String} folder_id The folder's ID.
1753
+ * @param {module:model/MoveFolderRequest} body Where to move the folder.
1754
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
1515
1755
  */
1756
+ }, {
1757
+ key: "moveFolder",
1758
+ value: function moveFolder(folder_id, body) {
1759
+ return this.moveFolderWithHttpInfo(folder_id, body).then(function (response_and_data) {
1760
+ return response_and_data.data;
1761
+ });
1762
+ }
1516
1763
 
1517
1764
  /**
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}
1765
+ * Move a template to a folder
1766
+ * Moves a template and all of its published versions to a folder, or to the root (`null`).
1767
+ * @param {String} template_id The template's ID.
1768
+ * @param {module:model/MoveTemplateRequest} body Where to move the template.
1769
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1524
1770
  */
1525
1771
  }, {
1526
- key: "moveTemplateToFolder",
1527
- value: function moveTemplateToFolder(template_id, data, callback) {
1528
- var postBody = data;
1772
+ key: "moveTemplateWithHttpInfo",
1773
+ value: function moveTemplateWithHttpInfo(template_id, body) {
1774
+ var postBody = body;
1529
1775
  // verify the required parameter 'template_id' is set
1530
1776
  if (template_id === undefined || template_id === null) {
1531
- throw new Error("Missing the required parameter 'template_id' when calling moveTemplateToFolder");
1777
+ throw new Error("Missing the required parameter 'template_id' when calling moveTemplate");
1532
1778
  }
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");
1779
+ // verify the required parameter 'body' is set
1780
+ if (body === undefined || body === null) {
1781
+ throw new Error("Missing the required parameter 'body' when calling moveTemplate");
1536
1782
  }
1537
1783
  var pathParams = {
1538
1784
  'template_id': template_id
@@ -1543,37 +1789,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1543
1789
  var authNames = ['api_token_basic'];
1544
1790
  var contentTypes = ['application/json'];
1545
1791
  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);
1792
+ var returnType = _Template["default"];
1793
+ return this.apiClient.callApi('/templates/{template_id}/move', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1548
1794
  }
1549
1795
 
1550
1796
  /**
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.
1797
+ * Move a template to a folder
1798
+ * Moves a template and all of its published versions to a folder, or to the root (`null`).
1799
+ * @param {String} template_id The template's ID.
1800
+ * @param {module:model/MoveTemplateRequest} body Where to move the template.
1801
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1556
1802
  */
1803
+ }, {
1804
+ key: "moveTemplate",
1805
+ value: function moveTemplate(template_id, body) {
1806
+ return this.moveTemplateWithHttpInfo(template_id, body).then(function (response_and_data) {
1807
+ return response_and_data.data;
1808
+ });
1809
+ }
1557
1810
 
1558
1811
  /**
1559
1812
  * 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}
1813
+ * 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.
1814
+ * @param {String} template_id The template's ID.
1815
+ * @param {module:model/PublishTemplateVersionRequest} body The version to publish.
1816
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TemplateVersion} and HTTP response
1565
1817
  */
1566
1818
  }, {
1567
- key: "publishTemplateVersion",
1568
- value: function publishTemplateVersion(template_id, data, callback) {
1569
- var postBody = data;
1819
+ key: "publishTemplateVersionWithHttpInfo",
1820
+ value: function publishTemplateVersionWithHttpInfo(template_id, body) {
1821
+ var postBody = body;
1570
1822
  // verify the required parameter 'template_id' is set
1571
1823
  if (template_id === undefined || template_id === null) {
1572
1824
  throw new Error("Missing the required parameter 'template_id' when calling publishTemplateVersion");
1573
1825
  }
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");
1826
+ // verify the required parameter 'body' is set
1827
+ if (body === undefined || body === null) {
1828
+ throw new Error("Missing the required parameter 'body' when calling publishTemplateVersion");
1577
1829
  }
1578
1830
  var pathParams = {
1579
1831
  'template_id': template_id
@@ -1584,37 +1836,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1584
1836
  var authNames = ['api_token_basic'];
1585
1837
  var contentTypes = ['application/json'];
1586
1838
  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);
1839
+ var returnType = _TemplateVersion["default"];
1840
+ return this.apiClient.callApi('/templates/{template_id}/publish_version', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1589
1841
  }
1590
1842
 
1591
1843
  /**
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.
1844
+ * Publish a template version
1845
+ * 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.
1846
+ * @param {String} template_id The template's ID.
1847
+ * @param {module:model/PublishTemplateVersionRequest} body The version to publish.
1848
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TemplateVersion}
1597
1849
  */
1850
+ }, {
1851
+ key: "publishTemplateVersion",
1852
+ value: function publishTemplateVersion(template_id, body) {
1853
+ return this.publishTemplateVersionWithHttpInfo(template_id, body).then(function (response_and_data) {
1854
+ return response_and_data.data;
1855
+ });
1856
+ }
1598
1857
 
1599
1858
  /**
1600
1859
  * 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}
1860
+ * Renames a folder. The name must be unique within its parent folder.
1861
+ * @param {String} folder_id The folder's ID.
1862
+ * @param {module:model/RenameFolderRequest} body The folder's new name.
1863
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Folder} and HTTP response
1606
1864
  */
1607
1865
  }, {
1608
- key: "renameFolder",
1609
- value: function renameFolder(folder_id, data, callback) {
1610
- var postBody = data;
1866
+ key: "renameFolderWithHttpInfo",
1867
+ value: function renameFolderWithHttpInfo(folder_id, body) {
1868
+ var postBody = body;
1611
1869
  // verify the required parameter 'folder_id' is set
1612
1870
  if (folder_id === undefined || folder_id === null) {
1613
1871
  throw new Error("Missing the required parameter 'folder_id' when calling renameFolder");
1614
1872
  }
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");
1873
+ // verify the required parameter 'body' is set
1874
+ if (body === undefined || body === null) {
1875
+ throw new Error("Missing the required parameter 'body' when calling renameFolder");
1618
1876
  }
1619
1877
  var pathParams = {
1620
1878
  'folder_id': folder_id
@@ -1626,36 +1884,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1626
1884
  var contentTypes = ['application/json'];
1627
1885
  var accepts = ['application/json'];
1628
1886
  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);
1887
+ return this.apiClient.callApi('/folders/{folder_id}/rename', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1630
1888
  }
1631
1889
 
1632
1890
  /**
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.
1891
+ * Rename a folder
1892
+ * Renames a folder. The name must be unique within its parent folder.
1893
+ * @param {String} folder_id The folder's ID.
1894
+ * @param {module:model/RenameFolderRequest} body The folder's new name.
1895
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Folder}
1638
1896
  */
1897
+ }, {
1898
+ key: "renameFolder",
1899
+ value: function renameFolder(folder_id, body) {
1900
+ return this.renameFolderWithHttpInfo(folder_id, body).then(function (response_and_data) {
1901
+ return response_and_data.data;
1902
+ });
1903
+ }
1639
1904
 
1640
1905
  /**
1641
1906
  * 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}
1907
+ * Replaces the template's draft with a copy of one of its published versions.
1908
+ * @param {String} template_id The template's ID.
1909
+ * @param {module:model/RestoreTemplateVersionRequest} body The version to restore.
1910
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1647
1911
  */
1648
1912
  }, {
1649
- key: "restoreTemplateVersion",
1650
- value: function restoreTemplateVersion(template_id, data, callback) {
1651
- var postBody = data;
1913
+ key: "restoreTemplateVersionWithHttpInfo",
1914
+ value: function restoreTemplateVersionWithHttpInfo(template_id, body) {
1915
+ var postBody = body;
1652
1916
  // verify the required parameter 'template_id' is set
1653
1917
  if (template_id === undefined || template_id === null) {
1654
1918
  throw new Error("Missing the required parameter 'template_id' when calling restoreTemplateVersion");
1655
1919
  }
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");
1920
+ // verify the required parameter 'body' is set
1921
+ if (body === undefined || body === null) {
1922
+ throw new Error("Missing the required parameter 'body' when calling restoreTemplateVersion");
1659
1923
  }
1660
1924
  var pathParams = {
1661
1925
  'template_id': template_id
@@ -1666,27 +1930,33 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1666
1930
  var authNames = ['api_token_basic'];
1667
1931
  var contentTypes = ['application/json'];
1668
1932
  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);
1933
+ var returnType = _Template["default"];
1934
+ return this.apiClient.callApi('/templates/{template_id}/restore_version', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1671
1935
  }
1672
1936
 
1673
1937
  /**
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.
1938
+ * Restore a template version
1939
+ * Replaces the template's draft with a copy of one of its published versions.
1940
+ * @param {String} template_id The template's ID.
1941
+ * @param {module:model/RestoreTemplateVersionRequest} body The version to restore.
1942
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1679
1943
  */
1944
+ }, {
1945
+ key: "restoreTemplateVersion",
1946
+ value: function restoreTemplateVersion(template_id, body) {
1947
+ return this.restoreTemplateVersionWithHttpInfo(template_id, body).then(function (response_and_data) {
1948
+ return response_and_data.data;
1949
+ });
1950
+ }
1680
1951
 
1681
1952
  /**
1682
1953
  * 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}
1954
+ * Checks whether your API token is valid by making an authenticated request. This endpoint is useful for verifying credentials during setup or troubleshooting issues.
1955
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AuthenticationCheck} and HTTP response
1686
1956
  */
1687
1957
  }, {
1688
- key: "testAuthentication",
1689
- value: function testAuthentication(callback) {
1958
+ key: "testAuthenticationWithHttpInfo",
1959
+ value: function testAuthenticationWithHttpInfo() {
1690
1960
  var postBody = null;
1691
1961
  var pathParams = {};
1692
1962
  var queryParams = {};
@@ -1695,40 +1965,44 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1695
1965
  var authNames = ['api_token_basic'];
1696
1966
  var contentTypes = [];
1697
1967
  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);
1968
+ var returnType = _AuthenticationCheck["default"];
1969
+ return this.apiClient.callApi('/authentication', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1700
1970
  }
1701
1971
 
1702
1972
  /**
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.
1973
+ * Test authentication
1974
+ * Checks whether your API token is valid by making an authenticated request. This endpoint is useful for verifying credentials during setup or troubleshooting issues.
1975
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AuthenticationCheck}
1708
1976
  */
1977
+ }, {
1978
+ key: "testAuthentication",
1979
+ value: function testAuthentication() {
1980
+ return this.testAuthenticationWithHttpInfo().then(function (response_and_data) {
1981
+ return response_and_data.data;
1982
+ });
1983
+ }
1709
1984
 
1710
1985
  /**
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}
1986
+ * Update a signature request
1987
+ * 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.
1988
+ * @param {String} signature_request_id The signature request's ID.
1989
+ * @param {module:model/UpdateSignatureRequestRequest} body The settings to change. Properties left out keep their values.
1990
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SignatureRequest} and HTTP response
1717
1991
  */
1718
1992
  }, {
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");
1993
+ key: "updateSignatureRequestWithHttpInfo",
1994
+ value: function updateSignatureRequestWithHttpInfo(signature_request_id, body) {
1995
+ var postBody = body;
1996
+ // verify the required parameter 'signature_request_id' is set
1997
+ if (signature_request_id === undefined || signature_request_id === null) {
1998
+ throw new Error("Missing the required parameter 'signature_request_id' when calling updateSignatureRequest");
1725
1999
  }
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");
2000
+ // verify the required parameter 'body' is set
2001
+ if (body === undefined || body === null) {
2002
+ throw new Error("Missing the required parameter 'body' when calling updateSignatureRequest");
1729
2003
  }
1730
2004
  var pathParams = {
1731
- 'data_request_id': data_request_id
2005
+ 'signature_request_id': signature_request_id
1732
2006
  };
1733
2007
  var queryParams = {};
1734
2008
  var headerParams = {};
@@ -1736,37 +2010,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1736
2010
  var authNames = ['api_token_basic'];
1737
2011
  var contentTypes = ['application/json'];
1738
2012
  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);
2013
+ var returnType = _SignatureRequest["default"];
2014
+ return this.apiClient.callApi('/signature_requests/{signature_request_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1741
2015
  }
1742
2016
 
1743
2017
  /**
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.
2018
+ * Update a signature request
2019
+ * 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.
2020
+ * @param {String} signature_request_id The signature request's ID.
2021
+ * @param {module:model/UpdateSignatureRequestRequest} body The settings to change. Properties left out keep their values.
2022
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SignatureRequest}
1749
2023
  */
2024
+ }, {
2025
+ key: "updateSignatureRequest",
2026
+ value: function updateSignatureRequest(signature_request_id, body) {
2027
+ return this.updateSignatureRequestWithHttpInfo(signature_request_id, body).then(function (response_and_data) {
2028
+ return response_and_data.data;
2029
+ });
2030
+ }
1750
2031
 
1751
2032
  /**
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}
2033
+ * Update a template
2034
+ * Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object. Setting `parent_folder_id` moves the template and all of its published versions.
2035
+ * @param {String} template_id The template's ID.
2036
+ * @param {module:model/UpdateTemplateRequest} body The settings to change. Properties left out keep their values.
2037
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1758
2038
  */
1759
2039
  }, {
1760
- key: "updateTemplate",
1761
- value: function updateTemplate(template_id, data, callback) {
1762
- var postBody = data;
2040
+ key: "updateTemplateWithHttpInfo",
2041
+ value: function updateTemplateWithHttpInfo(template_id, body) {
2042
+ var postBody = body;
1763
2043
  // verify the required parameter 'template_id' is set
1764
2044
  if (template_id === undefined || template_id === null) {
1765
2045
  throw new Error("Missing the required parameter 'template_id' when calling updateTemplate");
1766
2046
  }
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");
2047
+ // verify the required parameter 'body' is set
2048
+ if (body === undefined || body === null) {
2049
+ throw new Error("Missing the required parameter 'body' when calling updateTemplate");
1770
2050
  }
1771
2051
  var pathParams = {
1772
2052
  'template_id': template_id
@@ -1777,87 +2057,100 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1777
2057
  var authNames = ['api_token_basic'];
1778
2058
  var contentTypes = ['application/json'];
1779
2059
  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);
2060
+ var returnType = _Template["default"];
2061
+ return this.apiClient.callApi('/templates/{template_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1782
2062
  }
1783
2063
 
1784
2064
  /**
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.
2065
+ * Update a template
2066
+ * Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object. Setting `parent_folder_id` moves the template and all of its published versions.
2067
+ * @param {String} template_id The template's ID.
2068
+ * @param {module:model/UpdateTemplateRequest} body The settings to change. Properties left out keep their values.
2069
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1790
2070
  */
2071
+ }, {
2072
+ key: "updateTemplate",
2073
+ value: function updateTemplate(template_id, body) {
2074
+ return this.updateTemplateWithHttpInfo(template_id, body).then(function (response_and_data) {
2075
+ return response_and_data.data;
2076
+ });
2077
+ }
1791
2078
 
1792
2079
  /**
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
2080
+ * Replace a template's PDF
2081
+ * Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF with the request instead, use PUT /templates/{template_id}/document/upload.
2082
+ * @param {String} template_id The template's ID.
2083
+ * @param {module:model/UpdateTemplateDocumentRequest} body The new PDF.
1797
2084
  * @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}
2085
+ * @param {Boolean} [wait] Wait until the PDF has been processed before responding. Default true on sync.api hosts.
2086
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1801
2087
  */
1802
2088
  }, {
1803
- key: "updateTemplateDocument",
1804
- value: function updateTemplateDocument(template_id, template_document, opts, callback) {
2089
+ key: "updateTemplateDocumentWithHttpInfo",
2090
+ value: function updateTemplateDocumentWithHttpInfo(template_id, body, opts) {
1805
2091
  opts = opts || {};
1806
- var postBody = null;
2092
+ var postBody = body;
1807
2093
  // verify the required parameter 'template_id' is set
1808
2094
  if (template_id === undefined || template_id === null) {
1809
2095
  throw new Error("Missing the required parameter 'template_id' when calling updateTemplateDocument");
1810
2096
  }
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");
2097
+ // verify the required parameter 'body' is set
2098
+ if (body === undefined || body === null) {
2099
+ throw new Error("Missing the required parameter 'body' when calling updateTemplateDocument");
1814
2100
  }
1815
2101
  var pathParams = {
1816
2102
  'template_id': template_id
1817
2103
  };
1818
- var queryParams = {};
1819
- var headerParams = {};
1820
- var formParams = {
1821
- 'template[document]': template_document,
1822
- 'template[name]': opts['template_name']
2104
+ var queryParams = {
2105
+ 'wait': opts['wait']
1823
2106
  };
2107
+ var headerParams = {};
2108
+ var formParams = {};
1824
2109
  var authNames = ['api_token_basic'];
1825
- var contentTypes = ['multipart/form-data'];
2110
+ var contentTypes = ['application/json'];
1826
2111
  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);
2112
+ var returnType = _Template["default"];
2113
+ return this.apiClient.callApi('/templates/{template_id}/document', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1829
2114
  }
1830
2115
 
1831
2116
  /**
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.
2117
+ * Replace a template's PDF
2118
+ * Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF with the request instead, use PUT /templates/{template_id}/document/upload.
2119
+ * @param {String} template_id The template's ID.
2120
+ * @param {module:model/UpdateTemplateDocumentRequest} body The new PDF.
2121
+ * @param {Object} opts Optional parameters
2122
+ * @param {Boolean} opts.wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
2123
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
1837
2124
  */
2125
+ }, {
2126
+ key: "updateTemplateDocument",
2127
+ value: function updateTemplateDocument(template_id, body, opts) {
2128
+ return this.updateTemplateDocumentWithHttpInfo(template_id, body, opts).then(function (response_and_data) {
2129
+ return response_and_data.data;
2130
+ });
2131
+ }
1838
2132
 
1839
2133
  /**
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}
2134
+ * Update a webhook
2135
+ * Updates a webhook. Only the properties you send change.
2136
+ * @param {String} webhook_id The webhook's ID.
2137
+ * @param {module:model/UpdateWebhookRequest} body The settings to change. Properties left out keep their values.
2138
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Webhook} and HTTP response
1846
2139
  */
1847
2140
  }, {
1848
- key: "updateTemplateDocumentFromUpload",
1849
- value: function updateTemplateDocumentFromUpload(template_id, data, callback) {
1850
- var postBody = data;
1851
- // verify the required parameter 'template_id' is set
1852
- if (template_id === undefined || template_id === null) {
1853
- throw new Error("Missing the required parameter 'template_id' when calling updateTemplateDocumentFromUpload");
2141
+ key: "updateWebhookWithHttpInfo",
2142
+ value: function updateWebhookWithHttpInfo(webhook_id, body) {
2143
+ var postBody = body;
2144
+ // verify the required parameter 'webhook_id' is set
2145
+ if (webhook_id === undefined || webhook_id === null) {
2146
+ throw new Error("Missing the required parameter 'webhook_id' when calling updateWebhook");
1854
2147
  }
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");
2148
+ // verify the required parameter 'body' is set
2149
+ if (body === undefined || body === null) {
2150
+ throw new Error("Missing the required parameter 'body' when calling updateWebhook");
1858
2151
  }
1859
2152
  var pathParams = {
1860
- 'template_id': template_id
2153
+ 'webhook_id': webhook_id
1861
2154
  };
1862
2155
  var queryParams = {};
1863
2156
  var headerParams = {};
@@ -1865,49 +2158,154 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1865
2158
  var authNames = ['api_token_basic'];
1866
2159
  var contentTypes = ['application/json'];
1867
2160
  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);
2161
+ var returnType = _Webhook["default"];
2162
+ return this.apiClient.callApi('/webhooks/{webhook_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
1870
2163
  }
1871
2164
 
1872
2165
  /**
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.
2166
+ * Update a webhook
2167
+ * Updates a webhook. Only the properties you send change.
2168
+ * @param {String} webhook_id The webhook's ID.
2169
+ * @param {module:model/UpdateWebhookRequest} body The settings to change. Properties left out keep their values.
2170
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Webhook}
1878
2171
  */
2172
+ }, {
2173
+ key: "updateWebhook",
2174
+ value: function updateWebhook(webhook_id, body) {
2175
+ return this.updateWebhookWithHttpInfo(webhook_id, body).then(function (response_and_data) {
2176
+ return response_and_data.data;
2177
+ });
2178
+ }
1879
2179
 
1880
2180
  /**
1881
- * 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}
2181
+ * Create a PDF template from an uploaded PDF
2182
+ * 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.
2183
+ * @param {File} document The PDF.
2184
+ * @param {Object} opts Optional parameters
2185
+ * @param {Boolean} [wait] Wait until the PDF has been processed before responding. Default true on sync.api hosts.
2186
+ * @param {String} [name] The template's name.
2187
+ * @param {String} [description] The template's description.
2188
+ * @param {String} [parent_folder_id] The folder to put the template in. Left out, it's created at the root.
2189
+ * @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.
2190
+ * @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.
2191
+ * @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.
2192
+ * @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`.
2193
+ * @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.
2194
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
1887
2195
  */
1888
2196
  }, {
1889
- key: "updateWebhook",
1890
- value: function updateWebhook(webhook_id, data, callback) {
1891
- var postBody = data;
1892
- // verify the required parameter 'webhook_id' is set
1893
- if (webhook_id === undefined || webhook_id === null) {
1894
- throw new Error("Missing the required parameter 'webhook_id' when calling updateWebhook");
2197
+ key: "uploadTemplateWithHttpInfo",
2198
+ value: function uploadTemplateWithHttpInfo(document, opts) {
2199
+ opts = opts || {};
2200
+ var postBody = null;
2201
+ // verify the required parameter 'document' is set
2202
+ if (document === undefined || document === null) {
2203
+ throw new Error("Missing the required parameter 'document' when calling uploadTemplate");
1895
2204
  }
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");
2205
+ var pathParams = {};
2206
+ var queryParams = {
2207
+ 'wait': opts['wait']
2208
+ };
2209
+ var headerParams = {};
2210
+ var formParams = {
2211
+ 'document': document,
2212
+ 'name': opts['name'],
2213
+ 'description': opts['description'],
2214
+ 'parent_folder_id': opts['parent_folder_id'],
2215
+ 'ai_field_naming_language': opts['ai_field_naming_language'],
2216
+ 'detect_fields': opts['detect_fields'],
2217
+ 'field_source': opts['field_source'],
2218
+ 'field_naming': opts['field_naming'],
2219
+ 'field_logic': opts['field_logic']
2220
+ };
2221
+ var authNames = ['api_token_basic'];
2222
+ var contentTypes = ['multipart/form-data'];
2223
+ var accepts = ['application/json'];
2224
+ var returnType = _Template["default"];
2225
+ return this.apiClient.callApi('/templates/upload', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2226
+ }
2227
+
2228
+ /**
2229
+ * Create a PDF template from an uploaded PDF
2230
+ * 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.
2231
+ * @param {File} document The PDF.
2232
+ * @param {Object} opts Optional parameters
2233
+ * @param {Boolean} opts.wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
2234
+ * @param {String} opts.name The template's name.
2235
+ * @param {String} opts.description The template's description.
2236
+ * @param {String} opts.parent_folder_id The folder to put the template in. Left out, it's created at the root.
2237
+ * @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.
2238
+ * @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.
2239
+ * @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.
2240
+ * @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`.
2241
+ * @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.
2242
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
2243
+ */
2244
+ }, {
2245
+ key: "uploadTemplate",
2246
+ value: function uploadTemplate(document, opts) {
2247
+ return this.uploadTemplateWithHttpInfo(document, opts).then(function (response_and_data) {
2248
+ return response_and_data.data;
2249
+ });
2250
+ }
2251
+
2252
+ /**
2253
+ * Replace a template's PDF with an uploaded PDF
2254
+ * 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.
2255
+ * @param {String} template_id The template's ID.
2256
+ * @param {File} document The new PDF.
2257
+ * @param {Object} opts Optional parameters
2258
+ * @param {Boolean} [wait] Wait until the PDF has been processed before responding. Default true on sync.api hosts.
2259
+ * @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.
2260
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Template} and HTTP response
2261
+ */
2262
+ }, {
2263
+ key: "uploadTemplateDocumentWithHttpInfo",
2264
+ value: function uploadTemplateDocumentWithHttpInfo(template_id, document, opts) {
2265
+ opts = opts || {};
2266
+ var postBody = null;
2267
+ // verify the required parameter 'template_id' is set
2268
+ if (template_id === undefined || template_id === null) {
2269
+ throw new Error("Missing the required parameter 'template_id' when calling uploadTemplateDocument");
2270
+ }
2271
+ // verify the required parameter 'document' is set
2272
+ if (document === undefined || document === null) {
2273
+ throw new Error("Missing the required parameter 'document' when calling uploadTemplateDocument");
1899
2274
  }
1900
2275
  var pathParams = {
1901
- 'webhook_id': webhook_id
2276
+ 'template_id': template_id
2277
+ };
2278
+ var queryParams = {
2279
+ 'wait': opts['wait']
1902
2280
  };
1903
- var queryParams = {};
1904
2281
  var headerParams = {};
1905
- var formParams = {};
2282
+ var formParams = {
2283
+ 'document': document,
2284
+ 'reimport_fields': opts['reimport_fields']
2285
+ };
1906
2286
  var authNames = ['api_token_basic'];
1907
- var contentTypes = ['application/json'];
2287
+ var contentTypes = ['multipart/form-data'];
1908
2288
  var accepts = ['application/json'];
1909
- var returnType = _Webhook["default"];
1910
- return this.apiClient.callApi('/webhooks/{webhook_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
2289
+ var returnType = _Template["default"];
2290
+ return this.apiClient.callApi('/templates/{template_id}/document/upload', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
2291
+ }
2292
+
2293
+ /**
2294
+ * Replace a template's PDF with an uploaded PDF
2295
+ * 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.
2296
+ * @param {String} template_id The template's ID.
2297
+ * @param {File} document The new PDF.
2298
+ * @param {Object} opts Optional parameters
2299
+ * @param {Boolean} opts.wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
2300
+ * @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.
2301
+ * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Template}
2302
+ */
2303
+ }, {
2304
+ key: "uploadTemplateDocument",
2305
+ value: function uploadTemplateDocument(template_id, document, opts) {
2306
+ return this.uploadTemplateDocumentWithHttpInfo(template_id, document, opts).then(function (response_and_data) {
2307
+ return response_and_data.data;
2308
+ });
1911
2309
  }
1912
2310
  }]);
1913
2311
  }();