docspring 3.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 (72) hide show
  1. docspring/__init__.py +250 -0
  2. docspring/api/__init__.py +20 -0
  3. docspring/api/client.py +13430 -0
  4. docspring/api_client.py +805 -0
  5. docspring/api_response.py +21 -0
  6. docspring/configuration.py +598 -0
  7. docspring/exceptions.py +217 -0
  8. docspring/models/__init__.py +146 -0
  9. docspring/models/add_fields_data.py +88 -0
  10. docspring/models/batch_generate_pdfs201_response.py +111 -0
  11. docspring/models/combine_pdfs_data.py +98 -0
  12. docspring/models/combined_submission.py +173 -0
  13. docspring/models/combined_submission_action.py +156 -0
  14. docspring/models/copy_template_options.py +92 -0
  15. docspring/models/create_combined_submission_response.py +107 -0
  16. docspring/models/create_custom_file_data.py +89 -0
  17. docspring/models/create_custom_file_response.py +107 -0
  18. docspring/models/create_folder_data.py +88 -0
  19. docspring/models/create_html_template.py +88 -0
  20. docspring/models/create_pdf_submission_data.py +112 -0
  21. docspring/models/create_pdf_template.py +88 -0
  22. docspring/models/create_submission_data_request_data.py +187 -0
  23. docspring/models/create_submission_data_request_event_request.py +134 -0
  24. docspring/models/create_submission_data_request_event_response.py +107 -0
  25. docspring/models/create_submission_data_request_response.py +107 -0
  26. docspring/models/create_submission_data_request_token_response.py +107 -0
  27. docspring/models/create_submission_response.py +107 -0
  28. docspring/models/create_webhook_data.py +88 -0
  29. docspring/models/custom_file.py +100 -0
  30. docspring/models/error_or_multiple_errors_response.py +103 -0
  31. docspring/models/error_response.py +101 -0
  32. docspring/models/folder.py +114 -0
  33. docspring/models/json_schema.py +110 -0
  34. docspring/models/list_submissions_response.py +105 -0
  35. docspring/models/move_folder_data.py +93 -0
  36. docspring/models/move_template_data.py +95 -0
  37. docspring/models/multiple_errors_response.py +101 -0
  38. docspring/models/publish_version_data.py +90 -0
  39. docspring/models/rename_folder_data.py +88 -0
  40. docspring/models/restore_version_data.py +88 -0
  41. docspring/models/submission.py +287 -0
  42. docspring/models/submission422_response.py +109 -0
  43. docspring/models/submission_action.py +148 -0
  44. docspring/models/submission_batch.py +123 -0
  45. docspring/models/submission_batch_data.py +106 -0
  46. docspring/models/submission_batch_with_submissions.py +133 -0
  47. docspring/models/submission_data_request.py +253 -0
  48. docspring/models/submission_data_request_event.py +155 -0
  49. docspring/models/submission_data_request_show.py +260 -0
  50. docspring/models/submission_data_request_token.py +109 -0
  51. docspring/models/submission_preview.py +257 -0
  52. docspring/models/success_error_response.py +101 -0
  53. docspring/models/success_multiple_errors_response.py +101 -0
  54. docspring/models/template.py +402 -0
  55. docspring/models/template_add_fields_response.py +103 -0
  56. docspring/models/template_delete_response.py +110 -0
  57. docspring/models/template_model_code_response.py +103 -0
  58. docspring/models/template_preview.py +356 -0
  59. docspring/models/template_publish_version_response.py +103 -0
  60. docspring/models/update_html_template.py +88 -0
  61. docspring/models/update_pdf_template.py +88 -0
  62. docspring/models/update_submission_data_request_data.py +185 -0
  63. docspring/models/update_webhook_data.py +88 -0
  64. docspring/models/upload_presign_response.py +108 -0
  65. docspring/models/webhook.py +185 -0
  66. docspring/py.typed +0 -0
  67. docspring/rest.py +259 -0
  68. docspring-3.1.0.dist-info/METADATA +245 -0
  69. docspring-3.1.0.dist-info/RECORD +72 -0
  70. docspring-3.1.0.dist-info/WHEEL +5 -0
  71. docspring-3.1.0.dist-info/licenses/LICENSE +7 -0
  72. docspring-3.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,106 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DocSpring API
