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,100 @@
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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CustomFile(BaseModel):
27
+ """
28
+ CustomFile
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr]
31
+ url: Optional[StrictStr]
32
+ __properties: ClassVar[List[str]] = ["id", "url"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
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) -> Optional[Self]:
52
+ """Create an instance of CustomFile 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
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # set to None if id (nullable) is None
74
+ # and model_fields_set contains the field
75
+ if self.id is None and "id" in self.model_fields_set:
76
+ _dict['id'] = None
77
+
78
+ # set to None if url (nullable) is None
79
+ # and model_fields_set contains the field
80
+ if self.url is None and "url" in self.model_fields_set:
81
+ _dict['url'] = None
82
+
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of CustomFile from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
93
+
94
+ _obj = cls.model_validate({
95
+ "id": obj.get("id"),
96
+ "url": obj.get("url")
97
+ }, context={"skip_enum_validation": True})
98
+ return _obj
99
+
100
+
@@ -0,0 +1,103 @@
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, Field, 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 ErrorOrMultipleErrorsResponse(BaseModel):
27
+ """
28
+ ErrorOrMultipleErrorsResponse
29
+ """ # noqa: E501
30
+ status: StrictStr
31
+ error: Optional[StrictStr] = Field(default=None, description="Single error message (when only one error occurred)")
32
+ errors: Optional[List[StrictStr]] = Field(default=None, description="Array of error messages (when multiple validation errors occurred)")
33
+ __properties: ClassVar[List[str]] = ["status", "error", "errors"]
34
+
35
+ @field_validator('status')
36
+ def status_validate_enum(cls, value, info: ValidationInfo):
37
+ """Validates the enum"""
38
+ # from_dict accepts enum values this client doesn't know about yet
39
+ if info.context and info.context.get("skip_enum_validation"):
40
+ return value
41
+
42
+ if value not in set(['error']):
43
+ raise ValueError("must be one of enum values ('error')")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+
53
+ def to_str(self) -> str:
54
+ """Returns the string representation of the model using alias"""
55
+ return pprint.pformat(self.model_dump(by_alias=True))
56
+
57
+ def to_json(self) -> str:
58
+ """Returns the JSON representation of the model using alias"""
59
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of ErrorOrMultipleErrorsResponse from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ """
77
+ excluded_fields: Set[str] = set([
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of ErrorOrMultipleErrorsResponse from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
95
+
96
+ _obj = cls.model_validate({
97
+ "status": obj.get("status"),
98
+ "error": obj.get("error"),
99
+ "errors": obj.get("errors")
100
+ }, context={"skip_enum_validation": True})
101
+ return _obj
102
+
103
+
@@ -0,0 +1,101 @@
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
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ErrorResponse(BaseModel):
27
+ """
28
+ ErrorResponse
29
+ """ # noqa: E501
30
+ status: StrictStr
31
+ error: StrictStr
32
+ __properties: ClassVar[List[str]] = ["status", "error"]
33
+
34
+ @field_validator('status')
35
+ def status_validate_enum(cls, value, info: ValidationInfo):
36
+ """Validates the enum"""
37
+ # from_dict accepts enum values this client doesn't know about yet
38
+ if info.context and info.context.get("skip_enum_validation"):
39
+ return value
40
+
41
+ if value not in set(['error']):
42
+ raise ValueError("must be one of enum values ('error')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
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) -> Optional[Self]:
63
+ """Create an instance of ErrorResponse 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
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of ErrorResponse from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
94
+
95
+ _obj = cls.model_validate({
96
+ "status": obj.get("status"),
97
+ "error": obj.get("error")
98
+ }, context={"skip_enum_validation": True})
99
+ return _obj
100
+
101
+
@@ -0,0 +1,114 @@
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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class Folder(BaseModel):
27
+ """
28
+ Folder
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr]
31
+ name: Optional[StrictStr]
32
+ path: Optional[StrictStr]
33
+ parent_folder_id: Optional[StrictStr]
34
+ __properties: ClassVar[List[str]] = ["id", "name", "path", "parent_folder_id"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of Folder from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # set to None if id (nullable) is None
76
+ # and model_fields_set contains the field
77
+ if self.id is None and "id" in self.model_fields_set:
78
+ _dict['id'] = None
79
+
80
+ # set to None if name (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.name is None and "name" in self.model_fields_set:
83
+ _dict['name'] = None
84
+
85
+ # set to None if path (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.path is None and "path" in self.model_fields_set:
88
+ _dict['path'] = None
89
+
90
+ # set to None if parent_folder_id (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.parent_folder_id is None and "parent_folder_id" in self.model_fields_set:
93
+ _dict['parent_folder_id'] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of Folder from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
105
+
106
+ _obj = cls.model_validate({
107
+ "id": obj.get("id"),
108
+ "name": obj.get("name"),
109
+ "path": obj.get("path"),
110
+ "parent_folder_id": obj.get("parent_folder_id")
111
+ }, context={"skip_enum_validation": True})
112
+ return _obj
113
+
114
+
@@ -0,0 +1,110 @@
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, Field, 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 JsonSchema(BaseModel):
27
+ """
28
+ JsonSchema
29
+ """ # noqa: E501
30
+ var_schema: Optional[StrictStr] = Field(default=None, alias="$schema")
31
+ id: Optional[StrictStr] = None
32
+ schema_id: Optional[StrictStr] = Field(default=None, alias="$id")
33
+ title: Optional[StrictStr] = None
34
+ description: Optional[StrictStr] = None
35
+ definitions: Optional[Dict[str, Any]] = None
36
+ type: Optional[StrictStr] = None
37
+ properties: Optional[Dict[str, Any]] = None
38
+ additional_properties: Optional[StrictBool] = Field(default=None, alias="additionalProperties")
39
+ required: Optional[List[StrictStr]] = None
40
+ dependencies: Optional[Dict[str, Any]] = None
41
+ all_of: Optional[List[Dict[str, Any]]] = Field(default=None, alias="allOf")
42
+ __properties: ClassVar[List[str]] = ["$schema", "id", "$id", "title", "description", "definitions", "type", "properties", "additionalProperties", "required", "dependencies", "allOf"]
43
+
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
+ return json.dumps(self.to_dict())
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of JsonSchema from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ ])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of JsonSchema from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
93
+
94
+ _obj = cls.model_validate({
95
+ "$schema": obj.get("$schema"),
96
+ "id": obj.get("id"),
97
+ "$id": obj.get("$id"),
98
+ "title": obj.get("title"),
99
+ "description": obj.get("description"),
100
+ "definitions": obj.get("definitions"),
101
+ "type": obj.get("type"),
102
+ "properties": obj.get("properties"),
103
+ "additionalProperties": obj.get("additionalProperties"),
104
+ "required": obj.get("required"),
105
+ "dependencies": obj.get("dependencies"),
106
+ "allOf": obj.get("allOf")
107
+ }, context={"skip_enum_validation": True})
108
+ return _obj
109
+
110
+
@@ -0,0 +1,105 @@
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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from docspring.models.submission import Submission
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class ListSubmissionsResponse(BaseModel):
28
+ """
29
+ ListSubmissionsResponse
30
+ """ # noqa: E501
31
+ submissions: List[Submission]
32
+ limit: StrictInt
33
+ next_cursor: Optional[StrictStr]
34
+ __properties: ClassVar[List[str]] = ["submissions", "limit", "next_cursor"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of ListSubmissionsResponse from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in submissions (list)
76
+ _items = []
77
+ if self.submissions:
78
+ for _item_submissions in self.submissions:
79
+ if _item_submissions:
80
+ _items.append(_item_submissions.to_dict())
81
+ _dict['submissions'] = _items
82
+ # set to None if next_cursor (nullable) is None
83
+ # and model_fields_set contains the field
84
+ if self.next_cursor is None and "next_cursor" in self.model_fields_set:
85
+ _dict['next_cursor'] = None
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of ListSubmissionsResponse from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj, context={"skip_enum_validation": True})
97
+
98
+ _obj = cls.model_validate({
99
+ "submissions": [Submission.from_dict(_item) for _item in obj["submissions"]] if obj.get("submissions") is not None else None,
100
+ "limit": obj.get("limit"),
101
+ "next_cursor": obj.get("next_cursor")
102
+ }, context={"skip_enum_validation": True})
103
+ return _obj
104
+
105
+