From 0d0a6d1b6319ad9a3dfea6d5300313fb4c3f48ed Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Thu, 28 Nov 2024 06:12:16 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- api.md | 2 +- .../resources/ai_gateway/ai_gateway.py | 8 +++ src/cloudflare/resources/dnssec.py | 52 ++++++++----------- .../ai_gateway/ai_gateway_list_params.py | 3 ++ .../types/dnssec/dnssec_delete_response.py | 3 +- tests/api_resources/test_ai_gateway.py | 2 + tests/api_resources/test_dnssec.py | 14 ++--- 8 files changed, 44 insertions(+), 42 deletions(-) diff --git a/.stats.yml b/.stats.yml index 970d709d9c6..698ae42c511 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1451 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c5682a28c312411d32f5a8447e4c50880eabf7d71415128758e7924dc434c4da.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8c1088ba96368f5f19f6d33654ae76942cfd4f0e3b7f418add2c67b01a6085dc.yml diff --git a/api.md b/api.md index 8ebf78d8726..df694e69d0b 100644 --- a/api.md +++ b/api.md @@ -1164,7 +1164,7 @@ from cloudflare.types.dnssec import DNSSEC, DNSSECDeleteResponse Methods: -- client.dnssec.delete(\*, zone_id) -> Optional[DNSSECDeleteResponse] +- client.dnssec.delete(\*, zone_id) -> str - client.dnssec.edit(\*, zone_id, \*\*params) -> Optional[DNSSEC] - client.dnssec.get(\*, zone_id) -> Optional[DNSSEC] diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py index a6611f20caa..c10d86e5d9c 100644 --- a/src/cloudflare/resources/ai_gateway/ai_gateway.py +++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py @@ -234,6 +234,7 @@ def list( order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, # 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, @@ -249,6 +250,8 @@ def list( order_by_direction: Order By Direction + search: Search by id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -273,6 +276,7 @@ def list( "order_by_direction": order_by_direction, "page": page, "per_page": per_page, + "search": search, }, ai_gateway_list_params.AIGatewayListParams, ), @@ -534,6 +538,7 @@ def list( order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, # 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, @@ -549,6 +554,8 @@ def list( order_by_direction: Order By Direction + search: Search by id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -573,6 +580,7 @@ def list( "order_by_direction": order_by_direction, "page": page, "per_page": per_page, + "search": search, }, ai_gateway_list_params.AIGatewayListParams, ), diff --git a/src/cloudflare/resources/dnssec.py b/src/cloudflare/resources/dnssec.py index ee2c708afda..456af0fed2c 100644 --- a/src/cloudflare/resources/dnssec.py +++ b/src/cloudflare/resources/dnssec.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -59,7 +59,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DNSSECDeleteResponse]: + ) -> str: """ Delete DNSSEC. @@ -76,21 +76,16 @@ def delete( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - Optional[DNSSECDeleteResponse], - self._delete( - f"/zones/{zone_id}/dnssec", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[DNSSECDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/zones/{zone_id}/dnssec", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[str], ResultWrapper[str]), ) def edit( @@ -232,7 +227,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DNSSECDeleteResponse]: + ) -> str: """ Delete DNSSEC. @@ -249,21 +244,16 @@ async def delete( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - Optional[DNSSECDeleteResponse], - await self._delete( - f"/zones/{zone_id}/dnssec", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[DNSSECDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/zones/{zone_id}/dnssec", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[str], ResultWrapper[str]), ) async def edit( diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py b/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py index 4210334aa47..a363b567a3f 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py @@ -19,3 +19,6 @@ class AIGatewayListParams(TypedDict, total=False): page: int per_page: int + + search: str + """Search by id""" diff --git a/src/cloudflare/types/dnssec/dnssec_delete_response.py b/src/cloudflare/types/dnssec/dnssec_delete_response.py index 98446b72cf8..895a6c00234 100644 --- a/src/cloudflare/types/dnssec/dnssec_delete_response.py +++ b/src/cloudflare/types/dnssec/dnssec_delete_response.py @@ -1,8 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union from typing_extensions import TypeAlias __all__ = ["DNSSECDeleteResponse"] -DNSSECDeleteResponse: TypeAlias = Union[str, object] +DNSSECDeleteResponse: TypeAlias = str diff --git a/tests/api_resources/test_ai_gateway.py b/tests/api_resources/test_ai_gateway.py index e3a0e1a20b0..8c33ce4e9fa 100644 --- a/tests/api_resources/test_ai_gateway.py +++ b/tests/api_resources/test_ai_gateway.py @@ -215,6 +215,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: order_by_direction="asc", page=1, per_page=1, + search="search", ) assert_matches_type(SyncV4PagePaginationArray[AIGatewayListResponse], ai_gateway, path=["response"]) @@ -540,6 +541,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) order_by_direction="asc", page=1, per_page=1, + search="search", ) assert_matches_type(AsyncV4PagePaginationArray[AIGatewayListResponse], ai_gateway, path=["response"]) diff --git a/tests/api_resources/test_dnssec.py b/tests/api_resources/test_dnssec.py index 8b083f578d3..4337b194683 100644 --- a/tests/api_resources/test_dnssec.py +++ b/tests/api_resources/test_dnssec.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.dnssec import DNSSEC, DNSSECDeleteResponse +from cloudflare.types.dnssec import DNSSEC base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ def test_method_delete(self, client: Cloudflare) -> None: dnssec = client.dnssec.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) + assert_matches_type(str, dnssec, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -33,7 +33,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" dnssec = response.parse() - assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) + assert_matches_type(str, dnssec, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -44,7 +44,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = response.parse() - assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) + assert_matches_type(str, dnssec, path=["response"]) assert cast(Any, response.is_closed) is True @@ -150,7 +150,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: dnssec = await async_client.dnssec.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) + assert_matches_type(str, dnssec, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -161,7 +161,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" dnssec = await response.parse() - assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) + assert_matches_type(str, dnssec, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -172,7 +172,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" dnssec = await response.parse() - assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"]) + assert_matches_type(str, dnssec, path=["response"]) assert cast(Any, response.is_closed) is True