signwell-sdk-python 0.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.
- signwell_sdk/__init__.py +287 -0
- signwell_sdk/api/__init__.py +10 -0
- signwell_sdk/api/api_application_api.py +481 -0
- signwell_sdk/api/bulk_send_api.py +1589 -0
- signwell_sdk/api/document_api.py +2425 -0
- signwell_sdk/api/me_api.py +246 -0
- signwell_sdk/api/regional_api.py +345 -0
- signwell_sdk/api/template_api.py +1298 -0
- signwell_sdk/api/webhooks_api.py +710 -0
- signwell_sdk/api_client.py +747 -0
- signwell_sdk/api_response.py +20 -0
- signwell_sdk/configuration.py +599 -0
- signwell_sdk/embedded.py +385 -0
- signwell_sdk/exceptions.py +314 -0
- signwell_sdk/models/__init__.py +114 -0
- signwell_sdk/models/account_info_response.py +143 -0
- signwell_sdk/models/account_info_response_active_users_inner.py +107 -0
- signwell_sdk/models/account_info_response_preferences.py +147 -0
- signwell_sdk/models/additional_fields_inner_inner.py +274 -0
- signwell_sdk/models/additional_fields_inner_inner_value.py +189 -0
- signwell_sdk/models/additional_files_inner.py +103 -0
- signwell_sdk/models/api_application_response.py +137 -0
- signwell_sdk/models/api_application_response_owner.py +107 -0
- signwell_sdk/models/api_application_response_preferences.py +135 -0
- signwell_sdk/models/attachment_request_info.py +99 -0
- signwell_sdk/models/attachment_requests_inner.py +110 -0
- signwell_sdk/models/bulk_send_create_response.py +132 -0
- signwell_sdk/models/bulk_send_csv_request.py +100 -0
- signwell_sdk/models/bulk_send_csv_template_response.py +97 -0
- signwell_sdk/models/bulk_send_documents_response.py +167 -0
- signwell_sdk/models/bulk_send_list_item.py +141 -0
- signwell_sdk/models/bulk_send_list_response.py +138 -0
- signwell_sdk/models/bulk_send_response.py +151 -0
- signwell_sdk/models/bulk_send_response_templates_inner.py +98 -0
- signwell_sdk/models/bulk_send_validate_csv_response.py +129 -0
- signwell_sdk/models/checkbox_group_info.py +138 -0
- signwell_sdk/models/checkbox_groups_inner.py +136 -0
- signwell_sdk/models/checkbox_validation.py +35 -0
- signwell_sdk/models/completed_pdf_response.py +177 -0
- signwell_sdk/models/completed_pdf_url_response.py +97 -0
- signwell_sdk/models/copied_contact_info.py +99 -0
- signwell_sdk/models/copied_contacts_inner.py +98 -0
- signwell_sdk/models/copied_placeholders_inner.py +111 -0
- signwell_sdk/models/create_bulk_send_request.py +155 -0
- signwell_sdk/models/create_webhook_request.py +100 -0
- signwell_sdk/models/date_format.py +36 -0
- signwell_sdk/models/detailed_option.py +105 -0
- signwell_sdk/models/document_from_template_request.py +377 -0
- signwell_sdk/models/document_from_template_response.py +353 -0
- signwell_sdk/models/document_from_template_response_fields_inner_inner.py +270 -0
- signwell_sdk/models/document_from_template_response_fields_inner_inner_recipient.py +99 -0
- signwell_sdk/models/document_from_template_response_recipients_inner.py +206 -0
- signwell_sdk/models/document_list_response.py +138 -0
- signwell_sdk/models/document_request.py +350 -0
- signwell_sdk/models/document_response.py +357 -0
- signwell_sdk/models/document_response_attachment_requests_inner.py +101 -0
- signwell_sdk/models/document_response_fields_inner_inner.py +268 -0
- signwell_sdk/models/document_response_fields_inner_inner_options_inner.py +101 -0
- signwell_sdk/models/document_response_fields_inner_inner_recipient.py +98 -0
- signwell_sdk/models/document_response_fields_inner_inner_value.py +195 -0
- signwell_sdk/models/document_response_recipients_inner.py +208 -0
- signwell_sdk/models/document_template_list_response.py +138 -0
- signwell_sdk/models/document_template_request.py +307 -0
- signwell_sdk/models/document_template_response.py +323 -0
- signwell_sdk/models/document_template_response_copied_placeholders_inner.py +131 -0
- signwell_sdk/models/document_template_response_placeholders_inner.py +144 -0
- signwell_sdk/models/document_template_update_request.py +208 -0
- signwell_sdk/models/dropdown_option.py +153 -0
- signwell_sdk/models/error_response.py +107 -0
- signwell_sdk/models/error_response_meta.py +101 -0
- signwell_sdk/models/field_type.py +46 -0
- signwell_sdk/models/fields_inner_inner.py +268 -0
- signwell_sdk/models/file_format.py +33 -0
- signwell_sdk/models/file_info.py +98 -0
- signwell_sdk/models/files_inner.py +103 -0
- signwell_sdk/models/label_info.py +98 -0
- signwell_sdk/models/label_request.py +97 -0
- signwell_sdk/models/label_response.py +98 -0
- signwell_sdk/models/me_response.py +130 -0
- signwell_sdk/models/me_response_contact.py +147 -0
- signwell_sdk/models/me_response_user.py +117 -0
- signwell_sdk/models/me_response_user_preferences.py +105 -0
- signwell_sdk/models/nom151_certificate_response.py +107 -0
- signwell_sdk/models/nom151_certificate_response_nom151.py +125 -0
- signwell_sdk/models/nom151_url_response.py +97 -0
- signwell_sdk/models/pagination_meta.py +119 -0
- signwell_sdk/models/placeholders_inner.py +115 -0
- signwell_sdk/models/rate_limit_error_response.py +97 -0
- signwell_sdk/models/recipients_inner.py +141 -0
- signwell_sdk/models/reminder_recipients_inner.py +100 -0
- signwell_sdk/models/send_reminder_request.py +114 -0
- signwell_sdk/models/template_attachment_requests_inner.py +110 -0
- signwell_sdk/models/template_checkbox_groups_inner.py +136 -0
- signwell_sdk/models/template_field_values_inner.py +109 -0
- signwell_sdk/models/template_field_values_inner_value.py +189 -0
- signwell_sdk/models/template_fields_inner_inner.py +266 -0
- signwell_sdk/models/template_recipients_inner.py +146 -0
- signwell_sdk/models/text_validation.py +42 -0
- signwell_sdk/models/update_document_and_send_request.py +234 -0
- signwell_sdk/models/update_recipients_map_inner.py +118 -0
- signwell_sdk/models/update_recipients_request.py +111 -0
- signwell_sdk/models/validation_error_response.py +99 -0
- signwell_sdk/models/webhook_response.py +110 -0
- signwell_sdk/py.typed +0 -0
- signwell_sdk/rest.py +209 -0
- signwell_sdk/webhook.py +214 -0
- signwell_sdk_python-0.1.0.dist-info/METADATA +177 -0
- signwell_sdk_python-0.1.0.dist-info/RECORD +110 -0
- signwell_sdk_python-0.1.0.dist-info/WHEEL +4 -0
- signwell_sdk_python-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SignWell Developer API
|
|
3
|
+
|
|
4
|
+
API for creating, managing, and tracking electronic signature workflows.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v1
|
|
7
|
+
Contact: support@signwell.com
|
|
8
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
|
+
|
|
10
|
+
Do not edit the class manually.
|
|
11
|
+
""" # noqa: E501
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
20
|
+
from signwell_sdk.models.additional_fields_inner_inner_value import AdditionalFieldsInnerInnerValue
|
|
21
|
+
from signwell_sdk.models.date_format import DateFormat
|
|
22
|
+
from signwell_sdk.models.dropdown_option import DropdownOption
|
|
23
|
+
from signwell_sdk.models.field_type import FieldType
|
|
24
|
+
from signwell_sdk.models.text_validation import TextValidation
|
|
25
|
+
from pydantic import model_validator
|
|
26
|
+
from typing import Any, Optional, Set, get_args
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AdditionalFieldsInnerInner(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
AdditionalFieldsInnerInner
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
|
|
35
|
+
x: Union[StrictFloat, StrictInt] = Field(
|
|
36
|
+
description="Horizontal value in the coordinates of the field (in pixels). Coordinates are specific to the page where fields are located."
|
|
37
|
+
)
|
|
38
|
+
y: Union[StrictFloat, StrictInt] = Field(
|
|
39
|
+
description="Vertical value in the coordinates of the field (in pixels). Coordinates are specific to the page where fields are located."
|
|
40
|
+
)
|
|
41
|
+
page: StrictInt = Field(
|
|
42
|
+
description="The page number within the file. If the page does not exist within the file then the field won't be created."
|
|
43
|
+
)
|
|
44
|
+
recipient_id: StrictStr = Field(
|
|
45
|
+
description="Unique identifier of the recipient assigned to the field. Recipients assigned to fields will be the only ones that will see and be able to complete those fields."
|
|
46
|
+
)
|
|
47
|
+
type: FieldType
|
|
48
|
+
required: StrictBool | None = Field(
|
|
49
|
+
default=True,
|
|
50
|
+
description="Whether the field must be completed by the recipient. Defaults to `true` except for checkbox type fields.",
|
|
51
|
+
)
|
|
52
|
+
label: StrictStr | None = Field(
|
|
53
|
+
default=None, description="Text and Date fields only: label that is displayed when the field is empty."
|
|
54
|
+
)
|
|
55
|
+
value: AdditionalFieldsInnerInnerValue | None = None
|
|
56
|
+
api_id: StrictStr | None = Field(
|
|
57
|
+
default=None,
|
|
58
|
+
description="Unique identifier of the field. Useful when needing to reference specific field values or update a document and its fields.",
|
|
59
|
+
)
|
|
60
|
+
name: StrictStr | None = Field(
|
|
61
|
+
default=None,
|
|
62
|
+
description="Checkbox fields only. At least 2 checkbox fields in an array of fields must be assigned to the same recipient and grouped with selection requirements.",
|
|
63
|
+
)
|
|
64
|
+
validation: TextValidation | None = None
|
|
65
|
+
fixed_width: StrictBool | None = Field(
|
|
66
|
+
default=False,
|
|
67
|
+
description="Text fields only: whether the field width will stay fixed and text will display in multiple lines, rather than one long line. If set to `false` the field width will automatically grow horizontally to fit text on one line. Defaults to `false`.",
|
|
68
|
+
)
|
|
69
|
+
lock_sign_date: StrictBool | None = Field(
|
|
70
|
+
default=False,
|
|
71
|
+
description="Date fields only: makes fields readonly and automatically populates with the date the recipient signed. Defaults to `false`.",
|
|
72
|
+
)
|
|
73
|
+
date_format: DateFormat | None = None
|
|
74
|
+
formula: StrictStr | None = Field(
|
|
75
|
+
default=None,
|
|
76
|
+
description="Date fields only (text field formulas coming soon): formulas are a way to prefill fields with calculated future or past dates. Addition, subtraction, and parentheses are allowed. Valid event dates are `created_date`, `sent_date`, and `signed_date`. Valid time periods are `day`, `days`, `week`, `weeks`, `month`, and `months`. Example: `formula: 'sent_date + 10 days'`. Use with `lock_sign_date` if you'd like to make the field readonly and prevent signers from choosing a different date.",
|
|
77
|
+
)
|
|
78
|
+
height: Union[StrictFloat, StrictInt] | None = Field(
|
|
79
|
+
default=None,
|
|
80
|
+
description="Height of the field (in pixels). Maximum height varies by field type: Signature/Initials (200px), others (74px). When using text tags if the height is greater than the maximum height, the height will be set to the maximum height.",
|
|
81
|
+
)
|
|
82
|
+
width: Union[StrictFloat, StrictInt] | None = Field(
|
|
83
|
+
default=None,
|
|
84
|
+
description="Width of the field (in pixels). For text fields, width will auto-grow unless `fixed_width` is true.",
|
|
85
|
+
)
|
|
86
|
+
options: List[DropdownOption] | None = Field(
|
|
87
|
+
default=None, description="Array of dropdown options (for dropdown/select fields only)"
|
|
88
|
+
)
|
|
89
|
+
default_option: StrictStr | None = Field(
|
|
90
|
+
default=None, description="Default selected option (for dropdown/select fields only)"
|
|
91
|
+
)
|
|
92
|
+
allow_other: StrictBool | None = Field(
|
|
93
|
+
default=False, description='Whether to allow "Other" option with text input (for dropdown/select fields only)'
|
|
94
|
+
)
|
|
95
|
+
additional_properties: Dict[str, Any] = {}
|
|
96
|
+
__properties: ClassVar[List[str]] = [
|
|
97
|
+
"x",
|
|
98
|
+
"y",
|
|
99
|
+
"page",
|
|
100
|
+
"recipient_id",
|
|
101
|
+
"type",
|
|
102
|
+
"required",
|
|
103
|
+
"label",
|
|
104
|
+
"value",
|
|
105
|
+
"api_id",
|
|
106
|
+
"name",
|
|
107
|
+
"validation",
|
|
108
|
+
"fixed_width",
|
|
109
|
+
"lock_sign_date",
|
|
110
|
+
"date_format",
|
|
111
|
+
"formula",
|
|
112
|
+
"height",
|
|
113
|
+
"width",
|
|
114
|
+
"options",
|
|
115
|
+
"default_option",
|
|
116
|
+
"allow_other",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
@model_validator(mode="before")
|
|
120
|
+
@classmethod
|
|
121
|
+
def normalize_checkbox_value_input(cls, data: Any) -> Any:
|
|
122
|
+
if not isinstance(data, dict):
|
|
123
|
+
return data
|
|
124
|
+
if cls._field_type_value(data.get("type")) != "checkbox":
|
|
125
|
+
return data
|
|
126
|
+
if data.get("value") is None:
|
|
127
|
+
return data
|
|
128
|
+
|
|
129
|
+
normalized = dict(data)
|
|
130
|
+
normalized["value"] = cls._build_value_model(cls._normalize_checkbox_value(data["value"]))
|
|
131
|
+
return normalized
|
|
132
|
+
|
|
133
|
+
@model_validator(mode="after")
|
|
134
|
+
def normalize_checkbox_value(self) -> Self:
|
|
135
|
+
field_type = getattr(self.type, "value", self.type)
|
|
136
|
+
if field_type == "checkbox" and self.value is not None:
|
|
137
|
+
self.value.actual_instance = self._normalize_checkbox_value(self.value)
|
|
138
|
+
return self
|
|
139
|
+
|
|
140
|
+
@classmethod
|
|
141
|
+
def _build_value_model(cls, value: str) -> Any:
|
|
142
|
+
value_field = cls.model_fields.get("value")
|
|
143
|
+
if value_field is None:
|
|
144
|
+
return value
|
|
145
|
+
|
|
146
|
+
annotation = value_field.annotation
|
|
147
|
+
candidates = get_args(annotation) or (annotation,)
|
|
148
|
+
for candidate in candidates:
|
|
149
|
+
if candidate is type(None):
|
|
150
|
+
continue
|
|
151
|
+
value_model: Any = candidate
|
|
152
|
+
if callable(value_model):
|
|
153
|
+
return value_model(value)
|
|
154
|
+
return value
|
|
155
|
+
|
|
156
|
+
@staticmethod
|
|
157
|
+
def _field_type_value(value: Any) -> Any:
|
|
158
|
+
return getattr(value, "value", value)
|
|
159
|
+
|
|
160
|
+
@staticmethod
|
|
161
|
+
def _normalize_checkbox_value(value: Any) -> str:
|
|
162
|
+
actual_value = getattr(value, "actual_instance", value)
|
|
163
|
+
if isinstance(actual_value, bool):
|
|
164
|
+
return "t" if actual_value else "f"
|
|
165
|
+
if isinstance(actual_value, str):
|
|
166
|
+
normalized = actual_value.strip().lower()
|
|
167
|
+
if normalized in {"true", "t"}:
|
|
168
|
+
return "t"
|
|
169
|
+
if normalized in {"false", "f"}:
|
|
170
|
+
return "f"
|
|
171
|
+
raise ValueError('Checkbox field values must be boolean or one of "true", "false", "t", or "f"')
|
|
172
|
+
|
|
173
|
+
model_config = ConfigDict(
|
|
174
|
+
populate_by_name=True,
|
|
175
|
+
validate_assignment=True,
|
|
176
|
+
protected_namespaces=(),
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def to_str(self) -> str:
|
|
180
|
+
"""Returns the string representation of the model using alias"""
|
|
181
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
182
|
+
|
|
183
|
+
def to_json(self) -> str:
|
|
184
|
+
"""Returns the JSON representation of the model using alias"""
|
|
185
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
186
|
+
return json.dumps(self.to_dict())
|
|
187
|
+
|
|
188
|
+
@classmethod
|
|
189
|
+
def from_json(cls, json_str: str) -> Self | None:
|
|
190
|
+
"""Create an instance of AdditionalFieldsInnerInner from a JSON string"""
|
|
191
|
+
return cls.from_dict(json.loads(json_str))
|
|
192
|
+
|
|
193
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
194
|
+
"""Return the dictionary representation of the model using alias.
|
|
195
|
+
|
|
196
|
+
This has the following differences from calling pydantic's
|
|
197
|
+
`self.model_dump(by_alias=True)`:
|
|
198
|
+
|
|
199
|
+
* `None` is only added to the output dict for nullable fields that
|
|
200
|
+
were set at model initialization. Other fields with value `None`
|
|
201
|
+
are ignored.
|
|
202
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
203
|
+
"""
|
|
204
|
+
excluded_fields: Set[str] = set(
|
|
205
|
+
[
|
|
206
|
+
"additional_properties",
|
|
207
|
+
]
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
_dict = self.model_dump(
|
|
211
|
+
by_alias=True,
|
|
212
|
+
exclude=excluded_fields,
|
|
213
|
+
exclude_none=True,
|
|
214
|
+
)
|
|
215
|
+
# override the default output from pydantic by calling `to_dict()` of value
|
|
216
|
+
if self.value:
|
|
217
|
+
_dict["value"] = self.value.to_dict()
|
|
218
|
+
# override the default output from pydantic by calling `to_dict()` of each item in options (list)
|
|
219
|
+
_items_options: list[Any] = []
|
|
220
|
+
if self.options:
|
|
221
|
+
for _item_options in self.options:
|
|
222
|
+
if _item_options:
|
|
223
|
+
_items_options.append(_item_options.to_dict())
|
|
224
|
+
_dict["options"] = _items_options
|
|
225
|
+
# puts key-value pairs in additional_properties in the top level
|
|
226
|
+
if self.additional_properties is not None:
|
|
227
|
+
for _key, _value in self.additional_properties.items():
|
|
228
|
+
_dict[_key] = _value
|
|
229
|
+
|
|
230
|
+
return _dict
|
|
231
|
+
|
|
232
|
+
@classmethod
|
|
233
|
+
def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
|
|
234
|
+
"""Create an instance of AdditionalFieldsInnerInner from a dict"""
|
|
235
|
+
if obj is None:
|
|
236
|
+
return None
|
|
237
|
+
|
|
238
|
+
if not isinstance(obj, dict):
|
|
239
|
+
return cls.model_validate(obj)
|
|
240
|
+
|
|
241
|
+
_obj = cls.model_validate(
|
|
242
|
+
{
|
|
243
|
+
"x": obj.get("x"),
|
|
244
|
+
"y": obj.get("y"),
|
|
245
|
+
"page": obj.get("page"),
|
|
246
|
+
"recipient_id": obj.get("recipient_id"),
|
|
247
|
+
"type": obj.get("type"),
|
|
248
|
+
"required": obj.get("required") if obj.get("required") is not None else True,
|
|
249
|
+
"label": obj.get("label"),
|
|
250
|
+
"value": AdditionalFieldsInnerInnerValue.from_dict(obj["value"])
|
|
251
|
+
if obj.get("value") is not None
|
|
252
|
+
else None,
|
|
253
|
+
"api_id": obj.get("api_id"),
|
|
254
|
+
"name": obj.get("name"),
|
|
255
|
+
"validation": obj.get("validation"),
|
|
256
|
+
"fixed_width": obj.get("fixed_width") if obj.get("fixed_width") is not None else False,
|
|
257
|
+
"lock_sign_date": obj.get("lock_sign_date") if obj.get("lock_sign_date") is not None else False,
|
|
258
|
+
"date_format": obj.get("date_format"),
|
|
259
|
+
"formula": obj.get("formula"),
|
|
260
|
+
"height": obj.get("height"),
|
|
261
|
+
"width": obj.get("width"),
|
|
262
|
+
"options": [DropdownOption.from_dict(_item) for _item in obj["options"]]
|
|
263
|
+
if obj.get("options") is not None
|
|
264
|
+
else None,
|
|
265
|
+
"default_option": obj.get("default_option"),
|
|
266
|
+
"allow_other": obj.get("allow_other") if obj.get("allow_other") is not None else False,
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
# store additional fields in additional_properties
|
|
270
|
+
for _key in obj.keys():
|
|
271
|
+
if _key not in cls.__properties:
|
|
272
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
273
|
+
|
|
274
|
+
return _obj
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SignWell Developer API
|
|
3
|
+
|
|
4
|
+
API for creating, managing, and tracking electronic signature workflows.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v1
|
|
7
|
+
Contact: support@signwell.com
|
|
8
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
|
+
|
|
10
|
+
Do not edit the class manually.
|
|
11
|
+
""" # noqa: E501
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import json
|
|
15
|
+
import pprint
|
|
16
|
+
from pydantic import (
|
|
17
|
+
BaseModel,
|
|
18
|
+
ConfigDict,
|
|
19
|
+
Field,
|
|
20
|
+
StrictBool,
|
|
21
|
+
StrictFloat,
|
|
22
|
+
StrictInt,
|
|
23
|
+
StrictStr,
|
|
24
|
+
ValidationError,
|
|
25
|
+
field_validator,
|
|
26
|
+
)
|
|
27
|
+
from typing import Any, List, Optional, Union
|
|
28
|
+
from pydantic import StrictStr, Field
|
|
29
|
+
from typing import Union, List, Set, Optional, Dict, cast
|
|
30
|
+
from typing_extensions import Literal, Self
|
|
31
|
+
|
|
32
|
+
ADDITIONALFIELDSINNERINNERVALUE_ONE_OF_SCHEMAS = ["bool", "float", "str"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AdditionalFieldsInnerInnerValue(BaseModel):
|
|
36
|
+
"""
|
|
37
|
+
Varies according to the field type. Text fields accept strings or numbers. Date fields accept Iso8601 date strings. CheckBoxes accept booleans. Signature and Initials fields can't be signed through API requests. Autofill text fields accept strings or numbers.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
# data type: str
|
|
41
|
+
oneof_schema_1_validator: StrictStr | None = None
|
|
42
|
+
# data type: bool
|
|
43
|
+
oneof_schema_2_validator: StrictBool | None = None
|
|
44
|
+
# data type: float
|
|
45
|
+
oneof_schema_3_validator: Union[StrictFloat, StrictInt] | None = None
|
|
46
|
+
actual_instance: Union[bool, float, str] | None = None
|
|
47
|
+
one_of_schemas: Set[str] = {"bool", "float", "str"}
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
validate_assignment=True,
|
|
51
|
+
arbitrary_types_allowed=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
56
|
+
if args:
|
|
57
|
+
if len(args) > 1:
|
|
58
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
59
|
+
if kwargs:
|
|
60
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
61
|
+
super().__init__(actual_instance=args[0])
|
|
62
|
+
else:
|
|
63
|
+
super().__init__(**kwargs)
|
|
64
|
+
|
|
65
|
+
@field_validator("actual_instance")
|
|
66
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
67
|
+
instance = AdditionalFieldsInnerInnerValue.model_construct()
|
|
68
|
+
error_messages = []
|
|
69
|
+
match = 0
|
|
70
|
+
# validate data type: str
|
|
71
|
+
try:
|
|
72
|
+
instance.oneof_schema_1_validator = v
|
|
73
|
+
match += 1
|
|
74
|
+
except (ValidationError, ValueError) as e:
|
|
75
|
+
error_messages.append(str(e))
|
|
76
|
+
# validate data type: bool
|
|
77
|
+
try:
|
|
78
|
+
instance.oneof_schema_2_validator = v
|
|
79
|
+
match += 1
|
|
80
|
+
except (ValidationError, ValueError) as e:
|
|
81
|
+
error_messages.append(str(e))
|
|
82
|
+
# validate data type: float
|
|
83
|
+
try:
|
|
84
|
+
instance.oneof_schema_3_validator = v
|
|
85
|
+
match += 1
|
|
86
|
+
except (ValidationError, ValueError) as e:
|
|
87
|
+
error_messages.append(str(e))
|
|
88
|
+
if match > 1:
|
|
89
|
+
# more than 1 match
|
|
90
|
+
raise ValueError(
|
|
91
|
+
"Multiple matches found when setting `actual_instance` in AdditionalFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
|
|
92
|
+
+ ", ".join(error_messages)
|
|
93
|
+
)
|
|
94
|
+
elif match == 0:
|
|
95
|
+
# no match
|
|
96
|
+
raise ValueError(
|
|
97
|
+
"No match found when setting `actual_instance` in AdditionalFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
|
|
98
|
+
+ ", ".join(error_messages)
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
return v
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
105
|
+
return cls.from_json(json.dumps(obj))
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def from_json(cls, json_str: str) -> Self:
|
|
109
|
+
"""Returns the object represented by the json string"""
|
|
110
|
+
instance = cls.model_construct()
|
|
111
|
+
error_messages = []
|
|
112
|
+
match = 0
|
|
113
|
+
|
|
114
|
+
# deserialize data into str
|
|
115
|
+
try:
|
|
116
|
+
# validation
|
|
117
|
+
instance.oneof_schema_1_validator = json.loads(json_str)
|
|
118
|
+
# assign value to actual_instance
|
|
119
|
+
instance.actual_instance = cast(
|
|
120
|
+
Union[bool, float, str],
|
|
121
|
+
instance.oneof_schema_1_validator,
|
|
122
|
+
)
|
|
123
|
+
match += 1
|
|
124
|
+
except (ValidationError, ValueError) as e:
|
|
125
|
+
error_messages.append(str(e))
|
|
126
|
+
# deserialize data into bool
|
|
127
|
+
try:
|
|
128
|
+
# validation
|
|
129
|
+
instance.oneof_schema_2_validator = json.loads(json_str)
|
|
130
|
+
# assign value to actual_instance
|
|
131
|
+
instance.actual_instance = cast(
|
|
132
|
+
Union[bool, float, str],
|
|
133
|
+
instance.oneof_schema_2_validator,
|
|
134
|
+
)
|
|
135
|
+
match += 1
|
|
136
|
+
except (ValidationError, ValueError) as e:
|
|
137
|
+
error_messages.append(str(e))
|
|
138
|
+
# deserialize data into float
|
|
139
|
+
try:
|
|
140
|
+
# validation
|
|
141
|
+
instance.oneof_schema_3_validator = json.loads(json_str)
|
|
142
|
+
# assign value to actual_instance
|
|
143
|
+
instance.actual_instance = cast(
|
|
144
|
+
Union[bool, float, str],
|
|
145
|
+
instance.oneof_schema_3_validator,
|
|
146
|
+
)
|
|
147
|
+
match += 1
|
|
148
|
+
except (ValidationError, ValueError) as e:
|
|
149
|
+
error_messages.append(str(e))
|
|
150
|
+
|
|
151
|
+
if match > 1:
|
|
152
|
+
# more than 1 match
|
|
153
|
+
raise ValueError(
|
|
154
|
+
"Multiple matches found when deserializing the JSON string into AdditionalFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
|
|
155
|
+
+ ", ".join(error_messages)
|
|
156
|
+
)
|
|
157
|
+
elif match == 0:
|
|
158
|
+
# no match
|
|
159
|
+
raise ValueError(
|
|
160
|
+
"No match found when deserializing the JSON string into AdditionalFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
|
|
161
|
+
+ ", ".join(error_messages)
|
|
162
|
+
)
|
|
163
|
+
else:
|
|
164
|
+
return instance
|
|
165
|
+
|
|
166
|
+
def to_json(self) -> str:
|
|
167
|
+
"""Returns the JSON representation of the actual instance"""
|
|
168
|
+
if self.actual_instance is None:
|
|
169
|
+
return "null"
|
|
170
|
+
|
|
171
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
172
|
+
return self.actual_instance.to_json()
|
|
173
|
+
else:
|
|
174
|
+
return json.dumps(self.actual_instance)
|
|
175
|
+
|
|
176
|
+
def to_dict(self) -> Union[Dict[str, Any], bool, float, str] | None:
|
|
177
|
+
"""Returns the dict representation of the actual instance"""
|
|
178
|
+
if self.actual_instance is None:
|
|
179
|
+
return None
|
|
180
|
+
|
|
181
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
182
|
+
return self.actual_instance.to_dict()
|
|
183
|
+
else:
|
|
184
|
+
# primitive type
|
|
185
|
+
return self.actual_instance
|
|
186
|
+
|
|
187
|
+
def to_str(self) -> str:
|
|
188
|
+
"""Returns the string representation of the actual instance"""
|
|
189
|
+
return pprint.pformat(self.model_dump())
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SignWell Developer API
|
|
3
|
+
|
|
4
|
+
API for creating, managing, and tracking electronic signature workflows.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v1
|
|
7
|
+
Contact: support@signwell.com
|
|
8
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
|
+
|
|
10
|
+
Do not edit the class manually.
|
|
11
|
+
""" # noqa: E501
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
20
|
+
from typing import Any, Optional, Set
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AdditionalFilesInner(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
Additional files to be appended to the document. Will not replace existing files from the template. Document files can be uploaded by specifying a file URL or base64 string. Either `file_url` or `file_base64` must be present (not both). Valid file types are: .pdf, .docx, .jpg, .png, .ppt, .xls, .pages, and .txt.
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
|
|
29
|
+
name: StrictStr = Field(description="Name of the file that will be uploaded.")
|
|
30
|
+
file_url: StrictStr | None = Field(default=None, description="Publicly available URL of the file to be uploaded.")
|
|
31
|
+
file_base64: Union[StrictBytes, StrictStr] | None = Field(
|
|
32
|
+
default=None, description="A RFC 4648 base64 string of the file to be uploaded."
|
|
33
|
+
)
|
|
34
|
+
additional_properties: Dict[str, Any] = {}
|
|
35
|
+
__properties: ClassVar[List[str]] = ["name", "file_url", "file_base64"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Self | None:
|
|
54
|
+
"""Create an instance of AdditionalFilesInner from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set(
|
|
69
|
+
[
|
|
70
|
+
"additional_properties",
|
|
71
|
+
]
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# puts key-value pairs in additional_properties in the top level
|
|
80
|
+
if self.additional_properties is not None:
|
|
81
|
+
for _key, _value in self.additional_properties.items():
|
|
82
|
+
_dict[_key] = _value
|
|
83
|
+
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
|
|
88
|
+
"""Create an instance of AdditionalFilesInner from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return cls.model_validate(obj)
|
|
94
|
+
|
|
95
|
+
_obj = cls.model_validate(
|
|
96
|
+
{"name": obj.get("name"), "file_url": obj.get("file_url"), "file_base64": obj.get("file_base64")}
|
|
97
|
+
)
|
|
98
|
+
# store additional fields in additional_properties
|
|
99
|
+
for _key in obj.keys():
|
|
100
|
+
if _key not in cls.__properties:
|
|
101
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
102
|
+
|
|
103
|
+
return _obj
|