docspring 3.1.0 → 3.2.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 (62) hide show
  1. package/AGENTS.md +33 -0
  2. package/README.md +148 -215
  3. package/dist/ApiClient.js +2 -2
  4. package/dist/api/Client.js +1 -1
  5. package/dist/model/AddFieldsData.js +1 -1
  6. package/dist/model/BatchGeneratePdfs201Response.js +3 -6
  7. package/dist/model/CombinePdfsData.js +1 -1
  8. package/dist/model/CombinedSubmission.js +6 -21
  9. package/dist/model/CombinedSubmissionAction.js +3 -1
  10. package/dist/model/CopyTemplateOptions.js +1 -1
  11. package/dist/model/CreateCombinedSubmissionResponse.js +3 -6
  12. package/dist/model/CreateCustomFileData.js +1 -1
  13. package/dist/model/CreateCustomFileResponse.js +3 -6
  14. package/dist/model/CreateFolderData.js +1 -1
  15. package/dist/model/CreateHtmlTemplate.js +1 -1
  16. package/dist/model/CreatePdfSubmissionData.js +1 -1
  17. package/dist/model/CreatePdfTemplate.js +1 -1
  18. package/dist/model/CreateSubmissionDataRequestData.js +1 -1
  19. package/dist/model/CreateSubmissionDataRequestEventRequest.js +1 -1
  20. package/dist/model/CreateSubmissionDataRequestEventResponse.js +3 -6
  21. package/dist/model/CreateSubmissionDataRequestResponse.js +3 -6
  22. package/dist/model/CreateSubmissionDataRequestTokenResponse.js +3 -6
  23. package/dist/model/CreateSubmissionResponse.js +3 -6
  24. package/dist/model/CreateWebhookData.js +1 -1
  25. package/dist/model/CustomFile.js +3 -1
  26. package/dist/model/ErrorOrMultipleErrorsResponse.js +3 -1
  27. package/dist/model/ErrorResponse.js +3 -1
  28. package/dist/model/Folder.js +3 -1
  29. package/dist/model/JsonSchema.js +1 -1
  30. package/dist/model/ListSubmissionsResponse.js +6 -21
  31. package/dist/model/MoveFolderData.js +1 -1
  32. package/dist/model/MoveTemplateData.js +1 -1
  33. package/dist/model/MultipleErrorsResponse.js +3 -1
  34. package/dist/model/PublishVersionData.js +1 -1
  35. package/dist/model/RenameFolderData.js +1 -1
  36. package/dist/model/RestoreVersionData.js +1 -1
  37. package/dist/model/Submission.js +9 -41
  38. package/dist/model/Submission422Response.js +3 -6
  39. package/dist/model/SubmissionAction.js +3 -1
  40. package/dist/model/SubmissionBatch.js +3 -1
  41. package/dist/model/SubmissionBatchData.js +1 -1
  42. package/dist/model/SubmissionBatchWithSubmissions.js +6 -21
  43. package/dist/model/SubmissionDataRequest.js +3 -1
  44. package/dist/model/SubmissionDataRequestEvent.js +3 -1
  45. package/dist/model/SubmissionDataRequestShow.js +3 -1
  46. package/dist/model/SubmissionDataRequestToken.js +3 -1
  47. package/dist/model/SubmissionPreview.js +9 -41
  48. package/dist/model/SuccessErrorResponse.js +3 -1
  49. package/dist/model/SuccessMultipleErrorsResponse.js +3 -1
  50. package/dist/model/Template.js +17 -5
  51. package/dist/model/TemplateAddFieldsResponse.js +3 -1
  52. package/dist/model/TemplateDeleteResponse.js +3 -1
  53. package/dist/model/TemplateModelCodeResponse.js +3 -1
  54. package/dist/model/TemplatePreview.js +17 -5
  55. package/dist/model/TemplatePublishVersionResponse.js +3 -1
  56. package/dist/model/UpdateHtmlTemplate.js +1 -1
  57. package/dist/model/UpdatePdfTemplate.js +1 -1
  58. package/dist/model/UpdateSubmissionDataRequestData.js +1 -1
  59. package/dist/model/UpdateWebhookData.js +1 -1
  60. package/dist/model/UploadPresignResponse.js +3 -1
  61. package/dist/model/Webhook.js +3 -1
  62. package/package.json +13 -3