5
+
6
+ Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
7
+
8
+ The version of the OpenAPI document: v1
9
+ Contact: support@docspring.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class SubmissionBatchData(BaseModel):
27
+ """
28
+ SubmissionBatchData
29
+ """ # noqa: E501
30
+ metadata: Optional[Dict[str, Any]] = None
31
+ submissions: List[Dict[str, Any]]
32
+ template_id: Optional[StrictStr] = None
33
+ template_version: Optional[StrictStr] = None
34
+ test: Optional[StrictBool] = None
35
+ __properties: ClassVar[List[str]] = ["metadata", "submissions", "template_id", "template_version", "test"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of SubmissionBatchData from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # set to None if template_id (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.template_id is None and "template_id" in self.model_fields_set:
79
+ _dict['template_id'] = None
80
+
81
+ # set to None if template_version (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.template_version is None and "template_version" in self.model_fields_set:
84
+ _dict['template_version'] = None
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of SubmissionBatchData from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
96
+
97
+ _obj = cls.model_validate({
98
+ "metadata": obj.get("metadata"),
99
+ "submissions": obj.get("submissions"),
100
+ "template_id": obj.get("template_id"),
101
+ "template_version": obj.get("template_version"),
102
+ "test": obj.get("test")
103
+ }, context={"skip_enum_validation": True})
104
+ return _obj
105
+
106
+
@@ -0,0 +1,133 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DocSpring API
5
+
6
+ Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
7
+
8
+ The version of the OpenAPI document: v1
9
+ Contact: support@docspring.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, ValidationInfo, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from docspring.models.submission_preview import SubmissionPreview
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SubmissionBatchWithSubmissions(BaseModel):
28
+ """
29
+ SubmissionBatchWithSubmissions
30
+ """ # noqa: E501
31
+ id: Optional[StrictStr]
32
+ state: StrictStr
33
+ metadata: Dict[str, Any]
34
+ processed_at: Optional[StrictStr]
35
+ total_count: StrictInt
36
+ pending_count: StrictInt
37
+ error_count: StrictInt
38
+ completion_percentage: Union[StrictFloat, StrictInt]
39
+ submissions: Optional[List[SubmissionPreview]] = None
40
+ __properties: ClassVar[List[str]] = ["id", "state", "metadata", "processed_at", "total_count", "pending_count", "error_count", "completion_percentage", "submissions"]
41
+
42
+ @field_validator('state')
43
+ def state_validate_enum(cls, value, info: ValidationInfo):
44
+ """Validates the enum"""
45
+ # from_dict accepts enum values this client doesn't know about yet
46
+ if info.context and info.context.get("skip_enum_validation"):
47
+ return value
48
+
49
+ if value not in set(['pending', 'processed', 'error']):
50
+ raise ValueError("must be one of enum values ('pending', 'processed', 'error')")
51
+ return value
52
+
53
+ model_config = ConfigDict(
54
+ populate_by_name=True,
55
+ validate_assignment=True,
56
+ protected_namespaces=(),
57
+ )
58
+
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of SubmissionBatchWithSubmissions from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([
85
+ ])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ # override the default output from pydantic by calling `to_dict()` of each item in submissions (list)
93
+ _items = []
94
+ if self.submissions:
95
+ for _item_submissions in self.submissions:
96
+ if _item_submissions:
97
+ _items.append(_item_submissions.to_dict())
98
+ _dict['submissions'] = _items
99
+ # set to None if id (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.id is None and "id" in self.model_fields_set:
102
+ _dict['id'] = None
103
+
104
+ # set to None if processed_at (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.processed_at is None and "processed_at" in self.model_fields_set:
107
+ _dict['processed_at'] = None
108
+
109
+ return _dict
110
+
111
+ @classmethod
112
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
113
+ """Create an instance of SubmissionBatchWithSubmissions from a dict"""
114
+ if obj is None:
115
+ return None
116
+
117
+ if not isinstance(obj, dict):
118
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
119
+
120
+ _obj = cls.model_validate({
121
+ "id": obj.get("id"),
122
+ "state": obj.get("state"),
123
+ "metadata": obj.get("metadata"),
124
+ "processed_at": obj.get("processed_at"),
125
+ "total_count": obj.get("total_count"),
126
+ "pending_count": obj.get("pending_count"),
127
+ "error_count": obj.get("error_count"),
128
+ "completion_percentage": obj.get("completion_percentage"),
129
+ "submissions": [SubmissionPreview.from_dict(_item) for _item in obj["submissions"]] if obj.get("submissions") is not None else None
130
+ }, context={"skip_enum_validation": True})
131
+ return _obj
132
+
133
+
@@ -0,0 +1,253 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DocSpring API
5
+
6
+ Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
7
+
8
+ The version of the OpenAPI document: v1
9
+ Contact: support@docspring.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, ValidationInfo, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class SubmissionDataRequest(BaseModel):
27
+ """
28
+ SubmissionDataRequest
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr]
31
+ email: Optional[StrictStr]
32
+ name: Optional[StrictStr]
33
+ order: Optional[StrictInt]
34
+ sort_order: StrictInt
35
+ fields: Optional[List[StrictStr]]
36
+ metadata: Optional[Dict[str, Any]]
37
+ state: StrictStr
38
+ viewed_at: Optional[StrictStr]
39
+ completed_at: Optional[StrictStr]
40
+ declined_at: Optional[StrictStr]
41
+ data: Optional[Dict[str, Any]]
42
+ auth_type: StrictStr
43
+ auth_second_factor_type: StrictStr
44
+ auth_provider: Optional[StrictStr]
45
+ auth_session_started_at: Optional[StrictStr]
46
+ auth_session_id_hash: Optional[StrictStr]
47
+ auth_user_id_hash: Optional[StrictStr]
48
+ auth_username_hash: Optional[StrictStr]
49
+ auth_phone_number_hash: Optional[StrictStr]
50
+ ip_address: Optional[StrictStr]
51
+ user_agent: Optional[StrictStr]
52
+ __properties: ClassVar[List[str]] = ["id", "email", "name", "order", "sort_order", "fields", "metadata", "state", "viewed_at", "completed_at", "declined_at", "data", "auth_type", "auth_second_factor_type", "auth_provider", "auth_session_started_at", "auth_session_id_hash", "auth_user_id_hash", "auth_username_hash", "auth_phone_number_hash", "ip_address", "user_agent"]
53
+
54
+ @field_validator('state')
55
+ def state_validate_enum(cls, value, info: ValidationInfo):
56
+ """Validates the enum"""
57
+ # from_dict accepts enum values this client doesn't know about yet
58
+ if info.context and info.context.get("skip_enum_validation"):
59
+ return value
60
+
61
+ if value not in set(['pending', 'completed', 'declined']):
62
+ raise ValueError("must be one of enum values ('pending', 'completed', 'declined')")
63
+ return value
64
+
65
+ @field_validator('auth_type')
66
+ def auth_type_validate_enum(cls, value, info: ValidationInfo):
67
+ """Validates the enum"""
68
+ # from_dict accepts enum values this client doesn't know about yet
69
+ if info.context and info.context.get("skip_enum_validation"):
70
+ return value
71
+
72
+ if value not in set(['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml']):
73
+ raise ValueError("must be one of enum values ('none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml')")
74
+ return value
75
+
76
+ @field_validator('auth_second_factor_type')
77
+ def auth_second_factor_type_validate_enum(cls, value, info: ValidationInfo):
78
+ """Validates the enum"""
79
+ # from_dict accepts enum values this client doesn't know about yet
80
+ if info.context and info.context.get("skip_enum_validation"):
81
+ return value
82
+
83
+ if value not in set(['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint']):
84
+ raise ValueError("must be one of enum values ('none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint')")
85
+ return value
86
+
87
+ model_config = ConfigDict(
88
+ populate_by_name=True,
89
+ validate_assignment=True,
90
+ protected_namespaces=(),
91
+ )
92
+
93
+
94
+ def to_str(self) -> str:
95
+ """Returns the string representation of the model using alias"""
96
+ return pprint.pformat(self.model_dump(by_alias=True))
97
+
98
+ def to_json(self) -> str:
99
+ """Returns the JSON representation of the model using alias"""
100
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
101
+ return json.dumps(self.to_dict())
102
+
103
+ @classmethod
104
+ def from_json(cls, json_str: str) -> Optional[Self]:
105
+ """Create an instance of SubmissionDataRequest from a JSON string"""
106
+ return cls.from_dict(json.loads(json_str))
107
+
108
+ def to_dict(self) -> Dict[str, Any]:
109
+ """Return the dictionary representation of the model using alias.
110
+
111
+ This has the following differences from calling pydantic's
112
+ `self.model_dump(by_alias=True)`:
113
+
114
+ * `None` is only added to the output dict for nullable fields that
115
+ were set at model initialization. Other fields with value `None`
116
+ are ignored.
117
+ """
118
+ excluded_fields: Set[str] = set([
119
+ ])
120
+
121
+ _dict = self.model_dump(
122
+ by_alias=True,
123
+ exclude=excluded_fields,
124
+ exclude_none=True,
125
+ )
126
+ # set to None if id (nullable) is None
127
+ # and model_fields_set contains the field
128
+ if self.id is None and "id" in self.model_fields_set:
129
+ _dict['id'] = None
130
+
131
+ # set to None if email (nullable) is None
132
+ # and model_fields_set contains the field
133
+ if self.email is None and "email" in self.model_fields_set:
134
+ _dict['email'] = None
135
+
136
+ # set to None if name (nullable) is None
137
+ # and model_fields_set contains the field
138
+ if self.name is None and "name" in self.model_fields_set:
139
+ _dict['name'] = None
140
+
141
+ # set to None if order (nullable) is None
142
+ # and model_fields_set contains the field
143
+ if self.order is None and "order" in self.model_fields_set:
144
+ _dict['order'] = None
145
+
146
+ # set to None if fields (nullable) is None
147
+ # and model_fields_set contains the field
148
+ if self.fields is None and "fields" in self.model_fields_set:
149
+ _dict['fields'] = None
150
+
151
+ # set to None if metadata (nullable) is None
152
+ # and model_fields_set contains the field
153
+ if self.metadata is None and "metadata" in self.model_fields_set:
154
+ _dict['metadata'] = None
155
+
156
+ # set to None if viewed_at (nullable) is None
157
+ # and model_fields_set contains the field
158
+ if self.viewed_at is None and "viewed_at" in self.model_fields_set:
159
+ _dict['viewed_at'] = None
160
+
161
+ # set to None if completed_at (nullable) is None
162
+ # and model_fields_set contains the field
163
+ if self.completed_at is None and "completed_at" in self.model_fields_set:
164
+ _dict['completed_at'] = None
165
+
166
+ # set to None if declined_at (nullable) is None
167
+ # and model_fields_set contains the field
168
+ if self.declined_at is None and "declined_at" in self.model_fields_set:
169
+ _dict['declined_at'] = None
170
+
171
+ # set to None if data (nullable) is None
172
+ # and model_fields_set contains the field
173
+ if self.data is None and "data" in self.model_fields_set:
174
+ _dict['data'] = None
175
+
176
+ # set to None if auth_provider (nullable) is None
177
+ # and model_fields_set contains the field
178
+ if self.auth_provider is None and "auth_provider" in self.model_fields_set:
179
+ _dict['auth_provider'] = None
180
+
181
+ # set to None if auth_session_started_at (nullable) is None
182
+ # and model_fields_set contains the field
183
+ if self.auth_session_started_at is None and "auth_session_started_at" in self.model_fields_set:
184
+ _dict['auth_session_started_at'] = None
185
+
186
+ # set to None if auth_session_id_hash (nullable) is None
187
+ # and model_fields_set contains the field
188
+ if self.auth_session_id_hash is None and "auth_session_id_hash" in self.model_fields_set:
189
+ _dict['auth_session_id_hash'] = None
190
+
191
+ # set to None if auth_user_id_hash (nullable) is None
192
+ # and model_fields_set contains the field
193
+ if self.auth_user_id_hash is None and "auth_user_id_hash" in self.model_fields_set:
194
+ _dict['auth_user_id_hash'] = None
195
+
196
+ # set to None if auth_username_hash (nullable) is None
197
+ # and model_fields_set contains the field
198
+ if self.auth_username_hash is None and "auth_username_hash" in self.model_fields_set:
199
+ _dict['auth_username_hash'] = None
200
+
201
+ # set to None if auth_phone_number_hash (nullable) is None
202
+ # and model_fields_set contains the field
203
+ if self.auth_phone_number_hash is None and "auth_phone_number_hash" in self.model_fields_set:
204
+ _dict['auth_phone_number_hash'] = None
205
+
206
+ # set to None if ip_address (nullable) is None
207
+ # and model_fields_set contains the field
208
+ if self.ip_address is None and "ip_address" in self.model_fields_set:
209
+ _dict['ip_address'] = None
210
+
211
+ # set to None if user_agent (nullable) is None
212
+ # and model_fields_set contains the field
213
+ if self.user_agent is None and "user_agent" in self.model_fields_set:
214
+ _dict['user_agent'] = None
215
+
216
+ return _dict
217
+
218
+ @classmethod
219
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
220
+ """Create an instance of SubmissionDataRequest from a dict"""
221
+ if obj is None:
222
+ return None
223
+
224
+ if not isinstance(obj, dict):
225
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
226
+
227
+ _obj = cls.model_validate({
228
+ "id": obj.get("id"),
229
+ "email": obj.get("email"),
230
+ "name": obj.get("name"),
231
+ "order": obj.get("order"),
232
+ "sort_order": obj.get("sort_order"),
233
+ "fields": obj.get("fields"),
234
+ "metadata": obj.get("metadata"),
235
+ "state": obj.get("state"),
236
+ "viewed_at": obj.get("viewed_at"),
237
+ "completed_at": obj.get("completed_at"),
238
+ "declined_at": obj.get("declined_at"),
239
+ "data": obj.get("data"),
240
+ "auth_type": obj.get("auth_type"),
241
+ "auth_second_factor_type": obj.get("auth_second_factor_type"),
242
+ "auth_provider": obj.get("auth_provider"),
243
+ "auth_session_started_at": obj.get("auth_session_started_at"),
244
+ "auth_session_id_hash": obj.get("auth_session_id_hash"),
245
+ "auth_user_id_hash": obj.get("auth_user_id_hash"),
246
+ "auth_username_hash": obj.get("auth_username_hash"),
247
+ "auth_phone_number_hash": obj.get("auth_phone_number_hash"),
248
+ "ip_address": obj.get("ip_address"),
249
+ "user_agent": obj.get("user_agent")
250
+ }, context={"skip_enum_validation": True})
251
+ return _obj
252
+
253
+
@@ -0,0 +1,155 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DocSpring API
5
+
6
+ Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
7
+
8
+ The version of the OpenAPI document: v1
9
+ Contact: support@docspring.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, ValidationInfo, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class SubmissionDataRequestEvent(BaseModel):
27
+ """
28
+ SubmissionDataRequestEvent
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr]
31
+ submission_id: Optional[StrictStr]
32
+ submission_data_request_id: Optional[StrictStr]
33
+ event_type: StrictStr
34
+ message_type: Optional[StrictStr]
35
+ message_recipient: Optional[StrictStr]
36
+ occurred_at: Optional[StrictStr]
37
+ __properties: ClassVar[List[str]] = ["id", "submission_id", "submission_data_request_id", "event_type", "message_type", "message_recipient", "occurred_at"]
38
+
39
+ @field_validator('event_type')
40
+ def event_type_validate_enum(cls, value, info: ValidationInfo):
41
+ """Validates the enum"""
42
+ # from_dict accepts enum values this client doesn't know about yet
43
+ if info.context and info.context.get("skip_enum_validation"):
44
+ return value
45
+
46
+ if value not in set(['send_request', 'view_request', 'accepted_terms', 'decline_request', 'sign_request', 'all_completed']):
47
+ raise ValueError("must be one of enum values ('send_request', 'view_request', 'accepted_terms', 'decline_request', 'sign_request', 'all_completed')")
48
+ return value
49
+
50
+ @field_validator('message_type')
51
+ def message_type_validate_enum(cls, value, info: ValidationInfo):
52
+ """Validates the enum"""
53
+ # from_dict accepts enum values this client doesn't know about yet
54
+ if info.context and info.context.get("skip_enum_validation"):
55
+ return value
56
+
57
+ if value is None:
58
+ return value
59
+
60
+ if value not in set(['email', 'sms', 'fax', 'mail', 'slack', 'msteams', 'discord', 'telegram', 'whatsapp']):
61
+ raise ValueError("must be one of enum values ('email', 'sms', 'fax', 'mail', 'slack', 'msteams', 'discord', 'telegram', 'whatsapp')")
62
+ return value
63
+
64
+ model_config = ConfigDict(
65
+ populate_by_name=True,
66
+ validate_assignment=True,
67
+ protected_namespaces=(),
68
+ )
69
+
70
+
71
+ def to_str(self) -> str:
72
+ """Returns the string representation of the model using alias"""
73
+ return pprint.pformat(self.model_dump(by_alias=True))
74
+
75
+ def to_json(self) -> str:
76
+ """Returns the JSON representation of the model using alias"""
77
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
78
+ return json.dumps(self.to_dict())
79
+
80
+ @classmethod
81
+ def from_json(cls, json_str: str) -> Optional[Self]:
82
+ """Create an instance of SubmissionDataRequestEvent from a JSON string"""
83
+ return cls.from_dict(json.loads(json_str))
84
+
85
+ def to_dict(self) -> Dict[str, Any]:
86
+ """Return the dictionary representation of the model using alias.
87
+
88
+ This has the following differences from calling pydantic's
89
+ `self.model_dump(by_alias=True)`:
90
+
91
+ * `None` is only added to the output dict for nullable fields that
92
+ were set at model initialization. Other fields with value `None`
93
+ are ignored.
94
+ """
95
+ excluded_fields: Set[str] = set([
96
+ ])
97
+
98
+ _dict = self.model_dump(
99
+ by_alias=True,
100
+ exclude=excluded_fields,
101
+ exclude_none=True,
102
+ )
103
+ # set to None if id (nullable) is None
104
+ # and model_fields_set contains the field
105
+ if self.id is None and "id" in self.model_fields_set:
106
+ _dict['id'] = None
107
+
108
+ # set to None if submission_id (nullable) is None
109
+ # and model_fields_set contains the field
110
+ if self.submission_id is None and "submission_id" in self.model_fields_set:
111
+ _dict['submission_id'] = None
112
+
113
+ # set to None if submission_data_request_id (nullable) is None
114
+ # and model_fields_set contains the field
115
+ if self.submission_data_request_id is None and "submission_data_request_id" in self.model_fields_set:
116
+ _dict['submission_data_request_id'] = None
117
+
118
+ # set to None if message_type (nullable) is None
119
+ # and model_fields_set contains the field
120
+ if self.message_type is None and "message_type" in self.model_fields_set:
121
+ _dict['message_type'] = None
122
+
123
+ # set to None if message_recipient (nullable) is None
124
+ # and model_fields_set contains the field
125
+ if self.message_recipient is None and "message_recipient" in self.model_fields_set:
126
+ _dict['message_recipient'] = None
127
+
128
+ # set to None if occurred_at (nullable) is None
129
+ # and model_fields_set contains the field
130
+ if self.occurred_at is None and "occurred_at" in self.model_fields_set:
131
+ _dict['occurred_at'] = None
132
+
133
+ return _dict
134
+
135
+ @classmethod
136
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
137
+ """Create an instance of SubmissionDataRequestEvent from a dict"""
138
+ if obj is None:
139
+ return None
140
+
141
+ if not isinstance(obj, dict):
142
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
143
+
144
+ _obj = cls.model_validate({
145
+ "id": obj.get("id"),
146
+ "submission_id": obj.get("submission_id"),
147
+ "submission_data_request_id": obj.get("submission_data_request_id"),
148
+ "event_type": obj.get("event_type"),
149
+ "message_type": obj.get("message_type"),
150
+ "message_recipient": obj.get("message_recipient"),
151
+ "occurred_at": obj.get("occurred_at")
152
+ }, context={"skip_enum_validation": True})
153
+ return _obj
154
+
155
+