From 7adc9432296b46bfffe382e6f5b7d01e39ceccf7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:23:17 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#315) --- api.md | 70 +++++++++--------- src/cloudflare/resources/calls.py | 34 ++++----- .../resources/stream/audio_tracks.py | 34 ++++----- src/cloudflare/resources/stream/captions.py | 73 ++++++++----------- src/cloudflare/resources/stream/clip.py | 10 +-- src/cloudflare/resources/stream/copy.py | 10 +-- .../resources/stream/direct_upload.py | 10 +-- src/cloudflare/resources/stream/downloads.py | 26 +++---- src/cloudflare/resources/stream/keys.py | 26 +++---- .../stream/live_inputs/live_inputs.py | 34 ++++----- .../resources/stream/live_inputs/outputs.py | 18 ++--- src/cloudflare/resources/stream/stream.py | 10 +-- src/cloudflare/resources/stream/token.py | 10 +-- src/cloudflare/resources/stream/videos.py | 10 +-- src/cloudflare/resources/stream/watermarks.py | 26 +++---- src/cloudflare/resources/stream/webhooks.py | 26 +++---- .../types/stream/caption_delete_response.py | 3 +- .../stream/live_inputs/test_outputs.py | 30 ++++---- .../api_resources/stream/test_audio_tracks.py | 58 +++++++-------- tests/api_resources/stream/test_captions.py | 39 +++++----- tests/api_resources/stream/test_clip.py | 18 ++--- tests/api_resources/stream/test_copy.py | 18 ++--- .../stream/test_direct_upload.py | 18 ++--- tests/api_resources/stream/test_downloads.py | 38 +++++----- tests/api_resources/stream/test_keys.py | 38 +++++----- .../api_resources/stream/test_live_inputs.py | 62 ++++++++-------- tests/api_resources/stream/test_token.py | 18 ++--- tests/api_resources/stream/test_videos.py | 18 ++--- tests/api_resources/stream/test_watermarks.py | 42 +++++------ tests/api_resources/stream/test_webhooks.py | 38 +++++----- tests/api_resources/test_calls.py | 58 +++++++-------- tests/api_resources/test_stream.py | 14 ++-- 32 files changed, 462 insertions(+), 475 deletions(-) diff --git a/api.md b/api.md index a320fa98030d..b46fe3eb4bce 100644 --- a/api.md +++ b/api.md @@ -4223,7 +4223,7 @@ Methods: - client.stream.create(\*, account_id, \*\*params) -> None - client.stream.list(\*, account_id, \*\*params) -> SyncSinglePage[Video] - client.stream.delete(identifier, \*, account_id, \*\*params) -> None -- client.stream.get(identifier, \*, account_id) -> Video +- client.stream.get(identifier, \*, account_id) -> Optional ## AudioTracks @@ -4235,10 +4235,10 @@ from cloudflare.types.stream import Audio, AudioTrackDeleteResponse, AudioTrackG Methods: -- client.stream.audio_tracks.delete(audio_identifier, \*, account_id, identifier) -> AudioTrackDeleteResponse -- client.stream.audio_tracks.copy(identifier, \*, account_id, \*\*params) -> Audio -- client.stream.audio_tracks.edit(audio_identifier, \*, account_id, identifier, \*\*params) -> Audio -- client.stream.audio_tracks.get(identifier, \*, account_id) -> AudioTrackGetResponse +- client.stream.audio_tracks.delete(audio_identifier, \*, account_id, identifier) -> Optional +- client.stream.audio_tracks.copy(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.audio_tracks.edit(audio_identifier, \*, account_id, identifier, \*\*params) -> Optional +- client.stream.audio_tracks.get(identifier, \*, account_id) -> Optional ## Videos @@ -4250,7 +4250,7 @@ from cloudflare.types.stream import VideoStorageUsageResponse Methods: -- client.stream.videos.storage_usage(\*, account_id, \*\*params) -> VideoStorageUsageResponse +- client.stream.videos.storage_usage(\*, account_id, \*\*params) -> Optional ## ClipResource @@ -4262,13 +4262,13 @@ from cloudflare.types.stream import Clip Methods: -- client.stream.clip.create(\*, account_id, \*\*params) -> Clip +- client.stream.clip.create(\*, account_id, \*\*params) -> Optional ## Copy Methods: -- client.stream.copy.create(\*, account_id, \*\*params) -> Video +- client.stream.copy.create(\*, account_id, \*\*params) -> Optional ## DirectUpload @@ -4280,7 +4280,7 @@ from cloudflare.types.stream import DirectUploadCreateResponse Methods: -- client.stream.direct_upload.create(\*, account_id, \*\*params) -> DirectUploadCreateResponse +- client.stream.direct_upload.create(\*, account_id, \*\*params) -> Optional ## Keys @@ -4292,9 +4292,9 @@ from cloudflare.types.stream import Keys, KeyDeleteResponse, KeyGetResponse Methods: -- client.stream.keys.create(\*, account_id, \*\*params) -> Keys -- client.stream.keys.delete(identifier, \*, account_id, \*\*params) -> KeyDeleteResponse -- client.stream.keys.get(\*, account_id) -> KeyGetResponse +- client.stream.keys.create(\*, account_id, \*\*params) -> Optional +- client.stream.keys.delete(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.keys.get(\*, account_id) -> Optional ## LiveInputs @@ -4306,11 +4306,11 @@ from cloudflare.types.stream import LiveInput, LiveInputListResponse Methods: -- client.stream.live_inputs.create(\*, account_id, \*\*params) -> LiveInput -- client.stream.live_inputs.update(live_input_identifier, \*, account_id, \*\*params) -> LiveInput -- client.stream.live_inputs.list(\*, account_id, \*\*params) -> LiveInputListResponse +- client.stream.live_inputs.create(\*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.update(live_input_identifier, \*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.list(\*, account_id, \*\*params) -> Optional - client.stream.live_inputs.delete(live_input_identifier, \*, account_id, \*\*params) -> None -- client.stream.live_inputs.get(live_input_identifier, \*, account_id) -> LiveInput +- client.stream.live_inputs.get(live_input_identifier, \*, account_id) -> Optional ### Outputs @@ -4322,8 +4322,8 @@ from cloudflare.types.stream.live_inputs import Output Methods: -- client.stream.live_inputs.outputs.create(live_input_identifier, \*, account_id, \*\*params) -> Output -- client.stream.live_inputs.outputs.update(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> Output +- client.stream.live_inputs.outputs.create(live_input_identifier, \*, account_id, \*\*params) -> Optional +- client.stream.live_inputs.outputs.update(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> Optional - client.stream.live_inputs.outputs.list(live_input_identifier, \*, account_id) -> SyncSinglePage[Output] - client.stream.live_inputs.outputs.delete(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> None @@ -4342,10 +4342,10 @@ from cloudflare.types.stream import ( Methods: -- client.stream.watermarks.create(\*, account_id, \*\*params) -> WatermarkCreateResponse +- client.stream.watermarks.create(\*, account_id, \*\*params) -> Optional - client.stream.watermarks.list(\*, account_id) -> SyncSinglePage[Watermaks] -- client.stream.watermarks.delete(identifier, \*, account_id, \*\*params) -> WatermarkDeleteResponse -- client.stream.watermarks.get(identifier, \*, account_id) -> WatermarkGetResponse +- client.stream.watermarks.delete(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.watermarks.get(identifier, \*, account_id) -> Optional ## Webhooks @@ -4357,9 +4357,9 @@ from cloudflare.types.stream import WebhookUpdateResponse, WebhookDeleteResponse Methods: -- client.stream.webhooks.update(\*, account_id, \*\*params) -> WebhookUpdateResponse -- client.stream.webhooks.delete(\*, account_id, \*\*params) -> WebhookDeleteResponse -- client.stream.webhooks.get(\*, account_id) -> WebhookGetResponse +- client.stream.webhooks.update(\*, account_id, \*\*params) -> Optional +- client.stream.webhooks.delete(\*, account_id, \*\*params) -> Optional +- client.stream.webhooks.get(\*, account_id) -> Optional ## Captions @@ -4376,9 +4376,9 @@ from cloudflare.types.stream import ( Methods: -- client.stream.captions.update(language, \*, account_id, identifier, \*\*params) -> CaptionUpdateResponse -- client.stream.captions.delete(language, \*, account_id, identifier, \*\*params) -> CaptionDeleteResponse -- client.stream.captions.get(identifier, \*, account_id) -> CaptionGetResponse +- client.stream.captions.update(language, \*, account_id, identifier, \*\*params) -> Optional +- client.stream.captions.delete(language, \*, account_id, identifier, \*\*params) -> str +- client.stream.captions.get(identifier, \*, account_id) -> Optional ## Downloads @@ -4394,9 +4394,9 @@ from cloudflare.types.stream import ( Methods: -- client.stream.downloads.create(identifier, \*, account_id, \*\*params) -> DownloadCreateResponse -- client.stream.downloads.delete(identifier, \*, account_id) -> DownloadDeleteResponse -- client.stream.downloads.get(identifier, \*, account_id) -> DownloadGetResponse +- client.stream.downloads.create(identifier, \*, account_id, \*\*params) -> Optional +- client.stream.downloads.delete(identifier, \*, account_id) -> Optional +- client.stream.downloads.get(identifier, \*, account_id) -> Optional ## Embed @@ -4420,7 +4420,7 @@ from cloudflare.types.stream import TokenCreateResponse Methods: -- client.stream.token.create(identifier, \*, account_id, \*\*params) -> TokenCreateResponse +- client.stream.token.create(identifier, \*, account_id, \*\*params) -> Optional # Alerting @@ -7272,11 +7272,11 @@ from cloudflare.types import CallsApp, CallsAppWithSecret Methods: -- client.calls.create(\*, account_id, \*\*params) -> CallsAppWithSecret -- client.calls.update(app_id, \*, account_id, \*\*params) -> CallsApp +- client.calls.create(\*, account_id, \*\*params) -> Optional +- client.calls.update(app_id, \*, account_id, \*\*params) -> Optional - client.calls.list(\*, account_id) -> SyncSinglePage[CallsApp] -- client.calls.delete(app_id, \*, account_id) -> CallsApp -- client.calls.get(app_id, \*, account_id) -> CallsApp +- client.calls.delete(app_id, \*, account_id) -> Optional +- client.calls.get(app_id, \*, account_id) -> Optional # CloudforceOne diff --git a/src/cloudflare/resources/calls.py b/src/cloudflare/resources/calls.py index 595b997a7e5f..383090a8c33a 100644 --- a/src/cloudflare/resources/calls.py +++ b/src/cloudflare/resources/calls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -50,7 +50,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsAppWithSecret: + ) -> Optional[CallsAppWithSecret]: """Creates a new Cloudflare calls app. An app is an unique enviroment where each @@ -81,7 +81,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsAppWithSecret], ResultWrapper[CallsAppWithSecret]), + cast_to=cast(Type[Optional[CallsAppWithSecret]], ResultWrapper[CallsAppWithSecret]), ) def update( @@ -96,7 +96,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Edit details for a single app. @@ -129,7 +129,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) def list( @@ -179,7 +179,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Deletes an app from Cloudflare Calls @@ -209,7 +209,7 @@ def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) def get( @@ -223,7 +223,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Fetches details for a single Calls app. @@ -253,7 +253,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) @@ -277,7 +277,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsAppWithSecret: + ) -> Optional[CallsAppWithSecret]: """Creates a new Cloudflare calls app. An app is an unique enviroment where each @@ -308,7 +308,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsAppWithSecret], ResultWrapper[CallsAppWithSecret]), + cast_to=cast(Type[Optional[CallsAppWithSecret]], ResultWrapper[CallsAppWithSecret]), ) async def update( @@ -323,7 +323,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Edit details for a single app. @@ -356,7 +356,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) def list( @@ -406,7 +406,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Deletes an app from Cloudflare Calls @@ -436,7 +436,7 @@ async def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) async def get( @@ -450,7 +450,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallsApp: + ) -> Optional[CallsApp]: """ Fetches details for a single Calls app. @@ -480,7 +480,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), + cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), ) diff --git a/src/cloudflare/resources/stream/audio_tracks.py b/src/cloudflare/resources/stream/audio_tracks.py index 9f9510574728..29b6b4ebe441 100644 --- a/src/cloudflare/resources/stream/audio_tracks.py +++ b/src/cloudflare/resources/stream/audio_tracks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, Type, Optional, cast import httpx @@ -55,7 +55,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackDeleteResponse: + ) -> Optional[AudioTrackDeleteResponse]: """Deletes additional audio tracks on a video. Deleting a default audio track is @@ -83,7 +83,7 @@ def delete( if not audio_identifier: raise ValueError(f"Expected a non-empty value for `audio_identifier` but received {audio_identifier!r}") return cast( - AudioTrackDeleteResponse, + Optional[AudioTrackDeleteResponse], self._delete( f"/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}", options=make_request_options( @@ -112,7 +112,7 @@ def copy( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Audio: + ) -> Optional[Audio]: """ Adds an additional audio track to a video using the provided audio track URL. @@ -156,7 +156,7 @@ def copy( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Audio], ResultWrapper[Audio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) def edit( @@ -173,7 +173,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Audio: + ) -> Optional[Audio]: """Edits additional audio tracks on a video. Editing the default status of an audio @@ -222,7 +222,7 @@ def edit( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Audio], ResultWrapper[Audio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) def get( @@ -236,7 +236,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackGetResponse: + ) -> Optional[AudioTrackGetResponse]: """Lists additional audio tracks on a video. Note this API will not return @@ -268,7 +268,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AudioTrackGetResponse], ResultWrapper[AudioTrackGetResponse]), + cast_to=cast(Type[Optional[AudioTrackGetResponse]], ResultWrapper[AudioTrackGetResponse]), ) @@ -293,7 +293,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackDeleteResponse: + ) -> Optional[AudioTrackDeleteResponse]: """Deletes additional audio tracks on a video. Deleting a default audio track is @@ -321,7 +321,7 @@ async def delete( if not audio_identifier: raise ValueError(f"Expected a non-empty value for `audio_identifier` but received {audio_identifier!r}") return cast( - AudioTrackDeleteResponse, + Optional[AudioTrackDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/{identifier}/audio/{audio_identifier}", options=make_request_options( @@ -350,7 +350,7 @@ async def copy( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Audio: + ) -> Optional[Audio]: """ Adds an additional audio track to a video using the provided audio track URL. @@ -394,7 +394,7 @@ async def copy( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Audio], ResultWrapper[Audio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) async def edit( @@ -411,7 +411,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Audio: + ) -> Optional[Audio]: """Edits additional audio tracks on a video. Editing the default status of an audio @@ -460,7 +460,7 @@ async def edit( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Audio], ResultWrapper[Audio]), + cast_to=cast(Type[Optional[Audio]], ResultWrapper[Audio]), ) async def get( @@ -474,7 +474,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AudioTrackGetResponse: + ) -> Optional[AudioTrackGetResponse]: """Lists additional audio tracks on a video. Note this API will not return @@ -506,7 +506,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AudioTrackGetResponse], ResultWrapper[AudioTrackGetResponse]), + cast_to=cast(Type[Optional[AudioTrackGetResponse]], ResultWrapper[AudioTrackGetResponse]), ) diff --git a/src/cloudflare/resources/stream/captions.py b/src/cloudflare/resources/stream/captions.py index 4c7b84edb8a6..2d7ddf9fd619 100644 --- a/src/cloudflare/resources/stream/captions.py +++ b/src/cloudflare/resources/stream/captions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, Type, Optional, cast import httpx @@ -25,7 +25,6 @@ ) from ...types.stream import ( CaptionGetResponse, - CaptionDeleteResponse, CaptionUpdateResponse, caption_delete_params, caption_update_params, @@ -56,7 +55,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionUpdateResponse: + ) -> Optional[CaptionUpdateResponse]: """ Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed. @@ -85,7 +84,7 @@ def update( if not language: raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") return cast( - CaptionUpdateResponse, + Optional[CaptionUpdateResponse], self._put( f"/accounts/{account_id}/stream/{identifier}/captions/{language}", body=maybe_transform({"file": file}, caption_update_params.CaptionUpdateParams), @@ -115,7 +114,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionDeleteResponse: + ) -> str: """ Removes the captions or subtitles from a video. @@ -140,22 +139,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") if not language: raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") - return cast( - CaptionDeleteResponse, - self._delete( - f"/accounts/{account_id}/stream/{identifier}/captions/{language}", - body=maybe_transform(body, caption_delete_params.CaptionDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CaptionDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + body=maybe_transform(body, caption_delete_params.CaptionDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper._unwrapper, ), + cast_to=cast(Type[str], ResultWrapper[str]), ) def get( @@ -169,7 +163,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionGetResponse: + ) -> Optional[CaptionGetResponse]: """ Lists the available captions or subtitles for a specific video. @@ -199,7 +193,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CaptionGetResponse], ResultWrapper[CaptionGetResponse]), + cast_to=cast(Type[Optional[CaptionGetResponse]], ResultWrapper[CaptionGetResponse]), ) @@ -225,7 +219,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionUpdateResponse: + ) -> Optional[CaptionUpdateResponse]: """ Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed. @@ -254,7 +248,7 @@ async def update( if not language: raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") return cast( - CaptionUpdateResponse, + Optional[CaptionUpdateResponse], await self._put( f"/accounts/{account_id}/stream/{identifier}/captions/{language}", body=await async_maybe_transform({"file": file}, caption_update_params.CaptionUpdateParams), @@ -284,7 +278,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionDeleteResponse: + ) -> str: """ Removes the captions or subtitles from a video. @@ -309,22 +303,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") if not language: raise ValueError(f"Expected a non-empty value for `language` but received {language!r}") - return cast( - CaptionDeleteResponse, - await self._delete( - f"/accounts/{account_id}/stream/{identifier}/captions/{language}", - body=await async_maybe_transform(body, caption_delete_params.CaptionDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CaptionDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/stream/{identifier}/captions/{language}", + body=await async_maybe_transform(body, caption_delete_params.CaptionDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper._unwrapper, ), + cast_to=cast(Type[str], ResultWrapper[str]), ) async def get( @@ -338,7 +327,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CaptionGetResponse: + ) -> Optional[CaptionGetResponse]: """ Lists the available captions or subtitles for a specific video. @@ -368,7 +357,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[CaptionGetResponse], ResultWrapper[CaptionGetResponse]), + cast_to=cast(Type[Optional[CaptionGetResponse]], ResultWrapper[CaptionGetResponse]), ) diff --git a/src/cloudflare/resources/stream/clip.py b/src/cloudflare/resources/stream/clip.py index 9a280ecf14ec..5714a50b91c2 100644 --- a/src/cloudflare/resources/stream/clip.py +++ b/src/cloudflare/resources/stream/clip.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Clip: + ) -> Optional[Clip]: """ Clips a video based on the specified start and end times provided in seconds. @@ -122,7 +122,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Clip], ResultWrapper[Clip]), + cast_to=cast(Type[Optional[Clip]], ResultWrapper[Clip]), ) @@ -154,7 +154,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Clip: + ) -> Optional[Clip]: """ Clips a video based on the specified start and end times provided in seconds. @@ -219,7 +219,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Clip], ResultWrapper[Clip]), + cast_to=cast(Type[Optional[Clip]], ResultWrapper[Clip]), ) diff --git a/src/cloudflare/resources/stream/copy.py b/src/cloudflare/resources/stream/copy.py index 78932d9fa9a3..524050776be1 100644 --- a/src/cloudflare/resources/stream/copy.py +++ b/src/cloudflare/resources/stream/copy.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, cast +from typing import List, Type, Union, Optional, cast from datetime import datetime import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Video: + ) -> Optional[Video]: """ Uploads a video to Stream from a provided URL. @@ -121,7 +121,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Video], ResultWrapper[Video]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) @@ -152,7 +152,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Video: + ) -> Optional[Video]: """ Uploads a video to Stream from a provided URL. @@ -216,7 +216,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Video], ResultWrapper[Video]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) diff --git a/src/cloudflare/resources/stream/direct_upload.py b/src/cloudflare/resources/stream/direct_upload.py index 30dcf4c4d729..ceb5aed33aad 100644 --- a/src/cloudflare/resources/stream/direct_upload.py +++ b/src/cloudflare/resources/stream/direct_upload.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, cast +from typing import List, Type, Union, Optional, cast from datetime import datetime import httpx @@ -58,7 +58,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DirectUploadCreateResponse: + ) -> Optional[DirectUploadCreateResponse]: """ Creates a direct upload that allows video uploads without an API key. @@ -126,7 +126,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DirectUploadCreateResponse], ResultWrapper[DirectUploadCreateResponse]), + cast_to=cast(Type[Optional[DirectUploadCreateResponse]], ResultWrapper[DirectUploadCreateResponse]), ) @@ -158,7 +158,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DirectUploadCreateResponse: + ) -> Optional[DirectUploadCreateResponse]: """ Creates a direct upload that allows video uploads without an API key. @@ -226,7 +226,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DirectUploadCreateResponse], ResultWrapper[DirectUploadCreateResponse]), + cast_to=cast(Type[Optional[DirectUploadCreateResponse]], ResultWrapper[DirectUploadCreateResponse]), ) diff --git a/src/cloudflare/resources/stream/downloads.py b/src/cloudflare/resources/stream/downloads.py index af8f714cd63b..29b1ba5900ca 100644 --- a/src/cloudflare/resources/stream/downloads.py +++ b/src/cloudflare/resources/stream/downloads.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -49,7 +49,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadCreateResponse: + ) -> Optional[DownloadCreateResponse]: """ Creates a download for a video when a video is ready to view. @@ -71,7 +71,7 @@ def create( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadCreateResponse, + Optional[DownloadCreateResponse], self._post( f"/accounts/{account_id}/stream/{identifier}/downloads", body=maybe_transform(body, download_create_params.DownloadCreateParams), @@ -99,7 +99,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadDeleteResponse: + ) -> Optional[DownloadDeleteResponse]: """ Delete the downloads for a video. @@ -121,7 +121,7 @@ def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadDeleteResponse, + Optional[DownloadDeleteResponse], self._delete( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -148,7 +148,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadGetResponse: + ) -> Optional[DownloadGetResponse]: """ Lists the downloads created for a video. @@ -170,7 +170,7 @@ def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadGetResponse, + Optional[DownloadGetResponse], self._get( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -208,7 +208,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadCreateResponse: + ) -> Optional[DownloadCreateResponse]: """ Creates a download for a video when a video is ready to view. @@ -230,7 +230,7 @@ async def create( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadCreateResponse, + Optional[DownloadCreateResponse], await self._post( f"/accounts/{account_id}/stream/{identifier}/downloads", body=await async_maybe_transform(body, download_create_params.DownloadCreateParams), @@ -258,7 +258,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadDeleteResponse: + ) -> Optional[DownloadDeleteResponse]: """ Delete the downloads for a video. @@ -280,7 +280,7 @@ async def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadDeleteResponse, + Optional[DownloadDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( @@ -307,7 +307,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DownloadGetResponse: + ) -> Optional[DownloadGetResponse]: """ Lists the downloads created for a video. @@ -329,7 +329,7 @@ async def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - DownloadGetResponse, + Optional[DownloadGetResponse], await self._get( f"/accounts/{account_id}/stream/{identifier}/downloads", options=make_request_options( diff --git a/src/cloudflare/resources/stream/keys.py b/src/cloudflare/resources/stream/keys.py index 158827f4bd2c..ad22aa5fea0b 100644 --- a/src/cloudflare/resources/stream/keys.py +++ b/src/cloudflare/resources/stream/keys.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, Type, Optional, cast import httpx @@ -48,7 +48,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> keys.Keys: + ) -> Optional[keys.Keys]: """Creates an RSA private key in PEM and JWK formats. Key files are only displayed @@ -78,7 +78,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[keys.Keys], ResultWrapper[keys.Keys]), + cast_to=cast(Type[Optional[keys.Keys]], ResultWrapper[keys.Keys]), ) def delete( @@ -93,7 +93,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyDeleteResponse: + ) -> Optional[KeyDeleteResponse]: """ Deletes signing keys and revokes all signed URLs generated with the key. @@ -115,7 +115,7 @@ def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyDeleteResponse, + Optional[KeyDeleteResponse], self._delete( f"/accounts/{account_id}/stream/keys/{identifier}", body=maybe_transform(body, key_delete_params.KeyDeleteParams), @@ -142,7 +142,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyGetResponse: + ) -> Optional[KeyGetResponse]: """ Lists the video ID and creation date and time when a signing key was created. @@ -168,7 +168,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[KeyGetResponse], ResultWrapper[KeyGetResponse]), + cast_to=cast(Type[Optional[KeyGetResponse]], ResultWrapper[KeyGetResponse]), ) @@ -192,7 +192,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> keys.Keys: + ) -> Optional[keys.Keys]: """Creates an RSA private key in PEM and JWK formats. Key files are only displayed @@ -222,7 +222,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[keys.Keys], ResultWrapper[keys.Keys]), + cast_to=cast(Type[Optional[keys.Keys]], ResultWrapper[keys.Keys]), ) async def delete( @@ -237,7 +237,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyDeleteResponse: + ) -> Optional[KeyDeleteResponse]: """ Deletes signing keys and revokes all signed URLs generated with the key. @@ -259,7 +259,7 @@ async def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - KeyDeleteResponse, + Optional[KeyDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/keys/{identifier}", body=await async_maybe_transform(body, key_delete_params.KeyDeleteParams), @@ -286,7 +286,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> KeyGetResponse: + ) -> Optional[KeyGetResponse]: """ Lists the video ID and creation date and time when a signing key was created. @@ -312,7 +312,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[KeyGetResponse], ResultWrapper[KeyGetResponse]), + cast_to=cast(Type[Optional[KeyGetResponse]], ResultWrapper[KeyGetResponse]), ) diff --git a/src/cloudflare/resources/stream/live_inputs/live_inputs.py b/src/cloudflare/resources/stream/live_inputs/live_inputs.py index 739a91f0eb55..c5a5e5f8c7b0 100644 --- a/src/cloudflare/resources/stream/live_inputs/live_inputs.py +++ b/src/cloudflare/resources/stream/live_inputs/live_inputs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -70,7 +70,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInput: + ) -> Optional[LiveInput]: """ Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream. @@ -121,7 +121,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInput], ResultWrapper[LiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) def update( @@ -139,7 +139,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInput: + ) -> Optional[LiveInput]: """ Updates a specified live input. @@ -195,7 +195,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInput], ResultWrapper[LiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) def list( @@ -209,7 +209,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInputListResponse: + ) -> Optional[LiveInputListResponse]: """Lists the live inputs created for an account. To get the credentials needed to @@ -241,7 +241,7 @@ def list( query=maybe_transform({"include_counts": include_counts}, live_input_list_params.LiveInputListParams), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInputListResponse], ResultWrapper[LiveInputListResponse]), + cast_to=cast(Type[Optional[LiveInputListResponse]], ResultWrapper[LiveInputListResponse]), ) def delete( @@ -301,7 +301,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInput: + ) -> Optional[LiveInput]: """ Retrieves details of an existing live input. @@ -333,7 +333,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInput], ResultWrapper[LiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) @@ -364,7 +364,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInput: + ) -> Optional[LiveInput]: """ Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream. @@ -415,7 +415,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInput], ResultWrapper[LiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) async def update( @@ -433,7 +433,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInput: + ) -> Optional[LiveInput]: """ Updates a specified live input. @@ -489,7 +489,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInput], ResultWrapper[LiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) async def list( @@ -503,7 +503,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInputListResponse: + ) -> Optional[LiveInputListResponse]: """Lists the live inputs created for an account. To get the credentials needed to @@ -537,7 +537,7 @@ async def list( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInputListResponse], ResultWrapper[LiveInputListResponse]), + cast_to=cast(Type[Optional[LiveInputListResponse]], ResultWrapper[LiveInputListResponse]), ) async def delete( @@ -597,7 +597,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LiveInput: + ) -> Optional[LiveInput]: """ Retrieves details of an existing live input. @@ -629,7 +629,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LiveInput], ResultWrapper[LiveInput]), + cast_to=cast(Type[Optional[LiveInput]], ResultWrapper[LiveInput]), ) diff --git a/src/cloudflare/resources/stream/live_inputs/outputs.py b/src/cloudflare/resources/stream/live_inputs/outputs.py index e07f639d5126..9bb026ab38c7 100644 --- a/src/cloudflare/resources/stream/live_inputs/outputs.py +++ b/src/cloudflare/resources/stream/live_inputs/outputs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -53,7 +53,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Output: + ) -> Optional[Output]: """ Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live @@ -105,7 +105,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Output], ResultWrapper[Output]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) def update( @@ -121,7 +121,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Output: + ) -> Optional[Output]: """ Updates the state of an output. @@ -164,7 +164,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Output], ResultWrapper[Output]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) def list( @@ -284,7 +284,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Output: + ) -> Optional[Output]: """ Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live @@ -336,7 +336,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Output], ResultWrapper[Output]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) async def update( @@ -352,7 +352,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Output: + ) -> Optional[Output]: """ Updates the state of an output. @@ -395,7 +395,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Output], ResultWrapper[Output]), + cast_to=cast(Type[Optional[Output]], ResultWrapper[Output]), ) def list( diff --git a/src/cloudflare/resources/stream/stream.py b/src/cloudflare/resources/stream/stream.py index 492fca9ef786..1401773bba58 100644 --- a/src/cloudflare/resources/stream/stream.py +++ b/src/cloudflare/resources/stream/stream.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -375,7 +375,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Video: + ) -> Optional[Video]: """ Fetches details for a single video. @@ -405,7 +405,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Video], ResultWrapper[Video]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) @@ -647,7 +647,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Video: + ) -> Optional[Video]: """ Fetches details for a single video. @@ -677,7 +677,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Video], ResultWrapper[Video]), + cast_to=cast(Type[Optional[Video]], ResultWrapper[Video]), ) diff --git a/src/cloudflare/resources/stream/token.py b/src/cloudflare/resources/stream/token.py index a2904a823b7b..2c7206e26799 100644 --- a/src/cloudflare/resources/stream/token.py +++ b/src/cloudflare/resources/stream/token.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -54,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenCreateResponse: + ) -> Optional[TokenCreateResponse]: """Creates a signed URL token for a video. If a body is not provided in the @@ -118,7 +118,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), + cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]), ) @@ -148,7 +148,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenCreateResponse: + ) -> Optional[TokenCreateResponse]: """Creates a signed URL token for a video. If a body is not provided in the @@ -212,7 +212,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), + cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]), ) diff --git a/src/cloudflare/resources/stream/videos.py b/src/cloudflare/resources/stream/videos.py index c491c2171337..5956a7a7f4ab 100644 --- a/src/cloudflare/resources/stream/videos.py +++ b/src/cloudflare/resources/stream/videos.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -48,7 +48,7 @@ def storage_usage( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VideoStorageUsageResponse: + ) -> Optional[VideoStorageUsageResponse]: """ Returns information about an account's storage use. @@ -77,7 +77,7 @@ def storage_usage( query=maybe_transform({"creator": creator}, video_storage_usage_params.VideoStorageUsageParams), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VideoStorageUsageResponse], ResultWrapper[VideoStorageUsageResponse]), + cast_to=cast(Type[Optional[VideoStorageUsageResponse]], ResultWrapper[VideoStorageUsageResponse]), ) @@ -101,7 +101,7 @@ async def storage_usage( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VideoStorageUsageResponse: + ) -> Optional[VideoStorageUsageResponse]: """ Returns information about an account's storage use. @@ -132,7 +132,7 @@ async def storage_usage( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VideoStorageUsageResponse], ResultWrapper[VideoStorageUsageResponse]), + cast_to=cast(Type[Optional[VideoStorageUsageResponse]], ResultWrapper[VideoStorageUsageResponse]), ) diff --git a/src/cloudflare/resources/stream/watermarks.py b/src/cloudflare/resources/stream/watermarks.py index f6226bed949c..9434f85040e3 100644 --- a/src/cloudflare/resources/stream/watermarks.py +++ b/src/cloudflare/resources/stream/watermarks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -62,7 +62,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkCreateResponse: + ) -> Optional[WatermarkCreateResponse]: """ Creates watermark profiles using a single `HTTP POST multipart/form-data` request. @@ -102,7 +102,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WatermarkCreateResponse, + Optional[WatermarkCreateResponse], self._post( f"/accounts/{account_id}/stream/watermarks", body=maybe_transform( @@ -177,7 +177,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkDeleteResponse: + ) -> Optional[WatermarkDeleteResponse]: """ Deletes a watermark profile. @@ -199,7 +199,7 @@ def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - WatermarkDeleteResponse, + Optional[WatermarkDeleteResponse], self._delete( f"/accounts/{account_id}/stream/watermarks/{identifier}", body=maybe_transform(body, watermark_delete_params.WatermarkDeleteParams), @@ -227,7 +227,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkGetResponse: + ) -> Optional[WatermarkGetResponse]: """ Retrieves details for a single watermark profile. @@ -249,7 +249,7 @@ def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - WatermarkGetResponse, + Optional[WatermarkGetResponse], self._get( f"/accounts/{account_id}/stream/watermarks/{identifier}", options=make_request_options( @@ -291,7 +291,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkCreateResponse: + ) -> Optional[WatermarkCreateResponse]: """ Creates watermark profiles using a single `HTTP POST multipart/form-data` request. @@ -331,7 +331,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WatermarkCreateResponse, + Optional[WatermarkCreateResponse], await self._post( f"/accounts/{account_id}/stream/watermarks", body=await async_maybe_transform( @@ -406,7 +406,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkDeleteResponse: + ) -> Optional[WatermarkDeleteResponse]: """ Deletes a watermark profile. @@ -428,7 +428,7 @@ async def delete( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - WatermarkDeleteResponse, + Optional[WatermarkDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/watermarks/{identifier}", body=await async_maybe_transform(body, watermark_delete_params.WatermarkDeleteParams), @@ -456,7 +456,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkGetResponse: + ) -> Optional[WatermarkGetResponse]: """ Retrieves details for a single watermark profile. @@ -478,7 +478,7 @@ async def get( if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") return cast( - WatermarkGetResponse, + Optional[WatermarkGetResponse], await self._get( f"/accounts/{account_id}/stream/watermarks/{identifier}", options=make_request_options( diff --git a/src/cloudflare/resources/stream/webhooks.py b/src/cloudflare/resources/stream/webhooks.py index a98c45e5d89b..cd7b7857a666 100644 --- a/src/cloudflare/resources/stream/webhooks.py +++ b/src/cloudflare/resources/stream/webhooks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -54,7 +54,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookUpdateResponse: + ) -> Optional[WebhookUpdateResponse]: """ Creates a webhook notification. @@ -74,7 +74,7 @@ def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookUpdateResponse, + Optional[WebhookUpdateResponse], self._put( f"/accounts/{account_id}/stream/webhook", body=maybe_transform({"notification_url": notification_url}, webhook_update_params.WebhookUpdateParams), @@ -102,7 +102,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookDeleteResponse: + ) -> Optional[WebhookDeleteResponse]: """ Deletes a webhook. @@ -120,7 +120,7 @@ def delete( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookDeleteResponse, + Optional[WebhookDeleteResponse], self._delete( f"/accounts/{account_id}/stream/webhook", body=maybe_transform(body, webhook_delete_params.WebhookDeleteParams), @@ -147,7 +147,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookGetResponse: + ) -> Optional[WebhookGetResponse]: """ Retrieves a list of webhooks. @@ -165,7 +165,7 @@ def get( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookGetResponse, + Optional[WebhookGetResponse], self._get( f"/accounts/{account_id}/stream/webhook", options=make_request_options( @@ -202,7 +202,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookUpdateResponse: + ) -> Optional[WebhookUpdateResponse]: """ Creates a webhook notification. @@ -222,7 +222,7 @@ async def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookUpdateResponse, + Optional[WebhookUpdateResponse], await self._put( f"/accounts/{account_id}/stream/webhook", body=await async_maybe_transform( @@ -252,7 +252,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookDeleteResponse: + ) -> Optional[WebhookDeleteResponse]: """ Deletes a webhook. @@ -270,7 +270,7 @@ async def delete( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookDeleteResponse, + Optional[WebhookDeleteResponse], await self._delete( f"/accounts/{account_id}/stream/webhook", body=await async_maybe_transform(body, webhook_delete_params.WebhookDeleteParams), @@ -297,7 +297,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookGetResponse: + ) -> Optional[WebhookGetResponse]: """ Retrieves a list of webhooks. @@ -315,7 +315,7 @@ async def get( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WebhookGetResponse, + Optional[WebhookGetResponse], await self._get( f"/accounts/{account_id}/stream/webhook", options=make_request_options( diff --git a/src/cloudflare/types/stream/caption_delete_response.py b/src/cloudflare/types/stream/caption_delete_response.py index 569104a09db8..67c99da0b8f8 100644 --- a/src/cloudflare/types/stream/caption_delete_response.py +++ b/src/cloudflare/types/stream/caption_delete_response.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union __all__ = ["CaptionDeleteResponse"] -CaptionDeleteResponse = Union[List[object], str, object] +CaptionDeleteResponse = str diff --git a/tests/api_resources/stream/live_inputs/test_outputs.py b/tests/api_resources/stream/live_inputs/test_outputs.py index d9d1b07eb10f..a02b342ef613 100644 --- a/tests/api_resources/stream/live_inputs/test_outputs.py +++ b/tests/api_resources/stream/live_inputs/test_outputs.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -27,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: stream_key="uzya-f19y-g2g9-a2ee-51j2", url="rtmp://a.rtmp.youtube.com/live2", ) - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: url="rtmp://a.rtmp.youtube.com/live2", enabled=True, ) - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +69,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,7 +101,7 @@ def test_method_update(self, client: Cloudflare) -> None: live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", enabled=True, ) - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +131,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -297,7 +297,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: stream_key="uzya-f19y-g2g9-a2ee-51j2", url="rtmp://a.rtmp.youtube.com/live2", ) - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +309,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare url="rtmp://a.rtmp.youtube.com/live2", enabled=True, ) - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -324,7 +324,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,7 +339,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -371,7 +371,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", enabled=True, ) - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -386,7 +386,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -401,7 +401,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(Output, output, path=["response"]) + assert_matches_type(Optional[Output], output, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_audio_tracks.py b/tests/api_resources/stream/test_audio_tracks.py index 8924d80f3557..71756af4ca3c 100644 --- a/tests/api_resources/stream/test_audio_tracks.py +++ b/tests/api_resources/stream/test_audio_tracks.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -29,7 +29,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +43,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ def test_method_copy(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", label="director commentary", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +104,7 @@ def test_method_copy_with_all_params(self, client: Cloudflare) -> None: label="director commentary", url="https://www.examplestorage.com/audio_file.mp3", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ def test_raw_response_copy(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -132,7 +132,7 @@ def test_streaming_response_copy(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: default=True, label="director commentary", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +187,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +201,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -236,7 +236,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -249,7 +249,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +262,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -293,7 +293,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -307,7 +307,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -321,7 +321,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(AudioTrackDeleteResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackDeleteResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -357,7 +357,7 @@ async def test_method_copy(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", label="director commentary", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -368,7 +368,7 @@ async def test_method_copy_with_all_params(self, async_client: AsyncCloudflare) label="director commentary", url="https://www.examplestorage.com/audio_file.mp3", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -382,7 +382,7 @@ async def test_raw_response_copy(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +396,7 @@ async def test_streaming_response_copy(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -425,7 +425,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", identifier="ea95132c15732412d22c1476fa83f27a", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -437,7 +437,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) default=True, label="director commentary", ) - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -451,7 +451,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -465,7 +465,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(Audio, audio_track, path=["response"]) + assert_matches_type(Optional[Audio], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True @@ -500,7 +500,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +513,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) @pytest.mark.skip() @parametrize @@ -526,7 +526,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" audio_track = await response.parse() - assert_matches_type(AudioTrackGetResponse, audio_track, path=["response"]) + assert_matches_type(Optional[AudioTrackGetResponse], audio_track, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_captions.py b/tests/api_resources/stream/test_captions.py index 6365db01a96e..8c2f801d1814 100644 --- a/tests/api_resources/stream/test_captions.py +++ b/tests/api_resources/stream/test_captions.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -11,7 +11,6 @@ from tests.utils import assert_matches_type from cloudflare.types.stream import ( CaptionGetResponse, - CaptionDeleteResponse, CaptionUpdateResponse, ) @@ -30,7 +29,7 @@ def test_method_update(self, client: Cloudflare) -> None: identifier="ea95132c15732412d22c1476fa83f27a", file="@/Users/kyle/Desktop/tr.vtt", ) - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionUpdateResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +44,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionUpdateResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +59,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionUpdateResponse], caption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -100,7 +99,7 @@ def test_method_delete(self, client: Cloudflare) -> None: identifier="ea95132c15732412d22c1476fa83f27a", body={}, ) - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) + assert_matches_type(str, caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +114,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) + assert_matches_type(str, caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +129,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) + assert_matches_type(str, caption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -168,7 +167,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -181,7 +180,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +193,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -226,7 +225,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: identifier="ea95132c15732412d22c1476fa83f27a", file="@/Users/kyle/Desktop/tr.vtt", ) - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionUpdateResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -241,7 +240,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionUpdateResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -256,7 +255,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionUpdateResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionUpdateResponse], caption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -296,7 +295,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: identifier="ea95132c15732412d22c1476fa83f27a", body={}, ) - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) + assert_matches_type(str, caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +310,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) + assert_matches_type(str, caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +325,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionDeleteResponse, caption, path=["response"]) + assert_matches_type(str, caption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -364,7 +363,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -377,7 +376,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) @pytest.mark.skip() @parametrize @@ -390,7 +389,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" caption = await response.parse() - assert_matches_type(CaptionGetResponse, caption, path=["response"]) + assert_matches_type(Optional[CaptionGetResponse], caption, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_clip.py b/tests/api_resources/stream/test_clip.py index c87a34a4b12b..3386eec53e7b 100644 --- a/tests/api_resources/stream/test_clip.py +++ b/tests/api_resources/stream/test_clip.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: end_time_seconds=0, start_time_seconds=0, ) - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +58,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" clip = response.parse() - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -73,7 +73,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" clip = response.parse() - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,7 +101,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: end_time_seconds=0, start_time_seconds=0, ) - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +118,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +133,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" clip = await response.parse() - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +148,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" clip = await response.parse() - assert_matches_type(Clip, clip, path=["response"]) + assert_matches_type(Optional[Clip], clip, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_copy.py b/tests/api_resources/stream/test_copy.py index ef0c4259030d..43a53f675eeb 100644 --- a/tests/api_resources/stream/test_copy.py +++ b/tests/api_resources/stream/test_copy.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://example.com/myvideo.mp4", ) - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" copy = response.parse() - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" copy = response.parse() - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -91,7 +91,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://example.com/myvideo.mp4", ) - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +120,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" copy = await response.parse() - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +133,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" copy = await response.parse() - assert_matches_type(Video, copy, path=["response"]) + assert_matches_type(Optional[Video], copy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_direct_upload.py b/tests/api_resources/stream/test_direct_upload.py index e01a1a24cf57..88e93522a5ab 100644 --- a/tests/api_resources/stream/test_direct_upload.py +++ b/tests/api_resources/stream/test_direct_upload.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", max_duration_seconds=1, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +42,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +55,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" direct_upload = response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" direct_upload = response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) assert cast(Any, response.is_closed) is True @@ -92,7 +92,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", max_duration_seconds=1, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +109,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare thumbnail_timestamp_pct=0.529241, watermark={"uid": "ea95132c15732412d22c1476fa83f27a"}, ) - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +122,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" direct_upload = await response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) @pytest.mark.skip() @parametrize @@ -135,7 +135,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" direct_upload = await response.parse() - assert_matches_type(DirectUploadCreateResponse, direct_upload, path=["response"]) + assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_downloads.py b/tests/api_resources/stream/test_downloads.py index c5a8662fa516..b5fda9a4b9da 100644 --- a/tests/api_resources/stream/test_downloads.py +++ b/tests/api_resources/stream/test_downloads.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +43,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +98,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -137,7 +137,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +150,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -163,7 +163,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +194,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +208,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -222,7 +222,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadCreateResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -250,7 +250,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +263,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +276,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadDeleteResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadDeleteResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True @@ -302,7 +302,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -315,7 +315,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) @pytest.mark.skip() @parametrize @@ -328,7 +328,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" download = await response.parse() - assert_matches_type(DownloadGetResponse, download, path=["response"]) + assert_matches_type(Optional[DownloadGetResponse], download, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_keys.py b/tests/api_resources/stream/test_keys.py index 308f30af324e..2be86064c481 100644 --- a/tests/api_resources/stream/test_keys.py +++ b/tests/api_resources/stream/test_keys.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Keys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(Keys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(Keys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -71,7 +71,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -85,7 +85,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -126,7 +126,7 @@ def test_method_get(self, client: Cloudflare) -> None: key = client.stream.keys.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +138,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +150,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -173,7 +173,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Keys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +186,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(Keys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +199,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(Keys, key, path=["response"]) + assert_matches_type(Optional[Keys], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -220,7 +220,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -234,7 +234,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +248,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyDeleteResponse, key, path=["response"]) + assert_matches_type(Optional[KeyDeleteResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -275,7 +275,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: key = await async_client.stream.keys.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -287,7 +287,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @pytest.mark.skip() @parametrize @@ -299,7 +299,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" key = await response.parse() - assert_matches_type(KeyGetResponse, key, path=["response"]) + assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_live_inputs.py b/tests/api_resources/stream/test_live_inputs.py index 6daaa1bafef4..f68199a02da4 100644 --- a/tests/api_resources/stream/test_live_inputs.py +++ b/tests/api_resources/stream/test_live_inputs.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: live_input = client.stream.live_inputs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "timeout_seconds": 0, }, ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +55,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +86,7 @@ def test_method_update(self, client: Cloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +104,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "timeout_seconds": 0, }, ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +130,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,7 +155,7 @@ def test_method_list(self, client: Cloudflare) -> None: live_input = client.stream.live_inputs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +164,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", include_counts=True, ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +176,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +188,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -264,7 +264,7 @@ def test_method_get(self, client: Cloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -277,7 +277,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -290,7 +290,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -319,7 +319,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: live_input = await async_client.stream.live_inputs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -336,7 +336,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "timeout_seconds": 0, }, ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -348,7 +348,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -360,7 +360,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -379,7 +379,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -397,7 +397,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "timeout_seconds": 0, }, ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -410,7 +410,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +423,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -448,7 +448,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: live_input = await async_client.stream.live_inputs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -457,7 +457,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", include_counts=True, ) - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +469,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -481,7 +481,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInputListResponse, live_input, path=["response"]) + assert_matches_type(Optional[LiveInputListResponse], live_input, path=["response"]) assert cast(Any, response.is_closed) is True @@ -557,7 +557,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -570,7 +570,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) @pytest.mark.skip() @parametrize @@ -583,7 +583,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" live_input = await response.parse() - assert_matches_type(LiveInput, live_input, path=["response"]) + assert_matches_type(Optional[LiveInput], live_input, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_token.py b/tests/api_resources/stream/test_token.py index e4202e636224..4fea7d3ac62c 100644 --- a/tests/api_resources/stream/test_token.py +++ b/tests/api_resources/stream/test_token.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -58,7 +58,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: nbf=0, pem="LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBc284dnBvOFpEWXRkOUgzbWlPaW1qYXAzVXlVM0oyZ3kwTUYvN1R4blJuRnkwRHpDCkxqUk9naFZsQ0hPQmxsd3NVaE9GU0lyYnN4K05tUTdBeS90TFpXSGxuVGF3UWJ5WGZGOStJeDhVSnNlSHBGV1oKNVF5Z1JYd2liSjh1MVVsZ2xlcmZHMkpueldjVXpZTzEySktZN3doSkw1ajROMWgxZFJNUXQ5Q1pkZFlCQWRzOQpCdk02cjRFMDcxQkhQekhWeDMrUTI1VWtubGdUNXIwS3FiM1E1Y0dlTlBXY1JreW1ybkJEWWR0OXR4eFFMb1dPCllzNXdsMnVYWFVYL0VGcDMwajU0Nmp6czllWExLYlNDbjJjTDZFVE96Y2x3aG9DRGx2a2VQT05rUE9LMDVKNUMKTm1TdFdhMG9hV1VGRzM0MFl3cVVrWGt4OU9tNndXd1JldU1uU1FJREFRQUJBb0lCQUFJOHo1ck5kOEdtOGJBMgo1S3pxQjI1R2lOVENwbUNJeW53NXRJWHZTQmNHcEdydUcvdlN2WG9kVlFVSVY0TWdHQkVXUEFrVzdsNWVBcHI4CnA1ZFd5SkRXYTNkdklFSE9vSEpYU3dBYksxZzZEMTNVa2NkZ1EyRGpoNVhuWDhHZCtBY2c2SmRTQWgxOWtYSHEKMk54RUtBVDB6Ri83a1g2MkRkREFBcWxmQkpGSXJodVIvZUdEVWh4L2piTTRhQ2JCcFdiM0pnRE9OYm5tS1ZoMwpxS2ZwZmRZZENZU1lzWUxrNTlxRDF2VFNwUVFUQ0VadW9VKzNzRVNhdkJzaUs1bU0vTzY5ZkRMRXNURG1MeTVQCmhEK3BMQXI0SlhNNjFwRGVBS0l3cUVqWWJybXlDRHRXTUdJNnZzZ0E1eXQzUUJaME9vV2w5QUkwdWxoZ3p4dXQKZ2ZFNTRRRUNnWUVBN0F3a0lhVEEzYmQ4Nk9jSVZnNFlrWGk1cm5aNDdsM1k4V24zcjIzUmVISXhLdkllRUtSbgp5bUlFNDFtRVBBSmlGWFpLK1VPTXdkeS9EcnFJUithT1JiT2NiV01jWUg2QzgvbG1wdVJFaXE3SW1Ub3VWcnA4CnlnUkprMWprVDA4cTIvNmg4eTBEdjJqMitsaHFXNzRNOUt0cmwxcTRlWmZRUFREL01tR1NnTWtDZ1lFQXdhY04KaSttN1p6dnJtL3NuekF2VlZ5SEtwZHVUUjNERk1naC9maC9tZ0ZHZ1RwZWtUOVV5b3FleGNYQXdwMVlhL01iQQoyNTVJVDZRbXZZTm5yNXp6Wmxic2tMV0hsYllvbWhmWnVXTHhXR3hRaEFORWdaMFVVdUVTRGMvbWx2UXZHbEtSCkZoaGhBUWlVSmdDamhPaHk1SlBiNGFldGRKd0UxK09lVWRFaE1vRUNnWUVBNG8yZ25CM1o4ck5xa3NzemlBek4KYmNuMlJVbDJOaW9pejBwS3JMaDFaT29NNE5BekpQdjJsaHRQMzdtS0htS1hLMHczRjFqTEgwSTBxZmxFVmVZbQpSU1huakdHazJjUnpBYUVzOGgrQzNheDE0Z01pZUtGU3BqNUpNOEFNbVVZOXQ1cUVhN2FYc3o0V1ZoOUlMYmVTCkRiNzlhKzVwd21LQVBrcnBsTHhyZFdrQ2dZQlNNSHVBWVdBbmJYZ1BDS2FZWklGVWJNUWNacmY0ZnpWQ2lmYksKYWZHampvRlNPZXdEOGdGK3BWdWJRTGwxbkFieU44ek1xVDRaaHhybUhpcFlqMjJDaHV2NmN3RXJtbGRiSnpwQwpBMnRaVXdkTk1ESFlMUG5lUHlZeGRJWnlsUXFVeW14SGkydElUQUxNcWtLOGV3ZWdXZHpkeGhQSlJScU5JazhrCmZIVHhnUUtCZ1FEUFc2UXIxY3F3QjNUdnVWdWR4WGRqUTdIcDFodXhrNEVWaEFJZllKNFhSTW1NUE5YS28wdHUKdUt6LzE0QW14R0dvSWJxYVc1bDMzeFNteUxhem84clNUN0tSTjVKME9JSHcrZkR5SFgxdHpVSjZCTldDcEFTcwpjbWdNK0htSzVON0w2bkNaZFJQY2IwU1hGaVRQUGhCUG1PVWFDUnpER0ZMK2JYM1VwajJKbWc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -71,7 +71,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -84,7 +84,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,7 +114,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +148,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare nbf=0, pem="LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBc284dnBvOFpEWXRkOUgzbWlPaW1qYXAzVXlVM0oyZ3kwTUYvN1R4blJuRnkwRHpDCkxqUk9naFZsQ0hPQmxsd3NVaE9GU0lyYnN4K05tUTdBeS90TFpXSGxuVGF3UWJ5WGZGOStJeDhVSnNlSHBGV1oKNVF5Z1JYd2liSjh1MVVsZ2xlcmZHMkpueldjVXpZTzEySktZN3doSkw1ajROMWgxZFJNUXQ5Q1pkZFlCQWRzOQpCdk02cjRFMDcxQkhQekhWeDMrUTI1VWtubGdUNXIwS3FiM1E1Y0dlTlBXY1JreW1ybkJEWWR0OXR4eFFMb1dPCllzNXdsMnVYWFVYL0VGcDMwajU0Nmp6czllWExLYlNDbjJjTDZFVE96Y2x3aG9DRGx2a2VQT05rUE9LMDVKNUMKTm1TdFdhMG9hV1VGRzM0MFl3cVVrWGt4OU9tNndXd1JldU1uU1FJREFRQUJBb0lCQUFJOHo1ck5kOEdtOGJBMgo1S3pxQjI1R2lOVENwbUNJeW53NXRJWHZTQmNHcEdydUcvdlN2WG9kVlFVSVY0TWdHQkVXUEFrVzdsNWVBcHI4CnA1ZFd5SkRXYTNkdklFSE9vSEpYU3dBYksxZzZEMTNVa2NkZ1EyRGpoNVhuWDhHZCtBY2c2SmRTQWgxOWtYSHEKMk54RUtBVDB6Ri83a1g2MkRkREFBcWxmQkpGSXJodVIvZUdEVWh4L2piTTRhQ2JCcFdiM0pnRE9OYm5tS1ZoMwpxS2ZwZmRZZENZU1lzWUxrNTlxRDF2VFNwUVFUQ0VadW9VKzNzRVNhdkJzaUs1bU0vTzY5ZkRMRXNURG1MeTVQCmhEK3BMQXI0SlhNNjFwRGVBS0l3cUVqWWJybXlDRHRXTUdJNnZzZ0E1eXQzUUJaME9vV2w5QUkwdWxoZ3p4dXQKZ2ZFNTRRRUNnWUVBN0F3a0lhVEEzYmQ4Nk9jSVZnNFlrWGk1cm5aNDdsM1k4V24zcjIzUmVISXhLdkllRUtSbgp5bUlFNDFtRVBBSmlGWFpLK1VPTXdkeS9EcnFJUithT1JiT2NiV01jWUg2QzgvbG1wdVJFaXE3SW1Ub3VWcnA4CnlnUkprMWprVDA4cTIvNmg4eTBEdjJqMitsaHFXNzRNOUt0cmwxcTRlWmZRUFREL01tR1NnTWtDZ1lFQXdhY04KaSttN1p6dnJtL3NuekF2VlZ5SEtwZHVUUjNERk1naC9maC9tZ0ZHZ1RwZWtUOVV5b3FleGNYQXdwMVlhL01iQQoyNTVJVDZRbXZZTm5yNXp6Wmxic2tMV0hsYllvbWhmWnVXTHhXR3hRaEFORWdaMFVVdUVTRGMvbWx2UXZHbEtSCkZoaGhBUWlVSmdDamhPaHk1SlBiNGFldGRKd0UxK09lVWRFaE1vRUNnWUVBNG8yZ25CM1o4ck5xa3NzemlBek4KYmNuMlJVbDJOaW9pejBwS3JMaDFaT29NNE5BekpQdjJsaHRQMzdtS0htS1hLMHczRjFqTEgwSTBxZmxFVmVZbQpSU1huakdHazJjUnpBYUVzOGgrQzNheDE0Z01pZUtGU3BqNUpNOEFNbVVZOXQ1cUVhN2FYc3o0V1ZoOUlMYmVTCkRiNzlhKzVwd21LQVBrcnBsTHhyZFdrQ2dZQlNNSHVBWVdBbmJYZ1BDS2FZWklGVWJNUWNacmY0ZnpWQ2lmYksKYWZHampvRlNPZXdEOGdGK3BWdWJRTGwxbkFieU44ek1xVDRaaHhybUhpcFlqMjJDaHV2NmN3RXJtbGRiSnpwQwpBMnRaVXdkTk1ESFlMUG5lUHlZeGRJWnlsUXFVeW14SGkydElUQUxNcWtLOGV3ZWdXZHpkeGhQSlJScU5JazhrCmZIVHhnUUtCZ1FEUFc2UXIxY3F3QjNUdnVWdWR4WGRqUTdIcDFodXhrNEVWaEFJZllKNFhSTW1NUE5YS28wdHUKdUt6LzE0QW14R0dvSWJxYVc1bDMzeFNteUxhem84clNUN0tSTjVKME9JSHcrZkR5SFgxdHpVSjZCTldDcEFTcwpjbWdNK0htSzVON0w2bkNaZFJQY2IwU1hGaVRQUGhCUG1PVWFDUnpER0ZMK2JYM1VwajJKbWc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +161,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = await response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = await response.parse() - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_videos.py b/tests/api_resources/stream/test_videos.py index 3742bbcd71ae..d3558da187c0 100644 --- a/tests/api_resources/stream/test_videos.py +++ b/tests/api_resources/stream/test_videos.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_storage_usage(self, client: Cloudflare) -> None: video = client.stream.videos.storage_usage( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -32,7 +32,7 @@ def test_method_storage_usage_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", creator="creator-id_abcde12345", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_raw_response_storage_usage(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_streaming_response_storage_usage(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +78,7 @@ async def test_method_storage_usage(self, async_client: AsyncCloudflare) -> None video = await async_client.stream.videos.storage_usage( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_method_storage_usage_with_all_params(self, async_client: AsyncClo account_id="023e105f4ecef8ad9ca31a8372d0c353", creator="creator-id_abcde12345", ) - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,7 @@ async def test_raw_response_storage_usage(self, async_client: AsyncCloudflare) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = await response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +111,7 @@ async def test_streaming_response_storage_usage(self, async_client: AsyncCloudfl assert response.http_request.headers.get("X-Stainless-Lang") == "python" video = await response.parse() - assert_matches_type(VideoStorageUsageResponse, video, path=["response"]) + assert_matches_type(Optional[VideoStorageUsageResponse], video, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_watermarks.py b/tests/api_resources/stream/test_watermarks.py index 7ec7dfccd334..77ac7c6cde8b 100644 --- a/tests/api_resources/stream/test_watermarks.py +++ b/tests/api_resources/stream/test_watermarks.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -30,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", file="@/Users/rchen/Downloads/watermark.png", ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: position="center", scale=0.1, ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,7 +70,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -133,7 +133,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -147,7 +147,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +161,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -189,7 +189,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkGetResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -202,7 +202,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkGetResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +215,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkGetResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -245,7 +245,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", file="@/Users/rchen/Downloads/watermark.png", ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -259,7 +259,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare position="center", scale=0.1, ) - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +272,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +285,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkCreateResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkCreateResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -348,7 +348,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -376,7 +376,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkDeleteResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkDeleteResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -404,7 +404,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkGetResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +417,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkGetResponse], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -430,7 +430,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkGetResponse, watermark, path=["response"]) + assert_matches_type(Optional[WatermarkGetResponse], watermark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_webhooks.py b/tests/api_resources/stream/test_webhooks.py index d9ffbfa7de43..c2ba269535c3 100644 --- a/tests/api_resources/stream/test_webhooks.py +++ b/tests/api_resources/stream/test_webhooks.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", notification_url="https://example.com", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -119,7 +119,7 @@ def test_method_get(self, client: Cloudflare) -> None: webhook = client.stream.webhooks.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +131,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +143,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -166,7 +166,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", notification_url="https://example.com", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,7 +179,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -192,7 +192,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -212,7 +212,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +225,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -238,7 +238,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,7 +257,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.stream.webhooks.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +269,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +281,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookGetResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookGetResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_calls.py b/tests/api_resources/test_calls.py index 49df39e2a8bc..34125f96aab6 100644 --- a/tests/api_resources/test_calls.py +++ b/tests/api_resources/test_calls.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: call = client.calls.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -33,7 +33,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ def test_method_update(self, client: Cloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +86,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -180,7 +180,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +206,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -232,7 +232,7 @@ def test_method_get(self, client: Cloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -245,7 +245,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -258,7 +258,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +287,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: call = await async_client.calls.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +296,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -308,7 +308,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -320,7 +320,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsAppWithSecret, call, path=["response"]) + assert_matches_type(Optional[CallsAppWithSecret], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +339,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -349,7 +349,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="production-realtime-app", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +375,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -443,7 +443,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -456,7 +456,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -469,7 +469,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -495,7 +495,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "2a95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -508,7 +508,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -521,7 +521,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallsApp, call, path=["response"]) + assert_matches_type(Optional[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_stream.py b/tests/api_resources/test_stream.py index 133dadd6af7b..47203c71641e 100644 --- a/tests/api_resources/test_stream.py +++ b/tests/api_resources/test_stream.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -187,7 +187,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Video, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,7 +200,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(Video, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +213,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(Video, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) assert cast(Any, response.is_closed) is True @@ -404,7 +404,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Video, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +417,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(Video, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -430,7 +430,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(Video, stream, path=["response"]) + assert_matches_type(Optional[Video], stream, path=["response"]) assert cast(Any, response.is_closed) is True