cyberdesk 0.2.3__py3-none-any.whl → 0.2.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 cyberdesk might be problematic. Click here for more details.
- {cyberdesk-0.2.3.dist-info → cyberdesk-0.2.4.dist-info}/METADATA +1 -2
- cyberdesk-0.2.4.dist-info/RECORD +136 -0
- cyberdesk-0.2.4.dist-info/top_level.txt +2 -0
- openapi_client/api_reference_client/__init__.py +8 -0
- openapi_client/api_reference_client/api/__init__.py +1 -0
- openapi_client/api_reference_client/api/desktop/__init__.py +1 -0
- openapi_client/api_reference_client/api/desktop/get_v1_desktop_id.py +293 -0
- openapi_client/api_reference_client/api/desktop/post_v1_desktop.py +294 -0
- openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_bash_action.py +307 -0
- openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_computer_action.py +419 -0
- openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_stop.py +288 -0
- openapi_client/api_reference_client/client.py +268 -0
- openapi_client/api_reference_client/errors.py +16 -0
- openapi_client/api_reference_client/models/__init__.py +249 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_200.py +104 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_200_status.py +11 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_400.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_400_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_401.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_401_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_403.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_403_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_404.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_404_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_409.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_409_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_429.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_429_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_500.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_500_status.py +8 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_502.py +69 -0
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_502_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_body.py +59 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_body.py +59 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_200.py +79 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_400.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_400_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_401.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_401_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_403.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_403_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_404.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_404_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_409.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_409_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_429.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_429_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_500.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_500_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_502.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_502_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action.py +133 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_button.py +10 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_click_type.py +10 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action.py +98 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_end.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_start.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_get_cursor_position_action.py +64 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_get_cursor_position_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_move_mouse_action.py +80 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_move_mouse_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action.py +109 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action_key_action_type.py +10 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_200.py +79 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_400.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_400_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_401.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_401_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_403.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_403_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_404.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_404_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_409.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_409_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_429.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_429_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_500.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_500_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_502.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_502_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_screenshot_action.py +63 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_screenshot_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action.py +81 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action_direction.py +11 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_type_text_action.py +71 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_type_text_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_wait_action.py +70 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_wait_action_type.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_200.py +62 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_200_status.py +11 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_400.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_400_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_401.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_401_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_403.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_403_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_404.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_404_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_409.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_409_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_429.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_429_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_500.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_500_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_502.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_502_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_200.py +70 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_200_status.py +11 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_400.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_400_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_401.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_401_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_403.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_403_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_404.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_404_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_409.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_409_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_429.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_429_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_500.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_500_status.py +8 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_502.py +69 -0
- openapi_client/api_reference_client/models/post_v1_desktop_response_502_status.py +8 -0
- openapi_client/api_reference_client/py.typed +1 -0
- openapi_client/api_reference_client/types.py +46 -0
- cyberdesk-0.2.3.dist-info/RECORD +0 -9
- cyberdesk-0.2.3.dist-info/top_level.txt +0 -1
- {cyberdesk-0.2.3.dist-info → cyberdesk-0.2.4.dist-info}/WHEEL +0 -0
- {cyberdesk-0.2.3.dist-info → cyberdesk-0.2.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.post_v1_desktop_id_stop_response_200 import PostV1DesktopIdStopResponse200
|
|
9
|
+
from ...models.post_v1_desktop_id_stop_response_400 import PostV1DesktopIdStopResponse400
|
|
10
|
+
from ...models.post_v1_desktop_id_stop_response_401 import PostV1DesktopIdStopResponse401
|
|
11
|
+
from ...models.post_v1_desktop_id_stop_response_403 import PostV1DesktopIdStopResponse403
|
|
12
|
+
from ...models.post_v1_desktop_id_stop_response_404 import PostV1DesktopIdStopResponse404
|
|
13
|
+
from ...models.post_v1_desktop_id_stop_response_409 import PostV1DesktopIdStopResponse409
|
|
14
|
+
from ...models.post_v1_desktop_id_stop_response_429 import PostV1DesktopIdStopResponse429
|
|
15
|
+
from ...models.post_v1_desktop_id_stop_response_500 import PostV1DesktopIdStopResponse500
|
|
16
|
+
from ...models.post_v1_desktop_id_stop_response_502 import PostV1DesktopIdStopResponse502
|
|
17
|
+
from ...types import Response
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _get_kwargs(
|
|
21
|
+
id: str,
|
|
22
|
+
*,
|
|
23
|
+
x_api_key: str,
|
|
24
|
+
) -> dict[str, Any]:
|
|
25
|
+
headers: dict[str, Any] = {}
|
|
26
|
+
headers["x-api-key"] = x_api_key
|
|
27
|
+
|
|
28
|
+
_kwargs: dict[str, Any] = {
|
|
29
|
+
"method": "post",
|
|
30
|
+
"url": f"/v1/desktop/{id}/stop",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
39
|
+
) -> Optional[
|
|
40
|
+
Union[
|
|
41
|
+
PostV1DesktopIdStopResponse200,
|
|
42
|
+
PostV1DesktopIdStopResponse400,
|
|
43
|
+
PostV1DesktopIdStopResponse401,
|
|
44
|
+
PostV1DesktopIdStopResponse403,
|
|
45
|
+
PostV1DesktopIdStopResponse404,
|
|
46
|
+
PostV1DesktopIdStopResponse409,
|
|
47
|
+
PostV1DesktopIdStopResponse429,
|
|
48
|
+
PostV1DesktopIdStopResponse500,
|
|
49
|
+
PostV1DesktopIdStopResponse502,
|
|
50
|
+
]
|
|
51
|
+
]:
|
|
52
|
+
if response.status_code == 200:
|
|
53
|
+
response_200 = PostV1DesktopIdStopResponse200.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_200
|
|
56
|
+
if response.status_code == 400:
|
|
57
|
+
response_400 = PostV1DesktopIdStopResponse400.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_400
|
|
60
|
+
if response.status_code == 401:
|
|
61
|
+
response_401 = PostV1DesktopIdStopResponse401.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
return response_401
|
|
64
|
+
if response.status_code == 403:
|
|
65
|
+
response_403 = PostV1DesktopIdStopResponse403.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_403
|
|
68
|
+
if response.status_code == 404:
|
|
69
|
+
response_404 = PostV1DesktopIdStopResponse404.from_dict(response.json())
|
|
70
|
+
|
|
71
|
+
return response_404
|
|
72
|
+
if response.status_code == 409:
|
|
73
|
+
response_409 = PostV1DesktopIdStopResponse409.from_dict(response.json())
|
|
74
|
+
|
|
75
|
+
return response_409
|
|
76
|
+
if response.status_code == 429:
|
|
77
|
+
response_429 = PostV1DesktopIdStopResponse429.from_dict(response.json())
|
|
78
|
+
|
|
79
|
+
return response_429
|
|
80
|
+
if response.status_code == 500:
|
|
81
|
+
response_500 = PostV1DesktopIdStopResponse500.from_dict(response.json())
|
|
82
|
+
|
|
83
|
+
return response_500
|
|
84
|
+
if response.status_code == 502:
|
|
85
|
+
response_502 = PostV1DesktopIdStopResponse502.from_dict(response.json())
|
|
86
|
+
|
|
87
|
+
return response_502
|
|
88
|
+
if client.raise_on_unexpected_status:
|
|
89
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
90
|
+
else:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _build_response(
|
|
95
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
96
|
+
) -> Response[
|
|
97
|
+
Union[
|
|
98
|
+
PostV1DesktopIdStopResponse200,
|
|
99
|
+
PostV1DesktopIdStopResponse400,
|
|
100
|
+
PostV1DesktopIdStopResponse401,
|
|
101
|
+
PostV1DesktopIdStopResponse403,
|
|
102
|
+
PostV1DesktopIdStopResponse404,
|
|
103
|
+
PostV1DesktopIdStopResponse409,
|
|
104
|
+
PostV1DesktopIdStopResponse429,
|
|
105
|
+
PostV1DesktopIdStopResponse500,
|
|
106
|
+
PostV1DesktopIdStopResponse502,
|
|
107
|
+
]
|
|
108
|
+
]:
|
|
109
|
+
return Response(
|
|
110
|
+
status_code=HTTPStatus(response.status_code),
|
|
111
|
+
content=response.content,
|
|
112
|
+
headers=response.headers,
|
|
113
|
+
parsed=_parse_response(client=client, response=response),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def sync_detailed(
|
|
118
|
+
id: str,
|
|
119
|
+
*,
|
|
120
|
+
client: Union[AuthenticatedClient, Client],
|
|
121
|
+
x_api_key: str,
|
|
122
|
+
) -> Response[
|
|
123
|
+
Union[
|
|
124
|
+
PostV1DesktopIdStopResponse200,
|
|
125
|
+
PostV1DesktopIdStopResponse400,
|
|
126
|
+
PostV1DesktopIdStopResponse401,
|
|
127
|
+
PostV1DesktopIdStopResponse403,
|
|
128
|
+
PostV1DesktopIdStopResponse404,
|
|
129
|
+
PostV1DesktopIdStopResponse409,
|
|
130
|
+
PostV1DesktopIdStopResponse429,
|
|
131
|
+
PostV1DesktopIdStopResponse500,
|
|
132
|
+
PostV1DesktopIdStopResponse502,
|
|
133
|
+
]
|
|
134
|
+
]:
|
|
135
|
+
"""Stop a running desktop instance
|
|
136
|
+
|
|
137
|
+
Stops a running desktop instance and cleans up resources
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
id (str): Desktop instance ID to stop Example: desktop_12345.
|
|
141
|
+
x_api_key (str): API key for authentication Example: api_12345.
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
145
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Response[Union[PostV1DesktopIdStopResponse200, PostV1DesktopIdStopResponse400, PostV1DesktopIdStopResponse401, PostV1DesktopIdStopResponse403, PostV1DesktopIdStopResponse404, PostV1DesktopIdStopResponse409, PostV1DesktopIdStopResponse429, PostV1DesktopIdStopResponse500, PostV1DesktopIdStopResponse502]]
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
kwargs = _get_kwargs(
|
|
152
|
+
id=id,
|
|
153
|
+
x_api_key=x_api_key,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
response = client.get_httpx_client().request(
|
|
157
|
+
**kwargs,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
return _build_response(client=client, response=response)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def sync(
|
|
164
|
+
id: str,
|
|
165
|
+
*,
|
|
166
|
+
client: Union[AuthenticatedClient, Client],
|
|
167
|
+
x_api_key: str,
|
|
168
|
+
) -> Optional[
|
|
169
|
+
Union[
|
|
170
|
+
PostV1DesktopIdStopResponse200,
|
|
171
|
+
PostV1DesktopIdStopResponse400,
|
|
172
|
+
PostV1DesktopIdStopResponse401,
|
|
173
|
+
PostV1DesktopIdStopResponse403,
|
|
174
|
+
PostV1DesktopIdStopResponse404,
|
|
175
|
+
PostV1DesktopIdStopResponse409,
|
|
176
|
+
PostV1DesktopIdStopResponse429,
|
|
177
|
+
PostV1DesktopIdStopResponse500,
|
|
178
|
+
PostV1DesktopIdStopResponse502,
|
|
179
|
+
]
|
|
180
|
+
]:
|
|
181
|
+
"""Stop a running desktop instance
|
|
182
|
+
|
|
183
|
+
Stops a running desktop instance and cleans up resources
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
id (str): Desktop instance ID to stop Example: desktop_12345.
|
|
187
|
+
x_api_key (str): API key for authentication Example: api_12345.
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
191
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
Union[PostV1DesktopIdStopResponse200, PostV1DesktopIdStopResponse400, PostV1DesktopIdStopResponse401, PostV1DesktopIdStopResponse403, PostV1DesktopIdStopResponse404, PostV1DesktopIdStopResponse409, PostV1DesktopIdStopResponse429, PostV1DesktopIdStopResponse500, PostV1DesktopIdStopResponse502]
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
return sync_detailed(
|
|
198
|
+
id=id,
|
|
199
|
+
client=client,
|
|
200
|
+
x_api_key=x_api_key,
|
|
201
|
+
).parsed
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
async def asyncio_detailed(
|
|
205
|
+
id: str,
|
|
206
|
+
*,
|
|
207
|
+
client: Union[AuthenticatedClient, Client],
|
|
208
|
+
x_api_key: str,
|
|
209
|
+
) -> Response[
|
|
210
|
+
Union[
|
|
211
|
+
PostV1DesktopIdStopResponse200,
|
|
212
|
+
PostV1DesktopIdStopResponse400,
|
|
213
|
+
PostV1DesktopIdStopResponse401,
|
|
214
|
+
PostV1DesktopIdStopResponse403,
|
|
215
|
+
PostV1DesktopIdStopResponse404,
|
|
216
|
+
PostV1DesktopIdStopResponse409,
|
|
217
|
+
PostV1DesktopIdStopResponse429,
|
|
218
|
+
PostV1DesktopIdStopResponse500,
|
|
219
|
+
PostV1DesktopIdStopResponse502,
|
|
220
|
+
]
|
|
221
|
+
]:
|
|
222
|
+
"""Stop a running desktop instance
|
|
223
|
+
|
|
224
|
+
Stops a running desktop instance and cleans up resources
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
id (str): Desktop instance ID to stop Example: desktop_12345.
|
|
228
|
+
x_api_key (str): API key for authentication Example: api_12345.
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
232
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
Response[Union[PostV1DesktopIdStopResponse200, PostV1DesktopIdStopResponse400, PostV1DesktopIdStopResponse401, PostV1DesktopIdStopResponse403, PostV1DesktopIdStopResponse404, PostV1DesktopIdStopResponse409, PostV1DesktopIdStopResponse429, PostV1DesktopIdStopResponse500, PostV1DesktopIdStopResponse502]]
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
kwargs = _get_kwargs(
|
|
239
|
+
id=id,
|
|
240
|
+
x_api_key=x_api_key,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
244
|
+
|
|
245
|
+
return _build_response(client=client, response=response)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
async def asyncio(
|
|
249
|
+
id: str,
|
|
250
|
+
*,
|
|
251
|
+
client: Union[AuthenticatedClient, Client],
|
|
252
|
+
x_api_key: str,
|
|
253
|
+
) -> Optional[
|
|
254
|
+
Union[
|
|
255
|
+
PostV1DesktopIdStopResponse200,
|
|
256
|
+
PostV1DesktopIdStopResponse400,
|
|
257
|
+
PostV1DesktopIdStopResponse401,
|
|
258
|
+
PostV1DesktopIdStopResponse403,
|
|
259
|
+
PostV1DesktopIdStopResponse404,
|
|
260
|
+
PostV1DesktopIdStopResponse409,
|
|
261
|
+
PostV1DesktopIdStopResponse429,
|
|
262
|
+
PostV1DesktopIdStopResponse500,
|
|
263
|
+
PostV1DesktopIdStopResponse502,
|
|
264
|
+
]
|
|
265
|
+
]:
|
|
266
|
+
"""Stop a running desktop instance
|
|
267
|
+
|
|
268
|
+
Stops a running desktop instance and cleans up resources
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
id (str): Desktop instance ID to stop Example: desktop_12345.
|
|
272
|
+
x_api_key (str): API key for authentication Example: api_12345.
|
|
273
|
+
|
|
274
|
+
Raises:
|
|
275
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
276
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
277
|
+
|
|
278
|
+
Returns:
|
|
279
|
+
Union[PostV1DesktopIdStopResponse200, PostV1DesktopIdStopResponse400, PostV1DesktopIdStopResponse401, PostV1DesktopIdStopResponse403, PostV1DesktopIdStopResponse404, PostV1DesktopIdStopResponse409, PostV1DesktopIdStopResponse429, PostV1DesktopIdStopResponse500, PostV1DesktopIdStopResponse502]
|
|
280
|
+
"""
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
await asyncio_detailed(
|
|
284
|
+
id=id,
|
|
285
|
+
client=client,
|
|
286
|
+
x_api_key=x_api_key,
|
|
287
|
+
)
|
|
288
|
+
).parsed
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import ssl
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from attrs import define, evolve, field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@define
|
|
9
|
+
class Client:
|
|
10
|
+
"""A class for keeping track of data related to the API
|
|
11
|
+
|
|
12
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
13
|
+
|
|
14
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
15
|
+
|
|
16
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
17
|
+
|
|
18
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
19
|
+
|
|
20
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
21
|
+
httpx.TimeoutException if this is exceeded.
|
|
22
|
+
|
|
23
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
24
|
+
but can be set to False for testing purposes.
|
|
25
|
+
|
|
26
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
27
|
+
|
|
28
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Attributes:
|
|
32
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
33
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
|
+
argument to the constructor.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
|
+
_base_url: str = field(alias="base_url")
|
|
39
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
40
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
41
|
+
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
|
42
|
+
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
43
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
44
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
45
|
+
_client: Optional[httpx.Client] = field(default=None, init=False)
|
|
46
|
+
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
|
47
|
+
|
|
48
|
+
def with_headers(self, headers: dict[str, str]) -> "Client":
|
|
49
|
+
"""Get a new client matching this one with additional headers"""
|
|
50
|
+
if self._client is not None:
|
|
51
|
+
self._client.headers.update(headers)
|
|
52
|
+
if self._async_client is not None:
|
|
53
|
+
self._async_client.headers.update(headers)
|
|
54
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
55
|
+
|
|
56
|
+
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
|
57
|
+
"""Get a new client matching this one with additional cookies"""
|
|
58
|
+
if self._client is not None:
|
|
59
|
+
self._client.cookies.update(cookies)
|
|
60
|
+
if self._async_client is not None:
|
|
61
|
+
self._async_client.cookies.update(cookies)
|
|
62
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
63
|
+
|
|
64
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
|
65
|
+
"""Get a new client matching this one with a new timeout (in seconds)"""
|
|
66
|
+
if self._client is not None:
|
|
67
|
+
self._client.timeout = timeout
|
|
68
|
+
if self._async_client is not None:
|
|
69
|
+
self._async_client.timeout = timeout
|
|
70
|
+
return evolve(self, timeout=timeout)
|
|
71
|
+
|
|
72
|
+
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
|
73
|
+
"""Manually set the underlying httpx.Client
|
|
74
|
+
|
|
75
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
76
|
+
"""
|
|
77
|
+
self._client = client
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
81
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
82
|
+
if self._client is None:
|
|
83
|
+
self._client = httpx.Client(
|
|
84
|
+
base_url=self._base_url,
|
|
85
|
+
cookies=self._cookies,
|
|
86
|
+
headers=self._headers,
|
|
87
|
+
timeout=self._timeout,
|
|
88
|
+
verify=self._verify_ssl,
|
|
89
|
+
follow_redirects=self._follow_redirects,
|
|
90
|
+
**self._httpx_args,
|
|
91
|
+
)
|
|
92
|
+
return self._client
|
|
93
|
+
|
|
94
|
+
def __enter__(self) -> "Client":
|
|
95
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
96
|
+
self.get_httpx_client().__enter__()
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
100
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
101
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
102
|
+
|
|
103
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
|
104
|
+
"""Manually the underlying httpx.AsyncClient
|
|
105
|
+
|
|
106
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
107
|
+
"""
|
|
108
|
+
self._async_client = async_client
|
|
109
|
+
return self
|
|
110
|
+
|
|
111
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
112
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
113
|
+
if self._async_client is None:
|
|
114
|
+
self._async_client = httpx.AsyncClient(
|
|
115
|
+
base_url=self._base_url,
|
|
116
|
+
cookies=self._cookies,
|
|
117
|
+
headers=self._headers,
|
|
118
|
+
timeout=self._timeout,
|
|
119
|
+
verify=self._verify_ssl,
|
|
120
|
+
follow_redirects=self._follow_redirects,
|
|
121
|
+
**self._httpx_args,
|
|
122
|
+
)
|
|
123
|
+
return self._async_client
|
|
124
|
+
|
|
125
|
+
async def __aenter__(self) -> "Client":
|
|
126
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
127
|
+
await self.get_async_httpx_client().__aenter__()
|
|
128
|
+
return self
|
|
129
|
+
|
|
130
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
131
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
132
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@define
|
|
136
|
+
class AuthenticatedClient:
|
|
137
|
+
"""A Client which has been authenticated for use on secured endpoints
|
|
138
|
+
|
|
139
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
140
|
+
|
|
141
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
142
|
+
|
|
143
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
144
|
+
|
|
145
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
146
|
+
|
|
147
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
148
|
+
httpx.TimeoutException if this is exceeded.
|
|
149
|
+
|
|
150
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
151
|
+
but can be set to False for testing purposes.
|
|
152
|
+
|
|
153
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
154
|
+
|
|
155
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Attributes:
|
|
159
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
160
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
161
|
+
argument to the constructor.
|
|
162
|
+
token: The token to use for authentication
|
|
163
|
+
prefix: The prefix to use for the Authorization header
|
|
164
|
+
auth_header_name: The name of the Authorization header
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
168
|
+
_base_url: str = field(alias="base_url")
|
|
169
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
170
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
171
|
+
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
|
172
|
+
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
173
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
174
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
175
|
+
_client: Optional[httpx.Client] = field(default=None, init=False)
|
|
176
|
+
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
|
177
|
+
|
|
178
|
+
token: str
|
|
179
|
+
prefix: str = "Bearer"
|
|
180
|
+
auth_header_name: str = "Authorization"
|
|
181
|
+
|
|
182
|
+
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
|
183
|
+
"""Get a new client matching this one with additional headers"""
|
|
184
|
+
if self._client is not None:
|
|
185
|
+
self._client.headers.update(headers)
|
|
186
|
+
if self._async_client is not None:
|
|
187
|
+
self._async_client.headers.update(headers)
|
|
188
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
189
|
+
|
|
190
|
+
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
|
191
|
+
"""Get a new client matching this one with additional cookies"""
|
|
192
|
+
if self._client is not None:
|
|
193
|
+
self._client.cookies.update(cookies)
|
|
194
|
+
if self._async_client is not None:
|
|
195
|
+
self._async_client.cookies.update(cookies)
|
|
196
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
197
|
+
|
|
198
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
|
199
|
+
"""Get a new client matching this one with a new timeout (in seconds)"""
|
|
200
|
+
if self._client is not None:
|
|
201
|
+
self._client.timeout = timeout
|
|
202
|
+
if self._async_client is not None:
|
|
203
|
+
self._async_client.timeout = timeout
|
|
204
|
+
return evolve(self, timeout=timeout)
|
|
205
|
+
|
|
206
|
+
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
|
207
|
+
"""Manually set the underlying httpx.Client
|
|
208
|
+
|
|
209
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
210
|
+
"""
|
|
211
|
+
self._client = client
|
|
212
|
+
return self
|
|
213
|
+
|
|
214
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
215
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
216
|
+
if self._client is None:
|
|
217
|
+
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
218
|
+
self._client = httpx.Client(
|
|
219
|
+
base_url=self._base_url,
|
|
220
|
+
cookies=self._cookies,
|
|
221
|
+
headers=self._headers,
|
|
222
|
+
timeout=self._timeout,
|
|
223
|
+
verify=self._verify_ssl,
|
|
224
|
+
follow_redirects=self._follow_redirects,
|
|
225
|
+
**self._httpx_args,
|
|
226
|
+
)
|
|
227
|
+
return self._client
|
|
228
|
+
|
|
229
|
+
def __enter__(self) -> "AuthenticatedClient":
|
|
230
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
231
|
+
self.get_httpx_client().__enter__()
|
|
232
|
+
return self
|
|
233
|
+
|
|
234
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
235
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
236
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
237
|
+
|
|
238
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
|
239
|
+
"""Manually the underlying httpx.AsyncClient
|
|
240
|
+
|
|
241
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
242
|
+
"""
|
|
243
|
+
self._async_client = async_client
|
|
244
|
+
return self
|
|
245
|
+
|
|
246
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
247
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
248
|
+
if self._async_client is None:
|
|
249
|
+
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
250
|
+
self._async_client = httpx.AsyncClient(
|
|
251
|
+
base_url=self._base_url,
|
|
252
|
+
cookies=self._cookies,
|
|
253
|
+
headers=self._headers,
|
|
254
|
+
timeout=self._timeout,
|
|
255
|
+
verify=self._verify_ssl,
|
|
256
|
+
follow_redirects=self._follow_redirects,
|
|
257
|
+
**self._httpx_args,
|
|
258
|
+
)
|
|
259
|
+
return self._async_client
|
|
260
|
+
|
|
261
|
+
async def __aenter__(self) -> "AuthenticatedClient":
|
|
262
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
263
|
+
await self.get_async_httpx_client().__aenter__()
|
|
264
|
+
return self
|
|
265
|
+
|
|
266
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
267
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
268
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class UnexpectedStatus(Exception):
|
|
5
|
+
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, status_code: int, content: bytes):
|
|
8
|
+
self.status_code = status_code
|
|
9
|
+
self.content = content
|
|
10
|
+
|
|
11
|
+
super().__init__(
|
|
12
|
+
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["UnexpectedStatus"]
|