daytona_api_client 0.21.3a0__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 (117) hide show
  1. daytona_api_client/__init__.py +129 -0
  2. daytona_api_client/api/__init__.py +15 -0
  3. daytona_api_client/api/api_keys_api.py +1234 -0
  4. daytona_api_client/api/docker_registry_api.py +1741 -0
  5. daytona_api_client/api/object_storage_api.py +268 -0
  6. daytona_api_client/api/organizations_api.py +5792 -0
  7. daytona_api_client/api/preview_api.py +715 -0
  8. daytona_api_client/api/runners_api.py +664 -0
  9. daytona_api_client/api/sandbox_api.py +3584 -0
  10. daytona_api_client/api/snapshots_api.py +1830 -0
  11. daytona_api_client/api/toolbox_api.py +10545 -0
  12. daytona_api_client/api/users_api.py +1733 -0
  13. daytona_api_client/api/volumes_api.py +1267 -0
  14. daytona_api_client/api/workspace_api.py +3626 -0
  15. daytona_api_client/api_client.py +696 -0
  16. daytona_api_client/api_response.py +20 -0
  17. daytona_api_client/configuration.py +586 -0
  18. daytona_api_client/exceptions.py +216 -0
  19. daytona_api_client/models/__init__.py +101 -0
  20. daytona_api_client/models/account_provider.py +101 -0
  21. daytona_api_client/models/account_provider_dto.py +101 -0
  22. daytona_api_client/models/api_key_list.py +149 -0
  23. daytona_api_client/models/api_key_response.py +142 -0
  24. daytona_api_client/models/build_info.py +115 -0
  25. daytona_api_client/models/build_snapshot.py +118 -0
  26. daytona_api_client/models/command.py +104 -0
  27. daytona_api_client/models/completion_context.py +103 -0
  28. daytona_api_client/models/completion_item.py +124 -0
  29. daytona_api_client/models/completion_list.py +116 -0
  30. daytona_api_client/models/create_api_key.py +134 -0
  31. daytona_api_client/models/create_build_info.py +107 -0
  32. daytona_api_client/models/create_docker_registry.py +123 -0
  33. daytona_api_client/models/create_linked_account.py +101 -0
  34. daytona_api_client/models/create_organization.py +100 -0
  35. daytona_api_client/models/create_organization_invitation.py +122 -0
  36. daytona_api_client/models/create_organization_quota.py +130 -0
  37. daytona_api_client/models/create_organization_role.py +126 -0
  38. daytona_api_client/models/create_runner.py +150 -0
  39. daytona_api_client/models/create_sandbox.py +198 -0
  40. daytona_api_client/models/create_session_request.py +100 -0
  41. daytona_api_client/models/create_snapshot.py +138 -0
  42. daytona_api_client/models/create_user.py +132 -0
  43. daytona_api_client/models/create_volume.py +100 -0
  44. daytona_api_client/models/create_workspace.py +196 -0
  45. daytona_api_client/models/docker_registry.py +135 -0
  46. daytona_api_client/models/execute_request.py +104 -0
  47. daytona_api_client/models/execute_response.py +101 -0
  48. daytona_api_client/models/file_info.py +118 -0
  49. daytona_api_client/models/file_status.py +110 -0
  50. daytona_api_client/models/get_build_logs400_response.py +101 -0
  51. daytona_api_client/models/git_add_request.py +101 -0
  52. daytona_api_client/models/git_branch_request.py +101 -0
  53. daytona_api_client/models/git_checkout_request.py +101 -0
  54. daytona_api_client/models/git_clone_request.py +114 -0
  55. daytona_api_client/models/git_commit_info.py +112 -0
  56. daytona_api_client/models/git_commit_request.py +110 -0
  57. daytona_api_client/models/git_commit_response.py +100 -0
  58. daytona_api_client/models/git_delete_branch_request.py +101 -0
  59. daytona_api_client/models/git_repo_request.py +104 -0
  60. daytona_api_client/models/git_status.py +122 -0
  61. daytona_api_client/models/list_branch_response.py +100 -0
  62. daytona_api_client/models/lsp_completion_params.py +120 -0
  63. daytona_api_client/models/lsp_document_request.py +104 -0
  64. daytona_api_client/models/lsp_location.py +107 -0
  65. daytona_api_client/models/lsp_server_request.py +101 -0
  66. daytona_api_client/models/lsp_symbol.py +112 -0
  67. daytona_api_client/models/match.py +102 -0
  68. daytona_api_client/models/organization.py +134 -0
  69. daytona_api_client/models/organization_invitation.py +161 -0
  70. daytona_api_client/models/organization_role.py +147 -0
  71. daytona_api_client/models/organization_suspension.py +102 -0
  72. daytona_api_client/models/organization_user.py +145 -0
  73. daytona_api_client/models/paginated_snapshots_dto.py +120 -0
  74. daytona_api_client/models/port_preview_url.py +101 -0
  75. daytona_api_client/models/position.py +101 -0
  76. daytona_api_client/models/project_dir_response.py +100 -0
  77. daytona_api_client/models/range.py +113 -0
  78. daytona_api_client/models/registry_push_access_dto.py +114 -0
  79. daytona_api_client/models/replace_request.py +104 -0
  80. daytona_api_client/models/replace_result.py +102 -0
  81. daytona_api_client/models/sandbox.py +226 -0
  82. daytona_api_client/models/sandbox_info.py +110 -0
  83. daytona_api_client/models/sandbox_labels.py +100 -0
  84. daytona_api_client/models/sandbox_state.py +50 -0
  85. daytona_api_client/models/sandbox_volume.py +101 -0
  86. daytona_api_client/models/search_files_response.py +100 -0
  87. daytona_api_client/models/session.py +121 -0
  88. daytona_api_client/models/session_execute_request.py +110 -0
  89. daytona_api_client/models/session_execute_response.py +106 -0
  90. daytona_api_client/models/set_snapshot_general_status_dto.py +100 -0
  91. daytona_api_client/models/snapshot_dto.py +185 -0
  92. daytona_api_client/models/snapshot_state.py +44 -0
  93. daytona_api_client/models/storage_access_dto.py +121 -0
  94. daytona_api_client/models/toggle_state.py +100 -0
  95. daytona_api_client/models/update_assigned_organization_roles.py +100 -0
  96. daytona_api_client/models/update_docker_registry.py +104 -0
  97. daytona_api_client/models/update_organization_invitation.py +114 -0
  98. daytona_api_client/models/update_organization_member_role.py +107 -0
  99. daytona_api_client/models/update_organization_quota.py +175 -0
  100. daytona_api_client/models/update_organization_role.py +126 -0
  101. daytona_api_client/models/upload_file.py +101 -0
  102. daytona_api_client/models/upload_file_dto.py +101 -0
  103. daytona_api_client/models/upload_file_request_file.py +159 -0
  104. daytona_api_client/models/upload_files_multi_request_files_inner.py +101 -0
  105. daytona_api_client/models/usage_overview.py +124 -0
  106. daytona_api_client/models/user.py +120 -0
  107. daytona_api_client/models/user_public_key.py +101 -0
  108. daytona_api_client/models/volume.py +133 -0
  109. daytona_api_client/models/volume_dto.py +138 -0
  110. daytona_api_client/models/volume_state.py +41 -0
  111. daytona_api_client/models/workspace.py +259 -0
  112. daytona_api_client/py.typed +0 -0
  113. daytona_api_client/rest.py +208 -0
  114. daytona_api_client-0.21.3a0.dist-info/METADATA +23 -0
  115. daytona_api_client-0.21.3a0.dist-info/RECORD +117 -0
  116. daytona_api_client-0.21.3a0.dist-info/WHEEL +5 -0
  117. daytona_api_client-0.21.3a0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,101 @@
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, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class LspServerRequest(BaseModel):
28
+ """
29
+ LspServerRequest
30
+ """ # noqa: E501
31
+
32
+ language_id: StrictStr = Field(description="Language identifier", alias="languageId")
33
+ path_to_project: StrictStr = Field(description="Path to the project", alias="pathToProject")
34
+ additional_properties: Dict[str, Any] = {}
35
+ __properties: ClassVar[List[str]] = ["languageId", "pathToProject"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
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 LspServerRequest 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
+ * Fields in `self.additional_properties` are added to the output dict.
67
+ """
68
+ excluded_fields: Set[str] = set(
69
+ [
70
+ "additional_properties",
71
+ ]
72
+ )
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # puts key-value pairs in additional_properties in the top level
80
+ if self.additional_properties is not None:
81
+ for _key, _value in self.additional_properties.items():
82
+ _dict[_key] = _value
83
+
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of LspServerRequest from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({"languageId": obj.get("languageId"), "pathToProject": obj.get("pathToProject")})
96
+ # store additional fields in additional_properties
97
+ for _key in obj.keys():
98
+ if _key not in cls.__properties:
99
+ _obj.additional_properties[_key] = obj.get(_key)
100
+
101
+ return _obj
@@ -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 pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Union
23
+ from daytona_api_client.models.lsp_location import LspLocation
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class LspSymbol(BaseModel):
29
+ """
30
+ LspSymbol
31
+ """ # noqa: E501
32
+
33
+ kind: Union[StrictFloat, StrictInt]
34
+ location: LspLocation
35
+ name: StrictStr
36
+ additional_properties: Dict[str, Any] = {}
37
+ __properties: ClassVar[List[str]] = ["kind", "location", "name"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
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 LspSymbol 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
+ [
72
+ "additional_properties",
73
+ ]
74
+ )
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # override the default output from pydantic by calling `to_dict()` of location
82
+ if self.location:
83
+ _dict["location"] = self.location.to_dict()
84
+ # puts key-value pairs in additional_properties in the top level
85
+ if self.additional_properties is not None:
86
+ for _key, _value in self.additional_properties.items():
87
+ _dict[_key] = _value
88
+
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of LspSymbol from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate(
101
+ {
102
+ "kind": obj.get("kind"),
103
+ "location": LspLocation.from_dict(obj["location"]) if obj.get("location") is not None else None,
104
+ "name": obj.get("name"),
105
+ }
106
+ )
107
+ # store additional fields in additional_properties
108
+ for _key in obj.keys():
109
+ if _key not in cls.__properties:
110
+ _obj.additional_properties[_key] = obj.get(_key)
111
+
112
+ return _obj
@@ -0,0 +1,102 @@
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, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class Match(BaseModel):
28
+ """
29
+ Match
30
+ """ # noqa: E501
31
+
32
+ file: StrictStr
33
+ line: Union[StrictFloat, StrictInt]
34
+ content: StrictStr
35
+ additional_properties: Dict[str, Any] = {}
36
+ __properties: ClassVar[List[str]] = ["file", "line", "content"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
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 Match 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
+ [
71
+ "additional_properties",
72
+ ]
73
+ )
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # puts key-value pairs in additional_properties in the top level
81
+ if self.additional_properties is not None:
82
+ for _key, _value in self.additional_properties.items():
83
+ _dict[_key] = _value
84
+
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of Match from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({"file": obj.get("file"), "line": obj.get("line"), "content": obj.get("content")})
97
+ # store additional fields in additional_properties
98
+ for _key in obj.keys():
99
+ if _key not in cls.__properties:
100
+ _obj.additional_properties[_key] = obj.get(_key)
101
+
102
+ return _obj
@@ -0,0 +1,134 @@
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, StrictBool, StrictStr
23
+ from typing import Any, ClassVar, Dict, List
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class Organization(BaseModel):
29
+ """
30
+ Organization
31
+ """ # noqa: E501
32
+
33
+ id: StrictStr = Field(description="Organization ID")
34
+ name: StrictStr = Field(description="Organization name")
35
+ created_by: StrictStr = Field(description="User ID of the organization creator", alias="createdBy")
36
+ personal: StrictBool = Field(description="Personal organization flag")
37
+ created_at: datetime = Field(description="Creation timestamp", alias="createdAt")
38
+ updated_at: datetime = Field(description="Last update timestamp", alias="updatedAt")
39
+ suspended: StrictBool = Field(description="Suspended flag")
40
+ suspended_at: datetime = Field(description="Suspended at", alias="suspendedAt")
41
+ suspension_reason: StrictStr = Field(description="Suspended reason", alias="suspensionReason")
42
+ suspended_until: datetime = Field(description="Suspended until", alias="suspendedUntil")
43
+ additional_properties: Dict[str, Any] = {}
44
+ __properties: ClassVar[List[str]] = [
45
+ "id",
46
+ "name",
47
+ "createdBy",
48
+ "personal",
49
+ "createdAt",
50
+ "updatedAt",
51
+ "suspended",
52
+ "suspendedAt",
53
+ "suspensionReason",
54
+ "suspendedUntil",
55
+ ]
56
+
57
+ model_config = ConfigDict(
58
+ populate_by_name=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of Organization from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ * Fields in `self.additional_properties` are added to the output dict.
87
+ """
88
+ excluded_fields: Set[str] = set(
89
+ [
90
+ "additional_properties",
91
+ ]
92
+ )
93
+
94
+ _dict = self.model_dump(
95
+ by_alias=True,
96
+ exclude=excluded_fields,
97
+ exclude_none=True,
98
+ )
99
+ # puts key-value pairs in additional_properties in the top level
100
+ if self.additional_properties is not None:
101
+ for _key, _value in self.additional_properties.items():
102
+ _dict[_key] = _value
103
+
104
+ return _dict
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108
+ """Create an instance of Organization from a dict"""
109
+ if obj is None:
110
+ return None
111
+
112
+ if not isinstance(obj, dict):
113
+ return cls.model_validate(obj)
114
+
115
+ _obj = cls.model_validate(
116
+ {
117
+ "id": obj.get("id"),
118
+ "name": obj.get("name"),
119
+ "createdBy": obj.get("createdBy"),
120
+ "personal": obj.get("personal"),
121
+ "createdAt": obj.get("createdAt"),
122
+ "updatedAt": obj.get("updatedAt"),
123
+ "suspended": obj.get("suspended"),
124
+ "suspendedAt": obj.get("suspendedAt"),
125
+ "suspensionReason": obj.get("suspensionReason"),
126
+ "suspendedUntil": obj.get("suspendedUntil"),
127
+ }
128
+ )
129
+ # store additional fields in additional_properties
130
+ for _key in obj.keys():
131
+ if _key not in cls.__properties:
132
+ _obj.additional_properties[_key] = obj.get(_key)
133
+
134
+ return _obj
@@ -0,0 +1,161 @@
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, field_validator
23
+ from typing import Any, ClassVar, Dict, List
24
+ from daytona_api_client.models.organization_role import OrganizationRole
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+
29
+ class OrganizationInvitation(BaseModel):
30
+ """
31
+ OrganizationInvitation
32
+ """ # noqa: E501
33
+
34
+ id: StrictStr = Field(description="Invitation ID")
35
+ email: StrictStr = Field(description="Email address of the invitee")
36
+ invited_by: StrictStr = Field(description="Email address of the inviter", alias="invitedBy")
37
+ organization_id: StrictStr = Field(description="Organization ID", alias="organizationId")
38
+ organization_name: StrictStr = Field(description="Organization name", alias="organizationName")
39
+ expires_at: datetime = Field(description="Expiration date of the invitation", alias="expiresAt")
40
+ status: StrictStr = Field(description="Invitation status")
41
+ role: StrictStr = Field(description="Member role")
42
+ assigned_roles: List[OrganizationRole] = Field(description="Assigned roles", alias="assignedRoles")
43
+ created_at: datetime = Field(description="Creation timestamp", alias="createdAt")
44
+ updated_at: datetime = Field(description="Last update timestamp", alias="updatedAt")
45
+ additional_properties: Dict[str, Any] = {}
46
+ __properties: ClassVar[List[str]] = [
47
+ "id",
48
+ "email",
49
+ "invitedBy",
50
+ "organizationId",
51
+ "organizationName",
52
+ "expiresAt",
53
+ "status",
54
+ "role",
55
+ "assignedRoles",
56
+ "createdAt",
57
+ "updatedAt",
58
+ ]
59
+
60
+ @field_validator("status")
61
+ def status_validate_enum(cls, value):
62
+ """Validates the enum"""
63
+ if value not in set(["pending", "accepted", "declined", "cancelled"]):
64
+ raise ValueError("must be one of enum values ('pending', 'accepted', 'declined', 'cancelled')")
65
+ return value
66
+
67
+ @field_validator("role")
68
+ def role_validate_enum(cls, value):
69
+ """Validates the enum"""
70
+ if value not in set(["owner", "member"]):
71
+ raise ValueError("must be one of enum values ('owner', 'member')")
72
+ return value
73
+
74
+ model_config = ConfigDict(
75
+ populate_by_name=True,
76
+ validate_assignment=True,
77
+ protected_namespaces=(),
78
+ )
79
+
80
+ def to_str(self) -> str:
81
+ """Returns the string representation of the model using alias"""
82
+ return pprint.pformat(self.model_dump(by_alias=True))
83
+
84
+ def to_json(self) -> str:
85
+ """Returns the JSON representation of the model using alias"""
86
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
+ return json.dumps(self.to_dict())
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Optional[Self]:
91
+ """Create an instance of OrganizationInvitation from a JSON string"""
92
+ return cls.from_dict(json.loads(json_str))
93
+
94
+ def to_dict(self) -> Dict[str, Any]:
95
+ """Return the dictionary representation of the model using alias.
96
+
97
+ This has the following differences from calling pydantic's
98
+ `self.model_dump(by_alias=True)`:
99
+
100
+ * `None` is only added to the output dict for nullable fields that
101
+ were set at model initialization. Other fields with value `None`
102
+ are ignored.
103
+ * Fields in `self.additional_properties` are added to the output dict.
104
+ """
105
+ excluded_fields: Set[str] = set(
106
+ [
107
+ "additional_properties",
108
+ ]
109
+ )
110
+
111
+ _dict = self.model_dump(
112
+ by_alias=True,
113
+ exclude=excluded_fields,
114
+ exclude_none=True,
115
+ )
116
+ # override the default output from pydantic by calling `to_dict()` of each item in assigned_roles (list)
117
+ _items = []
118
+ if self.assigned_roles:
119
+ for _item_assigned_roles in self.assigned_roles:
120
+ if _item_assigned_roles:
121
+ _items.append(_item_assigned_roles.to_dict())
122
+ _dict["assignedRoles"] = _items
123
+ # puts key-value pairs in additional_properties in the top level
124
+ if self.additional_properties is not None:
125
+ for _key, _value in self.additional_properties.items():
126
+ _dict[_key] = _value
127
+
128
+ return _dict
129
+
130
+ @classmethod
131
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
132
+ """Create an instance of OrganizationInvitation from a dict"""
133
+ if obj is None:
134
+ return None
135
+
136
+ if not isinstance(obj, dict):
137
+ return cls.model_validate(obj)
138
+
139
+ _obj = cls.model_validate(
140
+ {
141
+ "id": obj.get("id"),
142
+ "email": obj.get("email"),
143
+ "invitedBy": obj.get("invitedBy"),
144
+ "organizationId": obj.get("organizationId"),
145
+ "organizationName": obj.get("organizationName"),
146
+ "expiresAt": obj.get("expiresAt"),
147
+ "status": obj.get("status"),
148
+ "role": obj.get("role"),
149
+ "assignedRoles": [OrganizationRole.from_dict(_item) for _item in obj["assignedRoles"]]
150
+ if obj.get("assignedRoles") is not None
151
+ else None,
152
+ "createdAt": obj.get("createdAt"),
153
+ "updatedAt": obj.get("updatedAt"),
154
+ }
155
+ )
156
+ # store additional fields in additional_properties
157
+ for _key in obj.keys():
158
+ if _key not in cls.__properties:
159
+ _obj.additional_properties[_key] = obj.get(_key)
160
+
161
+ return _obj