docspring 3.2.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 (157) hide show
  1. package/AGENTS.md +79 -19
  2. package/README.md +65 -63
  3. package/dist/ApiClient.js +62 -27
  4. package/dist/RequestSchemas.js +2297 -0
  5. package/dist/RequestValidator.js +494 -0
  6. package/dist/api/Client.js +1345 -946
  7. package/dist/index.js +655 -151
  8. package/dist/model/AiFieldNamingLanguage.js +64 -0
  9. package/dist/model/{AddFieldsData.js → AuthenticationCheck.js} +31 -31
  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} +26 -26
  15. package/dist/model/CombinedPdfList.js +132 -0
  16. package/dist/model/{SubmissionDataRequestToken.js → CombinedPdfSource.js} +55 -52
  17. package/dist/model/CombinedPdfSourceInput.js +270 -0
  18. package/dist/model/{SuccessErrorResponse.js → CombinedPdfSourcePdf.js} +41 -55
  19. package/dist/model/CombinedPdfSourceType.js +74 -0
  20. package/dist/model/CombinedPdfState.js +74 -0
  21. package/dist/model/{CopyTemplateOptions.js → CopyTemplateRequest.js} +25 -21
  22. package/dist/model/{CombinePdfsData.js → CreateCombinedPdfRequest.js} +68 -52
  23. package/dist/model/{CreateCustomFileData.js → CreateCustomFileFromUploadRequest.js} +24 -22
  24. package/dist/model/{CreateFolderData.js → CreateFolderRequest.js} +46 -27
  25. package/dist/model/{CreateSubmissionDataRequestEventRequest.js → CreateSignatureRequestEventRequest.js} +41 -137
  26. package/dist/model/CreateSignatureRequestTokenRequest.js +88 -0
  27. package/dist/model/{CreatePdfSubmissionData.js → CreateSubmissionBatchRequest.js} +63 -87
  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 +66 -15
  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/{BatchGeneratePdfs201Response.js → ErrorDetail.js} +65 -76
  36. package/dist/model/ErrorInfo.js +211 -0
  37. package/dist/model/ErrorResponse.js +11 -40
  38. package/dist/model/ExpirationInterval.js +64 -0
  39. package/dist/model/{CreateSubmissionResponse.js → FieldComparisonCondition.js} +46 -64
  40. package/dist/model/FieldComparisonOperator.js +69 -0
  41. package/dist/model/FieldDisplayType.js +79 -0
  42. package/dist/model/FieldEqualsCondition.js +137 -0
  43. package/dist/model/FieldEqualsOperator.js +59 -0
  44. package/dist/model/FieldInCondition.js +145 -0
  45. package/dist/model/FieldOverride.js +722 -0
  46. package/dist/model/{MultipleErrorsResponse.js → FieldPresenceCondition.js} +39 -54
  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 +37 -10
  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} +33 -27
  63. package/dist/model/{MoveTemplateData.js → MoveTemplateRequest.js} +24 -34
  64. package/dist/model/NumberConditionType.js +79 -0
  65. package/dist/model/PageFormat.js +114 -0
  66. package/dist/model/{PublishVersionData.js → PublishTemplateVersionRequest.js} +32 -32
  67. package/dist/model/{RenameFolderData.js → RenameFolderRequest.js} +24 -22
  68. package/dist/model/{RestoreVersionData.js → RestoreTemplateVersionRequest.js} +24 -22
  69. package/dist/model/ShapeType.js +79 -0
  70. package/dist/model/{SubmissionDataRequestShow.js → SignatureRequest.js} +164 -239
  71. package/dist/model/SignatureRequestAuthSecondFactorType.js +79 -0
  72. package/dist/model/SignatureRequestAuthType.js +84 -0
  73. package/dist/model/{SubmissionDataRequestEvent.js → SignatureRequestEvent.js} +66 -148
  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 +185 -339
  82. package/dist/model/SubmissionAction.js +29 -114
  83. package/dist/model/SubmissionActionState.js +69 -0
  84. package/dist/model/SubmissionActionType.js +84 -0
  85. package/dist/model/SubmissionBatch.js +73 -54
  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} +34 -41
  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 +309 -572
  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/TemplateFieldDependency.js +184 -0
  101. package/dist/model/TemplateFieldDependencyAction.js +64 -0
  102. package/dist/model/{CreateCombinedSubmissionResponse.js → TemplateFieldDependencyCondition.js} +50 -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} +33 -85
  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/{SubmissionBatchData.js → TemplateSourcePdf.js} +49 -49
  116. package/dist/model/TemplateSummary.js +560 -0
  117. package/dist/model/{SuccessMultipleErrorsResponse.js → TemplateSummaryList.js} +43 -55
  118. package/dist/model/TemplateType.js +59 -0
  119. package/dist/model/{Submission422Response.js → TemplateVersion.js} +59 -62
  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/{ErrorOrMultipleErrorsResponse.js → UpdateTemplateDocumentRequest.js} +43 -60
  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} +52 -57
  131. package/dist/model/UrlSourcePdf.js +130 -0
  132. package/dist/model/Webhook.js +57 -72
  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/CombinedSubmission.js +0 -308
  138. package/dist/model/CombinedSubmissionAction.js +0 -268
  139. package/dist/model/CreateCustomFileResponse.js +0 -155
  140. package/dist/model/CreateHtmlTemplate.js +0 -108
  141. package/dist/model/CreatePdfTemplate.js +0 -108
  142. package/dist/model/CreateSubmissionDataRequestData.js +0 -314
  143. package/dist/model/CreateSubmissionDataRequestEventResponse.js +0 -155
  144. package/dist/model/CreateSubmissionDataRequestResponse.js +0 -155
  145. package/dist/model/CreateSubmissionDataRequestTokenResponse.js +0 -155
  146. package/dist/model/CreateWebhookData.js +0 -108
  147. package/dist/model/JsonSchema.js +0 -205
  148. package/dist/model/SubmissionBatchWithSubmissions.js +0 -228
  149. package/dist/model/SubmissionDataRequest.js +0 -496
  150. package/dist/model/SubmissionPreview.js +0 -504
  151. package/dist/model/TemplateAddFieldsResponse.js +0 -156
  152. package/dist/model/TemplateDeleteResponse.js +0 -168
  153. package/dist/model/TemplatePreview.js +0 -796
  154. package/dist/model/TemplatePublishVersionResponse.js +0 -154
  155. package/dist/model/UpdateHtmlTemplate.js +0 -108
  156. package/dist/model/UpdateSubmissionDataRequestData.js +0 -311
  157. package/dist/model/UpdateWebhookData.js +0 -108
@@ -5,55 +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 _JsonSchema = _interopRequireDefault(require("../model/JsonSchema"));
30
- var _ListSubmissionsResponse = _interopRequireDefault(require("../model/ListSubmissionsResponse"));
31
- var _MoveFolderData = _interopRequireDefault(require("../model/MoveFolderData"));
32
- var _MoveTemplateData = _interopRequireDefault(require("../model/MoveTemplateData"));
33
- var _MultipleErrorsResponse = _interopRequireDefault(require("../model/MultipleErrorsResponse"));
34
- var _PublishVersionData = _interopRequireDefault(require("../model/PublishVersionData"));
35
- var _RenameFolderData = _interopRequireDefault(require("../model/RenameFolderData"));
36
- 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"));
37
39
  var _Submission = _interopRequireDefault(require("../model/Submission"));
38
- var _Submission422Response = _interopRequireDefault(require("../model/Submission422Response"));
39
- var _SubmissionBatchData = _interopRequireDefault(require("../model/SubmissionBatchData"));
40
- var _SubmissionBatchWithSubmissions = _interopRequireDefault(require("../model/SubmissionBatchWithSubmissions"));
41
- var _SubmissionDataRequestShow = _interopRequireDefault(require("../model/SubmissionDataRequestShow"));
42
- var _SubmissionPreview = _interopRequireDefault(require("../model/SubmissionPreview"));
43
- var _SuccessErrorResponse = _interopRequireDefault(require("../model/SuccessErrorResponse"));
44
- var _SuccessMultipleErrorsResponse = _interopRequireDefault(require("../model/SuccessMultipleErrorsResponse"));
40
+ var _SubmissionBatch = _interopRequireDefault(require("../model/SubmissionBatch"));
41
+ var _SubmissionList = _interopRequireDefault(require("../model/SubmissionList"));
45
42
  var _Template = _interopRequireDefault(require("../model/Template"));
46
- var _TemplateAddFieldsResponse = _interopRequireDefault(require("../model/TemplateAddFieldsResponse"));
47
- var _TemplateDeleteResponse = _interopRequireDefault(require("../model/TemplateDeleteResponse"));
48
- var _TemplateModelCodeResponse = _interopRequireDefault(require("../model/TemplateModelCodeResponse"));
49
- var _TemplatePreview = _interopRequireDefault(require("../model/TemplatePreview"));
50
- var _TemplatePublishVersionResponse = _interopRequireDefault(require("../model/TemplatePublishVersionResponse"));
51
- var _UpdateHtmlTemplate = _interopRequireDefault(require("../model/UpdateHtmlTemplate"));
52
- var _UpdatePdfTemplate = _interopRequireDefault(require("../model/UpdatePdfTemplate"));
53
- var _UpdateSubmissionDataRequestData = _interopRequireDefault(require("../model/UpdateSubmissionDataRequestData"));
54
- var _UpdateWebhookData = _interopRequireDefault(require("../model/UpdateWebhookData"));
55
- 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"));
56
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"));
57
55
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
58
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); }
59
57
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -64,7 +62,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
64
62
  * DocSpring API
65
63
  * Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
66
64
  *
67
- * The version of the OpenAPI document: v1
65
+ * The version of the OpenAPI document: v2
68
66
  *
69
67
  *
70
68
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -75,7 +73,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
75
73
  /**
76
74
  * Client service.
77
75
  * @module api/Client
78
- * @version 3.2.0
76
+ * @version 4.0.0
79
77
  */
