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.

Files changed (134) hide show
  1. {cyberdesk-0.2.3.dist-info → cyberdesk-0.2.4.dist-info}/METADATA +1 -2
  2. cyberdesk-0.2.4.dist-info/RECORD +136 -0
  3. cyberdesk-0.2.4.dist-info/top_level.txt +2 -0
  4. openapi_client/api_reference_client/__init__.py +8 -0
  5. openapi_client/api_reference_client/api/__init__.py +1 -0
  6. openapi_client/api_reference_client/api/desktop/__init__.py +1 -0
  7. openapi_client/api_reference_client/api/desktop/get_v1_desktop_id.py +293 -0
  8. openapi_client/api_reference_client/api/desktop/post_v1_desktop.py +294 -0
  9. openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_bash_action.py +307 -0
  10. openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_computer_action.py +419 -0
  11. openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_stop.py +288 -0
  12. openapi_client/api_reference_client/client.py +268 -0
  13. openapi_client/api_reference_client/errors.py +16 -0
  14. openapi_client/api_reference_client/models/__init__.py +249 -0
  15. openapi_client/api_reference_client/models/get_v1_desktop_id_response_200.py +104 -0
  16. openapi_client/api_reference_client/models/get_v1_desktop_id_response_200_status.py +11 -0
  17. openapi_client/api_reference_client/models/get_v1_desktop_id_response_400.py +69 -0
  18. openapi_client/api_reference_client/models/get_v1_desktop_id_response_400_status.py +8 -0
  19. openapi_client/api_reference_client/models/get_v1_desktop_id_response_401.py +69 -0
  20. openapi_client/api_reference_client/models/get_v1_desktop_id_response_401_status.py +8 -0
  21. openapi_client/api_reference_client/models/get_v1_desktop_id_response_403.py +69 -0
  22. openapi_client/api_reference_client/models/get_v1_desktop_id_response_403_status.py +8 -0
  23. openapi_client/api_reference_client/models/get_v1_desktop_id_response_404.py +69 -0
  24. openapi_client/api_reference_client/models/get_v1_desktop_id_response_404_status.py +8 -0
  25. openapi_client/api_reference_client/models/get_v1_desktop_id_response_409.py +69 -0
  26. openapi_client/api_reference_client/models/get_v1_desktop_id_response_409_status.py +8 -0
  27. openapi_client/api_reference_client/models/get_v1_desktop_id_response_429.py +69 -0
  28. openapi_client/api_reference_client/models/get_v1_desktop_id_response_429_status.py +8 -0
  29. openapi_client/api_reference_client/models/get_v1_desktop_id_response_500.py +69 -0
  30. openapi_client/api_reference_client/models/get_v1_desktop_id_response_500_status.py +8 -0
  31. openapi_client/api_reference_client/models/get_v1_desktop_id_response_502.py +69 -0
  32. openapi_client/api_reference_client/models/get_v1_desktop_id_response_502_status.py +8 -0
  33. openapi_client/api_reference_client/models/post_v1_desktop_body.py +59 -0
  34. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_body.py +59 -0
  35. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_200.py +79 -0
  36. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_400.py +69 -0
  37. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_400_status.py +8 -0
  38. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_401.py +69 -0
  39. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_401_status.py +8 -0
  40. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_403.py +69 -0
  41. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_403_status.py +8 -0
  42. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_404.py +69 -0
  43. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_404_status.py +8 -0
  44. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_409.py +69 -0
  45. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_409_status.py +8 -0
  46. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_429.py +69 -0
  47. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_429_status.py +8 -0
  48. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_500.py +69 -0
  49. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_500_status.py +8 -0
  50. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_502.py +69 -0
  51. openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_502_status.py +8 -0
  52. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action.py +133 -0
  53. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_button.py +10 -0
  54. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_click_type.py +10 -0
  55. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_type.py +8 -0
  56. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action.py +98 -0
  57. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_end.py +71 -0
  58. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_start.py +71 -0
  59. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_type.py +8 -0
  60. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_get_cursor_position_action.py +64 -0
  61. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_get_cursor_position_action_type.py +8 -0
  62. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_move_mouse_action.py +80 -0
  63. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_move_mouse_action_type.py +8 -0
  64. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action.py +109 -0
  65. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action_key_action_type.py +10 -0
  66. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action_type.py +8 -0
  67. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_200.py +79 -0
  68. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_400.py +71 -0
  69. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_400_status.py +8 -0
  70. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_401.py +71 -0
  71. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_401_status.py +8 -0
  72. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_403.py +71 -0
  73. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_403_status.py +8 -0
  74. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_404.py +71 -0
  75. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_404_status.py +8 -0
  76. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_409.py +71 -0
  77. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_409_status.py +8 -0
  78. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_429.py +71 -0
  79. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_429_status.py +8 -0
  80. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_500.py +71 -0
  81. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_500_status.py +8 -0
  82. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_502.py +71 -0
  83. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_502_status.py +8 -0
  84. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_screenshot_action.py +63 -0
  85. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_screenshot_action_type.py +8 -0
  86. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action.py +81 -0
  87. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action_direction.py +11 -0
  88. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action_type.py +8 -0
  89. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_type_text_action.py +71 -0
  90. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_type_text_action_type.py +8 -0
  91. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_wait_action.py +70 -0
  92. openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_wait_action_type.py +8 -0
  93. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_200.py +62 -0
  94. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_200_status.py +11 -0
  95. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_400.py +69 -0
  96. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_400_status.py +8 -0
  97. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_401.py +69 -0
  98. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_401_status.py +8 -0
  99. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_403.py +69 -0
  100. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_403_status.py +8 -0
  101. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_404.py +69 -0
  102. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_404_status.py +8 -0
  103. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_409.py +69 -0
  104. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_409_status.py +8 -0
  105. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_429.py +69 -0
  106. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_429_status.py +8 -0
  107. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_500.py +69 -0
  108. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_500_status.py +8 -0
  109. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_502.py +69 -0
  110. openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_502_status.py +8 -0
  111. openapi_client/api_reference_client/models/post_v1_desktop_response_200.py +70 -0
  112. openapi_client/api_reference_client/models/post_v1_desktop_response_200_status.py +11 -0
  113. openapi_client/api_reference_client/models/post_v1_desktop_response_400.py +69 -0
  114. openapi_client/api_reference_client/models/post_v1_desktop_response_400_status.py +8 -0
  115. openapi_client/api_reference_client/models/post_v1_desktop_response_401.py +69 -0
  116. openapi_client/api_reference_client/models/post_v1_desktop_response_401_status.py +8 -0
  117. openapi_client/api_reference_client/models/post_v1_desktop_response_403.py +69 -0
  118. openapi_client/api_reference_client/models/post_v1_desktop_response_403_status.py +8 -0
  119. openapi_client/api_reference_client/models/post_v1_desktop_response_404.py +69 -0
  120. openapi_client/api_reference_client/models/post_v1_desktop_response_404_status.py +8 -0
  121. openapi_client/api_reference_client/models/post_v1_desktop_response_409.py +69 -0
  122. openapi_client/api_reference_client/models/post_v1_desktop_response_409_status.py +8 -0
  123. openapi_client/api_reference_client/models/post_v1_desktop_response_429.py +69 -0
  124. openapi_client/api_reference_client/models/post_v1_desktop_response_429_status.py +8 -0
  125. openapi_client/api_reference_client/models/post_v1_desktop_response_500.py +69 -0
  126. openapi_client/api_reference_client/models/post_v1_desktop_response_500_status.py +8 -0
  127. openapi_client/api_reference_client/models/post_v1_desktop_response_502.py +69 -0
  128. openapi_client/api_reference_client/models/post_v1_desktop_response_502_status.py +8 -0
  129. openapi_client/api_reference_client/py.typed +1 -0
  130. openapi_client/api_reference_client/types.py +46 -0
  131. cyberdesk-0.2.3.dist-info/RECORD +0 -9
  132. cyberdesk-0.2.3.dist-info/top_level.txt +0 -1
  133. {cyberdesk-0.2.3.dist-info → cyberdesk-0.2.4.dist-info}/WHEEL +0 -0
  134. {cyberdesk-0.2.3.dist-info → cyberdesk-0.2.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,294 @@
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_body import PostV1DesktopBody
9
+ from ...models.post_v1_desktop_response_200 import PostV1DesktopResponse200
10
+ from ...models.post_v1_desktop_response_400 import PostV1DesktopResponse400
11
+ from ...models.post_v1_desktop_response_401 import PostV1DesktopResponse401
12
+ from ...models.post_v1_desktop_response_403 import PostV1DesktopResponse403
13
+ from ...models.post_v1_desktop_response_404 import PostV1DesktopResponse404
14
+ from ...models.post_v1_desktop_response_409 import PostV1DesktopResponse409
15
+ from ...models.post_v1_desktop_response_429 import PostV1DesktopResponse429
16
+ from ...models.post_v1_desktop_response_500 import PostV1DesktopResponse500
17
+ from ...models.post_v1_desktop_response_502 import PostV1DesktopResponse502
18
+ from ...types import Response
19
+
20
+
21
+ def _get_kwargs(
22
+ *,
23
+ body: PostV1DesktopBody,
24
+ x_api_key: str,
25
+ ) -> dict[str, Any]:
26
+ headers: dict[str, Any] = {}
27
+ headers["x-api-key"] = x_api_key
28
+
29
+ _kwargs: dict[str, Any] = {
30
+ "method": "post",
31
+ "url": "/v1/desktop",
32
+ }
33
+
34
+ _body = body.to_dict()
35
+
36
+ _kwargs["json"] = _body
37
+ headers["Content-Type"] = "application/json"
38
+
39
+ _kwargs["headers"] = headers
40
+ return _kwargs
41
+
42
+
43
+ def _parse_response(
44
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
45
+ ) -> Optional[
46
+ Union[
47
+ PostV1DesktopResponse200,
48
+ PostV1DesktopResponse400,
49
+ PostV1DesktopResponse401,
50
+ PostV1DesktopResponse403,
51
+ PostV1DesktopResponse404,
52
+ PostV1DesktopResponse409,
53
+ PostV1DesktopResponse429,
54
+ PostV1DesktopResponse500,
55
+ PostV1DesktopResponse502,
56
+ ]
57
+ ]:
58
+ if response.status_code == 200:
59
+ response_200 = PostV1DesktopResponse200.from_dict(response.json())
60
+
61
+ return response_200
62
+ if response.status_code == 400:
63
+ response_400 = PostV1DesktopResponse400.from_dict(response.json())
64
+
65
+ return response_400
66
+ if response.status_code == 401:
67
+ response_401 = PostV1DesktopResponse401.from_dict(response.json())
68
+
69
+ return response_401
70
+ if response.status_code == 403:
71
+ response_403 = PostV1DesktopResponse403.from_dict(response.json())
72
+
73
+ return response_403
74
+ if response.status_code == 404:
75
+ response_404 = PostV1DesktopResponse404.from_dict(response.json())
76
+
77
+ return response_404
78
+ if response.status_code == 409:
79
+ response_409 = PostV1DesktopResponse409.from_dict(response.json())
80
+
81
+ return response_409
82
+ if response.status_code == 429:
83
+ response_429 = PostV1DesktopResponse429.from_dict(response.json())
84
+
85
+ return response_429
86
+ if response.status_code == 500:
87
+ response_500 = PostV1DesktopResponse500.from_dict(response.json())
88
+
89
+ return response_500
90
+ if response.status_code == 502:
91
+ response_502 = PostV1DesktopResponse502.from_dict(response.json())
92
+
93
+ return response_502
94
+ if client.raise_on_unexpected_status:
95
+ raise errors.UnexpectedStatus(response.status_code, response.content)
96
+ else:
97
+ return None
98
+
99
+
100
+ def _build_response(
101
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
102
+ ) -> Response[
103
+ Union[
104
+ PostV1DesktopResponse200,
105
+ PostV1DesktopResponse400,
106
+ PostV1DesktopResponse401,
107
+ PostV1DesktopResponse403,
108
+ PostV1DesktopResponse404,
109
+ PostV1DesktopResponse409,
110
+ PostV1DesktopResponse429,
111
+ PostV1DesktopResponse500,
112
+ PostV1DesktopResponse502,
113
+ ]
114
+ ]:
115
+ return Response(
116
+ status_code=HTTPStatus(response.status_code),
117
+ content=response.content,
118
+ headers=response.headers,
119
+ parsed=_parse_response(client=client, response=response),
120
+ )
121
+
122
+
123
+ def sync_detailed(
124
+ *,
125
+ client: Union[AuthenticatedClient, Client],
126
+ body: PostV1DesktopBody,
127
+ x_api_key: str,
128
+ ) -> Response[
129
+ Union[
130
+ PostV1DesktopResponse200,
131
+ PostV1DesktopResponse400,
132
+ PostV1DesktopResponse401,
133
+ PostV1DesktopResponse403,
134
+ PostV1DesktopResponse404,
135
+ PostV1DesktopResponse409,
136
+ PostV1DesktopResponse429,
137
+ PostV1DesktopResponse500,
138
+ PostV1DesktopResponse502,
139
+ ]
140
+ ]:
141
+ """Create a new virtual desktop instance
142
+
143
+ Creates a new virtual desktop instance and returns its ID and stream URL
144
+
145
+ Args:
146
+ x_api_key (str): API key for authentication Example: api_12345.
147
+ body (PostV1DesktopBody):
148
+
149
+ Raises:
150
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
151
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
152
+
153
+ Returns:
154
+ Response[Union[PostV1DesktopResponse200, PostV1DesktopResponse400, PostV1DesktopResponse401, PostV1DesktopResponse403, PostV1DesktopResponse404, PostV1DesktopResponse409, PostV1DesktopResponse429, PostV1DesktopResponse500, PostV1DesktopResponse502]]
155
+ """
156
+
157
+ kwargs = _get_kwargs(
158
+ body=body,
159
+ x_api_key=x_api_key,
160
+ )
161
+
162
+ response = client.get_httpx_client().request(
163
+ **kwargs,
164
+ )
165
+
166
+ return _build_response(client=client, response=response)
167
+
168
+
169
+ def sync(
170
+ *,
171
+ client: Union[AuthenticatedClient, Client],
172
+ body: PostV1DesktopBody,
173
+ x_api_key: str,
174
+ ) -> Optional[
175
+ Union[
176
+ PostV1DesktopResponse200,
177
+ PostV1DesktopResponse400,
178
+ PostV1DesktopResponse401,
179
+ PostV1DesktopResponse403,
180
+ PostV1DesktopResponse404,
181
+ PostV1DesktopResponse409,
182
+ PostV1DesktopResponse429,
183
+ PostV1DesktopResponse500,
184
+ PostV1DesktopResponse502,
185
+ ]
186
+ ]:
187
+ """Create a new virtual desktop instance
188
+
189
+ Creates a new virtual desktop instance and returns its ID and stream URL
190
+
191
+ Args:
192
+ x_api_key (str): API key for authentication Example: api_12345.
193
+ body (PostV1DesktopBody):
194
+
195
+ Raises:
196
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
197
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
198
+
199
+ Returns:
200
+ Union[PostV1DesktopResponse200, PostV1DesktopResponse400, PostV1DesktopResponse401, PostV1DesktopResponse403, PostV1DesktopResponse404, PostV1DesktopResponse409, PostV1DesktopResponse429, PostV1DesktopResponse500, PostV1DesktopResponse502]
201
+ """
202
+
203
+ return sync_detailed(
204
+ client=client,
205
+ body=body,
206
+ x_api_key=x_api_key,
207
+ ).parsed
208
+
209
+
210
+ async def asyncio_detailed(
211
+ *,
212
+ client: Union[AuthenticatedClient, Client],
213
+ body: PostV1DesktopBody,
214
+ x_api_key: str,
215
+ ) -> Response[
216
+ Union[
217
+ PostV1DesktopResponse200,
218
+ PostV1DesktopResponse400,
219
+ PostV1DesktopResponse401,
220
+ PostV1DesktopResponse403,
221
+ PostV1DesktopResponse404,
222
+ PostV1DesktopResponse409,
223
+ PostV1DesktopResponse429,
224
+ PostV1DesktopResponse500,
225
+ PostV1DesktopResponse502,
226
+ ]
227
+ ]:
228
+ """Create a new virtual desktop instance
229
+
230
+ Creates a new virtual desktop instance and returns its ID and stream URL
231
+
232
+ Args:
233
+ x_api_key (str): API key for authentication Example: api_12345.
234
+ body (PostV1DesktopBody):
235
+
236
+ Raises:
237
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
238
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
239
+
240
+ Returns:
241
+ Response[Union[PostV1DesktopResponse200, PostV1DesktopResponse400, PostV1DesktopResponse401, PostV1DesktopResponse403, PostV1DesktopResponse404, PostV1DesktopResponse409, PostV1DesktopResponse429, PostV1DesktopResponse500, PostV1DesktopResponse502]]
242
+ """
243
+
244
+ kwargs = _get_kwargs(
245
+ body=body,
246
+ x_api_key=x_api_key,
247
+ )
248
+
249
+ response = await client.get_async_httpx_client().request(**kwargs)
250
+
251
+ return _build_response(client=client, response=response)
252
+
253
+
254
+ async def asyncio(
255
+ *,
256
+ client: Union[AuthenticatedClient, Client],
257
+ body: PostV1DesktopBody,
258
+ x_api_key: str,
259
+ ) -> Optional[
260
+ Union[
261
+ PostV1DesktopResponse200,
262
+ PostV1DesktopResponse400,
263
+ PostV1DesktopResponse401,
264
+ PostV1DesktopResponse403,
265
+ PostV1DesktopResponse404,
266
+ PostV1DesktopResponse409,
267
+ PostV1DesktopResponse429,
268
+ PostV1DesktopResponse500,
269
+ PostV1DesktopResponse502,
270
+ ]
271
+ ]:
272
+ """Create a new virtual desktop instance
273
+
274
+ Creates a new virtual desktop instance and returns its ID and stream URL
275
+
276
+ Args:
277
+ x_api_key (str): API key for authentication Example: api_12345.
278
+ body (PostV1DesktopBody):
279
+
280
+ Raises:
281
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
282
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
283
+
284
+ Returns:
285
+ Union[PostV1DesktopResponse200, PostV1DesktopResponse400, PostV1DesktopResponse401, PostV1DesktopResponse403, PostV1DesktopResponse404, PostV1DesktopResponse409, PostV1DesktopResponse429, PostV1DesktopResponse500, PostV1DesktopResponse502]
286
+ """
287
+
288
+ return (
289
+ await asyncio_detailed(
290
+ client=client,
291
+ body=body,
292
+ x_api_key=x_api_key,
293
+ )
294
+ ).parsed
@@ -0,0 +1,307 @@
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_bash_action_body import PostV1DesktopIdBashActionBody
9
+ from ...models.post_v1_desktop_id_bash_action_response_200 import PostV1DesktopIdBashActionResponse200
10
+ from ...models.post_v1_desktop_id_bash_action_response_400 import PostV1DesktopIdBashActionResponse400
11
+ from ...models.post_v1_desktop_id_bash_action_response_401 import PostV1DesktopIdBashActionResponse401
12
+ from ...models.post_v1_desktop_id_bash_action_response_403 import PostV1DesktopIdBashActionResponse403
13
+ from ...models.post_v1_desktop_id_bash_action_response_404 import PostV1DesktopIdBashActionResponse404
14
+ from ...models.post_v1_desktop_id_bash_action_response_409 import PostV1DesktopIdBashActionResponse409
15
+ from ...models.post_v1_desktop_id_bash_action_response_429 import PostV1DesktopIdBashActionResponse429
16
+ from ...models.post_v1_desktop_id_bash_action_response_500 import PostV1DesktopIdBashActionResponse500
17
+ from ...models.post_v1_desktop_id_bash_action_response_502 import PostV1DesktopIdBashActionResponse502
18
+ from ...types import Response
19
+
20
+
21
+ def _get_kwargs(
22
+ id: str,
23
+ *,
24
+ body: PostV1DesktopIdBashActionBody,
25
+ x_api_key: str,
26
+ ) -> dict[str, Any]:
27
+ headers: dict[str, Any] = {}
28
+ headers["x-api-key"] = x_api_key
29
+
30
+ _kwargs: dict[str, Any] = {
31
+ "method": "post",
32
+ "url": f"/v1/desktop/{id}/bash-action",
33
+ }
34
+
35
+ _body = body.to_dict()
36
+
37
+ _kwargs["json"] = _body
38
+ headers["Content-Type"] = "application/json"
39
+
40
+ _kwargs["headers"] = headers
41
+ return _kwargs
42
+
43
+
44
+ def _parse_response(
45
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
46
+ ) -> Optional[
47
+ Union[
48
+ PostV1DesktopIdBashActionResponse200,
49
+ PostV1DesktopIdBashActionResponse400,
50
+ PostV1DesktopIdBashActionResponse401,
51
+ PostV1DesktopIdBashActionResponse403,
52
+ PostV1DesktopIdBashActionResponse404,
53
+ PostV1DesktopIdBashActionResponse409,
54
+ PostV1DesktopIdBashActionResponse429,
55
+ PostV1DesktopIdBashActionResponse500,
56
+ PostV1DesktopIdBashActionResponse502,
57
+ ]
58
+ ]:
59
+ if response.status_code == 200:
60
+ response_200 = PostV1DesktopIdBashActionResponse200.from_dict(response.json())
61
+
62
+ return response_200
63
+ if response.status_code == 400:
64
+ response_400 = PostV1DesktopIdBashActionResponse400.from_dict(response.json())
65
+
66
+ return response_400
67
+ if response.status_code == 401:
68
+ response_401 = PostV1DesktopIdBashActionResponse401.from_dict(response.json())
69
+
70
+ return response_401
71
+ if response.status_code == 403:
72
+ response_403 = PostV1DesktopIdBashActionResponse403.from_dict(response.json())
73
+
74
+ return response_403
75
+ if response.status_code == 404:
76
+ response_404 = PostV1DesktopIdBashActionResponse404.from_dict(response.json())
77
+
78
+ return response_404
79
+ if response.status_code == 409:
80
+ response_409 = PostV1DesktopIdBashActionResponse409.from_dict(response.json())
81
+
82
+ return response_409
83
+ if response.status_code == 429:
84
+ response_429 = PostV1DesktopIdBashActionResponse429.from_dict(response.json())
85
+
86
+ return response_429
87
+ if response.status_code == 500:
88
+ response_500 = PostV1DesktopIdBashActionResponse500.from_dict(response.json())
89
+
90
+ return response_500
91
+ if response.status_code == 502:
92
+ response_502 = PostV1DesktopIdBashActionResponse502.from_dict(response.json())
93
+
94
+ return response_502
95
+ if client.raise_on_unexpected_status:
96
+ raise errors.UnexpectedStatus(response.status_code, response.content)
97
+ else:
98
+ return None
99
+
100
+
101
+ def _build_response(
102
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
103
+ ) -> Response[
104
+ Union[
105
+ PostV1DesktopIdBashActionResponse200,
106
+ PostV1DesktopIdBashActionResponse400,
107
+ PostV1DesktopIdBashActionResponse401,
108
+ PostV1DesktopIdBashActionResponse403,
109
+ PostV1DesktopIdBashActionResponse404,
110
+ PostV1DesktopIdBashActionResponse409,
111
+ PostV1DesktopIdBashActionResponse429,
112
+ PostV1DesktopIdBashActionResponse500,
113
+ PostV1DesktopIdBashActionResponse502,
114
+ ]
115
+ ]:
116
+ return Response(
117
+ status_code=HTTPStatus(response.status_code),
118
+ content=response.content,
119
+ headers=response.headers,
120
+ parsed=_parse_response(client=client, response=response),
121
+ )
122
+
123
+
124
+ def sync_detailed(
125
+ id: str,
126
+ *,
127
+ client: Union[AuthenticatedClient, Client],
128
+ body: PostV1DesktopIdBashActionBody,
129
+ x_api_key: str,
130
+ ) -> Response[
131
+ Union[
132
+ PostV1DesktopIdBashActionResponse200,
133
+ PostV1DesktopIdBashActionResponse400,
134
+ PostV1DesktopIdBashActionResponse401,
135
+ PostV1DesktopIdBashActionResponse403,
136
+ PostV1DesktopIdBashActionResponse404,
137
+ PostV1DesktopIdBashActionResponse409,
138
+ PostV1DesktopIdBashActionResponse429,
139
+ PostV1DesktopIdBashActionResponse500,
140
+ PostV1DesktopIdBashActionResponse502,
141
+ ]
142
+ ]:
143
+ """Execute a bash command on the desktop
144
+
145
+ Runs a bash command on the desktop and returns the command output
146
+
147
+ Args:
148
+ id (str): Desktop instance ID to run the command on Example: desktop_12345.
149
+ x_api_key (str): API key for authentication Example: api_12345.
150
+ body (PostV1DesktopIdBashActionBody):
151
+
152
+ Raises:
153
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
154
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
155
+
156
+ Returns:
157
+ Response[Union[PostV1DesktopIdBashActionResponse200, PostV1DesktopIdBashActionResponse400, PostV1DesktopIdBashActionResponse401, PostV1DesktopIdBashActionResponse403, PostV1DesktopIdBashActionResponse404, PostV1DesktopIdBashActionResponse409, PostV1DesktopIdBashActionResponse429, PostV1DesktopIdBashActionResponse500, PostV1DesktopIdBashActionResponse502]]
158
+ """
159
+
160
+ kwargs = _get_kwargs(
161
+ id=id,
162
+ body=body,
163
+ x_api_key=x_api_key,
164
+ )
165
+
166
+ response = client.get_httpx_client().request(
167
+ **kwargs,
168
+ )
169
+
170
+ return _build_response(client=client, response=response)
171
+
172
+
173
+ def sync(
174
+ id: str,
175
+ *,
176
+ client: Union[AuthenticatedClient, Client],
177
+ body: PostV1DesktopIdBashActionBody,
178
+ x_api_key: str,
179
+ ) -> Optional[
180
+ Union[
181
+ PostV1DesktopIdBashActionResponse200,
182
+ PostV1DesktopIdBashActionResponse400,
183
+ PostV1DesktopIdBashActionResponse401,
184
+ PostV1DesktopIdBashActionResponse403,
185
+ PostV1DesktopIdBashActionResponse404,
186
+ PostV1DesktopIdBashActionResponse409,
187
+ PostV1DesktopIdBashActionResponse429,
188
+ PostV1DesktopIdBashActionResponse500,
189
+ PostV1DesktopIdBashActionResponse502,
190
+ ]
191
+ ]:
192
+ """Execute a bash command on the desktop
193
+
194
+ Runs a bash command on the desktop and returns the command output
195
+
196
+ Args:
197
+ id (str): Desktop instance ID to run the command on Example: desktop_12345.
198
+ x_api_key (str): API key for authentication Example: api_12345.
199
+ body (PostV1DesktopIdBashActionBody):
200
+
201
+ Raises:
202
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
203
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
204
+
205
+ Returns:
206
+ Union[PostV1DesktopIdBashActionResponse200, PostV1DesktopIdBashActionResponse400, PostV1DesktopIdBashActionResponse401, PostV1DesktopIdBashActionResponse403, PostV1DesktopIdBashActionResponse404, PostV1DesktopIdBashActionResponse409, PostV1DesktopIdBashActionResponse429, PostV1DesktopIdBashActionResponse500, PostV1DesktopIdBashActionResponse502]
207
+ """
208
+
209
+ return sync_detailed(
210
+ id=id,
211
+ client=client,
212
+ body=body,
213
+ x_api_key=x_api_key,
214
+ ).parsed
215
+
216
+
217
+ async def asyncio_detailed(
218
+ id: str,
219
+ *,
220
+ client: Union[AuthenticatedClient, Client],
221
+ body: PostV1DesktopIdBashActionBody,
222
+ x_api_key: str,
223
+ ) -> Response[
224
+ Union[
225
+ PostV1DesktopIdBashActionResponse200,
226
+ PostV1DesktopIdBashActionResponse400,
227
+ PostV1DesktopIdBashActionResponse401,
228
+ PostV1DesktopIdBashActionResponse403,
229
+ PostV1DesktopIdBashActionResponse404,
230
+ PostV1DesktopIdBashActionResponse409,
231
+ PostV1DesktopIdBashActionResponse429,
232
+ PostV1DesktopIdBashActionResponse500,
233
+ PostV1DesktopIdBashActionResponse502,
234
+ ]
235
+ ]:
236
+ """Execute a bash command on the desktop
237
+
238
+ Runs a bash command on the desktop and returns the command output
239
+
240
+ Args:
241
+ id (str): Desktop instance ID to run the command on Example: desktop_12345.
242
+ x_api_key (str): API key for authentication Example: api_12345.
243
+ body (PostV1DesktopIdBashActionBody):
244
+
245
+ Raises:
246
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
247
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
248
+
249
+ Returns:
250
+ Response[Union[PostV1DesktopIdBashActionResponse200, PostV1DesktopIdBashActionResponse400, PostV1DesktopIdBashActionResponse401, PostV1DesktopIdBashActionResponse403, PostV1DesktopIdBashActionResponse404, PostV1DesktopIdBashActionResponse409, PostV1DesktopIdBashActionResponse429, PostV1DesktopIdBashActionResponse500, PostV1DesktopIdBashActionResponse502]]
251
+ """
252
+
253
+ kwargs = _get_kwargs(
254
+ id=id,
255
+ body=body,
256
+ x_api_key=x_api_key,
257
+ )
258
+
259
+ response = await client.get_async_httpx_client().request(**kwargs)
260
+
261
+ return _build_response(client=client, response=response)
262
+
263
+
264
+ async def asyncio(
265
+ id: str,
266
+ *,
267
+ client: Union[AuthenticatedClient, Client],
268
+ body: PostV1DesktopIdBashActionBody,
269
+ x_api_key: str,
270
+ ) -> Optional[
271
+ Union[
272
+ PostV1DesktopIdBashActionResponse200,
273
+ PostV1DesktopIdBashActionResponse400,
274
+ PostV1DesktopIdBashActionResponse401,
275
+ PostV1DesktopIdBashActionResponse403,
276
+ PostV1DesktopIdBashActionResponse404,
277
+ PostV1DesktopIdBashActionResponse409,
278
+ PostV1DesktopIdBashActionResponse429,
279
+ PostV1DesktopIdBashActionResponse500,
280
+ PostV1DesktopIdBashActionResponse502,
281
+ ]
282
+ ]:
283
+ """Execute a bash command on the desktop
284
+
285
+ Runs a bash command on the desktop and returns the command output
286
+
287
+ Args:
288
+ id (str): Desktop instance ID to run the command on Example: desktop_12345.
289
+ x_api_key (str): API key for authentication Example: api_12345.
290
+ body (PostV1DesktopIdBashActionBody):
291
+
292
+ Raises:
293
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
294
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
295
+
296
+ Returns:
297
+ Union[PostV1DesktopIdBashActionResponse200, PostV1DesktopIdBashActionResponse400, PostV1DesktopIdBashActionResponse401, PostV1DesktopIdBashActionResponse403, PostV1DesktopIdBashActionResponse404, PostV1DesktopIdBashActionResponse409, PostV1DesktopIdBashActionResponse429, PostV1DesktopIdBashActionResponse500, PostV1DesktopIdBashActionResponse502]
298
+ """
299
+
300
+ return (
301
+ await asyncio_detailed(
302
+ id=id,
303
+ client=client,
304
+ body=body,
305
+ x_api_key=x_api_key,
306
+ )
307
+ ).parsed