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,134 @@
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 CreateSubmissionDataRequestEventRequest(BaseModel):
27
+ """
28
+ CreateSubmissionDataRequestEventRequest
29
+ """ # noqa: E501
30
+ event_type: StrictStr
31
+ message_recipient: Optional[StrictStr] = None
32
+ message_type: Optional[StrictStr] = None
33
+ occurred_at: Optional[StrictStr] = None
34
+ __properties: ClassVar[List[str]] = ["event_type", "message_recipient", "message_type", "occurred_at"]
35
+
36
+ @field_validator('event_type')
37
+ def event_type_validate_enum(cls, value, info: ValidationInfo):
38
+ """Validates the enum"""
39
+ # from_dict accepts enum values this client doesn't know about yet
40
+ if info.context and info.context.get("skip_enum_validation"):
41
+ return value
42
+
43
+ if value not in set(['send_request', 'view_request', 'accepted_terms', 'decline_request', 'sign_request', 'all_completed']):
44
+ raise ValueError("must be one of enum values ('send_request', 'view_request', 'accepted_terms', 'decline_request', 'sign_request', 'all_completed')")
45
+ return value
46
+
47
+ @field_validator('message_type')
48
+ def message_type_validate_enum(cls, value, info: ValidationInfo):
49
+ """Validates the enum"""
50
+ # from_dict accepts enum values this client doesn't know about yet
51
+ if info.context and info.context.get("skip_enum_validation"):
52
+ return value
53
+
54
+ if value is None:
55
+ return value
56
+
57
+ if value not in set(['email', 'sms', 'fax', 'mail', 'slack', 'msteams', 'discord', 'telegram', 'whatsapp']):
58
+ raise ValueError("must be one of enum values ('email', 'sms', 'fax', 'mail', 'slack', 'msteams', 'discord', 'telegram', 'whatsapp')")
59
+ return value
60
+
61
+ model_config = ConfigDict(
62
+ populate_by_name=True,
63
+ validate_assignment=True,
64
+ protected_namespaces=(),
65
+ )
66
+
67
+
68
+ def to_str(self) -> str:
69
+ """Returns the string representation of the model using alias"""
70
+ return pprint.pformat(self.model_dump(by_alias=True))
71
+
72
+ def to_json(self) -> str:
73
+ """Returns the JSON representation of the model using alias"""
74
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
75
+ return json.dumps(self.to_dict())
76
+
77
+ @classmethod
78
+ def from_json(cls, json_str: str) -> Optional[Self]:
79
+ """Create an instance of CreateSubmissionDataRequestEventRequest from a JSON string"""
80
+ return cls.from_dict(json.loads(json_str))
81
+
82
+ def to_dict(self) -> Dict[str, Any]:
83
+ """Return the dictionary representation of the model using alias.
84
+
85
+ This has the following differences from calling pydantic's
86
+ `self.model_dump(by_alias=True)`:
87
+
88
+ * `None` is only added to the output dict for nullable fields that
89
+ were set at model initialization. Other fields with value `None`
90
+ are ignored.
91
+ """
92
+ excluded_fields: Set[str] = set([
93
+ ])
94
+
95
+ _dict = self.model_dump(
96
+ by_alias=True,
97
+ exclude=excluded_fields,
98
+ exclude_none=True,
99
+ )
100
+ # set to None if message_recipient (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.message_recipient is None and "message_recipient" in self.model_fields_set:
103
+ _dict['message_recipient'] = None
104
+
105
+ # set to None if message_type (nullable) is None
106
+ # and model_fields_set contains the field
107
+ if self.message_type is None and "message_type" in self.model_fields_set:
108
+ _dict['message_type'] = None
109
+
110
+ # set to None if occurred_at (nullable) is None
111
+ # and model_fields_set contains the field
112
+ if self.occurred_at is None and "occurred_at" in self.model_fields_set:
113
+ _dict['occurred_at'] = None
114
+
115
+ return _dict
116
+
117
+ @classmethod
118
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
119
+ """Create an instance of CreateSubmissionDataRequestEventRequest from a dict"""
120
+ if obj is None:
121
+ return None
122
+
123
+ if not isinstance(obj, dict):
124
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
125
+
126
+ _obj = cls.model_validate({
127
+ "event_type": obj.get("event_type"),
128
+ "message_recipient": obj.get("message_recipient"),
129
+ "message_type": obj.get("message_type"),
130
+ "occurred_at": obj.get("occurred_at")
131
+ }, context={"skip_enum_validation": True})
132
+ return _obj
133
+
134
+
@@ -0,0 +1,107 @@
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 docspring.models.submission_data_request_event import SubmissionDataRequestEvent
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CreateSubmissionDataRequestEventResponse(BaseModel):
28
+ """
29
+ CreateSubmissionDataRequestEventResponse
30
+ """ # noqa: E501
31
+ status: StrictStr
32
+ event: SubmissionDataRequestEvent
33
+ errors: Optional[List[StrictStr]] = None
34
+ __properties: ClassVar[List[str]] = ["status", "event", "errors"]
35
+
36
+ @field_validator('status')
37
+ def status_validate_enum(cls, value, info: ValidationInfo):
38
+ """Validates the enum"""
39
+ # from_dict accepts enum values this client doesn't know about yet
40
+ if info.context and info.context.get("skip_enum_validation"):
41
+ return value
42
+
43
+ if value not in set(['success', 'error']):
44
+ raise ValueError("must be one of enum values ('success', 'error')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of CreateSubmissionDataRequestEventResponse from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of event
87
+ if self.event:
88
+ _dict['event'] = self.event.to_dict()
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of CreateSubmissionDataRequestEventResponse from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
99
+
100
+ _obj = cls.model_validate({
101
+ "status": obj.get("status"),
102
+ "event": SubmissionDataRequestEvent.from_dict(obj["event"]) if obj.get("event") is not None else None,
103
+ "errors": obj.get("errors")
104
+ }, context={"skip_enum_validation": True})
105
+ return _obj
106
+
107
+
@@ -0,0 +1,107 @@
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 docspring.models.submission_data_request_show import SubmissionDataRequestShow
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CreateSubmissionDataRequestResponse(BaseModel):
28
+ """
29
+ CreateSubmissionDataRequestResponse
30
+ """ # noqa: E501
31
+ status: StrictStr
32
+ data_request: SubmissionDataRequestShow
33
+ errors: Optional[List[StrictStr]] = None
34
+ __properties: ClassVar[List[str]] = ["status", "data_request", "errors"]
35
+
36
+ @field_validator('status')
37
+ def status_validate_enum(cls, value, info: ValidationInfo):
38
+ """Validates the enum"""
39
+ # from_dict accepts enum values this client doesn't know about yet
40
+ if info.context and info.context.get("skip_enum_validation"):
41
+ return value
42
+
43
+ if value not in set(['success', 'error']):
44
+ raise ValueError("must be one of enum values ('success', 'error')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of CreateSubmissionDataRequestResponse from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of data_request
87
+ if self.data_request:
88
+ _dict['data_request'] = self.data_request.to_dict()
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of CreateSubmissionDataRequestResponse from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
99
+
100
+ _obj = cls.model_validate({
101
+ "status": obj.get("status"),
102
+ "data_request": SubmissionDataRequestShow.from_dict(obj["data_request"]) if obj.get("data_request") is not None else None,
103
+ "errors": obj.get("errors")
104
+ }, context={"skip_enum_validation": True})
105
+ return _obj
106
+
107
+
@@ -0,0 +1,107 @@
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 docspring.models.submission_data_request_token import SubmissionDataRequestToken
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CreateSubmissionDataRequestTokenResponse(BaseModel):
28
+ """
29
+ CreateSubmissionDataRequestTokenResponse
30
+ """ # noqa: E501
31
+ status: StrictStr
32
+ token: SubmissionDataRequestToken
33
+ errors: Optional[List[StrictStr]] = None
34
+ __properties: ClassVar[List[str]] = ["status", "token", "errors"]
35
+
36
+ @field_validator('status')
37
+ def status_validate_enum(cls, value, info: ValidationInfo):
38
+ """Validates the enum"""
39
+ # from_dict accepts enum values this client doesn't know about yet
40
+ if info.context and info.context.get("skip_enum_validation"):
41
+ return value
42
+
43
+ if value not in set(['success', 'error']):
44
+ raise ValueError("must be one of enum values ('success', 'error')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of CreateSubmissionDataRequestTokenResponse from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of token
87
+ if self.token:
88
+ _dict['token'] = self.token.to_dict()
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of CreateSubmissionDataRequestTokenResponse from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
99
+
100
+ _obj = cls.model_validate({
101
+ "status": obj.get("status"),
102
+ "token": SubmissionDataRequestToken.from_dict(obj["token"]) if obj.get("token") is not None else None,
103
+ "errors": obj.get("errors")
104
+ }, context={"skip_enum_validation": True})
105
+ return _obj
106
+
107
+
@@ -0,0 +1,107 @@
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 docspring.models.submission_preview import SubmissionPreview
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CreateSubmissionResponse(BaseModel):
28
+ """
29
+ CreateSubmissionResponse
30
+ """ # noqa: E501
31
+ status: StrictStr
32
+ submission: SubmissionPreview
33
+ errors: Optional[List[StrictStr]] = None
34
+ __properties: ClassVar[List[str]] = ["status", "submission", "errors"]
35
+
36
+ @field_validator('status')
37
+ def status_validate_enum(cls, value, info: ValidationInfo):
38
+ """Validates the enum"""
39
+ # from_dict accepts enum values this client doesn't know about yet
40
+ if info.context and info.context.get("skip_enum_validation"):
41
+ return value
42
+
43
+ if value not in set(['success', 'error']):
44
+ raise ValueError("must be one of enum values ('success', 'error')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of CreateSubmissionResponse from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of submission
87
+ if self.submission:
88
+ _dict['submission'] = self.submission.to_dict()
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of CreateSubmissionResponse from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
99
+
100
+ _obj = cls.model_validate({
101
+ "status": obj.get("status"),
102
+ "submission": SubmissionPreview.from_dict(obj["submission"]) if obj.get("submission") is not None else None,
103
+ "errors": obj.get("errors")
104
+ }, context={"skip_enum_validation": True})
105
+ return _obj
106
+
107
+
@@ -0,0 +1,88 @@
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
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CreateWebhookData(BaseModel):
27
+ """
28
+ CreateWebhookData
29
+ """ # noqa: E501
30
+ webhook: Dict[str, Any]
31
+ __properties: ClassVar[List[str]] = ["webhook"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
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) -> Optional[Self]:
51
+ """Create an instance of CreateWebhookData 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
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of CreateWebhookData from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
82
+
83
+ _obj = cls.model_validate({
84
+ "webhook": obj.get("webhook")
85
+ }, context={"skip_enum_validation": True})
86
+ return _obj
87
+
88
+