|
15 | 15 | WatchResourceWithStreamingResponse, |
16 | 16 | AsyncWatchResourceWithStreamingResponse, |
17 | 17 | ) |
18 | | -from ...._files import read_file_content, async_read_file_content |
| 18 | +from ...._files import read_file_content, deepcopy_with_paths, async_read_file_content |
19 | 19 | from ...._types import ( |
20 | 20 | Body, |
21 | 21 | Omit, |
|
30 | 30 | omit, |
31 | 31 | not_given, |
32 | 32 | ) |
33 | | -from ...._utils import extract_files, path_template, maybe_transform, deepcopy_minimal, async_maybe_transform |
| 33 | +from ...._utils import extract_files, path_template, maybe_transform, async_maybe_transform |
34 | 34 | from ...._compat import cached_property |
35 | 35 | from ...._resource import SyncAPIResource, AsyncAPIResource |
36 | 36 | from ...._response import ( |
@@ -509,7 +509,7 @@ def upload( |
509 | 509 | if not id: |
510 | 510 | raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
511 | 511 | extra_headers = {"Accept": "*/*", **(extra_headers or {})} |
512 | | - body = deepcopy_minimal({"files": files}) |
| 512 | + body = deepcopy_with_paths({"files": files}, [["files", "<array>", "file"]]) |
513 | 513 | extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>", "file"]]) |
514 | 514 | # It should be noted that the actual Content-Type header that will be |
515 | 515 | # sent to the server will contain a `boundary` parameter, e.g. |
@@ -555,11 +555,12 @@ def upload_zip( |
555 | 555 | if not id: |
556 | 556 | raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
557 | 557 | extra_headers = {"Accept": "*/*", **(extra_headers or {})} |
558 | | - body = deepcopy_minimal( |
| 558 | + body = deepcopy_with_paths( |
559 | 559 | { |
560 | 560 | "dest_path": dest_path, |
561 | 561 | "zip_file": zip_file, |
562 | | - } |
| 562 | + }, |
| 563 | + [["zip_file"]], |
563 | 564 | ) |
564 | 565 | files = extract_files(cast(Mapping[str, object], body), paths=[["zip_file"]]) |
565 | 566 | # It should be noted that the actual Content-Type header that will be |
@@ -1071,7 +1072,7 @@ async def upload( |
1071 | 1072 | if not id: |
1072 | 1073 | raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
1073 | 1074 | extra_headers = {"Accept": "*/*", **(extra_headers or {})} |
1074 | | - body = deepcopy_minimal({"files": files}) |
| 1075 | + body = deepcopy_with_paths({"files": files}, [["files", "<array>", "file"]]) |
1075 | 1076 | extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>", "file"]]) |
1076 | 1077 | # It should be noted that the actual Content-Type header that will be |
1077 | 1078 | # sent to the server will contain a `boundary` parameter, e.g. |
@@ -1117,11 +1118,12 @@ async def upload_zip( |
1117 | 1118 | if not id: |
1118 | 1119 | raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
1119 | 1120 | extra_headers = {"Accept": "*/*", **(extra_headers or {})} |
1120 | | - body = deepcopy_minimal( |
| 1121 | + body = deepcopy_with_paths( |
1121 | 1122 | { |
1122 | 1123 | "dest_path": dest_path, |
1123 | 1124 | "zip_file": zip_file, |
1124 | | - } |
| 1125 | + }, |
| 1126 | + [["zip_file"]], |
1125 | 1127 | ) |
1126 | 1128 | files = extract_files(cast(Mapping[str, object], body), paths=[["zip_file"]]) |
1127 | 1129 | # It should be noted that the actual Content-Type header that will be |
|
0 commit comments