diff --git a/api.md b/api.md index b46fe3eb4bce..7de6136dbf7c 100644 --- a/api.md +++ b/api.md @@ -7272,11 +7272,11 @@ from cloudflare.types import CallsApp, CallsAppWithSecret Methods: -- client.calls.create(\*, account_id, \*\*params) -> Optional -- client.calls.update(app_id, \*, account_id, \*\*params) -> Optional +- client.calls.create(\*, account_id, \*\*params) -> CallsAppWithSecret +- client.calls.update(app_id, \*, account_id, \*\*params) -> CallsApp - client.calls.list(\*, account_id) -> SyncSinglePage[CallsApp] -- client.calls.delete(app_id, \*, account_id) -> Optional -- client.calls.get(app_id, \*, account_id) -> Optional +- client.calls.delete(app_id, \*, account_id) -> CallsApp +- client.calls.get(app_id, \*, account_id) -> CallsApp # CloudforceOne diff --git a/src/cloudflare/resources/calls.py b/src/cloudflare/resources/calls.py index 383090a8c33a..595b997a7e5f 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, Optional, cast +from typing import Type, 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, - ) -> Optional[CallsAppWithSecret]: + ) -> 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[Optional[CallsAppWithSecret]], ResultWrapper[CallsAppWithSecret]), + cast_to=cast(Type[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, - ) -> Optional[CallsApp]: + ) -> CallsApp: """ Edit details for a single app. @@ -129,7 +129,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), + cast_to=cast(Type[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, - ) -> Optional[CallsApp]: + ) -> CallsApp: """ Deletes an app from Cloudflare Calls @@ -209,7 +209,7 @@ def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), + cast_to=cast(Type[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, - ) -> Optional[CallsApp]: + ) -> CallsApp: """ Fetches details for a single Calls app. @@ -253,7 +253,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), + cast_to=cast(Type[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, - ) -> Optional[CallsAppWithSecret]: + ) -> 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[Optional[CallsAppWithSecret]], ResultWrapper[CallsAppWithSecret]), + cast_to=cast(Type[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, - ) -> Optional[CallsApp]: + ) -> CallsApp: """ Edit details for a single app. @@ -356,7 +356,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), + cast_to=cast(Type[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, - ) -> Optional[CallsApp]: + ) -> CallsApp: """ Deletes an app from Cloudflare Calls @@ -436,7 +436,7 @@ async def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[CallsApp]], ResultWrapper[CallsApp]), + cast_to=cast(Type[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, - ) -> Optional[CallsApp]: + ) -> 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[Optional[CallsApp]], ResultWrapper[CallsApp]), + cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), ) diff --git a/tests/api_resources/test_calls.py b/tests/api_resources/test_calls.py index 34125f96aab6..49df39e2a8bc 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, Optional, cast +from typing import Any, 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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsAppWithSecret], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(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(Optional[CallsApp], call, path=["response"]) + assert_matches_type(CallsApp, call, path=["response"]) assert cast(Any, response.is_closed) is True