80
78
  var Client = exports["default"] = /*#__PURE__*/function () {
81
79
  /**
@@ -92,13 +90,23 @@ var Client = exports["default"] = /*#__PURE__*/function () {
92
90
  if (options && options.constructor && options.constructor.name === 'ApiClient') {
93
91
  this.apiClient = options;
94
92
  } else {
95
- var _env$DOCSPRING_TOKEN_, _env$DOCSPRING_TOKEN_2;
96
- 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);
97
99
  var env = typeof process !== 'undefined' && process.env ? process.env : {};
98
- var apiTokenId = options.apiTokenId !== undefined ? options.apiTokenId : (_env$DOCSPRING_TOKEN_ = env.DOCSPRING_TOKEN_ID) !== null && _env$DOCSPRING_TOKEN_ !== void 0 ? _env$DOCSPRING_TOKEN_ : null;
99
- 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;
100
- 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) {
101
107
  apiClient.authentications['api_token_basic'].username = apiTokenId;
108
+ }
109
+ if (apiTokenSecret != null) {
102
110
  apiClient.authentications['api_token_basic'].password = apiTokenSecret;
103
111
  }
104
112
 
@@ -113,7 +121,8 @@ var Client = exports["default"] = /*#__PURE__*/function () {
113
121
  var url = String(host).trim();
114
122
  if (!/^https?:\/\//i.test(url)) url = "https://".concat(url);
115
123
  url = url.replace(/\/+$/, '');
116
- 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");
117
126
  apiClient.basePath = url;
118
127
  }
119
128
  this.apiClient = apiClient;
@@ -121,32 +130,21 @@ var Client = exports["default"] = /*#__PURE__*/function () {
121
130
  }
122
131
 
123
132
  /**
124
- * Callback function to receive the result of the addFieldsToTemplate operation.
125
- * @callback module:api/Client~addFieldsToTemplateCallback
126
- * @param {String} error Error message, if any.
127
- * @param {module:model/TemplateAddFieldsResponse} data The data returned by the service call.
128
- * @param {String} response The complete HTTP response.
129
- */
130
-
131
- /**
132
- * Add new fields to a Template
133
- * Adds fields to a PDF template. Configure field types, positions, defaults, and formatting options.
134
- * @param {String} template_id
135
- * @param {module:model/AddFieldsData} data
136
- * @param {module:api/Client~addFieldsToTemplateCallback} callback The callback function, accepting three arguments: error, data, response
137
- * 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
138
139
  */
139
140
  return _createClass(Client, [{
140
- key: "addFieldsToTemplate",
141
- value: function addFieldsToTemplate(template_id, data, callback) {
142
- var postBody = data;
141
+ key: "copyTemplateWithHttpInfo",
142
+ value: function copyTemplateWithHttpInfo(template_id, opts) {
143
+ opts = opts || {};
144
+ var postBody = opts['body'];
143
145
  // verify the required parameter 'template_id' is set
144
146
  if (template_id === undefined || template_id === null) {
145
- throw new Error("Missing the required parameter 'template_id' when calling addFieldsToTemplate");
146
- }
147
- // verify the required parameter 'data' is set
148
- if (data === undefined || data === null) {
149
- throw new Error("Missing the required parameter 'data' when calling addFieldsToTemplate");
147
+ throw new Error("Missing the required parameter 'template_id' when calling copyTemplate");
150
148
  }
151
149
  var pathParams = {
152
150
  'template_id': template_id
@@ -157,35 +155,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
157
155
  var authNames = ['api_token_basic'];
158
156
  var contentTypes = ['application/json'];
159
157
  var accepts = ['application/json'];
160
- var returnType = _TemplateAddFieldsResponse["default"];
161
- 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);
162
160
  }
163
161
 
164
162
  /**
165
- * Callback function to receive the result of the batchGeneratePdfs operation.
166
- * @callback module:api/Client~batchGeneratePdfsCallback
167
- * @param {String} error Error message, if any.
168
- * @param {module:model/BatchGeneratePdfs201Response} data The data returned by the service call.
169
- * @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}
170
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
+ }
171
177
 
172
178
  /**
173
- * Generate multiple PDFs
174
- * 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. See also: - [Batch Generate PDFs](https://docspring.com/docs/api-guide/generate-pdfs/batch-generate-pdfs/) - Request format, responses, and limits
175
- * @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.
176
182
  * @param {Object} opts Optional parameters
177
- * @param {Boolean} [wait = true)] Wait for submission batch to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
178
- * @param {module:api/Client~batchGeneratePdfsCallback} callback The callback function, accepting three arguments: error, data, response
179
- * 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
180
185
  */
181
186
  }, {
182
- key: "batchGeneratePdfs",
183
- value: function batchGeneratePdfs(data, opts, callback) {
187
+ key: "createCombinedPdfWithHttpInfo",
188
+ value: function createCombinedPdfWithHttpInfo(body, opts) {
184
189
  opts = opts || {};
185
- var postBody = data;
186
- // verify the required parameter 'data' is set
187
- if (data === undefined || data === null) {
188
- 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");
189
194
  }
190
195
  var pathParams = {};
191
196
  var queryParams = {
@@ -196,32 +201,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
196
201
  var authNames = ['api_token_basic'];
197
202
  var contentTypes = ['application/json'];
198
203
  var accepts = ['application/json'];
199
- var returnType = _BatchGeneratePdfs201Response["default"];
200
- 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);
201
206
  }
202
207
 
203
208
  /**
204
- * Callback function to receive the result of the combinePdfs operation.
205
- * @callback module:api/Client~combinePdfsCallback
206
- * @param {String} error Error message, if any.
207
- * @param {module:model/CreateCombinedSubmissionResponse} data The data returned by the service call.
208
- * @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}
209
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
+ }
210
223
 
211
224
  /**
212
- * Merge submission PDFs, template PDFs, or custom files
213
- * 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.
214
- * @param {module:model/CombinePdfsData} data
215
- * @param {module:api/Client~combinePdfsCallback} callback The callback function, accepting three arguments: error, data, response
216
- * 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
217
229
  */
218
230
  }, {
219
- key: "combinePdfs",
220
- value: function combinePdfs(data, callback) {
221
- var postBody = data;
222
- // verify the required parameter 'data' is set
223
- if (data === undefined || data === null) {
224
- 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");
225
237
  }
226
238
  var pathParams = {};
227
239
  var queryParams = {};
@@ -230,113 +242,129 @@ var Client = exports["default"] = /*#__PURE__*/function () {
230
242
  var authNames = ['api_token_basic'];
231
243
  var contentTypes = ['application/json'];
232
244
  var accepts = ['application/json'];
233
- var returnType = _CreateCombinedSubmissionResponse["default"];
234
- 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);
235
247
  }
236
248
 
237
249
  /**
238
- * Callback function to receive the result of the copyTemplate operation.
239
- * @callback module:api/Client~copyTemplateCallback
240
- * @param {String} error Error message, if any.
241
- * @param {module:model/TemplatePreview} data The data returned by the service call.
242
- * @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}
243
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
+ }
244
262
 
245
263
  /**
246
- * Copy a template
247
- * 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.
248
- * @param {String} template_id
249
- * @param {Object} opts Optional parameters
250
- * @param {module:model/CopyTemplateOptions} [options]
251
- * @param {module:api/Client~copyTemplateCallback} callback The callback function, accepting three arguments: error, data, response
252
- * 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
253
268
  */
254
269
  }, {
255
- key: "copyTemplate",
256
- value: function copyTemplate(template_id, opts, callback) {
257
- opts = opts || {};
258
- var postBody = opts['options'];
259
- // verify the required parameter 'template_id' is set
260
- if (template_id === undefined || template_id === null) {
261
- 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");
262
276
  }
263
- var pathParams = {
264
- 'template_id': template_id
265
- };
277
+ var pathParams = {};
266
278
  var queryParams = {};
267
279
  var headerParams = {};
268
280
  var formParams = {};
269
281
  var authNames = ['api_token_basic'];
270
282
  var contentTypes = ['application/json'];
271
283
  var accepts = ['application/json'];
272
- var returnType = _TemplatePreview["default"];
273
- 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);
274
286
  }
275
287
 
276
288
  /**
277
- * Callback function to receive the result of the createCustomFileFromUpload operation.
278
- * @callback module:api/Client~createCustomFileFromUploadCallback
279
- * @param {String} error Error message, if any.
280
- * @param {module:model/CreateCustomFileResponse} data The data returned by the service call.
281
- * @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}
282
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
+ }
283
301
 
284
302
  /**
285
- * Create a new custom file from a cached S3 upload
286
- * 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.
287
- * @param {module:model/CreateCustomFileData} data
288
- * @param {module:api/Client~createCustomFileFromUploadCallback} callback The callback function, accepting three arguments: error, data, response
289
- * 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
290
308
  */
291
309
  }, {
292
- key: "createCustomFileFromUpload",
293
- value: function createCustomFileFromUpload(data, callback) {
294
- var postBody = data;
295
- // verify the required parameter 'data' is set
296
- if (data === undefined || data === null) {
297
- 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");
298
316
  }
299
- 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
+ };
300
324
  var queryParams = {};
301
325
  var headerParams = {};
302
326
  var formParams = {};
303
327
  var authNames = ['api_token_basic'];
304
328
  var contentTypes = ['application/json'];
305
329
  var accepts = ['application/json'];
306
- var returnType = _CreateCustomFileResponse["default"];
307
- 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);
308
332
  }
309
333
 
310
334
  /**
311
- * Callback function to receive the result of the createDataRequestEvent operation.
312
- * @callback module:api/Client~createDataRequestEventCallback
313
- * @param {String} error Error message, if any.
314
- * @param {module:model/CreateSubmissionDataRequestEventResponse} data The data returned by the service call.
315
- * @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}
316
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
+ }
317
348
 
318
349
  /**
319
- * Create a new event for emailing a signee a request for signature
320
- * 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
321
- * @param {String} data_request_id
322
- * @param {module:model/CreateSubmissionDataRequestEventRequest} event
323
- * @param {module:api/Client~createDataRequestEventCallback} callback The callback function, accepting three arguments: error, data, response
324
- * 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
325
356
  */
326
357
  }, {
327
- key: "createDataRequestEvent",
328
- value: function createDataRequestEvent(data_request_id, event, callback) {
329
- var postBody = event;
330
- // verify the required parameter 'data_request_id' is set
331
- if (data_request_id === undefined || data_request_id === null) {
332
- throw new Error("Missing the required parameter 'data_request_id' when calling createDataRequestEvent");
333
- }
334
- // verify the required parameter 'event' is set
335
- if (event === undefined || event === null) {
336
- 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");
337
365
  }
338
366
  var pathParams = {
339
- 'data_request_id': data_request_id
367
+ 'signature_request_id': signature_request_id
340
368
  };
341
369
  var queryParams = {};
342
370
  var headerParams = {};
@@ -344,192 +372,188 @@ var Client = exports["default"] = /*#__PURE__*/function () {
344
372
  var authNames = ['api_token_basic'];
345
373
  var contentTypes = ['application/json'];
346
374
  var accepts = ['application/json'];
347
- var returnType = _CreateSubmissionDataRequestEventResponse["default"];
348
- 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);
349
377
  }
350
378
 
351
379
  /**
352
- * Callback function to receive the result of the createDataRequestToken operation.
353
- * @callback module:api/Client~createDataRequestTokenCallback
354
- * @param {String} error Error message, if any.
355
- * @param {module:model/CreateSubmissionDataRequestTokenResponse} data The data returned by the service call.
356
- * @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}
357
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
+ }
358
394
 
359
395
  /**
360
- * Create a new data request token for form authentication
361
- * 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/)
362
- * @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.
363
400
  * @param {Object} opts Optional parameters
364
- * @param {module:model/String} [type]
365
- * @param {module:api/Client~createDataRequestTokenCallback} callback The callback function, accepting three arguments: error, data, response
366
- * 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
367
404
  */
368
405
  }, {
369
- key: "createDataRequestToken",
370
- value: function createDataRequestToken(data_request_id, opts, callback) {
406
+ key: "createSubmissionWithHttpInfo",
407
+ value: function createSubmissionWithHttpInfo(template_id, body, opts) {
371
408
  opts = opts || {};
372
- var postBody = null;
373
- // verify the required parameter 'data_request_id' is set
374
- if (data_request_id === undefined || data_request_id === null) {
375
- 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");
376
417
  }
377
418
  var pathParams = {
378
- 'data_request_id': data_request_id
419
+ 'template_id': template_id
379
420
  };
380
421
  var queryParams = {
381
- 'type': opts['type']
422
+ 'version': opts['version'],
423
+ 'wait': opts['wait']
382
424
  };
383
425
  var headerParams = {};
384
426
  var formParams = {};
385
427
  var authNames = ['api_token_basic'];
386
- var contentTypes = [];
428
+ var contentTypes = ['application/json'];
387
429
  var accepts = ['application/json'];
388
- var returnType = _CreateSubmissionDataRequestTokenResponse["default"];
389
- 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);
390
432
  }
391
433
 
392
434
  /**
393
- * Callback function to receive the result of the createFolder operation.
394
- * @callback module:api/Client~createFolderCallback
395
- * @param {String} error Error message, if any.
396
- * @param {module:model/Folder} data The data returned by the service call.
397
- * @param {String} response The complete HTTP response.
398
- */
399
-
400
- /**
401
- * Create a folder
402
- * 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.
403
- * @param {module:model/CreateFolderData} data
404
- * @param {module:api/Client~createFolderCallback} callback The callback function, accepting three arguments: error, data, response
405
- * 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}
406
443
  */
407
444
  }, {
408
- key: "createFolder",
409
- value: function createFolder(data, callback) {
410
- var postBody = data;
411
- // verify the required parameter 'data' is set
412
- if (data === undefined || data === null) {
413
- throw new Error("Missing the required parameter 'data' when calling createFolder");
414
- }
415
- var pathParams = {};
416
- var queryParams = {};
417
- var headerParams = {};
418
- var formParams = {};
419
- var authNames = ['api_token_basic'];
420
- var contentTypes = ['application/json'];
421
- var accepts = ['application/json'];
422
- var returnType = _Folder["default"];
423
- 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
+ });
424
450
  }
425
451
 
426
452
  /**
427
- * Callback function to receive the result of the createHtmlTemplate operation.
428
- * @callback module:api/Client~createHtmlTemplateCallback
429
- * @param {String} error Error message, if any.
430
- * @param {module:model/TemplatePreview} data The data returned by the service call.
431
- * @param {String} response The complete HTTP response.
432
- */
433
-
434
- /**
435
- * Create a new HTML template
436
- * 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.
437
- * @param {module:model/CreateHtmlTemplate} data
438
- * @param {module:api/Client~createHtmlTemplateCallback} callback The callback function, accepting three arguments: error, data, response
439
- * 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
440
459
  */
441
460
  }, {
442
- key: "createHtmlTemplate",
443
- value: function createHtmlTemplate(data, callback) {
444
- var postBody = data;
445
- // verify the required parameter 'data' is set
446
- if (data === undefined || data === null) {
447
- 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");
448
468
  }
449
469
  var pathParams = {};
450
- var queryParams = {};
470
+ var queryParams = {
471
+ 'wait': opts['wait']
472
+ };
451
473
  var headerParams = {};
452
474
  var formParams = {};
453
475
  var authNames = ['api_token_basic'];
454
476
  var contentTypes = ['application/json'];
455
477
  var accepts = ['application/json'];
456
- var returnType = _TemplatePreview["default"];
457
- 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);
458
480
  }
459
481
 
460
482
  /**
461
- * Callback function to receive the result of the createPdfTemplate operation.
462
- * @callback module:api/Client~createPdfTemplateCallback
463
- * @param {String} error Error message, if any.
464
- * @param {module:model/TemplatePreview} data The data returned by the service call.
465
- * @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}
466
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
+ }
467
497
 
468
498
  /**
469
- * Create a new PDF template with a form POST file upload
470
- * 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.
471
- * @param {File} template_document
472
- * @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.
473
502
  * @param {Object} opts Optional parameters
474
- * @param {Boolean} [wait = true)] Wait for template document to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
475
- * @param {String} [template_description]
476
- * @param {String} [template_parent_folder_id]
477
- * @param {module:api/Client~createPdfTemplateCallback} callback The callback function, accepting three arguments: error, data, response
478
- * 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
479
505
  */
480
506
  }, {
481
- key: "createPdfTemplate",
482
- value: function createPdfTemplate(template_document, template_name, opts, callback) {
507
+ key: "createTemplateWithHttpInfo",
508
+ value: function createTemplateWithHttpInfo(body, opts) {
483
509
  opts = opts || {};
484
- var postBody = null;
485
- // verify the required parameter 'template_document' is set
486
- if (template_document === undefined || template_document === null) {
487
- throw new Error("Missing the required parameter 'template_document' when calling createPdfTemplate");
488
- }
489
- // verify the required parameter 'template_name' is set
490
- if (template_name === undefined || template_name === null) {
491
- 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");
492
514
  }
493
515
  var pathParams = {};
494
516
  var queryParams = {
495
517
  'wait': opts['wait']
496
518
  };
497
519
  var headerParams = {};
498
- var formParams = {
499
- 'template[document]': template_document,
500
- 'template[name]': template_name,
501
- 'template[description]': opts['template_description'],
502
- 'template[parent_folder_id]': opts['template_parent_folder_id']
503
- };
520
+ var formParams = {};
504
521
  var authNames = ['api_token_basic'];
505
- var contentTypes = ['multipart/form-data'];
522
+ var contentTypes = ['application/json'];
506
523
  var accepts = ['application/json'];
507
- var returnType = _TemplatePreview["default"];
508
- 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);
509
526
  }
510
527
 
511
528
  /**
512
- * Callback function to receive the result of the createPdfTemplateFromUpload operation.
513
- * @callback module:api/Client~createPdfTemplateFromUploadCallback
514
- * @param {String} error Error message, if any.
515
- * @param {module:model/TemplatePreview} data The data returned by the service call.
516
- * @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}
517
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
+ }
518
543
 
519
544
  /**
520
- * Create a new PDF template from a cached S3 file upload
521
- * 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.
522
- * @param {module:model/CreatePdfTemplate} data
523
- * @param {module:api/Client~createPdfTemplateFromUploadCallback} callback The callback function, accepting three arguments: error, data, response
524
- * 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
525
549
  */
526
550
  }, {
527
- key: "createPdfTemplateFromUpload",
528
- value: function createPdfTemplateFromUpload(data, callback) {
529
- var postBody = data;
530
- // verify the required parameter 'data' is set
531
- if (data === undefined || data === null) {
532
- 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");
533
557
  }
534
558
  var pathParams = {};
535
559
  var queryParams = {};
@@ -538,62 +562,74 @@ var Client = exports["default"] = /*#__PURE__*/function () {
538
562
  var authNames = ['api_token_basic'];
539
563
  var contentTypes = ['application/json'];
540
564
  var accepts = ['application/json'];
541
- var returnType = _TemplatePreview["default"];
542
- 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);
543
567
  }
544
568
 
545
569
  /**
546
- * Callback function to receive the result of the createWebhook operation.
547
- * @callback module:api/Client~createWebhookCallback
548
- * @param {String} error Error message, if any.
549
- * @param {module:model/Webhook} data The data returned by the service call.
550
- * @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}
551
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
+ }
552
582
 
553
583
  /**
554
- * Create a webhook
555
- * 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.
556
- * @param {module:model/CreateWebhookData} data
557
- * @param {module:api/Client~createWebhookCallback} callback The callback function, accepting three arguments: error, data, response
558
- * 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
559
588
  */
560
589
  }, {
561
- key: "createWebhook",
562
- value: function createWebhook(data, callback) {
563
- var postBody = data;
564
- // verify the required parameter 'data' is set
565
- if (data === undefined || data === null) {
566
- 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");
567
596
  }
568
- var pathParams = {};
597
+ var pathParams = {
598
+ 'custom_file_id': custom_file_id
599
+ };
569
600
  var queryParams = {};
570
601
  var headerParams = {};
571
602
  var formParams = {};
572
603
  var authNames = ['api_token_basic'];
573
- var contentTypes = ['application/json'];
604
+ var contentTypes = [];
574
605
  var accepts = ['application/json'];
575
- var returnType = _Webhook["default"];
576
- 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);
577
608
  }
