daytona_api_client 0.106.0a3__py3-none-any.whl → 0.106.4__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.

@@ -17,11 +17,11 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
17
17
  from typing import Any, Dict, List, Optional, Tuple, Union
18
18
  from typing_extensions import Annotated
19
19
 
20
- from pydantic import Field, StrictBool, StrictStr, field_validator
20
+ from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr
21
21
  from typing import Optional, Union
22
22
  from typing_extensions import Annotated
23
23
  from daytona_api_client.models.create_snapshot import CreateSnapshot
24
- from daytona_api_client.models.paginated_snapshots import PaginatedSnapshots
24
+ from daytona_api_client.models.paginated_snapshots_dto import PaginatedSnapshotsDto
25
25
  from daytona_api_client.models.set_snapshot_general_status_dto import SetSnapshotGeneralStatusDto
26
26
  from daytona_api_client.models.snapshot_dto import SnapshotDto
27
27
 
@@ -1160,11 +1160,8 @@ class SnapshotsApi:
1160
1160
  def get_all_snapshots(
1161
1161
  self,
1162
1162
  x_daytona_organization_id: Annotated[Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")] = None,
1163
- page: Annotated[Optional[Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]]], Field(description="Page number of the results")] = None,
1164
- limit: Annotated[Optional[Union[Annotated[float, Field(le=100, strict=True, ge=1)], Annotated[int, Field(le=100, strict=True, ge=1)]]], Field(description="Number of results per page")] = None,
1165
- name: Annotated[Optional[StrictStr], Field(description="Filter by partial name match")] = None,
1166
- sort: Annotated[Optional[StrictStr], Field(description="Field to sort by")] = None,
1167
- order: Annotated[Optional[StrictStr], Field(description="Direction to sort by")] = None,
1163
+ limit: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="Number of items per page")] = None,
1164
+ page: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="Page number")] = None,
1168
1165
  _request_timeout: Union[
1169
1166
  None,
1170
1167
  Annotated[StrictFloat, Field(gt=0)],
@@ -1177,22 +1174,16 @@ class SnapshotsApi:
1177
1174
  _content_type: Optional[StrictStr] = None,
1178
1175
  _headers: Optional[Dict[StrictStr, Any]] = None,
1179
1176
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1180
- ) -> PaginatedSnapshots:
1177
+ ) -> PaginatedSnapshotsDto:
1181
1178
  """List all snapshots
1182
1179
 
1183
1180
 
1184
1181
  :param x_daytona_organization_id: Use with JWT to specify the organization ID
1185
1182
  :type x_daytona_organization_id: str
1186
- :param page: Page number of the results
1187
- :type page: float
1188
- :param limit: Number of results per page
1183
+ :param limit: Number of items per page
1189
1184
  :type limit: float
1190
- :param name: Filter by partial name match
1191
- :type name: str
1192
- :param sort: Field to sort by
1193
- :type sort: str
1194
- :param order: Direction to sort by
1195
- :type order: str
1185
+ :param page: Page number
1186
+ :type page: float
1196
1187
  :param _request_timeout: timeout setting for this request. If one
1197
1188
  number provided, it will be total request
1198
1189
  timeout. It can also be a pair (tuple) of
@@ -1217,11 +1208,8 @@ class SnapshotsApi:
1217
1208
 
1218
1209
  _param = self._get_all_snapshots_serialize(
1219
1210
  x_daytona_organization_id=x_daytona_organization_id,
1220
- page=page,
1221
1211
  limit=limit,
1222
- name=name,
1223
- sort=sort,
1224
- order=order,
1212
+ page=page,
1225
1213
  _request_auth=_request_auth,
1226
1214
  _content_type=_content_type,
1227
1215
  _headers=_headers,
@@ -1229,7 +1217,7 @@ class SnapshotsApi:
1229
1217
  )
1230
1218
 
1231
1219
  _response_types_map: Dict[str, Optional[str]] = {
1232
- '200': "PaginatedSnapshots",
1220
+ '200': "PaginatedSnapshotsDto",
1233
1221
  }
1234
1222
  response_data = self.api_client.call_api(
1235
1223
  *_param,
@@ -1246,11 +1234,8 @@ class SnapshotsApi:
1246
1234
  def get_all_snapshots_with_http_info(
1247
1235
  self,
1248
1236
  x_daytona_organization_id: Annotated[Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")] = None,
1249
- page: Annotated[Optional[Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]]], Field(description="Page number of the results")] = None,
1250
- limit: Annotated[Optional[Union[Annotated[float, Field(le=100, strict=True, ge=1)], Annotated[int, Field(le=100, strict=True, ge=1)]]], Field(description="Number of results per page")] = None,
1251
- name: Annotated[Optional[StrictStr], Field(description="Filter by partial name match")] = None,
1252
- sort: Annotated[Optional[StrictStr], Field(description="Field to sort by")] = None,
1253
- order: Annotated[Optional[StrictStr], Field(description="Direction to sort by")] = None,
1237
+ limit: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="Number of items per page")] = None,
1238
+ page: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="Page number")] = None,
1254
1239
  _request_timeout: Union[
1255
1240
  None,
1256
1241
  Annotated[StrictFloat, Field(gt=0)],
@@ -1263,22 +1248,16 @@ class SnapshotsApi:
1263
1248
  _content_type: Optional[StrictStr] = None,
1264
1249
  _headers: Optional[Dict[StrictStr, Any]] = None,
1265
1250
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1266
- ) -> ApiResponse[PaginatedSnapshots]:
1251
+ ) -> ApiResponse[PaginatedSnapshotsDto]:
1267
1252
  """List all snapshots
