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,208 @@
|
|
|
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, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from typing_extensions import Annotated
|
|
21
|
+
from signwell_sdk.models.label_request import LabelRequest
|
|
22
|
+
from signwell_sdk.models.template_checkbox_groups_inner import TemplateCheckboxGroupsInner
|
|
23
|
+
from typing import Any, Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class DocumentTemplateUpdateRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
DocumentTemplateUpdateRequest
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
name: StrictStr | None = Field(default=None, description="The name of the template.")
|
|
33
|
+
subject: StrictStr | None = Field(
|
|
34
|
+
default=None,
|
|
35
|
+
description="Email subject for the signature request that recipients will see. Defaults to the default system subject or a template subject (if the document is created from a template).",
|
|
36
|
+
)
|
|
37
|
+
message: StrictStr | None = Field(
|
|
38
|
+
default=None,
|
|
39
|
+
description="Email message for the signature request that recipients will see. Defaults to the default system message or a template message (if the document is created from a template).",
|
|
40
|
+
)
|
|
41
|
+
draft: StrictBool | None = Field(
|
|
42
|
+
default=False,
|
|
43
|
+
description="Whether the template can still be updated before it is ready for usage. If set to `false` the template is marked as `Available` and it will be ready for use. Defaults to `false`.",
|
|
44
|
+
)
|
|
45
|
+
expires_in: Annotated[int, Field(strict=True, ge=1)] | None = Field(
|
|
46
|
+
default=None,
|
|
47
|
+
description="Number of days before the signature request expires. Defaults to the account expiration setting or template expiration (if the document is created from a template).",
|
|
48
|
+
)
|
|
49
|
+
reminders: StrictBool | None = Field(
|
|
50
|
+
default=True,
|
|
51
|
+
description="Whether to send signing reminders to recipients. Reminders are sent on day 3, day 6, and day 10 if set to `true`. Defaults to `true`.",
|
|
52
|
+
)
|
|
53
|
+
apply_signing_order: StrictBool | None = Field(
|
|
54
|
+
default=False,
|
|
55
|
+
description="When set to `true` recipients will sign one at a time in the order of the `recipients` collection of this request.",
|
|
56
|
+
)
|
|
57
|
+
api_application_id: StrictStr | None = Field(
|
|
58
|
+
default=None,
|
|
59
|
+
description="Unique identifier for API Application settings to use. API Applications are optional and mainly used when isolating OAuth apps or for more control over embedded API settings",
|
|
60
|
+
)
|
|
61
|
+
redirect_url: StrictStr | None = Field(
|
|
62
|
+
default=None, description="A URL that recipients are redirected to after successfully signing a document."
|
|
63
|
+
)
|
|
64
|
+
allow_decline: StrictBool | None = Field(
|
|
65
|
+
default=True,
|
|
66
|
+
description="Whether to allow recipients the option to decline signing a document. If multiple signers are involved in a document, any single recipient can cancel the entire document signing process by declining to sign.",
|
|
67
|
+
)
|
|
68
|
+
allow_reassign: StrictBool | None = Field(
|
|
69
|
+
default=True,
|
|
70
|
+
description="In some cases a signer is not the right person to sign and may need to reassign their signing responsibilities to another person. This feature allows them to reassign the document to someone else.",
|
|
71
|
+
)
|
|
72
|
+
decline_redirect_url: StrictStr | None = Field(
|
|
73
|
+
default=None, description="A URL that recipients are redirected to if the document is declined."
|
|
74
|
+
)
|
|
75
|
+
metadata: Dict[str, StrictStr] | None = Field(
|
|
76
|
+
default=None,
|
|
77
|
+
description="Optional key-value data that can be associated with the document. If set, will be available every time the document data is returned.",
|
|
78
|
+
)
|
|
79
|
+
labels: List[LabelRequest] | None = Field(
|
|
80
|
+
default=None,
|
|
81
|
+
description="Labels can be used to organize documents in a way that can make it easy to find using the document search in SignWell. A document can have multiple labels. Updating labels on a document will replace any existing labels for that document.",
|
|
82
|
+
)
|
|
83
|
+
checkbox_groups: List[TemplateCheckboxGroupsInner] | None = Field(
|
|
84
|
+
default=None,
|
|
85
|
+
description="Checkbox fields that are placed on a document can be grouped with selection requirements. At least 2 checkbox fields in an array of fields must be assigned to the same recipient.",
|
|
86
|
+
)
|
|
87
|
+
additional_properties: Dict[str, Any] = {}
|
|
88
|
+
__properties: ClassVar[List[str]] = [
|
|
89
|
+
"name",
|
|
90
|
+
"subject",
|
|
91
|
+
"message",
|
|
92
|
+
"draft",
|
|
93
|
+
"expires_in",
|
|
94
|
+
"reminders",
|
|
95
|
+
"apply_signing_order",
|
|
96
|
+
"api_application_id",
|
|
97
|
+
"redirect_url",
|
|
98
|
+
"allow_decline",
|
|
99
|
+
"allow_reassign",
|
|
100
|
+
"decline_redirect_url",
|
|
101
|
+
"metadata",
|
|
102
|
+
"labels",
|
|
103
|
+
"checkbox_groups",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
model_config = ConfigDict(
|
|
107
|
+
populate_by_name=True,
|
|
108
|
+
validate_assignment=True,
|
|
109
|
+
protected_namespaces=(),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
def to_str(self) -> str:
|
|
113
|
+
"""Returns the string representation of the model using alias"""
|
|
114
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
115
|
+
|
|
116
|
+
def to_json(self) -> str:
|
|
117
|
+
"""Returns the JSON representation of the model using alias"""
|
|
118
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
119
|
+
return json.dumps(self.to_dict())
|
|
120
|
+
|
|
121
|
+
@classmethod
|
|
122
|
+
def from_json(cls, json_str: str) -> Self | None:
|
|
123
|
+
"""Create an instance of DocumentTemplateUpdateRequest from a JSON string"""
|
|
124
|
+
return cls.from_dict(json.loads(json_str))
|
|
125
|
+
|
|
126
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
127
|
+
"""Return the dictionary representation of the model using alias.
|
|
128
|
+
|
|
129
|
+
This has the following differences from calling pydantic's
|
|
130
|
+
`self.model_dump(by_alias=True)`:
|
|
131
|
+
|
|
132
|
+
* `None` is only added to the output dict for nullable fields that
|
|
133
|
+
were set at model initialization. Other fields with value `None`
|
|
134
|
+
are ignored.
|
|
135
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
136
|
+
"""
|
|
137
|
+
excluded_fields: Set[str] = set(
|
|
138
|
+
[
|
|
139
|
+
"additional_properties",
|
|
140
|
+
]
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
_dict = self.model_dump(
|
|
144
|
+
by_alias=True,
|
|
145
|
+
exclude=excluded_fields,
|
|
146
|
+
exclude_none=True,
|
|
147
|
+
)
|
|
148
|
+
# override the default output from pydantic by calling `to_dict()` of each item in labels (list)
|
|
149
|
+
_items_labels: list[Any] = []
|
|
150
|
+
if self.labels:
|
|
151
|
+
for _item_labels in self.labels:
|
|
152
|
+
if _item_labels:
|
|
153
|
+
_items_labels.append(_item_labels.to_dict())
|
|
154
|
+
_dict["labels"] = _items_labels
|
|
155
|
+
# override the default output from pydantic by calling `to_dict()` of each item in checkbox_groups (list)
|
|
156
|
+
_items_checkbox_groups: list[Any] = []
|
|
157
|
+
if self.checkbox_groups:
|
|
158
|
+
for _item_checkbox_groups in self.checkbox_groups:
|
|
159
|
+
if _item_checkbox_groups:
|
|
160
|
+
_items_checkbox_groups.append(_item_checkbox_groups.to_dict())
|
|
161
|
+
_dict["checkbox_groups"] = _items_checkbox_groups
|
|
162
|
+
# puts key-value pairs in additional_properties in the top level
|
|
163
|
+
if self.additional_properties is not None:
|
|
164
|
+
for _key, _value in self.additional_properties.items():
|
|
165
|
+
_dict[_key] = _value
|
|
166
|
+
|
|
167
|
+
return _dict
|
|
168
|
+
|
|
169
|
+
@classmethod
|
|
170
|
+
def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
|
|
171
|
+
"""Create an instance of DocumentTemplateUpdateRequest 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
|
+
"name": obj.get("name"),
|
|
181
|
+
"subject": obj.get("subject"),
|
|
182
|
+
"message": obj.get("message"),
|
|
183
|
+
"draft": obj.get("draft") if obj.get("draft") is not None else False,
|
|
184
|
+
"expires_in": obj.get("expires_in"),
|
|
185
|
+
"reminders": obj.get("reminders") if obj.get("reminders") is not None else True,
|
|
186
|
+
"apply_signing_order": obj.get("apply_signing_order")
|
|
187
|
+
if obj.get("apply_signing_order") is not None
|
|
188
|
+
else False,
|
|
189
|
+
"api_application_id": obj.get("api_application_id"),
|
|
190
|
+
"redirect_url": obj.get("redirect_url"),
|
|
191
|
+
"allow_decline": obj.get("allow_decline") if obj.get("allow_decline") is not None else True,
|
|
192
|
+
"allow_reassign": obj.get("allow_reassign") if obj.get("allow_reassign") is not None else True,
|
|
193
|
+
"decline_redirect_url": obj.get("decline_redirect_url"),
|
|
194
|
+
"metadata": obj.get("metadata"),
|
|
195
|
+
"labels": [LabelRequest.from_dict(_item) for _item in obj["labels"]]
|
|
196
|
+
if obj.get("labels") is not None
|
|
197
|
+
else None,
|
|
198
|
+
"checkbox_groups": [TemplateCheckboxGroupsInner.from_dict(_item) for _item in obj["checkbox_groups"]]
|
|
199
|
+
if obj.get("checkbox_groups") is not None
|
|
200
|
+
else None,
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
# store additional fields in additional_properties
|
|
204
|
+
for _key in obj.keys():
|
|
205
|
+
if _key not in cls.__properties:
|
|
206
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
207
|
+
|
|
208
|
+
return _obj
|
|
@@ -0,0 +1,153 @@
|
|
|
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 BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
17
|
+
from typing import Any, List, Optional
|
|
18
|
+
from signwell_sdk.models.detailed_option import DetailedOption
|
|
19
|
+
from pydantic import StrictStr, Field
|
|
20
|
+
from typing import Union, List, Set, Optional, Dict, cast
|
|
21
|
+
from typing_extensions import Literal, Self
|
|
22
|
+
|
|
23
|
+
DROPDOWNOPTION_ONE_OF_SCHEMAS = ["DetailedOption", "str"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DropdownOption(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
A dropdown option - either a simple string or a detailed object with name and optional api_id
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
# data type: str
|
|
32
|
+
oneof_schema_1_validator: StrictStr | None = Field(default=None, description="Simple string option")
|
|
33
|
+
# data type: DetailedOption
|
|
34
|
+
oneof_schema_2_validator: DetailedOption | None = None
|
|
35
|
+
actual_instance: Union[DetailedOption, str] | None = None
|
|
36
|
+
one_of_schemas: Set[str] = {"DetailedOption", "str"}
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
arbitrary_types_allowed=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
45
|
+
if args:
|
|
46
|
+
if len(args) > 1:
|
|
47
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
48
|
+
if kwargs:
|
|
49
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
50
|
+
super().__init__(actual_instance=args[0])
|
|
51
|
+
else:
|
|
52
|
+
super().__init__(**kwargs)
|
|
53
|
+
|
|
54
|
+
@field_validator("actual_instance")
|
|
55
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
56
|
+
instance = DropdownOption.model_construct()
|
|
57
|
+
error_messages = []
|
|
58
|
+
match = 0
|
|
59
|
+
# validate data type: str
|
|
60
|
+
try:
|
|
61
|
+
instance.oneof_schema_1_validator = v
|
|
62
|
+
match += 1
|
|
63
|
+
except (ValidationError, ValueError) as e:
|
|
64
|
+
error_messages.append(str(e))
|
|
65
|
+
# validate data type: DetailedOption
|
|
66
|
+
if not isinstance(v, DetailedOption):
|
|
67
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `DetailedOption`")
|
|
68
|
+
else:
|
|
69
|
+
match += 1
|
|
70
|
+
if match > 1:
|
|
71
|
+
# more than 1 match
|
|
72
|
+
raise ValueError(
|
|
73
|
+
"Multiple matches found when setting `actual_instance` in DropdownOption with oneOf schemas: DetailedOption, str. Details: "
|
|
74
|
+
+ ", ".join(error_messages)
|
|
75
|
+
)
|
|
76
|
+
elif match == 0:
|
|
77
|
+
# no match
|
|
78
|
+
raise ValueError(
|
|
79
|
+
"No match found when setting `actual_instance` in DropdownOption with oneOf schemas: DetailedOption, str. Details: "
|
|
80
|
+
+ ", ".join(error_messages)
|
|
81
|
+
)
|
|
82
|
+
else:
|
|
83
|
+
return v
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
87
|
+
return cls.from_json(json.dumps(obj))
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_json(cls, json_str: str) -> Self:
|
|
91
|
+
"""Returns the object represented by the json string"""
|
|
92
|
+
instance = cls.model_construct()
|
|
93
|
+
error_messages = []
|
|
94
|
+
match = 0
|
|
95
|
+
|
|
96
|
+
# deserialize data into str
|
|
97
|
+
try:
|
|
98
|
+
# validation
|
|
99
|
+
instance.oneof_schema_1_validator = json.loads(json_str)
|
|
100
|
+
# assign value to actual_instance
|
|
101
|
+
instance.actual_instance = cast(
|
|
102
|
+
Union[DetailedOption, str],
|
|
103
|
+
instance.oneof_schema_1_validator,
|
|
104
|
+
)
|
|
105
|
+
match += 1
|
|
106
|
+
except (ValidationError, ValueError) as e:
|
|
107
|
+
error_messages.append(str(e))
|
|
108
|
+
# deserialize data into DetailedOption
|
|
109
|
+
try:
|
|
110
|
+
instance.actual_instance = DetailedOption.from_json(json_str)
|
|
111
|
+
match += 1
|
|
112
|
+
except (ValidationError, ValueError) as e:
|
|
113
|
+
error_messages.append(str(e))
|
|
114
|
+
|
|
115
|
+
if match > 1:
|
|
116
|
+
# more than 1 match
|
|
117
|
+
raise ValueError(
|
|
118
|
+
"Multiple matches found when deserializing the JSON string into DropdownOption with oneOf schemas: DetailedOption, str. Details: "
|
|
119
|
+
+ ", ".join(error_messages)
|
|
120
|
+
)
|
|
121
|
+
elif match == 0:
|
|
122
|
+
# no match
|
|
123
|
+
raise ValueError(
|
|
124
|
+
"No match found when deserializing the JSON string into DropdownOption with oneOf schemas: DetailedOption, str. Details: "
|
|
125
|
+
+ ", ".join(error_messages)
|
|
126
|
+
)
|
|
127
|
+
else:
|
|
128
|
+
return instance
|
|
129
|
+
|
|
130
|
+
def to_json(self) -> str:
|
|
131
|
+
"""Returns the JSON representation of the actual instance"""
|
|
132
|
+
if self.actual_instance is None:
|
|
133
|
+
return "null"
|
|
134
|
+
|
|
135
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
136
|
+
return self.actual_instance.to_json()
|
|
137
|
+
else:
|
|
138
|
+
return json.dumps(self.actual_instance)
|
|
139
|
+
|
|
140
|
+
def to_dict(self) -> Union[Dict[str, Any], DetailedOption, str] | None:
|
|
141
|
+
"""Returns the dict representation of the actual instance"""
|
|
142
|
+
if self.actual_instance is None:
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
146
|
+
return self.actual_instance.to_dict()
|
|
147
|
+
else:
|
|
148
|
+
# primitive type
|
|
149
|
+
return self.actual_instance
|
|
150
|
+
|
|
151
|
+
def to_str(self) -> str:
|
|
152
|
+
"""Returns the string representation of the actual instance"""
|
|
153
|
+
return pprint.pformat(self.model_dump())
|
|
@@ -0,0 +1,107 @@
|
|
|
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, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from signwell_sdk.models.error_response_meta import ErrorResponseMeta
|
|
21
|
+
from typing import Any, Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ErrorResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Standard error response
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
message: StrictStr | None = Field(default=None, description="Human-readable error message")
|
|
31
|
+
meta: ErrorResponseMeta | None = None
|
|
32
|
+
additional_properties: Dict[str, Any] = {}
|
|
33
|
+
__properties: ClassVar[List[str]] = ["message", "meta"]
|
|
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 ErrorResponse 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
|
+
# override the default output from pydantic by calling `to_dict()` of meta
|
|
78
|
+
if self.meta:
|
|
79
|
+
_dict["meta"] = self.meta.to_dict()
|
|
80
|
+
# puts key-value pairs in additional_properties in the top level
|
|
81
|
+
if self.additional_properties is not None:
|
|
82
|
+
for _key, _value in self.additional_properties.items():
|
|
83
|
+
_dict[_key] = _value
|
|
84
|
+
|
|
85
|
+
return _dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
|
|
89
|
+
"""Create an instance of ErrorResponse from a dict"""
|
|
90
|
+
if obj is None:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
if not isinstance(obj, dict):
|
|
94
|
+
return cls.model_validate(obj)
|
|
95
|
+
|
|
96
|
+
_obj = cls.model_validate(
|
|
97
|
+
{
|
|
98
|
+
"message": obj.get("message"),
|
|
99
|
+
"meta": ErrorResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
# store additional fields in additional_properties
|
|
103
|
+
for _key in obj.keys():
|
|
104
|
+
if _key not in cls.__properties:
|
|
105
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
106
|
+
|
|
107
|
+
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, Field, 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 ErrorResponseMeta(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
ErrorResponseMeta
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
|
|
29
|
+
error: StrictStr = Field(description="Error code identifier")
|
|
30
|
+
message: StrictStr = Field(description="Detailed error message")
|
|
31
|
+
messages: List[StrictStr] | None = Field(default=None, description="List of error messages")
|
|
32
|
+
additional_properties: Dict[str, Any] = {}
|
|
33
|
+
__properties: ClassVar[List[str]] = ["error", "message", "messages"]
|
|
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 ErrorResponseMeta 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 ErrorResponseMeta 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
|
+
{"error": obj.get("error"), "message": obj.get("message"), "messages": obj.get("messages")}
|
|
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,46 @@
|
|
|
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
|
+
from enum import Enum
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class FieldType(str, Enum):
|
|
20
|
+
"""
|
|
21
|
+
Type of signing field
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
allowed enum values
|
|
26
|
+
"""
|
|
27
|
+
INITIALS = "initials"
|
|
28
|
+
SIGNATURE = "signature"
|
|
29
|
+
CHECKBOX = "checkbox"
|
|
30
|
+
DATE = "date"
|
|
31
|
+
SELECT = "select"
|
|
32
|
+
TEXT = "text"
|
|
33
|
+
DROPDOWN = "dropdown"
|
|
34
|
+
AUTOFILL_COMPANY = "autofill_company"
|
|
35
|
+
AUTOFILL_EMAIL = "autofill_email"
|
|
36
|
+
AUTOFILL_FIRST_NAME = "autofill_first_name"
|
|
37
|
+
AUTOFILL_LAST_NAME = "autofill_last_name"
|
|
38
|
+
AUTOFILL_NAME = "autofill_name"
|
|
39
|
+
AUTOFILL_PHONE = "autofill_phone"
|
|
40
|
+
AUTOFILL_TITLE = "autofill_title"
|
|
41
|
+
AUTOFILL_DATE_SIGNED = "autofill_date_signed"
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_json(cls, json_str: str) -> Self:
|
|
45
|
+
"""Create an instance of FieldType from a JSON string"""
|
|
46
|
+
return cls(json.loads(json_str))
|