diff --git a/.stats.yml b/.stats.yml index db4425733dd..b793266d078 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1259 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1f0167c5fee5c0cadf72c222f47f8fc3ba43905607b21f6a88853c061117b77b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-543a9898a4efc4501e7101d78908dcfaa303efd8f2abb7164299dd85be87749d.yml diff --git a/api.md b/api.md index 2f743e48fcb..72f9bde7c00 100644 --- a/api.md +++ b/api.md @@ -3409,8 +3409,8 @@ from cloudflare.types.brand_protection import ( Methods: -- client.brand_protection.submit(\*, account_id, \*\*params) -> Submit -- client.brand_protection.url_info(\*, account_id, \*\*params) -> Info +- client.brand_protection.submit(\*, account_id, \*\*params) -> Optional +- client.brand_protection.url_info(\*, account_id, \*\*params) -> Optional # Diagnostics @@ -3528,7 +3528,7 @@ Methods: Methods: -- client.intel.asn.get(asn, \*, account_id) -> ASN +- client.intel.asn.get(asn, \*, account_id) -> Optional ### Subnets @@ -3564,7 +3564,7 @@ from cloudflare.types.intel import Domain Methods: -- client.intel.domains.get(\*, account_id, \*\*params) -> Domain +- client.intel.domains.get(\*, account_id, \*\*params) -> Optional ### Bulks @@ -3624,7 +3624,7 @@ from cloudflare.types.intel import MiscategorizationCreateResponse Methods: -- client.intel.miscategorizations.create(\*, account_id, \*\*params) -> MiscategorizationCreateResponse +- client.intel.miscategorizations.create(\*, account_id, \*\*params) -> Optional ## Whois @@ -3636,7 +3636,7 @@ from cloudflare.types.intel import Whois Methods: -- client.intel.whois.get(\*, account_id, \*\*params) -> Whois +- client.intel.whois.get(\*, account_id, \*\*params) -> Optional ## IndicatorFeeds diff --git a/src/cloudflare/resources/brand_protection.py b/src/cloudflare/resources/brand_protection.py index 093a59d6c7e..f23dee3648c 100644 --- a/src/cloudflare/resources/brand_protection.py +++ b/src/cloudflare/resources/brand_protection.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 submit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Submit: + ) -> Optional[Submit]: """ Submit suspicious URL for scanning @@ -77,9 +77,9 @@ def submit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Submit]._unwrapper, + post_parser=ResultWrapper[Optional[Submit]]._unwrapper, ), - cast_to=cast(Type[Submit], ResultWrapper[Submit]), + cast_to=cast(Type[Optional[Submit]], ResultWrapper[Submit]), ) def url_info( @@ -94,7 +94,7 @@ def url_info( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Info: + ) -> Optional[Info]: """ Get results for a URL scan @@ -125,9 +125,9 @@ def url_info( }, brand_protection_url_info_params.BrandProtectionURLInfoParams, ), - post_parser=ResultWrapper[Info]._unwrapper, + post_parser=ResultWrapper[Optional[Info]]._unwrapper, ), - cast_to=cast(Type[Info], ResultWrapper[Info]), + cast_to=cast(Type[Optional[Info]], ResultWrapper[Info]), ) @@ -151,7 +151,7 @@ async def submit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Submit: + ) -> Optional[Submit]: """ Submit suspicious URL for scanning @@ -178,9 +178,9 @@ async def submit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Submit]._unwrapper, + post_parser=ResultWrapper[Optional[Submit]]._unwrapper, ), - cast_to=cast(Type[Submit], ResultWrapper[Submit]), + cast_to=cast(Type[Optional[Submit]], ResultWrapper[Submit]), ) async def url_info( @@ -195,7 +195,7 @@ async def url_info( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Info: + ) -> Optional[Info]: """ Get results for a URL scan @@ -226,9 +226,9 @@ async def url_info( }, brand_protection_url_info_params.BrandProtectionURLInfoParams, ), - post_parser=ResultWrapper[Info]._unwrapper, + post_parser=ResultWrapper[Optional[Info]]._unwrapper, ), - cast_to=cast(Type[Info], ResultWrapper[Info]), + cast_to=cast(Type[Optional[Info]], ResultWrapper[Info]), ) diff --git a/src/cloudflare/resources/intel/asn/asn.py b/src/cloudflare/resources/intel/asn/asn.py index 2c721f038ed..97ac5cb12f8 100644 --- a/src/cloudflare/resources/intel/asn/asn.py +++ b/src/cloudflare/resources/intel/asn/asn.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -56,7 +56,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ASN: + ) -> Optional[ASN]: """ Get ASN Overview @@ -80,9 +80,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ASN]._unwrapper, + post_parser=ResultWrapper[Optional[ASN]]._unwrapper, ), - cast_to=cast(Type[ASN], ResultWrapper[int]), + cast_to=cast(Type[Optional[ASN]], ResultWrapper[int]), ) @@ -110,7 +110,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ASN: + ) -> Optional[ASN]: """ Get ASN Overview @@ -134,9 +134,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ASN]._unwrapper, + post_parser=ResultWrapper[Optional[ASN]]._unwrapper, ), - cast_to=cast(Type[ASN], ResultWrapper[int]), + cast_to=cast(Type[Optional[ASN]], ResultWrapper[int]), ) diff --git a/src/cloudflare/resources/intel/domains/domains.py b/src/cloudflare/resources/intel/domains/domains.py index 15b1171aca6..81e9d09a452 100644 --- a/src/cloudflare/resources/intel/domains/domains.py +++ b/src/cloudflare/resources/intel/domains/domains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -61,7 +61,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Domain: + ) -> Optional[Domain]: """ Get Domain Details @@ -86,9 +86,9 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, domain_get_params.DomainGetParams), - post_parser=ResultWrapper[Domain]._unwrapper, + post_parser=ResultWrapper[Optional[Domain]]._unwrapper, ), - cast_to=cast(Type[Domain], ResultWrapper[Domain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) @@ -116,7 +116,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Domain: + ) -> Optional[Domain]: """ Get Domain Details @@ -141,9 +141,9 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, domain_get_params.DomainGetParams), - post_parser=ResultWrapper[Domain]._unwrapper, + post_parser=ResultWrapper[Optional[Domain]]._unwrapper, ), - cast_to=cast(Type[Domain], ResultWrapper[Domain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) diff --git a/src/cloudflare/resources/intel/miscategorizations.py b/src/cloudflare/resources/intel/miscategorizations.py index 266ed05d040..bea63b18176 100644 --- a/src/cloudflare/resources/intel/miscategorizations.py +++ b/src/cloudflare/resources/intel/miscategorizations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Iterable, cast +from typing import Any, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -56,7 +56,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MiscategorizationCreateResponse: + ) -> Optional[MiscategorizationCreateResponse]: """ Create Miscategorization @@ -88,7 +88,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( - MiscategorizationCreateResponse, + Optional[MiscategorizationCreateResponse], self._post( f"/accounts/{account_id}/intel/miscategorization", body=maybe_transform( @@ -108,7 +108,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MiscategorizationCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MiscategorizationCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MiscategorizationCreateResponse] @@ -143,7 +143,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MiscategorizationCreateResponse: + ) -> Optional[MiscategorizationCreateResponse]: """ Create Miscategorization @@ -175,7 +175,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( - MiscategorizationCreateResponse, + Optional[MiscategorizationCreateResponse], await self._post( f"/accounts/{account_id}/intel/miscategorization", body=await async_maybe_transform( @@ -195,7 +195,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MiscategorizationCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MiscategorizationCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[MiscategorizationCreateResponse] diff --git a/src/cloudflare/resources/intel/whois.py b/src/cloudflare/resources/intel/whois.py index 570d37b6095..c6c0ce7a13b 100644 --- a/src/cloudflare/resources/intel/whois.py +++ b/src/cloudflare/resources/intel/whois.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -49,7 +49,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Whois: + ) -> Optional[Whois]: """ Get WHOIS Record @@ -74,9 +74,9 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[Whois]._unwrapper, + post_parser=ResultWrapper[Optional[Whois]]._unwrapper, ), - cast_to=cast(Type[Whois], ResultWrapper[Whois]), + cast_to=cast(Type[Optional[Whois]], ResultWrapper[Whois]), ) @@ -100,7 +100,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Whois: + ) -> Optional[Whois]: """ Get WHOIS Record @@ -125,9 +125,9 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[Whois]._unwrapper, + post_parser=ResultWrapper[Optional[Whois]]._unwrapper, ), - cast_to=cast(Type[Whois], ResultWrapper[Whois]), + cast_to=cast(Type[Optional[Whois]], ResultWrapper[Whois]), ) diff --git a/src/cloudflare/types/intel/dns_list_response.py b/src/cloudflare/types/intel/dns_list_response.py index ed0cea0cfcf..b17d1940c3f 100644 --- a/src/cloudflare/types/intel/dns_list_response.py +++ b/src/cloudflare/types/intel/dns_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from typing_extensions import Literal from .dns import DNS @@ -15,7 +15,7 @@ class DNSListResponse(BaseModel): messages: List[ResponseInfo] - result: DNS - success: Literal[True] """Whether the API call was successful""" + + result: Optional[DNS] = None diff --git a/tests/api_resources/intel/test_asn.py b/tests/api_resources/intel/test_asn.py index da82b690fa4..5ef9475861f 100644 --- a/tests/api_resources/intel/test_asn.py +++ b/tests/api_resources/intel/test_asn.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_get(self, client: Cloudflare) -> None: 0, account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ASN, asn, path=["response"]) + assert_matches_type(Optional[ASN], asn, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -35,7 +35,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" asn = response.parse() - assert_matches_type(ASN, asn, path=["response"]) + assert_matches_type(Optional[ASN], asn, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = response.parse() - assert_matches_type(ASN, asn, path=["response"]) + assert_matches_type(Optional[ASN], asn, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: 0, account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ASN, asn, path=["response"]) + assert_matches_type(Optional[ASN], asn, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -81,7 +81,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" asn = await response.parse() - assert_matches_type(ASN, asn, path=["response"]) + assert_matches_type(Optional[ASN], asn, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -93,7 +93,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = await response.parse() - assert_matches_type(ASN, asn, path=["response"]) + assert_matches_type(Optional[ASN], asn, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_domains.py b/tests/api_resources/intel/test_domains.py index 8a5a65a6699..7241e5d4ad2 100644 --- a/tests/api_resources/intel/test_domains.py +++ b/tests/api_resources/intel/test_domains.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_get(self, client: Cloudflare) -> None: domain = client.intel.domains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -30,7 +30,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -41,7 +41,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" domain = response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: domain = await async_client.intel.domains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -80,7 +80,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -91,7 +91,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" domain = await response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_miscategorizations.py b/tests/api_resources/intel/test_miscategorizations.py index 9e5d6b8786f..9f3f59fae1d 100644 --- a/tests/api_resources/intel/test_miscategorizations.py +++ b/tests/api_resources/intel/test_miscategorizations.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_create(self, client: Cloudflare) -> None: miscategorization = client.intel.miscategorizations.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -36,7 +36,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: security_removes=[83], url="string", ) - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -47,7 +47,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" miscategorization = response.parse() - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -58,7 +58,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" miscategorization = response.parse() - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +78,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: miscategorization = await async_client.intel.miscategorizations.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -92,7 +92,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare security_removes=[83], url="string", ) - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -103,7 +103,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" miscategorization = await response.parse() - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -114,7 +114,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" miscategorization = await response.parse() - assert_matches_type(MiscategorizationCreateResponse, miscategorization, path=["response"]) + assert_matches_type(Optional[MiscategorizationCreateResponse], miscategorization, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_whois.py b/tests/api_resources/intel/test_whois.py index d9d603dfc23..1428403d21e 100644 --- a/tests/api_resources/intel/test_whois.py +++ b/tests/api_resources/intel/test_whois.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_get(self, client: Cloudflare) -> None: whois = client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -30,7 +30,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -41,7 +41,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" whois = response.parse() - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = response.parse() - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: whois = await async_client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -80,7 +80,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -91,7 +91,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" whois = await response.parse() - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = await response.parse() - assert_matches_type(Whois, whois, path=["response"]) + assert_matches_type(Optional[Whois], whois, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_brand_protection.py b/tests/api_resources/test_brand_protection.py index 303dc3a6bd9..31b53da9ac7 100644 --- a/tests/api_resources/test_brand_protection.py +++ b/tests/api_resources/test_brand_protection.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_submit(self, client: Cloudflare) -> None: brand_protection = client.brand_protection.submit( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) @parametrize def test_method_submit_with_all_params(self, client: Cloudflare) -> None: @@ -33,7 +33,7 @@ def test_method_submit_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://www.cloudflare.com", ) - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) @parametrize def test_raw_response_submit(self, client: Cloudflare) -> None: @@ -44,7 +44,7 @@ def test_raw_response_submit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) @parametrize def test_streaming_response_submit(self, client: Cloudflare) -> None: @@ -55,7 +55,7 @@ def test_streaming_response_submit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -71,7 +71,7 @@ def test_method_url_info(self, client: Cloudflare) -> None: brand_protection = client.brand_protection.url_info( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) @parametrize def test_method_url_info_with_all_params(self, client: Cloudflare) -> None: @@ -80,7 +80,7 @@ def test_method_url_info_with_all_params(self, client: Cloudflare) -> None: url="string", url_id_param={"url_id": 0}, ) - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) @parametrize def test_raw_response_url_info(self, client: Cloudflare) -> None: @@ -91,7 +91,7 @@ def test_raw_response_url_info(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) @parametrize def test_streaming_response_url_info(self, client: Cloudflare) -> None: @@ -102,7 +102,7 @@ def test_streaming_response_url_info(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = response.parse() - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,7 +122,7 @@ async def test_method_submit(self, async_client: AsyncCloudflare) -> None: brand_protection = await async_client.brand_protection.submit( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) @parametrize async def test_method_submit_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -130,7 +130,7 @@ async def test_method_submit_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", url="https://www.cloudflare.com", ) - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) @parametrize async def test_raw_response_submit(self, async_client: AsyncCloudflare) -> None: @@ -141,7 +141,7 @@ async def test_raw_response_submit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) @parametrize async def test_streaming_response_submit(self, async_client: AsyncCloudflare) -> None: @@ -152,7 +152,7 @@ async def test_streaming_response_submit(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(Submit, brand_protection, path=["response"]) + assert_matches_type(Optional[Submit], brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -168,7 +168,7 @@ async def test_method_url_info(self, async_client: AsyncCloudflare) -> None: brand_protection = await async_client.brand_protection.url_info( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) @parametrize async def test_method_url_info_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -177,7 +177,7 @@ async def test_method_url_info_with_all_params(self, async_client: AsyncCloudfla url="string", url_id_param={"url_id": 0}, ) - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) @parametrize async def test_raw_response_url_info(self, async_client: AsyncCloudflare) -> None: @@ -188,7 +188,7 @@ async def test_raw_response_url_info(self, async_client: AsyncCloudflare) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) @parametrize async def test_streaming_response_url_info(self, async_client: AsyncCloudflare) -> None: @@ -199,7 +199,7 @@ async def test_streaming_response_url_info(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" brand_protection = await response.parse() - assert_matches_type(Info, brand_protection, path=["response"]) + assert_matches_type(Optional[Info], brand_protection, path=["response"]) assert cast(Any, response.is_closed) is True