From 32e92cfeec38b615e48ca8da842365a5e57b0ac2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 14:27:08 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#460) --- .stats.yml | 4 +- api.md | 4 +- .../resources/custom_nameservers.py | 157 +++--------------- .../resources/zones/custom_nameservers.py | 122 ++++++-------- .../types/custom_nameservers/__init__.py | 2 - .../custom_nameserver_delete_response.py | 4 +- .../custom_nameserver_verify_params.py | 14 -- .../custom_nameserver_verify_response.py | 9 - .../zones/custom_nameserver_get_response.py | 4 +- .../custom_nameserver_update_response.py | 4 +- .../api_resources/test_custom_nameservers.py | 101 +---------- 11 files changed, 94 insertions(+), 331 deletions(-) delete mode 100644 src/cloudflare/types/custom_nameservers/custom_nameserver_verify_params.py delete mode 100644 src/cloudflare/types/custom_nameservers/custom_nameserver_verify_response.py diff --git a/.stats.yml b/.stats.yml index 455fd99129b..54834395b2a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1275 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-66b404214530cc73c44f34f297dad6bc8da0645b63e61d9d4fcbeb301e127e65.yml +configured_endpoints: 1274 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6ad087215145bdd87a8fb698a148f42cf8f61d66010b60edb5e4842345953810.yml diff --git a/api.md b/api.md index ac2c4403662..8cf0ccfb413 100644 --- a/api.md +++ b/api.md @@ -1571,17 +1571,15 @@ from cloudflare.types.custom_nameservers import ( CustomNameserverDeleteResponse, CustomNameserverAvailabiltyResponse, CustomNameserverGetResponse, - CustomNameserverVerifyResponse, ) ``` Methods: -- client.custom_nameservers.create(\*, account_id, \*\*params) -> CustomNameserver +- client.custom_nameservers.create(\*, account_id, \*\*params) -> Optional - client.custom_nameservers.delete(custom_ns_id, \*, account_id) -> Optional - client.custom_nameservers.availabilty(\*, account_id) -> Optional - client.custom_nameservers.get(\*, account_id) -> Optional -- client.custom_nameservers.verify(\*, account_id, \*\*params) -> Optional # DNS diff --git a/src/cloudflare/resources/custom_nameservers.py b/src/cloudflare/resources/custom_nameservers.py index d6f0533f990..e0aa1a8fee7 100644 --- a/src/cloudflare/resources/custom_nameservers.py +++ b/src/cloudflare/resources/custom_nameservers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx @@ -23,11 +23,10 @@ from .._base_client import ( make_request_options, ) -from ..types.custom_nameservers import custom_nameserver_create_params, custom_nameserver_verify_params +from ..types.custom_nameservers import custom_nameserver_create_params from ..types.custom_nameservers.custom_nameserver import CustomNameserver from ..types.custom_nameservers.custom_nameserver_get_response import CustomNameserverGetResponse from ..types.custom_nameservers.custom_nameserver_delete_response import CustomNameserverDeleteResponse -from ..types.custom_nameservers.custom_nameserver_verify_response import CustomNameserverVerifyResponse from ..types.custom_nameservers.custom_nameserver_availabilty_response import CustomNameserverAvailabiltyResponse __all__ = ["CustomNameserversResource", "AsyncCustomNameserversResource"] @@ -54,7 +53,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomNameserver: + ) -> Optional[CustomNameserver]: """ Add Account Custom Nameserver @@ -89,9 +88,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CustomNameserver]._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserver]]._unwrapper, ), - cast_to=cast(Type[CustomNameserver], ResultWrapper[CustomNameserver]), + cast_to=cast(Type[Optional[CustomNameserver]], ResultWrapper[CustomNameserver]), ) def delete( @@ -126,21 +125,16 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not custom_ns_id: raise ValueError(f"Expected a non-empty value for `custom_ns_id` but received {custom_ns_id!r}") - return cast( - Optional[CustomNameserverDeleteResponse], - self._delete( - f"/accounts/{account_id}/custom_ns/{custom_ns_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CustomNameserverDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/custom_ns/{custom_ns_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CustomNameserverDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[CustomNameserverDeleteResponse]], ResultWrapper[CustomNameserverDeleteResponse]), ) def availabilty( @@ -223,47 +217,6 @@ def get( cast_to=cast(Type[Optional[CustomNameserverGetResponse]], ResultWrapper[CustomNameserverGetResponse]), ) - def verify( - self, - *, - account_id: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomNameserverVerifyResponse]: - """ - Verify Account Custom Nameserver Glue Records - - Args: - account_id: Account identifier tag. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._post( - f"/accounts/{account_id}/custom_ns/verify", - body=maybe_transform(body, custom_nameserver_verify_params.CustomNameserverVerifyParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverVerifyResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomNameserverVerifyResponse]], ResultWrapper[CustomNameserverVerifyResponse]), - ) - class AsyncCustomNameserversResource(AsyncAPIResource): @cached_property @@ -286,7 +239,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomNameserver: + ) -> Optional[CustomNameserver]: """ Add Account Custom Nameserver @@ -321,9 +274,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CustomNameserver]._unwrapper, + post_parser=ResultWrapper[Optional[CustomNameserver]]._unwrapper, ), - cast_to=cast(Type[CustomNameserver], ResultWrapper[CustomNameserver]), + cast_to=cast(Type[Optional[CustomNameserver]], ResultWrapper[CustomNameserver]), ) async def delete( @@ -358,21 +311,16 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not custom_ns_id: raise ValueError(f"Expected a non-empty value for `custom_ns_id` but received {custom_ns_id!r}") - return cast( - Optional[CustomNameserverDeleteResponse], - await self._delete( - f"/accounts/{account_id}/custom_ns/{custom_ns_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CustomNameserverDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/custom_ns/{custom_ns_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CustomNameserverDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[CustomNameserverDeleteResponse]], ResultWrapper[CustomNameserverDeleteResponse]), ) async def availabilty( @@ -455,47 +403,6 @@ async def get( cast_to=cast(Type[Optional[CustomNameserverGetResponse]], ResultWrapper[CustomNameserverGetResponse]), ) - async def verify( - self, - *, - account_id: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomNameserverVerifyResponse]: - """ - Verify Account Custom Nameserver Glue Records - - Args: - account_id: Account identifier tag. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._post( - f"/accounts/{account_id}/custom_ns/verify", - body=await async_maybe_transform(body, custom_nameserver_verify_params.CustomNameserverVerifyParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverVerifyResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[CustomNameserverVerifyResponse]], ResultWrapper[CustomNameserverVerifyResponse]), - ) - class CustomNameserversResourceWithRawResponse: def __init__(self, custom_nameservers: CustomNameserversResource) -> None: @@ -513,9 +420,6 @@ def __init__(self, custom_nameservers: CustomNameserversResource) -> None: self.get = to_raw_response_wrapper( custom_nameservers.get, ) - self.verify = to_raw_response_wrapper( - custom_nameservers.verify, - ) class AsyncCustomNameserversResourceWithRawResponse: @@ -534,9 +438,6 @@ def __init__(self, custom_nameservers: AsyncCustomNameserversResource) -> None: self.get = async_to_raw_response_wrapper( custom_nameservers.get, ) - self.verify = async_to_raw_response_wrapper( - custom_nameservers.verify, - ) class CustomNameserversResourceWithStreamingResponse: @@ -555,9 +456,6 @@ def __init__(self, custom_nameservers: CustomNameserversResource) -> None: self.get = to_streamed_response_wrapper( custom_nameservers.get, ) - self.verify = to_streamed_response_wrapper( - custom_nameservers.verify, - ) class AsyncCustomNameserversResourceWithStreamingResponse: @@ -576,6 +474,3 @@ def __init__(self, custom_nameservers: AsyncCustomNameserversResource) -> None: self.get = async_to_streamed_response_wrapper( custom_nameservers.get, ) - self.verify = async_to_streamed_response_wrapper( - custom_nameservers.verify, - ) diff --git a/src/cloudflare/resources/zones/custom_nameservers.py b/src/cloudflare/resources/zones/custom_nameservers.py index ba334b39387..641fd246f32 100644 --- a/src/cloudflare/resources/zones/custom_nameservers.py +++ b/src/cloudflare/resources/zones/custom_nameservers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -76,28 +76,23 @@ def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - Optional[CustomNameserverUpdateResponse], - self._put( - f"/zones/{zone_id}/custom_ns", - body=maybe_transform( - { - "enabled": enabled, - "ns_set": ns_set, - }, - custom_nameserver_update_params.CustomNameserverUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CustomNameserverUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/zones/{zone_id}/custom_ns", + body=maybe_transform( + { + "enabled": enabled, + "ns_set": ns_set, + }, + custom_nameserver_update_params.CustomNameserverUpdateParams, ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CustomNameserverUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[CustomNameserverUpdateResponse]], ResultWrapper[CustomNameserverUpdateResponse]), ) def get( @@ -127,21 +122,16 @@ def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - Optional[CustomNameserverGetResponse], - self._get( - f"/zones/{zone_id}/custom_ns", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CustomNameserverGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/zones/{zone_id}/custom_ns", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[CustomNameserverGetResponse]], ResultWrapper[CustomNameserverGetResponse]), ) @@ -191,28 +181,23 @@ async def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - Optional[CustomNameserverUpdateResponse], - await self._put( - f"/zones/{zone_id}/custom_ns", - body=await async_maybe_transform( - { - "enabled": enabled, - "ns_set": ns_set, - }, - custom_nameserver_update_params.CustomNameserverUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CustomNameserverUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/zones/{zone_id}/custom_ns", + body=await async_maybe_transform( + { + "enabled": enabled, + "ns_set": ns_set, + }, + custom_nameserver_update_params.CustomNameserverUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CustomNameserverUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[CustomNameserverUpdateResponse]], ResultWrapper[CustomNameserverUpdateResponse]), ) async def get( @@ -242,21 +227,16 @@ async def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - Optional[CustomNameserverGetResponse], - await self._get( - f"/zones/{zone_id}/custom_ns", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[CustomNameserverGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/zones/{zone_id}/custom_ns", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CustomNameserverGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[CustomNameserverGetResponse]], ResultWrapper[CustomNameserverGetResponse]), ) diff --git a/src/cloudflare/types/custom_nameservers/__init__.py b/src/cloudflare/types/custom_nameservers/__init__.py index 67531c81bc0..a67351a5bcd 100644 --- a/src/cloudflare/types/custom_nameservers/__init__.py +++ b/src/cloudflare/types/custom_nameservers/__init__.py @@ -5,9 +5,7 @@ from .custom_nameserver import CustomNameserver as CustomNameserver from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse from .custom_nameserver_create_params import CustomNameserverCreateParams as CustomNameserverCreateParams -from .custom_nameserver_verify_params import CustomNameserverVerifyParams as CustomNameserverVerifyParams from .custom_nameserver_delete_response import CustomNameserverDeleteResponse as CustomNameserverDeleteResponse -from .custom_nameserver_verify_response import CustomNameserverVerifyResponse as CustomNameserverVerifyResponse from .custom_nameserver_availabilty_response import ( CustomNameserverAvailabiltyResponse as CustomNameserverAvailabiltyResponse, ) diff --git a/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_response.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_response.py index f50c645a449..fe6ff20f1de 100644 --- a/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_response.py +++ b/src/cloudflare/types/custom_nameservers/custom_nameserver_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["CustomNameserverDeleteResponse"] -CustomNameserverDeleteResponse = Union[List[object], str, object, None] +CustomNameserverDeleteResponse = List[object] diff --git a/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_params.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_params.py deleted file mode 100644 index 037e56c8880..00000000000 --- a/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["CustomNameserverVerifyParams"] - - -class CustomNameserverVerifyParams(TypedDict, total=False): - account_id: Required[str] - """Account identifier tag.""" - - body: Required[object] diff --git a/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_response.py b/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_response.py deleted file mode 100644 index 2397a7bb05a..00000000000 --- a/src/cloudflare/types/custom_nameservers/custom_nameserver_verify_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .custom_nameserver import CustomNameserver - -__all__ = ["CustomNameserverVerifyResponse"] - -CustomNameserverVerifyResponse = List[CustomNameserver] diff --git a/src/cloudflare/types/zones/custom_nameserver_get_response.py b/src/cloudflare/types/zones/custom_nameserver_get_response.py index a257787a184..e28ec99293d 100644 --- a/src/cloudflare/types/zones/custom_nameserver_get_response.py +++ b/src/cloudflare/types/zones/custom_nameserver_get_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["CustomNameserverGetResponse"] -CustomNameserverGetResponse = Union[List[object], str, object, None] +CustomNameserverGetResponse = List[object] diff --git a/src/cloudflare/types/zones/custom_nameserver_update_response.py b/src/cloudflare/types/zones/custom_nameserver_update_response.py index d2c3ed336e7..ca378e8247d 100644 --- a/src/cloudflare/types/zones/custom_nameserver_update_response.py +++ b/src/cloudflare/types/zones/custom_nameserver_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["CustomNameserverUpdateResponse"] -CustomNameserverUpdateResponse = Union[List[object], str, object, None] +CustomNameserverUpdateResponse = List[object] diff --git a/tests/api_resources/test_custom_nameservers.py b/tests/api_resources/test_custom_nameservers.py index 6eb63958355..a0ed2167a7d 100644 --- a/tests/api_resources/test_custom_nameservers.py +++ b/tests/api_resources/test_custom_nameservers.py @@ -13,7 +13,6 @@ CustomNameserver, CustomNameserverGetResponse, CustomNameserverDeleteResponse, - CustomNameserverVerifyResponse, CustomNameserverAvailabiltyResponse, ) @@ -29,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="372e67954025e0ba6aaa6d586b9e0b59", ns_name="ns1.example.com", ) - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -38,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ns_name="ns1.example.com", ns_set=1, ) - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -50,7 +49,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" custom_nameserver = response.parse() - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -62,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_nameserver = response.parse() - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) assert cast(Any, response.is_closed) is True @@ -198,48 +197,6 @@ def test_path_params_get(self, client: Cloudflare) -> None: account_id="", ) - @parametrize - def test_method_verify(self, client: Cloudflare) -> None: - custom_nameserver = client.custom_nameservers.verify( - account_id="372e67954025e0ba6aaa6d586b9e0b59", - body={}, - ) - assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) - - @parametrize - def test_raw_response_verify(self, client: Cloudflare) -> None: - response = client.custom_nameservers.with_raw_response.verify( - account_id="372e67954025e0ba6aaa6d586b9e0b59", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_nameserver = response.parse() - assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) - - @parametrize - def test_streaming_response_verify(self, client: Cloudflare) -> None: - with client.custom_nameservers.with_streaming_response.verify( - account_id="372e67954025e0ba6aaa6d586b9e0b59", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_nameserver = response.parse() - assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_verify(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.custom_nameservers.with_raw_response.verify( - account_id="", - body={}, - ) - class TestAsyncCustomNameservers: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -250,7 +207,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="372e67954025e0ba6aaa6d586b9e0b59", ns_name="ns1.example.com", ) - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -259,7 +216,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ns_name="ns1.example.com", ns_set=1, ) - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -271,7 +228,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" custom_nameserver = await response.parse() - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -283,7 +240,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_nameserver = await response.parse() - assert_matches_type(CustomNameserver, custom_nameserver, path=["response"]) + assert_matches_type(Optional[CustomNameserver], custom_nameserver, path=["response"]) assert cast(Any, response.is_closed) is True @@ -418,45 +375,3 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: await async_client.custom_nameservers.with_raw_response.get( account_id="", ) - - @parametrize - async def test_method_verify(self, async_client: AsyncCloudflare) -> None: - custom_nameserver = await async_client.custom_nameservers.verify( - account_id="372e67954025e0ba6aaa6d586b9e0b59", - body={}, - ) - assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) - - @parametrize - async def test_raw_response_verify(self, async_client: AsyncCloudflare) -> None: - response = await async_client.custom_nameservers.with_raw_response.verify( - account_id="372e67954025e0ba6aaa6d586b9e0b59", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - custom_nameserver = await response.parse() - assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) - - @parametrize - async def test_streaming_response_verify(self, async_client: AsyncCloudflare) -> None: - async with async_client.custom_nameservers.with_streaming_response.verify( - account_id="372e67954025e0ba6aaa6d586b9e0b59", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - custom_nameserver = await response.parse() - assert_matches_type(Optional[CustomNameserverVerifyResponse], custom_nameserver, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_verify(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.custom_nameservers.with_raw_response.verify( - account_id="", - body={}, - )