runloop_api_client 1.5.1__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.
Files changed (261) hide show
  1. runloop_api_client/__init__.py +95 -0
  2. runloop_api_client/_base_client.py +2127 -0
  3. runloop_api_client/_client.py +866 -0
  4. runloop_api_client/_compat.py +219 -0
  5. runloop_api_client/_constants.py +23 -0
  6. runloop_api_client/_exceptions.py +108 -0
  7. runloop_api_client/_files.py +123 -0
  8. runloop_api_client/_models.py +872 -0
  9. runloop_api_client/_qs.py +150 -0
  10. runloop_api_client/_resource.py +43 -0
  11. runloop_api_client/_response.py +832 -0
  12. runloop_api_client/_streaming.py +518 -0
  13. runloop_api_client/_types.py +270 -0
  14. runloop_api_client/_utils/__init__.py +65 -0
  15. runloop_api_client/_utils/_compat.py +45 -0
  16. runloop_api_client/_utils/_datetime_parse.py +136 -0
  17. runloop_api_client/_utils/_json.py +35 -0
  18. runloop_api_client/_utils/_logs.py +25 -0
  19. runloop_api_client/_utils/_proxy.py +65 -0
  20. runloop_api_client/_utils/_reflection.py +42 -0
  21. runloop_api_client/_utils/_resources_proxy.py +24 -0
  22. runloop_api_client/_utils/_streams.py +12 -0
  23. runloop_api_client/_utils/_sync.py +58 -0
  24. runloop_api_client/_utils/_transform.py +457 -0
  25. runloop_api_client/_utils/_typing.py +156 -0
  26. runloop_api_client/_utils/_utils.py +421 -0
  27. runloop_api_client/_utils/_validation.py +31 -0
  28. runloop_api_client/_version.py +4 -0
  29. runloop_api_client/lib/.keep +4 -0
  30. runloop_api_client/lib/__init__.py +3 -0
  31. runloop_api_client/lib/_ignore.py +496 -0
  32. runloop_api_client/lib/context_loader.py +78 -0
  33. runloop_api_client/lib/polling.py +75 -0
  34. runloop_api_client/lib/polling_async.py +60 -0
  35. runloop_api_client/pagination.py +986 -0
  36. runloop_api_client/py.typed +0 -0
  37. runloop_api_client/resources/__init__.py +173 -0
  38. runloop_api_client/resources/agents.py +431 -0
  39. runloop_api_client/resources/benchmark_jobs.py +394 -0
  40. runloop_api_client/resources/benchmark_runs.py +595 -0
  41. runloop_api_client/resources/benchmarks.py +1085 -0
  42. runloop_api_client/resources/blueprints.py +1563 -0
  43. runloop_api_client/resources/devboxes/__init__.py +89 -0
  44. runloop_api_client/resources/devboxes/browsers.py +267 -0
  45. runloop_api_client/resources/devboxes/computers.py +648 -0
  46. runloop_api_client/resources/devboxes/devboxes.py +3784 -0
  47. runloop_api_client/resources/devboxes/disk_snapshots.py +602 -0
  48. runloop_api_client/resources/devboxes/executions.py +1212 -0
  49. runloop_api_client/resources/devboxes/logs.py +197 -0
  50. runloop_api_client/resources/gateway_configs.py +658 -0
  51. runloop_api_client/resources/network_policies.py +680 -0
  52. runloop_api_client/resources/objects.py +870 -0
  53. runloop_api_client/resources/repositories.py +918 -0
  54. runloop_api_client/resources/scenarios/__init__.py +47 -0
  55. runloop_api_client/resources/scenarios/runs.py +973 -0
  56. runloop_api_client/resources/scenarios/scenarios.py +1101 -0
  57. runloop_api_client/resources/scenarios/scorers.py +629 -0
  58. runloop_api_client/resources/secrets.py +500 -0
  59. runloop_api_client/sdk/__init__.py +117 -0
  60. runloop_api_client/sdk/_helpers.py +49 -0
  61. runloop_api_client/sdk/_types.py +264 -0
  62. runloop_api_client/sdk/agent.py +70 -0
  63. runloop_api_client/sdk/async_.py +1036 -0
  64. runloop_api_client/sdk/async_agent.py +70 -0
  65. runloop_api_client/sdk/async_benchmark.py +169 -0
  66. runloop_api_client/sdk/async_benchmark_run.py +127 -0
  67. runloop_api_client/sdk/async_blueprint.py +104 -0
  68. runloop_api_client/sdk/async_devbox.py +797 -0
  69. runloop_api_client/sdk/async_execution.py +144 -0
  70. runloop_api_client/sdk/async_execution_result.py +175 -0
  71. runloop_api_client/sdk/async_network_policy.py +80 -0
  72. runloop_api_client/sdk/async_scenario.py +118 -0
  73. runloop_api_client/sdk/async_scenario_builder.py +480 -0
  74. runloop_api_client/sdk/async_scenario_run.py +242 -0
  75. runloop_api_client/sdk/async_scorer.py +77 -0
  76. runloop_api_client/sdk/async_snapshot.py +125 -0
  77. runloop_api_client/sdk/async_storage_object.py +188 -0
  78. runloop_api_client/sdk/benchmark.py +167 -0
  79. runloop_api_client/sdk/benchmark_run.py +127 -0
  80. runloop_api_client/sdk/blueprint.py +104 -0
  81. runloop_api_client/sdk/devbox.py +800 -0
  82. runloop_api_client/sdk/execution.py +132 -0
  83. runloop_api_client/sdk/execution_result.py +173 -0
  84. runloop_api_client/sdk/network_policy.py +80 -0
  85. runloop_api_client/sdk/scenario.py +118 -0
  86. runloop_api_client/sdk/scenario_builder.py +480 -0
  87. runloop_api_client/sdk/scenario_run.py +242 -0
  88. runloop_api_client/sdk/scorer.py +77 -0
  89. runloop_api_client/sdk/snapshot.py +125 -0
  90. runloop_api_client/sdk/storage_object.py +188 -0
  91. runloop_api_client/sdk/sync.py +1061 -0
  92. runloop_api_client/types/__init__.py +130 -0
  93. runloop_api_client/types/agent_create_params.py +21 -0
  94. runloop_api_client/types/agent_list_params.py +27 -0
  95. runloop_api_client/types/agent_list_view.py +24 -0
  96. runloop_api_client/types/agent_view.py +30 -0
  97. runloop_api_client/types/benchmark_create_params.py +40 -0
  98. runloop_api_client/types/benchmark_definitions_params.py +15 -0
  99. runloop_api_client/types/benchmark_job_create_params.py +220 -0
  100. runloop_api_client/types/benchmark_job_list_params.py +18 -0
  101. runloop_api_client/types/benchmark_job_list_view.py +19 -0
  102. runloop_api_client/types/benchmark_job_view.py +344 -0
  103. runloop_api_client/types/benchmark_list_params.py +18 -0
  104. runloop_api_client/types/benchmark_list_public_params.py +15 -0
  105. runloop_api_client/types/benchmark_run_list_params.py +21 -0
  106. runloop_api_client/types/benchmark_run_list_scenario_runs_params.py +18 -0
  107. runloop_api_client/types/benchmark_run_list_view.py +19 -0
  108. runloop_api_client/types/benchmark_run_view.py +58 -0
  109. runloop_api_client/types/benchmark_start_run_params.py +29 -0
  110. runloop_api_client/types/benchmark_update_params.py +42 -0
  111. runloop_api_client/types/benchmark_update_scenarios_params.py +18 -0
  112. runloop_api_client/types/benchmark_view.py +49 -0
  113. runloop_api_client/types/blueprint_build_log.py +16 -0
  114. runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
  115. runloop_api_client/types/blueprint_build_parameters.py +119 -0
  116. runloop_api_client/types/blueprint_create_from_inspection_params.py +49 -0
  117. runloop_api_client/types/blueprint_create_params.py +121 -0
  118. runloop_api_client/types/blueprint_list_params.py +21 -0
  119. runloop_api_client/types/blueprint_list_public_params.py +21 -0
  120. runloop_api_client/types/blueprint_list_view.py +19 -0
  121. runloop_api_client/types/blueprint_preview_params.py +121 -0
  122. runloop_api_client/types/blueprint_preview_view.py +10 -0
  123. runloop_api_client/types/blueprint_view.py +93 -0
  124. runloop_api_client/types/devbox_async_execution_detail_view.py +46 -0
  125. runloop_api_client/types/devbox_create_params.py +124 -0
  126. runloop_api_client/types/devbox_create_ssh_key_response.py +19 -0
  127. runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
  128. runloop_api_client/types/devbox_download_file_params.py +15 -0
  129. runloop_api_client/types/devbox_enable_tunnel_params.py +13 -0
  130. runloop_api_client/types/devbox_execute_async_params.py +33 -0
  131. runloop_api_client/types/devbox_execute_params.py +37 -0
  132. runloop_api_client/types/devbox_execute_sync_params.py +31 -0
  133. runloop_api_client/types/devbox_execution_detail_view.py +24 -0
  134. runloop_api_client/types/devbox_list_disk_snapshots_params.py +32 -0
  135. runloop_api_client/types/devbox_list_params.py +20 -0
  136. runloop_api_client/types/devbox_list_view.py +19 -0
  137. runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
  138. runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
  139. runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
  140. runloop_api_client/types/devbox_send_std_in_result.py +16 -0
  141. runloop_api_client/types/devbox_snapshot_disk_async_params.py +19 -0
  142. runloop_api_client/types/devbox_snapshot_disk_params.py +19 -0
  143. runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
  144. runloop_api_client/types/devbox_snapshot_view.py +30 -0
  145. runloop_api_client/types/devbox_tunnel_view.py +16 -0
  146. runloop_api_client/types/devbox_update_params.py +16 -0
  147. runloop_api_client/types/devbox_upload_file_params.py +19 -0
  148. runloop_api_client/types/devbox_view.py +121 -0
  149. runloop_api_client/types/devbox_wait_for_command_params.py +28 -0
  150. runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
  151. runloop_api_client/types/devboxes/__init__.py +33 -0
  152. runloop_api_client/types/devboxes/browser_create_params.py +13 -0
  153. runloop_api_client/types/devboxes/browser_view.py +29 -0
  154. runloop_api_client/types/devboxes/computer_create_params.py +26 -0
  155. runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
  156. runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
  157. runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +35 -0
  158. runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
  159. runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
  160. runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
  161. runloop_api_client/types/devboxes/computer_view.py +23 -0
  162. runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
  163. runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
  164. runloop_api_client/types/devboxes/disk_snapshot_list_params.py +32 -0
  165. runloop_api_client/types/devboxes/disk_snapshot_update_params.py +19 -0
  166. runloop_api_client/types/devboxes/execution_execute_async_params.py +31 -0
  167. runloop_api_client/types/devboxes/execution_execute_sync_params.py +31 -0
  168. runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
  169. runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
  170. runloop_api_client/types/devboxes/execution_send_std_in_params.py +18 -0
  171. runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +17 -0
  172. runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +17 -0
  173. runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
  174. runloop_api_client/types/devboxes/log_list_params.py +15 -0
  175. runloop_api_client/types/gateway_config_create_params.py +41 -0
  176. runloop_api_client/types/gateway_config_list_params.py +21 -0
  177. runloop_api_client/types/gateway_config_list_view.py +21 -0
  178. runloop_api_client/types/gateway_config_update_params.py +32 -0
  179. runloop_api_client/types/gateway_config_view.py +47 -0
  180. runloop_api_client/types/input_context.py +19 -0
  181. runloop_api_client/types/input_context_param.py +20 -0
  182. runloop_api_client/types/input_context_update_param.py +16 -0
  183. runloop_api_client/types/inspection_source_param.py +18 -0
  184. runloop_api_client/types/network_policy_create_params.py +40 -0
  185. runloop_api_client/types/network_policy_list_params.py +21 -0
  186. runloop_api_client/types/network_policy_list_view.py +21 -0
  187. runloop_api_client/types/network_policy_update_params.py +30 -0
  188. runloop_api_client/types/network_policy_view.py +52 -0
  189. runloop_api_client/types/object_create_params.py +30 -0
  190. runloop_api_client/types/object_download_params.py +12 -0
  191. runloop_api_client/types/object_download_url_view.py +12 -0
  192. runloop_api_client/types/object_list_params.py +27 -0
  193. runloop_api_client/types/object_list_public_params.py +27 -0
  194. runloop_api_client/types/object_list_view.py +24 -0
  195. runloop_api_client/types/object_view.py +36 -0
  196. runloop_api_client/types/repository_connection_list_view.py +19 -0
  197. runloop_api_client/types/repository_connection_view.py +18 -0
  198. runloop_api_client/types/repository_create_params.py +22 -0
  199. runloop_api_client/types/repository_inspect_params.py +13 -0
  200. runloop_api_client/types/repository_inspection_details.py +83 -0
  201. runloop_api_client/types/repository_inspection_list_view.py +13 -0
  202. runloop_api_client/types/repository_list_params.py +21 -0
  203. runloop_api_client/types/repository_manifest_view.py +174 -0
  204. runloop_api_client/types/repository_refresh_params.py +16 -0
  205. runloop_api_client/types/scenario_create_params.py +53 -0
  206. runloop_api_client/types/scenario_definition_list_view.py +19 -0
  207. runloop_api_client/types/scenario_environment.py +29 -0
  208. runloop_api_client/types/scenario_environment_param.py +31 -0
  209. runloop_api_client/types/scenario_list_params.py +24 -0
  210. runloop_api_client/types/scenario_list_public_params.py +18 -0
  211. runloop_api_client/types/scenario_run_list_view.py +19 -0
  212. runloop_api_client/types/scenario_run_view.py +55 -0
  213. runloop_api_client/types/scenario_start_run_params.py +30 -0
  214. runloop_api_client/types/scenario_update_params.py +49 -0
  215. runloop_api_client/types/scenario_view.py +61 -0
  216. runloop_api_client/types/scenarios/__init__.py +14 -0
  217. runloop_api_client/types/scenarios/run_list_params.py +27 -0
  218. runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
  219. runloop_api_client/types/scenarios/scorer_create_response.py +18 -0
  220. runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
  221. runloop_api_client/types/scenarios/scorer_list_response.py +18 -0
  222. runloop_api_client/types/scenarios/scorer_retrieve_response.py +18 -0
  223. runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
  224. runloop_api_client/types/scenarios/scorer_update_response.py +18 -0
  225. runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
  226. runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
  227. runloop_api_client/types/scoring_contract.py +17 -0
  228. runloop_api_client/types/scoring_contract_param.py +19 -0
  229. runloop_api_client/types/scoring_contract_result_view.py +20 -0
  230. runloop_api_client/types/scoring_contract_update_param.py +15 -0
  231. runloop_api_client/types/scoring_function.py +157 -0
  232. runloop_api_client/types/scoring_function_param.py +153 -0
  233. runloop_api_client/types/scoring_function_result_view.py +25 -0
  234. runloop_api_client/types/secret_create_params.py +23 -0
  235. runloop_api_client/types/secret_list_params.py +12 -0
  236. runloop_api_client/types/secret_list_view.py +24 -0
  237. runloop_api_client/types/secret_update_params.py +16 -0
  238. runloop_api_client/types/secret_view.py +26 -0
  239. runloop_api_client/types/shared/__init__.py +10 -0
  240. runloop_api_client/types/shared/after_idle.py +15 -0
  241. runloop_api_client/types/shared/agent_mount.py +31 -0
  242. runloop_api_client/types/shared/agent_source.py +75 -0
  243. runloop_api_client/types/shared/code_mount_parameters.py +24 -0
  244. runloop_api_client/types/shared/launch_parameters.py +86 -0
  245. runloop_api_client/types/shared/mount.py +43 -0
  246. runloop_api_client/types/shared/object_mount.py +21 -0
  247. runloop_api_client/types/shared/run_profile.py +37 -0
  248. runloop_api_client/types/shared_params/__init__.py +10 -0
  249. runloop_api_client/types/shared_params/after_idle.py +15 -0
  250. runloop_api_client/types/shared_params/agent_mount.py +31 -0
  251. runloop_api_client/types/shared_params/agent_source.py +78 -0
  252. runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
  253. runloop_api_client/types/shared_params/launch_parameters.py +88 -0
  254. runloop_api_client/types/shared_params/mount.py +43 -0
  255. runloop_api_client/types/shared_params/object_mount.py +21 -0
  256. runloop_api_client/types/shared_params/run_profile.py +38 -0
  257. runloop_api_client/types/tunnel_view.py +34 -0
  258. runloop_api_client-1.5.1.dist-info/METADATA +522 -0
  259. runloop_api_client-1.5.1.dist-info/RECORD +261 -0
  260. runloop_api_client-1.5.1.dist-info/WHEEL +4 -0
  261. runloop_api_client-1.5.1.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,648 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from ..._utils import maybe_transform, async_maybe_transform
