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.
- runloop_api_client/__init__.py +95 -0
- runloop_api_client/_base_client.py +2127 -0
- runloop_api_client/_client.py +866 -0
- runloop_api_client/_compat.py +219 -0
- runloop_api_client/_constants.py +23 -0
- runloop_api_client/_exceptions.py +108 -0
- runloop_api_client/_files.py +123 -0
- runloop_api_client/_models.py +872 -0
- runloop_api_client/_qs.py +150 -0
- runloop_api_client/_resource.py +43 -0
- runloop_api_client/_response.py +832 -0
- runloop_api_client/_streaming.py +518 -0
- runloop_api_client/_types.py +270 -0
- runloop_api_client/_utils/__init__.py +65 -0
- runloop_api_client/_utils/_compat.py +45 -0
- runloop_api_client/_utils/_datetime_parse.py +136 -0
- runloop_api_client/_utils/_json.py +35 -0
- runloop_api_client/_utils/_logs.py +25 -0
- runloop_api_client/_utils/_proxy.py +65 -0
- runloop_api_client/_utils/_reflection.py +42 -0
- runloop_api_client/_utils/_resources_proxy.py +24 -0
- runloop_api_client/_utils/_streams.py +12 -0
- runloop_api_client/_utils/_sync.py +58 -0
- runloop_api_client/_utils/_transform.py +457 -0
- runloop_api_client/_utils/_typing.py +156 -0
- runloop_api_client/_utils/_utils.py +421 -0
- runloop_api_client/_utils/_validation.py +31 -0
- runloop_api_client/_version.py +4 -0
- runloop_api_client/lib/.keep +4 -0
- runloop_api_client/lib/__init__.py +3 -0
- runloop_api_client/lib/_ignore.py +496 -0
- runloop_api_client/lib/context_loader.py +78 -0
- runloop_api_client/lib/polling.py +75 -0
- runloop_api_client/lib/polling_async.py +60 -0
- runloop_api_client/pagination.py +986 -0
- runloop_api_client/py.typed +0 -0
- runloop_api_client/resources/__init__.py +173 -0
- runloop_api_client/resources/agents.py +431 -0
- runloop_api_client/resources/benchmark_jobs.py +394 -0
- runloop_api_client/resources/benchmark_runs.py +595 -0
- runloop_api_client/resources/benchmarks.py +1085 -0
- runloop_api_client/resources/blueprints.py +1563 -0
- runloop_api_client/resources/devboxes/__init__.py +89 -0
- runloop_api_client/resources/devboxes/browsers.py +267 -0
- runloop_api_client/resources/devboxes/computers.py +648 -0
- runloop_api_client/resources/devboxes/devboxes.py +3784 -0
- runloop_api_client/resources/devboxes/disk_snapshots.py +602 -0
- runloop_api_client/resources/devboxes/executions.py +1212 -0
- runloop_api_client/resources/devboxes/logs.py +197 -0
- runloop_api_client/resources/gateway_configs.py +658 -0
- runloop_api_client/resources/network_policies.py +680 -0
- runloop_api_client/resources/objects.py +870 -0
- runloop_api_client/resources/repositories.py +918 -0
- runloop_api_client/resources/scenarios/__init__.py +47 -0
- runloop_api_client/resources/scenarios/runs.py +973 -0
- runloop_api_client/resources/scenarios/scenarios.py +1101 -0
- runloop_api_client/resources/scenarios/scorers.py +629 -0
- runloop_api_client/resources/secrets.py +500 -0
- runloop_api_client/sdk/__init__.py +117 -0
- runloop_api_client/sdk/_helpers.py +49 -0
- runloop_api_client/sdk/_types.py +264 -0
- runloop_api_client/sdk/agent.py +70 -0
- runloop_api_client/sdk/async_.py +1036 -0
- runloop_api_client/sdk/async_agent.py +70 -0
- runloop_api_client/sdk/async_benchmark.py +169 -0
- runloop_api_client/sdk/async_benchmark_run.py +127 -0
- runloop_api_client/sdk/async_blueprint.py +104 -0
- runloop_api_client/sdk/async_devbox.py +797 -0
- runloop_api_client/sdk/async_execution.py +144 -0
- runloop_api_client/sdk/async_execution_result.py +175 -0
- runloop_api_client/sdk/async_network_policy.py +80 -0
- runloop_api_client/sdk/async_scenario.py +118 -0
- runloop_api_client/sdk/async_scenario_builder.py +480 -0
- runloop_api_client/sdk/async_scenario_run.py +242 -0
- runloop_api_client/sdk/async_scorer.py +77 -0
- runloop_api_client/sdk/async_snapshot.py +125 -0
- runloop_api_client/sdk/async_storage_object.py +188 -0
- runloop_api_client/sdk/benchmark.py +167 -0
- runloop_api_client/sdk/benchmark_run.py +127 -0
- runloop_api_client/sdk/blueprint.py +104 -0
- runloop_api_client/sdk/devbox.py +800 -0
- runloop_api_client/sdk/execution.py +132 -0
- runloop_api_client/sdk/execution_result.py +173 -0
- runloop_api_client/sdk/network_policy.py +80 -0
- runloop_api_client/sdk/scenario.py +118 -0
- runloop_api_client/sdk/scenario_builder.py +480 -0
- runloop_api_client/sdk/scenario_run.py +242 -0
- runloop_api_client/sdk/scorer.py +77 -0
- runloop_api_client/sdk/snapshot.py +125 -0
- runloop_api_client/sdk/storage_object.py +188 -0
- runloop_api_client/sdk/sync.py +1061 -0
- runloop_api_client/types/__init__.py +130 -0
- runloop_api_client/types/agent_create_params.py +21 -0
- runloop_api_client/types/agent_list_params.py +27 -0
- runloop_api_client/types/agent_list_view.py +24 -0
- runloop_api_client/types/agent_view.py +30 -0
- runloop_api_client/types/benchmark_create_params.py +40 -0
- runloop_api_client/types/benchmark_definitions_params.py +15 -0
- runloop_api_client/types/benchmark_job_create_params.py +220 -0
- runloop_api_client/types/benchmark_job_list_params.py +18 -0
- runloop_api_client/types/benchmark_job_list_view.py +19 -0
- runloop_api_client/types/benchmark_job_view.py +344 -0
- runloop_api_client/types/benchmark_list_params.py +18 -0
- runloop_api_client/types/benchmark_list_public_params.py +15 -0
- runloop_api_client/types/benchmark_run_list_params.py +21 -0
- runloop_api_client/types/benchmark_run_list_scenario_runs_params.py +18 -0
- runloop_api_client/types/benchmark_run_list_view.py +19 -0
- runloop_api_client/types/benchmark_run_view.py +58 -0
- runloop_api_client/types/benchmark_start_run_params.py +29 -0
- runloop_api_client/types/benchmark_update_params.py +42 -0
- runloop_api_client/types/benchmark_update_scenarios_params.py +18 -0
- runloop_api_client/types/benchmark_view.py +49 -0
- runloop_api_client/types/blueprint_build_log.py +16 -0
- runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
- runloop_api_client/types/blueprint_build_parameters.py +119 -0
- runloop_api_client/types/blueprint_create_from_inspection_params.py +49 -0
- runloop_api_client/types/blueprint_create_params.py +121 -0
- runloop_api_client/types/blueprint_list_params.py +21 -0
- runloop_api_client/types/blueprint_list_public_params.py +21 -0
- runloop_api_client/types/blueprint_list_view.py +19 -0
- runloop_api_client/types/blueprint_preview_params.py +121 -0
- runloop_api_client/types/blueprint_preview_view.py +10 -0
- runloop_api_client/types/blueprint_view.py +93 -0
- runloop_api_client/types/devbox_async_execution_detail_view.py +46 -0
- runloop_api_client/types/devbox_create_params.py +124 -0
- runloop_api_client/types/devbox_create_ssh_key_response.py +19 -0
- runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
- runloop_api_client/types/devbox_download_file_params.py +15 -0
- runloop_api_client/types/devbox_enable_tunnel_params.py +13 -0
- runloop_api_client/types/devbox_execute_async_params.py +33 -0
- runloop_api_client/types/devbox_execute_params.py +37 -0
- runloop_api_client/types/devbox_execute_sync_params.py +31 -0
- runloop_api_client/types/devbox_execution_detail_view.py +24 -0
- runloop_api_client/types/devbox_list_disk_snapshots_params.py +32 -0
- runloop_api_client/types/devbox_list_params.py +20 -0
- runloop_api_client/types/devbox_list_view.py +19 -0
- runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
- runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
- runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
- runloop_api_client/types/devbox_send_std_in_result.py +16 -0
- runloop_api_client/types/devbox_snapshot_disk_async_params.py +19 -0
- runloop_api_client/types/devbox_snapshot_disk_params.py +19 -0
- runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
- runloop_api_client/types/devbox_snapshot_view.py +30 -0
- runloop_api_client/types/devbox_tunnel_view.py +16 -0
- runloop_api_client/types/devbox_update_params.py +16 -0
- runloop_api_client/types/devbox_upload_file_params.py +19 -0
- runloop_api_client/types/devbox_view.py +121 -0
- runloop_api_client/types/devbox_wait_for_command_params.py +28 -0
- runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
- runloop_api_client/types/devboxes/__init__.py +33 -0
- runloop_api_client/types/devboxes/browser_create_params.py +13 -0
- runloop_api_client/types/devboxes/browser_view.py +29 -0
- runloop_api_client/types/devboxes/computer_create_params.py +26 -0
- runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
- runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
- runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +35 -0
- runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
- runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
- runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
- runloop_api_client/types/devboxes/computer_view.py +23 -0
- runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
- runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
- runloop_api_client/types/devboxes/disk_snapshot_list_params.py +32 -0
- runloop_api_client/types/devboxes/disk_snapshot_update_params.py +19 -0
- runloop_api_client/types/devboxes/execution_execute_async_params.py +31 -0
- runloop_api_client/types/devboxes/execution_execute_sync_params.py +31 -0
- runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
- runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
- runloop_api_client/types/devboxes/execution_send_std_in_params.py +18 -0
- runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +17 -0
- runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +17 -0
- runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
- runloop_api_client/types/devboxes/log_list_params.py +15 -0
- runloop_api_client/types/gateway_config_create_params.py +41 -0
- runloop_api_client/types/gateway_config_list_params.py +21 -0
- runloop_api_client/types/gateway_config_list_view.py +21 -0
- runloop_api_client/types/gateway_config_update_params.py +32 -0
- runloop_api_client/types/gateway_config_view.py +47 -0
- runloop_api_client/types/input_context.py +19 -0
- runloop_api_client/types/input_context_param.py +20 -0
- runloop_api_client/types/input_context_update_param.py +16 -0
- runloop_api_client/types/inspection_source_param.py +18 -0
- runloop_api_client/types/network_policy_create_params.py +40 -0
- runloop_api_client/types/network_policy_list_params.py +21 -0
- runloop_api_client/types/network_policy_list_view.py +21 -0
- runloop_api_client/types/network_policy_update_params.py +30 -0
- runloop_api_client/types/network_policy_view.py +52 -0
- runloop_api_client/types/object_create_params.py +30 -0
- runloop_api_client/types/object_download_params.py +12 -0
- runloop_api_client/types/object_download_url_view.py +12 -0
- runloop_api_client/types/object_list_params.py +27 -0
- runloop_api_client/types/object_list_public_params.py +27 -0
- runloop_api_client/types/object_list_view.py +24 -0
- runloop_api_client/types/object_view.py +36 -0
- runloop_api_client/types/repository_connection_list_view.py +19 -0
- runloop_api_client/types/repository_connection_view.py +18 -0
- runloop_api_client/types/repository_create_params.py +22 -0
- runloop_api_client/types/repository_inspect_params.py +13 -0
- runloop_api_client/types/repository_inspection_details.py +83 -0
- runloop_api_client/types/repository_inspection_list_view.py +13 -0
- runloop_api_client/types/repository_list_params.py +21 -0
- runloop_api_client/types/repository_manifest_view.py +174 -0
- runloop_api_client/types/repository_refresh_params.py +16 -0
- runloop_api_client/types/scenario_create_params.py +53 -0
- runloop_api_client/types/scenario_definition_list_view.py +19 -0
- runloop_api_client/types/scenario_environment.py +29 -0
- runloop_api_client/types/scenario_environment_param.py +31 -0
- runloop_api_client/types/scenario_list_params.py +24 -0
- runloop_api_client/types/scenario_list_public_params.py +18 -0
- runloop_api_client/types/scenario_run_list_view.py +19 -0
- runloop_api_client/types/scenario_run_view.py +55 -0
- runloop_api_client/types/scenario_start_run_params.py +30 -0
- runloop_api_client/types/scenario_update_params.py +49 -0
- runloop_api_client/types/scenario_view.py +61 -0
- runloop_api_client/types/scenarios/__init__.py +14 -0
- runloop_api_client/types/scenarios/run_list_params.py +27 -0
- runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
- runloop_api_client/types/scenarios/scorer_create_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
- runloop_api_client/types/scenarios/scorer_list_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_retrieve_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
- runloop_api_client/types/scenarios/scorer_update_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
- runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
- runloop_api_client/types/scoring_contract.py +17 -0
- runloop_api_client/types/scoring_contract_param.py +19 -0
- runloop_api_client/types/scoring_contract_result_view.py +20 -0
- runloop_api_client/types/scoring_contract_update_param.py +15 -0
- runloop_api_client/types/scoring_function.py +157 -0
- runloop_api_client/types/scoring_function_param.py +153 -0
- runloop_api_client/types/scoring_function_result_view.py +25 -0
- runloop_api_client/types/secret_create_params.py +23 -0
- runloop_api_client/types/secret_list_params.py +12 -0
- runloop_api_client/types/secret_list_view.py +24 -0
- runloop_api_client/types/secret_update_params.py +16 -0
- runloop_api_client/types/secret_view.py +26 -0
- runloop_api_client/types/shared/__init__.py +10 -0
- runloop_api_client/types/shared/after_idle.py +15 -0
- runloop_api_client/types/shared/agent_mount.py +31 -0
- runloop_api_client/types/shared/agent_source.py +75 -0
- runloop_api_client/types/shared/code_mount_parameters.py +24 -0
- runloop_api_client/types/shared/launch_parameters.py +86 -0
- runloop_api_client/types/shared/mount.py +43 -0
- runloop_api_client/types/shared/object_mount.py +21 -0
- runloop_api_client/types/shared/run_profile.py +37 -0
- runloop_api_client/types/shared_params/__init__.py +10 -0
- runloop_api_client/types/shared_params/after_idle.py +15 -0
- runloop_api_client/types/shared_params/agent_mount.py +31 -0
- runloop_api_client/types/shared_params/agent_source.py +78 -0
- runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
- runloop_api_client/types/shared_params/launch_parameters.py +88 -0
- runloop_api_client/types/shared_params/mount.py +43 -0
- runloop_api_client/types/shared_params/object_mount.py +21 -0
- runloop_api_client/types/shared_params/run_profile.py +38 -0
- runloop_api_client/types/tunnel_view.py +34 -0
- runloop_api_client-1.5.1.dist-info/METADATA +522 -0
- runloop_api_client-1.5.1.dist-info/RECORD +261 -0
- runloop_api_client-1.5.1.dist-info/WHEEL +4 -0
- runloop_api_client-1.5.1.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, List, Tuple, Union, Mapping, TypeVar
|
|
4
|
+
from urllib.parse import parse_qs, urlencode
|
|
5
|
+
from typing_extensions import Literal, get_args
|
|
6
|
+
|
|
7
|
+
from ._types import NotGiven, not_given
|
|
8
|
+
from ._utils import flatten
|
|
9
|
+
|
|
10
|
+
_T = TypeVar("_T")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
ArrayFormat = Literal["comma", "repeat", "indices", "brackets"]
|
|
14
|
+
NestedFormat = Literal["dots", "brackets"]
|
|
15
|
+
|
|
16
|
+
PrimitiveData = Union[str, int, float, bool, None]
|
|
17
|
+
# this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"]
|
|
18
|
+
# https://github.com/microsoft/pyright/issues/3555
|
|
19
|
+
Data = Union[PrimitiveData, List[Any], Tuple[Any], "Mapping[str, Any]"]
|
|
20
|
+
Params = Mapping[str, Data]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Querystring:
|
|
24
|
+
array_format: ArrayFormat
|
|
25
|
+
nested_format: NestedFormat
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
array_format: ArrayFormat = "repeat",
|
|
31
|
+
nested_format: NestedFormat = "brackets",
|
|
32
|
+
) -> None:
|
|
33
|
+
self.array_format = array_format
|
|
34
|
+
self.nested_format = nested_format
|
|
35
|
+
|
|
36
|
+
def parse(self, query: str) -> Mapping[str, object]:
|
|
37
|
+
# Note: custom format syntax is not supported yet
|
|
38
|
+
return parse_qs(query)
|
|
39
|
+
|
|
40
|
+
def stringify(
|
|
41
|
+
self,
|
|
42
|
+
params: Params,
|
|
43
|
+
*,
|
|
44
|
+
array_format: ArrayFormat | NotGiven = not_given,
|
|
45
|
+
nested_format: NestedFormat | NotGiven = not_given,
|
|
46
|
+
) -> str:
|
|
47
|
+
return urlencode(
|
|
48
|
+
self.stringify_items(
|
|
49
|
+
params,
|
|
50
|
+
array_format=array_format,
|
|
51
|
+
nested_format=nested_format,
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def stringify_items(
|
|
56
|
+
self,
|
|
57
|
+
params: Params,
|
|
58
|
+
*,
|
|
59
|
+
array_format: ArrayFormat | NotGiven = not_given,
|
|
60
|
+
nested_format: NestedFormat | NotGiven = not_given,
|
|
61
|
+
) -> list[tuple[str, str]]:
|
|
62
|
+
opts = Options(
|
|
63
|
+
qs=self,
|
|
64
|
+
array_format=array_format,
|
|
65
|
+
nested_format=nested_format,
|
|
66
|
+
)
|
|
67
|
+
return flatten([self._stringify_item(key, value, opts) for key, value in params.items()])
|
|
68
|
+
|
|
69
|
+
def _stringify_item(
|
|
70
|
+
self,
|
|
71
|
+
key: str,
|
|
72
|
+
value: Data,
|
|
73
|
+
opts: Options,
|
|
74
|
+
) -> list[tuple[str, str]]:
|
|
75
|
+
if isinstance(value, Mapping):
|
|
76
|
+
items: list[tuple[str, str]] = []
|
|
77
|
+
nested_format = opts.nested_format
|
|
78
|
+
for subkey, subvalue in value.items():
|
|
79
|
+
items.extend(
|
|
80
|
+
self._stringify_item(
|
|
81
|
+
# TODO: error if unknown format
|
|
82
|
+
f"{key}.{subkey}" if nested_format == "dots" else f"{key}[{subkey}]",
|
|
83
|
+
subvalue,
|
|
84
|
+
opts,
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
return items
|
|
88
|
+
|
|
89
|
+
if isinstance(value, (list, tuple)):
|
|
90
|
+
array_format = opts.array_format
|
|
91
|
+
if array_format == "comma":
|
|
92
|
+
return [
|
|
93
|
+
(
|
|
94
|
+
key,
|
|
95
|
+
",".join(self._primitive_value_to_str(item) for item in value if item is not None),
|
|
96
|
+
),
|
|
97
|
+
]
|
|
98
|
+
elif array_format == "repeat":
|
|
99
|
+
items = []
|
|
100
|
+
for item in value:
|
|
101
|
+
items.extend(self._stringify_item(key, item, opts))
|
|
102
|
+
return items
|
|
103
|
+
elif array_format == "indices":
|
|
104
|
+
raise NotImplementedError("The array indices format is not supported yet")
|
|
105
|
+
elif array_format == "brackets":
|
|
106
|
+
items = []
|
|
107
|
+
key = key + "[]"
|
|
108
|
+
for item in value:
|
|
109
|
+
items.extend(self._stringify_item(key, item, opts))
|
|
110
|
+
return items
|
|
111
|
+
else:
|
|
112
|
+
raise NotImplementedError(
|
|
113
|
+
f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
serialised = self._primitive_value_to_str(value)
|
|
117
|
+
if not serialised:
|
|
118
|
+
return []
|
|
119
|
+
return [(key, serialised)]
|
|
120
|
+
|
|
121
|
+
def _primitive_value_to_str(self, value: PrimitiveData) -> str:
|
|
122
|
+
# copied from httpx
|
|
123
|
+
if value is True:
|
|
124
|
+
return "true"
|
|
125
|
+
elif value is False:
|
|
126
|
+
return "false"
|
|
127
|
+
elif value is None:
|
|
128
|
+
return ""
|
|
129
|
+
return str(value)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
_qs = Querystring()
|
|
133
|
+
parse = _qs.parse
|
|
134
|
+
stringify = _qs.stringify
|
|
135
|
+
stringify_items = _qs.stringify_items
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class Options:
|
|
139
|
+
array_format: ArrayFormat
|
|
140
|
+
nested_format: NestedFormat
|
|
141
|
+
|
|
142
|
+
def __init__(
|
|
143
|
+
self,
|
|
144
|
+
qs: Querystring = _qs,
|
|
145
|
+
*,
|
|
146
|
+
array_format: ArrayFormat | NotGiven = not_given,
|
|
147
|
+
nested_format: NestedFormat | NotGiven = not_given,
|
|
148
|
+
) -> None:
|
|
149
|
+
self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format
|
|
150
|
+
self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
import anyio
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ._client import Runloop, AsyncRunloop
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SyncAPIResource:
|
|
15
|
+
_client: Runloop
|
|
16
|
+
|
|
17
|
+
def __init__(self, client: Runloop) -> None:
|
|
18
|
+
self._client = client
|
|
19
|
+
self._get = client.get
|
|
20
|
+
self._post = client.post
|
|
21
|
+
self._patch = client.patch
|
|
22
|
+
self._put = client.put
|
|
23
|
+
self._delete = client.delete
|
|
24
|
+
self._get_api_list = client.get_api_list
|
|
25
|
+
|
|
26
|
+
def _sleep(self, seconds: float) -> None:
|
|
27
|
+
time.sleep(seconds)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AsyncAPIResource:
|
|
31
|
+
_client: AsyncRunloop
|
|
32
|
+
|
|
33
|
+
def __init__(self, client: AsyncRunloop) -> None:
|
|
34
|
+
self._client = client
|
|
35
|
+
self._get = client.get
|
|
36
|
+
self._post = client.post
|
|
37
|
+
self._patch = client.patch
|
|
38
|
+
self._put = client.put
|
|
39
|
+
self._delete = client.delete
|
|
40
|
+
self._get_api_list = client.get_api_list
|
|
41
|
+
|
|
42
|
+
async def _sleep(self, seconds: float) -> None:
|
|
43
|
+
await anyio.sleep(seconds)
|