diff --git a/api.md b/api.md index 3d64fc75b2f..d8ad15a99ce 100644 --- a/api.md +++ b/api.md @@ -292,7 +292,7 @@ from cloudflare.types.zones import ActivationCheckTriggerResponse Methods: -- client.zones.activation_check.trigger(\*, zone_id) -> ActivationCheckTriggerResponse +- client.zones.activation_check.trigger(\*, zone_id) -> Optional ## DNSSettings diff --git a/src/cloudflare/resources/zones/activation_check.py b/src/cloudflare/resources/zones/activation_check.py index 7dfdc7ef4b4..473145a2821 100644 --- a/src/cloudflare/resources/zones/activation_check.py +++ b/src/cloudflare/resources/zones/activation_check.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -43,7 +43,7 @@ def trigger( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ActivationCheckTriggerResponse: + ) -> Optional[ActivationCheckTriggerResponse]: """Triggeres a new activation check for a PENDING Zone. This can be triggered every @@ -69,9 +69,9 @@ def trigger( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ActivationCheckTriggerResponse]._unwrapper, + post_parser=ResultWrapper[Optional[ActivationCheckTriggerResponse]]._unwrapper, ), - cast_to=cast(Type[ActivationCheckTriggerResponse], ResultWrapper[ActivationCheckTriggerResponse]), + cast_to=cast(Type[Optional[ActivationCheckTriggerResponse]], ResultWrapper[ActivationCheckTriggerResponse]), ) @@ -94,7 +94,7 @@ async def trigger( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ActivationCheckTriggerResponse: + ) -> Optional[ActivationCheckTriggerResponse]: """Triggeres a new activation check for a PENDING Zone. This can be triggered every @@ -120,9 +120,9 @@ async def trigger( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ActivationCheckTriggerResponse]._unwrapper, + post_parser=ResultWrapper[Optional[ActivationCheckTriggerResponse]]._unwrapper, ), - cast_to=cast(Type[ActivationCheckTriggerResponse], ResultWrapper[ActivationCheckTriggerResponse]), + cast_to=cast(Type[Optional[ActivationCheckTriggerResponse]], ResultWrapper[ActivationCheckTriggerResponse]), ) diff --git a/tests/api_resources/zones/test_activation_check.py b/tests/api_resources/zones/test_activation_check.py index 56199bb58be..67f56ba83eb 100644 --- a/tests/api_resources/zones/test_activation_check.py +++ b/tests/api_resources/zones/test_activation_check.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_trigger(self, client: Cloudflare) -> None: activation_check = client.zones.activation_check.trigger( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_raw_response_trigger(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_trigger(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_trigger(self, async_client: AsyncCloudflare) -> None: activation_check = await async_client.zones.activation_check.trigger( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,7 @@ async def test_raw_response_trigger(self, async_client: AsyncCloudflare) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = await response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ async def test_streaming_response_trigger(self, async_client: AsyncCloudflare) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" activation_check = await response.parse() - assert_matches_type(ActivationCheckTriggerResponse, activation_check, path=["response"]) + assert_matches_type(Optional[ActivationCheckTriggerResponse], activation_check, path=["response"]) assert cast(Any, response.is_closed) is True