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,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, 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 DocumentResponseRecipientsInner(BaseModel):
26
+ """
27
+ DocumentResponseRecipientsInner
28
+ """ # noqa: E501
29
+
30
+ id: StrictStr | None = None
31
+ name: StrictStr
32
+ email: StrictStr
33
+ body: 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
+ additional_properties: Dict[str, Any] = {}
47
+ __properties: ClassVar[List[str]] = [
48
+ "id",
49
+ "name",
50
+ "email",
51
+ "body",
52
+ "message",
53
+ "subject",
54
+ "send_email",
55
+ "send_email_delay",
56
+ "signing_order",
57
+ "signing_url",
58
+ "embedded_signing_url",
59
+ "bounced",
60
+ "bounced_details",
61
+ "attachment_requests",
62
+ "passcode",
63
+ "status",
64
+ ]
65
+
66
+ model_config = ConfigDict(
67
+ populate_by_name=True,
68
+ validate_assignment=True,
69
+ protected_namespaces=(),
70
+ )
71
+
72
+ def to_str(self) -> str:
73
+ """Returns the string representation of the model using alias"""
74
+ return pprint.pformat(self.model_dump(by_alias=True))
75
+
76
+ def to_json(self) -> str:
77
+ """Returns the JSON representation of the model using alias"""
78
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
79
+ return json.dumps(self.to_dict())
80
+
81
+ @classmethod
82
+ def from_json(cls, json_str: str) -> Self | None:
83
+ """Create an instance of DocumentResponseRecipientsInner from a JSON string"""
84
+ return cls.from_dict(json.loads(json_str))
85
+
86
+ def to_dict(self) -> Dict[str, Any]:
87
+ """Return the dictionary representation of the model using alias.
88
+
89
+ This has the following differences from calling pydantic's
90
+ `self.model_dump(by_alias=True)`:
91
+
92
+ * `None` is only added to the output dict for nullable fields that
93
+ were set at model initialization. Other fields with value `None`
94
+ are ignored.
95
+ * Fields in `self.additional_properties` are added to the output dict.
96
+ """
97
+ excluded_fields: Set[str] = set(
98
+ [
99
+ "additional_properties",
100
+ ]
101
+ )
102
+
103
+ _dict = self.model_dump(
104
+ by_alias=True,
105
+ exclude=excluded_fields,
106
+ exclude_none=True,
107
+ )
108
+ # override the default output from pydantic by calling `to_dict()` of each item in attachment_requests (list)
109
+ _items_attachment_requests: list[Any] = []
110
+ if self.attachment_requests:
111
+ for _item_attachment_requests in self.attachment_requests:
112
+ if _item_attachment_requests:
113
+ _items_attachment_requests.append(_item_attachment_requests.to_dict())
114
+ _dict["attachment_requests"] = _items_attachment_requests
115
+ # puts key-value pairs in additional_properties in the top level
116
+ if self.additional_properties is not None:
117
+ for _key, _value in self.additional_properties.items():
118
+ _dict[_key] = _value
119
+
120
+ # set to None if message (nullable) is None
121
+ # and model_fields_set contains the field
122
+ if self.message is None and "message" in self.model_fields_set:
123
+ _dict["message"] = None
124
+
125
+ # set to None if subject (nullable) is None
126
+ # and model_fields_set contains the field
127
+ if self.subject is None and "subject" in self.model_fields_set:
128
+ _dict["subject"] = None
129
+
130
+ # set to None if send_email (nullable) is None
131
+ # and model_fields_set contains the field
132
+ if self.send_email is None and "send_email" in self.model_fields_set:
133
+ _dict["send_email"] = None
134
+
135
+ # set to None if send_email_delay (nullable) is None
136
+ # and model_fields_set contains the field
137
+ if self.send_email_delay is None and "send_email_delay" in self.model_fields_set:
138
+ _dict["send_email_delay"] = None
139
+
140
+ # set to None if signing_url (nullable) is None
141
+ # and model_fields_set contains the field
142
+ if self.signing_url is None and "signing_url" in self.model_fields_set:
143
+ _dict["signing_url"] = None
144
+
145
+ # set to None if embedded_signing_url (nullable) is None
146
+ # and model_fields_set contains the field
147
+ if self.embedded_signing_url is None and "embedded_signing_url" in self.model_fields_set:
148
+ _dict["embedded_signing_url"] = None
149
+
150
+ # set to None if bounced (nullable) is None
151
+ # and model_fields_set contains the field
152
+ if self.bounced is None and "bounced" in self.model_fields_set:
153
+ _dict["bounced"] = None
154
+
155
+ # set to None if bounced_details (nullable) is None
156
+ # and model_fields_set contains the field
157
+ if self.bounced_details is None and "bounced_details" in self.model_fields_set:
158
+ _dict["bounced_details"] = None
159
+
160
+ # set to None if passcode (nullable) is None
161
+ # and model_fields_set contains the field
162
+ if self.passcode is None and "passcode" in self.model_fields_set:
163
+ _dict["passcode"] = None
164
+
165
+ # set to None if status (nullable) is None
166
+ # and model_fields_set contains the field
167
+ if self.status is None and "status" in self.model_fields_set:
168
+ _dict["status"] = None
169
+
170
+ return _dict
171
+
172
+ @classmethod
173
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
174
+ """Create an instance of DocumentResponseRecipientsInner from a dict"""
175
+ if obj is None:
176
+ return None
177
+
178
+ if not isinstance(obj, dict):
179
+ return cls.model_validate(obj)
180
+
181
+ _obj = cls.model_validate(
182
+ {
183
+ "id": obj.get("id"),
184
+ "name": obj.get("name"),
185
+ "email": obj.get("email"),
186
+ "body": obj.get("body"),
187
+ "message": obj.get("message"),
188
+ "subject": obj.get("subject"),
189
+ "send_email": obj.get("send_email"),
190
+ "send_email_delay": obj.get("send_email_delay"),
191
+ "signing_order": obj.get("signing_order"),
192
+ "signing_url": obj.get("signing_url"),
193
+ "embedded_signing_url": obj.get("embedded_signing_url"),
194
+ "bounced": obj.get("bounced"),
195
+ "bounced_details": obj.get("bounced_details"),
196
+ "attachment_requests": [AttachmentRequestInfo.from_dict(_item) for _item in obj["attachment_requests"]]
197
+ if obj.get("attachment_requests") is not None
198
+ else None,
199
+ "passcode": obj.get("passcode"),
200
+ "status": obj.get("status"),
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,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_template_response import DocumentTemplateResponse
21
+ from typing import Any, Optional, Set
22
+ from typing_extensions import Self
23
+
24
+
25
+ class DocumentTemplateListResponse(BaseModel):
26
+ """
27
+ List of templates with pagination
28
+ """ # noqa: E501
29
+
30
+ templates: List[DocumentTemplateResponse]
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
+ "templates",
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 DocumentTemplateListResponse 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 templates (list)
89
+ _items_templates: list[Any] = []
90
+ if self.templates:
91
+ for _item_templates in self.templates:
92
+ if _item_templates:
93
+ _items_templates.append(_item_templates.to_dict())
94
+ _dict["templates"] = _items_templates
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 DocumentTemplateListResponse 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
+ "templates": [DocumentTemplateResponse.from_dict(_item) for _item in obj["templates"]]
124
+ if obj.get("templates") 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
@@ -0,0 +1,307 @@
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.copied_placeholders_inner import CopiedPlaceholdersInner
22
+ from signwell_sdk.models.files_inner import FilesInner
23
+ from signwell_sdk.models.label_request import LabelRequest
24
+ from signwell_sdk.models.placeholders_inner import PlaceholdersInner
25
+ from signwell_sdk.models.template_attachment_requests_inner import TemplateAttachmentRequestsInner
26
+ from signwell_sdk.models.template_checkbox_groups_inner import TemplateCheckboxGroupsInner
27
+ from signwell_sdk.models.template_fields_inner_inner import TemplateFieldsInnerInner
28
+ from typing import Any, Optional, Set
29
+ from typing_extensions import Self
30
+
31
+
32
+ class DocumentTemplateRequest(BaseModel):
33
+ """
34
+ DocumentTemplateRequest
35
+ """ # noqa: E501
36
+
37
+ files: List[FilesInner] = Field(
38
+ description="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, .doc, .docx, .pages, .ppt, .pptx, .key, .xls, .xlsx, .numbers, .jpg, .jpeg, .png, .tiff, .tif, .webp, .html, and .htm"
39
+ )
40
+ name: StrictStr | None = Field(default=None, description="The name of the template.")
41
+ subject: StrictStr | None = Field(
42
+ default=None,
43
+ 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).",
44
+ )
45
+ message: StrictStr | None = Field(
46
+ default=None,
47
+ 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).",
48
+ )
49
+ placeholders: List[PlaceholdersInner] = Field(
50
+ description="Placeholders are generally job roles that must complete and/or sign the document. For example, a placeholder might be “Client” or “Legal Department”. When a document is created from the template, you assign a person to each placeholder."
51
+ )
52
+ copied_placeholders: List[CopiedPlaceholdersInner] | None = Field(
53
+ default=None,
54
+ description="Copied placeholders are emailed the final document once it has been completed by all recipients.",
55
+ )
56
+ draft: StrictBool | None = Field(
57
+ default=False,
58
+ 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`.",
59
+ )
60
+ expires_in: Annotated[int, Field(strict=True, ge=1)] | None = Field(
61
+ default=None,
62
+ 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).",
63
+ )
64
+ reminders: StrictBool | None = Field(
65
+ default=True,
66
+ 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`.",
67
+ )
68
+ apply_signing_order: StrictBool | None = Field(
69
+ default=False,
70
+ description="When set to `true` recipients will sign one at a time in the order of the `recipients` collection of this request.",
71
+ )
72
+ api_application_id: StrictStr | None = Field(
73
+ default=None,
74
+ 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",
75
+ )
76
+ text_tags: StrictBool | None = Field(
77
+ default=False,
78
+ description="An alternative way (if you can’t use the recommended way) of placing fields in specific locations of your document by using special text tags. Useful when changing the content of your files changes the location of fields. See API documentation for “Text Tags” for details. Defaults to false.",
79
+ )
80
+ redirect_url: StrictStr | None = Field(
81
+ default=None, description="A URL that recipients are redirected to after successfully signing a document."
82
+ )
83
+ allow_decline: StrictBool | None = Field(
84
+ default=True,
85
+ 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.",
86
+ )
87
+ allow_reassign: StrictBool | None = Field(
88
+ default=True,
89
+ 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.",
90
+ )
91
+ decline_redirect_url: StrictStr | None = Field(
92
+ default=None, description="A URL that recipients are redirected to if the document is declined."
93
+ )
94
+ language: StrictStr | None = Field(
95
+ default=None,
96
+ description="Sets the language for the template and documents created from the template for all recipient side interactions including the document email and the document itself. Accepted languages: English, Français, Español, Deutsch, Polski, Português, Dansk, Nederlands, Italiano, Русский, Svenska, العربية, Ελληνικά, Türkçe, Slovenčina. Language should be sent in ISO 639-1 format: en, fr, es, de, pl, pt, da, nl, it, ru, sv, ar, el, tr, sk.",
97
+ )
98
+ metadata: Dict[str, StrictStr] | None = Field(
99
+ default=None,
100
+ description="Optional key-value data that can be associated with the document. If set, will be available every time the document data is returned.",
101
+ )
102
+ fields: List[List[TemplateFieldsInnerInner]] | None = Field(
103
+ default=None,
104
+ description="Document fields placed on a document for collecting data or signatures from recipients. At least one field must be present in the Create Document request if `draft` is `false` (unless adding a signature page by using `with_signature_page`). Field data should be sent as a 2-dimensional JSON array. One array of fields is needed for each file in the files array. An array of fields can be empty if you have a file that does not contain any fields.",
105
+ )
106
+ attachment_requests: List[TemplateAttachmentRequestsInner] | None = Field(
107
+ default=None,
108
+ description="Attachments that a recipient must upload to complete the signing process. Attachment requests are shown after all document fields have been completed.",
109
+ )
110
+ labels: List[LabelRequest] | None = Field(
111
+ default=None,
112
+ 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.",
113
+ )
114
+ checkbox_groups: List[TemplateCheckboxGroupsInner] | None = Field(
115
+ default=None,
116
+ 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.",
117
+ )
118
+ additional_properties: Dict[str, Any] = {}
119
+ __properties: ClassVar[List[str]] = [
120
+ "files",
121
+ "name",
122
+ "subject",
123
+ "message",
124
+ "placeholders",
125
+ "copied_placeholders",
126
+ "draft",
127
+ "expires_in",
128
+ "reminders",
129
+ "apply_signing_order",
130
+ "api_application_id",
131
+ "text_tags",
132
+ "redirect_url",
133
+ "allow_decline",
134
+ "allow_reassign",
135
+ "decline_redirect_url",
136
+ "language",
137
+ "metadata",
138
+ "fields",
139
+ "attachment_requests",
140
+ "labels",
141
+ "checkbox_groups",
142
+ ]
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 DocumentTemplateRequest 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 each item in files (list)
187
+ _items_files: list[Any] = []
188
+ if self.files:
189
+ for _item_files in self.files:
190
+ if _item_files:
191
+ _items_files.append(_item_files.to_dict())
192
+ _dict["files"] = _items_files
193
+ # override the default output from pydantic by calling `to_dict()` of each item in placeholders (list)
194
+ _items_placeholders: list[Any] = []
195
+ if self.placeholders:
196
+ for _item_placeholders in self.placeholders:
197
+ if _item_placeholders:
198
+ _items_placeholders.append(_item_placeholders.to_dict())
199
+ _dict["placeholders"] = _items_placeholders
200
+ # override the default output from pydantic by calling `to_dict()` of each item in copied_placeholders (list)
201
+ _items_copied_placeholders: list[Any] = []
202
+ if self.copied_placeholders:
203
+ for _item_copied_placeholders in self.copied_placeholders:
204
+ if _item_copied_placeholders:
205
+ _items_copied_placeholders.append(_item_copied_placeholders.to_dict())
206
+ _dict["copied_placeholders"] = _items_copied_placeholders
207
+ # override the default output from pydantic by calling `to_dict()` of each item in fields (list of list)
208
+ _items_fields: list[Any] = []
209
+ if self.fields:
210
+ for _item_fields in self.fields:
211
+ if _item_fields:
212
+ _items_fields.append(
213
+ [_inner_item.to_dict() for _inner_item in _item_fields if _inner_item is not None]
214
+ )
215
+ _dict["fields"] = _items_fields
216
+ # override the default output from pydantic by calling `to_dict()` of each item in attachment_requests (list)
217
+ _items_attachment_requests: list[Any] = []
218
+ if self.attachment_requests:
219
+ for _item_attachment_requests in self.attachment_requests:
220
+ if _item_attachment_requests:
221
+ _items_attachment_requests.append(_item_attachment_requests.to_dict())
222
+ _dict["attachment_requests"] = _items_attachment_requests
223
+ # override the default output from pydantic by calling `to_dict()` of each item in labels (list)
224
+ _items_labels: list[Any] = []
225
+ if self.labels:
226
+ for _item_labels in self.labels:
227
+ if _item_labels:
228
+ _items_labels.append(_item_labels.to_dict())
229
+ _dict["labels"] = _items_labels
230
+ # override the default output from pydantic by calling `to_dict()` of each item in checkbox_groups (list)
231
+ _items_checkbox_groups: list[Any] = []
232
+ if self.checkbox_groups:
233
+ for _item_checkbox_groups in self.checkbox_groups:
234
+ if _item_checkbox_groups:
235
+ _items_checkbox_groups.append(_item_checkbox_groups.to_dict())
236
+ _dict["checkbox_groups"] = _items_checkbox_groups
237
+ # puts key-value pairs in additional_properties in the top level
238
+ if self.additional_properties is not None:
239
+ for _key, _value in self.additional_properties.items():
240
+ _dict[_key] = _value
241
+
242
+ return _dict
243
+
244
+ @classmethod
245
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
246
+ """Create an instance of DocumentTemplateRequest from a dict"""
247
+ if obj is None:
248
+ return None
249
+
250
+ if not isinstance(obj, dict):
251
+ return cls.model_validate(obj)
252
+
253
+ _obj = cls.model_validate(
254
+ {
255
+ "files": [FilesInner.from_dict(_item) for _item in obj["files"]]
256
+ if obj.get("files") is not None
257
+ else None,
258
+ "name": obj.get("name"),
259
+ "subject": obj.get("subject"),
260
+ "message": obj.get("message"),
261
+ "placeholders": [PlaceholdersInner.from_dict(_item) for _item in obj["placeholders"]]
262
+ if obj.get("placeholders") is not None
263
+ else None,
264
+ "copied_placeholders": [
265
+ CopiedPlaceholdersInner.from_dict(_item) for _item in obj["copied_placeholders"]
266
+ ]
267
+ if obj.get("copied_placeholders") is not None
268
+ else None,
269
+ "draft": obj.get("draft") if obj.get("draft") is not None else False,
270
+ "expires_in": obj.get("expires_in"),
271
+ "reminders": obj.get("reminders") if obj.get("reminders") is not None else True,
272
+ "apply_signing_order": obj.get("apply_signing_order")
273
+ if obj.get("apply_signing_order") is not None
274
+ else False,
275
+ "api_application_id": obj.get("api_application_id"),
276
+ "text_tags": obj.get("text_tags") if obj.get("text_tags") is not None else False,
277
+ "redirect_url": obj.get("redirect_url"),
278
+ "allow_decline": obj.get("allow_decline") if obj.get("allow_decline") is not None else True,
279
+ "allow_reassign": obj.get("allow_reassign") if obj.get("allow_reassign") is not None else True,
280
+ "decline_redirect_url": obj.get("decline_redirect_url"),
281
+ "language": obj.get("language"),
282
+ "metadata": obj.get("metadata"),
283
+ "fields": [
284
+ [TemplateFieldsInnerInner.from_dict(_inner_item) for _inner_item in _item]
285
+ for _item in obj["fields"]
286
+ ]
287
+ if obj.get("fields") is not None
288
+ else None,
289
+ "attachment_requests": [
290
+ TemplateAttachmentRequestsInner.from_dict(_item) for _item in obj["attachment_requests"]
291
+ ]
292
+ if obj.get("attachment_requests") is not None
293
+ else None,
294
+ "labels": [LabelRequest.from_dict(_item) for _item in obj["labels"]]
295
+ if obj.get("labels") is not None
296
+ else None,
297
+ "checkbox_groups": [TemplateCheckboxGroupsInner.from_dict(_item) for _item in obj["checkbox_groups"]]
298
+ if obj.get("checkbox_groups") is not None
299
+ else None,
300
+ }
301
+ )
302
+ # store additional fields in additional_properties
303
+ for _key in obj.keys():
304
+ if _key not in cls.__properties:
305
+ _obj.additional_properties[_key] = obj.get(_key)
306
+
307
+ return _obj