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.
Files changed (110) hide show
  1. signwell_sdk/__init__.py +287 -0
  2. signwell_sdk/api/__init__.py +10 -0
  3. signwell_sdk/api/api_application_api.py +481 -0
  4. signwell_sdk/api/bulk_send_api.py +1589 -0
  5. signwell_sdk/api/document_api.py +2425 -0
  6. signwell_sdk/api/me_api.py +246 -0
  7. signwell_sdk/api/regional_api.py +345 -0
  8. signwell_sdk/api/template_api.py +1298 -0
  9. signwell_sdk/api/webhooks_api.py +710 -0
  10. signwell_sdk/api_client.py +747 -0
  11. signwell_sdk/api_response.py +20 -0
  12. signwell_sdk/configuration.py +599 -0
  13. signwell_sdk/embedded.py +385 -0
  14. signwell_sdk/exceptions.py +314 -0
  15. signwell_sdk/models/__init__.py +114 -0
  16. signwell_sdk/models/account_info_response.py +143 -0
  17. signwell_sdk/models/account_info_response_active_users_inner.py +107 -0
  18. signwell_sdk/models/account_info_response_preferences.py +147 -0
  19. signwell_sdk/models/additional_fields_inner_inner.py +274 -0
  20. signwell_sdk/models/additional_fields_inner_inner_value.py +189 -0
  21. signwell_sdk/models/additional_files_inner.py +103 -0
  22. signwell_sdk/models/api_application_response.py +137 -0
  23. signwell_sdk/models/api_application_response_owner.py +107 -0
  24. signwell_sdk/models/api_application_response_preferences.py +135 -0
  25. signwell_sdk/models/attachment_request_info.py +99 -0
  26. signwell_sdk/models/attachment_requests_inner.py +110 -0
  27. signwell_sdk/models/bulk_send_create_response.py +132 -0
  28. signwell_sdk/models/bulk_send_csv_request.py +100 -0
  29. signwell_sdk/models/bulk_send_csv_template_response.py +97 -0
  30. signwell_sdk/models/bulk_send_documents_response.py +167 -0
  31. signwell_sdk/models/bulk_send_list_item.py +141 -0
  32. signwell_sdk/models/bulk_send_list_response.py +138 -0
  33. signwell_sdk/models/bulk_send_response.py +151 -0
  34. signwell_sdk/models/bulk_send_response_templates_inner.py +98 -0
  35. signwell_sdk/models/bulk_send_validate_csv_response.py +129 -0
  36. signwell_sdk/models/checkbox_group_info.py +138 -0
  37. signwell_sdk/models/checkbox_groups_inner.py +136 -0
  38. signwell_sdk/models/checkbox_validation.py +35 -0
  39. signwell_sdk/models/completed_pdf_response.py +177 -0
  40. signwell_sdk/models/completed_pdf_url_response.py +97 -0
  41. signwell_sdk/models/copied_contact_info.py +99 -0
  42. signwell_sdk/models/copied_contacts_inner.py +98 -0
  43. signwell_sdk/models/copied_placeholders_inner.py +111 -0
  44. signwell_sdk/models/create_bulk_send_request.py +155 -0
  45. signwell_sdk/models/create_webhook_request.py +100 -0
  46. signwell_sdk/models/date_format.py +36 -0
  47. signwell_sdk/models/detailed_option.py +105 -0
  48. signwell_sdk/models/document_from_template_request.py +377 -0
  49. signwell_sdk/models/document_from_template_response.py +353 -0
  50. signwell_sdk/models/document_from_template_response_fields_inner_inner.py +270 -0
  51. signwell_sdk/models/document_from_template_response_fields_inner_inner_recipient.py +99 -0
  52. signwell_sdk/models/document_from_template_response_recipients_inner.py +206 -0
  53. signwell_sdk/models/document_list_response.py +138 -0
  54. signwell_sdk/models/document_request.py +350 -0
  55. signwell_sdk/models/document_response.py +357 -0
  56. signwell_sdk/models/document_response_attachment_requests_inner.py +101 -0
  57. signwell_sdk/models/document_response_fields_inner_inner.py +268 -0
  58. signwell_sdk/models/document_response_fields_inner_inner_options_inner.py +101 -0
  59. signwell_sdk/models/document_response_fields_inner_inner_recipient.py +98 -0
  60. signwell_sdk/models/document_response_fields_inner_inner_value.py +195 -0
  61. signwell_sdk/models/document_response_recipients_inner.py +208 -0
  62. signwell_sdk/models/document_template_list_response.py +138 -0
  63. signwell_sdk/models/document_template_request.py +307 -0
  64. signwell_sdk/models/document_template_response.py +323 -0
  65. signwell_sdk/models/document_template_response_copied_placeholders_inner.py +131 -0
  66. signwell_sdk/models/document_template_response_placeholders_inner.py +144 -0
  67. signwell_sdk/models/document_template_update_request.py +208 -0
  68. signwell_sdk/models/dropdown_option.py +153 -0
  69. signwell_sdk/models/error_response.py +107 -0
  70. signwell_sdk/models/error_response_meta.py +101 -0
  71. signwell_sdk/models/field_type.py +46 -0
  72. signwell_sdk/models/fields_inner_inner.py +268 -0
  73. signwell_sdk/models/file_format.py +33 -0
  74. signwell_sdk/models/file_info.py +98 -0
  75. signwell_sdk/models/files_inner.py +103 -0
  76. signwell_sdk/models/label_info.py +98 -0
  77. signwell_sdk/models/label_request.py +97 -0
  78. signwell_sdk/models/label_response.py +98 -0
  79. signwell_sdk/models/me_response.py +130 -0
  80. signwell_sdk/models/me_response_contact.py +147 -0
  81. signwell_sdk/models/me_response_user.py +117 -0
  82. signwell_sdk/models/me_response_user_preferences.py +105 -0
  83. signwell_sdk/models/nom151_certificate_response.py +107 -0
  84. signwell_sdk/models/nom151_certificate_response_nom151.py +125 -0
  85. signwell_sdk/models/nom151_url_response.py +97 -0
  86. signwell_sdk/models/pagination_meta.py +119 -0
  87. signwell_sdk/models/placeholders_inner.py +115 -0
  88. signwell_sdk/models/rate_limit_error_response.py +97 -0
  89. signwell_sdk/models/recipients_inner.py +141 -0
  90. signwell_sdk/models/reminder_recipients_inner.py +100 -0
  91. signwell_sdk/models/send_reminder_request.py +114 -0
  92. signwell_sdk/models/template_attachment_requests_inner.py +110 -0
  93. signwell_sdk/models/template_checkbox_groups_inner.py +136 -0
  94. signwell_sdk/models/template_field_values_inner.py +109 -0
  95. signwell_sdk/models/template_field_values_inner_value.py +189 -0
  96. signwell_sdk/models/template_fields_inner_inner.py +266 -0
  97. signwell_sdk/models/template_recipients_inner.py +146 -0
  98. signwell_sdk/models/text_validation.py +42 -0
  99. signwell_sdk/models/update_document_and_send_request.py +234 -0
  100. signwell_sdk/models/update_recipients_map_inner.py +118 -0
  101. signwell_sdk/models/update_recipients_request.py +111 -0
  102. signwell_sdk/models/validation_error_response.py +99 -0
  103. signwell_sdk/models/webhook_response.py +110 -0
  104. signwell_sdk/py.typed +0 -0
  105. signwell_sdk/rest.py +209 -0
  106. signwell_sdk/webhook.py +214 -0
  107. signwell_sdk_python-0.1.0.dist-info/METADATA +177 -0
  108. signwell_sdk_python-0.1.0.dist-info/RECORD +110 -0
  109. signwell_sdk_python-0.1.0.dist-info/WHEEL +4 -0
  110. signwell_sdk_python-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,268 @@
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.date_format import DateFormat
21
+ from signwell_sdk.models.document_response_fields_inner_inner_options_inner import (
22
+ DocumentResponseFieldsInnerInnerOptionsInner,
23
+ )
24
+ from signwell_sdk.models.document_response_fields_inner_inner_recipient import DocumentResponseFieldsInnerInnerRecipient
25
+ from signwell_sdk.models.document_response_fields_inner_inner_value import DocumentResponseFieldsInnerInnerValue
26
+ from signwell_sdk.models.field_type import FieldType
27
+ from signwell_sdk.models.text_validation import TextValidation
28
+ from pydantic import model_validator
29
+ from typing import Any, Optional, Set, get_args
30
+ from typing_extensions import Self
31
+
32
+
33
+ class DocumentResponseFieldsInnerInner(BaseModel):
34
+ """
35
+ DocumentResponseFieldsInnerInner
36
+ """ # noqa: E501
37
+
38
+ x: Union[StrictFloat, StrictInt]
39
+ y: Union[StrictFloat, StrictInt]
40
+ page: StrictInt
41
+ recipient: DocumentResponseFieldsInnerInnerRecipient | None = None
42
+ api_id: StrictStr | None = None
43
+ name: StrictStr | None = None
44
+ date_format: DateFormat | None = None
45
+ fixed_width: StrictBool | None = None
46
+ formula: StrictStr | None = None
47
+ label: StrictStr | None = None
48
+ lock_sign_date: StrictBool | None = None
49
+ required: StrictBool | None = None
50
+ type: FieldType | None = None
51
+ validation: TextValidation | None = None
52
+ value: DocumentResponseFieldsInnerInnerValue | None = None
53
+ height: StrictStr | None = None
54
+ width: StrictStr | None = None
55
+ recipient_id: StrictStr | None = None
56
+ signing_elements_group_id: StrictStr | None = None
57
+ placeholder_name: StrictStr | None = None
58
+ options: List[DocumentResponseFieldsInnerInnerOptionsInner] | None = Field(
59
+ default=None, description="Dropdown options (for dropdown/select fields)"
60
+ )
61
+ default_option: StrictStr | None = Field(default=None, description="Default selected option")
62
+ allow_other: StrictBool | None = Field(default=None, description='Whether "Other" option is allowed')
63
+ additional_properties: Dict[str, Any] = {}
64
+ __properties: ClassVar[List[str]] = [
65
+ "x",
66
+ "y",
67
+ "page",
68
+ "recipient",
69
+ "api_id",
70
+ "name",
71
+ "date_format",
72
+ "fixed_width",
73
+ "formula",
74
+ "label",
75
+ "lock_sign_date",
76
+ "required",
77
+ "type",
78
+ "validation",
79
+ "value",
80
+ "height",
81
+ "width",
82
+ "recipient_id",
83
+ "signing_elements_group_id",
84
+ "placeholder_name",
85
+ "options",
86
+ "default_option",
87
+ "allow_other",
88
+ ]
89
+
90
+ @model_validator(mode="before")
91
+ @classmethod
92
+ def normalize_checkbox_value_input(cls, data: Any) -> Any:
93
+ if not isinstance(data, dict):
94
+ return data
95
+ if cls._field_type_value(data.get("type")) != "checkbox":
96
+ return data
97
+ if data.get("value") is None:
98
+ return data
99
+
100
+ normalized = dict(data)
101
+ normalized["value"] = cls._build_value_model(cls._normalize_checkbox_value(data["value"]))
102
+ return normalized
103
+
104
+ @model_validator(mode="after")
105
+ def normalize_checkbox_value(self) -> Self:
106
+ field_type = getattr(self.type, "value", self.type)
107
+ if field_type == "checkbox" and self.value is not None:
108
+ self.value.actual_instance = self._normalize_checkbox_value(self.value)
109
+ return self
110
+
111
+ @classmethod
112
+ def _build_value_model(cls, value: str) -> Any:
113
+ value_field = cls.model_fields.get("value")
114
+ if value_field is None:
115
+ return value
116
+
117
+ annotation = value_field.annotation
118
+ candidates = get_args(annotation) or (annotation,)
119
+ for candidate in candidates:
120
+ if candidate is type(None):
121
+ continue
122
+ value_model: Any = candidate
123
+ if callable(value_model):
124
+ return value_model(value)
125
+ return value
126
+
127
+ @staticmethod
128
+ def _field_type_value(value: Any) -> Any:
129
+ return getattr(value, "value", value)
130
+
131
+ @staticmethod
132
+ def _normalize_checkbox_value(value: Any) -> str:
133
+ actual_value = getattr(value, "actual_instance", value)
134
+ if isinstance(actual_value, bool):
135
+ return "t" if actual_value else "f"
136
+ if isinstance(actual_value, str):
137
+ normalized = actual_value.strip().lower()
138
+ if normalized in {"true", "t"}:
139
+ return "t"
140
+ if normalized in {"false", "f"}:
141
+ return "f"
142
+ raise ValueError('Checkbox field values must be boolean or one of "true", "false", "t", or "f"')
143
+
144
+ model_config = ConfigDict(
145
+ populate_by_name=True,
146
+ validate_assignment=True,
147
+ protected_namespaces=(),
148
+ )
149
+
150
+ def to_str(self) -> str:
151
+ """Returns the string representation of the model using alias"""
152
+ return pprint.pformat(self.model_dump(by_alias=True))
153
+
154
+ def to_json(self) -> str:
155
+ """Returns the JSON representation of the model using alias"""
156
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
157
+ return json.dumps(self.to_dict())
158
+
159
+ @classmethod
160
+ def from_json(cls, json_str: str) -> Self | None:
161
+ """Create an instance of DocumentResponseFieldsInnerInner from a JSON string"""
162
+ return cls.from_dict(json.loads(json_str))
163
+
164
+ def to_dict(self) -> Dict[str, Any]:
165
+ """Return the dictionary representation of the model using alias.
166
+
167
+ This has the following differences from calling pydantic's
168
+ `self.model_dump(by_alias=True)`:
169
+
170
+ * `None` is only added to the output dict for nullable fields that
171
+ were set at model initialization. Other fields with value `None`
172
+ are ignored.
173
+ * Fields in `self.additional_properties` are added to the output dict.
174
+ """
175
+ excluded_fields: Set[str] = set(
176
+ [
177
+ "additional_properties",
178
+ ]
179
+ )
180
+
181
+ _dict = self.model_dump(
182
+ by_alias=True,
183
+ exclude=excluded_fields,
184
+ exclude_none=True,
185
+ )
186
+ # override the default output from pydantic by calling `to_dict()` of recipient
187
+ if self.recipient:
188
+ _dict["recipient"] = self.recipient.to_dict()
189
+ # override the default output from pydantic by calling `to_dict()` of value
190
+ if self.value:
191
+ _dict["value"] = self.value.to_dict()
192
+ # override the default output from pydantic by calling `to_dict()` of each item in options (list)
193
+ _items_options: list[Any] = []
194
+ if self.options:
195
+ for _item_options in self.options:
196
+ if _item_options:
197
+ _items_options.append(_item_options.to_dict())
198
+ _dict["options"] = _items_options
199
+ # puts key-value pairs in additional_properties in the top level
200
+ if self.additional_properties is not None:
201
+ for _key, _value in self.additional_properties.items():
202
+ _dict[_key] = _value
203
+
204
+ # set to None if name (nullable) is None
205
+ # and model_fields_set contains the field
206
+ if self.name is None and "name" in self.model_fields_set:
207
+ _dict["name"] = None
208
+
209
+ # set to None if value (nullable) is None
210
+ # and model_fields_set contains the field
211
+ if self.value is None and "value" in self.model_fields_set:
212
+ _dict["value"] = None
213
+
214
+ # set to None if recipient_id (nullable) is None
215
+ # and model_fields_set contains the field
216
+ if self.recipient_id is None and "recipient_id" in self.model_fields_set:
217
+ _dict["recipient_id"] = None
218
+
219
+ return _dict
220
+
221
+ @classmethod
222
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
223
+ """Create an instance of DocumentResponseFieldsInnerInner from a dict"""
224
+ if obj is None:
225
+ return None
226
+
227
+ if not isinstance(obj, dict):
228
+ return cls.model_validate(obj)
229
+
230
+ _obj = cls.model_validate(
231
+ {
232
+ "x": obj.get("x"),
233
+ "y": obj.get("y"),
234
+ "page": obj.get("page"),
235
+ "recipient": DocumentResponseFieldsInnerInnerRecipient.from_dict(obj["recipient"])
236
+ if obj.get("recipient") is not None
237
+ else None,
238
+ "api_id": obj.get("api_id"),
239
+ "name": obj.get("name"),
240
+ "date_format": obj.get("date_format"),
241
+ "fixed_width": obj.get("fixed_width"),
242
+ "formula": obj.get("formula"),
243
+ "label": obj.get("label"),
244
+ "lock_sign_date": obj.get("lock_sign_date"),
245
+ "required": obj.get("required"),
246
+ "type": obj.get("type"),
247
+ "validation": obj.get("validation"),
248
+ "value": DocumentResponseFieldsInnerInnerValue.from_dict(obj["value"])
249
+ if obj.get("value") is not None
250
+ else None,
251
+ "height": obj.get("height"),
252
+ "width": obj.get("width"),
253
+ "recipient_id": obj.get("recipient_id"),
254
+ "signing_elements_group_id": obj.get("signing_elements_group_id"),
255
+ "placeholder_name": obj.get("placeholder_name"),
256
+ "options": [DocumentResponseFieldsInnerInnerOptionsInner.from_dict(_item) for _item in obj["options"]]
257
+ if obj.get("options") is not None
258
+ else None,
259
+ "default_option": obj.get("default_option"),
260
+ "allow_other": obj.get("allow_other"),
261
+ }
262
+ )
263
+ # store additional fields in additional_properties
264
+ for _key in obj.keys():
265
+ if _key not in cls.__properties:
266
+ _obj.additional_properties[_key] = obj.get(_key)
267
+
268
+ return _obj
@@ -0,0 +1,101 @@
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, StrictBool, StrictStr
19
+ from typing import Any, ClassVar, Dict, List, Optional
20
+ from typing import Any, Optional, Set
21
+ from typing_extensions import Self
22
+
23
+
24
+ class DocumentResponseFieldsInnerInnerOptionsInner(BaseModel):
25
+ """
26
+ DocumentResponseFieldsInnerInnerOptionsInner
27
+ """ # noqa: E501
28
+
29
+ name: StrictStr | None = None
30
+ api_id: StrictStr | None = None
31
+ is_other: StrictBool | None = None
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["name", "api_id", "is_other"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Self | None:
52
+ """Create an instance of DocumentResponseFieldsInnerInnerOptionsInner from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ * Fields in `self.additional_properties` are added to the output dict.
65
+ """
66
+ excluded_fields: Set[str] = set(
67
+ [
68
+ "additional_properties",
69
+ ]
70
+ )
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # puts key-value pairs in additional_properties in the top level
78
+ if self.additional_properties is not None:
79
+ for _key, _value in self.additional_properties.items():
80
+ _dict[_key] = _value
81
+
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
86
+ """Create an instance of DocumentResponseFieldsInnerInnerOptionsInner from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate(
94
+ {"name": obj.get("name"), "api_id": obj.get("api_id"), "is_other": obj.get("is_other")}
95
+ )
96
+ # store additional fields in additional_properties
97
+ for _key in obj.keys():
98
+ if _key not in cls.__properties:
99
+ _obj.additional_properties[_key] = obj.get(_key)
100
+
101
+ return _obj
@@ -0,0 +1,98 @@
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, StrictStr
19
+ from typing import Any, ClassVar, Dict, List
20
+ from typing import Any, Optional, Set
21
+ from typing_extensions import Self
22
+
23
+
24
+ class DocumentResponseFieldsInnerInnerRecipient(BaseModel):
25
+ """
26
+ DocumentResponseFieldsInnerInnerRecipient
27
+ """ # noqa: E501
28
+
29
+ email: StrictStr
30
+ name: StrictStr
31
+ additional_properties: Dict[str, Any] = {}
32
+ __properties: ClassVar[List[str]] = ["email", "name"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Self | None:
51
+ """Create an instance of DocumentResponseFieldsInnerInnerRecipient from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ * Fields in `self.additional_properties` are added to the output dict.
64
+ """
65
+ excluded_fields: Set[str] = set(
66
+ [
67
+ "additional_properties",
68
+ ]
69
+ )
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # puts key-value pairs in additional_properties in the top level
77
+ if self.additional_properties is not None:
78
+ for _key, _value in self.additional_properties.items():
79
+ _dict[_key] = _value
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
85
+ """Create an instance of DocumentResponseFieldsInnerInnerRecipient from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({"email": obj.get("email"), "name": obj.get("name")})
93
+ # store additional fields in additional_properties
94
+ for _key in obj.keys():
95
+ if _key not in cls.__properties:
96
+ _obj.additional_properties[_key] = obj.get(_key)
97
+
98
+ return _obj
@@ -0,0 +1,195 @@
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
+ DOCUMENTRESPONSEFIELDSINNERINNERVALUE_ONE_OF_SCHEMAS = ["bool", "float", "str"]
33
+
34
+
35
+ class DocumentResponseFieldsInnerInnerValue(BaseModel):
36
+ """
37
+ DocumentResponseFieldsInnerInnerValue
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
+ if v is None:
68
+ return v
69
+
70
+ instance = DocumentResponseFieldsInnerInnerValue.model_construct()
71
+ error_messages = []
72
+ match = 0
73
+ # validate data type: str
74
+ try:
75
+ instance.oneof_schema_1_validator = v
76
+ match += 1
77
+ except (ValidationError, ValueError) as e:
78
+ error_messages.append(str(e))
79
+ # validate data type: bool
80
+ try:
81
+ instance.oneof_schema_2_validator = v
82
+ match += 1
83
+ except (ValidationError, ValueError) as e:
84
+ error_messages.append(str(e))
85
+ # validate data type: float
86
+ try:
87
+ instance.oneof_schema_3_validator = v
88
+ match += 1
89
+ except (ValidationError, ValueError) as e:
90
+ error_messages.append(str(e))
91
+ if match > 1:
92
+ # more than 1 match
93
+ raise ValueError(
94
+ "Multiple matches found when setting `actual_instance` in DocumentResponseFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
95
+ + ", ".join(error_messages)
96
+ )
97
+ elif match == 0:
98
+ # no match
99
+ raise ValueError(
100
+ "No match found when setting `actual_instance` in DocumentResponseFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
101
+ + ", ".join(error_messages)
102
+ )
103
+ else:
104
+ return v
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
108
+ return cls.from_json(json.dumps(obj))
109
+
110
+ @classmethod
111
+ def from_json(cls, json_str: str | None) -> Self:
112
+ """Returns the object represented by the json string"""
113
+ instance = cls.model_construct()
114
+ if json_str is None:
115
+ return instance
116
+
117
+ error_messages = []
118
+ match = 0
119
+
120
+ # deserialize data into str
121
+ try:
122
+ # validation
123
+ instance.oneof_schema_1_validator = json.loads(json_str)
124
+ # assign value to actual_instance
125
+ instance.actual_instance = cast(
126
+ Union[bool, float, str],
127
+ instance.oneof_schema_1_validator,
128
+ )
129
+ match += 1
130
+ except (ValidationError, ValueError) as e:
131
+ error_messages.append(str(e))
132
+ # deserialize data into bool
133
+ try:
134
+ # validation
135
+ instance.oneof_schema_2_validator = json.loads(json_str)
136
+ # assign value to actual_instance
137
+ instance.actual_instance = cast(
138
+ Union[bool, float, str],
139
+ instance.oneof_schema_2_validator,
140
+ )
141
+ match += 1
142
+ except (ValidationError, ValueError) as e:
143
+ error_messages.append(str(e))
144
+ # deserialize data into float
145
+ try:
146
+ # validation
147
+ instance.oneof_schema_3_validator = json.loads(json_str)
148
+ # assign value to actual_instance
149
+ instance.actual_instance = cast(
150
+ Union[bool, float, str],
151
+ instance.oneof_schema_3_validator,
152
+ )
153
+ match += 1
154
+ except (ValidationError, ValueError) as e:
155
+ error_messages.append(str(e))
156
+
157
+ if match > 1:
158
+ # more than 1 match
159
+ raise ValueError(
160
+ "Multiple matches found when deserializing the JSON string into DocumentResponseFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
161
+ + ", ".join(error_messages)
162
+ )
163
+ elif match == 0:
164
+ # no match
165
+ raise ValueError(
166
+ "No match found when deserializing the JSON string into DocumentResponseFieldsInnerInnerValue with oneOf schemas: bool, float, str. Details: "
167
+ + ", ".join(error_messages)
168
+ )
169
+ else:
170
+ return instance
171
+
172
+ def to_json(self) -> str:
173
+ """Returns the JSON representation of the actual instance"""
174
+ if self.actual_instance is None:
175
+ return "null"
176
+
177
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
178
+ return self.actual_instance.to_json()
179
+ else:
180
+ return json.dumps(self.actual_instance)
181
+
182
+ def to_dict(self) -> Union[Dict[str, Any], bool, float, str] | None:
183
+ """Returns the dict representation of the actual instance"""
184
+ if self.actual_instance is None:
185
+ return None
186
+
187
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
188
+ return self.actual_instance.to_dict()
189
+ else:
190
+ # primitive type
191
+ return self.actual_instance
192
+
193
+ def to_str(self) -> str:
194
+ """Returns the string representation of the actual instance"""
195
+ return pprint.pformat(self.model_dump())