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,111 @@
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 CopiedPlaceholdersInner(BaseModel):
25
+ """
26
+ CopiedPlaceholdersInner
27
+ """ # noqa: E501
28
+
29
+ name: StrictStr = Field(description="Name of the placeholder.")
30
+ preassigned_recipient_name: StrictStr | None = Field(
31
+ default=None,
32
+ description="In some cases, it may be necessary to pre-fill the name and email for a placeholder because it will always be the same person for all documents created from this template. This sets the name.",
33
+ )
34
+ preassigned_recipient_email: StrictStr | None = Field(
35
+ default=None,
36
+ description="In some cases, it may be necessary to pre-fill the name and email for a placeholder because it will always be the same person for all documents created from this template. This sets the email.",
37
+ )
38
+ additional_properties: Dict[str, Any] = {}
39
+ __properties: ClassVar[List[str]] = ["name", "preassigned_recipient_name", "preassigned_recipient_email"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Self | None:
58
+ """Create an instance of CopiedPlaceholdersInner from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ * Fields in `self.additional_properties` are added to the output dict.
71
+ """
72
+ excluded_fields: Set[str] = set(
73
+ [
74
+ "additional_properties",
75
+ ]
76
+ )
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # puts key-value pairs in additional_properties in the top level
84
+ if self.additional_properties is not None:
85
+ for _key, _value in self.additional_properties.items():
86
+ _dict[_key] = _value
87
+
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
92
+ """Create an instance of CopiedPlaceholdersInner from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate(
100
+ {
101
+ "name": obj.get("name"),
102
+ "preassigned_recipient_name": obj.get("preassigned_recipient_name"),
103
+ "preassigned_recipient_email": obj.get("preassigned_recipient_email"),
104
+ }
105
+ )
106
+ # store additional fields in additional_properties
107
+ for _key in obj.keys():
108
+ if _key not in cls.__properties:
109
+ _obj.additional_properties[_key] = obj.get(_key)
110
+
111
+ return _obj
@@ -0,0 +1,155 @@
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 import Any, Optional, Set
21
+ from typing_extensions import Self
22
+
23
+
24
+ class CreateBulkSendRequest(BaseModel):
25
+ """
26
+ CreateBulkSendRequest
27
+ """ # noqa: E501
28
+
29
+ template_ids: List[StrictStr] = Field(description="Unique identifiers for a list of templates.")
30
+ bulk_send_csv: StrictStr = Field(description="A RFC 4648 base64 string of the template CSV file to be validated.")
31
+ skip_row_errors: StrictBool | None = Field(
32
+ default=False, description="Whether to skip errors in the rows. Defaults to `false`."
33
+ )
34
+ api_application_id: StrictStr | None = Field(
35
+ default=None,
36
+ 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",
37
+ )
38
+ name: StrictStr | None = Field(
39
+ default=None,
40
+ description="The name of the Bulk Send. Will be used as the document name for each of the documents.",
41
+ )
42
+ subject: StrictStr | None = Field(
43
+ default=None,
44
+ description="Email subject for the signature request that recipients will see. Defaults to the default system subject or a template subject.",
45
+ )
46
+ message: StrictStr | None = Field(
47
+ default=None,
48
+ description="Email message for the signature request that recipients will see. Defaults to the default system message or a template message.",
49
+ )
50
+ apply_signing_order: StrictBool | None = Field(
51
+ default=False,
52
+ description="When set to `true` recipients will sign one at a time in the order of the `recipients` collection of this request.",
53
+ )
54
+ custom_requester_name: StrictStr | None = Field(
55
+ default=None,
56
+ description="Sets the custom requester name for the document. When set, this is the name used for all email communications, signing notifications, and in the audit file.",
57
+ )
58
+ custom_requester_email: StrictStr | None = Field(
59
+ default=None,
60
+ description="Sets the custom requester email for the document. When set, this is the email used for all email communications, signing notifications, and in the audit file.",
61
+ )
62
+ additional_properties: Dict[str, Any] = {}
63
+ __properties: ClassVar[List[str]] = [
64
+ "template_ids",
65
+ "bulk_send_csv",
66
+ "skip_row_errors",
67
+ "api_application_id",
68
+ "name",
69
+ "subject",
70
+ "message",
71
+ "apply_signing_order",
72
+ "custom_requester_name",
73
+ "custom_requester_email",
74
+ ]
75
+
76
+ model_config = ConfigDict(
77
+ populate_by_name=True,
78
+ validate_assignment=True,
79
+ protected_namespaces=(),
80
+ )
81
+
82
+ def to_str(self) -> str:
83
+ """Returns the string representation of the model using alias"""
84
+ return pprint.pformat(self.model_dump(by_alias=True))
85
+
86
+ def to_json(self) -> str:
87
+ """Returns the JSON representation of the model using alias"""
88
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
89
+ return json.dumps(self.to_dict())
90
+
91
+ @classmethod
92
+ def from_json(cls, json_str: str) -> Self | None:
93
+ """Create an instance of CreateBulkSendRequest from a JSON string"""
94
+ return cls.from_dict(json.loads(json_str))
95
+
96
+ def to_dict(self) -> Dict[str, Any]:
97
+ """Return the dictionary representation of the model using alias.
98
+
99
+ This has the following differences from calling pydantic's
100
+ `self.model_dump(by_alias=True)`:
101
+
102
+ * `None` is only added to the output dict for nullable fields that
103
+ were set at model initialization. Other fields with value `None`
104
+ are ignored.
105
+ * Fields in `self.additional_properties` are added to the output dict.
106
+ """
107
+ excluded_fields: Set[str] = set(
108
+ [
109
+ "additional_properties",
110
+ ]
111
+ )
112
+
113
+ _dict = self.model_dump(
114
+ by_alias=True,
115
+ exclude=excluded_fields,
116
+ exclude_none=True,
117
+ )
118
+ # puts key-value pairs in additional_properties in the top level
119
+ if self.additional_properties is not None:
120
+ for _key, _value in self.additional_properties.items():
121
+ _dict[_key] = _value
122
+
123
+ return _dict
124
+
125
+ @classmethod
126
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
127
+ """Create an instance of CreateBulkSendRequest from a dict"""
128
+ if obj is None:
129
+ return None
130
+
131
+ if not isinstance(obj, dict):
132
+ return cls.model_validate(obj)
133
+
134
+ _obj = cls.model_validate(
135
+ {
136
+ "template_ids": obj.get("template_ids"),
137
+ "bulk_send_csv": obj.get("bulk_send_csv"),
138
+ "skip_row_errors": obj.get("skip_row_errors") if obj.get("skip_row_errors") is not None else False,
139
+ "api_application_id": obj.get("api_application_id"),
140
+ "name": obj.get("name"),
141
+ "subject": obj.get("subject"),
142
+ "message": obj.get("message"),
143
+ "apply_signing_order": obj.get("apply_signing_order")
144
+ if obj.get("apply_signing_order") is not None
145
+ else False,
146
+ "custom_requester_name": obj.get("custom_requester_name"),
147
+ "custom_requester_email": obj.get("custom_requester_email"),
148
+ }
149
+ )
150
+ # store additional fields in additional_properties
151
+ for _key in obj.keys():
152
+ if _key not in cls.__properties:
153
+ _obj.additional_properties[_key] = obj.get(_key)
154
+
155
+ return _obj
@@ -0,0 +1,100 @@
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 CreateWebhookRequest(BaseModel):
25
+ """
26
+ CreateWebhookRequest
27
+ """ # noqa: E501
28
+
29
+ callback_url: StrictStr = Field(description="URL that we will post document events to.")
30
+ api_application_id: StrictStr | None = Field(default=None, description="Unique identifier for the API Application.")
31
+ additional_properties: Dict[str, Any] = {}
32
+ __properties: ClassVar[List[str]] = ["callback_url", "api_application_id"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Self | None:
51
+ """Create an instance of CreateWebhookRequest from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ * Fields in `self.additional_properties` are added to the output dict.
64
+ """
65
+ excluded_fields: Set[str] = set(
66
+ [
67
+ "additional_properties",
68
+ ]
69
+ )
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # puts key-value pairs in additional_properties in the top level
77
+ if self.additional_properties is not None:
78
+ for _key, _value in self.additional_properties.items():
79
+ _dict[_key] = _value
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None:
85
+ """Create an instance of CreateWebhookRequest from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {"callback_url": obj.get("callback_url"), "api_application_id": obj.get("api_application_id")}
94
+ )
95
+ # store additional fields in additional_properties
96
+ for _key in obj.keys():
97
+ if _key not in cls.__properties:
98
+ _obj.additional_properties[_key] = obj.get(_key)
99
+
100
+ return _obj
@@ -0,0 +1,36 @@
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 DateFormat(str, Enum):
20
+ """
21
+ Date format for date fields. Valid values: MM/DD/YYYY, DD/MM/YYYY, YYYY/MM/DD, Month DD, YYYY, MM/DD/YYYY hh:mm:ss a. Default: MM/DD/YYYY
22
+ """
23
+
24
+ """
25
+ allowed enum values
26
+ """
27
+ MM_SLASH_DD_SLASH_YYYY = "MM/DD/YYYY"
28
+ DD_SLASH_MM_SLASH_YYYY = "DD/MM/YYYY"
29
+ YYYY_SLASH_MM_SLASH_DD = "YYYY/MM/DD"
30
+ MONTH_DD_COMMA__YYYY = "Month DD, YYYY"
31
+ MM_SLASH_DD_SLASH_YYYY_HH_COLON_MM_COLON_SS_A = "MM/DD/YYYY hh:mm:ss a"
32
+
33
+ @classmethod
34
+ def from_json(cls, json_str: str) -> Self:
35
+ """Create an instance of DateFormat from a JSON string"""
36
+ return cls(json.loads(json_str))
@@ -0,0 +1,105 @@
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 import Any, Optional, Set
21
+ from typing_extensions import Self
22
+
23
+
24
+ class DetailedOption(BaseModel):
25
+ """
26
+ Detailed option object
27
+ """ # noqa: E501
28
+
29
+ name: StrictStr = Field(description="Option display name")
30
+ api_id: StrictStr | None = Field(default=None, description="Unique identifier for the option")
31
+ is_other: StrictBool | None = Field(default=False, description='Whether this is the special "Other" option')
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["name", "api_id", "is_other"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Self | None:
52
+ """Create an instance of DetailedOption 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 DetailedOption 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
+ {
95
+ "name": obj.get("name"),
96
+ "api_id": obj.get("api_id"),
97
+ "is_other": obj.get("is_other") if obj.get("is_other") is not None else False,
98
+ }
99
+ )
100
+ # store additional fields in additional_properties
101
+ for _key in obj.keys():
102
+ if _key not in cls.__properties:
103
+ _obj.additional_properties[_key] = obj.get(_key)
104
+
105
+ return _obj