cyberdesk 0.2.5__py3-none-any.whl → 0.2.7__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/__init__.py CHANGED
@@ -3,6 +3,5 @@ from .types import (
3
3
  GetDesktopParams,
4
4
  LaunchDesktopParams,
5
5
  TerminateDesktopParams,
6
- ExecuteComputerActionParams,
7
6
  ExecuteBashActionParams,
8
7
  )
cyberdesk/actions.py CHANGED
@@ -1,38 +1,118 @@
1
- from .types import (
1
+ from typing import Union, List, Optional
2
+
3
+ from openapi_client.api_reference_client.types import UNSET
4
+ from openapi_client.api_reference_client.models import (
2
5
  PostV1DesktopIdComputerActionClickMouseAction,
6
+ PostV1DesktopIdComputerActionClickMouseActionType,
7
+ PostV1DesktopIdComputerActionClickMouseActionButton as ClickMouseButton,
8
+ PostV1DesktopIdComputerActionClickMouseActionClickType as ClickMouseActionType,
3
9
  PostV1DesktopIdComputerActionDragMouseAction,
10
+ PostV1DesktopIdComputerActionDragMouseActionType,
11
+ PostV1DesktopIdComputerActionDragMouseActionStart,
12
+ PostV1DesktopIdComputerActionDragMouseActionEnd,
4
13
  PostV1DesktopIdComputerActionGetCursorPositionAction,
14
+ PostV1DesktopIdComputerActionGetCursorPositionActionType,
5
15
  PostV1DesktopIdComputerActionMoveMouseAction,
16
+ PostV1DesktopIdComputerActionMoveMouseActionType,
6
17
  PostV1DesktopIdComputerActionPressKeysAction,
18
+ PostV1DesktopIdComputerActionPressKeysActionType,
19
+ PostV1DesktopIdComputerActionPressKeysActionKeyActionType as PressKeyActionType,
7
20
  PostV1DesktopIdComputerActionScreenshotAction,
21
+ PostV1DesktopIdComputerActionScreenshotActionType,
8
22
  PostV1DesktopIdComputerActionScrollAction,
23
+ PostV1DesktopIdComputerActionScrollActionType,
24
+ PostV1DesktopIdComputerActionScrollActionDirection as ScrollDirection,
9
25
  PostV1DesktopIdComputerActionTypeTextAction,
26
+ PostV1DesktopIdComputerActionTypeTextActionType,
10
27
  PostV1DesktopIdComputerActionWaitAction,
28
+ PostV1DesktopIdComputerActionWaitActionType,
11
29
  )
12
30
 
13
- def click_mouse(x: int, y: int, button: str = "left") -> PostV1DesktopIdComputerActionClickMouseAction:
14
- return PostV1DesktopIdComputerActionClickMouseAction(type="click_mouse", x=x, y=y, button=button)
31
+ # Re-export the original Enum types under their aliased names for user convenience if they need to import them
32
+ # This makes `from cyberdesk.actions import ClickMouseButton` possible.
33
+
34
+ def click_mouse(
35
+ x: Optional[int] = None,
36
+ y: Optional[int] = None,
37
+ button: Optional[ClickMouseButton] = None,
38
+ num_of_clicks: Optional[int] = None,
39
+ click_type: Optional[ClickMouseActionType] = None,
40
+ ) -> PostV1DesktopIdComputerActionClickMouseAction:
41
+ return PostV1DesktopIdComputerActionClickMouseAction(
42
+ type_=PostV1DesktopIdComputerActionClickMouseActionType.CLICK_MOUSE,
43
+ x=x if x is not None else UNSET,
44
+ y=y if y is not None else UNSET,
45
+ button=button if button is not None else UNSET,
46
+ num_of_clicks=num_of_clicks if num_of_clicks is not None else UNSET,
47
+ click_type=click_type if click_type is not None else UNSET
48
+ )
15
49
 
16
- def drag_mouse(start_x: int, start_y: int, end_x: int, end_y: int, button: str = "left") -> PostV1DesktopIdComputerActionDragMouseAction:
17
- return PostV1DesktopIdComputerActionDragMouseAction(type="drag_mouse", start_x=start_x, start_y=start_y, end_x=end_x, end_y=end_y, button=button)
50
+ def drag_mouse(
51
+ start_x: int,
52
+ start_y: int,
53
+ end_x: int,
54
+ end_y: int
55
+ ) -> PostV1DesktopIdComputerActionDragMouseAction:
56
+ start_model = PostV1DesktopIdComputerActionDragMouseActionStart(x=start_x, y=start_y)
57
+ end_model = PostV1DesktopIdComputerActionDragMouseActionEnd(x=end_x, y=end_y)
58
+ return PostV1DesktopIdComputerActionDragMouseAction(
59
+ type_=PostV1DesktopIdComputerActionDragMouseActionType.DRAG_MOUSE,
60
+ start=start_model,
61
+ end=end_model
62
+ )
18
63
 
19
64
  def get_cursor_position() -> PostV1DesktopIdComputerActionGetCursorPositionAction:
20
- return PostV1DesktopIdComputerActionGetCursorPositionAction(type="get_cursor_position")
65
+ return PostV1DesktopIdComputerActionGetCursorPositionAction(
66
+ type_=PostV1DesktopIdComputerActionGetCursorPositionActionType.GET_CURSOR_POSITION
67
+ )
21
68
 
22
- def move_mouse(x: int, y: int) -> PostV1DesktopIdComputerActionMoveMouseAction:
23
- return PostV1DesktopIdComputerActionMoveMouseAction(type="move_mouse", x=x, y=y)
69
+ def move_mouse(
70
+ x: int,
71
+ y: int
72
+ ) -> PostV1DesktopIdComputerActionMoveMouseAction:
73
+ return PostV1DesktopIdComputerActionMoveMouseAction(
74
+ type_=PostV1DesktopIdComputerActionMoveMouseActionType.MOVE_MOUSE,
75
+ x=x,
76
+ y=y
77
+ )
24
78
 
25
- def press_keys(keys: list[str]) -> PostV1DesktopIdComputerActionPressKeysAction:
26
- return PostV1DesktopIdComputerActionPressKeysAction(type="press_keys", keys=keys)
79
+ def press_keys(
80
+ keys: Optional[Union[str, List[str]]] = None,
81
+ key_action_type: Optional[PressKeyActionType] = None
82
+ ) -> PostV1DesktopIdComputerActionPressKeysAction:
83
+ return PostV1DesktopIdComputerActionPressKeysAction(
84
+ type_=PostV1DesktopIdComputerActionPressKeysActionType.PRESS_KEYS,
85
+ keys=keys if keys is not None else UNSET,
86
+ key_action_type=key_action_type if key_action_type is not None else UNSET
87
+ )
27
88
 
28
89
  def screenshot() -> PostV1DesktopIdComputerActionScreenshotAction:
29
- return PostV1DesktopIdComputerActionScreenshotAction(type="screenshot")
90
+ return PostV1DesktopIdComputerActionScreenshotAction(
91
+ type_=PostV1DesktopIdComputerActionScreenshotActionType.SCREENSHOT
92
+ )
30
93
 
31
- def scroll(dx: int, dy: int) -> PostV1DesktopIdComputerActionScrollAction:
32
- return PostV1DesktopIdComputerActionScrollAction(type="scroll", dx=dx, dy=dy)
94
+ def scroll(
95
+ direction: ScrollDirection,
96
+ amount: int
97
+ ) -> PostV1DesktopIdComputerActionScrollAction:
98
+ return PostV1DesktopIdComputerActionScrollAction(
99
+ type_=PostV1DesktopIdComputerActionScrollActionType.SCROLL,
100
+ direction=direction,
101
+ amount=amount
102
+ )
33
103
 
34
- def type_text(text: str) -> PostV1DesktopIdComputerActionTypeTextAction:
35
- return PostV1DesktopIdComputerActionTypeTextAction(type="type", text=text)
104
+ def type_text(
105
+ text: str
106
+ ) -> PostV1DesktopIdComputerActionTypeTextAction:
107
+ return PostV1DesktopIdComputerActionTypeTextAction(
108
+ type_=PostV1DesktopIdComputerActionTypeTextActionType.TYPE,
109
+ text=text
110
+ )
36
111
 
37
- def wait(ms: int) -> PostV1DesktopIdComputerActionWaitAction:
38
- return PostV1DesktopIdComputerActionWaitAction(type="wait", ms=ms)
112
+ def wait(
113
+ ms: int
114
+ ) -> PostV1DesktopIdComputerActionWaitAction:
115
+ return PostV1DesktopIdComputerActionWaitAction(
116
+ type_=PostV1DesktopIdComputerActionWaitActionType.WAIT,
117
+ ms=ms
118
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cyberdesk
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: The official Python SDK for Cyberdesk
5
5
  Author-email: Cyberdesk Team <dev@cyberdesk.io>
6
6
  License-Expression: MIT
@@ -71,9 +71,9 @@ print('Desktop info:', info)
71
71
  ### Perform a Computer Action (e.g., Mouse Click)
72
72
 
73
73
  ```python
74
- from cyberdesk.actions import click_mouse
74
+ from cyberdesk.actions import click_mouse, ClickMouseButton
75
75
 
76
- action = click_mouse(x=100, y=150, button="left")
76
+ action = click_mouse(x=100, y=150, button=ClickMouseButton.LEFT)
77
77
  action_result = client.execute_computer_action("your-desktop-id", action)
78
78
 
79
79
  if hasattr(action_result, 'error') and action_result.error:
@@ -106,9 +106,9 @@ To create computer actions (mouse, keyboard, etc.), use the factory functions in
106
106
 
107
107
  **Example:**
108
108
  ```python
109
- from cyberdesk.actions import click_mouse, type_text
109
+ from cyberdesk.actions import click_mouse, type_text, ClickMouseButton
110
110
 
111
- action1 = click_mouse(x=100, y=200, button="left")
111
+ action1 = click_mouse(x=100, y=200, button=ClickMouseButton.LEFT)
112
112
  action2 = type_text(text="Hello, world!")
113
113
 
114
114
  client.execute_computer_action("your-desktop-id", action1)
@@ -136,14 +136,14 @@ All methods are also available as async variants (prefixed with `async_`). Examp
136
136
  ```python
137
137
  import asyncio
138
138
  from cyberdesk import CyberdeskClient
139
- from cyberdesk.actions import click_mouse
139
+ from cyberdesk.actions import click_mouse, ClickMouseButton
140
140
 
141
141
  async def main():
142
142
  client = CyberdeskClient(api_key="YOUR_API_KEY")
143
143
  result = await client.async_launch_desktop(timeout_ms=10000)
144
144
  print(result)
145
145
  # Example async computer action
146
- action = click_mouse(x=100, y=200)
146
+ action = click_mouse(x=100, y=200, button=ClickMouseButton.LEFT)
147
147
  await client.async_execute_computer_action("your-desktop-id", action)
148
148
  # ... use other async_ methods as needed
149
149
 
@@ -157,9 +157,11 @@ asyncio.run(main())
157
157
  All request/response types are available from the generated models, and all computer actions are available as factory functions in `cyberdesk.actions` for ergonomic, type-safe usage.
158
158
 
159
159
  ```python
160
- from cyberdesk.actions import click_mouse, drag_mouse, type_text, wait, scroll, move_mouse, press_keys, screenshot, get_cursor_position
160
+ from cyberdesk.actions import click_mouse, drag_mouse, type_text, wait, scroll, move_mouse, press_keys, screenshot, get_cursor_position, ClickMouseButton, ClickMouseActionType, PressKeyActionType, ScrollDirection
161
161
  ```
162
162
 
163
+ # Note: All action enums (e.g., ClickMouseButton, ClickMouseActionType, PressKeyActionType, ScrollDirection, etc.) are available from cyberdesk.actions for type-safe usage.
164
+
163
165
  ---
164
166
 
165
167
  ## For Cyberdesk Team: Publishing to PyPI
@@ -1,8 +1,8 @@
1
- cyberdesk/__init__.py,sha256=y9_g5NSt6hLmLsYLZuueIrRdQ_iT4EcAbbYwxPrjaHg,196
2
- cyberdesk/actions.py,sha256=O8AV9hsPMvhSn2qZHaSuGfjMaAJeLoHdnd10LT_4_Ws,2069
1
+ cyberdesk/__init__.py,sha256=36X_HPAXaE9dfr3OmHbTrRgpm3b90W5TiOf0eAg-cmw,163
2
+ cyberdesk/actions.py,sha256=5simzCOs5xDNMm9DmuXQzpxBJlt8-H5ipU3COL8UBpo,4773
3
3
  cyberdesk/client.py,sha256=kxtkdh7AjNuXU8u2rAGhHQTuUKRLyXvX_h7jtdgLzrk,3807
4
4
  cyberdesk/types.py,sha256=5jJSShzk3G8DqT0uRc8NFMlSru46tP9q3KJXcZhNRhc,1975
5
- cyberdesk-0.2.5.dist-info/licenses/LICENSE,sha256=06Op63FCwGhuUOz__M8IZW5sxd29WxyGC4X5-Uih7IQ,1071
5
+ cyberdesk-0.2.7.dist-info/licenses/LICENSE,sha256=06Op63FCwGhuUOz__M8IZW5sxd29WxyGC4X5-Uih7IQ,1071
6
6
  openapi_client/api_reference_client/__init__.py,sha256=AKzi7ml3W37ADpacR564Q0j8Vsls9eFRsccqBgVWUNk,164
7
7
  openapi_client/api_reference_client/client.py,sha256=fXqcOZ8-Gse8ibdNn29cB93rozF_LAmSuofr5fMH0bw,12687
8
8
  openapi_client/api_reference_client/errors.py,sha256=DqMs2X8xF-YlxOWUYdkm_1wiQyDOKtWzYSiETtsXGjg,562
@@ -130,7 +130,7 @@ openapi_client/api_reference_client/models/post_v1_desktop_response_500.py,sha25
130
130
  openapi_client/api_reference_client/models/post_v1_desktop_response_500_status.py,sha256=xZ16zTTNQmzXJ_kGwZ0Dpzgfb3pYAfXgvSybiTohs1M,163
131
131
  openapi_client/api_reference_client/models/post_v1_desktop_response_502.py,sha256=AtVm799Itz2A2-cQOwHu-1japGSXVvMDUTETLDvTrAI,2036
132
132
  openapi_client/api_reference_client/models/post_v1_desktop_response_502_status.py,sha256=y45sxeHU0bzaR2hkDQLLUN-NGr3OtJ_ofqdywlL6kZA,163
133
- cyberdesk-0.2.5.dist-info/METADATA,sha256=b2E7J_sR2QBuqJy7njIIHms9q8IXk3IPbBAuTIgbgwE,6426
134
- cyberdesk-0.2.5.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
135
- cyberdesk-0.2.5.dist-info/top_level.txt,sha256=qTYHZHVHh3VClNPQsiFFA8p8tmJgFGhq9G1COd-pX_A,25
136
- cyberdesk-0.2.5.dist-info/RECORD,,
133
+ cyberdesk-0.2.7.dist-info/METADATA,sha256=b_G-VoXyh3vzMoezQsmk19OnQ7qbAtMDrsPnTOSwSh8,6793
134
+ cyberdesk-0.2.7.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
135
+ cyberdesk-0.2.7.dist-info/top_level.txt,sha256=qTYHZHVHh3VClNPQsiFFA8p8tmJgFGhq9G1COd-pX_A,25
136
+ cyberdesk-0.2.7.dist-info/RECORD,,