From 7ffa1bfbbc43c63d5f45bf864dbbab19c5e48b25 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Wed, 20 Nov 2024 22:24:13 +0000 Subject: [PATCH] feat(api): manual updates --- api.md | 10 +++------- .../api_gateway/discovery/operations.py | 14 +++++++------- src/cloudflare/types/api_gateway/__init__.py | 1 + .../types/api_gateway/discovery/__init__.py | 1 - ...list_response.py => discovery_operation.py} | 6 +++--- .../api_gateway/discovery/test_operations.py | 18 +++++++++--------- 6 files changed, 23 insertions(+), 27 deletions(-) rename src/cloudflare/types/api_gateway/{discovery/operation_list_response.py => discovery_operation.py} (91%) diff --git a/api.md b/api.md index 2efe289ba68..692bfb6d3d5 100644 --- a/api.md +++ b/api.md @@ -2653,7 +2653,7 @@ Methods: Types: ```python -from cloudflare.types.api_gateway import DiscoveryGetResponse +from cloudflare.types.api_gateway import DiscoveryOperation, DiscoveryGetResponse ``` Methods: @@ -2665,16 +2665,12 @@ Methods: Types: ```python -from cloudflare.types.api_gateway.discovery import ( - OperationListResponse, - OperationBulkEditResponse, - OperationEditResponse, -) +from cloudflare.types.api_gateway.discovery import OperationBulkEditResponse, OperationEditResponse ``` Methods: -- client.api_gateway.discovery.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OperationListResponse] +- client.api_gateway.discovery.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[DiscoveryOperation] - client.api_gateway.discovery.operations.bulk_edit(\*, zone_id, \*\*params) -> OperationBulkEditResponse - client.api_gateway.discovery.operations.edit(operation_id, \*, zone_id, \*\*params) -> OperationEditResponse diff --git a/src/cloudflare/resources/api_gateway/discovery/operations.py b/src/cloudflare/resources/api_gateway/discovery/operations.py index 95a5dc74fc6..1994f365d02 100644 --- a/src/cloudflare/resources/api_gateway/discovery/operations.py +++ b/src/cloudflare/resources/api_gateway/discovery/operations.py @@ -24,8 +24,8 @@ from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options from ....types.api_gateway.discovery import operation_edit_params, operation_list_params, operation_bulk_edit_params +from ....types.api_gateway.discovery_operation import DiscoveryOperation from ....types.api_gateway.discovery.operation_edit_response import OperationEditResponse -from ....types.api_gateway.discovery.operation_list_response import OperationListResponse from ....types.api_gateway.discovery.operation_bulk_edit_response import OperationBulkEditResponse __all__ = ["OperationsResource", "AsyncOperationsResource"] @@ -72,7 +72,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[OperationListResponse]: + ) -> SyncV4PagePaginationArray[DiscoveryOperation]: """ Retrieve the most up to date view of discovered operations @@ -124,7 +124,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._get_api_list( f"/zones/{zone_id}/api_gateway/discovery/operations", - page=SyncV4PagePaginationArray[OperationListResponse], + page=SyncV4PagePaginationArray[DiscoveryOperation], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -146,7 +146,7 @@ def list( operation_list_params.OperationListParams, ), ), - model=OperationListResponse, + model=DiscoveryOperation, ) def bulk_edit( @@ -283,7 +283,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[OperationListResponse, AsyncV4PagePaginationArray[OperationListResponse]]: + ) -> AsyncPaginator[DiscoveryOperation, AsyncV4PagePaginationArray[DiscoveryOperation]]: """ Retrieve the most up to date view of discovered operations @@ -335,7 +335,7 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._get_api_list( f"/zones/{zone_id}/api_gateway/discovery/operations", - page=AsyncV4PagePaginationArray[OperationListResponse], + page=AsyncV4PagePaginationArray[DiscoveryOperation], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -357,7 +357,7 @@ def list( operation_list_params.OperationListParams, ), ), - model=OperationListResponse, + model=DiscoveryOperation, ) async def bulk_edit( diff --git a/src/cloudflare/types/api_gateway/__init__.py b/src/cloudflare/types/api_gateway/__init__.py index a335e9140d0..272e71c2b78 100644 --- a/src/cloudflare/types/api_gateway/__init__.py +++ b/src/cloudflare/types/api_gateway/__init__.py @@ -9,6 +9,7 @@ from .public_schema import PublicSchema as PublicSchema from .schema_upload import SchemaUpload as SchemaUpload from .schema_list_params import SchemaListParams as SchemaListParams +from .discovery_operation import DiscoveryOperation as DiscoveryOperation from .operation_get_params import OperationGetParams as OperationGetParams from .schema_list_response import SchemaListResponse as SchemaListResponse from .operation_list_params import OperationListParams as OperationListParams diff --git a/src/cloudflare/types/api_gateway/discovery/__init__.py b/src/cloudflare/types/api_gateway/discovery/__init__.py index 80aadd81e5a..40378bcab0c 100644 --- a/src/cloudflare/types/api_gateway/discovery/__init__.py +++ b/src/cloudflare/types/api_gateway/discovery/__init__.py @@ -5,6 +5,5 @@ from .operation_edit_params import OperationEditParams as OperationEditParams from .operation_list_params import OperationListParams as OperationListParams from .operation_edit_response import OperationEditResponse as OperationEditResponse -from .operation_list_response import OperationListResponse as OperationListResponse from .operation_bulk_edit_params import OperationBulkEditParams as OperationBulkEditParams from .operation_bulk_edit_response import OperationBulkEditResponse as OperationBulkEditResponse diff --git a/src/cloudflare/types/api_gateway/discovery/operation_list_response.py b/src/cloudflare/types/api_gateway/discovery_operation.py similarity index 91% rename from src/cloudflare/types/api_gateway/discovery/operation_list_response.py rename to src/cloudflare/types/api_gateway/discovery_operation.py index 98dc452c73c..8c3fe0a8617 100644 --- a/src/cloudflare/types/api_gateway/discovery/operation_list_response.py +++ b/src/cloudflare/types/api_gateway/discovery_operation.py @@ -4,9 +4,9 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel -__all__ = ["OperationListResponse", "Features", "FeaturesTrafficStats"] +__all__ = ["DiscoveryOperation", "Features", "FeaturesTrafficStats"] class FeaturesTrafficStats(BaseModel): @@ -23,7 +23,7 @@ class Features(BaseModel): traffic_stats: Optional[FeaturesTrafficStats] = None -class OperationListResponse(BaseModel): +class DiscoveryOperation(BaseModel): id: str """UUID""" diff --git a/tests/api_resources/api_gateway/discovery/test_operations.py b/tests/api_resources/api_gateway/discovery/test_operations.py index 9cdf69de240..01e6ba3122e 100644 --- a/tests/api_resources/api_gateway/discovery/test_operations.py +++ b/tests/api_resources/api_gateway/discovery/test_operations.py @@ -10,9 +10,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.api_gateway import DiscoveryOperation from cloudflare.types.api_gateway.discovery import ( OperationEditResponse, - OperationListResponse, OperationBulkEditResponse, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: operation = client.api_gateway.discovery.operations.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -44,7 +44,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=5, state="review", ) - assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -55,7 +55,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = response.parse() - assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -66,7 +66,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = response.parse() - assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +197,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: operation = await async_client.api_gateway.discovery.operations.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -214,7 +214,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=5, state="review", ) - assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -225,7 +225,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -236,7 +236,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) assert cast(Any, response.is_closed) is True