cyberdesk 0.2.6__py3-none-any.whl → 1.0.0__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 +45 -7
- cyberdesk/client.py +779 -70
- cyberdesk-1.0.0.dist-info/METADATA +274 -0
- cyberdesk-1.0.0.dist-info/RECORD +114 -0
- {cyberdesk-0.2.6.dist-info → cyberdesk-1.0.0.dist-info}/WHEEL +1 -1
- openapi_client/{api_reference_client → cyberdesk_cloud_client}/__init__.py +8 -8
- openapi_client/{api_reference_client → cyberdesk_cloud_client}/api/__init__.py +1 -1
- openapi_client/{api_reference_client/api/desktop → cyberdesk_cloud_client/api/computer}/__init__.py +1 -1
- openapi_client/cyberdesk_cloud_client/api/computer/get_display_dimensions_v1_computer_machine_id_display_dimensions_get.py +163 -0
- openapi_client/cyberdesk_cloud_client/api/computer/get_mouse_position_v1_computer_machine_id_input_mouse_position_get.py +163 -0
- openapi_client/cyberdesk_cloud_client/api/computer/get_screenshot_v1_computer_machine_id_display_screenshot_get.py +158 -0
- openapi_client/cyberdesk_cloud_client/api/computer/keyboard_key_v1_computer_machine_id_input_keyboard_key_post.py +183 -0
- openapi_client/cyberdesk_cloud_client/api/computer/keyboard_type_v1_computer_machine_id_input_keyboard_type_post.py +183 -0
- openapi_client/cyberdesk_cloud_client/api/computer/mouse_click_v1_computer_machine_id_input_mouse_click_post.py +187 -0
- openapi_client/cyberdesk_cloud_client/api/computer/mouse_move_v1_computer_machine_id_input_mouse_move_post.py +183 -0
- openapi_client/cyberdesk_cloud_client/api/connections/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/connections/create_connection_v1_connections_post.py +180 -0
- openapi_client/cyberdesk_cloud_client/api/connections/delete_connection_v1_connections_connection_id_delete.py +170 -0
- openapi_client/cyberdesk_cloud_client/api/connections/get_connection_v1_connections_connection_id_get.py +172 -0
- openapi_client/cyberdesk_cloud_client/api/connections/list_connections_v1_connections_get.py +244 -0
- openapi_client/cyberdesk_cloud_client/api/connections/update_connection_v1_connections_connection_id_patch.py +198 -0
- openapi_client/cyberdesk_cloud_client/api/default/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/default/root_get.py +83 -0
- openapi_client/cyberdesk_cloud_client/api/health/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/health/database_health_check_v1_health_db_get.py +146 -0
- openapi_client/cyberdesk_cloud_client/api/health/health_check_v1_health_get.py +144 -0
- openapi_client/cyberdesk_cloud_client/api/machines/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/machines/create_machine_v1_machines_post.py +180 -0
- openapi_client/cyberdesk_cloud_client/api/machines/delete_machine_v1_machines_machine_id_delete.py +174 -0
- openapi_client/cyberdesk_cloud_client/api/machines/get_machine_v1_machines_machine_id_get.py +172 -0
- openapi_client/cyberdesk_cloud_client/api/machines/list_machines_v1_machines_get.py +217 -0
- openapi_client/cyberdesk_cloud_client/api/machines/update_machine_v1_machines_machine_id_patch.py +198 -0
- openapi_client/cyberdesk_cloud_client/api/request_logs/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/request_logs/create_request_log_v1_request_logs_post.py +184 -0
- openapi_client/cyberdesk_cloud_client/api/request_logs/delete_request_log_v1_request_logs_log_id_delete.py +170 -0
- openapi_client/cyberdesk_cloud_client/api/request_logs/get_request_log_v1_request_logs_log_id_get.py +172 -0
- openapi_client/cyberdesk_cloud_client/api/request_logs/list_request_logs_v1_request_logs_get.py +257 -0
- openapi_client/cyberdesk_cloud_client/api/request_logs/update_request_log_v1_request_logs_log_id_patch.py +202 -0
- openapi_client/cyberdesk_cloud_client/api/runs/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/runs/create_run_v1_runs_post.py +188 -0
- openapi_client/cyberdesk_cloud_client/api/runs/delete_run_v1_runs_run_id_delete.py +170 -0
- openapi_client/cyberdesk_cloud_client/api/runs/get_run_v1_runs_run_id_get.py +176 -0
- openapi_client/cyberdesk_cloud_client/api/runs/list_runs_v1_runs_get.py +266 -0
- openapi_client/cyberdesk_cloud_client/api/runs/update_run_v1_runs_run_id_patch.py +202 -0
- openapi_client/cyberdesk_cloud_client/api/test/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/test/dummy_test_endpoint_v1_test_post.py +156 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/create_trajectory_v1_trajectories_post.py +184 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/delete_trajectory_v1_trajectories_trajectory_id_delete.py +170 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/get_latest_trajectory_for_workflow_v1_workflows_workflow_id_latest_trajectory_get.py +176 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/get_trajectory_v1_trajectories_trajectory_id_get.py +176 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/list_trajectories_v1_trajectories_get.py +221 -0
- openapi_client/cyberdesk_cloud_client/api/trajectories/update_trajectory_v1_trajectories_trajectory_id_patch.py +198 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/create_workflow_v1_workflows_post.py +180 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/delete_workflow_v1_workflows_workflow_id_delete.py +174 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/get_workflow_v1_workflows_workflow_id_get.py +172 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/get_workflow_versions_v1_workflows_workflow_id_versions_get.py +185 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/list_workflows_v1_workflows_get.py +194 -0
- openapi_client/cyberdesk_cloud_client/api/workflows/update_workflow_v1_workflows_workflow_id_patch.py +202 -0
- openapi_client/{api_reference_client → cyberdesk_cloud_client}/client.py +268 -268
- openapi_client/{api_reference_client → cyberdesk_cloud_client}/errors.py +16 -16
- openapi_client/cyberdesk_cloud_client/models/__init__.py +107 -0
- openapi_client/cyberdesk_cloud_client/models/connection_create.py +111 -0
- openapi_client/cyberdesk_cloud_client/models/connection_response.py +171 -0
- openapi_client/{api_reference_client/models/get_v1_desktop_id_response_404_status.py → cyberdesk_cloud_client/models/connection_status.py} +10 -8
- openapi_client/cyberdesk_cloud_client/models/connection_update.py +145 -0
- openapi_client/cyberdesk_cloud_client/models/database_health_check_v1_health_db_get_response_database_health_check_v1_health_db_get.py +44 -0
- openapi_client/{api_reference_client/models/post_v1_desktop_id_bash_action_body.py → cyberdesk_cloud_client/models/display_dimensions.py} +67 -59
- openapi_client/cyberdesk_cloud_client/models/dummy_test_endpoint_v1_test_post_response_dummy_test_endpoint_v1_test_post.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/get_workflow_versions_v1_workflows_workflow_id_versions_get_response_200_item.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/health_check_v1_health_get_response_health_check_v1_health_get.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/http_validation_error.py +75 -0
- openapi_client/{api_reference_client/models/post_v1_desktop_body.py → cyberdesk_cloud_client/models/keyboard_key_request.py} +59 -59
- openapi_client/{api_reference_client/models/post_v1_desktop_id_stop_response_200.py → cyberdesk_cloud_client/models/keyboard_type_request.py} +59 -62
- openapi_client/cyberdesk_cloud_client/models/machine_create.py +130 -0
- openapi_client/cyberdesk_cloud_client/models/machine_response.py +182 -0
- openapi_client/{api_reference_client/models/get_v1_desktop_id_response_403_status.py → cyberdesk_cloud_client/models/machine_status.py} +10 -8
- openapi_client/cyberdesk_cloud_client/models/machine_update.py +195 -0
- openapi_client/cyberdesk_cloud_client/models/mouse_click_request.py +109 -0
- openapi_client/{api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_end.py → cyberdesk_cloud_client/models/mouse_move_request.py} +67 -71
- openapi_client/{api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_start.py → cyberdesk_cloud_client/models/mouse_position.py} +67 -71
- openapi_client/cyberdesk_cloud_client/models/paginated_response.py +84 -0
- openapi_client/cyberdesk_cloud_client/models/paginated_response_connection_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/paginated_response_machine_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/paginated_response_run_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/paginated_response_trajectory_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/paginated_response_workflow_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/request_log_create.py +187 -0
- openapi_client/cyberdesk_cloud_client/models/request_log_response.py +230 -0
- openapi_client/cyberdesk_cloud_client/models/request_log_update.py +164 -0
- openapi_client/cyberdesk_cloud_client/models/run_create.py +94 -0
- openapi_client/cyberdesk_cloud_client/models/run_response.py +228 -0
- openapi_client/cyberdesk_cloud_client/models/run_response_output_data_type_0.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/run_response_run_message_history_type_0_item.py +44 -0
- openapi_client/{api_reference_client/models/post_v1_desktop_response_200_status.py → cyberdesk_cloud_client/models/run_status.py} +12 -11
- openapi_client/cyberdesk_cloud_client/models/run_update.py +226 -0
- openapi_client/cyberdesk_cloud_client/models/run_update_output_data_type_0.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/run_update_run_message_history_type_0_item.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_create.py +83 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_create_trajectory_data_item.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_response.py +117 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_response_trajectory_data_item.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_update.py +99 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_update_trajectory_data_type_0_item.py +44 -0
- openapi_client/{api_reference_client/models/post_v1_desktop_id_computer_action_wait_action.py → cyberdesk_cloud_client/models/validation_error.py} +88 -70
- openapi_client/cyberdesk_cloud_client/models/workflow_create.py +82 -0
- openapi_client/cyberdesk_cloud_client/models/workflow_response.py +164 -0
- openapi_client/cyberdesk_cloud_client/models/workflow_response_old_versions_type_0_item.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/workflow_update.py +92 -0
- openapi_client/{api_reference_client → cyberdesk_cloud_client}/types.py +54 -46
- cyberdesk/actions.py +0 -38
- cyberdesk/types.py +0 -50
- cyberdesk-0.2.6.dist-info/METADATA +0 -226
- cyberdesk-0.2.6.dist-info/RECORD +0 -136
- openapi_client/api_reference_client/api/desktop/get_v1_desktop_id.py +0 -293
- openapi_client/api_reference_client/api/desktop/post_v1_desktop.py +0 -294
- openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_bash_action.py +0 -307
- openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_computer_action.py +0 -419
- openapi_client/api_reference_client/api/desktop/post_v1_desktop_id_stop.py +0 -288
- openapi_client/api_reference_client/models/__init__.py +0 -249
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_200.py +0 -104
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_200_status.py +0 -11
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_400.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_400_status.py +0 -8
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_401.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_401_status.py +0 -8
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_403.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_404.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_409.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_409_status.py +0 -8
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_429.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_429_status.py +0 -8
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_500.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_500_status.py +0 -8
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_502.py +0 -69
- openapi_client/api_reference_client/models/get_v1_desktop_id_response_502_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_200.py +0 -79
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_400.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_400_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_401.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_401_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_403.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_403_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_404.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_404_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_409.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_409_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_429.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_429_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_500.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_500_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_502.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_bash_action_response_502_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action.py +0 -133
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_button.py +0 -10
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_click_type.py +0 -10
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_click_mouse_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action.py +0 -98
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_drag_mouse_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_get_cursor_position_action.py +0 -64
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_get_cursor_position_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_move_mouse_action.py +0 -80
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_move_mouse_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action.py +0 -109
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action_key_action_type.py +0 -10
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_press_keys_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_200.py +0 -79
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_400.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_400_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_401.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_401_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_403.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_403_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_404.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_404_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_409.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_409_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_429.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_429_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_500.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_500_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_502.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_response_502_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_screenshot_action.py +0 -63
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_screenshot_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action.py +0 -81
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action_direction.py +0 -11
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_scroll_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_type_text_action.py +0 -71
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_type_text_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_computer_action_wait_action_type.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_200_status.py +0 -11
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_400.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_400_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_401.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_401_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_403.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_403_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_404.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_404_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_409.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_409_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_429.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_429_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_500.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_500_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_502.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_id_stop_response_502_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_200.py +0 -70
- openapi_client/api_reference_client/models/post_v1_desktop_response_400.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_400_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_401.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_401_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_403.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_403_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_404.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_404_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_409.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_409_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_429.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_429_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_500.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_500_status.py +0 -8
- openapi_client/api_reference_client/models/post_v1_desktop_response_502.py +0 -69
- openapi_client/api_reference_client/models/post_v1_desktop_response_502_status.py +0 -8
- {cyberdesk-0.2.6.dist-info → cyberdesk-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {cyberdesk-0.2.6.dist-info → cyberdesk-1.0.0.dist-info}/top_level.txt +0 -0
- /openapi_client/{api_reference_client → cyberdesk_cloud_client}/py.typed +0 -0
cyberdesk/client.py
CHANGED
|
@@ -1,75 +1,784 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"""Cyberdesk Python SDK Client."""
|
|
2
|
+
from typing import Optional, Dict, Any, Union
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
import httpx
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
# Import the generated client
|
|
8
|
+
from openapi_client.cyberdesk_cloud_client import AuthenticatedClient
|
|
9
|
+
from openapi_client.cyberdesk_cloud_client.types import UNSET, Unset
|
|
10
|
+
from openapi_client.cyberdesk_cloud_client.api.machines import (
|
|
11
|
+
list_machines_v1_machines_get,
|
|
12
|
+
create_machine_v1_machines_post,
|
|
13
|
+
get_machine_v1_machines_machine_id_get,
|
|
14
|
+
update_machine_v1_machines_machine_id_patch,
|
|
15
|
+
delete_machine_v1_machines_machine_id_delete,
|
|
16
|
+
)
|
|
17
|
+
from openapi_client.cyberdesk_cloud_client.api.workflows import (
|
|
18
|
+
list_workflows_v1_workflows_get,
|
|
19
|
+
create_workflow_v1_workflows_post,
|
|
20
|
+
get_workflow_v1_workflows_workflow_id_get,
|
|
21
|
+
update_workflow_v1_workflows_workflow_id_patch,
|
|
22
|
+
delete_workflow_v1_workflows_workflow_id_delete,
|
|
23
|
+
)
|
|
24
|
+
from openapi_client.cyberdesk_cloud_client.api.runs import (
|
|
25
|
+
list_runs_v1_runs_get,
|
|
26
|
+
create_run_v1_runs_post,
|
|
27
|
+
get_run_v1_runs_run_id_get,
|
|
28
|
+
update_run_v1_runs_run_id_patch,
|
|
29
|
+
delete_run_v1_runs_run_id_delete,
|
|
10
30
|
)
|
|
11
|
-
from openapi_client.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
post_v1_desktop,
|
|
15
|
-
post_v1_desktop_id_stop,
|
|
16
|
-
post_v1_desktop_id_computer_action,
|
|
17
|
-
post_v1_desktop_id_bash_action,
|
|
31
|
+
from openapi_client.cyberdesk_cloud_client.api.connections import (
|
|
32
|
+
list_connections_v1_connections_get,
|
|
33
|
+
create_connection_v1_connections_post,
|
|
18
34
|
)
|
|
19
|
-
from openapi_client.
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
from openapi_client.cyberdesk_cloud_client.api.trajectories import (
|
|
36
|
+
list_trajectories_v1_trajectories_get,
|
|
37
|
+
create_trajectory_v1_trajectories_post,
|
|
38
|
+
get_trajectory_v1_trajectories_trajectory_id_get,
|
|
39
|
+
update_trajectory_v1_trajectories_trajectory_id_patch,
|
|
40
|
+
delete_trajectory_v1_trajectories_trajectory_id_delete,
|
|
41
|
+
get_latest_trajectory_for_workflow_v1_workflows_workflow_id_latest_trajectory_get,
|
|
22
42
|
)
|
|
23
43
|
|
|
44
|
+
# Import models
|
|
45
|
+
from openapi_client.cyberdesk_cloud_client.models import (
|
|
46
|
+
MachineCreate,
|
|
47
|
+
MachineUpdate,
|
|
48
|
+
MachineResponse,
|
|
49
|
+
MachineStatus,
|
|
50
|
+
WorkflowCreate,
|
|
51
|
+
WorkflowUpdate,
|
|
52
|
+
WorkflowResponse,
|
|
53
|
+
RunCreate,
|
|
54
|
+
RunUpdate,
|
|
55
|
+
RunResponse,
|
|
56
|
+
RunStatus,
|
|
57
|
+
ConnectionCreate,
|
|
58
|
+
ConnectionResponse,
|
|
59
|
+
ConnectionStatus,
|
|
60
|
+
TrajectoryCreate,
|
|
61
|
+
TrajectoryUpdate,
|
|
62
|
+
TrajectoryResponse,
|
|
63
|
+
PaginatedResponseMachineResponse,
|
|
64
|
+
PaginatedResponseWorkflowResponse,
|
|
65
|
+
PaginatedResponseRunResponse,
|
|
66
|
+
PaginatedResponseConnectionResponse,
|
|
67
|
+
PaginatedResponseTrajectoryResponse,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Re-export common types
|
|
71
|
+
__all__ = [
|
|
72
|
+
"CyberdeskClient",
|
|
73
|
+
"MachineCreate",
|
|
74
|
+
"MachineUpdate",
|
|
75
|
+
"MachineResponse",
|
|
76
|
+
"MachineStatus",
|
|
77
|
+
"WorkflowCreate",
|
|
78
|
+
"WorkflowUpdate",
|
|
79
|
+
"WorkflowResponse",
|
|
80
|
+
"RunCreate",
|
|
81
|
+
"RunUpdate",
|
|
82
|
+
"RunResponse",
|
|
83
|
+
"RunStatus",
|
|
84
|
+
"ConnectionCreate",
|
|
85
|
+
"ConnectionResponse",
|
|
86
|
+
"ConnectionStatus",
|
|
87
|
+
"TrajectoryCreate",
|
|
88
|
+
"TrajectoryUpdate",
|
|
89
|
+
"TrajectoryResponse",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
DEFAULT_API_BASE_URL = "https://api.cyberdesk.io"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class ApiResponse:
|
|
97
|
+
"""Wrapper for API responses."""
|
|
98
|
+
data: Optional[Any] = None
|
|
99
|
+
error: Optional[Any] = None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _to_uuid(value: Union[str, UUID]) -> UUID:
|
|
103
|
+
"""Convert string to UUID if needed."""
|
|
104
|
+
if isinstance(value, str):
|
|
105
|
+
return UUID(value)
|
|
106
|
+
return value
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _to_unset_or_value(value: Optional[Any]) -> Union[Unset, Any]:
|
|
110
|
+
"""Convert None to UNSET."""
|
|
111
|
+
return UNSET if value is None else value
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class MachinesAPI:
|
|
115
|
+
"""Machines API endpoints."""
|
|
116
|
+
|
|
117
|
+
def __init__(self, client: AuthenticatedClient):
|
|
118
|
+
self.client = client
|
|
119
|
+
|
|
120
|
+
async def list(
|
|
121
|
+
self,
|
|
122
|
+
skip: Optional[int] = None,
|
|
123
|
+
limit: Optional[int] = None,
|
|
124
|
+
status: Optional[MachineStatus] = None
|
|
125
|
+
) -> ApiResponse:
|
|
126
|
+
"""List machines with optional filtering."""
|
|
127
|
+
try:
|
|
128
|
+
response = await list_machines_v1_machines_get.asyncio(
|
|
129
|
+
client=self.client,
|
|
130
|
+
skip=_to_unset_or_value(skip),
|
|
131
|
+
limit=_to_unset_or_value(limit),
|
|
132
|
+
status=status
|
|
133
|
+
)
|
|
134
|
+
return ApiResponse(data=response)
|
|
135
|
+
except Exception as e:
|
|
136
|
+
return ApiResponse(error=e)
|
|
137
|
+
|
|
138
|
+
def list_sync(
|
|
139
|
+
self,
|
|
140
|
+
skip: Optional[int] = None,
|
|
141
|
+
limit: Optional[int] = None,
|
|
142
|
+
status: Optional[MachineStatus] = None
|
|
143
|
+
) -> ApiResponse:
|
|
144
|
+
"""List machines with optional filtering (synchronous)."""
|
|
145
|
+
try:
|
|
146
|
+
response = list_machines_v1_machines_get.sync(
|
|
147
|
+
client=self.client,
|
|
148
|
+
skip=_to_unset_or_value(skip),
|
|
149
|
+
limit=_to_unset_or_value(limit),
|
|
150
|
+
status=status
|
|
151
|
+
)
|
|
152
|
+
return ApiResponse(data=response)
|
|
153
|
+
except Exception as e:
|
|
154
|
+
return ApiResponse(error=e)
|
|
155
|
+
|
|
156
|
+
async def create(self, data: MachineCreate) -> ApiResponse:
|
|
157
|
+
"""Create a new machine."""
|
|
158
|
+
try:
|
|
159
|
+
response = await create_machine_v1_machines_post.asyncio(
|
|
160
|
+
client=self.client,
|
|
161
|
+
body=data
|
|
162
|
+
)
|
|
163
|
+
return ApiResponse(data=response)
|
|
164
|
+
except Exception as e:
|
|
165
|
+
return ApiResponse(error=e)
|
|
166
|
+
|
|
167
|
+
def create_sync(self, data: MachineCreate) -> ApiResponse:
|
|
168
|
+
"""Create a new machine (synchronous)."""
|
|
169
|
+
try:
|
|
170
|
+
response = create_machine_v1_machines_post.sync(
|
|
171
|
+
client=self.client,
|
|
172
|
+
body=data
|
|
173
|
+
)
|
|
174
|
+
return ApiResponse(data=response)
|
|
175
|
+
except Exception as e:
|
|
176
|
+
return ApiResponse(error=e)
|
|
177
|
+
|
|
178
|
+
async def get(self, machine_id: str) -> ApiResponse:
|
|
179
|
+
"""Get a specific machine by ID."""
|
|
180
|
+
try:
|
|
181
|
+
response = await get_machine_v1_machines_machine_id_get.asyncio(
|
|
182
|
+
client=self.client,
|
|
183
|
+
machine_id=_to_uuid(machine_id)
|
|
184
|
+
)
|
|
185
|
+
return ApiResponse(data=response)
|
|
186
|
+
except Exception as e:
|
|
187
|
+
return ApiResponse(error=e)
|
|
188
|
+
|
|
189
|
+
def get_sync(self, machine_id: str) -> ApiResponse:
|
|
190
|
+
"""Get a specific machine by ID (synchronous)."""
|
|
191
|
+
try:
|
|
192
|
+
response = get_machine_v1_machines_machine_id_get.sync(
|
|
193
|
+
client=self.client,
|
|
194
|
+
machine_id=_to_uuid(machine_id)
|
|
195
|
+
)
|
|
196
|
+
return ApiResponse(data=response)
|
|
197
|
+
except Exception as e:
|
|
198
|
+
return ApiResponse(error=e)
|
|
199
|
+
|
|
200
|
+
async def update(self, machine_id: str, data: MachineUpdate) -> ApiResponse:
|
|
201
|
+
"""Update a machine."""
|
|
202
|
+
try:
|
|
203
|
+
response = await update_machine_v1_machines_machine_id_patch.asyncio(
|
|
204
|
+
client=self.client,
|
|
205
|
+
machine_id=_to_uuid(machine_id),
|
|
206
|
+
body=data
|
|
207
|
+
)
|
|
208
|
+
return ApiResponse(data=response)
|
|
209
|
+
except Exception as e:
|
|
210
|
+
return ApiResponse(error=e)
|
|
211
|
+
|
|
212
|
+
def update_sync(self, machine_id: str, data: MachineUpdate) -> ApiResponse:
|
|
213
|
+
"""Update a machine (synchronous)."""
|
|
214
|
+
try:
|
|
215
|
+
response = update_machine_v1_machines_machine_id_patch.sync(
|
|
216
|
+
client=self.client,
|
|
217
|
+
machine_id=_to_uuid(machine_id),
|
|
218
|
+
body=data
|
|
219
|
+
)
|
|
220
|
+
return ApiResponse(data=response)
|
|
221
|
+
except Exception as e:
|
|
222
|
+
return ApiResponse(error=e)
|
|
223
|
+
|
|
224
|
+
async def delete(self, machine_id: str) -> ApiResponse:
|
|
225
|
+
"""Delete a machine."""
|
|
226
|
+
try:
|
|
227
|
+
await delete_machine_v1_machines_machine_id_delete.asyncio(
|
|
228
|
+
client=self.client,
|
|
229
|
+
machine_id=_to_uuid(machine_id)
|
|
230
|
+
)
|
|
231
|
+
return ApiResponse(data={"success": True})
|
|
232
|
+
except Exception as e:
|
|
233
|
+
return ApiResponse(error=e)
|
|
234
|
+
|
|
235
|
+
def delete_sync(self, machine_id: str) -> ApiResponse:
|
|
236
|
+
"""Delete a machine (synchronous)."""
|
|
237
|
+
try:
|
|
238
|
+
delete_machine_v1_machines_machine_id_delete.sync(
|
|
239
|
+
client=self.client,
|
|
240
|
+
machine_id=_to_uuid(machine_id)
|
|
241
|
+
)
|
|
242
|
+
return ApiResponse(data={"success": True})
|
|
243
|
+
except Exception as e:
|
|
244
|
+
return ApiResponse(error=e)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
class WorkflowsAPI:
|
|
248
|
+
"""Workflows API endpoints."""
|
|
249
|
+
|
|
250
|
+
def __init__(self, client: AuthenticatedClient):
|
|
251
|
+
self.client = client
|
|
252
|
+
|
|
253
|
+
async def list(self, skip: Optional[int] = None, limit: Optional[int] = None) -> ApiResponse:
|
|
254
|
+
"""List workflows."""
|
|
255
|
+
try:
|
|
256
|
+
response = await list_workflows_v1_workflows_get.asyncio(
|
|
257
|
+
client=self.client,
|
|
258
|
+
skip=_to_unset_or_value(skip),
|
|
259
|
+
limit=_to_unset_or_value(limit)
|
|
260
|
+
)
|
|
261
|
+
return ApiResponse(data=response)
|
|
262
|
+
except Exception as e:
|
|
263
|
+
return ApiResponse(error=e)
|
|
264
|
+
|
|
265
|
+
def list_sync(self, skip: Optional[int] = None, limit: Optional[int] = None) -> ApiResponse:
|
|
266
|
+
"""List workflows (synchronous)."""
|
|
267
|
+
try:
|
|
268
|
+
response = list_workflows_v1_workflows_get.sync(
|
|
269
|
+
client=self.client,
|
|
270
|
+
skip=_to_unset_or_value(skip),
|
|
271
|
+
limit=_to_unset_or_value(limit)
|
|
272
|
+
)
|
|
273
|
+
return ApiResponse(data=response)
|
|
274
|
+
except Exception as e:
|
|
275
|
+
return ApiResponse(error=e)
|
|
276
|
+
|
|
277
|
+
async def create(self, data: WorkflowCreate) -> ApiResponse:
|
|
278
|
+
"""Create a new workflow."""
|
|
279
|
+
try:
|
|
280
|
+
response = await create_workflow_v1_workflows_post.asyncio(
|
|
281
|
+
client=self.client,
|
|
282
|
+
body=data
|
|
283
|
+
)
|
|
284
|
+
return ApiResponse(data=response)
|
|
285
|
+
except Exception as e:
|
|
286
|
+
return ApiResponse(error=e)
|
|
287
|
+
|
|
288
|
+
def create_sync(self, data: WorkflowCreate) -> ApiResponse:
|
|
289
|
+
"""Create a new workflow (synchronous)."""
|
|
290
|
+
try:
|
|
291
|
+
response = create_workflow_v1_workflows_post.sync(
|
|
292
|
+
client=self.client,
|
|
293
|
+
body=data
|
|
294
|
+
)
|
|
295
|
+
return ApiResponse(data=response)
|
|
296
|
+
except Exception as e:
|
|
297
|
+
return ApiResponse(error=e)
|
|
298
|
+
|
|
299
|
+
async def get(self, workflow_id: str) -> ApiResponse:
|
|
300
|
+
"""Get a specific workflow by ID."""
|
|
301
|
+
try:
|
|
302
|
+
response = await get_workflow_v1_workflows_workflow_id_get.asyncio(
|
|
303
|
+
client=self.client,
|
|
304
|
+
workflow_id=_to_uuid(workflow_id)
|
|
305
|
+
)
|
|
306
|
+
return ApiResponse(data=response)
|
|
307
|
+
except Exception as e:
|
|
308
|
+
return ApiResponse(error=e)
|
|
309
|
+
|
|
310
|
+
def get_sync(self, workflow_id: str) -> ApiResponse:
|
|
311
|
+
"""Get a specific workflow by ID (synchronous)."""
|
|
312
|
+
try:
|
|
313
|
+
response = get_workflow_v1_workflows_workflow_id_get.sync(
|
|
314
|
+
client=self.client,
|
|
315
|
+
workflow_id=_to_uuid(workflow_id)
|
|
316
|
+
)
|
|
317
|
+
return ApiResponse(data=response)
|
|
318
|
+
except Exception as e:
|
|
319
|
+
return ApiResponse(error=e)
|
|
320
|
+
|
|
321
|
+
async def update(self, workflow_id: str, data: WorkflowUpdate) -> ApiResponse:
|
|
322
|
+
"""Update a workflow."""
|
|
323
|
+
try:
|
|
324
|
+
response = await update_workflow_v1_workflows_workflow_id_patch.asyncio(
|
|
325
|
+
client=self.client,
|
|
326
|
+
workflow_id=_to_uuid(workflow_id),
|
|
327
|
+
body=data
|
|
328
|
+
)
|
|
329
|
+
return ApiResponse(data=response)
|
|
330
|
+
except Exception as e:
|
|
331
|
+
return ApiResponse(error=e)
|
|
332
|
+
|
|
333
|
+
def update_sync(self, workflow_id: str, data: WorkflowUpdate) -> ApiResponse:
|
|
334
|
+
"""Update a workflow (synchronous)."""
|
|
335
|
+
try:
|
|
336
|
+
response = update_workflow_v1_workflows_workflow_id_patch.sync(
|
|
337
|
+
client=self.client,
|
|
338
|
+
workflow_id=_to_uuid(workflow_id),
|
|
339
|
+
body=data
|
|
340
|
+
)
|
|
341
|
+
return ApiResponse(data=response)
|
|
342
|
+
except Exception as e:
|
|
343
|
+
return ApiResponse(error=e)
|
|
344
|
+
|
|
345
|
+
async def delete(self, workflow_id: str) -> ApiResponse:
|
|
346
|
+
"""Delete a workflow."""
|
|
347
|
+
try:
|
|
348
|
+
await delete_workflow_v1_workflows_workflow_id_delete.asyncio(
|
|
349
|
+
client=self.client,
|
|
350
|
+
workflow_id=_to_uuid(workflow_id)
|
|
351
|
+
)
|
|
352
|
+
return ApiResponse(data={"success": True})
|
|
353
|
+
except Exception as e:
|
|
354
|
+
return ApiResponse(error=e)
|
|
355
|
+
|
|
356
|
+
def delete_sync(self, workflow_id: str) -> ApiResponse:
|
|
357
|
+
"""Delete a workflow (synchronous)."""
|
|
358
|
+
try:
|
|
359
|
+
delete_workflow_v1_workflows_workflow_id_delete.sync(
|
|
360
|
+
client=self.client,
|
|
361
|
+
workflow_id=_to_uuid(workflow_id)
|
|
362
|
+
)
|
|
363
|
+
return ApiResponse(data={"success": True})
|
|
364
|
+
except Exception as e:
|
|
365
|
+
return ApiResponse(error=e)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class RunsAPI:
|
|
369
|
+
"""Runs API endpoints."""
|
|
370
|
+
|
|
371
|
+
def __init__(self, client: AuthenticatedClient):
|
|
372
|
+
self.client = client
|
|
373
|
+
|
|
374
|
+
async def list(
|
|
375
|
+
self,
|
|
376
|
+
skip: Optional[int] = None,
|
|
377
|
+
limit: Optional[int] = None,
|
|
378
|
+
status: Optional[RunStatus] = None,
|
|
379
|
+
workflow_id: Optional[str] = None,
|
|
380
|
+
machine_id: Optional[str] = None
|
|
381
|
+
) -> ApiResponse:
|
|
382
|
+
"""List runs with optional filtering."""
|
|
383
|
+
try:
|
|
384
|
+
response = await list_runs_v1_runs_get.asyncio(
|
|
385
|
+
client=self.client,
|
|
386
|
+
skip=_to_unset_or_value(skip),
|
|
387
|
+
limit=_to_unset_or_value(limit),
|
|
388
|
+
status=status,
|
|
389
|
+
workflow_id=_to_uuid(workflow_id) if workflow_id else UNSET,
|
|
390
|
+
machine_id=_to_uuid(machine_id) if machine_id else UNSET
|
|
391
|
+
)
|
|
392
|
+
return ApiResponse(data=response)
|
|
393
|
+
except Exception as e:
|
|
394
|
+
return ApiResponse(error=e)
|
|
395
|
+
|
|
396
|
+
def list_sync(
|
|
397
|
+
self,
|
|
398
|
+
skip: Optional[int] = None,
|
|
399
|
+
limit: Optional[int] = None,
|
|
400
|
+
status: Optional[RunStatus] = None,
|
|
401
|
+
workflow_id: Optional[str] = None,
|
|
402
|
+
machine_id: Optional[str] = None
|
|
403
|
+
) -> ApiResponse:
|
|
404
|
+
"""List runs with optional filtering (synchronous)."""
|
|
405
|
+
try:
|
|
406
|
+
response = list_runs_v1_runs_get.sync(
|
|
407
|
+
client=self.client,
|
|
408
|
+
skip=_to_unset_or_value(skip),
|
|
409
|
+
limit=_to_unset_or_value(limit),
|
|
410
|
+
status=status,
|
|
411
|
+
workflow_id=_to_uuid(workflow_id) if workflow_id else UNSET,
|
|
412
|
+
machine_id=_to_uuid(machine_id) if machine_id else UNSET
|
|
413
|
+
)
|
|
414
|
+
return ApiResponse(data=response)
|
|
415
|
+
except Exception as e:
|
|
416
|
+
return ApiResponse(error=e)
|
|
417
|
+
|
|
418
|
+
async def create(self, data: RunCreate) -> ApiResponse:
|
|
419
|
+
"""Create a new run."""
|
|
420
|
+
try:
|
|
421
|
+
response = await create_run_v1_runs_post.asyncio(
|
|
422
|
+
client=self.client,
|
|
423
|
+
body=data
|
|
424
|
+
)
|
|
425
|
+
return ApiResponse(data=response)
|
|
426
|
+
except Exception as e:
|
|
427
|
+
return ApiResponse(error=e)
|
|
428
|
+
|
|
429
|
+
def create_sync(self, data: RunCreate) -> ApiResponse:
|
|
430
|
+
"""Create a new run (synchronous)."""
|
|
431
|
+
try:
|
|
432
|
+
response = create_run_v1_runs_post.sync(
|
|
433
|
+
client=self.client,
|
|
434
|
+
body=data
|
|
435
|
+
)
|
|
436
|
+
return ApiResponse(data=response)
|
|
437
|
+
except Exception as e:
|
|
438
|
+
return ApiResponse(error=e)
|
|
439
|
+
|
|
440
|
+
async def get(self, run_id: str) -> ApiResponse:
|
|
441
|
+
"""Get a specific run by ID."""
|
|
442
|
+
try:
|
|
443
|
+
response = await get_run_v1_runs_run_id_get.asyncio(
|
|
444
|
+
client=self.client,
|
|
445
|
+
run_id=_to_uuid(run_id)
|
|
446
|
+
)
|
|
447
|
+
return ApiResponse(data=response)
|
|
448
|
+
except Exception as e:
|
|
449
|
+
return ApiResponse(error=e)
|
|
450
|
+
|
|
451
|
+
def get_sync(self, run_id: str) -> ApiResponse:
|
|
452
|
+
"""Get a specific run by ID (synchronous)."""
|
|
453
|
+
try:
|
|
454
|
+
response = get_run_v1_runs_run_id_get.sync(
|
|
455
|
+
client=self.client,
|
|
456
|
+
run_id=_to_uuid(run_id)
|
|
457
|
+
)
|
|
458
|
+
return ApiResponse(data=response)
|
|
459
|
+
except Exception as e:
|
|
460
|
+
return ApiResponse(error=e)
|
|
461
|
+
|
|
462
|
+
async def update(self, run_id: str, data: RunUpdate) -> ApiResponse:
|
|
463
|
+
"""Update a run."""
|
|
464
|
+
try:
|
|
465
|
+
response = await update_run_v1_runs_run_id_patch.asyncio(
|
|
466
|
+
client=self.client,
|
|
467
|
+
run_id=_to_uuid(run_id),
|
|
468
|
+
body=data
|
|
469
|
+
)
|
|
470
|
+
return ApiResponse(data=response)
|
|
471
|
+
except Exception as e:
|
|
472
|
+
return ApiResponse(error=e)
|
|
473
|
+
|
|
474
|
+
def update_sync(self, run_id: str, data: RunUpdate) -> ApiResponse:
|
|
475
|
+
"""Update a run (synchronous)."""
|
|
476
|
+
try:
|
|
477
|
+
response = update_run_v1_runs_run_id_patch.sync(
|
|
478
|
+
client=self.client,
|
|
479
|
+
run_id=_to_uuid(run_id),
|
|
480
|
+
body=data
|
|
481
|
+
)
|
|
482
|
+
return ApiResponse(data=response)
|
|
483
|
+
except Exception as e:
|
|
484
|
+
return ApiResponse(error=e)
|
|
485
|
+
|
|
486
|
+
async def delete(self, run_id: str) -> ApiResponse:
|
|
487
|
+
"""Delete a run."""
|
|
488
|
+
try:
|
|
489
|
+
await delete_run_v1_runs_run_id_delete.asyncio(
|
|
490
|
+
client=self.client,
|
|
491
|
+
run_id=_to_uuid(run_id)
|
|
492
|
+
)
|
|
493
|
+
return ApiResponse(data={"success": True})
|
|
494
|
+
except Exception as e:
|
|
495
|
+
return ApiResponse(error=e)
|
|
496
|
+
|
|
497
|
+
def delete_sync(self, run_id: str) -> ApiResponse:
|
|
498
|
+
"""Delete a run (synchronous)."""
|
|
499
|
+
try:
|
|
500
|
+
delete_run_v1_runs_run_id_delete.sync(
|
|
501
|
+
client=self.client,
|
|
502
|
+
run_id=_to_uuid(run_id)
|
|
503
|
+
)
|
|
504
|
+
return ApiResponse(data={"success": True})
|
|
505
|
+
except Exception as e:
|
|
506
|
+
return ApiResponse(error=e)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
class ConnectionsAPI:
|
|
510
|
+
"""Connections API endpoints."""
|
|
511
|
+
|
|
512
|
+
def __init__(self, client: AuthenticatedClient):
|
|
513
|
+
self.client = client
|
|
514
|
+
|
|
515
|
+
async def list(
|
|
516
|
+
self,
|
|
517
|
+
skip: Optional[int] = None,
|
|
518
|
+
limit: Optional[int] = None,
|
|
519
|
+
machine_id: Optional[str] = None,
|
|
520
|
+
status: Optional[Union[str, ConnectionStatus]] = None
|
|
521
|
+
) -> ApiResponse:
|
|
522
|
+
"""List connections with optional filtering."""
|
|
523
|
+
try:
|
|
524
|
+
# Handle status conversion
|
|
525
|
+
if isinstance(status, str):
|
|
526
|
+
status = Unset if status is None else ConnectionStatus(status)
|
|
527
|
+
|
|
528
|
+
response = await list_connections_v1_connections_get.asyncio(
|
|
529
|
+
client=self.client,
|
|
530
|
+
skip=_to_unset_or_value(skip),
|
|
531
|
+
limit=_to_unset_or_value(limit),
|
|
532
|
+
machine_id=_to_uuid(machine_id) if machine_id else UNSET,
|
|
533
|
+
status=status
|
|
534
|
+
)
|
|
535
|
+
return ApiResponse(data=response)
|
|
536
|
+
except Exception as e:
|
|
537
|
+
return ApiResponse(error=e)
|
|
538
|
+
|
|
539
|
+
def list_sync(
|
|
540
|
+
self,
|
|
541
|
+
skip: Optional[int] = None,
|
|
542
|
+
limit: Optional[int] = None,
|
|
543
|
+
machine_id: Optional[str] = None,
|
|
544
|
+
status: Optional[Union[str, ConnectionStatus]] = None
|
|
545
|
+
) -> ApiResponse:
|
|
546
|
+
"""List connections with optional filtering (synchronous)."""
|
|
547
|
+
try:
|
|
548
|
+
# Handle status conversion
|
|
549
|
+
if isinstance(status, str):
|
|
550
|
+
status = Unset if status is None else ConnectionStatus(status)
|
|
551
|
+
|
|
552
|
+
response = list_connections_v1_connections_get.sync(
|
|
553
|
+
client=self.client,
|
|
554
|
+
skip=_to_unset_or_value(skip),
|
|
555
|
+
limit=_to_unset_or_value(limit),
|
|
556
|
+
machine_id=_to_uuid(machine_id) if machine_id else UNSET,
|
|
557
|
+
status=status
|
|
558
|
+
)
|
|
559
|
+
return ApiResponse(data=response)
|
|
560
|
+
except Exception as e:
|
|
561
|
+
return ApiResponse(error=e)
|
|
562
|
+
|
|
563
|
+
async def create(self, data: ConnectionCreate) -> ApiResponse:
|
|
564
|
+
"""Create a new connection."""
|
|
565
|
+
try:
|
|
566
|
+
response = await create_connection_v1_connections_post.asyncio(
|
|
567
|
+
client=self.client,
|
|
568
|
+
body=data
|
|
569
|
+
)
|
|
570
|
+
return ApiResponse(data=response)
|
|
571
|
+
except Exception as e:
|
|
572
|
+
return ApiResponse(error=e)
|
|
573
|
+
|
|
574
|
+
def create_sync(self, data: ConnectionCreate) -> ApiResponse:
|
|
575
|
+
"""Create a new connection (synchronous)."""
|
|
576
|
+
try:
|
|
577
|
+
response = create_connection_v1_connections_post.sync(
|
|
578
|
+
client=self.client,
|
|
579
|
+
body=data
|
|
580
|
+
)
|
|
581
|
+
return ApiResponse(data=response)
|
|
582
|
+
except Exception as e:
|
|
583
|
+
return ApiResponse(error=e)
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
class TrajectoriesAPI:
|
|
587
|
+
"""Trajectories API endpoints."""
|
|
588
|
+
|
|
589
|
+
def __init__(self, client: AuthenticatedClient):
|
|
590
|
+
self.client = client
|
|
591
|
+
|
|
592
|
+
async def list(
|
|
593
|
+
self,
|
|
594
|
+
skip: Optional[int] = None,
|
|
595
|
+
limit: Optional[int] = None,
|
|
596
|
+
workflow_id: Optional[str] = None
|
|
597
|
+
) -> ApiResponse:
|
|
598
|
+
"""List trajectories with optional filtering."""
|
|
599
|
+
try:
|
|
600
|
+
response = await list_trajectories_v1_trajectories_get.asyncio(
|
|
601
|
+
client=self.client,
|
|
602
|
+
skip=_to_unset_or_value(skip),
|
|
603
|
+
limit=_to_unset_or_value(limit),
|
|
604
|
+
workflow_id=_to_uuid(workflow_id) if workflow_id else UNSET
|
|
605
|
+
)
|
|
606
|
+
return ApiResponse(data=response)
|
|
607
|
+
except Exception as e:
|
|
608
|
+
return ApiResponse(error=e)
|
|
609
|
+
|
|
610
|
+
def list_sync(
|
|
611
|
+
self,
|
|
612
|
+
skip: Optional[int] = None,
|
|
613
|
+
limit: Optional[int] = None,
|
|
614
|
+
workflow_id: Optional[str] = None
|
|
615
|
+
) -> ApiResponse:
|
|
616
|
+
"""List trajectories with optional filtering (synchronous)."""
|
|
617
|
+
try:
|
|
618
|
+
response = list_trajectories_v1_trajectories_get.sync(
|
|
619
|
+
client=self.client,
|
|
620
|
+
skip=_to_unset_or_value(skip),
|
|
621
|
+
limit=_to_unset_or_value(limit),
|
|
622
|
+
workflow_id=_to_uuid(workflow_id) if workflow_id else UNSET
|
|
623
|
+
)
|
|
624
|
+
return ApiResponse(data=response)
|
|
625
|
+
except Exception as e:
|
|
626
|
+
return ApiResponse(error=e)
|
|
627
|
+
|
|
628
|
+
async def create(self, data: TrajectoryCreate) -> ApiResponse:
|
|
629
|
+
"""Create a new trajectory."""
|
|
630
|
+
try:
|
|
631
|
+
response = await create_trajectory_v1_trajectories_post.asyncio(
|
|
632
|
+
client=self.client,
|
|
633
|
+
body=data
|
|
634
|
+
)
|
|
635
|
+
return ApiResponse(data=response)
|
|
636
|
+
except Exception as e:
|
|
637
|
+
return ApiResponse(error=e)
|
|
638
|
+
|
|
639
|
+
def create_sync(self, data: TrajectoryCreate) -> ApiResponse:
|
|
640
|
+
"""Create a new trajectory (synchronous)."""
|
|
641
|
+
try:
|
|
642
|
+
response = create_trajectory_v1_trajectories_post.sync(
|
|
643
|
+
client=self.client,
|
|
644
|
+
body=data
|
|
645
|
+
)
|
|
646
|
+
return ApiResponse(data=response)
|
|
647
|
+
except Exception as e:
|
|
648
|
+
return ApiResponse(error=e)
|
|
649
|
+
|
|
650
|
+
async def get(self, trajectory_id: str) -> ApiResponse:
|
|
651
|
+
"""Get a specific trajectory by ID."""
|
|
652
|
+
try:
|
|
653
|
+
response = await get_trajectory_v1_trajectories_trajectory_id_get.asyncio(
|
|
654
|
+
client=self.client,
|
|
655
|
+
trajectory_id=_to_uuid(trajectory_id)
|
|
656
|
+
)
|
|
657
|
+
return ApiResponse(data=response)
|
|
658
|
+
except Exception as e:
|
|
659
|
+
return ApiResponse(error=e)
|
|
660
|
+
|
|
661
|
+
def get_sync(self, trajectory_id: str) -> ApiResponse:
|
|
662
|
+
"""Get a specific trajectory by ID (synchronous)."""
|
|
663
|
+
try:
|
|
664
|
+
response = get_trajectory_v1_trajectories_trajectory_id_get.sync(
|
|
665
|
+
client=self.client,
|
|
666
|
+
trajectory_id=_to_uuid(trajectory_id)
|
|
667
|
+
)
|
|
668
|
+
return ApiResponse(data=response)
|
|
669
|
+
except Exception as e:
|
|
670
|
+
return ApiResponse(error=e)
|
|
671
|
+
|
|
672
|
+
async def update(self, trajectory_id: str, data: TrajectoryUpdate) -> ApiResponse:
|
|
673
|
+
"""Update a trajectory."""
|
|
674
|
+
try:
|
|
675
|
+
response = await update_trajectory_v1_trajectories_trajectory_id_patch.asyncio(
|
|
676
|
+
client=self.client,
|
|
677
|
+
trajectory_id=_to_uuid(trajectory_id),
|
|
678
|
+
body=data
|
|
679
|
+
)
|
|
680
|
+
return ApiResponse(data=response)
|
|
681
|
+
except Exception as e:
|
|
682
|
+
return ApiResponse(error=e)
|
|
683
|
+
|
|
684
|
+
def update_sync(self, trajectory_id: str, data: TrajectoryUpdate) -> ApiResponse:
|
|
685
|
+
"""Update a trajectory (synchronous)."""
|
|
686
|
+
try:
|
|
687
|
+
response = update_trajectory_v1_trajectories_trajectory_id_patch.sync(
|
|
688
|
+
client=self.client,
|
|
689
|
+
trajectory_id=_to_uuid(trajectory_id),
|
|
690
|
+
body=data
|
|
691
|
+
)
|
|
692
|
+
return ApiResponse(data=response)
|
|
693
|
+
except Exception as e:
|
|
694
|
+
return ApiResponse(error=e)
|
|
695
|
+
|
|
696
|
+
async def delete(self, trajectory_id: str) -> ApiResponse:
|
|
697
|
+
"""Delete a trajectory."""
|
|
698
|
+
try:
|
|
699
|
+
await delete_trajectory_v1_trajectories_trajectory_id_delete.asyncio(
|
|
700
|
+
client=self.client,
|
|
701
|
+
trajectory_id=_to_uuid(trajectory_id)
|
|
702
|
+
)
|
|
703
|
+
return ApiResponse(data={"success": True})
|
|
704
|
+
except Exception as e:
|
|
705
|
+
return ApiResponse(error=e)
|
|
706
|
+
|
|
707
|
+
def delete_sync(self, trajectory_id: str) -> ApiResponse:
|
|
708
|
+
"""Delete a trajectory (synchronous)."""
|
|
709
|
+
try:
|
|
710
|
+
delete_trajectory_v1_trajectories_trajectory_id_delete.sync(
|
|
711
|
+
client=self.client,
|
|
712
|
+
trajectory_id=_to_uuid(trajectory_id)
|
|
713
|
+
)
|
|
714
|
+
return ApiResponse(data={"success": True})
|
|
715
|
+
except Exception as e:
|
|
716
|
+
return ApiResponse(error=e)
|
|
717
|
+
|
|
718
|
+
async def get_latest_for_workflow(self, workflow_id: str) -> ApiResponse:
|
|
719
|
+
"""Get the latest trajectory for a workflow."""
|
|
720
|
+
try:
|
|
721
|
+
response = await get_latest_trajectory_for_workflow_v1_workflows_workflow_id_latest_trajectory_get.asyncio(
|
|
722
|
+
client=self.client,
|
|
723
|
+
workflow_id=_to_uuid(workflow_id)
|
|
724
|
+
)
|
|
725
|
+
return ApiResponse(data=response)
|
|
726
|
+
except Exception as e:
|
|
727
|
+
return ApiResponse(error=e)
|
|
728
|
+
|
|
729
|
+
def get_latest_for_workflow_sync(self, workflow_id: str) -> ApiResponse:
|
|
730
|
+
"""Get the latest trajectory for a workflow (synchronous)."""
|
|
731
|
+
try:
|
|
732
|
+
response = get_latest_trajectory_for_workflow_v1_workflows_workflow_id_latest_trajectory_get.sync(
|
|
733
|
+
client=self.client,
|
|
734
|
+
workflow_id=_to_uuid(workflow_id)
|
|
735
|
+
)
|
|
736
|
+
return ApiResponse(data=response)
|
|
737
|
+
except Exception as e:
|
|
738
|
+
return ApiResponse(error=e)
|
|
739
|
+
|
|
740
|
+
|
|
24
741
|
class CyberdeskClient:
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"""Synchronous: Execute a bash command on the desktop."""
|
|
69
|
-
body = PostV1DesktopIdBashActionBody(command=command)
|
|
70
|
-
return post_v1_desktop_id_bash_action.sync(id=id, client=self.client, body=body, x_api_key=self.api_key)
|
|
71
|
-
|
|
72
|
-
async def async_execute_bash_action(self, id: GetDesktopParams, command: ExecuteBashActionParams):
|
|
73
|
-
"""Async: Execute a bash command on the desktop. Use with 'await'."""
|
|
74
|
-
body = PostV1DesktopIdBashActionBody(command=command)
|
|
75
|
-
return await post_v1_desktop_id_bash_action.asyncio(id=id, client=self.client, body=body, x_api_key=self.api_key)
|
|
742
|
+
"""Main Cyberdesk SDK client."""
|
|
743
|
+
|
|
744
|
+
def __init__(self, api_key: str, base_url: str = DEFAULT_API_BASE_URL):
|
|
745
|
+
"""Initialize the Cyberdesk client.
|
|
746
|
+
|
|
747
|
+
Args:
|
|
748
|
+
api_key: Your Cyberdesk API key
|
|
749
|
+
base_url: API base URL (defaults to https://api.cyberdesk.io)
|
|
750
|
+
"""
|
|
751
|
+
# Create the underlying client with authentication
|
|
752
|
+
self._client = AuthenticatedClient(
|
|
753
|
+
base_url=base_url,
|
|
754
|
+
token=api_key,
|
|
755
|
+
prefix="Bearer",
|
|
756
|
+
auth_header_name="Authorization"
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
# Initialize API endpoints
|
|
760
|
+
self.machines = MachinesAPI(self._client)
|
|
761
|
+
self.workflows = WorkflowsAPI(self._client)
|
|
762
|
+
self.runs = RunsAPI(self._client)
|
|
763
|
+
self.connections = ConnectionsAPI(self._client)
|
|
764
|
+
self.trajectories = TrajectoriesAPI(self._client)
|
|
765
|
+
|
|
766
|
+
# TODO: Add computer API for screenshot functionality
|
|
767
|
+
# The openapi-python-client doesn't generate code for binary responses like PNG images
|
|
768
|
+
# To add screenshot support, implement a ComputerAPI class that:
|
|
769
|
+
# - Makes raw HTTP GET request to /v1/computer/{machine_id}/display/screenshot
|
|
770
|
+
# - Returns the PNG image bytes
|
|
771
|
+
# Example: self.computer = ComputerAPI(self._client)
|
|
772
|
+
|
|
773
|
+
def __enter__(self):
|
|
774
|
+
"""Context manager entry."""
|
|
775
|
+
return self
|
|
776
|
+
|
|
777
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
778
|
+
"""Context manager exit."""
|
|
779
|
+
self.close()
|
|
780
|
+
|
|
781
|
+
def close(self):
|
|
782
|
+
"""Close the client connection."""
|
|
783
|
+
if hasattr(self._client, '__exit__'):
|
|
784
|
+
self._client.__exit__(None, None, None)
|