|
19 | 19 | devbox_create_params, |
20 | 20 | devbox_read_file_params, |
21 | 21 | devbox_write_file_params, |
| 22 | + devbox_upload_file_params, |
22 | 23 | devbox_execute_sync_params, |
23 | 24 | devbox_read_file_contents_params, |
24 | 25 | ) |
25 | | -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven |
| 26 | +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes |
26 | 27 | from ..._utils import ( |
27 | 28 | maybe_transform, |
28 | 29 | async_maybe_transform, |
@@ -365,6 +366,48 @@ def shutdown( |
365 | 366 | cast_to=DevboxView, |
366 | 367 | ) |
367 | 368 |
|
| 369 | + def upload_file( |
| 370 | + self, |
| 371 | + id: str, |
| 372 | + *, |
| 373 | + file_input_stream: FileTypes | NotGiven = NOT_GIVEN, |
| 374 | + path: str | NotGiven = NOT_GIVEN, |
| 375 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 376 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 377 | + extra_headers: Headers | None = None, |
| 378 | + extra_query: Query | None = None, |
| 379 | + extra_body: Body | None = None, |
| 380 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 381 | + ) -> object: |
| 382 | + """ |
| 383 | + Upload file contents to a file at path on the Devbox. |
| 384 | +
|
| 385 | + Args: |
| 386 | + extra_headers: Send extra headers |
| 387 | +
|
| 388 | + extra_query: Add additional query parameters to the request |
| 389 | +
|
| 390 | + extra_body: Add additional JSON properties to the request |
| 391 | +
|
| 392 | + timeout: Override the client-level default timeout for this request, in seconds |
| 393 | + """ |
| 394 | + if not id: |
| 395 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 396 | + return self._post( |
| 397 | + f"/v1/devboxes/{id}/upload_file", |
| 398 | + body=maybe_transform( |
| 399 | + { |
| 400 | + "file_input_stream": file_input_stream, |
| 401 | + "path": path, |
| 402 | + }, |
| 403 | + devbox_upload_file_params.DevboxUploadFileParams, |
| 404 | + ), |
| 405 | + options=make_request_options( |
| 406 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 407 | + ), |
| 408 | + cast_to=object, |
| 409 | + ) |
| 410 | + |
368 | 411 | def write_file( |
369 | 412 | self, |
370 | 413 | id: str, |
@@ -734,6 +777,48 @@ async def shutdown( |
734 | 777 | cast_to=DevboxView, |
735 | 778 | ) |
736 | 779 |
|
| 780 | + async def upload_file( |
| 781 | + self, |
| 782 | + id: str, |
| 783 | + *, |
| 784 | + file_input_stream: FileTypes | NotGiven = NOT_GIVEN, |
| 785 | + path: str | NotGiven = NOT_GIVEN, |
| 786 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 787 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 788 | + extra_headers: Headers | None = None, |
| 789 | + extra_query: Query | None = None, |
| 790 | + extra_body: Body | None = None, |
| 791 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 792 | + ) -> object: |
| 793 | + """ |
| 794 | + Upload file contents to a file at path on the Devbox. |
| 795 | +
|
| 796 | + Args: |
| 797 | + extra_headers: Send extra headers |
| 798 | +
|
| 799 | + extra_query: Add additional query parameters to the request |
| 800 | +
|
| 801 | + extra_body: Add additional JSON properties to the request |
| 802 | +
|
| 803 | + timeout: Override the client-level default timeout for this request, in seconds |
| 804 | + """ |
| 805 | + if not id: |
| 806 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 807 | + return await self._post( |
| 808 | + f"/v1/devboxes/{id}/upload_file", |
| 809 | + body=await async_maybe_transform( |
| 810 | + { |
| 811 | + "file_input_stream": file_input_stream, |
| 812 | + "path": path, |
| 813 | + }, |
| 814 | + devbox_upload_file_params.DevboxUploadFileParams, |
| 815 | + ), |
| 816 | + options=make_request_options( |
| 817 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 818 | + ), |
| 819 | + cast_to=object, |
| 820 | + ) |
| 821 | + |
737 | 822 | async def write_file( |
738 | 823 | self, |
739 | 824 | id: str, |
@@ -806,6 +891,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: |
806 | 891 | self.shutdown = to_raw_response_wrapper( |
807 | 892 | devboxes.shutdown, |
808 | 893 | ) |
| 894 | + self.upload_file = to_raw_response_wrapper( |
| 895 | + devboxes.upload_file, |
| 896 | + ) |
809 | 897 | self.write_file = to_raw_response_wrapper( |
810 | 898 | devboxes.write_file, |
811 | 899 | ) |
@@ -840,6 +928,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: |
840 | 928 | self.shutdown = async_to_raw_response_wrapper( |
841 | 929 | devboxes.shutdown, |
842 | 930 | ) |
| 931 | + self.upload_file = async_to_raw_response_wrapper( |
| 932 | + devboxes.upload_file, |
| 933 | + ) |
843 | 934 | self.write_file = async_to_raw_response_wrapper( |
844 | 935 | devboxes.write_file, |
845 | 936 | ) |
@@ -874,6 +965,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: |
874 | 965 | self.shutdown = to_streamed_response_wrapper( |
875 | 966 | devboxes.shutdown, |
876 | 967 | ) |
| 968 | + self.upload_file = to_streamed_response_wrapper( |
| 969 | + devboxes.upload_file, |
| 970 | + ) |
877 | 971 | self.write_file = to_streamed_response_wrapper( |
878 | 972 | devboxes.write_file, |
879 | 973 | ) |
@@ -908,6 +1002,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: |
908 | 1002 | self.shutdown = async_to_streamed_response_wrapper( |
909 | 1003 | devboxes.shutdown, |
910 | 1004 | ) |
| 1005 | + self.upload_file = async_to_streamed_response_wrapper( |
| 1006 | + devboxes.upload_file, |
| 1007 | + ) |
911 | 1008 | self.write_file = async_to_streamed_response_wrapper( |
912 | 1009 | devboxes.write_file, |
913 | 1010 | ) |
|
0 commit comments