1268
1253
 
1269
1254
 
1270
1255
  :param x_daytona_organization_id: Use with JWT to specify the organization ID
1271
1256
  :type x_daytona_organization_id: str
1272
- :param page: Page number of the results
1273
- :type page: float
1274
- :param limit: Number of results per page
1257
+ :param limit: Number of items per page
1275
1258
  :type limit: float
1276
- :param name: Filter by partial name match
1277
- :type name: str
1278
- :param sort: Field to sort by
1279
- :type sort: str
1280
- :param order: Direction to sort by
1281
- :type order: str
1259
+ :param page: Page number
1260
+ :type page: float
1282
1261
  :param _request_timeout: timeout setting for this request. If one
1283
1262
  number provided, it will be total request
1284
1263
  timeout. It can also be a pair (tuple) of
@@ -1303,11 +1282,8 @@ class SnapshotsApi:
1303
1282
 
1304
1283
  _param = self._get_all_snapshots_serialize(
1305
1284
  x_daytona_organization_id=x_daytona_organization_id,
1306
- page=page,
1307
1285
  limit=limit,
1308
- name=name,
1309
- sort=sort,
1310
- order=order,
1286
+ page=page,
1311
1287
  _request_auth=_request_auth,
1312
1288
  _content_type=_content_type,
1313
1289
  _headers=_headers,
@@ -1315,7 +1291,7 @@ class SnapshotsApi:
1315
1291
  )
1316
1292
 
1317
1293
  _response_types_map: Dict[str, Optional[str]] = {
1318
- '200': "PaginatedSnapshots",
1294
+ '200': "PaginatedSnapshotsDto",
1319
1295
  }
