diff --git a/.stats.yml b/.stats.yml index a0398485e87..4b802baedab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1348 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc907ac853f9f492d6e9168c4a32fd2c7ccacbabbcb716280dbaa42a0d9c14f2.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f2b480625b4e667e5ed9a238c9b5314522dc9be0bf8f514bed4e03a88d09455c.yml diff --git a/src/cloudflare/resources/stream/copy.py b/src/cloudflare/resources/stream/copy.py index 426b93d4b48..e6b85f79d95 100644 --- a/src/cloudflare/resources/stream/copy.py +++ b/src/cloudflare/resources/stream/copy.py @@ -10,6 +10,7 @@ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, + strip_not_given, async_maybe_transform, ) from ..._compat import cached_property @@ -52,6 +53,8 @@ def create( scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN, thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN, watermark: copy_create_params.Watermark | NotGiven = NOT_GIVEN, + upload_creator: str | NotGiven = NOT_GIVEN, + upload_metadata: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -90,6 +93,12 @@ def create( divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video. + upload_creator: A user-defined identifier for the media creator. + + upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values + are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -100,6 +109,15 @@ def create( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + extra_headers = { + **strip_not_given( + { + "Upload-Creator": upload_creator, + "Upload-Metadata": upload_metadata, + } + ), + **(extra_headers or {}), + } return self._post( f"/accounts/{account_id}/stream/copy", body=maybe_transform( @@ -147,6 +165,8 @@ async def create( scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN, thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN, watermark: copy_create_params.Watermark | NotGiven = NOT_GIVEN, + upload_creator: str | NotGiven = NOT_GIVEN, + upload_metadata: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -185,6 +205,12 @@ async def create( divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video. + upload_creator: A user-defined identifier for the media creator. + + upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values + are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -195,6 +221,15 @@ async def create( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + extra_headers = { + **strip_not_given( + { + "Upload-Creator": upload_creator, + "Upload-Metadata": upload_metadata, + } + ), + **(extra_headers or {}), + } return await self._post( f"/accounts/{account_id}/stream/copy", body=await async_maybe_transform( diff --git a/src/cloudflare/resources/stream/direct_upload.py b/src/cloudflare/resources/stream/direct_upload.py index de337332a8c..efa26368eeb 100644 --- a/src/cloudflare/resources/stream/direct_upload.py +++ b/src/cloudflare/resources/stream/direct_upload.py @@ -10,6 +10,7 @@ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, + strip_not_given, async_maybe_transform, ) from ..._compat import cached_property @@ -53,6 +54,7 @@ def create( scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN, thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN, watermark: direct_upload_create_params.Watermark | NotGiven = NOT_GIVEN, + upload_creator: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -94,6 +96,8 @@ def create( divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video. + upload_creator: A user-defined identifier for the media creator. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -104,6 +108,7 @@ def create( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + extra_headers = {**strip_not_given({"Upload-Creator": upload_creator}), **(extra_headers or {})} return self._post( f"/accounts/{account_id}/stream/direct_upload", body=maybe_transform( @@ -153,6 +158,7 @@ async def create( scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN, thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN, watermark: direct_upload_create_params.Watermark | NotGiven = NOT_GIVEN, + upload_creator: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -194,6 +200,8 @@ async def create( divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video. + upload_creator: A user-defined identifier for the media creator. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -204,6 +212,7 @@ async def create( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + extra_headers = {**strip_not_given({"Upload-Creator": upload_creator}), **(extra_headers or {})} return await self._post( f"/accounts/{account_id}/stream/direct_upload", body=await async_maybe_transform( diff --git a/src/cloudflare/resources/stream/stream.py b/src/cloudflare/resources/stream/stream.py index 4a66a234404..5c7449705e8 100644 --- a/src/cloudflare/resources/stream/stream.py +++ b/src/cloudflare/resources/stream/stream.py @@ -59,6 +59,7 @@ from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ..._utils import ( maybe_transform, + strip_not_given, async_maybe_transform, ) from .captions import ( @@ -205,6 +206,10 @@ def create( *, account_id: str, body: object, + tus_resumable: Literal["1.0.0"], + upload_length: int, + upload_creator: str | NotGiven = NOT_GIVEN, + upload_metadata: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -222,6 +227,18 @@ def create( Args: account_id: The account identifier tag. + tus_resumable: Specifies the TUS protocol version. This value must be included in every upload + request. Notes: The only supported version of TUS protocol is 1.0.0. + + upload_length: Indicates the size of the entire upload in bytes. The value must be a + non-negative integer. + + upload_creator: A user-defined identifier for the media creator. + + upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values + are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -233,6 +250,17 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + { + "Tus-Resumable": str(tus_resumable), + "Upload-Length": str(upload_length), + "Upload-Creator": upload_creator, + "Upload-Metadata": upload_metadata, + } + ), + **(extra_headers or {}), + } return self._post( f"/accounts/{account_id}/stream", body=maybe_transform(body, stream_create_params.StreamCreateParams), @@ -475,6 +503,10 @@ async def create( *, account_id: str, body: object, + tus_resumable: Literal["1.0.0"], + upload_length: int, + upload_creator: str | NotGiven = NOT_GIVEN, + upload_metadata: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -492,6 +524,18 @@ async def create( Args: account_id: The account identifier tag. + tus_resumable: Specifies the TUS protocol version. This value must be included in every upload + request. Notes: The only supported version of TUS protocol is 1.0.0. + + upload_length: Indicates the size of the entire upload in bytes. The value must be a + non-negative integer. + + upload_creator: A user-defined identifier for the media creator. + + upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values + are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -503,6 +547,17 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + { + "Tus-Resumable": str(tus_resumable), + "Upload-Length": str(upload_length), + "Upload-Creator": upload_creator, + "Upload-Metadata": upload_metadata, + } + ), + **(extra_headers or {}), + } return await self._post( f"/accounts/{account_id}/stream", body=await async_maybe_transform(body, stream_create_params.StreamCreateParams), diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py index 04ea3cd8771..381a25fff2d 100644 --- a/src/cloudflare/resources/workers/scripts/content.py +++ b/src/cloudflare/resources/workers/scripts/content.py @@ -10,6 +10,7 @@ from ...._utils import ( extract_files, maybe_transform, + strip_not_given, deepcopy_minimal, async_maybe_transform, ) @@ -56,6 +57,8 @@ def update( account_id: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + cf_worker_body_part: str | NotGiven = NOT_GIVEN, + cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -92,6 +95,15 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = { + **strip_not_given( + { + "CF-WORKER-BODY-PART": cf_worker_body_part, + "CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part, + } + ), + **(extra_headers or {}), + } body = deepcopy_minimal( { "any_part_name": any_part_name, @@ -176,6 +188,8 @@ async def update( account_id: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + cf_worker_body_part: str | NotGiven = NOT_GIVEN, + cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -212,6 +226,15 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = { + **strip_not_given( + { + "CF-WORKER-BODY-PART": cf_worker_body_part, + "CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part, + } + ), + **(extra_headers or {}), + } body = deepcopy_minimal( { "any_part_name": any_part_name, diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py index 66185449605..c0e679c40d1 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py @@ -10,6 +10,7 @@ from ......_utils import ( extract_files, maybe_transform, + strip_not_given, deepcopy_minimal, async_maybe_transform, ) @@ -57,6 +58,8 @@ def update( dispatch_namespace: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + cf_worker_body_part: str | NotGiven = NOT_GIVEN, + cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -97,6 +100,15 @@ def update( raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = { + **strip_not_given( + { + "CF-WORKER-BODY-PART": cf_worker_body_part, + "CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part, + } + ), + **(extra_headers or {}), + } body = deepcopy_minimal( { "any_part_name": any_part_name, @@ -188,6 +200,8 @@ async def update( dispatch_namespace: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + cf_worker_body_part: str | NotGiven = NOT_GIVEN, + cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -228,6 +242,15 @@ async def update( raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = { + **strip_not_given( + { + "CF-WORKER-BODY-PART": cf_worker_body_part, + "CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part, + } + ), + **(extra_headers or {}), + } body = deepcopy_minimal( { "any_part_name": any_part_name, diff --git a/src/cloudflare/types/stream/copy_create_params.py b/src/cloudflare/types/stream/copy_create_params.py index 7049042d564..94338a1f17b 100644 --- a/src/cloudflare/types/stream/copy_create_params.py +++ b/src/cloudflare/types/stream/copy_create_params.py @@ -65,6 +65,16 @@ class CopyCreateParams(TypedDict, total=False): watermark: Watermark + upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")] + """A user-defined identifier for the media creator.""" + + upload_metadata: Annotated[str, PropertyInfo(alias="Upload-Metadata")] + """Comma-separated key-value pairs following the TUS protocol specification. + + Values are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + """ + class Watermark(TypedDict, total=False): uid: str diff --git a/src/cloudflare/types/stream/direct_upload_create_params.py b/src/cloudflare/types/stream/direct_upload_create_params.py index 6689ff92e37..7b4354993a1 100644 --- a/src/cloudflare/types/stream/direct_upload_create_params.py +++ b/src/cloudflare/types/stream/direct_upload_create_params.py @@ -68,6 +68,9 @@ class DirectUploadCreateParams(TypedDict, total=False): watermark: Watermark + upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")] + """A user-defined identifier for the media creator.""" + class Watermark(TypedDict, total=False): uid: str diff --git a/src/cloudflare/types/stream/stream_create_params.py b/src/cloudflare/types/stream/stream_create_params.py index 438ac398bc7..9585b05ec41 100644 --- a/src/cloudflare/types/stream/stream_create_params.py +++ b/src/cloudflare/types/stream/stream_create_params.py @@ -2,7 +2,9 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo __all__ = ["StreamCreateParams"] @@ -12,3 +14,26 @@ class StreamCreateParams(TypedDict, total=False): """The account identifier tag.""" body: Required[object] + + tus_resumable: Required[Annotated[Literal["1.0.0"], PropertyInfo(alias="Tus-Resumable")]] + """Specifies the TUS protocol version. + + This value must be included in every upload request. Notes: The only supported + version of TUS protocol is 1.0.0. + """ + + upload_length: Required[Annotated[int, PropertyInfo(alias="Upload-Length")]] + """Indicates the size of the entire upload in bytes. + + The value must be a non-negative integer. + """ + + upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")] + """A user-defined identifier for the media creator.""" + + upload_metadata: Annotated[str, PropertyInfo(alias="Upload-Metadata")] + """Comma-separated key-value pairs following the TUS protocol specification. + + Values are Base-64 encoded. Supported keys: `name`, `requiresignedurls`, + `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`. + """ diff --git a/src/cloudflare/types/workers/scripts/content_update_params.py b/src/cloudflare/types/workers/scripts/content_update_params.py index 8cc85869cad..f5c5e96e343 100644 --- a/src/cloudflare/types/workers/scripts/content_update_params.py +++ b/src/cloudflare/types/workers/scripts/content_update_params.py @@ -29,3 +29,7 @@ class ContentUpdateParams(TypedDict, total=False): metadata: WorkerMetadataParam """JSON encoded metadata about the uploaded parts and Worker configuration.""" + + cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")] + + cf_worker_main_module_part: Annotated[str, PropertyInfo(alias="CF-WORKER-MAIN-MODULE-PART")] diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py index a9f9eceeb85..9f4d3118469 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py @@ -32,3 +32,7 @@ class ContentUpdateParams(TypedDict, total=False): metadata: WorkerMetadataParam """JSON encoded metadata about the uploaded parts and Worker configuration.""" + + cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")] + + cf_worker_main_module_part: Annotated[str, PropertyInfo(alias="CF-WORKER-MAIN-MODULE-PART")] diff --git a/tests/api_resources/stream/test_copy.py b/tests/api_resources/stream/test_copy.py index 191a1cc36c3..fa2c1cdd5b1 100644 --- a/tests/api_resources/stream/test_copy.py +++ b/tests/api_resources/stream/test_copy.py @@ -38,6 +38,8 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"), thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, + upload_creator="creator-id_abcde12345", + upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=", ) assert_matches_type(Optional[Video], copy, path=["response"]) @@ -99,6 +101,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"), thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, + upload_creator="creator-id_abcde12345", + upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=", ) assert_matches_type(Optional[Video], copy, path=["response"]) diff --git a/tests/api_resources/stream/test_direct_upload.py b/tests/api_resources/stream/test_direct_upload.py index 7115e89cc14..54f9c3d0070 100644 --- a/tests/api_resources/stream/test_direct_upload.py +++ b/tests/api_resources/stream/test_direct_upload.py @@ -39,6 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"), thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, + upload_creator="creator-id_abcde12345", ) assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @@ -101,6 +102,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"), thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, + upload_creator="creator-id_abcde12345", ) assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) diff --git a/tests/api_resources/test_stream.py b/tests/api_resources/test_stream.py index ee6f6fbfc80..5bab50b63ce 100644 --- a/tests/api_resources/test_stream.py +++ b/tests/api_resources/test_stream.py @@ -25,6 +25,21 @@ def test_method_create(self, client: Cloudflare) -> None: stream = client.stream.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, + tus_resumable="1.0.0", + upload_length=0, + ) + assert stream is None + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + stream = client.stream.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + tus_resumable="1.0.0", + upload_length=0, + upload_creator="creator-id_abcde12345", + upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=", ) assert stream is None @@ -34,6 +49,8 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.stream.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, + tus_resumable="1.0.0", + upload_length=0, ) assert response.is_closed is True @@ -47,6 +64,8 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.stream.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, + tus_resumable="1.0.0", + upload_length=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,6 +82,8 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.stream.with_raw_response.create( account_id="", body={}, + tus_resumable="1.0.0", + upload_length=0, ) @parametrize @@ -224,6 +245,21 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: stream = await async_client.stream.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, + tus_resumable="1.0.0", + upload_length=0, + ) + assert stream is None + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + stream = await async_client.stream.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + tus_resumable="1.0.0", + upload_length=0, + upload_creator="creator-id_abcde12345", + upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=", ) assert stream is None @@ -233,6 +269,8 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.stream.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, + tus_resumable="1.0.0", + upload_length=0, ) assert response.is_closed is True @@ -246,6 +284,8 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.stream.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, + tus_resumable="1.0.0", + upload_length=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -262,6 +302,8 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.stream.with_raw_response.create( account_id="", body={}, + tus_resumable="1.0.0", + upload_length=0, ) @parametrize diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py index 9a748afefda..ade69104c00 100644 --- a/tests/api_resources/workers/scripts/test_content.py +++ b/tests/api_resources/workers/scripts/test_content.py @@ -45,6 +45,8 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "body_part": "worker.js", "main_module": "worker.js", }, + cf_worker_body_part="string", + cf_worker_main_module_part="string", ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -181,6 +183,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "body_part": "worker.js", "main_module": "worker.js", }, + cf_worker_body_part="string", + cf_worker_main_module_part="string", ) assert_matches_type(Optional[Script], content, path=["response"]) diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py index a9073edfee5..cfbbc556765 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py @@ -47,6 +47,8 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "body_part": "worker.js", "main_module": "worker.js", }, + cf_worker_body_part="string", + cf_worker_main_module_part="string", ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -208,6 +210,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "body_part": "worker.js", "main_module": "worker.js", }, + cf_worker_body_part="string", + cf_worker_main_module_part="string", ) assert_matches_type(Optional[Script], content, path=["response"])