daytona_api_client 0.25.6__py3-none-any.whl → 0.26.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.

Potentially problematic release.


This version of daytona_api_client might be problematic. Click here for more details.

Files changed (44) hide show
  1. daytona_api_client/__init__.py +11 -0
  2. daytona_api_client/api/__init__.py +2 -0
  3. daytona_api_client/api/default_api.py +1884 -0
  4. daytona_api_client/api/health_api.py +282 -0
  5. daytona_api_client/api/sandbox_api.py +855 -2
  6. daytona_api_client/api/webhooks_api.py +1704 -0
  7. daytona_api_client/models/__init__.py +9 -0
  8. daytona_api_client/models/create_audit_log.py +2 -2
  9. daytona_api_client/models/health_controller_check200_response.py +154 -0
  10. daytona_api_client/models/{account_provider_dto.py → health_controller_check200_response_info_value.py} +23 -23
  11. daytona_api_client/models/health_controller_check503_response.py +154 -0
  12. daytona_api_client/models/sandbox_created_post_request.py +110 -0
  13. daytona_api_client/models/sandbox_created_post_request_data.py +152 -0
  14. daytona_api_client/models/sandbox_state_updated_post_request.py +110 -0
  15. daytona_api_client/models/sandbox_state_updated_post_request_data.py +129 -0
  16. daytona_api_client/models/{usage_overview.py → sandbox_state_updated_post_request_data_sandbox.py} +23 -21
  17. daytona_api_client/models/send_webhook_dto.py +105 -0
  18. daytona_api_client/models/snapshot_created_post_request.py +110 -0
  19. daytona_api_client/models/snapshot_created_post_request_data.py +136 -0
  20. daytona_api_client/models/{get_build_logs400_response.py → snapshot_removed_post_request.py} +31 -26
  21. daytona_api_client/models/snapshot_state_updated_post_request.py +110 -0
  22. daytona_api_client/models/snapshot_state_updated_post_request_data.py +129 -0
  23. daytona_api_client/models/snapshot_state_updated_post_request_data_snapshot.py +115 -0
  24. daytona_api_client/models/ssh_access_dto.py +112 -0
  25. daytona_api_client/models/ssh_access_validation_dto.py +107 -0
  26. daytona_api_client/models/volume_created_post_request.py +110 -0
  27. daytona_api_client/models/{volume.py → volume_created_post_request_data.py} +48 -55
  28. daytona_api_client/models/volume_state_updated_post_request.py +110 -0
  29. daytona_api_client/models/volume_state_updated_post_request_data.py +129 -0
  30. daytona_api_client/models/volume_state_updated_post_request_data_volume.py +115 -0
  31. daytona_api_client/models/{download_files.py → webhook_app_portal_access.py} +7 -7
  32. daytona_api_client/models/{upload_file.py → webhook_controller_get_app_portal_access200_response.py} +26 -26
  33. daytona_api_client/models/webhook_controller_get_initialization_status200_response.py +118 -0
  34. daytona_api_client/models/{toggle_state.py → webhook_controller_get_status200_response.py} +7 -7
  35. daytona_api_client/models/webhook_initialization_status.py +121 -0
  36. {daytona_api_client-0.25.6.dist-info → daytona_api_client-0.26.0.dist-info}/METADATA +1 -1
  37. {daytona_api_client-0.25.6.dist-info → daytona_api_client-0.26.0.dist-info}/RECORD +40 -21
  38. daytona_api_client/models/build_snapshot.py +0 -118
  39. daytona_api_client/models/upload_file_dto.py +0 -101
  40. daytona_api_client/models/upload_file_request_file.py +0 -159
  41. daytona_api_client/models/upload_files_multi_request_files_inner.py +0 -101
  42. {daytona_api_client-0.25.6.dist-info → daytona_api_client-0.26.0.dist-info}/WHEEL +0 -0
  43. {daytona_api_client-0.25.6.dist-info → daytona_api_client-0.26.0.dist-info}/licenses/LICENSE +0 -0
  44. {daytona_api_client-0.25.6.dist-info → daytona_api_client-0.26.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Daytona
5
+
6
+ Daytona AI platform API Docs
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@daytona.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 datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
+ from typing import Any, ClassVar, Dict, List
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SshAccessDto(BaseModel):
28
+ """
29
+ SshAccessDto
30
+ """ # noqa: E501
31
+ id: StrictStr = Field(description="Unique identifier for the SSH access")
32
+ sandbox_id: StrictStr = Field(description="ID of the sandbox this SSH access is for", alias="sandboxId")
33
+ token: StrictStr = Field(description="SSH access token")
34
+ expires_at: datetime = Field(description="When the SSH access expires", alias="expiresAt")
35
+ created_at: datetime = Field(description="When the SSH access was created", alias="createdAt")
36
+ updated_at: datetime = Field(description="When the SSH access was last updated", alias="updatedAt")
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["id", "sandboxId", "token", "expiresAt", "createdAt", "updatedAt"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
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) -> Optional[Self]:
58
+ """Create an instance of SshAccessDto 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
+ "additional_properties",
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # puts key-value pairs in additional_properties in the top level
82
+ if self.additional_properties is not None:
83
+ for _key, _value in self.additional_properties.items():
84
+ _dict[_key] = _value
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of SshAccessDto from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "id": obj.get("id"),
99
+ "sandboxId": obj.get("sandboxId"),
100
+ "token": obj.get("token"),
101
+ "expiresAt": obj.get("expiresAt"),
102
+ "createdAt": obj.get("createdAt"),
103
+ "updatedAt": obj.get("updatedAt")
104
+ })
105
+ # store additional fields in additional_properties
106
+ for _key in obj.keys():
107
+ if _key not in cls.__properties:
108
+ _obj.additional_properties[_key] = obj.get(_key)
109
+
110
+ return _obj
111
+
112
+
@@ -0,0 +1,107 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Daytona
5
+
6
+ Daytona AI platform API Docs
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@daytona.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 SshAccessValidationDto(BaseModel):
27
+ """
28
+ SshAccessValidationDto
29
+ """ # noqa: E501
30
+ valid: StrictBool = Field(description="Whether the SSH access token is valid")
31
+ sandbox_id: StrictStr = Field(description="ID of the sandbox this SSH access is for", alias="sandboxId")
32
+ runner_id: Optional[StrictStr] = Field(default=None, description="ID of the runner hosting the sandbox", alias="runnerId")
33
+ runner_domain: Optional[StrictStr] = Field(default=None, description="Domain of the runner hosting the sandbox", alias="runnerDomain")
34
+ additional_properties: Dict[str, Any] = {}
35
+ __properties: ClassVar[List[str]] = ["valid", "sandboxId", "runnerId", "runnerDomain"]
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 SshAccessValidationDto 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
+ * Fields in `self.additional_properties` are added to the output dict.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "additional_properties",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # puts key-value pairs in additional_properties in the top level
79
+ if self.additional_properties is not None:
80
+ for _key, _value in self.additional_properties.items():
81
+ _dict[_key] = _value
82
+
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of SshAccessValidationDto from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "valid": obj.get("valid"),
96
+ "sandboxId": obj.get("sandboxId"),
97
+ "runnerId": obj.get("runnerId"),
98
+ "runnerDomain": obj.get("runnerDomain")
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
106
+
107
+
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Daytona
5
+
6
+ Daytona AI platform API Docs
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@daytona.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 datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from daytona_api_client.models.volume_created_post_request_data import VolumeCreatedPostRequestData
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class VolumeCreatedPostRequest(BaseModel):
29
+ """
30
+ VolumeCreatedPostRequest
31
+ """ # noqa: E501
32
+ event: Optional[StrictStr] = None
33
+ timestamp: Optional[datetime] = None
34
+ data: Optional[VolumeCreatedPostRequestData] = None
35
+ additional_properties: Dict[str, Any] = {}
36
+ __properties: ClassVar[List[str]] = ["event", "timestamp", "data"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of VolumeCreatedPostRequest from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ * Fields in `self.additional_properties` are added to the output dict.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ "additional_properties",
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # override the default output from pydantic by calling `to_dict()` of data
80
+ if self.data:
81
+ _dict['data'] = self.data.to_dict()
82
+ # puts key-value pairs in additional_properties in the top level
83
+ if self.additional_properties is not None:
84
+ for _key, _value in self.additional_properties.items():
85
+ _dict[_key] = _value
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of VolumeCreatedPostRequest from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "event": obj.get("event"),
100
+ "timestamp": obj.get("timestamp"),
101
+ "data": VolumeCreatedPostRequestData.from_dict(obj["data"]) if obj.get("data") is not None else None
102
+ })
103
+ # store additional fields in additional_properties
104
+ for _key in obj.keys():
105
+ if _key not in cls.__properties:
106
+ _obj.additional_properties[_key] = obj.get(_key)
107
+
108
+ return _obj
109
+
110
+
@@ -1,15 +1,15 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Daytona
4
+ Daytona
5
5
 
6
- Daytona AI platform API Docs
6
+ Daytona AI platform API Docs
7
7
 
8
- The version of the OpenAPI document: 1.0
9
- Contact: support@daytona.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@daytona.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
- Do not edit the class manually.
12
+ Do not edit the class manually.
13
13
  """ # noqa: E501
14
14
 
15
15
 
@@ -18,37 +18,36 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing import Any, ClassVar, Dict, List, Optional
23
- from daytona_api_client.models.volume_state import VolumeState
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
 
27
-
28
- class Volume(BaseModel):
27
+ class VolumeCreatedPostRequestData(BaseModel):
29
28
  """
30
- Volume
31
- """ # noqa: E501
32
-
33
- id: StrictStr = Field(description="Volume ID")
34
- name: StrictStr = Field(description="Volume name")
35
- organization_id: StrictStr = Field(description="Organization ID", alias="organizationId")
36
- state: VolumeState = Field(description="Volume state")
37
- created_at: StrictStr = Field(description="Creation timestamp", alias="createdAt")
38
- updated_at: StrictStr = Field(description="Last update timestamp", alias="updatedAt")
39
- last_used_at: StrictStr = Field(description="Last used timestamp", alias="lastUsedAt")
40
- error_reason: Optional[StrictStr] = Field(description="The error reason of the volume", alias="errorReason")
29
+ VolumeCreatedPostRequestData
30
+ """ # noqa: E501
31
+ id: Optional[StrictStr] = None
32
+ name: Optional[StrictStr] = None
33
+ organization_id: Optional[StrictStr] = Field(default=None, alias="organizationId")
34
+ state: Optional[StrictStr] = None
35
+ created_at: Optional[datetime] = Field(default=None, alias="createdAt")
36
+ updated_at: Optional[datetime] = Field(default=None, alias="updatedAt")
37
+ last_used_at: Optional[datetime] = Field(default=None, alias="lastUsedAt")
38
+ error_reason: Optional[StrictStr] = Field(default=None, alias="errorReason")
41
39
  additional_properties: Dict[str, Any] = {}
42
- __properties: ClassVar[List[str]] = [
43
- "id",
44
- "name",
45
- "organizationId",
46
- "state",
47
- "createdAt",
48
- "updatedAt",
49
- "lastUsedAt",
50
- "errorReason",
51
- ]
40
+ __properties: ClassVar[List[str]] = ["id", "name", "organizationId", "state", "createdAt", "updatedAt", "lastUsedAt", "errorReason"]
41
+
42
+ @field_validator('state')
43
+ def state_validate_enum(cls, value):
44
+ """Validates the enum"""
45
+ if value is None:
46
+ return value
47
+
48
+ if value not in set(['creating', 'ready', 'pending_create', 'pending_delete', 'deleting', 'deleted', 'error']):
49
+ raise ValueError("must be one of enum values ('creating', 'ready', 'pending_create', 'pending_delete', 'deleting', 'deleted', 'error')")
50
+ return value
52
51
 
53
52
  model_config = ConfigDict(
54
53
  populate_by_name=True,
@@ -56,6 +55,7 @@ class Volume(BaseModel):
56
55
  protected_namespaces=(),
57
56
  )
58
57
 
58
+
59
59
  def to_str(self) -> str:
60
60
  """Returns the string representation of the model using alias"""
61
61
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -67,7 +67,7 @@ class Volume(BaseModel):
67
67
 
68
68
  @classmethod
69
69
  def from_json(cls, json_str: str) -> Optional[Self]:
70
- """Create an instance of Volume from a JSON string"""
70
+ """Create an instance of VolumeCreatedPostRequestData from a JSON string"""
71
71
  return cls.from_dict(json.loads(json_str))
72
72
 
73
73
  def to_dict(self) -> Dict[str, Any]:
@@ -81,11 +81,9 @@ class Volume(BaseModel):
81
81
  are ignored.
82
82
  * Fields in `self.additional_properties` are added to the output dict.
83
83
  """
84
- excluded_fields: Set[str] = set(
85
- [
86
- "additional_properties",
87
- ]
88
- )
84
+ excluded_fields: Set[str] = set([
85
+ "additional_properties",
86
+ ])
89
87
 
90
88
  _dict = self.model_dump(
91
89
  by_alias=True,
@@ -97,37 +95,32 @@ class Volume(BaseModel):
97
95
  for _key, _value in self.additional_properties.items():
98
96
  _dict[_key] = _value
99
97
 
100
- # set to None if error_reason (nullable) is None
101
- # and model_fields_set contains the field
102
- if self.error_reason is None and "error_reason" in self.model_fields_set:
103
- _dict["errorReason"] = None
104
-
105
98
  return _dict
106
99
 
107
100
  @classmethod
108
101
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
- """Create an instance of Volume from a dict"""
102
+ """Create an instance of VolumeCreatedPostRequestData from a dict"""
110
103
  if obj is None:
111
104
  return None
112
105
 
113
106
  if not isinstance(obj, dict):
114
107
  return cls.model_validate(obj)
115
108
 
116
- _obj = cls.model_validate(
117
- {
118
- "id": obj.get("id"),
119
- "name": obj.get("name"),
120
- "organizationId": obj.get("organizationId"),
121
- "state": obj.get("state"),
122
- "createdAt": obj.get("createdAt"),
123
- "updatedAt": obj.get("updatedAt"),
124
- "lastUsedAt": obj.get("lastUsedAt"),
125
- "errorReason": obj.get("errorReason"),
126
- }
127
- )
109
+ _obj = cls.model_validate({
110
+ "id": obj.get("id"),
111
+ "name": obj.get("name"),
112
+ "organizationId": obj.get("organizationId"),
113
+ "state": obj.get("state"),
114
+ "createdAt": obj.get("createdAt"),
115
+ "updatedAt": obj.get("updatedAt"),
116
+ "lastUsedAt": obj.get("lastUsedAt"),
117
+ "errorReason": obj.get("errorReason")
118
+ })
128
119
  # store additional fields in additional_properties
129
120
  for _key in obj.keys():
130
121
  if _key not in cls.__properties:
131
122
  _obj.additional_properties[_key] = obj.get(_key)
132
123
 
133
124
  return _obj
125
+
126
+
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Daytona
5
+
6
+ Daytona AI platform API Docs
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@daytona.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 datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from daytona_api_client.models.volume_state_updated_post_request_data import VolumeStateUpdatedPostRequestData
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class VolumeStateUpdatedPostRequest(BaseModel):
29
+ """
30
+ VolumeStateUpdatedPostRequest
31
+ """ # noqa: E501
32
+ event: Optional[StrictStr] = None
33
+ timestamp: Optional[datetime] = None
34
+ data: Optional[VolumeStateUpdatedPostRequestData] = None
35
+ additional_properties: Dict[str, Any] = {}
36
+ __properties: ClassVar[List[str]] = ["event", "timestamp", "data"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of VolumeStateUpdatedPostRequest from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ * Fields in `self.additional_properties` are added to the output dict.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ "additional_properties",
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # override the default output from pydantic by calling `to_dict()` of data
80
+ if self.data:
81
+ _dict['data'] = self.data.to_dict()
82
+ # puts key-value pairs in additional_properties in the top level
83
+ if self.additional_properties is not None:
84
+ for _key, _value in self.additional_properties.items():
85
+ _dict[_key] = _value
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of VolumeStateUpdatedPostRequest from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "event": obj.get("event"),
100
+ "timestamp": obj.get("timestamp"),
101
+ "data": VolumeStateUpdatedPostRequestData.from_dict(obj["data"]) if obj.get("data") is not None else None
102
+ })
103
+ # store additional fields in additional_properties
104
+ for _key in obj.keys():
105
+ if _key not in cls.__properties:
106
+ _obj.additional_properties[_key] = obj.get(_key)
107
+
108
+ return _obj
109
+
110
+