578
609
 
579
610
  /**
580
- * Callback function to receive the result of the deleteFolder operation.
581
- * @callback module:api/Client~deleteFolderCallback
582
- * @param {String} error Error message, if any.
583
- * @param {module:model/Folder} data The data returned by the service call.
584
- * @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}
585
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
+ }
586
623
 
587
624
  /**
588
625
  * Delete a folder
589
- * Deletes an empty folder. The folder must not contain any templates or subfolders. Move or delete all contents before attempting to delete the folder.
590
- * @param {String} folder_id
591
- * @param {module:api/Client~deleteFolderCallback} callback The callback function, accepting three arguments: error, data, response
592
- * 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
593
629
  */
594
630
  }, {
595
- key: "deleteFolder",
596
- value: function deleteFolder(folder_id, callback) {
631
+ key: "deleteFolderWithHttpInfo",
632
+ value: function deleteFolderWithHttpInfo(folder_id) {
597
633
  var postBody = null;
598
634
  // verify the required parameter 'folder_id' is set
599
635
  if (folder_id === undefined || folder_id === null) {
@@ -609,29 +645,34 @@ var Client = exports["default"] = /*#__PURE__*/function () {
609
645
  var contentTypes = [];
610
646
  var accepts = ['application/json'];
611
647
  var returnType = _Folder["default"];
612
- 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);
613
649
  }
614
650
 
615
651
  /**
616
- * Callback function to receive the result of the deleteTemplate operation.
617
- * @callback module:api/Client~deleteTemplateCallback
618
- * @param {String} error Error message, if any.
619
- * @param {module:model/TemplateDeleteResponse} data The data returned by the service call.
620
- * @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}
621
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
+ }
622
664
 
623
665
  /**
624
666
  * Delete a template
625
- * 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.
626
- * @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.
627
669
  * @param {Object} opts Optional parameters
628
- * @param {String} [version]
629
- * @param {module:api/Client~deleteTemplateCallback} callback The callback function, accepting three arguments: error, data, response
630
- * 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
631
672
  */
632
673
  }, {
633
- key: "deleteTemplate",
634
- value: function deleteTemplate(template_id, opts, callback) {
674
+ key: "deleteTemplateWithHttpInfo",
675
+ value: function deleteTemplateWithHttpInfo(template_id, opts) {
635
676
  opts = opts || {};
636
677
  var postBody = null;
637
678
  // verify the required parameter 'template_id' is set
@@ -649,28 +690,35 @@ var Client = exports["default"] = /*#__PURE__*/function () {
649
690
  var authNames = ['api_token_basic'];
650
691
  var contentTypes = [];
651
692
  var accepts = ['application/json'];
652
- var returnType = _TemplateDeleteResponse["default"];
653
- 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);
654
695
  }
655
696
 
656
697
  /**
657
- * Callback function to receive the result of the deleteWebhook operation.
658
- * @callback module:api/Client~deleteWebhookCallback
659
- * @param {String} error Error message, if any.
660
- * @param {module:model/Webhook} data The data returned by the service call.
661
- * @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}
662
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
+ }
663
712
 
664
713
  /**
665
714
  * Delete a webhook
666
- * Permanently deletes a webhook so it stops receiving events, and returns the deleted webhook.
667
- * @param {String} webhook_id
668
- * @param {module:api/Client~deleteWebhookCallback} callback The callback function, accepting three arguments: error, data, response
669
- * 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
670
718
  */
671
719
  }, {
672
- key: "deleteWebhook",
673
- value: function deleteWebhook(webhook_id, callback) {
720
+ key: "deleteWebhookWithHttpInfo",
721
+ value: function deleteWebhookWithHttpInfo(webhook_id) {
674
722
  var postBody = null;
675
723
  // verify the required parameter 'webhook_id' is set
676
724
  if (webhook_id === undefined || webhook_id === null) {
@@ -686,34 +734,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
686
734
  var contentTypes = [];
687
735
  var accepts = ['application/json'];
688
736
  var returnType = _Webhook["default"];
689
- 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);
690
738
  }
691
739
 
692
740
  /**
693
- * Callback function to receive the result of the expireCombinedSubmission operation.
694
- * @callback module:api/Client~expireCombinedSubmissionCallback
695
- * @param {String} error Error message, if any.
696
- * @param {module:model/CombinedSubmission} data The data returned by the service call.
697
- * @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}
698
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
+ }
699
753
 
700
754
  /**
701
- * Expire a combined submission
702
- * Expiring a combined submission deletes the PDF from our system. This is useful for invalidating sensitive documents.
703
- * @param {String} combined_submission_id
704
- * @param {module:api/Client~expireCombinedSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
705
- * 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
706
759
  */
707
760
  }, {
708
- key: "expireCombinedSubmission",
709
- value: function expireCombinedSubmission(combined_submission_id, callback) {
761
+ key: "expireCombinedPdfWithHttpInfo",
762
+ value: function expireCombinedPdfWithHttpInfo(combined_pdf_id) {
710
763
  var postBody = null;
711
- // verify the required parameter 'combined_submission_id' is set
712
- if (combined_submission_id === undefined || combined_submission_id === null) {
713
- 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");
714
767
  }
715
768
  var pathParams = {
716
- 'combined_submission_id': combined_submission_id
769
+ 'combined_pdf_id': combined_pdf_id
717
770
  };
718
771
  var queryParams = {};
719
772
  var headerParams = {};
@@ -721,28 +774,33 @@ var Client = exports["default"] = /*#__PURE__*/function () {
721
774
  var authNames = ['api_token_basic'];
722
775
  var contentTypes = [];
723
776
  var accepts = ['application/json'];
724
- var returnType = _CombinedSubmission["default"];
725
- 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);
726
779
  }
727
780
 
728
781
  /**
729
- * Callback function to receive the result of the expireSubmission operation.
730
- * @callback module:api/Client~expireSubmissionCallback
731
- * @param {String} error Error message, if any.
732
- * @param {module:model/SubmissionPreview} data The data returned by the service call.
733
- * @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}
734
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
+ }
735
794
 
736
795
  /**
737
- * Expire a PDF submission
738
- * 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.
739
- * @param {String} submission_id
740
- * @param {module:api/Client~expireSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
741
- * 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
742
800
  */
743
801
  }, {
744
- key: "expireSubmission",
745
- value: function expireSubmission(submission_id, callback) {
802
+ key: "expireSubmissionWithHttpInfo",
803
+ value: function expireSubmissionWithHttpInfo(submission_id) {
746
804
  var postBody = null;
747
805
  // verify the required parameter 'submission_id' is set
748
806
  if (submission_id === undefined || submission_id === null) {
@@ -757,81 +815,81 @@ var Client = exports["default"] = /*#__PURE__*/function () {
757
815
  var authNames = ['api_token_basic'];
758
816
  var contentTypes = [];
759
817
  var accepts = ['application/json'];
760
- var returnType = _SubmissionPreview["default"];
761
- 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);
762
820
  }
763
821
 
764
822
  /**
765
- * Callback function to receive the result of the generatePdf operation.
766
- * @callback module:api/Client~generatePdfCallback
767
- * @param {String} error Error message, if any.
768
- * @param {module:model/CreateSubmissionResponse} data The data returned by the service call.
769
- * @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}
770
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
+ }
771
835
 
772
836
  /**
773
- * Generate a PDF
774
- * 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. 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
775
- * @param {String} template_id
776
- * @param {module:model/CreatePdfSubmissionData} submission
777
- * @param {Object} opts Optional parameters
778
- * @param {Boolean} [wait = true)] Wait for submission to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
779
- * @param {module:api/Client~generatePdfCallback} callback The callback function, accepting three arguments: error, data, response
780
- * 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
781
841
  */
782
842
  }, {
783
- key: "generatePdf",
784
- value: function generatePdf(template_id, submission, opts, callback) {
785
- opts = opts || {};
786
- var postBody = submission;
787
- // verify the required parameter 'template_id' is set
788
- if (template_id === undefined || template_id === null) {
789
- throw new Error("Missing the required parameter 'template_id' when calling generatePdf");
790
- }
791
- // verify the required parameter 'submission' is set
792
- if (submission === undefined || submission === null) {
793
- 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");
794
849
  }
795
850
  var pathParams = {
796
- 'template_id': template_id
797
- };
798
- var queryParams = {
799
- 'wait': opts['wait']
851
+ 'submission_id': submission_id
800
852
  };
853
+ var queryParams = {};
801
854
  var headerParams = {};
802
855
  var formParams = {};
803
856
  var authNames = ['api_token_basic'];
804
- var contentTypes = ['application/json'];
857
+ var contentTypes = [];
805
858
  var accepts = ['application/json'];
806
- var returnType = _CreateSubmissionResponse["default"];
807
- 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);
808
861
  }
809
862
 
810
863
  /**
811
- * Callback function to receive the result of the generatePreview operation.
812
- * @callback module:api/Client~generatePreviewCallback
813
- * @param {String} error Error message, if any.
814
- * @param {module:model/SuccessErrorResponse} data The data returned by the service call.
815
- * @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}
816
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
+ }
817
876
 
818
877
  /**
819
- * Generate a preview PDF for partially completed data requests
820
- * 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.
821
- * @param {String} submission_id
822
- * @param {module:api/Client~generatePreviewCallback} callback The callback function, accepting three arguments: error, data, response
823
- * 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
824
882
  */
825
883
  }, {
826
- key: "generatePreview",
827
- value: function generatePreview(submission_id, callback) {
884
+ key: "getCombinedPdfWithHttpInfo",
885
+ value: function getCombinedPdfWithHttpInfo(combined_pdf_id) {
828
886
  var postBody = null;
829
- // verify the required parameter 'submission_id' is set
830
- if (submission_id === undefined || submission_id === null) {
831
- 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");
832
890
  }
833
891
  var pathParams = {
834
- 'submission_id': submission_id
892
+ 'combined_pdf_id': combined_pdf_id
835
893
  };
836
894
  var queryParams = {};
837
895
  var headerParams = {};
@@ -839,35 +897,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
839
897
  var authNames = ['api_token_basic'];
840
898
  var contentTypes = [];
841
899
  var accepts = ['application/json'];
842
- var returnType = _SuccessErrorResponse["default"];
843
- 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);
844
902
  }
845
903
 
846
904
  /**
847
- * Callback function to receive the result of the getCombinedSubmission operation.
848
- * @callback module:api/Client~getCombinedSubmissionCallback
849
- * @param {String} error Error message, if any.
850
- * @param {module:model/CombinedSubmission} data The data returned by the service call.
851
- * @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}
852
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
+ }
853
917
 
854
918
  /**
855
- * Check the status of a combined submission (merged PDFs)
856
- * 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).
857
- * @param {String} combined_submission_id
858
- * @param {module:api/Client~getCombinedSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
859
- * 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
860
923
  */
861
924
  }, {
862
- key: "getCombinedSubmission",
863
- value: function getCombinedSubmission(combined_submission_id, callback) {
925
+ key: "getCustomFileWithHttpInfo",
926
+ value: function getCustomFileWithHttpInfo(custom_file_id) {
864
927
  var postBody = null;
865
- // verify the required parameter 'combined_submission_id' is set
866
- if (combined_submission_id === undefined || combined_submission_id === null) {
867
- 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");
868
931
  }
869
932
  var pathParams = {
870
- 'combined_submission_id': combined_submission_id
933
+ 'custom_file_id': custom_file_id
871
934
  };
872
935
  var queryParams = {};
873
936
  var headerParams = {};
@@ -875,35 +938,40 @@ var Client = exports["default"] = /*#__PURE__*/function () {
875
938
  var authNames = ['api_token_basic'];
876
939
  var contentTypes = [];
877
940
  var accepts = ['application/json'];
878
- var returnType = _CombinedSubmission["default"];
879
- 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);
880
943
  }
881
944
 
882
945
  /**
883
- * Callback function to receive the result of the getDataRequest operation.
884
- * @callback module:api/Client~getDataRequestCallback
885
- * @param {String} error Error message, if any.
886
- * @param {module:model/SubmissionDataRequestShow} data The data returned by the service call.
887
- * @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}
888
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
+ }
889
958
 
890
959
  /**
891
- * Look up a submission data request
892
- * 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
893
- * @param {String} data_request_id
894
- * @param {module:api/Client~getDataRequestCallback} callback The callback function, accepting three arguments: error, data, response
895
- * 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
896
964
  */
897
965
  }, {
898
- key: "getDataRequest",
899
- value: function getDataRequest(data_request_id, callback) {
966
+ key: "getFolderWithHttpInfo",
967
+ value: function getFolderWithHttpInfo(folder_id) {
900
968
  var postBody = null;
901
- // verify the required parameter 'data_request_id' is set
902
- if (data_request_id === undefined || data_request_id === null) {
903
- 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");
904
972
  }
905
973
  var pathParams = {
906
- 'data_request_id': data_request_id
974
+ 'folder_id': folder_id
907
975
  };
908
976
  var queryParams = {};
909
977
  var headerParams = {};
@@ -911,96 +979,107 @@ var Client = exports["default"] = /*#__PURE__*/function () {
911
979
  var authNames = ['api_token_basic'];
912
980
  var contentTypes = [];
913
981
  var accepts = ['application/json'];
914
- var returnType = _SubmissionDataRequestShow["default"];
915
- 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);
916
984
  }
917
985
 
918
986
  /**
919
- * Callback function to receive the result of the getFullTemplate operation.
920
- * @callback module:api/Client~getFullTemplateCallback
921
- * @param {String} error Error message, if any.
922
- * @param {module:model/Template} data The data returned by the service call.
923
- * @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}
924
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
+ }
925
999
 
926
1000
  /**
927
- * Fetch the full attributes for a PDF template
928
- * 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.
929
- * @param {String} template_id
930
- * @param {module:api/Client~getFullTemplateCallback} callback The callback function, accepting three arguments: error, data, response
931
- * 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
932
1004
  */
933
1005
  }, {
934
- key: "getFullTemplate",
935
- value: function getFullTemplate(template_id, callback) {
1006
+ key: "getPresignUrlWithHttpInfo",
1007
+ value: function getPresignUrlWithHttpInfo() {
936
1008
  var postBody = null;
937
- // verify the required parameter 'template_id' is set
938
- if (template_id === undefined || template_id === null) {
939
- throw new Error("Missing the required parameter 'template_id' when calling getFullTemplate");
940
- }
941
- var pathParams = {
942
- 'template_id': template_id
943
- };
1009
+ var pathParams = {};
944
1010
  var queryParams = {};
945
1011
  var headerParams = {};
946
1012
  var formParams = {};
947
1013
  var authNames = ['api_token_basic'];
948
1014
  var contentTypes = [];
949
1015
  var accepts = ['application/json'];
950
- var returnType = _Template["default"];
951
- 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);
952
1018
  }
953
1019
 
954
1020
  /**
955
- * Callback function to receive the result of the getPresignUrl operation.
956
- * @callback module:api/Client~getPresignUrlCallback
957
- * @param {String} error Error message, if any.
958
- * @param {module:model/UploadPresignResponse} data The data returned by the service call.
959
- * @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}
960
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
+ }
961
1032
 
962
1033
  /**
963
- * Get a presigned S3 URL for direct file upload
964
- * 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)
965
- * @param {module:api/Client~getPresignUrlCallback} callback The callback function, accepting three arguments: error, data, response
966
- * 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
967
1038
  */
968
1039
  }, {
969
- key: "getPresignUrl",
970
- value: function getPresignUrl(callback) {
1040
+ key: "getSignatureRequestWithHttpInfo",
1041
+ value: function getSignatureRequestWithHttpInfo(signature_request_id) {
971
1042
  var postBody = null;
972
- 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
+ };
973
1050
  var queryParams = {};
974
1051
  var headerParams = {};
975
1052
  var formParams = {};
976
1053
  var authNames = ['api_token_basic'];
977
1054
  var contentTypes = [];
978
1055
  var accepts = ['application/json'];
979
- var returnType = _UploadPresignResponse["default"];
980
- 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);
981
1058
  }
982
1059
 
983
1060
  /**
984
- * Callback function to receive the result of the getSubmission operation.
985
- * @callback module:api/Client~getSubmissionCallback
986
- * @param {String} error Error message, if any.
987
- * @param {module:model/Submission} data The data returned by the service call.
988
- * @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}
989
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
+ }
990
1073
 
991
1074
  /**
992
- * Check the status of a PDF
993
- * 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.
994
- * @param {String} submission_id
995
- * @param {Object} opts Optional parameters
996
- * @param {Boolean} [include_data]
997
- * @param {module:api/Client~getSubmissionCallback} callback The callback function, accepting three arguments: error, data, response
998
- * 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
999
1079
  */
1000
1080
  }, {
1001
- key: "getSubmission",
1002
- value: function getSubmission(submission_id, opts, callback) {
1003
- opts = opts || {};
1081
+ key: "getSubmissionWithHttpInfo",
1082
+ value: function getSubmissionWithHttpInfo(submission_id) {
1004
1083
  var postBody = null;
1005
1084
  // verify the required parameter 'submission_id' is set
1006
1085
  if (submission_id === undefined || submission_id === null) {
@@ -1009,38 +1088,41 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1009
1088
  var pathParams = {
1010
1089
  'submission_id': submission_id
1011
1090
  };
1012
- var queryParams = {
1013
- 'include_data': opts['include_data']
1014
- };
1091
+ var queryParams = {};
1015
1092
  var headerParams = {};
1016
1093
  var formParams = {};
1017
1094
  var authNames = ['api_token_basic'];
1018
1095
  var contentTypes = [];
1019
1096
  var accepts = ['application/json'];
1020
1097
  var returnType = _Submission["default"];
1021
- 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);
1022
1099
  }
1023
1100
 
1024
1101
  /**
1025
- * Callback function to receive the result of the getSubmissionBatch operation.
1026
- * @callback module:api/Client~getSubmissionBatchCallback
1027
- * @param {String} error Error message, if any.
1028
- * @param {module:model/SubmissionBatchWithSubmissions} data The data returned by the service call.
1029
- * @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}
1030
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
+ }
1031
1114
 
1032
1115
  /**
1033
- * Check the status of a submission batch job
1034
- * 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.
1035
- * @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.
1036
1119
  * @param {Object} opts Optional parameters
1037
- * @param {Boolean} [include_submissions]
1038
- * @param {module:api/Client~getSubmissionBatchCallback} callback The callback function, accepting three arguments: error, data, response
1039
- * 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
1040
1122
  */
1041
1123
  }, {
1042
- key: "getSubmissionBatch",
1043
- value: function getSubmissionBatch(submission_batch_id, opts, callback) {
1124
+ key: "getSubmissionBatchWithHttpInfo",
1125
+ value: function getSubmissionBatchWithHttpInfo(submission_batch_id, opts) {
1044
1126
  opts = opts || {};
1045
1127
  var postBody = null;
1046
1128
  // verify the required parameter 'submission_batch_id' is set
@@ -1051,35 +1133,45 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1051
1133
  'submission_batch_id': submission_batch_id
1052
1134
  };
1053
1135
  var queryParams = {
1054
- 'include_submissions': opts['include_submissions']
1136
+ 'include_data': opts['include_data']
1055
1137
  };
1056
1138
  var headerParams = {};
1057
1139
  var formParams = {};
1058
1140
  var authNames = ['api_token_basic'];
1059
1141
  var contentTypes = [];
1060
1142
  var accepts = ['application/json'];
1061
- var returnType = _SubmissionBatchWithSubmissions["default"];
1062
- 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);
1063
1145
  }
1064
1146
 
1065
1147
  /**
1066
- * Callback function to receive the result of the getTemplate operation.
1067
- * @callback module:api/Client~getTemplateCallback
1068
- * @param {String} error Error message, if any.
1069
- * @param {module:model/TemplatePreview} data The data returned by the service call.
1070
- * @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}
1071
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
+ }
1072
1162
 
1073
1163
  /**
1074
- * Check the status of an uploaded template
1075
- * 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.
1076
- * @param {String} template_id
1077
- * @param {module:api/Client~getTemplateCallback} callback The callback function, accepting three arguments: error, data, response
1078
- * 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
1079
1170
  */
1080
1171
  }, {
1081
- key: "getTemplate",
1082
- value: function getTemplate(template_id, callback) {
1172
+ key: "getTemplateWithHttpInfo",
1173
+ value: function getTemplateWithHttpInfo(template_id, opts) {
1174
+ opts = opts || {};
1083
1175
  var postBody = null;
1084
1176
  // verify the required parameter 'template_id' is set
1085
1177
  if (template_id === undefined || template_id === null) {
@@ -1088,35 +1180,47 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1088
1180
  var pathParams = {
1089
1181
  'template_id': template_id
1090
1182
  };
1091
- var queryParams = {};
1183
+ var queryParams = {
1184
+ 'version': opts['version']
1185
+ };
1092
1186
  var headerParams = {};
1093
1187
  var formParams = {};
1094
1188
  var authNames = ['api_token_basic'];
1095
1189
  var contentTypes = [];
1096
1190
  var accepts = ['application/json'];
1097
- var returnType = _TemplatePreview["default"];
1098
- 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);
1099
1193
  }
1100
1194
 
1101
1195
  /**
1102
- * Callback function to receive the result of the getTemplateModelCode operation.
1103
- * @callback module:api/Client~getTemplateModelCodeCallback
1104
- * @param {String} error Error message, if any.
1105
- * @param {module:model/TemplateModelCodeResponse} data The data returned by the service call.
1106
- * @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}
1107
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
+ }
1108
1210
 
1109
1211
  /**
1110
- * Generate typed model code for a template
1111
- * 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
1112
- * @param {String} template_id
1113
- * @param {module:model/String} lang The language to generate code for
1114
- * @param {module:api/Client~getTemplateModelCodeCallback} callback The callback function, accepting three arguments: error, data, response
1115
- * 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
1116
1219
  */
1117
1220
  }, {
1118
- key: "getTemplateModelCode",
1119
- value: function getTemplateModelCode(template_id, lang, callback) {
1221
+ key: "getTemplateModelCodeWithHttpInfo",
1222
+ value: function getTemplateModelCodeWithHttpInfo(template_id, lang, opts) {
1223
+ opts = opts || {};
1120
1224
  var postBody = null;
1121
1225
  // verify the required parameter 'template_id' is set
1122
1226
  if (template_id === undefined || template_id === null) {
@@ -1130,6 +1234,7 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1130
1234
  'template_id': template_id
1131
1235
  };
1132
1236
  var queryParams = {
1237
+ 'version': opts['version'],
1133
1238
  'lang': lang
1134
1239
  };
1135
1240
  var headerParams = {};
@@ -1137,28 +1242,39 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1137
1242
  var authNames = ['api_token_basic'];
1138
1243
  var contentTypes = [];
1139
1244
  var accepts = ['application/json'];
1140
- var returnType = _TemplateModelCodeResponse["default"];
1141
- 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);
1142
1247
  }
1143
1248
 
1144
1249
  /**
1145
- * Callback function to receive the result of the getTemplateSchema operation.
1146
- * @callback module:api/Client~getTemplateSchemaCallback
1147
- * @param {String} error Error message, if any.
1148
- * @param {module:model/JsonSchema} data The data returned by the service call.
1149
- * @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}
1150
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
+ }
1151
1265
 
1152
1266
  /**
1153
- * Fetch the JSON schema for a template
1154
- * 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
1155
- * @param {String} template_id
1156
- * @param {module:api/Client~getTemplateSchemaCallback} callback The callback function, accepting three arguments: error, data, response
1157
- * 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
1158
1273
  */
1159
1274
  }, {
1160
- key: "getTemplateSchema",
1161
- value: function getTemplateSchema(template_id, callback) {
1275
+ key: "getTemplateSchemaWithHttpInfo",
1276
+ value: function getTemplateSchemaWithHttpInfo(template_id, opts) {
1277
+ opts = opts || {};
1162
1278
  var postBody = null;
1163
1279
  // verify the required parameter 'template_id' is set
1164
1280
  if (template_id === undefined || template_id === null) {
@@ -1167,34 +1283,45 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1167
1283
  var pathParams = {
1168
1284
  'template_id': template_id
1169
1285
  };
1170
- var queryParams = {};
1286
+ var queryParams = {
1287
+ 'version': opts['version']
1288
+ };
1171
1289
  var headerParams = {};
1172
1290
  var formParams = {};
1173
1291
  var authNames = ['api_token_basic'];
1174
1292
  var contentTypes = [];
1175
1293
  var accepts = ['application/json'];
1176
- var returnType = _JsonSchema["default"];
1177
- 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);
1178
1298
  }
1179
1299
 
1180
1300
  /**
1181
- * Callback function to receive the result of the getWebhook operation.
1182
- * @callback module:api/Client~getWebhookCallback
1183
- * @param {String} error Error message, if any.
1184
- * @param {module:model/Webhook} data The data returned by the service call.
1185
- * @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}>}
1186
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
+ }
1187
1315
 
1188
1316
  /**
1189
1317
  * Get a webhook
1190
- * Retrieves a single webhook by its ID.
1191
- * @param {String} webhook_id
1192
- * @param {module:api/Client~getWebhookCallback} callback The callback function, accepting three arguments: error, data, response
1193
- * 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
1194
1321
  */
1195
1322
  }, {
1196
- key: "getWebhook",
1197
- value: function getWebhook(webhook_id, callback) {
1323
+ key: "getWebhookWithHttpInfo",
1324
+ value: function getWebhookWithHttpInfo(webhook_id) {
1198
1325
  var postBody = null;
1199
1326
  // verify the required parameter 'webhook_id' is set
1200
1327
  if (webhook_id === undefined || webhook_id === null) {
@@ -1210,148 +1337,229 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1210
1337
  var contentTypes = [];
1211
1338
  var accepts = ['application/json'];
1212
1339
  var returnType = _Webhook["default"];
1213
- 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);
1214
1341
  }
1215
1342
 
1216
1343
  /**
1217
- * Callback function to receive the result of the listCombinedSubmissions operation.
1218
- * @callback module:api/Client~listCombinedSubmissionsCallback
1219
- * @param {String} error Error message, if any.
1220
- * @param {Array.<module:model/CombinedSubmission>} data The data returned by the service call.
1221
- * @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}
1222
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
+ }
1223
1356
 
1224
1357
  /**
1225
- * Get a list of all combined submissions
1226
- * 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.
1227
1360
  * @param {Object} opts Optional parameters
1228
- * @param {Number} [page] Default: 1
1229
- * @param {Number} [per_page] Default: 50
1230
- * @param {module:api/Client~listCombinedSubmissionsCallback} callback The callback function, accepting three arguments: error, data, response
1231
- * 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
1232
1364
  */
1233
1365
  }, {
1234
- key: "listCombinedSubmissions",
1235
- value: function listCombinedSubmissions(opts, callback) {
1366
+ key: "listCombinedPdfsWithHttpInfo",
1367
+ value: function listCombinedPdfsWithHttpInfo(opts) {
1236
1368
  opts = opts || {};
1237
1369
  var postBody = null;
1238
1370
  var pathParams = {};
1239
1371
  var queryParams = {
1240
- 'page': opts['page'],
1241
- 'per_page': opts['per_page']
1372
+ 'limit': opts['limit'],
1373
+ 'cursor': opts['cursor']
1242
1374
  };
1243
1375
  var headerParams = {};
1244
1376
  var formParams = {};
1245
1377
  var authNames = ['api_token_basic'];
1246
1378
  var contentTypes = [];
1247
1379
  var accepts = ['application/json'];
1248
- var returnType = [_CombinedSubmission["default"]];
1249
- 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);
1250
1382
  }
1251
1383
 
1252
1384
  /**
1253
- * Callback function to receive the result of the listFolders operation.
1254
- * @callback module:api/Client~listFoldersCallback
1255
- * @param {String} error Error message, if any.
1256
- * @param {Array.<module:model/Folder>} data The data returned by the service call.
1257
- * @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}
1258
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
+ }
1259
1399
 
1260
1400
  /**
1261
- * Get a list of all folders
1262
- * 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.
1263
1403
  * @param {Object} opts Optional parameters
1264
- * @param {String} [parent_folder_id] Filter By Folder Id
1265
- * @param {module:api/Client~listFoldersCallback} callback The callback function, accepting three arguments: error, data, response
1266
- * 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
1267
1407
  */
1268
1408
  }, {
1269
- key: "listFolders",
1270
- value: function listFolders(opts, callback) {
1409
+ key: "listCustomFilesWithHttpInfo",
1410
+ value: function listCustomFilesWithHttpInfo(opts) {
1271
1411
  opts = opts || {};
1272
1412
  var postBody = null;
1273
1413
  var pathParams = {};
1274
1414
  var queryParams = {
1275
- 'parent_folder_id': opts['parent_folder_id']
1415
+ 'limit': opts['limit'],
1416
+ 'cursor': opts['cursor']
1276
1417
  };
1277
1418
  var headerParams = {};
1278
1419
  var formParams = {};
1279
1420
  var authNames = ['api_token_basic'];
1280
1421
  var contentTypes = [];
1281
1422
  var accepts = ['application/json'];
1282
- var returnType = [_Folder["default"]];
1283
- 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);
1284
1425
  }
1285
1426
 
1286
1427
  /**
1287
- * Callback function to receive the result of the listSubmissions operation.
1288
- * @callback module:api/Client~listSubmissionsCallback
1289
- * @param {String} error Error message, if any.
1290
- * @param {module:model/ListSubmissionsResponse} data The data returned by the service call.
1291
- * @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}
1292
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
+ }
1293
1442
 
1294
1443
  /**
1295
- * List all submissions
1296
- * 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.
1297
1446
  * @param {Object} opts Optional parameters
1298
- * @param {String} [cursor]
1299
- * @param {Number} [limit]
1300
- * @param {String} [created_after]
1301
- * @param {String} [created_before]
1302
- * @param {String} [type]
1303
- * @param {Boolean} [include_data]
1304
- * @param {module:api/Client~listSubmissionsCallback} callback The callback function, accepting three arguments: error, data, response
1305
- * 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
1306
1451
  */
1307
1452
  }, {
1308
- key: "listSubmissions",
1309
- value: function listSubmissions(opts, callback) {
1453
+ key: "listFoldersWithHttpInfo",
1454
+ value: function listFoldersWithHttpInfo(opts) {
1310
1455
  opts = opts || {};
1311
1456
  var postBody = null;
1312
1457
  var pathParams = {};
1313
1458
  var queryParams = {
1314
- 'cursor': opts['cursor'],
1459
+ 'parent_folder_id': opts['parent_folder_id'],
1315
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'],
1316
1511
  'created_after': opts['created_after'],
1317
1512
  'created_before': opts['created_before'],
1318
- 'type': opts['type'],
1319
- 'include_data': opts['include_data']
1513
+ 'include_data': opts['include_data'],
1514
+ 'limit': opts['limit'],
1515
+ 'cursor': opts['cursor']
1320
1516
  };
1321
1517
  var headerParams = {};
1322
1518
  var formParams = {};
1323
1519
  var authNames = ['api_token_basic'];
1324
1520
  var contentTypes = [];
1325
1521
  var accepts = ['application/json'];
1326
- var returnType = _ListSubmissionsResponse["default"];
1327
- 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);
1328
1524
  }
1329
1525
 
1330
1526
  /**
1331
- * Callback function to receive the result of the listTemplateSubmissions operation.
1332
- * @callback module:api/Client~listTemplateSubmissionsCallback
1333
- * @param {String} error Error message, if any.
1334
- * @param {module:model/ListSubmissionsResponse} data The data returned by the service call.
1335
- * @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}
1336
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
+ }
1337
1546
 
1338
1547
  /**
1339
- * List all submissions for a given template
1340
- * 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.
1341
- * @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.
1342
1551
  * @param {Object} opts Optional parameters
1343
- * @param {String} [cursor]
1344
- * @param {Number} [limit]
1345
- * @param {String} [created_after]
1346
- * @param {String} [created_before]
1347
- * @param {String} [type]
1348
- * @param {Boolean} [include_data]
1349
- * @param {module:api/Client~listTemplateSubmissionsCallback} callback The callback function, accepting three arguments: error, data, response
1350
- * 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
1351
1559
  */
1352
1560
  }, {
1353
- key: "listTemplateSubmissions",
1354
- value: function listTemplateSubmissions(template_id, opts, callback) {
1561
+ key: "listTemplateSubmissionsWithHttpInfo",
1562
+ value: function listTemplateSubmissionsWithHttpInfo(template_id, opts) {
1355
1563
  opts = opts || {};
1356
1564
  var postBody = null;
1357
1565
  // verify the required parameter 'template_id' is set
@@ -1362,135 +1570,168 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1362
1570
  'template_id': template_id
1363
1571
  };
1364
1572
  var queryParams = {
1365
- 'cursor': opts['cursor'],
1366
- 'limit': opts['limit'],
1573
+ 'test': opts['test'],
1367
1574
  'created_after': opts['created_after'],
1368
1575
  'created_before': opts['created_before'],
1369
- 'type': opts['type'],
1370
- 'include_data': opts['include_data']
1576
+ 'include_data': opts['include_data'],
1577
+ 'limit': opts['limit'],
1578
+ 'cursor': opts['cursor']
1371
1579
  };
1372
1580
  var headerParams = {};
1373
1581
  var formParams = {};
1374
1582
  var authNames = ['api_token_basic'];
1375
1583
  var contentTypes = [];
1376
1584
  var accepts = ['application/json'];
1377
- var returnType = _ListSubmissionsResponse["default"];
1378
- 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);
1379
1587
  }
1380
1588
 
1381
1589
  /**
1382
- * Callback function to receive the result of the listTemplates operation.
1383
- * @callback module:api/Client~listTemplatesCallback
1384
- * @param {String} error Error message, if any.
1385
- * @param {Array.<module:model/TemplatePreview>} data The data returned by the service call.
1386
- * @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}
1387
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
+ }
1388
1609
 
1389
1610
  /**
1390
- * Get a list of all templates
1391
- * 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.
1392
1613
  * @param {Object} opts Optional parameters
1393
- * @param {String} [query] Search By Name
1394
- * @param {String} [parent_folder_id] Filter By Folder Id
1395
- * @param {Number} [page] Default: 1
1396
- * @param {Number} [per_page] Default: 50
1397
- * @param {module:api/Client~listTemplatesCallback} callback The callback function, accepting three arguments: error, data, response
1398
- * 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
1399
1619
  */
1400
1620
  }, {
1401
- key: "listTemplates",
1402
- value: function listTemplates(opts, callback) {
1621
+ key: "listTemplatesWithHttpInfo",
1622
+ value: function listTemplatesWithHttpInfo(opts) {
1403
1623
  opts = opts || {};
1404
1624
  var postBody = null;
1405
1625
  var pathParams = {};
1406
1626
  var queryParams = {
1407
1627
  'query': opts['query'],
1408
1628
  'parent_folder_id': opts['parent_folder_id'],
1409
- 'page': opts['page'],
1410
- 'per_page': opts['per_page']
1629
+ 'limit': opts['limit'],
1630
+ 'cursor': opts['cursor']
1411
1631
  };
1412
1632
  var headerParams = {};
1413
1633
  var formParams = {};
1414
1634
  var authNames = ['api_token_basic'];
1415
1635
  var contentTypes = [];
1416
1636
  var accepts = ['application/json'];
1417
- var returnType = [_TemplatePreview["default"]];
1418
- 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);
1419
1639
  }
1420
1640
 
1421
1641
  /**
1422
- * Callback function to receive the result of the listWebhooks operation.
1423
- * @callback module:api/Client~listWebhooksCallback
1424
- * @param {String} error Error message, if any.
1425
- * @param {Array.<module:model/Webhook>} data The data returned by the service call.
1426
- * @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}
1427
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
+ }
1428
1658
 
1429
1659
  /**
1430
- * Get a list of all webhooks
1431
- * 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.
1432
1662
  * @param {Object} opts Optional parameters
1433
- * @param {Number} [page] Default: 1
1434
- * @param {Number} [per_page] Default: 50
1435
- * @param {String} [event_type] Filter by a subscribed event type
1436
- * @param {String} [mode] Filter by mode (test or live)
1437
- * @param {String} [template_id] Filter by a scoped template ID
1438
- * @param {String} [folder_id] Filter by a scoped folder ID
1439
- * @param {String} [api_token_id] Filter by a scoped API token ID
1440
- * @param {module:api/Client~listWebhooksCallback} callback The callback function, accepting three arguments: error, data, response
1441
- * 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
1442
1671
  */
1443
1672
  }, {
1444
- key: "listWebhooks",
1445
- value: function listWebhooks(opts, callback) {
1673
+ key: "listWebhooksWithHttpInfo",
1674
+ value: function listWebhooksWithHttpInfo(opts) {
1446
1675
  opts = opts || {};
1447
1676
  var postBody = null;
1448
1677
  var pathParams = {};
1449
1678
  var queryParams = {
1450
- 'page': opts['page'],
1451
- 'per_page': opts['per_page'],
1452
1679
  'event_type': opts['event_type'],
1453
1680
  'mode': opts['mode'],
1454
1681
  'template_id': opts['template_id'],
1455
1682
  'folder_id': opts['folder_id'],
1456
- 'api_token_id': opts['api_token_id']
1683
+ 'api_token_id': opts['api_token_id'],
1684
+ 'limit': opts['limit'],
1685
+ 'cursor': opts['cursor']
1457
1686
  };
1458
1687
  var headerParams = {};
1459
1688
  var formParams = {};
1460
1689
  var authNames = ['api_token_basic'];
1461
1690
  var contentTypes = [];
1462
1691
  var accepts = ['application/json'];
1463
- var returnType = [_Webhook["default"]];
1464
- 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);
1465
1694
  }
1466
1695
 
1467
1696
  /**
1468
- * Callback function to receive the result of the moveFolderToFolder operation.
1469
- * @callback module:api/Client~moveFolderToFolderCallback
1470
- * @param {String} error Error message, if any.
1471
- * @param {module:model/Folder} data The data returned by the service call.
1472
- * @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}
1473
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
+ }
1474
1716
 
1475
1717
  /**
1476
1718
  * Move a folder
1477
- * 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.
1478
- * @param {String} folder_id
1479
- * @param {module:model/MoveFolderData} data
1480
- * @param {module:api/Client~moveFolderToFolderCallback} callback The callback function, accepting three arguments: error, data, response
1481
- * 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
1482
1723
  */
1483
1724
  }, {
1484
- key: "moveFolderToFolder",
1485
- value: function moveFolderToFolder(folder_id, data, callback) {
1486
- var postBody = data;
1725
+ key: "moveFolderWithHttpInfo",
1726
+ value: function moveFolderWithHttpInfo(folder_id, body) {
1727
+ var postBody = body;
1487
1728
  // verify the required parameter 'folder_id' is set
1488
1729
  if (folder_id === undefined || folder_id === null) {
1489
- 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");
1490
1731
  }
1491
- // verify the required parameter 'data' is set
1492
- if (data === undefined || data === null) {
1493
- 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");
1494
1735
  }
1495
1736
  var pathParams = {
1496
1737
  'folder_id': folder_id
@@ -1502,36 +1743,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1502
1743
  var contentTypes = ['application/json'];
1503
1744
  var accepts = ['application/json'];
1504
1745
  var returnType = _Folder["default"];
1505
- 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);
1506
1747
  }
1507
1748
 
1508
1749
  /**
1509
- * Callback function to receive the result of the moveTemplateToFolder operation.
1510
- * @callback module:api/Client~moveTemplateToFolderCallback
1511
- * @param {String} error Error message, if any.
1512
- * @param {module:model/TemplatePreview} data The data returned by the service call.
1513
- * @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}
1514
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
+ }
1515
1763
 
1516
1764
  /**
1517
- * Move Template to folder
1518
- * 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.
1519
- * @param {String} template_id
1520
- * @param {module:model/MoveTemplateData} data
1521
- * @param {module:api/Client~moveTemplateToFolderCallback} callback The callback function, accepting three arguments: error, data, response
1522
- * 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
1523
1770
  */
1524
1771
  }, {
1525
- key: "moveTemplateToFolder",
1526
- value: function moveTemplateToFolder(template_id, data, callback) {
1527
- var postBody = data;
1772
+ key: "moveTemplateWithHttpInfo",
1773
+ value: function moveTemplateWithHttpInfo(template_id, body) {
1774
+ var postBody = body;
1528
1775
  // verify the required parameter 'template_id' is set
1529
1776
  if (template_id === undefined || template_id === null) {
1530
- 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");
1531
1778
  }
1532
- // verify the required parameter 'data' is set
1533
- if (data === undefined || data === null) {
1534
- 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");
1535
1782
  }
1536
1783
  var pathParams = {
1537
1784
  'template_id': template_id
@@ -1542,37 +1789,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1542
1789
  var authNames = ['api_token_basic'];
1543
1790
  var contentTypes = ['application/json'];
1544
1791
  var accepts = ['application/json'];
1545
- var returnType = _TemplatePreview["default"];
1546
- 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);
1547
1794
  }
1548
1795
 
1549
1796
  /**
1550
- * Callback function to receive the result of the publishTemplateVersion operation.
1551
- * @callback module:api/Client~publishTemplateVersionCallback
1552
- * @param {String} error Error message, if any.
1553
- * @param {module:model/TemplatePublishVersionResponse} data The data returned by the service call.
1554
- * @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}
1555
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
+ }
1556
1810
 
1557
1811
  /**
1558
1812
  * Publish a template version
1559
- * Publishes the current draft version of a template and creates a new immutable version with semantic versioning (major.minor.patch).
1560
- * @param {String} template_id
1561
- * @param {module:model/PublishVersionData} data
1562
- * @param {module:api/Client~publishTemplateVersionCallback} callback The callback function, accepting three arguments: error, data, response
1563
- * 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
1564
1817
  */
1565
1818
  }, {
1566
- key: "publishTemplateVersion",
1567
- value: function publishTemplateVersion(template_id, data, callback) {
1568
- var postBody = data;
1819
+ key: "publishTemplateVersionWithHttpInfo",
1820
+ value: function publishTemplateVersionWithHttpInfo(template_id, body) {
1821
+ var postBody = body;
1569
1822
  // verify the required parameter 'template_id' is set
1570
1823
  if (template_id === undefined || template_id === null) {
1571
1824
  throw new Error("Missing the required parameter 'template_id' when calling publishTemplateVersion");
1572
1825
  }
1573
- // verify the required parameter 'data' is set
1574
- if (data === undefined || data === null) {
1575
- 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");
1576
1829
  }
1577
1830
  var pathParams = {
1578
1831
  'template_id': template_id
@@ -1583,37 +1836,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1583
1836
  var authNames = ['api_token_basic'];
1584
1837
  var contentTypes = ['application/json'];
1585
1838
  var accepts = ['application/json'];
1586
- var returnType = _TemplatePublishVersionResponse["default"];
1587
- 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);
1588
1841
  }
1589
1842
 
1590
1843
  /**
1591
- * Callback function to receive the result of the renameFolder operation.
1592
- * @callback module:api/Client~renameFolderCallback
1593
- * @param {String} error Error message, if any.
1594
- * @param {module:model/Folder} data The data returned by the service call.
1595
- * @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}
1596
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
+ }
1597
1857
 
1598
1858
  /**
1599
1859
  * Rename a folder
1600
- * 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.
1601
- * @param {String} folder_id
1602
- * @param {module:model/RenameFolderData} data
1603
- * @param {module:api/Client~renameFolderCallback} callback The callback function, accepting three arguments: error, data, response
1604
- * 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
1605
1864
  */
1606
1865
  }, {
1607
- key: "renameFolder",
1608
- value: function renameFolder(folder_id, data, callback) {
1609
- var postBody = data;
1866
+ key: "renameFolderWithHttpInfo",
1867
+ value: function renameFolderWithHttpInfo(folder_id, body) {
1868
+ var postBody = body;
1610
1869
  // verify the required parameter 'folder_id' is set
1611
1870
  if (folder_id === undefined || folder_id === null) {
1612
1871
  throw new Error("Missing the required parameter 'folder_id' when calling renameFolder");
1613
1872
  }
1614
- // verify the required parameter 'data' is set
1615
- if (data === undefined || data === null) {
1616
- 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");
1617
1876
  }
1618
1877
  var pathParams = {
1619
1878
  'folder_id': folder_id
@@ -1625,36 +1884,42 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1625
1884
  var contentTypes = ['application/json'];
1626
1885
  var accepts = ['application/json'];
1627
1886
  var returnType = _Folder["default"];
1628
- 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);
1629
1888
  }
1630
1889
 
1631
1890
  /**
1632
- * Callback function to receive the result of the restoreTemplateVersion operation.
1633
- * @callback module:api/Client~restoreTemplateVersionCallback
1634
- * @param {String} error Error message, if any.
1635
- * @param {module:model/SuccessErrorResponse} data The data returned by the service call.
1636
- * @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}
1637
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
+ }
1638
1904
 
1639
1905
  /**
1640
1906
  * Restore a template version
1641
- * 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.
1642
- * @param {String} template_id
1643
- * @param {module:model/RestoreVersionData} data
1644
- * @param {module:api/Client~restoreTemplateVersionCallback} callback The callback function, accepting three arguments: error, data, response
1645
- * 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
1646
1911
  */
1647
1912
  }, {
1648
- key: "restoreTemplateVersion",
1649
- value: function restoreTemplateVersion(template_id, data, callback) {
1650
- var postBody = data;
1913
+ key: "restoreTemplateVersionWithHttpInfo",
1914
+ value: function restoreTemplateVersionWithHttpInfo(template_id, body) {
1915
+ var postBody = body;
1651
1916
  // verify the required parameter 'template_id' is set
1652
1917
  if (template_id === undefined || template_id === null) {
1653
1918
  throw new Error("Missing the required parameter 'template_id' when calling restoreTemplateVersion");
1654
1919
  }
1655
- // verify the required parameter 'data' is set
1656
- if (data === undefined || data === null) {
1657
- 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");
1658
1923
  }
1659
1924
  var pathParams = {
1660
1925
  'template_id': template_id
@@ -1665,27 +1930,33 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1665
1930
  var authNames = ['api_token_basic'];
1666
1931
  var contentTypes = ['application/json'];
1667
1932
  var accepts = ['application/json'];
1668
- var returnType = _SuccessErrorResponse["default"];
1669
- 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);
1670
1935
  }
1671
1936
 
1672
1937
  /**
1673
- * Callback function to receive the result of the testAuthentication operation.
1674
- * @callback module:api/Client~testAuthenticationCallback
1675
- * @param {String} error Error message, if any.
1676
- * @param {module:model/SuccessErrorResponse} data The data returned by the service call.
1677
- * @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}
1678
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
+ }
1679
1951
 
1680
1952
  /**
1681
1953
  * Test authentication
1682
- * 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.
1683
- * @param {module:api/Client~testAuthenticationCallback} callback The callback function, accepting three arguments: error, data, response
1684
- * 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
1685
1956
  */
1686
1957
  }, {
1687
- key: "testAuthentication",
1688
- value: function testAuthentication(callback) {
1958
+ key: "testAuthenticationWithHttpInfo",
1959
+ value: function testAuthenticationWithHttpInfo() {
1689
1960
  var postBody = null;
1690
1961
  var pathParams = {};
1691
1962
  var queryParams = {};
@@ -1694,40 +1965,44 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1694
1965
  var authNames = ['api_token_basic'];
1695
1966
  var contentTypes = [];
1696
1967
  var accepts = ['application/json'];
1697
- var returnType = _SuccessErrorResponse["default"];
1698
- 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);
1699
1970
  }
1700
1971
 
1701
1972
  /**
1702
- * Callback function to receive the result of the updateDataRequest operation.
1703
- * @callback module:api/Client~updateDataRequestCallback
1704
- * @param {String} error Error message, if any.
1705
- * @param {module:model/CreateSubmissionDataRequestResponse} data The data returned by the service call.
1706
- * @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}
1707
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
+ }
1708
1984
 
1709
1985
  /**
1710
- * Update a submission data request
1711
- * 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.
1712
- * @param {String} data_request_id
1713
- * @param {module:model/UpdateSubmissionDataRequestData} data
1714
- * @param {module:api/Client~updateDataRequestCallback} callback The callback function, accepting three arguments: error, data, response
1715
- * 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
1716
1991
  */
1717
1992
  }, {
1718
- key: "updateDataRequest",
1719
- value: function updateDataRequest(data_request_id, data, callback) {
1720
- var postBody = data;
1721
- // verify the required parameter 'data_request_id' is set
1722
- if (data_request_id === undefined || data_request_id === null) {
1723
- 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");
1724
1999
  }
1725
- // verify the required parameter 'data' is set
1726
- if (data === undefined || data === null) {
1727
- 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");
1728
2003
  }
1729
2004
  var pathParams = {
1730
- 'data_request_id': data_request_id
2005
+ 'signature_request_id': signature_request_id
1731
2006
  };
1732
2007
  var queryParams = {};
1733
2008
  var headerParams = {};
@@ -1735,37 +2010,43 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1735
2010
  var authNames = ['api_token_basic'];
1736
2011
  var contentTypes = ['application/json'];
1737
2012
  var accepts = ['application/json'];
1738
- var returnType = _CreateSubmissionDataRequestResponse["default"];
1739
- 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);
1740
2015
  }
1741
2016
 
1742
2017
  /**
1743
- * Callback function to receive the result of the updateTemplate operation.
1744
- * @callback module:api/Client~updateTemplateCallback
1745
- * @param {String} error Error message, if any.
1746
- * @param {module:model/SuccessMultipleErrorsResponse} data The data returned by the service call.
1747
- * @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}
1748
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
+ }
1749
2031
 
1750
2032
  /**
1751
- * Update a Template
1752
- * 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.
1753
- * @param {String} template_id
1754
- * @param {module:model/UpdateHtmlTemplate} data
1755
- * @param {module:api/Client~updateTemplateCallback} callback The callback function, accepting three arguments: error, data, response
1756
- * 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
1757
2038
  */
1758
2039
  }, {
1759
- key: "updateTemplate",
1760
- value: function updateTemplate(template_id, data, callback) {
1761
- var postBody = data;
2040
+ key: "updateTemplateWithHttpInfo",
2041
+ value: function updateTemplateWithHttpInfo(template_id, body) {
2042
+ var postBody = body;
1762
2043
  // verify the required parameter 'template_id' is set
1763
2044
  if (template_id === undefined || template_id === null) {
1764
2045
  throw new Error("Missing the required parameter 'template_id' when calling updateTemplate");
1765
2046
  }
1766
- // verify the required parameter 'data' is set
1767
- if (data === undefined || data === null) {
1768
- 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");
1769
2050
  }
1770
2051
  var pathParams = {
1771
2052
  'template_id': template_id
@@ -1776,87 +2057,100 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1776
2057
  var authNames = ['api_token_basic'];
1777
2058
  var contentTypes = ['application/json'];
1778
2059
  var accepts = ['application/json'];
1779
- var returnType = _SuccessMultipleErrorsResponse["default"];
1780
- 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);
1781
2062
  }
1782
2063
 
1783
2064
  /**
1784
- * Callback function to receive the result of the updateTemplateDocument operation.
1785
- * @callback module:api/Client~updateTemplateDocumentCallback
1786
- * @param {String} error Error message, if any.
1787
- * @param {module:model/SuccessMultipleErrorsResponse} data The data returned by the service call.
1788
- * @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}
1789
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
+ }
1790
2078
 
1791
2079
  /**
1792
- * Update a template's document with a form POST file upload
1793
- * 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.
1794
- * @param {String} template_id
1795
- * @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.
1796
2084
  * @param {Object} opts Optional parameters
1797
- * @param {String} [template_name]
1798
- * @param {module:api/Client~updateTemplateDocumentCallback} callback The callback function, accepting three arguments: error, data, response
1799
- * 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
1800
2087
  */
1801
2088
  }, {
1802
- key: "updateTemplateDocument",
1803
- value: function updateTemplateDocument(template_id, template_document, opts, callback) {
2089
+ key: "updateTemplateDocumentWithHttpInfo",
2090
+ value: function updateTemplateDocumentWithHttpInfo(template_id, body, opts) {
1804
2091
  opts = opts || {};
1805
- var postBody = null;
2092
+ var postBody = body;
1806
2093
  // verify the required parameter 'template_id' is set
1807
2094
  if (template_id === undefined || template_id === null) {
1808
2095
  throw new Error("Missing the required parameter 'template_id' when calling updateTemplateDocument");
1809
2096
  }
1810
- // verify the required parameter 'template_document' is set
1811
- if (template_document === undefined || template_document === null) {
1812
- 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");
1813
2100
  }
1814
2101
  var pathParams = {
1815
2102
  'template_id': template_id
1816
2103
  };
1817
- var queryParams = {};
1818
- var headerParams = {};
1819
- var formParams = {
1820
- 'template[document]': template_document,
1821
- 'template[name]': opts['template_name']
2104
+ var queryParams = {
2105
+ 'wait': opts['wait']
1822
2106
  };
2107
+ var headerParams = {};
2108
+ var formParams = {};
1823
2109
  var authNames = ['api_token_basic'];
1824
- var contentTypes = ['multipart/form-data'];
2110
+ var contentTypes = ['application/json'];
1825
2111
  var accepts = ['application/json'];
1826
- var returnType = _SuccessMultipleErrorsResponse["default"];
1827
- 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);
1828
2114
  }
1829
2115
 
1830
2116
  /**
1831
- * Callback function to receive the result of the updateTemplateDocumentFromUpload operation.
1832
- * @callback module:api/Client~updateTemplateDocumentFromUploadCallback
1833
- * @param {String} error Error message, if any.
1834
- * @param {module:model/SuccessMultipleErrorsResponse} data The data returned by the service call.
1835
- * @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}
1836
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
+ }
1837
2132
 
1838
2133
  /**
1839
- * Update a template's document with a cached S3 file upload
1840
- * 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.
1841
- * @param {String} template_id
1842
- * @param {module:model/UpdatePdfTemplate} data
1843
- * @param {module:api/Client~updateTemplateDocumentFromUploadCallback} callback The callback function, accepting three arguments: error, data, response
1844
- * 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
1845
2139
  */
1846
2140
  }, {
1847
- key: "updateTemplateDocumentFromUpload",
1848
- value: function updateTemplateDocumentFromUpload(template_id, data, callback) {
1849
- var postBody = data;
1850
- // verify the required parameter 'template_id' is set
1851
- if (template_id === undefined || template_id === null) {
1852
- 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");
1853
2147
  }
1854
- // verify the required parameter 'data' is set
1855
- if (data === undefined || data === null) {
1856
- 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");
1857
2151
  }
1858
2152
  var pathParams = {
1859
- 'template_id': template_id
2153
+ 'webhook_id': webhook_id
1860
2154
  };
1861
2155
  var queryParams = {};
1862
2156
  var headerParams = {};
@@ -1864,49 +2158,154 @@ var Client = exports["default"] = /*#__PURE__*/function () {
1864
2158
  var authNames = ['api_token_basic'];
1865
2159
  var contentTypes = ['application/json'];
1866
2160
  var accepts = ['application/json'];
1867
- var returnType = _SuccessMultipleErrorsResponse["default"];
1868
- 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);
1869
2163
  }
1870
2164
 
1871
2165
  /**
1872
- * Callback function to receive the result of the updateWebhook operation.
1873
- * @callback module:api/Client~updateWebhookCallback
1874
- * @param {String} error Error message, if any.
1875
- * @param {module:model/Webhook} data The data returned by the service call.
1876
- * @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}
1877
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
+ }
1878
2179
 
1879
2180
  /**
1880
- * Update a webhook
1881
- * Updates the configuration of an existing webhook.
1882
- * @param {String} webhook_id
1883
- * @param {module:model/UpdateWebhookData} data
1884
- * @param {module:api/Client~updateWebhookCallback} callback The callback function, accepting three arguments: error, data, response
1885
- * 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
1886
2195
  */
1887
2196
  }, {
1888
- key: "updateWebhook",
1889
- value: function updateWebhook(webhook_id, data, callback) {
1890
- var postBody = data;
1891
- // verify the required parameter 'webhook_id' is set
1892
- if (webhook_id === undefined || webhook_id === null) {
1893
- 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");
1894
2204
  }
1895
- // verify the required parameter 'data' is set
1896
- if (data === undefined || data === null) {
1897
- 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");
1898
2274
  }
1899
2275
  var pathParams = {
1900
- 'webhook_id': webhook_id
2276
+ 'template_id': template_id
2277
+ };
2278
+ var queryParams = {
2279
+ 'wait': opts['wait']
1901
2280
  };
1902
- var queryParams = {};
1903
2281
  var headerParams = {};
1904
- var formParams = {};
2282
+ var formParams = {
2283
+ 'document': document,
2284
+ 'reimport_fields': opts['reimport_fields']
2285
+ };
1905
2286
  var authNames = ['api_token_basic'];
1906
- var contentTypes = ['application/json'];
2287
+ var contentTypes = ['multipart/form-data'];
1907
2288
  var accepts = ['application/json'];
1908
- var returnType = _Webhook["default"];
1909
- 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
+ });
1910
2309
  }
1911
2310
  }]);
1912
2311
  }();