Skip to content

Commit d2aefd1

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#63)
1 parent 42ab77f commit d2aefd1

7 files changed

Lines changed: 123 additions & 20 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8ed7237714dcf00d5e186095c38ac8afb3300d4773e0d836042d89f3b53c7ffc.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-d46e8a351f9ab9469594e4ac1b185033afe2e530e0dd6df2cae2a666d8fc8336.yml

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ Methods:
5757
- <code title="get /v1/devboxes/{id}">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
5858
- <code title="get /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">list</a>(\*\*<a href="src/runloop_api_client/types/devbox_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_list_view.py">DevboxListView</a></code>
5959
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
60-
- <code title="post /v1/devboxes/{id}/read_file">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">read_file</a>(id) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
60+
- <code title="post /v1/devboxes/{id}/read_file">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">read_file</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_read_file_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
6161
- <code title="post /v1/devboxes/{id}/shutdown">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">shutdown</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
62-
- <code title="post /v1/devboxes/{id}/write_file">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">write_file</a>(id) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
62+
- <code title="post /v1/devboxes/{id}/write_file">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">write_file</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_write_file_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
6363

6464
## Logs
6565

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
LogsResourceWithStreamingResponse,
1515
AsyncLogsResourceWithStreamingResponse,
1616
)
17-
from ...types import devbox_list_params, devbox_create_params, devbox_execute_sync_params
17+
from ...types import (
18+
devbox_list_params,
19+
devbox_create_params,
20+
devbox_read_file_params,
21+
devbox_write_file_params,
22+
devbox_execute_sync_params,
23+
)
1824
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1925
from ..._utils import (
2026
maybe_transform,
@@ -251,6 +257,7 @@ def read_file(
251257
self,
252258
id: str,
253259
*,
260+
file_path: str | NotGiven = NOT_GIVEN,
254261
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
255262
# The extra values given here take precedence over values defined on the client or passed to this method.
256263
extra_headers: Headers | None = None,
@@ -262,6 +269,8 @@ def read_file(
262269
Read file contents from a file on given Devbox.
263270
264271
Args:
272+
file_path: The path of the file to read.
273+
265274
extra_headers: Send extra headers
266275
267276
extra_query: Add additional query parameters to the request
@@ -274,6 +283,7 @@ def read_file(
274283
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
275284
return self._post(
276285
f"/v1/devboxes/{id}/read_file",
286+
body=maybe_transform({"file_path": file_path}, devbox_read_file_params.DevboxReadFileParams),
277287
options=make_request_options(
278288
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
279289
),
@@ -318,6 +328,8 @@ def write_file(
318328
self,
319329
id: str,
320330
*,
331+
contents: str | NotGiven = NOT_GIVEN,
332+
file_path: str | NotGiven = NOT_GIVEN,
321333
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
322334
# The extra values given here take precedence over values defined on the client or passed to this method.
323335
extra_headers: Headers | None = None,
@@ -329,6 +341,10 @@ def write_file(
329341
Write contents to a file at path on the Devbox.
330342
331343
Args:
344+
contents: The contents to write to file.
345+
346+
file_path: The path of the file to read.
347+
332348
extra_headers: Send extra headers
333349
334350
extra_query: Add additional query parameters to the request
@@ -341,6 +357,13 @@ def write_file(
341357
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
342358
return self._post(
343359
f"/v1/devboxes/{id}/write_file",
360+
body=maybe_transform(
361+
{
362+
"contents": contents,
363+
"file_path": file_path,
364+
},
365+
devbox_write_file_params.DevboxWriteFileParams,
366+
),
344367
options=make_request_options(
345368
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
346369
),
@@ -563,6 +586,7 @@ async def read_file(
563586
self,
564587
id: str,
565588
*,
589+
file_path: str | NotGiven = NOT_GIVEN,
566590
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
567591
# The extra values given here take precedence over values defined on the client or passed to this method.
568592
extra_headers: Headers | None = None,
@@ -574,6 +598,8 @@ async def read_file(
574598
Read file contents from a file on given Devbox.
575599
576600
Args:
601+
file_path: The path of the file to read.
602+
577603
extra_headers: Send extra headers
578604
579605
extra_query: Add additional query parameters to the request
@@ -586,6 +612,7 @@ async def read_file(
586612
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
587613
return await self._post(
588614
f"/v1/devboxes/{id}/read_file",
615+
body=await async_maybe_transform({"file_path": file_path}, devbox_read_file_params.DevboxReadFileParams),
589616
options=make_request_options(
590617
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
591618
),
@@ -630,6 +657,8 @@ async def write_file(
630657
self,
631658
id: str,
632659
*,
660+
contents: str | NotGiven = NOT_GIVEN,
661+
file_path: str | NotGiven = NOT_GIVEN,
633662
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
634663
# The extra values given here take precedence over values defined on the client or passed to this method.
635664
extra_headers: Headers | None = None,
@@ -641,6 +670,10 @@ async def write_file(
641670
Write contents to a file at path on the Devbox.
642671
643672
Args:
673+
contents: The contents to write to file.
674+
675+
file_path: The path of the file to read.
676+
644677
extra_headers: Send extra headers
645678
646679
extra_query: Add additional query parameters to the request
@@ -653,6 +686,13 @@ async def write_file(
653686
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
654687
return await self._post(
655688
f"/v1/devboxes/{id}/write_file",
689+
body=await async_maybe_transform(
690+
{
691+
"contents": contents,
692+
"file_path": file_path,
693+
},
694+
devbox_write_file_params.DevboxWriteFileParams,
695+
),
656696
options=make_request_options(
657697
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
658698
),

src/runloop_api_client/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
from .code_mount_parameters import CodeMountParameters as CodeMountParameters
2121
from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView
2222
from .blueprint_create_params import BlueprintCreateParams as BlueprintCreateParams
23+
from .devbox_read_file_params import DevboxReadFileParams as DevboxReadFileParams
2324
from .blueprint_preview_params import BlueprintPreviewParams as BlueprintPreviewParams
25+
from .devbox_write_file_params import DevboxWriteFileParams as DevboxWriteFileParams
2426
from .blueprint_build_parameters import BlueprintBuildParameters as BlueprintBuildParameters
2527
from .devbox_execute_sync_params import DevboxExecuteSyncParams as DevboxExecuteSyncParams
2628
from .code_mount_parameters_param import CodeMountParametersParam as CodeMountParametersParam
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["DevboxReadFileParams"]
8+
9+
10+
class DevboxReadFileParams(TypedDict, total=False):
11+
file_path: str
12+
"""The path of the file to read."""
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["DevboxWriteFileParams"]
8+
9+
10+
class DevboxWriteFileParams(TypedDict, total=False):
11+
contents: str
12+
"""The contents to write to file."""
13+
14+
file_path: str
15+
"""The path of the file to read."""

tests/api_resources/test_devboxes.py

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,22 @@ def test_path_params_execute_sync(self, client: Runloop) -> None:
181181
@parametrize
182182
def test_method_read_file(self, client: Runloop) -> None:
183183
devbox = client.devboxes.read_file(
184-
"id",
184+
id="id",
185+
)
186+
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
187+
188+
@parametrize
189+
def test_method_read_file_with_all_params(self, client: Runloop) -> None:
190+
devbox = client.devboxes.read_file(
191+
id="id",
192+
file_path="file_path",
185193
)
186194
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
187195

188196
@parametrize
189197
def test_raw_response_read_file(self, client: Runloop) -> None:
190198
response = client.devboxes.with_raw_response.read_file(
191-
"id",
199+
id="id",
192200
)
193201

194202
assert response.is_closed is True
@@ -199,7 +207,7 @@ def test_raw_response_read_file(self, client: Runloop) -> None:
199207
@parametrize
200208
def test_streaming_response_read_file(self, client: Runloop) -> None:
201209
with client.devboxes.with_streaming_response.read_file(
202-
"id",
210+
id="id",
203211
) as response:
204212
assert not response.is_closed
205213
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -213,7 +221,7 @@ def test_streaming_response_read_file(self, client: Runloop) -> None:
213221
def test_path_params_read_file(self, client: Runloop) -> None:
214222
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
215223
client.devboxes.with_raw_response.read_file(
216-
"",
224+
id="",
217225
)
218226

219227
@parametrize
@@ -257,14 +265,23 @@ def test_path_params_shutdown(self, client: Runloop) -> None:
257265
@parametrize
258266
def test_method_write_file(self, client: Runloop) -> None:
259267
devbox = client.devboxes.write_file(
260-
"id",
268+
id="id",
269+
)
270+
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
271+
272+
@parametrize
273+
def test_method_write_file_with_all_params(self, client: Runloop) -> None:
274+
devbox = client.devboxes.write_file(
275+
id="id",
276+
contents="contents",
277+
file_path="file_path",
261278
)
262279
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
263280

264281
@parametrize
265282
def test_raw_response_write_file(self, client: Runloop) -> None:
266283
response = client.devboxes.with_raw_response.write_file(
267-
"id",
284+
id="id",
268285
)
269286

270287
assert response.is_closed is True
@@ -275,7 +292,7 @@ def test_raw_response_write_file(self, client: Runloop) -> None:
275292
@parametrize
276293
def test_streaming_response_write_file(self, client: Runloop) -> None:
277294
with client.devboxes.with_streaming_response.write_file(
278-
"id",
295+
id="id",
279296
) as response:
280297
assert not response.is_closed
281298
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -289,7 +306,7 @@ def test_streaming_response_write_file(self, client: Runloop) -> None:
289306
def test_path_params_write_file(self, client: Runloop) -> None:
290307
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
291308
client.devboxes.with_raw_response.write_file(
292-
"",
309+
id="",
293310
)
294311

295312

@@ -456,14 +473,22 @@ async def test_path_params_execute_sync(self, async_client: AsyncRunloop) -> Non
456473
@parametrize
457474
async def test_method_read_file(self, async_client: AsyncRunloop) -> None:
458475
devbox = await async_client.devboxes.read_file(
459-
"id",
476+
id="id",
477+
)
478+
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
479+
480+
@parametrize
481+
async def test_method_read_file_with_all_params(self, async_client: AsyncRunloop) -> None:
482+
devbox = await async_client.devboxes.read_file(
483+
id="id",
484+
file_path="file_path",
460485
)
461486
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
462487

463488
@parametrize
464489
async def test_raw_response_read_file(self, async_client: AsyncRunloop) -> None:
465490
response = await async_client.devboxes.with_raw_response.read_file(
466-
"id",
491+
id="id",
467492
)
468493

469494
assert response.is_closed is True
@@ -474,7 +499,7 @@ async def test_raw_response_read_file(self, async_client: AsyncRunloop) -> None:
474499
@parametrize
475500
async def test_streaming_response_read_file(self, async_client: AsyncRunloop) -> None:
476501
async with async_client.devboxes.with_streaming_response.read_file(
477-
"id",
502+
id="id",
478503
) as response:
479504
assert not response.is_closed
480505
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -488,7 +513,7 @@ async def test_streaming_response_read_file(self, async_client: AsyncRunloop) ->
488513
async def test_path_params_read_file(self, async_client: AsyncRunloop) -> None:
489514
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
490515
await async_client.devboxes.with_raw_response.read_file(
491-
"",
516+
id="",
492517
)
493518

494519
@parametrize
@@ -532,14 +557,23 @@ async def test_path_params_shutdown(self, async_client: AsyncRunloop) -> None:
532557
@parametrize
533558
async def test_method_write_file(self, async_client: AsyncRunloop) -> None:
534559
devbox = await async_client.devboxes.write_file(
535-
"id",
560+
id="id",
561+
)
562+
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
563+
564+
@parametrize
565+
async def test_method_write_file_with_all_params(self, async_client: AsyncRunloop) -> None:
566+
devbox = await async_client.devboxes.write_file(
567+
id="id",
568+
contents="contents",
569+
file_path="file_path",
536570
)
537571
assert_matches_type(DevboxExecutionDetailView, devbox, path=["response"])
538572

539573
@parametrize
540574
async def test_raw_response_write_file(self, async_client: AsyncRunloop) -> None:
541575
response = await async_client.devboxes.with_raw_response.write_file(
542-
"id",
576+
id="id",
543577
)
544578

545579
assert response.is_closed is True
@@ -550,7 +584,7 @@ async def test_raw_response_write_file(self, async_client: AsyncRunloop) -> None
550584
@parametrize
551585
async def test_streaming_response_write_file(self, async_client: AsyncRunloop) -> None:
552586
async with async_client.devboxes.with_streaming_response.write_file(
553-
"id",
587+
id="id",
554588
) as response:
555589
assert not response.is_closed
556590
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -564,5 +598,5 @@ async def test_streaming_response_write_file(self, async_client: AsyncRunloop) -
564598
async def test_path_params_write_file(self, async_client: AsyncRunloop) -> None:
565599
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
566600
await async_client.devboxes.with_raw_response.write_file(
567-
"",
601+
id="",
568602
)

0 commit comments

Comments
 (0)