Skip to content

Commit f5d07b9

Browse files
feat(api): api update
1 parent 720a4f0 commit f5d07b9

File tree

4 files changed

+18
-41
lines changed

4 files changed

+18
-41
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1712
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5b95965bcd85193fcb31b2d1961a75d944347439f615190f9e26ca8ec0fcc256.yml
3-
openapi_spec_hash: c2a3061d116c9e5216601ef7ae927414
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6a4a0d47e8ceab80534487c492d0dadf39a242ad7c586228e50cd19fe76488fc.yml
3+
openapi_spec_hash: 236c4734c35907f8f0a7c1f14eee05dd
44
config_hash: 04c03b2581e7a04107a02c6ae53e4e03

src/cloudflare/resources/workers/assets/upload.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Type, Optional, cast
5+
from typing import Dict, Type, Optional, cast
66
from typing_extensions import Literal
77

88
import httpx
@@ -50,7 +50,7 @@ def create(
5050
*,
5151
account_id: str,
5252
base64: Literal[True],
53-
any_file_hash: List[str] | NotGiven = NOT_GIVEN,
53+
body: Dict[str, str],
5454
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5555
# The extra values given here take precedence over values defined on the client or passed to this method.
5656
extra_headers: Headers | None = None,
@@ -69,9 +69,6 @@ def create(
6969
7070
base64: Whether the file contents are base64-encoded. Must be `true`.
7171
72-
any_file_hash: Base-64 encoded contents of the file. The content type of the file should be
73-
included to ensure a valid "Content-Type" header is included in asset responses.
74-
7572
extra_headers: Send extra headers
7673
7774
extra_query: Add additional query parameters to the request
@@ -88,7 +85,7 @@ def create(
8885
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
8986
return self._post(
9087
f"/accounts/{account_id}/workers/assets/upload",
91-
body=maybe_transform({"any_file_hash": any_file_hash}, upload_create_params.UploadCreateParams),
88+
body=maybe_transform(body, upload_create_params.UploadCreateParams),
9289
options=make_request_options(
9390
extra_headers=extra_headers,
9491
extra_query=extra_query,
@@ -126,7 +123,7 @@ async def create(
126123
*,
127124
account_id: str,
128125
base64: Literal[True],
129-
any_file_hash: List[str] | NotGiven = NOT_GIVEN,
126+
body: Dict[str, str],
130127
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
131128
# The extra values given here take precedence over values defined on the client or passed to this method.
132129
extra_headers: Headers | None = None,
@@ -145,9 +142,6 @@ async def create(
145142
146143
base64: Whether the file contents are base64-encoded. Must be `true`.
147144
148-
any_file_hash: Base-64 encoded contents of the file. The content type of the file should be
149-
included to ensure a valid "Content-Type" header is included in asset responses.
150-
151145
extra_headers: Send extra headers
152146
153147
extra_query: Add additional query parameters to the request
@@ -164,7 +158,7 @@ async def create(
164158
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
165159
return await self._post(
166160
f"/accounts/{account_id}/workers/assets/upload",
167-
body=await async_maybe_transform({"any_file_hash": any_file_hash}, upload_create_params.UploadCreateParams),
161+
body=await async_maybe_transform(body, upload_create_params.UploadCreateParams),
168162
options=make_request_options(
169163
extra_headers=extra_headers,
170164
extra_query=extra_query,

src/cloudflare/types/workers/assets/upload_create_params.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import List
6-
from typing_extensions import Literal, Required, Annotated, TypedDict
7-
8-
from ...._utils import PropertyInfo
5+
from typing import Dict
6+
from typing_extensions import Literal, Required, TypedDict
97

108
__all__ = ["UploadCreateParams"]
119

@@ -17,9 +15,4 @@ class UploadCreateParams(TypedDict, total=False):
1715
base64: Required[Literal[True]]
1816
"""Whether the file contents are base64-encoded. Must be `true`."""
1917

20-
any_file_hash: Annotated[List[str], PropertyInfo(alias="<any file hash>")]
21-
"""Base-64 encoded contents of the file.
22-
23-
The content type of the file should be included to ensure a valid "Content-Type"
24-
header is included in asset responses.
25-
"""
18+
body: Required[Dict[str, str]]

tests/api_resources/workers/assets/test_upload.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@ def test_method_create(self, client: Cloudflare) -> None:
2222
upload = client.workers.assets.upload.create(
2323
account_id="023e105f4ecef8ad9ca31a8372d0c353",
2424
base64=True,
25-
)
26-
assert_matches_type(Optional[UploadCreateResponse], upload, path=["response"])
27-
28-
@parametrize
29-
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
30-
upload = client.workers.assets.upload.create(
31-
account_id="023e105f4ecef8ad9ca31a8372d0c353",
32-
base64=True,
33-
any_file_hash=["string"],
25+
body={"foo": "string"},
3426
)
3527
assert_matches_type(Optional[UploadCreateResponse], upload, path=["response"])
3628

@@ -39,6 +31,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
3931
response = client.workers.assets.upload.with_raw_response.create(
4032
account_id="023e105f4ecef8ad9ca31a8372d0c353",
4133
base64=True,
34+
body={"foo": "string"},
4235
)
4336

4437
assert response.is_closed is True
@@ -51,6 +44,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
5144
with client.workers.assets.upload.with_streaming_response.create(
5245
account_id="023e105f4ecef8ad9ca31a8372d0c353",
5346
base64=True,
47+
body={"foo": "string"},
5448
) as response:
5549
assert not response.is_closed
5650
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -66,6 +60,7 @@ def test_path_params_create(self, client: Cloudflare) -> None:
6660
client.workers.assets.upload.with_raw_response.create(
6761
account_id="",
6862
base64=True,
63+
body={"foo": "string"},
6964
)
7065

7166

@@ -77,15 +72,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
7772
upload = await async_client.workers.assets.upload.create(
7873
account_id="023e105f4ecef8ad9ca31a8372d0c353",
7974
base64=True,
80-
)
81-
assert_matches_type(Optional[UploadCreateResponse], upload, path=["response"])
82-
83-
@parametrize
84-
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
85-
upload = await async_client.workers.assets.upload.create(
86-
account_id="023e105f4ecef8ad9ca31a8372d0c353",
87-
base64=True,
88-
any_file_hash=["string"],
75+
body={"foo": "string"},
8976
)
9077
assert_matches_type(Optional[UploadCreateResponse], upload, path=["response"])
9178

@@ -94,6 +81,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
9481
response = await async_client.workers.assets.upload.with_raw_response.create(
9582
account_id="023e105f4ecef8ad9ca31a8372d0c353",
9683
base64=True,
84+
body={"foo": "string"},
9785
)
9886

9987
assert response.is_closed is True
@@ -106,6 +94,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
10694
async with async_client.workers.assets.upload.with_streaming_response.create(
10795
account_id="023e105f4ecef8ad9ca31a8372d0c353",
10896
base64=True,
97+
body={"foo": "string"},
10998
) as response:
11099
assert not response.is_closed
111100
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -121,4 +110,5 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
121110
await async_client.workers.assets.upload.with_raw_response.create(
122111
account_id="",
123112
base64=True,
113+
body={"foo": "string"},
124114
)

0 commit comments

Comments
 (0)