package/AGENTS.md ADDED
@@ -0,0 +1,33 @@
1
+ # AGENTS.md
2
+
3
+ Notes for AI coding agents working with the DocSpring JavaScript SDK (`docspring`), in this repository or
4
+ as a dependency of an app.
5
+
6
+ ## This code is generated
7
+
8
+ Every file here is generated from DocSpring's OpenAPI spec by
9
+ [DocSpring's fork of OpenAPI Generator](https://github.com/DocSpring/openapi-generator/tree/docspring/all_patches), and each release replaces
10
+ all of it. Don't edit it or open pull requests that change it, and don't patch an installed copy: the next release
11
+ overwrites the change. Report bugs at https://github.com/DocSpring/docspring-javascript/issues or to support@docspring.com, and DocSpring fixes them in
12
+ the generator.
13
+
14
+ ## Where to look
15
+
16
+ - [README.md](README.md): install, configuration, an example and how errors and API changes are handled.
17
+ - [docs/Client.md](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md): every method, with its parameters and return type.
18
+ - [docs/](https://github.com/DocSpring/docspring-javascript/tree/main/docs): every model and its fields.
19
+ - https://docspring.com/docs/llms.txt: DocSpring's documentation for LLMs (`llms-small.txt`, `llms-full.txt`).
20
+ - https://docspring.com/docs/api/: the API reference, with JavaScript code for every method.
21
+ - https://docspring.com/api-docs/v1/openapi.json: the OpenAPI spec this SDK is generated from.
22
+
23
+ ## Using it in an app
24
+
25
+ - Credentials come from `DOCSPRING_TOKEN_ID` and `DOCSPRING_TOKEN_SECRET`. Keep them in the environment or a secret
26
+ store, never in code. Accounts in the EU region also need `DOCSPRING_REGION=EU`.
27
+ - Template IDs look like `tpl_...` and submission IDs like `sub_...`.
28
+ - Pass `test: true` when you generate PDFs during development: test PDFs are free and watermarked.
29
+ - Generating a PDF waits for it, for up to 95 seconds. For many PDFs or slow templates, set `wait` to false and use
30
+ webhooks or check the submission later (https://docspring.com/docs/api-guide/synchronous-requests/).
31
+ - Errors: The callback gets `(error, data, response)`. For an error response, `error.status` is the HTTP status and `response.body` the parsed body.
32
+ - Responses can be newer than this SDK, because DocSpring adds fields and enum values to API v1 without a new
33
+ version. The model object keeps a response field added to the API after this release as a property. An enum value added to the API after this release comes back as a string, so handle values you don't recognize.
package/README.md CHANGED
@@ -1,246 +1,179 @@
1
- # docspring
1
+ # DocSpring JavaScript SDK
2
2
 
3
- DocSpring - JavaScript client for docspring
4
- Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
5
- This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
3
+ The official JavaScript client for the [DocSpring API](https://docspring.com/docs/api/). DocSpring fills PDF
4
+ templates with your data, generates PDFs from HTML templates, combines PDFs and collects e-signatures.
6
5
 
7
- - API version: v1
8
- - Package version: 3.1.0
9
- - Generator version: 7.16.0-DOCSPRING
10
- - Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
6
+ [Documentation](https://docspring.com/docs/) · [API reference](https://docspring.com/docs/api/) ·
7
+ [npm](https://www.npmjs.com/package/docspring) · [Changelog](https://github.com/DocSpring/docspring-javascript/blob/main/CHANGELOG.md)
11
8
 
12
- ## Installation
9
+ Version 3.2.0.
13
10
 
14
- ### For [Node.js](https://nodejs.org/)
11
+ ## Install and configure
15
12
 
16
- #### npm
13
+ Add docspring to your package.json:
17
14
 
18
- To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
19
-
20
- Then install it via:
21
-
22
- ```shell
15
+ ```bash
23
16
  npm install docspring --save
24
17
  ```
25
18
 
26
- Finally, you need to build the module:
27
-
28
- ```shell
29
- npm run build
30
- ```
31
-
32
- ##### Local development
33
-
34
- To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
35
-
36
- ```shell
37
- npm install
38
- ```
39
-
40
- Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
19
+ Or with Yarn:
41
20
 
42
- ```shell
43
- npm link
21
+ ```bash
22
+ yarn add docspring
44
23
  ```
45
24
 
46
- To use the link you just defined in your project, switch to the directory you want to use your docspring from, and run:
25
+ Configure authentication via environment variables:
47
26
 
48
- ```shell
49
- npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
27
+ ```bash
28
+ export DOCSPRING_TOKEN_ID="API_TOKEN_ID"
29
+ export DOCSPRING_TOKEN_SECRET="API_TOKEN_SECRET"
50
30
  ```
51
31
 
52
- Finally, you need to build the module:
32
+ You can also configure the region or host. The host takes priority over the region:
53
33
 
54
- ```shell
55
- npm run build
34
+ ```bash
35
+ export DOCSPRING_REGION="US" # US or EU (defaults to US)
36
+ export DOCSPRING_HOST="docspring.yourcompany.com" # For on-premise deployments
56
37
  ```
57
38
 
58
- #### git
59
-
60
- If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID
61
- then install it via:
62
-
63
- ```shell
64
- npm install GIT_USER_ID/GIT_REPO_ID --save
65
- ```
39
+ Initialize the DocSpring client with no arguments:
66
40
 
67
- ### For browser
68
-
69
- The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
70
- the above steps with Node.js and installing browserify with `npm install -g browserify`,
71
- perform the following (assuming *main.js* is your entry file):
72
-
73
- ```shell
74
- browserify main.js > bundle.js
41
+ ```javascript
42
+ const DocSpring = require("docspring");
43
+ const apiInstance = new DocSpring.Client();
75
44
  ```
76
45
 
77
- Then include *bundle.js* in the HTML pages.
78
-
79
- ### Webpack Configuration
80
-
81
- Using Webpack you may encounter the following error: "Module not found: Error:
82
- Cannot resolve module", most certainly you should disable AMD loader. Add/merge
83
- the following section to your webpack config:
46
+ Or provide credentials directly:
84
47
 
85
48
  ```javascript
86
- module: {
87
- rules: [
88
- {
89
- parser: {
90
- amd: false
91
- }
92
- }
93
- ]
94
- }
49
+ const DocSpring = require("docspring");
50
+ const apiInstance = new DocSpring.Client({
51
+ apiTokenId: "API_TOKEN_ID",
52
+ apiTokenSecret: "API_TOKEN_SECRET",
53
+ });
95
54
  ```
96
55
 
97
- ## Getting Started
56
+ ## Generate a PDF
98
57
 
99
- Please follow the [installation](#installation) instruction and execute the following JS code:
58
+ Fill a template with data (use your template's ID in place of `tpl_1234567890abcdef01`):
100
59
 
101
60
  ```javascript
102
- var DocSpring = require('docspring');
103
-
104
- var defaultClient = DocSpring.ApiClient.instance;
105
- // Configure HTTP basic authorization: api_token_basic
106
- var api_token_basic = defaultClient.authentications['api_token_basic'];
107
- api_token_basic.username = 'YOUR USERNAME'
108
- api_token_basic.password = 'YOUR PASSWORD'
109
-
110
- var api = new DocSpring.Client()
111
- var template_id = "tpl_1234567890abcdef02"; // {String}
112
- var data = new DocSpring.AddFieldsData(); // {AddFieldsData}
113
- var callback = function(error, data, response) {
114
- if (error) {
115
- console.error(error);
116
- } else {
117
- console.log('API called successfully. Returned data: ' + data);
61
+ const templateId = 'tpl_1234567890abcdef01'
62
+ const submission = {
63
+ data: {
64
+ first_name: 'John',
65
+ last_name: 'Smith',
66
+ phone_number: '+11234567890',
67
+ },
68
+ metadata: { foo: 123, bar: 'baz' },
69
+ }
70
+ const wait = undefined
71
+
72
+ apiInstance.generatePdf(
73
+ templateId,
74
+ submission,
75
+ { wait: wait },
76
+ (error, data, response) => {
77
+ if (error) {
78
+ console.error('Error calling generatePdf:', error)
79
+ } else {
80
+ console.log('API call completed successfully:', data)
81
+ }
118
82
  }
119
- };
120
- api.addFieldsToTemplate(template_id, data, callback);
121
-
83
+ )
122
84
  ```
123
85
 
124
- ## Documentation for API Endpoints
125
-
126
- All URIs are relative to *https://sync.api.docspring.com/api/v1*
127
-
128
- Class | Method | HTTP request | Description
129
- ------------ | ------------- | ------------- | -------------
130
- *DocSpring.Client* | [**addFieldsToTemplate**](docs/Client.md#addFieldsToTemplate) | **PUT** /templates/{template_id}/add_fields | Add new fields to a Template
131
- *DocSpring.Client* | [**batchGeneratePdfs**](docs/Client.md#batchGeneratePdfs) | **POST** /submissions/batches | Generate multiple PDFs
132
- *DocSpring.Client* | [**combinePdfs**](docs/Client.md#combinePdfs) | **POST** /combined_submissions | Merge submission PDFs, template PDFs, or custom files
133
- *DocSpring.Client* | [**copyTemplate**](docs/Client.md#copyTemplate) | **POST** /templates/{template_id}/copy | Copy a template
134
- *DocSpring.Client* | [**createCustomFileFromUpload**](docs/Client.md#createCustomFileFromUpload) | **POST** /custom_files | Create a new custom file from a cached S3 upload
135
- *DocSpring.Client* | [**createDataRequestEvent**](docs/Client.md#createDataRequestEvent) | **POST** /data_requests/{data_request_id}/events | Create a new event for emailing a signee a request for signature
136
- *DocSpring.Client* | [**createDataRequestToken**](docs/Client.md#createDataRequestToken) | **POST** /data_requests/{data_request_id}/tokens | Create a new data request token for form authentication
137
- *DocSpring.Client* | [**createFolder**](docs/Client.md#createFolder) | **POST** /folders/ | Create a folder
138
- *DocSpring.Client* | [**createHtmlTemplate**](docs/Client.md#createHtmlTemplate) | **POST** /templates?endpoint_variant&#x3D;create_html_template | Create a new HTML template
139
- *DocSpring.Client* | [**createPdfTemplate**](docs/Client.md#createPdfTemplate) | **POST** /templates | Create a new PDF template with a form POST file upload
140
- *DocSpring.Client* | [**createPdfTemplateFromUpload**](docs/Client.md#createPdfTemplateFromUpload) | **POST** /templates?endpoint_variant&#x3D;create_template_from_cached_upload | Create a new PDF template from a cached S3 file upload
141
- *DocSpring.Client* | [**createWebhook**](docs/Client.md#createWebhook) | **POST** /webhooks | Create a webhook
142
- *DocSpring.Client* | [**deleteFolder**](docs/Client.md#deleteFolder) | **DELETE** /folders/{folder_id} | Delete a folder
143
- *DocSpring.Client* | [**deleteTemplate**](docs/Client.md#deleteTemplate) | **DELETE** /templates/{template_id} | Delete a template
144
- *DocSpring.Client* | [**deleteWebhook**](docs/Client.md#deleteWebhook) | **DELETE** /webhooks/{webhook_id} | Delete a webhook
145
- *DocSpring.Client* | [**expireCombinedSubmission**](docs/Client.md#expireCombinedSubmission) | **DELETE** /combined_submissions/{combined_submission_id} | Expire a combined submission
146
- *DocSpring.Client* | [**expireSubmission**](docs/Client.md#expireSubmission) | **DELETE** /submissions/{submission_id} | Expire a PDF submission
147
- *DocSpring.Client* | [**generatePdf**](docs/Client.md#generatePdf) | **POST** /templates/{template_id}/submissions | Generate a PDF
148
- *DocSpring.Client* | [**generatePreview**](docs/Client.md#generatePreview) | **POST** /submissions/{submission_id}/generate_preview | Generate a preview PDF for partially completed data requests
149
- *DocSpring.Client* | [**getCombinedSubmission**](docs/Client.md#getCombinedSubmission) | **GET** /combined_submissions/{combined_submission_id} | Check the status of a combined submission (merged PDFs)
150
- *DocSpring.Client* | [**getDataRequest**](docs/Client.md#getDataRequest) | **GET** /data_requests/{data_request_id} | Look up a submission data request
151
- *DocSpring.Client* | [**getFullTemplate**](docs/Client.md#getFullTemplate) | **GET** /templates/{template_id}?full&#x3D;true | Fetch the full attributes for a PDF template
152
- *DocSpring.Client* | [**getPresignUrl**](docs/Client.md#getPresignUrl) | **GET** /uploads/presign | Get a presigned S3 URL for direct file upload
153
- *DocSpring.Client* | [**getSubmission**](docs/Client.md#getSubmission) | **GET** /submissions/{submission_id} | Check the status of a PDF
154
- *DocSpring.Client* | [**getSubmissionBatch**](docs/Client.md#getSubmissionBatch) | **GET** /submissions/batches/{submission_batch_id} | Check the status of a submission batch job
155
- *DocSpring.Client* | [**getTemplate**](docs/Client.md#getTemplate) | **GET** /templates/{template_id} | Check the status of an uploaded template
156
- *DocSpring.Client* | [**getTemplateModelCode**](docs/Client.md#getTemplateModelCode) | **GET** /templates/{template_id}/model_code | Generate typed model code for a template
157
- *DocSpring.Client* | [**getTemplateSchema**](docs/Client.md#getTemplateSchema) | **GET** /templates/{template_id}/schema | Fetch the JSON schema for a template
158
- *DocSpring.Client* | [**getWebhook**](docs/Client.md#getWebhook) | **GET** /webhooks/{webhook_id} | Get a webhook
159
- *DocSpring.Client* | [**listCombinedSubmissions**](docs/Client.md#listCombinedSubmissions) | **GET** /combined_submissions | Get a list of all combined submissions
160
- *DocSpring.Client* | [**listFolders**](docs/Client.md#listFolders) | **GET** /folders/ | Get a list of all folders
161
- *DocSpring.Client* | [**listSubmissions**](docs/Client.md#listSubmissions) | **GET** /submissions | List all submissions
162
- *DocSpring.Client* | [**listTemplateSubmissions**](docs/Client.md#listTemplateSubmissions) | **GET** /templates/{template_id}/submissions | List all submissions for a given template
163
- *DocSpring.Client* | [**listTemplates**](docs/Client.md#listTemplates) | **GET** /templates | Get a list of all templates
164
- *DocSpring.Client* | [**listWebhooks**](docs/Client.md#listWebhooks) | **GET** /webhooks | Get a list of all webhooks
165
- *DocSpring.Client* | [**moveFolderToFolder**](docs/Client.md#moveFolderToFolder) | **POST** /folders/{folder_id}/move | Move a folder
166
- *DocSpring.Client* | [**moveTemplateToFolder**](docs/Client.md#moveTemplateToFolder) | **POST** /templates/{template_id}/move | Move Template to folder
167
- *DocSpring.Client* | [**publishTemplateVersion**](docs/Client.md#publishTemplateVersion) | **POST** /templates/{template_id}/publish_version | Publish a template version
168
- *DocSpring.Client* | [**renameFolder**](docs/Client.md#renameFolder) | **POST** /folders/{folder_id}/rename | Rename a folder
169
- *DocSpring.Client* | [**restoreTemplateVersion**](docs/Client.md#restoreTemplateVersion) | **POST** /templates/{template_id}/restore_version | Restore a template version
170
- *DocSpring.Client* | [**testAuthentication**](docs/Client.md#testAuthentication) | **GET** /authentication | Test authentication
171
- *DocSpring.Client* | [**updateDataRequest**](docs/Client.md#updateDataRequest) | **PUT** /data_requests/{data_request_id} | Update a submission data request
172
- *DocSpring.Client* | [**updateTemplate**](docs/Client.md#updateTemplate) | **PUT** /templates/{template_id} | Update a Template
173
- *DocSpring.Client* | [**updateTemplateDocument**](docs/Client.md#updateTemplateDocument) | **PUT** /templates/{template_id}?endpoint_variant&#x3D;update_template_pdf_with_form_post | Update a template&#39;s document with a form POST file upload
174
- *DocSpring.Client* | [**updateTemplateDocumentFromUpload**](docs/Client.md#updateTemplateDocumentFromUpload) | **PUT** /templates/{template_id}?endpoint_variant&#x3D;update_template_pdf_with_cached_upload | Update a template&#39;s document with a cached S3 file upload
175
- *DocSpring.Client* | [**updateWebhook**](docs/Client.md#updateWebhook) | **PUT** /webhooks/{webhook_id} | Update a webhook
176
-
177
-
178
- ## Documentation for Models
179
-
180
- - [DocSpring.AddFieldsData](docs/AddFieldsData.md)
181
- - [DocSpring.BatchGeneratePdfs201Response](docs/BatchGeneratePdfs201Response.md)
182
- - [DocSpring.CombinePdfsData](docs/CombinePdfsData.md)
183
- - [DocSpring.CombinedSubmission](docs/CombinedSubmission.md)
184
- - [DocSpring.CombinedSubmissionAction](docs/CombinedSubmissionAction.md)
185
- - [DocSpring.CopyTemplateOptions](docs/CopyTemplateOptions.md)
186
- - [DocSpring.CreateCombinedSubmissionResponse](docs/CreateCombinedSubmissionResponse.md)
187
- - [DocSpring.CreateCustomFileData](docs/CreateCustomFileData.md)
188
- - [DocSpring.CreateCustomFileResponse](docs/CreateCustomFileResponse.md)
189
- - [DocSpring.CreateFolderData](docs/CreateFolderData.md)
190
- - [DocSpring.CreateHtmlTemplate](docs/CreateHtmlTemplate.md)
191
- - [DocSpring.CreatePdfSubmissionData](docs/CreatePdfSubmissionData.md)
192
- - [DocSpring.CreatePdfTemplate](docs/CreatePdfTemplate.md)
193
- - [DocSpring.CreateSubmissionDataRequestData](docs/CreateSubmissionDataRequestData.md)
194
- - [DocSpring.CreateSubmissionDataRequestEventRequest](docs/CreateSubmissionDataRequestEventRequest.md)
195
- - [DocSpring.CreateSubmissionDataRequestEventResponse](docs/CreateSubmissionDataRequestEventResponse.md)
196
- - [DocSpring.CreateSubmissionDataRequestResponse](docs/CreateSubmissionDataRequestResponse.md)
197
- - [DocSpring.CreateSubmissionDataRequestTokenResponse](docs/CreateSubmissionDataRequestTokenResponse.md)
198
- - [DocSpring.CreateSubmissionResponse](docs/CreateSubmissionResponse.md)
199
- - [DocSpring.CreateWebhookData](docs/CreateWebhookData.md)
200
- - [DocSpring.CustomFile](docs/CustomFile.md)
201
- - [DocSpring.ErrorOrMultipleErrorsResponse](docs/ErrorOrMultipleErrorsResponse.md)
202
- - [DocSpring.ErrorResponse](docs/ErrorResponse.md)
203
- - [DocSpring.Folder](docs/Folder.md)
204
- - [DocSpring.JsonSchema](docs/JsonSchema.md)
205
- - [DocSpring.ListSubmissionsResponse](docs/ListSubmissionsResponse.md)
206
- - [DocSpring.MoveFolderData](docs/MoveFolderData.md)
207
- - [DocSpring.MoveTemplateData](docs/MoveTemplateData.md)
208
- - [DocSpring.MultipleErrorsResponse](docs/MultipleErrorsResponse.md)
209
- - [DocSpring.PublishVersionData](docs/PublishVersionData.md)
210
- - [DocSpring.RenameFolderData](docs/RenameFolderData.md)
211
- - [DocSpring.RestoreVersionData](docs/RestoreVersionData.md)
212
- - [DocSpring.Submission](docs/Submission.md)
213
- - [DocSpring.Submission422Response](docs/Submission422Response.md)
214
- - [DocSpring.SubmissionAction](docs/SubmissionAction.md)
215
- - [DocSpring.SubmissionBatch](docs/SubmissionBatch.md)
216
- - [DocSpring.SubmissionBatchData](docs/SubmissionBatchData.md)
217
- - [DocSpring.SubmissionBatchWithSubmissions](docs/SubmissionBatchWithSubmissions.md)
218
- - [DocSpring.SubmissionDataRequest](docs/SubmissionDataRequest.md)
219
- - [DocSpring.SubmissionDataRequestEvent](docs/SubmissionDataRequestEvent.md)
220
- - [DocSpring.SubmissionDataRequestShow](docs/SubmissionDataRequestShow.md)
221
- - [DocSpring.SubmissionDataRequestToken](docs/SubmissionDataRequestToken.md)
222
- - [DocSpring.SubmissionPreview](docs/SubmissionPreview.md)
223
- - [DocSpring.SuccessErrorResponse](docs/SuccessErrorResponse.md)
224
- - [DocSpring.SuccessMultipleErrorsResponse](docs/SuccessMultipleErrorsResponse.md)
225
- - [DocSpring.Template](docs/Template.md)
226
- - [DocSpring.TemplateAddFieldsResponse](docs/TemplateAddFieldsResponse.md)
227
- - [DocSpring.TemplateDeleteResponse](docs/TemplateDeleteResponse.md)
228
- - [DocSpring.TemplateModelCodeResponse](docs/TemplateModelCodeResponse.md)
229
- - [DocSpring.TemplatePreview](docs/TemplatePreview.md)
230
- - [DocSpring.TemplatePublishVersionResponse](docs/TemplatePublishVersionResponse.md)
231
- - [DocSpring.UpdateHtmlTemplate](docs/UpdateHtmlTemplate.md)
232
- - [DocSpring.UpdatePdfTemplate](docs/UpdatePdfTemplate.md)
233
- - [DocSpring.UpdateSubmissionDataRequestData](docs/UpdateSubmissionDataRequestData.md)
234
- - [DocSpring.UpdateWebhookData](docs/UpdateWebhookData.md)
235
- - [DocSpring.UploadPresignResponse](docs/UploadPresignResponse.md)
236
- - [DocSpring.Webhook](docs/Webhook.md)
237
-
238
-
239
- ## Documentation for Authorization
240
-
241
-
242
- Authentication schemes defined for the API:
243
- ### api_token_basic
244
-
245
- - **Type**: HTTP basic authentication
246
-
86
+ By default the call waits for the PDF, for up to 95 seconds, and the submission in the response has its
87
+ `download_url`. Set `wait` to false to get a pending submission straight away.
88
+ [Sync vs. async processing](https://docspring.com/docs/api-guide/synchronous-requests/) covers the time limit, status
89
+ checks and webhooks.
90
+
91
+ ## Methods
92
+
93
+ [docs/Client.md](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md) has each method's parameters and return type, and
94
+ [docs/](https://github.com/DocSpring/docspring-javascript/tree/main/docs) has the models. The [API reference](https://docspring.com/docs/api/) has
95
+ JavaScript code for every method.
96
+
97
+ | Method | Description |
98
+ | ------ | ----------- |
99
+ | [`addFieldsToTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#addfieldstotemplate) | Add new fields to a Template |
100
+ | [`batchGeneratePdfs`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#batchgeneratepdfs) | Generate multiple PDFs |
101
+ | [`combinePdfs`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#combinepdfs) | Merge submission PDFs, template PDFs, or custom files |
102
+ | [`copyTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#copytemplate) | Copy a template |
103
+ | [`createCustomFileFromUpload`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createcustomfilefromupload) | Create a new custom file from a cached S3 upload |
104
+ | [`createDataRequestEvent`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createdatarequestevent) | Create a new event for emailing a signee a request for signature |
105
+ | [`createDataRequestToken`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createdatarequesttoken) | Create a new data request token for form authentication |
106
+ | [`createFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createfolder) | Create a folder |
107
+ | [`createHtmlTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createhtmltemplate) | Create a new HTML template |
108
+ | [`createPdfTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createpdftemplate) | Create a new PDF template with a form POST file upload |
109
+ | [`createPdfTemplateFromUpload`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createpdftemplatefromupload) | Create a new PDF template from a cached S3 file upload |
110
+ | [`createWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createwebhook) | Create a webhook |
111
+ | [`deleteFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#deletefolder) | Delete a folder |
112
+ | [`deleteTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#deletetemplate) | Delete a template |
113
+ | [`deleteWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#deletewebhook) | Delete a webhook |
114
+ | [`expireCombinedSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#expirecombinedsubmission) | Expire a combined submission |
115
+ | [`expireSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#expiresubmission) | Expire a PDF submission |
116
+ | [`generatePdf`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#generatepdf) | Generate a PDF |
117
+ | [`generatePreview`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#generatepreview) | Generate a preview PDF for partially completed data requests |
118
+ | [`getCombinedSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getcombinedsubmission) | Check the status of a combined submission (merged PDFs) |
119
+ | [`getDataRequest`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getdatarequest) | Look up a submission data request |
120
+ | [`getFullTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getfulltemplate) | Fetch the full attributes for a PDF template |
121
+ | [`getPresignUrl`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getpresignurl) | Get a presigned S3 URL for direct file upload |
122
+ | [`getSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getsubmission) | Check the status of a PDF |
123
+ | [`getSubmissionBatch`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getsubmissionbatch) | Check the status of a submission batch job |
124
+ | [`getTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplate) | Check the status of an uploaded template |
125
+ | [`getTemplateModelCode`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplatemodelcode) | Generate typed model code for a template |
126
+ | [`getTemplateSchema`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplateschema) | Fetch the JSON schema for a template |
127
+ | [`getWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getwebhook) | Get a webhook |
128
+ | [`listCombinedSubmissions`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listcombinedsubmissions) | Get a list of all combined submissions |
129
+ | [`listFolders`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listfolders) | Get a list of all folders |
130
+ | [`listSubmissions`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listsubmissions) | List all submissions |
131
+ | [`listTemplates`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listtemplates) | Get a list of all templates |
132
+ | [`listTemplateSubmissions`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listtemplatesubmissions) | List all submissions for a given template |
133
+ | [`listWebhooks`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listwebhooks) | Get a list of all webhooks |
134
+ | [`moveFolderToFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#movefoldertofolder) | Move a folder |
135
+ | [`moveTemplateToFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#movetemplatetofolder) | Move Template to folder |
136
+ | [`publishTemplateVersion`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#publishtemplateversion) | Publish a template version |
137
+ | [`renameFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#renamefolder) | Rename a folder |
138
+ | [`restoreTemplateVersion`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#restoretemplateversion) | Restore a template version |
139
+ | [`testAuthentication`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#testauthentication) | Test authentication |
140
+ | [`updateDataRequest`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatedatarequest) | Update a submission data request |
141
+ | [`updateTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatetemplate) | Update a Template |
142
+ | [`updateTemplateDocument`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatetemplatedocument) | Update a template's document with a form POST file upload |
143
+ | [`updateTemplateDocumentFromUpload`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatetemplatedocumentfromupload) | Update a template's document with a cached S3 file upload |
144
+ | [`updateWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatewebhook) | Update a webhook |
145
+
146
+ ## Errors
147
+
148
+ The callback gets `(error, data, response)`. For an error response, `error.status` is the HTTP status and `response.body` the parsed body.
149
+
150
+ ## API changes
151
+
152
+ DocSpring adds fields and enum values to API v1 without releasing a new API version. Changes that would break
153
+ existing code, such as removing or renaming a field, go in a new API version
154
+ ([API changes](https://docspring.com/docs/api-guide/openapi-schema/#api-changes)). So this SDK keeps working with
155
+ responses that are newer than it is:
156
+
157
+ - The model object keeps a response field added to the API after this release as a property.
158
+ - An enum value added to the API after this release comes back as a string, so handle values you don't recognize.
159
+
160
+ Upgrade the SDK to read new fields and enum values. The [changelog](https://github.com/DocSpring/docspring-javascript/blob/main/CHANGELOG.md) lists
161
+ what each release adds.
162
+
163
+ ## About this SDK
164
+
165
+ This SDK is generated from DocSpring's [OpenAPI spec](https://docspring.com/api-docs/v1/openapi.json) with
166
+ [DocSpring's fork of OpenAPI Generator](https://github.com/DocSpring/openapi-generator/tree/docspring/all_patches) 7.16.0.
167
+ The fork doesn't change the JavaScript generator.
168
+
169
+ On top of the generated code, we add:
170
+
171
+ - A client constructor that reads your credentials, region and host from the environment.
172
+
173
+ Because the code is generated, we can't merge pull requests that change it. Please
174
+ [open an issue](https://github.com/DocSpring/docspring-javascript/issues) or email [support@docspring.com](mailto:support@docspring.com) instead, and
175
+ we'll fix it in the generator. [AGENTS.md](https://github.com/DocSpring/docspring-javascript/blob/main/AGENTS.md) is a short guide for AI coding agents.
176
+
177
+ ## License
178
+
179
+ MIT. See [LICENSE](https://github.com/DocSpring/docspring-javascript/blob/main/LICENSE).
package/dist/ApiClient.js CHANGED
@@ -25,7 +25,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
25
25
  */
26
26
  /**
27
27
  * @module ApiClient
28
- * @version 3.1.0
28
+ * @version 3.2.0
29
29
  */
30
30
  /**
31
31
  * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
@@ -66,7 +66,7 @@ var ApiClient = /*#__PURE__*/function () {
66
66
  * @default {}
67
67
  */
68
68
  this.defaultHeaders = {
69
- 'User-Agent': 'docspring-javascript-3.1.0'
69
+ 'User-Agent': 'docspring-javascript-3.2.0'
70
70
  };
71
71
 
72
72
  /**
@@ -75,7 +75,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
75
75
  /**
76
76
  * Client service.
77
77
  * @module api/Client
78
- * @version 3.1.0
78
+ * @version 3.2.0
79
79
  */
80
80
  var Client = exports["default"] = /*#__PURE__*/function () {
81
81
  /**
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
29
29
  /**
30
30
  * The AddFieldsData model module.
31
31
  * @module model/AddFieldsData
32
- * @version 3.1.0
32
+ * @version 3.2.0
33
33
  */
34
34
  var AddFieldsData = /*#__PURE__*/function () {
35
35
  /**
@@ -30,12 +30,13 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
30
30
  /**
31
31
  * The BatchGeneratePdfs201Response model module.
32
32
  * @module model/BatchGeneratePdfs201Response
33
- * @version 3.1.0
33
+ * @version 3.2.0
34
34
  */
35
35
  var BatchGeneratePdfs201Response = /*#__PURE__*/function () {
36
36
  /**
37
37
  * Constructs a new <code>BatchGeneratePdfs201Response</code>.
38
38
  * @alias module:model/BatchGeneratePdfs201Response
39
+ * @extends Object
39
40
  * @param status {module:model/BatchGeneratePdfs201Response.StatusEnum}
40
41
  * @param submission_batch {module:model/SubmissionBatch}
41
42
  * @param submissions {Array.<Object>}
@@ -70,6 +71,7 @@ var BatchGeneratePdfs201Response = /*#__PURE__*/function () {
70
71
  value: function constructFromObject(data, obj) {
71
72
  if (data) {
72
73
  obj = obj || new BatchGeneratePdfs201Response();
74
+ _ApiClient["default"].constructFromObject(data, obj, 'Object');
73
75
  if (data.hasOwnProperty('status')) {
74
76
  obj['status'] = _ApiClient["default"].convertToType(data['status'], 'String');
75
77
  }
@@ -124,11 +126,6 @@ var BatchGeneratePdfs201Response = /*#__PURE__*/function () {
124
126
  if (!Array.isArray(data['errors'])) {
125
127
  throw new Error("Expected the field `errors` to be an array in the JSON data but got " + data['errors']);
126
128
  }
127
- // validate the optional field `submission_batch`
128
- if (data['submission_batch']) {
129
- // data not null
130
- _SubmissionBatch["default"].validateJSON(data['submission_batch']);
131
- }
132
129
  // ensure the json data is an array
133
130
  if (!Array.isArray(data['submissions'])) {
134
131
  throw new Error("Expected the field `submissions` to be an array in the JSON data but got " + data['submissions']);
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
29
29
  /**
30
30
  * The CombinePdfsData model module.
31
31
  * @module model/CombinePdfsData
32
- * @version 3.1.0
32
+ * @version 3.2.0
33
33
  */
34
34
  var CombinePdfsData = /*#__PURE__*/function () {
35
35
  /**
@@ -30,12 +30,13 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
30
30
  /**
31
31
  * The CombinedSubmission model module.
32
32
  * @module model/CombinedSubmission
33
- * @version 3.1.0
33
+ * @version 3.2.0
34
34
  */
35
35
  var CombinedSubmission = /*#__PURE__*/function () {
36
36
  /**
37
37
  * Constructs a new <code>CombinedSubmission</code>.
38
38
  * @alias module:model/CombinedSubmission
39
+ * @extends Object
39
40
  * @param id {String}
40
41
  * @param state {module:model/CombinedSubmission.StateEnum}
41
42
  * @param expired {Boolean}
@@ -92,6 +93,7 @@ var CombinedSubmission = /*#__PURE__*/function () {
92
93
  value: function constructFromObject(data, obj) {
93
94
  if (data) {
94
95
  obj = obj || new CombinedSubmission();
96
+ _ApiClient["default"].constructFromObject(data, obj, 'Object');
95
97
  if (data.hasOwnProperty('id')) {
96
98
  obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String');
97
99
  }
@@ -201,26 +203,9 @@ var CombinedSubmission = /*#__PURE__*/function () {
201
203
  if (data['download_url'] && !(typeof data['download_url'] === 'string' || data['download_url'] instanceof String)) {
202
204
  throw new Error("Expected the field `download_url` to be a primitive type in the JSON string but got " + data['download_url']);
203
205
  }
204
- if (data['actions']) {
205
- // data not null
206
- // ensure the json data is an array
207
- if (!Array.isArray(data['actions'])) {
208
- throw new Error("Expected the field `actions` to be an array in the JSON data but got " + data['actions']);
209
- }
210
- // validate the optional field `actions` (array)
211
- var _iterator2 = _createForOfIteratorHelper(data['actions']),
212
- _step2;
213
- try {
214
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
215
- var item = _step2.value;
216
- _CombinedSubmissionAction["default"].validateJSON(item);
217
- }
218
- } catch (err) {
219
- _iterator2.e(err);
220
- } finally {
221
- _iterator2.f();
222
- }
223
- ;
206
+ // ensure the json data is an array
207
+ if (!Array.isArray(data['actions'])) {
208
+ throw new Error("Expected the field `actions` to be an array in the JSON data but got " + data['actions']);
224
209
  }
225
210
  return true;
226
211
  }
@@ -29,12 +29,13 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
29
29
  /**
30
30
  * The CombinedSubmissionAction model module.
31
31
  * @module model/CombinedSubmissionAction
32
- * @version 3.1.0
32
+ * @version 3.2.0
33
33
  */
34
34
  var CombinedSubmissionAction = /*#__PURE__*/function () {
35
35
  /**
36
36
  * Constructs a new <code>CombinedSubmissionAction</code>.
37
37
  * @alias module:model/CombinedSubmissionAction
38
+ * @extends Object
38
39
  * @param id {String}
39
40
  * @param integration_id {String}
40
41
  * @param state {module:model/CombinedSubmissionAction.StateEnum}
@@ -77,6 +78,7 @@ var CombinedSubmissionAction = /*#__PURE__*/function () {
77
78
  value: function constructFromObject(data, obj) {
78
79
  if (data) {
79
80
  obj = obj || new CombinedSubmissionAction();
81
+ _ApiClient["default"].constructFromObject(data, obj, 'Object');
80
82
  if (data.hasOwnProperty('id')) {
81
83
  obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String');
82
84
  }