From 1740e2f667f6adb32cc56b0a9edb202b79ed81bb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:13:59 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#327) --- api.md | 2 +- .../resources/logs/control/cmb/config.py | 58 ++++++++----------- .../types/logs/control/cmb/__init__.py | 1 - .../control/cmb/config_delete_response.py | 7 --- .../logs/control/cmb/test_config.py | 17 +++--- 5 files changed, 32 insertions(+), 53 deletions(-) delete mode 100644 src/cloudflare/types/logs/control/cmb/config_delete_response.py diff --git a/api.md b/api.md index 1669a8e4f20..2fd9d1c23e8 100644 --- a/api.md +++ b/api.md @@ -2139,7 +2139,7 @@ from cloudflare.types.logs.control.cmb import CmbConfig, ConfigDeleteResponse Methods: - client.logs.control.cmb.config.create(\*, account_id, \*\*params) -> Optional -- client.logs.control.cmb.config.delete(\*, account_id, \*\*params) -> Optional +- client.logs.control.cmb.config.delete(\*, account_id, \*\*params) -> object - client.logs.control.cmb.config.get(\*, account_id) -> Optional ## RayID diff --git a/src/cloudflare/resources/logs/control/cmb/config.py b/src/cloudflare/resources/logs/control/cmb/config.py index 86da5f0ff2c..a9a6e1844ab 100644 --- a/src/cloudflare/resources/logs/control/cmb/config.py +++ b/src/cloudflare/resources/logs/control/cmb/config.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,7 +23,7 @@ from ....._base_client import ( make_request_options, ) -from .....types.logs.control.cmb import CmbConfig, ConfigDeleteResponse, config_create_params, config_delete_params +from .....types.logs.control.cmb import CmbConfig, config_create_params, config_delete_params __all__ = ["Config", "AsyncConfig"] @@ -91,7 +91,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConfigDeleteResponse]: + ) -> object: """ Deletes CMB config. @@ -108,22 +108,17 @@ def delete( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - Optional[ConfigDeleteResponse], - self._delete( - f"/accounts/{account_id}/logs/control/cmb/config", - body=maybe_transform(body, config_delete_params.ConfigDeleteParams), - 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[ConfigDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/logs/control/cmb/config", + body=maybe_transform(body, config_delete_params.ConfigDeleteParams), + 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[object], ResultWrapper[object]), ) def get( @@ -229,7 +224,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConfigDeleteResponse]: + ) -> object: """ Deletes CMB config. @@ -246,22 +241,17 @@ 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( - Optional[ConfigDeleteResponse], - await self._delete( - f"/accounts/{account_id}/logs/control/cmb/config", - body=await async_maybe_transform(body, config_delete_params.ConfigDeleteParams), - 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[ConfigDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/logs/control/cmb/config", + body=await async_maybe_transform(body, config_delete_params.ConfigDeleteParams), + 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[object], ResultWrapper[object]), ) async def get( diff --git a/src/cloudflare/types/logs/control/cmb/__init__.py b/src/cloudflare/types/logs/control/cmb/__init__.py index dc545fb11dd..d96a935ea5d 100644 --- a/src/cloudflare/types/logs/control/cmb/__init__.py +++ b/src/cloudflare/types/logs/control/cmb/__init__.py @@ -5,4 +5,3 @@ from .cmb_config import CmbConfig as CmbConfig from .config_create_params import ConfigCreateParams as ConfigCreateParams from .config_delete_params import ConfigDeleteParams as ConfigDeleteParams -from .config_delete_response import ConfigDeleteResponse as ConfigDeleteResponse diff --git a/src/cloudflare/types/logs/control/cmb/config_delete_response.py b/src/cloudflare/types/logs/control/cmb/config_delete_response.py deleted file mode 100644 index 4407776e27b..00000000000 --- a/src/cloudflare/types/logs/control/cmb/config_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -__all__ = ["ConfigDeleteResponse"] - -ConfigDeleteResponse = Union[List[object], str, object, None] diff --git a/tests/api_resources/logs/control/cmb/test_config.py b/tests/api_resources/logs/control/cmb/test_config.py index 556af0c050d..20b0222ef19 100644 --- a/tests/api_resources/logs/control/cmb/test_config.py +++ b/tests/api_resources/logs/control/cmb/test_config.py @@ -9,10 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logs.control.cmb import ( - CmbConfig, - ConfigDeleteResponse, -) +from cloudflare.types.logs.control.cmb import CmbConfig base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -78,7 +75,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -91,7 +88,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" config = response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +101,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,7 +218,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -234,7 +231,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" config = await response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,7 +244,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) + assert_matches_type(object, config, path=["response"]) assert cast(Any, response.is_closed) is True