12
+ from ..._compat import cached_property
13
+ from ..._resource import SyncAPIResource, AsyncAPIResource
14
+ from ..._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ..._base_client import make_request_options
21
+ from ...types.devboxes import (
22
+ computer_create_params,
23
+ computer_mouse_interaction_params,
24
+ computer_screen_interaction_params,
25
+ computer_keyboard_interaction_params,
26
+ )
27
+ from ...types.devboxes.computer_view import ComputerView
28
+ from ...types.devboxes.computer_mouse_interaction_response import ComputerMouseInteractionResponse
29
+ from ...types.devboxes.computer_screen_interaction_response import ComputerScreenInteractionResponse
30
+ from ...types.devboxes.computer_keyboard_interaction_response import ComputerKeyboardInteractionResponse
31
+
32
+ __all__ = ["ComputersResource", "AsyncComputersResource"]
33
+
34
+
35
+ class ComputersResource(SyncAPIResource):
36
+ @cached_property
37
+ def with_raw_response(self) -> ComputersResourceWithRawResponse:
38
+ """
39
+ This property can be used as a prefix for any HTTP method call to return
40
+ the raw response object instead of the parsed content.
41
+
42
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
43
+ """
44
+ return ComputersResourceWithRawResponse(self)
45
+
46
+ @cached_property
47
+ def with_streaming_response(self) -> ComputersResourceWithStreamingResponse:
48
+ """
49
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
50
+
51
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
52
+ """
53
+ return ComputersResourceWithStreamingResponse(self)
54
+
55
+ def create(
56
+ self,
57
+ *,
58
+ display_dimensions: Optional[computer_create_params.DisplayDimensions] | Omit = omit,
59
+ name: Optional[str] | Omit = omit,
60
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
+ # The extra values given here take precedence over values defined on the client or passed to this method.
62
+ extra_headers: Headers | None = None,
63
+ extra_query: Query | None = None,
64
+ extra_body: Body | None = None,
65
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
66
+ idempotency_key: str | None = None,
67
+ ) -> ComputerView:
68
+ """Create a Computer and begin the boot process.
69
+
70
+ The Computer will initially launch
71
+ in the 'provisioning' state while Runloop allocates the necessary
72
+ infrastructure. It will transition to the 'initializing' state while the booted
73
+ Computer runs any Runloop or user defined set up scripts. Finally, the Computer
74
+ will transition to the 'running' state when it is ready for use.
75
+
76
+ Args:
77
+ display_dimensions: Customize the dimensions of the computer display.
78
+
79
+ name: The name to use for the created computer.
80
+
81
+ extra_headers: Send extra headers
82
+
83
+ extra_query: Add additional query parameters to the request
84
+
85
+ extra_body: Add additional JSON properties to the request
86
+
87
+ timeout: Override the client-level default timeout for this request, in seconds
88
+
89
+ idempotency_key: Specify a custom idempotency key for this request
90
+ """
91
+ return self._post(
92
+ "/v1/devboxes/computers",
93
+ body=maybe_transform(
94
+ {
95
+ "display_dimensions": display_dimensions,
96
+ "name": name,
97
+ },
98
+ computer_create_params.ComputerCreateParams,
99
+ ),
100
+ options=make_request_options(
101
+ extra_headers=extra_headers,
102
+ extra_query=extra_query,
103
+ extra_body=extra_body,
104
+ timeout=timeout,
105
+ idempotency_key=idempotency_key,
106
+ ),
107
+ cast_to=ComputerView,
108
+ )
109
+
110
+ def retrieve(
111
+ self,
112
+ id: str,
113
+ *,
114
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
115
+ # The extra values given here take precedence over values defined on the client or passed to this method.
116
+ extra_headers: Headers | None = None,
117
+ extra_query: Query | None = None,
118
+ extra_body: Body | None = None,
119
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
120
+ ) -> ComputerView:
121
+ """
122
+ Get Computer Details.
123
+
124
+ Args:
125
+ extra_headers: Send extra headers
126
+
127
+ extra_query: Add additional query parameters to the request
128
+
129
+ extra_body: Add additional JSON properties to the request
130
+
131
+ timeout: Override the client-level default timeout for this request, in seconds
132
+ """
133
+ if not id:
134
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
135
+ return self._get(
136
+ f"/v1/devboxes/computers/{id}",
137
+ options=make_request_options(
138
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
139
+ ),
140
+ cast_to=ComputerView,
141
+ )
142
+
143
+ def keyboard_interaction(
144
+ self,
145
+ id: str,
146
+ *,
147
+ action: Literal["key", "type"],
148
+ text: Optional[str] | Omit = omit,
149
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
150
+ # The extra values given here take precedence over values defined on the client or passed to this method.
151
+ extra_headers: Headers | None = None,
152
+ extra_query: Query | None = None,
153
+ extra_body: Body | None = None,
154
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
155
+ idempotency_key: str | None = None,
156
+ ) -> ComputerKeyboardInteractionResponse:
157
+ """
158
+ Perform the specified keyboard interaction on the Computer identified by the
159
+ given ID.
160
+
161
+ Args:
162
+ action: The keyboard action to perform.
163
+
164
+ text: The text to type or the key (with optional modifier) to press.
165
+
166
+ extra_headers: Send extra headers
167
+
168
+ extra_query: Add additional query parameters to the request
169
+
170
+ extra_body: Add additional JSON properties to the request
171
+
172
+ timeout: Override the client-level default timeout for this request, in seconds
173
+
174
+ idempotency_key: Specify a custom idempotency key for this request
175
+ """
176
+ if not id:
177
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
178
+ return self._post(
179
+ f"/v1/devboxes/computers/{id}/keyboard_interaction",
180
+ body=maybe_transform(
181
+ {
182
+ "action": action,
183
+ "text": text,
184
+ },
185
+ computer_keyboard_interaction_params.ComputerKeyboardInteractionParams,
186
+ ),
187
+ options=make_request_options(
188
+ extra_headers=extra_headers,
189
+ extra_query=extra_query,
190
+ extra_body=extra_body,
191
+ timeout=timeout,
192
+ idempotency_key=idempotency_key,
193
+ ),
194
+ cast_to=ComputerKeyboardInteractionResponse,
195
+ )
196
+
197
+ def mouse_interaction(
198
+ self,
199
+ id: str,
200
+ *,
201
+ action: Literal["mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click"],
202
+ coordinate: Optional[computer_mouse_interaction_params.Coordinate] | Omit = omit,
203
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
204
+ # The extra values given here take precedence over values defined on the client or passed to this method.
205
+ extra_headers: Headers | None = None,
206
+ extra_query: Query | None = None,
207
+ extra_body: Body | None = None,
208
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
209
+ idempotency_key: str | None = None,
210
+ ) -> ComputerMouseInteractionResponse:
211
+ """
212
+ Perform the specified mouse interaction on the Computer identified by the given
213
+ ID.
214
+
215
+ Args:
216
+ action: The mouse action to perform.
217
+
218
+ coordinate: The x (pixels from the left) and y (pixels from the top) coordinates for the
219
+ mouse to move or click-drag. Required only by `action=mouse_move` or
220
+ `action=left_click_drag`
221
+
222
+ extra_headers: Send extra headers
223
+
224
+ extra_query: Add additional query parameters to the request
225
+
226
+ extra_body: Add additional JSON properties to the request
227
+
228
+ timeout: Override the client-level default timeout for this request, in seconds
229
+
230
+ idempotency_key: Specify a custom idempotency key for this request
231
+ """
232
+ if not id:
233
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
234
+ return self._post(
235
+ f"/v1/devboxes/computers/{id}/mouse_interaction",
236
+ body=maybe_transform(
237
+ {
238
+ "action": action,
239
+ "coordinate": coordinate,
240
+ },
241
+ computer_mouse_interaction_params.ComputerMouseInteractionParams,
242
+ ),
243
+ options=make_request_options(
244
+ extra_headers=extra_headers,
245
+ extra_query=extra_query,
246
+ extra_body=extra_body,
247
+ timeout=timeout,
248
+ idempotency_key=idempotency_key,
249
+ ),
250
+ cast_to=ComputerMouseInteractionResponse,
251
+ )
252
+
253
+ def screen_interaction(
254
+ self,
255
+ id: str,
256
+ *,
257
+ action: Literal["screenshot", "cursor_position"],
258
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
259
+ # The extra values given here take precedence over values defined on the client or passed to this method.
260
+ extra_headers: Headers | None = None,
261
+ extra_query: Query | None = None,
262
+ extra_body: Body | None = None,
263
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
264
+ idempotency_key: str | None = None,
265
+ ) -> ComputerScreenInteractionResponse:
266
+ """
267
+ Perform the specified screen interaction on the Computer identified by the given
268
+ ID.
269
+
270
+ Args:
271
+ action: The screen action to perform.
272
+
273
+ extra_headers: Send extra headers
274
+
275
+ extra_query: Add additional query parameters to the request
276
+
277
+ extra_body: Add additional JSON properties to the request
278
+
279
+ timeout: Override the client-level default timeout for this request, in seconds
280
+
281
+ idempotency_key: Specify a custom idempotency key for this request
282
+ """
283
+ if not id:
284
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
285
+ return self._post(
286
+ f"/v1/devboxes/computers/{id}/screen_interaction",
287
+ body=maybe_transform(
288
+ {"action": action}, computer_screen_interaction_params.ComputerScreenInteractionParams
289
+ ),
290
+ options=make_request_options(
291
+ extra_headers=extra_headers,
292
+ extra_query=extra_query,
293
+ extra_body=extra_body,
294
+ timeout=timeout,
295
+ idempotency_key=idempotency_key,
296
+ ),
297
+ cast_to=ComputerScreenInteractionResponse,
298
+ )
299
+
300
+
301
+ class AsyncComputersResource(AsyncAPIResource):
302
+ @cached_property
303
+ def with_raw_response(self) -> AsyncComputersResourceWithRawResponse:
304
+ """
305
+ This property can be used as a prefix for any HTTP method call to return
306
+ the raw response object instead of the parsed content.
307
+
308
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
309
+ """
310
+ return AsyncComputersResourceWithRawResponse(self)
311
+
312
+ @cached_property
313
+ def with_streaming_response(self) -> AsyncComputersResourceWithStreamingResponse:
314
+ """
315
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
316
+
317
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
318
+ """
319
+ return AsyncComputersResourceWithStreamingResponse(self)
320
+
321
+ async def create(
322
+ self,
323
+ *,
324
+ display_dimensions: Optional[computer_create_params.DisplayDimensions] | Omit = omit,
325
+ name: Optional[str] | Omit = omit,
326
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
327
+ # The extra values given here take precedence over values defined on the client or passed to this method.
328
+ extra_headers: Headers | None = None,
329
+ extra_query: Query | None = None,
330
+ extra_body: Body | None = None,
331
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
332
+ idempotency_key: str | None = None,
333
+ ) -> ComputerView:
334
+ """Create a Computer and begin the boot process.
335
+
336
+ The Computer will initially launch
337
+ in the 'provisioning' state while Runloop allocates the necessary
338
+ infrastructure. It will transition to the 'initializing' state while the booted
339
+ Computer runs any Runloop or user defined set up scripts. Finally, the Computer
340
+ will transition to the 'running' state when it is ready for use.
341
+
342
+ Args:
343
+ display_dimensions: Customize the dimensions of the computer display.
344
+
345
+ name: The name to use for the created computer.
346
+
347
+ extra_headers: Send extra headers
348
+
349
+ extra_query: Add additional query parameters to the request
350
+
351
+ extra_body: Add additional JSON properties to the request
352
+
353
+ timeout: Override the client-level default timeout for this request, in seconds
354
+
355
+ idempotency_key: Specify a custom idempotency key for this request
356
+ """
357
+ return await self._post(
358
+ "/v1/devboxes/computers",
359
+ body=await async_maybe_transform(
360
+ {
361
+ "display_dimensions": display_dimensions,
362
+ "name": name,
363
+ },
364
+ computer_create_params.ComputerCreateParams,
365
+ ),
366
+ options=make_request_options(
367
+ extra_headers=extra_headers,
368
+ extra_query=extra_query,
369
+ extra_body=extra_body,
370
+ timeout=timeout,
371
+ idempotency_key=idempotency_key,
372
+ ),
373
+ cast_to=ComputerView,
374
+ )
375
+
376
+ async def retrieve(
377
+ self,
378
+ id: str,
379
+ *,
380
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
381
+ # The extra values given here take precedence over values defined on the client or passed to this method.
382
+ extra_headers: Headers | None = None,
383
+ extra_query: Query | None = None,
384
+ extra_body: Body | None = None,
385
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
386
+ ) -> ComputerView:
387
+ """
388
+ Get Computer Details.
389
+
390
+ Args:
391
+ extra_headers: Send extra headers
392
+
393
+ extra_query: Add additional query parameters to the request
394
+
395
+ extra_body: Add additional JSON properties to the request
396
+
397
+ timeout: Override the client-level default timeout for this request, in seconds
398
+ """
399
+ if not id:
400
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
401
+ return await self._get(
402
+ f"/v1/devboxes/computers/{id}",
403
+ options=make_request_options(
404
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
405
+ ),
406
+ cast_to=ComputerView,
407
+ )
408
+
409
+ async def keyboard_interaction(
410
+ self,
411
+ id: str,
412
+ *,
413
+ action: Literal["key", "type"],
414
+ text: Optional[str] | Omit = omit,
415
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
416
+ # The extra values given here take precedence over values defined on the client or passed to this method.
417
+ extra_headers: Headers | None = None,
418
+ extra_query: Query | None = None,
419
+ extra_body: Body | None = None,
420
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
421
+ idempotency_key: str | None = None,
422
+ ) -> ComputerKeyboardInteractionResponse:
423
+ """
424
+ Perform the specified keyboard interaction on the Computer identified by the
425
+ given ID.
426
+
427
+ Args:
428
+ action: The keyboard action to perform.
429
+
430
+ text: The text to type or the key (with optional modifier) to press.
431
+
432
+ extra_headers: Send extra headers
433
+
434
+ extra_query: Add additional query parameters to the request
435
+
436
+ extra_body: Add additional JSON properties to the request
437
+
438
+ timeout: Override the client-level default timeout for this request, in seconds
439
+
440
+ idempotency_key: Specify a custom idempotency key for this request
441
+ """
442
+ if not id:
443
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
444
+ return await self._post(
445
+ f"/v1/devboxes/computers/{id}/keyboard_interaction",
446
+ body=await async_maybe_transform(
447
+ {
448
+ "action": action,
449
+ "text": text,
450
+ },
451
+ computer_keyboard_interaction_params.ComputerKeyboardInteractionParams,
452
+ ),
453
+ options=make_request_options(
454
+ extra_headers=extra_headers,
455
+ extra_query=extra_query,
456
+ extra_body=extra_body,
457
+ timeout=timeout,
458
+ idempotency_key=idempotency_key,
459
+ ),
460
+ cast_to=ComputerKeyboardInteractionResponse,
461
+ )
462
+
463
+ async def mouse_interaction(
464
+ self,
465
+ id: str,
466
+ *,
467
+ action: Literal["mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click"],
468
+ coordinate: Optional[computer_mouse_interaction_params.Coordinate] | Omit = omit,
469
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
470
+ # The extra values given here take precedence over values defined on the client or passed to this method.
471
+ extra_headers: Headers | None = None,
472
+ extra_query: Query | None = None,
473
+ extra_body: Body | None = None,
474
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
475
+ idempotency_key: str | None = None,
476
+ ) -> ComputerMouseInteractionResponse:
477
+ """
478
+ Perform the specified mouse interaction on the Computer identified by the given
479
+ ID.
480
+
481
+ Args:
482
+ action: The mouse action to perform.
483
+
484
+ coordinate: The x (pixels from the left) and y (pixels from the top) coordinates for the
485
+ mouse to move or click-drag. Required only by `action=mouse_move` or
486
+ `action=left_click_drag`
487
+
488
+ extra_headers: Send extra headers
489
+
490
+ extra_query: Add additional query parameters to the request
491
+
492
+ extra_body: Add additional JSON properties to the request
493
+
494
+ timeout: Override the client-level default timeout for this request, in seconds
495
+
496
+ idempotency_key: Specify a custom idempotency key for this request
497
+ """
498
+ if not id:
499
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
500
+ return await self._post(
501
+ f"/v1/devboxes/computers/{id}/mouse_interaction",
502
+ body=await async_maybe_transform(
503
+ {
504
+ "action": action,
505
+ "coordinate": coordinate,
506
+ },
507
+ computer_mouse_interaction_params.ComputerMouseInteractionParams,
508
+ ),
509
+ options=make_request_options(
510
+ extra_headers=extra_headers,
511
+ extra_query=extra_query,
512
+ extra_body=extra_body,
513
+ timeout=timeout,
514
+ idempotency_key=idempotency_key,
515
+ ),
516
+ cast_to=ComputerMouseInteractionResponse,
517
+ )
518
+
519
+ async def screen_interaction(
520
+ self,
521
+ id: str,
522
+ *,
523
+ action: Literal["screenshot", "cursor_position"],
524
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
525
+ # The extra values given here take precedence over values defined on the client or passed to this method.
526
+ extra_headers: Headers | None = None,
527
+ extra_query: Query | None = None,
528
+ extra_body: Body | None = None,
529
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
530
+ idempotency_key: str | None = None,
531
+ ) -> ComputerScreenInteractionResponse:
532
+ """
533
+ Perform the specified screen interaction on the Computer identified by the given
534
+ ID.
535
+
536
+ Args:
537
+ action: The screen action to perform.
538
+
539
+ extra_headers: Send extra headers
540
+
541
+ extra_query: Add additional query parameters to the request
542
+
543
+ extra_body: Add additional JSON properties to the request
544
+
545
+ timeout: Override the client-level default timeout for this request, in seconds
546
+
547
+ idempotency_key: Specify a custom idempotency key for this request
548
+ """
549
+ if not id:
550
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
551
+ return await self._post(
552
+ f"/v1/devboxes/computers/{id}/screen_interaction",
553
+ body=await async_maybe_transform(
554
+ {"action": action}, computer_screen_interaction_params.ComputerScreenInteractionParams
555
+ ),
556
+ options=make_request_options(
557
+ extra_headers=extra_headers,
558
+ extra_query=extra_query,
559
+ extra_body=extra_body,
560
+ timeout=timeout,
561
+ idempotency_key=idempotency_key,
562
+ ),
563
+ cast_to=ComputerScreenInteractionResponse,
564
+ )
565
+
566
+
567
+ class ComputersResourceWithRawResponse:
568
+ def __init__(self, computers: ComputersResource) -> None:
569
+ self._computers = computers
570
+
571
+ self.create = to_raw_response_wrapper(
572
+ computers.create,
573
+ )
574
+ self.retrieve = to_raw_response_wrapper(
575
+ computers.retrieve,
576
+ )
577
+ self.keyboard_interaction = to_raw_response_wrapper(
578
+ computers.keyboard_interaction,
579
+ )
580
+ self.mouse_interaction = to_raw_response_wrapper(
581
+ computers.mouse_interaction,
582
+ )
583
+ self.screen_interaction = to_raw_response_wrapper(
584
+ computers.screen_interaction,
585
+ )
586
+
587
+
588
+ class AsyncComputersResourceWithRawResponse:
589
+ def __init__(self, computers: AsyncComputersResource) -> None:
590
+ self._computers = computers
591
+
592
+ self.create = async_to_raw_response_wrapper(
593
+ computers.create,
594
+ )
595
+ self.retrieve = async_to_raw_response_wrapper(
596
+ computers.retrieve,
597
+ )
598
+ self.keyboard_interaction = async_to_raw_response_wrapper(
599
+ computers.keyboard_interaction,
600
+ )
601
+ self.mouse_interaction = async_to_raw_response_wrapper(
602
+ computers.mouse_interaction,
603
+ )
604
+ self.screen_interaction = async_to_raw_response_wrapper(
605
+ computers.screen_interaction,
606
+ )
607
+
608
+
609
+ class ComputersResourceWithStreamingResponse:
610
+ def __init__(self, computers: ComputersResource) -> None:
611
+ self._computers = computers
612
+
613
+ self.create = to_streamed_response_wrapper(
614
+ computers.create,
615
+ )
616
+ self.retrieve = to_streamed_response_wrapper(
617
+ computers.retrieve,
618
+ )
619
+ self.keyboard_interaction = to_streamed_response_wrapper(
620
+ computers.keyboard_interaction,
621
+ )
622
+ self.mouse_interaction = to_streamed_response_wrapper(
623
+ computers.mouse_interaction,
624
+ )
625
+ self.screen_interaction = to_streamed_response_wrapper(
626
+ computers.screen_interaction,
627
+ )
628
+
629
+
630
+ class AsyncComputersResourceWithStreamingResponse:
631
+ def __init__(self, computers: AsyncComputersResource) -> None:
632
+ self._computers = computers
633
+
634
+ self.create = async_to_streamed_response_wrapper(
635
+ computers.create,
636
+ )
637
+ self.retrieve = async_to_streamed_response_wrapper(
638
+ computers.retrieve,
639
+ )
640
+ self.keyboard_interaction = async_to_streamed_response_wrapper(
641
+ computers.keyboard_interaction,
642
+ )
643
+ self.mouse_interaction = async_to_streamed_response_wrapper(
644
+ computers.mouse_interaction,
645
+ )
646
+ self.screen_interaction = async_to_streamed_response_wrapper(
647
+ computers.screen_interaction,
648
+ )