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,99 @@
|
|
|
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, Optional
|
|
20
|
+
from typing import Any, Optional, Set
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class DocumentFromTemplateResponseFieldsInnerInnerRecipient(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
DocumentFromTemplateResponseFieldsInnerInnerRecipient
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
|
|
29
|
+
email: StrictStr
|
|
30
|
+
name: StrictStr
|
|
31
|
+
role: StrictStr | None = None
|
|
32
|
+
additional_properties: Dict[str, Any] = {}
|
|
33
|
+
__properties: ClassVar[List[str]] = ["email", "name", "role"]
|
|
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 DocumentFromTemplateResponseFieldsInnerInnerRecipient 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 DocumentFromTemplateResponseFieldsInnerInnerRecipient 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({"email": obj.get("email"), "name": obj.get("name"), "role": obj.get("role")})
|
|
94
|
+
# store additional fields in additional_properties
|
|
95
|
+
for _key in obj.keys():
|
|
96
|
+
if _key not in cls.__properties:
|
|
97
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
98
|
+
|
|
99
|
+
return _obj
|
|
@@ -0,0 +1,206 @@
|
|
|
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, StrictInt, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from signwell_sdk.models.attachment_request_info import AttachmentRequestInfo
|
|
21
|
+
from typing import Any, Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class DocumentFromTemplateResponseRecipientsInner(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
DocumentFromTemplateResponseRecipientsInner
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
id: StrictStr | None = None
|
|
31
|
+
name: StrictStr | None = None
|
|
32
|
+
email: StrictStr
|
|
33
|
+
role: StrictStr | None = None
|
|
34
|
+
message: StrictStr | None = None
|
|
35
|
+
subject: StrictStr | None = None
|
|
36
|
+
send_email: StrictBool | None = None
|
|
37
|
+
send_email_delay: StrictInt | None = None
|
|
38
|
+
signing_order: StrictInt | None = None
|
|
39
|
+
signing_url: StrictStr | None = None
|
|
40
|
+
embedded_signing_url: StrictStr | None = None
|
|
41
|
+
bounced: StrictBool | None = None
|
|
42
|
+
bounced_details: StrictStr | None = None
|
|
43
|
+
attachment_requests: List[AttachmentRequestInfo] | None = None
|
|
44
|
+
passcode: StrictStr | None = None
|
|
45
|
+
status: StrictStr | None = None
|
|
46
|
+
placeholder_name: StrictStr | None = None
|
|
47
|
+
additional_properties: Dict[str, Any] = {}
|
|
48
|
+
__properties: ClassVar[List[str]] = [
|
|
49
|
+
"id",
|
|
50
|
+
"name",
|
|
51
|
+
"email",
|
|
52
|
+
"role",
|
|
53
|
+
"message",
|
|
54
|
+
"subject",
|
|
55
|
+
"send_email",
|
|
56
|
+
"send_email_delay",
|
|
57
|
+
"signing_order",
|
|
58
|
+
"signing_url",
|
|
59
|
+
"embedded_signing_url",
|
|
60
|
+
"bounced",
|
|
61
|
+
"bounced_details",
|
|
62
|
+
"attachment_requests",
|
|
63
|
+
"passcode",
|
|
64
|
+
"status",
|
|
65
|
+
"placeholder_name",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
model_config = ConfigDict(
|
|
69
|
+
populate_by_name=True,
|
|
70
|
+
validate_assignment=True,
|
|
71
|
+
protected_namespaces=(),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def to_str(self) -> str:
|
|
75
|
+
"""Returns the string representation of the model using alias"""
|
|
76
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
77
|
+
|
|
78
|
+
def to_json(self) -> str:
|
|
79
|
+
"""Returns the JSON representation of the model using alias"""
|
|
80
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
81
|
+
return json.dumps(self.to_dict())
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_json(cls, json_str: str) -> Self | None:
|
|
85
|
+
"""Create an instance of DocumentFromTemplateResponseRecipientsInner from a JSON string"""
|
|
86
|
+
return cls.from_dict(json.loads(json_str))
|
|
87
|
+
|
|
88
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
89
|
+
"""Return the dictionary representation of the model using alias.
|
|
90
|
+
|
|
91
|
+
This has the following differences from calling pydantic's
|
|
92
|
+
`self.model_dump(by_alias=True)`:
|
|
93
|
+
|
|
94
|
+
* `None` is only added to the output dict for nullable fields that
|
|
95
|
+
were set at model initialization. Other fields with value `None`
|
|
96
|
+
are ignored.
|
|
97
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
98
|
+
"""
|
|
99
|
+
excluded_fields: Set[str] = set(
|
|
100
|
+
[
|
|
101
|
+
"additional_properties",
|
|
102
|
+
]
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
_dict = self.model_dump(
|
|
106
|
+
by_alias=True,
|
|
107
|
+
exclude=excluded_fields,
|
|
108
|
+
exclude_none=True,
|
|
109
|
+
)
|
|
110
|
+
# override the default output from pydantic by calling `to_dict()` of each item in attachment_requests (list)
|
|
111
|
+
_items_attachment_requests: list[Any] = []
|
|
112
|
+
if self.attachment_requests:
|
|
113
|
+
for _item_attachment_requests in self.attachment_requests:
|
|
114
|
+
if _item_attachment_requests:
|
|
115
|
+
_items_attachment_requests.append(_item_attachment_requests.to_dict())
|
|
116
|
+
_dict["attachment_requests"] = _items_attachment_requests
|
|
117
|
+
# puts key-value pairs in additional_properties in the top level
|
|
118
|
+
if self.additional_properties is not None:
|
|
119
|
+
for _key, _value in self.additional_properties.items():
|
|
120
|
+
_dict[_key] = _value
|
|
121
|
+
|
|
122
|
+
# set to None if message (nullable) is None
|
|
123
|
+
# and model_fields_set contains the field
|
|
124
|
+
if self.message is None and "message" in self.model_fields_set:
|
|
125
|
+
_dict["message"] = None
|
|
126
|
+
|
|
127
|
+
# set to None if subject (nullable) is None
|
|
128
|
+
# and model_fields_set contains the field
|
|
129
|
+
if self.subject is None and "subject" in self.model_fields_set:
|
|
130
|
+
_dict["subject"] = None
|
|
131
|
+
|
|
132
|
+
# set to None if send_email (nullable) is None
|
|
133
|
+
# and model_fields_set contains the field
|
|
134
|
+
if self.send_email is None and "send_email" in self.model_fields_set:
|
|
135
|
+
_dict["send_email"] = None
|
|
136
|
+
|
|
137
|
+
# set to None if send_email_delay (nullable) is None
|
|
138
|
+
# and model_fields_set contains the field
|
|
139
|
+
if self.send_email_delay is None and "send_email_delay" in self.model_fields_set:
|
|
140
|
+
_dict["send_email_delay"] = None
|
|
141
|
+
|
|
142
|
+
# set to None if signing_url (nullable) is None
|
|
143
|
+
# and model_fields_set contains the field
|
|
144
|
+
if self.signing_url is None and "signing_url" in self.model_fields_set:
|
|
145
|
+
_dict["signing_url"] = None
|
|
146
|
+
|
|
147
|
+
# set to None if embedded_signing_url (nullable) is None
|
|
148
|
+
# and model_fields_set contains the field
|
|
149
|
+
if self.embedded_signing_url is None and "embedded_signing_url" in self.model_fields_set:
|
|
150
|
+
_dict["embedded_signing_url"] = None
|
|
151
|
+
|
|
152
|
+
# set to None if bounced (nullable) is None
|
|
153
|
+
# and model_fields_set contains the field
|
|
154
|
+
if self.bounced is None and "bounced" in self.model_fields_set:
|
|
155
|
+
_dict["bounced"] = None
|
|
156
|
+
|
|
157
|
+
# set to None if bounced_details (nullable) is None
|
|
158
|
+
# and model_fields_set contains the field
|
|
159
|
+
if self.bounced_details is None and "bounced_details" in self.model_fields_set:
|
|
160
|
+
_dict["bounced_details"] = None
|
|
161
|
+
|
|
162
|
+
# set to None if passcode (nullable) is None
|
|
163
|
+
# and model_fields_set contains the field
|
|
164
|
+
if self.passcode is None and "passcode" in self.model_fields_set:
|
|
165
|
+
_dict["passcode"] = None
|
|
166
|
+
|
|
167
|
+
return _dict
|
|
168
|
+
|
|
169
|
+
@classmethod
|
|
170
|
+
def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
|
|
171
|
+
"""Create an instance of DocumentFromTemplateResponseRecipientsInner from a dict"""
|
|
172
|
+
if obj is None:
|
|
173
|
+
return None
|
|
174
|
+
|
|
175
|
+
if not isinstance(obj, dict):
|
|
176
|
+
return cls.model_validate(obj)
|
|
177
|
+
|
|
178
|
+
_obj = cls.model_validate(
|
|
179
|
+
{
|
|
180
|
+
"id": obj.get("id"),
|
|
181
|
+
"name": obj.get("name"),
|
|
182
|
+
"email": obj.get("email"),
|
|
183
|
+
"role": obj.get("role"),
|
|
184
|
+
"message": obj.get("message"),
|
|
185
|
+
"subject": obj.get("subject"),
|
|
186
|
+
"send_email": obj.get("send_email"),
|
|
187
|
+
"send_email_delay": obj.get("send_email_delay"),
|
|
188
|
+
"signing_order": obj.get("signing_order"),
|
|
189
|
+
"signing_url": obj.get("signing_url"),
|
|
190
|
+
"embedded_signing_url": obj.get("embedded_signing_url"),
|
|
191
|
+
"bounced": obj.get("bounced"),
|
|
192
|
+
"bounced_details": obj.get("bounced_details"),
|
|
193
|
+
"attachment_requests": [AttachmentRequestInfo.from_dict(_item) for _item in obj["attachment_requests"]]
|
|
194
|
+
if obj.get("attachment_requests") is not None
|
|
195
|
+
else None,
|
|
196
|
+
"passcode": obj.get("passcode"),
|
|
197
|
+
"status": obj.get("status"),
|
|
198
|
+
"placeholder_name": obj.get("placeholder_name"),
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
# store additional fields in additional_properties
|
|
202
|
+
for _key in obj.keys():
|
|
203
|
+
if _key not in cls.__properties:
|
|
204
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
205
|
+
|
|
206
|
+
return _obj
|
|
@@ -0,0 +1,138 @@
|
|
|
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, StrictInt
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from signwell_sdk.models.document_response import DocumentResponse
|
|
21
|
+
from typing import Any, Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class DocumentListResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
List of documents with pagination
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
documents: List[DocumentResponse]
|
|
31
|
+
current_page: StrictInt
|
|
32
|
+
next_page: StrictInt | None = None
|
|
33
|
+
previous_page: StrictInt | None = None
|
|
34
|
+
total_count: StrictInt
|
|
35
|
+
total_pages: StrictInt
|
|
36
|
+
additional_properties: Dict[str, Any] = {}
|
|
37
|
+
__properties: ClassVar[List[str]] = [
|
|
38
|
+
"documents",
|
|
39
|
+
"current_page",
|
|
40
|
+
"next_page",
|
|
41
|
+
"previous_page",
|
|
42
|
+
"total_count",
|
|
43
|
+
"total_pages",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
populate_by_name=True,
|
|
48
|
+
validate_assignment=True,
|
|
49
|
+
protected_namespaces=(),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
59
|
+
return json.dumps(self.to_dict())
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_json(cls, json_str: str) -> Self | None:
|
|
63
|
+
"""Create an instance of DocumentListResponse from a JSON string"""
|
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
|
65
|
+
|
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
|
68
|
+
|
|
69
|
+
This has the following differences from calling pydantic's
|
|
70
|
+
`self.model_dump(by_alias=True)`:
|
|
71
|
+
|
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
|
73
|
+
were set at model initialization. Other fields with value `None`
|
|
74
|
+
are ignored.
|
|
75
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
76
|
+
"""
|
|
77
|
+
excluded_fields: Set[str] = set(
|
|
78
|
+
[
|
|
79
|
+
"additional_properties",
|
|
80
|
+
]
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
_dict = self.model_dump(
|
|
84
|
+
by_alias=True,
|
|
85
|
+
exclude=excluded_fields,
|
|
86
|
+
exclude_none=True,
|
|
87
|
+
)
|
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of each item in documents (list)
|
|
89
|
+
_items_documents: list[Any] = []
|
|
90
|
+
if self.documents:
|
|
91
|
+
for _item_documents in self.documents:
|
|
92
|
+
if _item_documents:
|
|
93
|
+
_items_documents.append(_item_documents.to_dict())
|
|
94
|
+
_dict["documents"] = _items_documents
|
|
95
|
+
# puts key-value pairs in additional_properties in the top level
|
|
96
|
+
if self.additional_properties is not None:
|
|
97
|
+
for _key, _value in self.additional_properties.items():
|
|
98
|
+
_dict[_key] = _value
|
|
99
|
+
|
|
100
|
+
# set to None if next_page (nullable) is None
|
|
101
|
+
# and model_fields_set contains the field
|
|
102
|
+
if self.next_page is None and "next_page" in self.model_fields_set:
|
|
103
|
+
_dict["next_page"] = None
|
|
104
|
+
|
|
105
|
+
# set to None if previous_page (nullable) is None
|
|
106
|
+
# and model_fields_set contains the field
|
|
107
|
+
if self.previous_page is None and "previous_page" in self.model_fields_set:
|
|
108
|
+
_dict["previous_page"] = None
|
|
109
|
+
|
|
110
|
+
return _dict
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
|
|
114
|
+
"""Create an instance of DocumentListResponse from a dict"""
|
|
115
|
+
if obj is None:
|
|
116
|
+
return None
|
|
117
|
+
|
|
118
|
+
if not isinstance(obj, dict):
|
|
119
|
+
return cls.model_validate(obj)
|
|
120
|
+
|
|
121
|
+
_obj = cls.model_validate(
|
|
122
|
+
{
|
|
123
|
+
"documents": [DocumentResponse.from_dict(_item) for _item in obj["documents"]]
|
|
124
|
+
if obj.get("documents") is not None
|
|
125
|
+
else None,
|
|
126
|
+
"current_page": obj.get("current_page"),
|
|
127
|
+
"next_page": obj.get("next_page"),
|
|
128
|
+
"previous_page": obj.get("previous_page"),
|
|
129
|
+
"total_count": obj.get("total_count"),
|
|
130
|
+
"total_pages": obj.get("total_pages"),
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
# store additional fields in additional_properties
|
|
134
|
+
for _key in obj.keys():
|
|
135
|
+
if _key not in cls.__properties:
|
|
136
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
137
|
+
|
|
138
|
+
return _obj
|