docspring 3.1.0__py3-none-any.whl
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.
- docspring/__init__.py +250 -0
- docspring/api/__init__.py +20 -0
- docspring/api/client.py +13430 -0
- docspring/api_client.py +805 -0
- docspring/api_response.py +21 -0
- docspring/configuration.py +598 -0
- docspring/exceptions.py +217 -0
- docspring/models/__init__.py +146 -0
- docspring/models/add_fields_data.py +88 -0
- docspring/models/batch_generate_pdfs201_response.py +111 -0
- docspring/models/combine_pdfs_data.py +98 -0
- docspring/models/combined_submission.py +173 -0
- docspring/models/combined_submission_action.py +156 -0
- docspring/models/copy_template_options.py +92 -0
- docspring/models/create_combined_submission_response.py +107 -0
- docspring/models/create_custom_file_data.py +89 -0
- docspring/models/create_custom_file_response.py +107 -0
- docspring/models/create_folder_data.py +88 -0
- docspring/models/create_html_template.py +88 -0
- docspring/models/create_pdf_submission_data.py +112 -0
- docspring/models/create_pdf_template.py +88 -0
- docspring/models/create_submission_data_request_data.py +187 -0
- docspring/models/create_submission_data_request_event_request.py +134 -0
- docspring/models/create_submission_data_request_event_response.py +107 -0
- docspring/models/create_submission_data_request_response.py +107 -0
- docspring/models/create_submission_data_request_token_response.py +107 -0
- docspring/models/create_submission_response.py +107 -0
- docspring/models/create_webhook_data.py +88 -0
- docspring/models/custom_file.py +100 -0
- docspring/models/error_or_multiple_errors_response.py +103 -0
- docspring/models/error_response.py +101 -0
- docspring/models/folder.py +114 -0
- docspring/models/json_schema.py +110 -0
- docspring/models/list_submissions_response.py +105 -0
- docspring/models/move_folder_data.py +93 -0
- docspring/models/move_template_data.py +95 -0
- docspring/models/multiple_errors_response.py +101 -0
- docspring/models/publish_version_data.py +90 -0
- docspring/models/rename_folder_data.py +88 -0
- docspring/models/restore_version_data.py +88 -0
- docspring/models/submission.py +287 -0
- docspring/models/submission422_response.py +109 -0
- docspring/models/submission_action.py +148 -0
- docspring/models/submission_batch.py +123 -0
- docspring/models/submission_batch_data.py +106 -0
- docspring/models/submission_batch_with_submissions.py +133 -0
- docspring/models/submission_data_request.py +253 -0
- docspring/models/submission_data_request_event.py +155 -0
- docspring/models/submission_data_request_show.py +260 -0
- docspring/models/submission_data_request_token.py +109 -0
- docspring/models/submission_preview.py +257 -0
- docspring/models/success_error_response.py +101 -0
- docspring/models/success_multiple_errors_response.py +101 -0
- docspring/models/template.py +402 -0
- docspring/models/template_add_fields_response.py +103 -0
- docspring/models/template_delete_response.py +110 -0
- docspring/models/template_model_code_response.py +103 -0
- docspring/models/template_preview.py +356 -0
- docspring/models/template_publish_version_response.py +103 -0
- docspring/models/update_html_template.py +88 -0
- docspring/models/update_pdf_template.py +88 -0
- docspring/models/update_submission_data_request_data.py +185 -0
- docspring/models/update_webhook_data.py +88 -0
- docspring/models/upload_presign_response.py +108 -0
- docspring/models/webhook.py +185 -0
- docspring/py.typed +0 -0
- docspring/rest.py +259 -0
- docspring-3.1.0.dist-info/METADATA +245 -0
- docspring-3.1.0.dist-info/RECORD +72 -0
- docspring-3.1.0.dist-info/WHEEL +5 -0
- docspring-3.1.0.dist-info/licenses/LICENSE +7 -0
- docspring-3.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DocSpring API
|
|
5
|
+
|
|
6
|
+
Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Contact: support@docspring.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr, ValidationInfo, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from docspring.models.submission_action import SubmissionAction
|
|
24
|
+
from docspring.models.submission_data_request import SubmissionDataRequest
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class Submission(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Submission
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
batch_id: Optional[StrictStr]
|
|
33
|
+
data_requests: List[SubmissionDataRequest]
|
|
34
|
+
editable: Optional[StrictBool]
|
|
35
|
+
error_message: Optional[StrictStr]
|
|
36
|
+
expired: StrictBool
|
|
37
|
+
expires_at: Optional[StrictStr]
|
|
38
|
+
id: Optional[StrictStr]
|
|
39
|
+
json_schema_errors: Optional[List[StrictStr]]
|
|
40
|
+
metadata: Dict[str, Any]
|
|
41
|
+
password: Optional[StrictStr]
|
|
42
|
+
processed_at: Optional[StrictStr]
|
|
43
|
+
state: StrictStr
|
|
44
|
+
template_id: Optional[StrictStr]
|
|
45
|
+
template_type: StrictStr
|
|
46
|
+
template_version: Optional[StrictStr]
|
|
47
|
+
test: StrictBool
|
|
48
|
+
truncated_text: Optional[Dict[str, Any]]
|
|
49
|
+
pdf_hash: Optional[StrictStr]
|
|
50
|
+
download_url: Optional[StrictStr]
|
|
51
|
+
permanent_download_url: Optional[StrictStr]
|
|
52
|
+
preview_download_url: Optional[StrictStr]
|
|
53
|
+
preview_generated_at: Optional[StrictStr]
|
|
54
|
+
audit_trail_download_url: Optional[StrictStr]
|
|
55
|
+
actions: List[SubmissionAction]
|
|
56
|
+
source: Optional[StrictStr] = None
|
|
57
|
+
referrer: Optional[StrictStr] = None
|
|
58
|
+
data: Optional[Dict[str, Any]] = None
|
|
59
|
+
__properties: ClassVar[List[str]] = ["batch_id", "data_requests", "editable", "error_message", "expired", "expires_at", "id", "json_schema_errors", "metadata", "password", "processed_at", "state", "template_id", "template_type", "template_version", "test", "truncated_text", "pdf_hash", "download_url", "permanent_download_url", "preview_download_url", "preview_generated_at", "audit_trail_download_url", "actions", "source", "referrer", "data"]
|
|
60
|
+
|
|
61
|
+
@field_validator('state')
|
|
62
|
+
def state_validate_enum(cls, value, info: ValidationInfo):
|
|
63
|
+
"""Validates the enum"""
|
|
64
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
65
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
66
|
+
return value
|
|
67
|
+
|
|
68
|
+
if value not in set(['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked', 'accidental', 'declined']):
|
|
69
|
+
raise ValueError("must be one of enum values ('pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked', 'accidental', 'declined')")
|
|
70
|
+
return value
|
|
71
|
+
|
|
72
|
+
@field_validator('template_type')
|
|
73
|
+
def template_type_validate_enum(cls, value, info: ValidationInfo):
|
|
74
|
+
"""Validates the enum"""
|
|
75
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
76
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
77
|
+
return value
|
|
78
|
+
|
|
79
|
+
if value not in set(['pdf', 'html']):
|
|
80
|
+
raise ValueError("must be one of enum values ('pdf', 'html')")
|
|
81
|
+
return value
|
|
82
|
+
|
|
83
|
+
@field_validator('source')
|
|
84
|
+
def source_validate_enum(cls, value, info: ValidationInfo):
|
|
85
|
+
"""Validates the enum"""
|
|
86
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
87
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
88
|
+
return value
|
|
89
|
+
|
|
90
|
+
if value is None:
|
|
91
|
+
return value
|
|
92
|
+
|
|
93
|
+
if value not in set(['api', 'web', 'reprocess', 'webhook']):
|
|
94
|
+
raise ValueError("must be one of enum values ('api', 'web', 'reprocess', 'webhook')")
|
|
95
|
+
return value
|
|
96
|
+
|
|
97
|
+
model_config = ConfigDict(
|
|
98
|
+
populate_by_name=True,
|
|
99
|
+
validate_assignment=True,
|
|
100
|
+
protected_namespaces=(),
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def to_str(self) -> str:
|
|
105
|
+
"""Returns the string representation of the model using alias"""
|
|
106
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
107
|
+
|
|
108
|
+
def to_json(self) -> str:
|
|
109
|
+
"""Returns the JSON representation of the model using alias"""
|
|
110
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
111
|
+
return json.dumps(self.to_dict())
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
115
|
+
"""Create an instance of Submission from a JSON string"""
|
|
116
|
+
return cls.from_dict(json.loads(json_str))
|
|
117
|
+
|
|
118
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
119
|
+
"""Return the dictionary representation of the model using alias.
|
|
120
|
+
|
|
121
|
+
This has the following differences from calling pydantic's
|
|
122
|
+
`self.model_dump(by_alias=True)`:
|
|
123
|
+
|
|
124
|
+
* `None` is only added to the output dict for nullable fields that
|
|
125
|
+
were set at model initialization. Other fields with value `None`
|
|
126
|
+
are ignored.
|
|
127
|
+
"""
|
|
128
|
+
excluded_fields: Set[str] = set([
|
|
129
|
+
])
|
|
130
|
+
|
|
131
|
+
_dict = self.model_dump(
|
|
132
|
+
by_alias=True,
|
|
133
|
+
exclude=excluded_fields,
|
|
134
|
+
exclude_none=True,
|
|
135
|
+
)
|
|
136
|
+
# override the default output from pydantic by calling `to_dict()` of each item in data_requests (list)
|
|
137
|
+
_items = []
|
|
138
|
+
if self.data_requests:
|
|
139
|
+
for _item_data_requests in self.data_requests:
|
|
140
|
+
if _item_data_requests:
|
|
141
|
+
_items.append(_item_data_requests.to_dict())
|
|
142
|
+
_dict['data_requests'] = _items
|
|
143
|
+
# override the default output from pydantic by calling `to_dict()` of each item in actions (list)
|
|
144
|
+
_items = []
|
|
145
|
+
if self.actions:
|
|
146
|
+
for _item_actions in self.actions:
|
|
147
|
+
if _item_actions:
|
|
148
|
+
_items.append(_item_actions.to_dict())
|
|
149
|
+
_dict['actions'] = _items
|
|
150
|
+
# set to None if batch_id (nullable) is None
|
|
151
|
+
# and model_fields_set contains the field
|
|
152
|
+
if self.batch_id is None and "batch_id" in self.model_fields_set:
|
|
153
|
+
_dict['batch_id'] = None
|
|
154
|
+
|
|
155
|
+
# set to None if editable (nullable) is None
|
|
156
|
+
# and model_fields_set contains the field
|
|
157
|
+
if self.editable is None and "editable" in self.model_fields_set:
|
|
158
|
+
_dict['editable'] = None
|
|
159
|
+
|
|
160
|
+
# set to None if error_message (nullable) is None
|
|
161
|
+
# and model_fields_set contains the field
|
|
162
|
+
if self.error_message is None and "error_message" in self.model_fields_set:
|
|
163
|
+
_dict['error_message'] = None
|
|
164
|
+
|
|
165
|
+
# set to None if expires_at (nullable) is None
|
|
166
|
+
# and model_fields_set contains the field
|
|
167
|
+
if self.expires_at is None and "expires_at" in self.model_fields_set:
|
|
168
|
+
_dict['expires_at'] = None
|
|
169
|
+
|
|
170
|
+
# set to None if id (nullable) is None
|
|
171
|
+
# and model_fields_set contains the field
|
|
172
|
+
if self.id is None and "id" in self.model_fields_set:
|
|
173
|
+
_dict['id'] = None
|
|
174
|
+
|
|
175
|
+
# set to None if json_schema_errors (nullable) is None
|
|
176
|
+
# and model_fields_set contains the field
|
|
177
|
+
if self.json_schema_errors is None and "json_schema_errors" in self.model_fields_set:
|
|
178
|
+
_dict['json_schema_errors'] = None
|
|
179
|
+
|
|
180
|
+
# set to None if password (nullable) is None
|
|
181
|
+
# and model_fields_set contains the field
|
|
182
|
+
if self.password is None and "password" in self.model_fields_set:
|
|
183
|
+
_dict['password'] = None
|
|
184
|
+
|
|
185
|
+
# set to None if processed_at (nullable) is None
|
|
186
|
+
# and model_fields_set contains the field
|
|
187
|
+
if self.processed_at is None and "processed_at" in self.model_fields_set:
|
|
188
|
+
_dict['processed_at'] = None
|
|
189
|
+
|
|
190
|
+
# set to None if template_id (nullable) is None
|
|
191
|
+
# and model_fields_set contains the field
|
|
192
|
+
if self.template_id is None and "template_id" in self.model_fields_set:
|
|
193
|
+
_dict['template_id'] = None
|
|
194
|
+
|
|
195
|
+
# set to None if template_version (nullable) is None
|
|
196
|
+
# and model_fields_set contains the field
|
|
197
|
+
if self.template_version is None and "template_version" in self.model_fields_set:
|
|
198
|
+
_dict['template_version'] = None
|
|
199
|
+
|
|
200
|
+
# set to None if truncated_text (nullable) is None
|
|
201
|
+
# and model_fields_set contains the field
|
|
202
|
+
if self.truncated_text is None and "truncated_text" in self.model_fields_set:
|
|
203
|
+
_dict['truncated_text'] = None
|
|
204
|
+
|
|
205
|
+
# set to None if pdf_hash (nullable) is None
|
|
206
|
+
# and model_fields_set contains the field
|
|
207
|
+
if self.pdf_hash is None and "pdf_hash" in self.model_fields_set:
|
|
208
|
+
_dict['pdf_hash'] = None
|
|
209
|
+
|
|
210
|
+
# set to None if download_url (nullable) is None
|
|
211
|
+
# and model_fields_set contains the field
|
|
212
|
+
if self.download_url is None and "download_url" in self.model_fields_set:
|
|
213
|
+
_dict['download_url'] = None
|
|
214
|
+
|
|
215
|
+
# set to None if permanent_download_url (nullable) is None
|
|
216
|
+
# and model_fields_set contains the field
|
|
217
|
+
if self.permanent_download_url is None and "permanent_download_url" in self.model_fields_set:
|
|
218
|
+
_dict['permanent_download_url'] = None
|
|
219
|
+
|
|
220
|
+
# set to None if preview_download_url (nullable) is None
|
|
221
|
+
# and model_fields_set contains the field
|
|
222
|
+
if self.preview_download_url is None and "preview_download_url" in self.model_fields_set:
|
|
223
|
+
_dict['preview_download_url'] = None
|
|
224
|
+
|
|
225
|
+
# set to None if preview_generated_at (nullable) is None
|
|
226
|
+
# and model_fields_set contains the field
|
|
227
|
+
if self.preview_generated_at is None and "preview_generated_at" in self.model_fields_set:
|
|
228
|
+
_dict['preview_generated_at'] = None
|
|
229
|
+
|
|
230
|
+
# set to None if audit_trail_download_url (nullable) is None
|
|
231
|
+
# and model_fields_set contains the field
|
|
232
|
+
if self.audit_trail_download_url is None and "audit_trail_download_url" in self.model_fields_set:
|
|
233
|
+
_dict['audit_trail_download_url'] = None
|
|
234
|
+
|
|
235
|
+
# set to None if referrer (nullable) is None
|
|
236
|
+
# and model_fields_set contains the field
|
|
237
|
+
if self.referrer is None and "referrer" in self.model_fields_set:
|
|
238
|
+
_dict['referrer'] = None
|
|
239
|
+
|
|
240
|
+
# set to None if data (nullable) is None
|
|
241
|
+
# and model_fields_set contains the field
|
|
242
|
+
if self.data is None and "data" in self.model_fields_set:
|
|
243
|
+
_dict['data'] = None
|
|
244
|
+
|
|
245
|
+
return _dict
|
|
246
|
+
|
|
247
|
+
@classmethod
|
|
248
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
249
|
+
"""Create an instance of Submission from a dict"""
|
|
250
|
+
if obj is None:
|
|
251
|
+
return None
|
|
252
|
+
|
|
253
|
+
if not isinstance(obj, dict):
|
|
254
|
+
return cls.model_validate(obj, context={"skip_enum_validation": True})
|
|
255
|
+
|
|
256
|
+
_obj = cls.model_validate({
|
|
257
|
+
"batch_id": obj.get("batch_id"),
|
|
258
|
+
"data_requests": [SubmissionDataRequest.from_dict(_item) for _item in obj["data_requests"]] if obj.get("data_requests") is not None else None,
|
|
259
|
+
"editable": obj.get("editable"),
|
|
260
|
+
"error_message": obj.get("error_message"),
|
|
261
|
+
"expired": obj.get("expired"),
|
|
262
|
+
"expires_at": obj.get("expires_at"),
|
|
263
|
+
"id": obj.get("id"),
|
|
264
|
+
"json_schema_errors": obj.get("json_schema_errors"),
|
|
265
|
+
"metadata": obj.get("metadata"),
|
|
266
|
+
"password": obj.get("password"),
|
|
267
|
+
"processed_at": obj.get("processed_at"),
|
|
268
|
+
"state": obj.get("state"),
|
|
269
|
+
"template_id": obj.get("template_id"),
|
|
270
|
+
"template_type": obj.get("template_type"),
|
|
271
|
+
"template_version": obj.get("template_version"),
|
|
272
|
+
"test": obj.get("test"),
|
|
273
|
+
"truncated_text": obj.get("truncated_text"),
|
|
274
|
+
"pdf_hash": obj.get("pdf_hash"),
|
|
275
|
+
"download_url": obj.get("download_url"),
|
|
276
|
+
"permanent_download_url": obj.get("permanent_download_url"),
|
|
277
|
+
"preview_download_url": obj.get("preview_download_url"),
|
|
278
|
+
"preview_generated_at": obj.get("preview_generated_at"),
|
|
279
|
+
"audit_trail_download_url": obj.get("audit_trail_download_url"),
|
|
280
|
+
"actions": [SubmissionAction.from_dict(_item) for _item in obj["actions"]] if obj.get("actions") is not None else None,
|
|
281
|
+
"source": obj.get("source"),
|
|
282
|
+
"referrer": obj.get("referrer"),
|
|
283
|
+
"data": obj.get("data")
|
|
284
|
+
}, context={"skip_enum_validation": True})
|
|
285
|
+
return _obj
|
|
286
|
+
|
|
287
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DocSpring API
|
|
5
|
+
|
|
6
|
+
Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Contact: support@docspring.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationInfo, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from docspring.models.submission_preview import SubmissionPreview
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class Submission422Response(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Submission422Response
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
status: StrictStr
|
|
32
|
+
error: Optional[StrictStr] = Field(default=None, description="Single error message (for non-validation errors)")
|
|
33
|
+
submission: Optional[SubmissionPreview] = None
|
|
34
|
+
errors: Optional[List[StrictStr]] = Field(default=None, description="Array of validation error messages (when submission data is invalid)")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["status", "error", "submission", "errors"]
|
|
36
|
+
|
|
37
|
+
@field_validator('status')
|
|
38
|
+
def status_validate_enum(cls, value, info: ValidationInfo):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
41
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
if value not in set(['error']):
|
|
45
|
+
raise ValueError("must be one of enum values ('error')")
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(
|
|
49
|
+
populate_by_name=True,
|
|
50
|
+
validate_assignment=True,
|
|
51
|
+
protected_namespaces=(),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
62
|
+
return json.dumps(self.to_dict())
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
66
|
+
"""Create an instance of Submission422Response from a JSON string"""
|
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
|
68
|
+
|
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
|
71
|
+
|
|
72
|
+
This has the following differences from calling pydantic's
|
|
73
|
+
`self.model_dump(by_alias=True)`:
|
|
74
|
+
|
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
|
76
|
+
were set at model initialization. Other fields with value `None`
|
|
77
|
+
are ignored.
|
|
78
|
+
"""
|
|
79
|
+
excluded_fields: Set[str] = set([
|
|
80
|
+
])
|
|
81
|
+
|
|
82
|
+
_dict = self.model_dump(
|
|
83
|
+
by_alias=True,
|
|
84
|
+
exclude=excluded_fields,
|
|
85
|
+
exclude_none=True,
|
|
86
|
+
)
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of submission
|
|
88
|
+
if self.submission:
|
|
89
|
+
_dict['submission'] = self.submission.to_dict()
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of Submission422Response from a dict"""
|
|
95
|
+
if obj is None:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
if not isinstance(obj, dict):
|
|
99
|
+
return cls.model_validate(obj, context={"skip_enum_validation": True})
|
|
100
|
+
|
|
101
|
+
_obj = cls.model_validate({
|
|
102
|
+
"status": obj.get("status"),
|
|
103
|
+
"error": obj.get("error"),
|
|
104
|
+
"submission": SubmissionPreview.from_dict(obj["submission"]) if obj.get("submission") is not None else None,
|
|
105
|
+
"errors": obj.get("errors")
|
|
106
|
+
}, context={"skip_enum_validation": True})
|
|
107
|
+
return _obj
|
|
108
|
+
|
|
109
|
+
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DocSpring API
|
|
5
|
+
|
|
6
|
+
Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Contact: support@docspring.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, ValidationInfo, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class SubmissionAction(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
SubmissionAction
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: Optional[StrictStr]
|
|
31
|
+
integration_id: Optional[StrictStr]
|
|
32
|
+
state: StrictStr
|
|
33
|
+
action_type: StrictStr
|
|
34
|
+
action_category: StrictStr
|
|
35
|
+
result_data: Dict[str, Any]
|
|
36
|
+
error_message: Optional[StrictStr]
|
|
37
|
+
__properties: ClassVar[List[str]] = ["id", "integration_id", "state", "action_type", "action_category", "result_data", "error_message"]
|
|
38
|
+
|
|
39
|
+
@field_validator('state')
|
|
40
|
+
def state_validate_enum(cls, value, info: ValidationInfo):
|
|
41
|
+
"""Validates the enum"""
|
|
42
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
43
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
44
|
+
return value
|
|
45
|
+
|
|
46
|
+
if value not in set(['pending', 'processed', 'failed', 'error']):
|
|
47
|
+
raise ValueError("must be one of enum values ('pending', 'processed', 'failed', 'error')")
|
|
48
|
+
return value
|
|
49
|
+
|
|
50
|
+
@field_validator('action_type')
|
|
51
|
+
def action_type_validate_enum(cls, value, info: ValidationInfo):
|
|
52
|
+
"""Validates the enum"""
|
|
53
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
54
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
if value not in set(['webhook', 'slack_webhook', 'email', 'aws_s3_upload']):
|
|
58
|
+
raise ValueError("must be one of enum values ('webhook', 'slack_webhook', 'email', 'aws_s3_upload')")
|
|
59
|
+
return value
|
|
60
|
+
|
|
61
|
+
@field_validator('action_category')
|
|
62
|
+
def action_category_validate_enum(cls, value, info: ValidationInfo):
|
|
63
|
+
"""Validates the enum"""
|
|
64
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
65
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
66
|
+
return value
|
|
67
|
+
|
|
68
|
+
if value not in set(['notification', 'file_upload']):
|
|
69
|
+
raise ValueError("must be one of enum values ('notification', 'file_upload')")
|
|
70
|
+
return value
|
|
71
|
+
|
|
72
|
+
model_config = ConfigDict(
|
|
73
|
+
populate_by_name=True,
|
|
74
|
+
validate_assignment=True,
|
|
75
|
+
protected_namespaces=(),
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def to_str(self) -> str:
|
|
80
|
+
"""Returns the string representation of the model using alias"""
|
|
81
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
82
|
+
|
|
83
|
+
def to_json(self) -> str:
|
|
84
|
+
"""Returns the JSON representation of the model using alias"""
|
|
85
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
86
|
+
return json.dumps(self.to_dict())
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of SubmissionAction from a JSON string"""
|
|
91
|
+
return cls.from_dict(json.loads(json_str))
|
|
92
|
+
|
|
93
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
94
|
+
"""Return the dictionary representation of the model using alias.
|
|
95
|
+
|
|
96
|
+
This has the following differences from calling pydantic's
|
|
97
|
+
`self.model_dump(by_alias=True)`:
|
|
98
|
+
|
|
99
|
+
* `None` is only added to the output dict for nullable fields that
|
|
100
|
+
were set at model initialization. Other fields with value `None`
|
|
101
|
+
are ignored.
|
|
102
|
+
"""
|
|
103
|
+
excluded_fields: Set[str] = set([
|
|
104
|
+
])
|
|
105
|
+
|
|
106
|
+
_dict = self.model_dump(
|
|
107
|
+
by_alias=True,
|
|
108
|
+
exclude=excluded_fields,
|
|
109
|
+
exclude_none=True,
|
|
110
|
+
)
|
|
111
|
+
# set to None if id (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.id is None and "id" in self.model_fields_set:
|
|
114
|
+
_dict['id'] = None
|
|
115
|
+
|
|
116
|
+
# set to None if integration_id (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.integration_id is None and "integration_id" in self.model_fields_set:
|
|
119
|
+
_dict['integration_id'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if error_message (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.error_message is None and "error_message" in self.model_fields_set:
|
|
124
|
+
_dict['error_message'] = None
|
|
125
|
+
|
|
126
|
+
return _dict
|
|
127
|
+
|
|
128
|
+
@classmethod
|
|
129
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
130
|
+
"""Create an instance of SubmissionAction from a dict"""
|
|
131
|
+
if obj is None:
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
if not isinstance(obj, dict):
|
|
135
|
+
return cls.model_validate(obj, context={"skip_enum_validation": True})
|
|
136
|
+
|
|
137
|
+
_obj = cls.model_validate({
|
|
138
|
+
"id": obj.get("id"),
|
|
139
|
+
"integration_id": obj.get("integration_id"),
|
|
140
|
+
"state": obj.get("state"),
|
|
141
|
+
"action_type": obj.get("action_type"),
|
|
142
|
+
"action_category": obj.get("action_category"),
|
|
143
|
+
"result_data": obj.get("result_data"),
|
|
144
|
+
"error_message": obj.get("error_message")
|
|
145
|
+
}, context={"skip_enum_validation": True})
|
|
146
|
+
return _obj
|
|
147
|
+
|
|
148
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DocSpring API
|
|
5
|
+
|
|
6
|
+
Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Contact: support@docspring.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, ValidationInfo, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class SubmissionBatch(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
SubmissionBatch
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: Optional[StrictStr]
|
|
31
|
+
state: StrictStr
|
|
32
|
+
metadata: Dict[str, Any]
|
|
33
|
+
processed_at: Optional[StrictStr]
|
|
34
|
+
total_count: StrictInt
|
|
35
|
+
pending_count: StrictInt
|
|
36
|
+
error_count: StrictInt
|
|
37
|
+
completion_percentage: Union[StrictFloat, StrictInt]
|
|
38
|
+
__properties: ClassVar[List[str]] = ["id", "state", "metadata", "processed_at", "total_count", "pending_count", "error_count", "completion_percentage"]
|
|
39
|
+
|
|
40
|
+
@field_validator('state')
|
|
41
|
+
def state_validate_enum(cls, value, info: ValidationInfo):
|
|
42
|
+
"""Validates the enum"""
|
|
43
|
+
# from_dict accepts enum values this client doesn't know about yet
|
|
44
|
+
if info.context and info.context.get("skip_enum_validation"):
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
if value not in set(['pending', 'processed', 'error']):
|
|
48
|
+
raise ValueError("must be one of enum values ('pending', 'processed', 'error')")
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
populate_by_name=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of SubmissionBatch from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
excluded_fields: Set[str] = set([
|
|
83
|
+
])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
# set to None if id (nullable) is None
|
|
91
|
+
# and model_fields_set contains the field
|
|
92
|
+
if self.id is None and "id" in self.model_fields_set:
|
|
93
|
+
_dict['id'] = None
|
|
94
|
+
|
|
95
|
+
# set to None if processed_at (nullable) is None
|
|
96
|
+
# and model_fields_set contains the field
|
|
97
|
+
if self.processed_at is None and "processed_at" in self.model_fields_set:
|
|
98
|
+
_dict['processed_at'] = None
|
|
99
|
+
|
|
100
|
+
return _dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
104
|
+
"""Create an instance of SubmissionBatch from a dict"""
|
|
105
|
+
if obj is None:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
if not isinstance(obj, dict):
|
|
109
|
+
return cls.model_validate(obj, context={"skip_enum_validation": True})
|
|
110
|
+
|
|
111
|
+
_obj = cls.model_validate({
|
|
112
|
+
"id": obj.get("id"),
|
|
113
|
+
"state": obj.get("state"),
|
|
114
|
+
"metadata": obj.get("metadata"),
|
|
115
|
+
"processed_at": obj.get("processed_at"),
|
|
116
|
+
"total_count": obj.get("total_count"),
|
|
117
|
+
"pending_count": obj.get("pending_count"),
|
|
118
|
+
"error_count": obj.get("error_count"),
|
|
119
|
+
"completion_percentage": obj.get("completion_percentage")
|
|
120
|
+
}, context={"skip_enum_validation": True})
|
|
121
|
+
return _obj
|
|
122
|
+
|
|
123
|
+
|