1320
1296
  response_data = self.api_client.call_api(
1321
1297
  *_param,
@@ -1332,11 +1308,8 @@ class SnapshotsApi:
1332
1308
  def get_all_snapshots_without_preload_content(
1333
1309
  self,
1334
1310
  x_daytona_organization_id: Annotated[Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")] = None,
1335
- page: Annotated[Optional[Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]]], Field(description="Page number of the results")] = None,
1336
- limit: Annotated[Optional[Union[Annotated[float, Field(le=100, strict=True, ge=1)], Annotated[int, Field(le=100, strict=True, ge=1)]]], Field(description="Number of results per page")] = None,
1337
- name: Annotated[Optional[StrictStr], Field(description="Filter by partial name match")] = None,
1338
- sort: Annotated[Optional[StrictStr], Field(description="Field to sort by")] = None,
1339
- order: Annotated[Optional[StrictStr], Field(description="Direction to sort by")] = None,
1311
+ limit: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="Number of items per page")] = None,
1312
+ page: Annotated[Optional[Union[StrictFloat, StrictInt]], Field(description="Page number")] = None,
1340
1313
  _request_timeout: Union[
1341
1314
  None,
1342
1315
  Annotated[StrictFloat, Field(gt=0)],
@@ -1355,16 +1328,10 @@ class SnapshotsApi:
1355
1328
 
1356
1329
  :param x_daytona_organization_id: Use with JWT to specify the organization ID
1357
1330
  :type x_daytona_organization_id: str
1358
- :param page: Page number of the results
1359
- :type page: float
1360
- :param limit: Number of results per page
1331
+ :param limit: Number of items per page
1361
1332
  :type limit: float
1362
- :param name: Filter by partial name match
1363
- :type name: str
1364
- :param sort: Field to sort by
1365
- :type sort: str
1366
- :param order: Direction to sort by
1367
- :type order: str
1333
+ :param page: Page number
1334
+ :type page: float
1368
1335
  :param _request_timeout: timeout setting for this request. If one
1369
1336
  number provided, it will be total request
1370
1337
  timeout. It can also be a pair (tuple) of
@@ -1389,11 +1356,8 @@ class SnapshotsApi:
1389
1356
 
1390
1357
  _param = self._get_all_snapshots_serialize(
1391
1358
  x_daytona_organization_id=x_daytona_organization_id,
1392
- page=page,
1393
1359
  limit=limit,
1394
- name=name,
1395
- sort=sort,
1396
- order=order,
1360
+ page=page,
1397
1361
  _request_auth=_request_auth,
1398
1362
  _content_type=_content_type,
1399
1363
  _headers=_headers,
@@ -1401,7 +1365,7 @@ class SnapshotsApi:
1401
1365
  )
1402
1366
 
1403
1367
  _response_types_map: Dict[str, Optional[str]] = {
1404
- '200': "PaginatedSnapshots",
1368
+ '200': "PaginatedSnapshotsDto",
1405
1369
  }
1406
1370
  response_data = self.api_client.call_api(
1407
1371
  *_param,
@@ -1413,11 +1377,8 @@ class SnapshotsApi:
1413
1377
  def _get_all_snapshots_serialize(
1414
1378
  self,
1415
1379
  x_daytona_organization_id,
1416
- page,
1417
1380
  limit,
1418
- name,
1419
- sort,
1420
- order,
1381
+ page,
1421
1382
  _request_auth,
1422
1383
  _content_type,
1423
1384
  _headers,
@@ -1440,25 +1401,13 @@ class SnapshotsApi:
1440
1401
 
1441
1402
  # process the path parameters
1442
1403
  # process the query parameters
1443
- if page is not None:
1444
-
1445
- _query_params.append(('page', page))
1446
-
1447
1404
  if limit is not None:
1448
1405
 
1449
1406
  _query_params.append(('limit', limit))
1450
1407
 
1451
- if name is not None:
1452
-
1453
- _query_params.append(('name', name))
1454
-
1455
- if sort is not None:
1456
-
1457
- _query_params.append(('sort', sort))
1458
-
1459
- if order is not None:
1408
+ if page is not None:
1460
1409
 
1461
- _query_params.append(('order', order))
1410
+ _query_params.append(('page', page))
1462
1411
 
1463
1412
  # process the header parameters
1464
1413
  if x_daytona_organization_id is not None:
@@ -94,8 +94,7 @@ from daytona_api_client.models.organization_suspension import OrganizationSuspen
94
94
  from daytona_api_client.models.organization_usage_overview import OrganizationUsageOverview
95
95
  from daytona_api_client.models.organization_user import OrganizationUser
96
96
  from daytona_api_client.models.paginated_audit_logs import PaginatedAuditLogs
97
- from daytona_api_client.models.paginated_sandboxes import PaginatedSandboxes
98
- from daytona_api_client.models.paginated_snapshots import PaginatedSnapshots
97
+ from daytona_api_client.models.paginated_snapshots_dto import PaginatedSnapshotsDto
99
98
  from daytona_api_client.models.port_preview_url import PortPreviewUrl
100
99
  from daytona_api_client.models.position import Position
101
100
  from daytona_api_client.models.posthog_config import PosthogConfig
@@ -105,7 +104,6 @@ from daytona_api_client.models.process_restart_response import ProcessRestartRes
105
104
  from daytona_api_client.models.process_status_response import ProcessStatusResponse
106
105
  from daytona_api_client.models.project_dir_response import ProjectDirResponse
107
106
  from daytona_api_client.models.range import Range
108
- from daytona_api_client.models.region import Region
109
107
  from daytona_api_client.models.region_screenshot_response import RegionScreenshotResponse
110
108
  from daytona_api_client.models.registry_push_access_dto import RegistryPushAccessDto
111
109
  from daytona_api_client.models.replace_request import ReplaceRequest
@@ -0,0 +1,111 @@
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, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PtyCreateRequest(BaseModel):
27
+ """
28
+ PtyCreateRequest
29
+ """ # noqa: E501
30
+ id: StrictStr = Field(description="The unique identifier for the PTY session")
31
+ cwd: Optional[StrictStr] = Field(default=None, description="Starting directory for the PTY session, defaults to the sandbox's working directory")
32
+ envs: Optional[Dict[str, Any]] = Field(default=None, description="Environment variables for the PTY session")
33
+ cols: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of terminal columns")
34
+ rows: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of terminal rows")
35
+ lazy_start: Optional[StrictBool] = Field(default=False, description="Whether to start the PTY session lazily (only start when first client connects)", alias="lazyStart")
36
+ additional_properties: Dict[str, Any] = {}
37
+ __properties: ClassVar[List[str]] = ["id", "cwd", "envs", "cols", "rows", "lazyStart"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of PtyCreateRequest from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ * Fields in `self.additional_properties` are added to the output dict.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ "additional_properties",
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 PtyCreateRequest 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({
97
+ "id": obj.get("id"),
98
+ "cwd": obj.get("cwd"),
99
+ "envs": obj.get("envs"),
100
+ "cols": obj.get("cols"),
101
+ "rows": obj.get("rows"),
102
+ "lazyStart": obj.get("lazyStart") if obj.get("lazyStart") is not None else False
103
+ })
104
+ # store additional fields in additional_properties
105
+ for _key in obj.keys():
106
+ if _key not in cls.__properties:
107
+ _obj.additional_properties[_key] = obj.get(_key)
108
+
109
+ return _obj
110
+
111
+
@@ -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
+ class PtyCreateResponse(BaseModel):
27
+ """
28
+ PtyCreateResponse
29
+ """ # noqa: E501
30
+ session_id: StrictStr = Field(description="The unique identifier for the created PTY session", alias="sessionId")
31
+ additional_properties: Dict[str, Any] = {}
32
+ __properties: ClassVar[List[str]] = ["sessionId"]
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 PtyCreateResponse 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
+ * Fields in `self.additional_properties` are added to the output dict.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ "additional_properties",
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # puts key-value pairs in additional_properties in the top level
76
+ if self.additional_properties is not None:
77
+ for _key, _value in self.additional_properties.items():
78
+ _dict[_key] = _value
79
+
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of PtyCreateResponse from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate({
92
+ "sessionId": obj.get("sessionId")
93
+ })
94
+ # store additional fields in additional_properties
95
+ for _key in obj.keys():
96
+ if _key not in cls.__properties:
97
+ _obj.additional_properties[_key] = obj.get(_key)
98
+
99
+ return _obj
100
+
101
+
@@ -0,0 +1,109 @@
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
22
+ from typing import Any, ClassVar, Dict, List
23
+ from daytona_api_client.models.pty_session_info import PtySessionInfo
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class PtyListResponse(BaseModel):
28
+ """
29
+ PtyListResponse
30
+ """ # noqa: E501
31
+ sessions: List[PtySessionInfo] = Field(description="List of active PTY sessions")
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["sessions"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of PtyListResponse from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ "additional_properties",
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of each item in sessions (list)
77
+ _items = []
78
+ if self.sessions:
79
+ for _item_sessions in self.sessions:
80
+ if _item_sessions:
81
+ _items.append(_item_sessions.to_dict())
82
+ _dict['sessions'] = _items
83
+ # puts key-value pairs in additional_properties in the top level
84
+ if self.additional_properties is not None:
85
+ for _key, _value in self.additional_properties.items():
86
+ _dict[_key] = _value
87
+
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of PtyListResponse from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "sessions": [PtySessionInfo.from_dict(_item) for _item in obj["sessions"]] if obj.get("sessions") is not None else None
101
+ })
102
+ # store additional fields in additional_properties
103
+ for _key in obj.keys():
104
+ if _key not in cls.__properties:
105
+ _obj.additional_properties[_key] = obj.get(_key)
106
+
107
+ return _obj
108
+
109
+
@@ -0,0 +1,103 @@
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, StrictFloat, StrictInt
22
+ from typing import Any, ClassVar, Dict, List, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PtyResizeRequest(BaseModel):
27
+ """
28
+ PtyResizeRequest
29
+ """ # noqa: E501
30
+ cols: Union[StrictFloat, StrictInt] = Field(description="Number of terminal columns")
31
+ rows: Union[StrictFloat, StrictInt] = Field(description="Number of terminal rows")
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["cols", "rows"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of PtyResizeRequest from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ "additional_properties",
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # puts key-value pairs in additional_properties in the top level
77
+ if self.additional_properties is not None:
78
+ for _key, _value in self.additional_properties.items():
79
+ _dict[_key] = _value
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of PtyResizeRequest from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "cols": obj.get("cols"),
94
+ "rows": obj.get("rows")
95
+ })
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
102
+
103
+