From 7b9be4f734bff8d327659a1eed569eb6fecfc414 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 16 Jul 2024 11:07:02 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- .stats.yml | 2 +- api.md | 22 +- .../resources/api_gateway/configurations.py | 60 ++--- .../api_gateway/discovery/operations.py | 22 +- .../api_gateway/operations/operations.py | 101 ++++---- .../operations/schema_validation.py | 8 + .../api_gateway/user_schemas/operations.py | 18 +- .../api_gateway/user_schemas/user_schemas.py | 32 +-- src/cloudflare/types/api_gateway/__init__.py | 2 + .../types/api_gateway/api_shield.py | 4 +- .../types/api_gateway/configuration.py | 4 +- .../configuration_update_params.py | 2 +- .../configuration_update_response.py | 14 +- .../discovery/operation_list_params.py | 4 +- .../api_gateway/discovery_get_response.py | 6 +- .../types/api_gateway/discovery_operation.py | 2 +- .../api_gateway/operation_delete_response.py | 14 +- .../api_gateway/operation_get_response.py | 227 ++++++++++++++++++ .../api_gateway/operation_list_params.py | 6 +- .../api_gateway/operation_list_response.py | 227 ++++++++++++++++++ .../types/api_gateway/public_schema.py | 2 +- .../user_schema_delete_response.py | 4 +- .../api_gateway/user_schema_list_params.py | 4 +- .../user_schemas/operation_list_params.py | 4 +- .../api_gateway/discovery/test_operations.py | 46 ++-- .../api_gateway/test_configurations.py | 50 ++-- .../api_gateway/test_operations.py | 55 ++--- .../api_gateway/test_user_schemas.py | 40 +-- .../user_schemas/test_operations.py | 26 +- 29 files changed, 747 insertions(+), 261 deletions(-) create mode 100644 src/cloudflare/types/api_gateway/operation_get_response.py create mode 100644 src/cloudflare/types/api_gateway/operation_list_response.py diff --git a/.stats.yml b/.stats.yml index 10fd2e7e73a..a7c4ebd6ec6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1256 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-74d68374448e03b29a39bb6cdf6c39cdeaaaa691dd9c38f46a26a1d562c8ee37.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b116e60da4a69a05bc8823c2397e4a33d111c82a6b458ea4f480d0ba52ea8de0.yml diff --git a/api.md b/api.md index 9418685f613..b2c35ac9ccd 100644 --- a/api.md +++ b/api.md @@ -2392,7 +2392,7 @@ from cloudflare.types.api_gateway.discovery import OperationEditResponse Methods: -- client.api_gateway.discovery.operations.list(\*, zone_id, \*\*params) -> SyncSinglePage[DiscoveryOperation] +- client.api_gateway.discovery.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[DiscoveryOperation] - client.api_gateway.discovery.operations.edit(operation_id, \*, zone_id, \*\*params) -> OperationEditResponse ## Operations @@ -2400,15 +2400,21 @@ Methods: Types: ```python -from cloudflare.types.api_gateway import APIShield, OperationCreateResponse, OperationDeleteResponse +from cloudflare.types.api_gateway import ( + APIShield, + OperationCreateResponse, + OperationListResponse, + OperationDeleteResponse, + OperationGetResponse, +) ``` Methods: -- client.api_gateway.operations.create(\*, zone_id, \*\*params) -> Optional -- client.api_gateway.operations.list(\*, zone_id, \*\*params) -> SyncSinglePage[APIShield] +- client.api_gateway.operations.create(\*, zone_id, \*\*params) -> OperationCreateResponse +- client.api_gateway.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OperationListResponse] - client.api_gateway.operations.delete(operation_id, \*, zone_id) -> OperationDeleteResponse -- client.api_gateway.operations.get(operation_id, \*, zone_id, \*\*params) -> APIShield +- client.api_gateway.operations.get(operation_id, \*, zone_id, \*\*params) -> OperationGetResponse ### SchemaValidation @@ -2472,8 +2478,8 @@ from cloudflare.types.api_gateway import ( Methods: - client.api_gateway.user_schemas.create(\*, zone_id, \*\*params) -> SchemaUpload -- client.api_gateway.user_schemas.list(\*, zone_id, \*\*params) -> SyncSinglePage[PublicSchema] -- client.api_gateway.user_schemas.delete(schema_id, \*, zone_id) -> UserSchemaDeleteResponse +- client.api_gateway.user_schemas.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[PublicSchema] +- client.api_gateway.user_schemas.delete(schema_id, \*, zone_id) -> Optional - client.api_gateway.user_schemas.edit(schema_id, \*, zone_id, \*\*params) -> PublicSchema - client.api_gateway.user_schemas.get(schema_id, \*, zone_id, \*\*params) -> PublicSchema @@ -2487,7 +2493,7 @@ from cloudflare.types.api_gateway.user_schemas import OperationListResponse Methods: -- client.api_gateway.user_schemas.operations.list(schema_id, \*, zone_id, \*\*params) -> SyncSinglePage[OperationListResponse] +- client.api_gateway.user_schemas.operations.list(schema_id, \*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OperationListResponse] # ManagedHeaders diff --git a/src/cloudflare/resources/api_gateway/configurations.py b/src/cloudflare/resources/api_gateway/configurations.py index 3d4aa7ba68a..efa78c99742 100644 --- a/src/cloudflare/resources/api_gateway/configurations.py +++ b/src/cloudflare/resources/api_gateway/configurations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Iterable, cast +from typing import List, Type, Iterable, cast from typing_extensions import Literal import httpx @@ -42,7 +42,7 @@ def update( self, *, zone_id: str, - auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic] | NotGiven = NOT_GIVEN, + auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic], # 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, @@ -66,25 +66,16 @@ def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - ConfigurationUpdateResponse, - self._put( - f"/zones/{zone_id}/api_gateway/configuration", - body=maybe_transform( - {"auth_id_characteristics": auth_id_characteristics}, - configuration_update_params.ConfigurationUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ConfigurationUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/zones/{zone_id}/api_gateway/configuration", + body=maybe_transform( + {"auth_id_characteristics": auth_id_characteristics}, + configuration_update_params.ConfigurationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=ConfigurationUpdateResponse, ) def get( @@ -144,7 +135,7 @@ async def update( self, *, zone_id: str, - auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic] | NotGiven = NOT_GIVEN, + auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic], # 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, @@ -168,25 +159,16 @@ 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( - ConfigurationUpdateResponse, - await self._put( - f"/zones/{zone_id}/api_gateway/configuration", - body=await async_maybe_transform( - {"auth_id_characteristics": auth_id_characteristics}, - configuration_update_params.ConfigurationUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ConfigurationUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/zones/{zone_id}/api_gateway/configuration", + body=await async_maybe_transform( + {"auth_id_characteristics": auth_id_characteristics}, + configuration_update_params.ConfigurationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=ConfigurationUpdateResponse, ) async def get( diff --git a/src/cloudflare/resources/api_gateway/discovery/operations.py b/src/cloudflare/resources/api_gateway/discovery/operations.py index 03fb113abb0..4f7fb29a475 100644 --- a/src/cloudflare/resources/api_gateway/discovery/operations.py +++ b/src/cloudflare/resources/api_gateway/discovery/operations.py @@ -21,7 +21,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage +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 from ....types.api_gateway.discovery_operation import DiscoveryOperation @@ -51,8 +51,8 @@ def list( order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] | NotGiven = NOT_GIVEN, origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: object | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, state: Literal["review", "saved", "ignored"] | 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. @@ -60,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[DiscoveryOperation]: + ) -> SyncV4PagePaginationArray[DiscoveryOperation]: """ Retrieve the most up to date view of discovered operations @@ -112,7 +112,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=SyncSinglePage[DiscoveryOperation], + page=SyncV4PagePaginationArray[DiscoveryOperation], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -156,7 +156,7 @@ def edit( Args: zone_id: Identifier - operation_id: UUID identifier + operation_id: UUID state: Mark state of operation in API Discovery @@ -210,8 +210,8 @@ def list( order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] | NotGiven = NOT_GIVEN, origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: object | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, state: Literal["review", "saved", "ignored"] | 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. @@ -219,7 +219,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[DiscoveryOperation, AsyncSinglePage[DiscoveryOperation]]: + ) -> AsyncPaginator[DiscoveryOperation, AsyncV4PagePaginationArray[DiscoveryOperation]]: """ Retrieve the most up to date view of discovered operations @@ -271,7 +271,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=AsyncSinglePage[DiscoveryOperation], + page=AsyncV4PagePaginationArray[DiscoveryOperation], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -315,7 +315,7 @@ async def edit( Args: zone_id: Identifier - operation_id: UUID identifier + operation_id: UUID state: Mark state of operation in API Discovery diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py index f0737a85bf5..cb5b7673217 100644 --- a/src/cloudflare/resources/api_gateway/operations/operations.py +++ b/src/cloudflare/resources/api_gateway/operations/operations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Iterable, Optional, cast +from typing import List, Type, Iterable, cast from typing_extensions import Literal import httpx @@ -21,7 +21,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage +from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options from .schema_validation import ( SchemaValidationResource, @@ -32,7 +32,8 @@ AsyncSchemaValidationResourceWithStreamingResponse, ) from ....types.api_gateway import operation_get_params, operation_list_params, operation_create_params -from ....types.api_gateway.api_shield import APIShield +from ....types.api_gateway.operation_get_response import OperationGetResponse +from ....types.api_gateway.operation_list_response import OperationListResponse from ....types.api_gateway.operation_create_response import OperationCreateResponse from ....types.api_gateway.operation_delete_response import OperationDeleteResponse @@ -63,7 +64,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OperationCreateResponse]: + ) -> OperationCreateResponse: """Add one or more operations to a zone. Endpoints can contain path variables. @@ -93,9 +94,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[OperationCreateResponse]]._unwrapper, + post_parser=ResultWrapper[OperationCreateResponse]._unwrapper, ), - cast_to=cast(Type[Optional[OperationCreateResponse]], ResultWrapper[OperationCreateResponse]), + cast_to=cast(Type[OperationCreateResponse], ResultWrapper[OperationCreateResponse]), ) def list( @@ -108,15 +109,15 @@ def list( host: List[str] | NotGiven = NOT_GIVEN, method: List[str] | NotGiven = NOT_GIVEN, order: Literal["method", "host", "endpoint", "thresholds.$key"] | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: float | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | 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, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[APIShield]: + ) -> SyncV4PagePaginationArray[OperationListResponse]: """ Retrieve information about all operations on a zone @@ -140,7 +141,7 @@ def list( page: Page number of paginated results. - per_page: Number of results to return per page + per_page: Maximum number of results per page. extra_headers: Send extra headers @@ -154,7 +155,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/operations", - page=SyncSinglePage[APIShield], + page=SyncV4PagePaginationArray[OperationListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -174,7 +175,7 @@ def list( operation_list_params.OperationListParams, ), ), - model=APIShield, + model=OperationListResponse, ) def delete( @@ -195,6 +196,8 @@ def delete( Args: zone_id: Identifier + operation_id: UUID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -207,21 +210,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not operation_id: raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") - return cast( - OperationDeleteResponse, - self._delete( - f"/zones/{zone_id}/api_gateway/operations/{operation_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OperationDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OperationDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=OperationDeleteResponse, ) def get( @@ -236,13 +230,15 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIShield: + ) -> OperationGetResponse: """ Retrieve information about an operation Args: zone_id: Identifier + operation_id: UUID + feature: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. @@ -267,9 +263,9 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"feature": feature}, operation_get_params.OperationGetParams), - post_parser=ResultWrapper[APIShield]._unwrapper, + post_parser=ResultWrapper[OperationGetResponse]._unwrapper, ), - cast_to=cast(Type[APIShield], ResultWrapper[APIShield]), + cast_to=cast(Type[OperationGetResponse], ResultWrapper[OperationGetResponse]), ) @@ -297,7 +293,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OperationCreateResponse]: + ) -> OperationCreateResponse: """Add one or more operations to a zone. Endpoints can contain path variables. @@ -327,9 +323,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[OperationCreateResponse]]._unwrapper, + post_parser=ResultWrapper[OperationCreateResponse]._unwrapper, ), - cast_to=cast(Type[Optional[OperationCreateResponse]], ResultWrapper[OperationCreateResponse]), + cast_to=cast(Type[OperationCreateResponse], ResultWrapper[OperationCreateResponse]), ) def list( @@ -342,15 +338,15 @@ def list( host: List[str] | NotGiven = NOT_GIVEN, method: List[str] | NotGiven = NOT_GIVEN, order: Literal["method", "host", "endpoint", "thresholds.$key"] | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: float | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | 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, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[APIShield, AsyncSinglePage[APIShield]]: + ) -> AsyncPaginator[OperationListResponse, AsyncV4PagePaginationArray[OperationListResponse]]: """ Retrieve information about all operations on a zone @@ -374,7 +370,7 @@ def list( page: Page number of paginated results. - per_page: Number of results to return per page + per_page: Maximum number of results per page. extra_headers: Send extra headers @@ -388,7 +384,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/operations", - page=AsyncSinglePage[APIShield], + page=AsyncV4PagePaginationArray[OperationListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -408,7 +404,7 @@ def list( operation_list_params.OperationListParams, ), ), - model=APIShield, + model=OperationListResponse, ) async def delete( @@ -429,6 +425,8 @@ async def delete( Args: zone_id: Identifier + operation_id: UUID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -441,21 +439,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not operation_id: raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") - return cast( - OperationDeleteResponse, - await self._delete( - f"/zones/{zone_id}/api_gateway/operations/{operation_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OperationDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OperationDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=OperationDeleteResponse, ) async def get( @@ -470,13 +459,15 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIShield: + ) -> OperationGetResponse: """ Retrieve information about an operation Args: zone_id: Identifier + operation_id: UUID + feature: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. @@ -501,9 +492,9 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"feature": feature}, operation_get_params.OperationGetParams), - post_parser=ResultWrapper[APIShield]._unwrapper, + post_parser=ResultWrapper[OperationGetResponse]._unwrapper, ), - cast_to=cast(Type[APIShield], ResultWrapper[APIShield]), + cast_to=cast(Type[OperationGetResponse], ResultWrapper[OperationGetResponse]), ) diff --git a/src/cloudflare/resources/api_gateway/operations/schema_validation.py b/src/cloudflare/resources/api_gateway/operations/schema_validation.py index 5b86343cfd6..75fbceb4e40 100644 --- a/src/cloudflare/resources/api_gateway/operations/schema_validation.py +++ b/src/cloudflare/resources/api_gateway/operations/schema_validation.py @@ -63,6 +63,8 @@ def update( Args: zone_id: Identifier + operation_id: UUID + mitigation_action: When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation @@ -154,6 +156,8 @@ def get( Args: zone_id: Identifier + operation_id: UUID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -203,6 +207,8 @@ async def update( Args: zone_id: Identifier + operation_id: UUID + mitigation_action: When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation @@ -296,6 +302,8 @@ async def get( Args: zone_id: Identifier + operation_id: UUID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/api_gateway/user_schemas/operations.py b/src/cloudflare/resources/api_gateway/user_schemas/operations.py index 783e7f5e5cd..18cb925ea95 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/operations.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/operations.py @@ -17,7 +17,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncSinglePage, AsyncSinglePage +from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options from ....types.api_gateway.user_schemas import operation_list_params from ....types.api_gateway.user_schemas.operation_list_response import OperationListResponse @@ -44,15 +44,15 @@ def list( host: List[str] | NotGiven = NOT_GIVEN, method: List[str] | NotGiven = NOT_GIVEN, operation_status: Literal["new", "existing"] | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: object | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | 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, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[OperationListResponse]: + ) -> SyncV4PagePaginationArray[OperationListResponse]: """Retrieves all operations from the schema. Operations that already exist in API @@ -94,7 +94,7 @@ def list( raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") return self._get_api_list( f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations", - page=SyncSinglePage[OperationListResponse], + page=SyncV4PagePaginationArray[OperationListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -136,15 +136,15 @@ def list( host: List[str] | NotGiven = NOT_GIVEN, method: List[str] | NotGiven = NOT_GIVEN, operation_status: Literal["new", "existing"] | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: object | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | 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, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[OperationListResponse, AsyncSinglePage[OperationListResponse]]: + ) -> AsyncPaginator[OperationListResponse, AsyncV4PagePaginationArray[OperationListResponse]]: """Retrieves all operations from the schema. Operations that already exist in API @@ -186,7 +186,7 @@ def list( raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") return self._get_api_list( f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations", - page=AsyncSinglePage[OperationListResponse], + page=AsyncV4PagePaginationArray[OperationListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py index a2f21d53add..267ebee4be3 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Mapping, cast +from typing import Any, Type, Mapping, Optional, cast from typing_extensions import Literal import httpx @@ -31,7 +31,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage +from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options from ....types.api_gateway import ( user_schema_get_params, @@ -130,8 +130,8 @@ def list( *, zone_id: str, omit_source: bool | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: object | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, validation_enabled: bool | 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. @@ -139,7 +139,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[PublicSchema]: + ) -> SyncV4PagePaginationArray[PublicSchema]: """ Retrieve information about all schemas on a zone @@ -166,7 +166,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/user_schemas", - page=SyncSinglePage[PublicSchema], + page=SyncV4PagePaginationArray[PublicSchema], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -196,7 +196,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserSchemaDeleteResponse: + ) -> Optional[UserSchemaDeleteResponse]: """ Delete a schema @@ -216,7 +216,7 @@ def delete( if not schema_id: raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") return cast( - UserSchemaDeleteResponse, + Optional[UserSchemaDeleteResponse], self._delete( f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", options=make_request_options( @@ -224,7 +224,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UserSchemaDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[UserSchemaDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UserSchemaDeleteResponse] @@ -411,8 +411,8 @@ def list( *, zone_id: str, omit_source: bool | NotGiven = NOT_GIVEN, - page: object | NotGiven = NOT_GIVEN, - per_page: object | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, validation_enabled: bool | 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. @@ -420,7 +420,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PublicSchema, AsyncSinglePage[PublicSchema]]: + ) -> AsyncPaginator[PublicSchema, AsyncV4PagePaginationArray[PublicSchema]]: """ Retrieve information about all schemas on a zone @@ -447,7 +447,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/user_schemas", - page=AsyncSinglePage[PublicSchema], + page=AsyncV4PagePaginationArray[PublicSchema], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -477,7 +477,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserSchemaDeleteResponse: + ) -> Optional[UserSchemaDeleteResponse]: """ Delete a schema @@ -497,7 +497,7 @@ async def delete( if not schema_id: raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") return cast( - UserSchemaDeleteResponse, + Optional[UserSchemaDeleteResponse], await self._delete( f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", options=make_request_options( @@ -505,7 +505,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UserSchemaDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[UserSchemaDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UserSchemaDeleteResponse] diff --git a/src/cloudflare/types/api_gateway/__init__.py b/src/cloudflare/types/api_gateway/__init__.py index 03e7d8be4f3..15d29b9c6f3 100644 --- a/src/cloudflare/types/api_gateway/__init__.py +++ b/src/cloudflare/types/api_gateway/__init__.py @@ -14,8 +14,10 @@ from .schema_list_response import SchemaListResponse as SchemaListResponse from .operation_list_params import OperationListParams as OperationListParams from .discovery_get_response import DiscoveryGetResponse as DiscoveryGetResponse +from .operation_get_response import OperationGetResponse as OperationGetResponse from .user_schema_get_params import UserSchemaGetParams as UserSchemaGetParams from .operation_create_params import OperationCreateParams as OperationCreateParams +from .operation_list_response import OperationListResponse as OperationListResponse from .user_schema_edit_params import UserSchemaEditParams as UserSchemaEditParams from .user_schema_list_params import UserSchemaListParams as UserSchemaListParams from .configuration_get_params import ConfigurationGetParams as ConfigurationGetParams diff --git a/src/cloudflare/types/api_gateway/api_shield.py b/src/cloudflare/types/api_gateway/api_shield.py index 9f5c25885e8..e3ca4b81018 100644 --- a/src/cloudflare/types/api_gateway/api_shield.py +++ b/src/cloudflare/types/api_gateway/api_shield.py @@ -169,7 +169,7 @@ class FeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): id: Optional[str] = None - """UUID identifier""" + """UUID""" created_at: Optional[datetime] = None @@ -222,6 +222,6 @@ class APIShield(BaseModel): """The HTTP method used to access the endpoint.""" operation_id: str - """UUID identifier""" + """UUID""" features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/configuration.py b/src/cloudflare/types/api_gateway/configuration.py index 855946241b2..b9dbfd61c92 100644 --- a/src/cloudflare/types/api_gateway/configuration.py +++ b/src/cloudflare/types/api_gateway/configuration.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Union from typing_extensions import Literal from ..._models import BaseModel @@ -43,4 +43,4 @@ class AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim(BaseModel): class Configuration(BaseModel): - auth_id_characteristics: Optional[List[AuthIDCharacteristic]] = None + auth_id_characteristics: List[AuthIDCharacteristic] diff --git a/src/cloudflare/types/api_gateway/configuration_update_params.py b/src/cloudflare/types/api_gateway/configuration_update_params.py index 52c7aff9ed0..db98617b582 100644 --- a/src/cloudflare/types/api_gateway/configuration_update_params.py +++ b/src/cloudflare/types/api_gateway/configuration_update_params.py @@ -17,7 +17,7 @@ class ConfigurationUpdateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - auth_id_characteristics: Iterable[AuthIDCharacteristic] + auth_id_characteristics: Required[Iterable[AuthIDCharacteristic]] class AuthIDCharacteristicAPIShieldAuthIDCharacteristic(TypedDict, total=False): diff --git a/src/cloudflare/types/api_gateway/configuration_update_response.py b/src/cloudflare/types/api_gateway/configuration_update_response.py index efe6f827dda..ae84bf09c04 100644 --- a/src/cloudflare/types/api_gateway/configuration_update_response.py +++ b/src/cloudflare/types/api_gateway/configuration_update_response.py @@ -1,7 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing_extensions import Literal + +from .message import Message +from ..._models import BaseModel __all__ = ["ConfigurationUpdateResponse"] -ConfigurationUpdateResponse = Union[Optional[str], Optional[object]] + +class ConfigurationUpdateResponse(BaseModel): + errors: Message + + messages: Message + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/api_gateway/discovery/operation_list_params.py b/src/cloudflare/types/api_gateway/discovery/operation_list_params.py index 978fee2d4bb..0b33645439c 100644 --- a/src/cloudflare/types/api_gateway/discovery/operation_list_params.py +++ b/src/cloudflare/types/api_gateway/discovery/operation_list_params.py @@ -43,10 +43,10 @@ class OperationListParams(TypedDict, total=False): Identifier API Discovery """ - page: object + page: int """Page number of paginated results.""" - per_page: object + per_page: int """Maximum number of results per page.""" state: Literal["review", "saved", "ignored"] diff --git a/src/cloudflare/types/api_gateway/discovery_get_response.py b/src/cloudflare/types/api_gateway/discovery_get_response.py index ac55c572760..bcc99ffc364 100644 --- a/src/cloudflare/types/api_gateway/discovery_get_response.py +++ b/src/cloudflare/types/api_gateway/discovery_get_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from datetime import datetime from ..._models import BaseModel @@ -9,6 +9,6 @@ class DiscoveryGetResponse(BaseModel): - schemas: Optional[List[object]] = None + schemas: List[object] - timestamp: Optional[datetime] = None + timestamp: datetime diff --git a/src/cloudflare/types/api_gateway/discovery_operation.py b/src/cloudflare/types/api_gateway/discovery_operation.py index bf9570a9176..8c3fe0a8617 100644 --- a/src/cloudflare/types/api_gateway/discovery_operation.py +++ b/src/cloudflare/types/api_gateway/discovery_operation.py @@ -25,7 +25,7 @@ class Features(BaseModel): class DiscoveryOperation(BaseModel): id: str - """UUID identifier""" + """UUID""" endpoint: str """ diff --git a/src/cloudflare/types/api_gateway/operation_delete_response.py b/src/cloudflare/types/api_gateway/operation_delete_response.py index 5c1266decb6..3122a809ae2 100644 --- a/src/cloudflare/types/api_gateway/operation_delete_response.py +++ b/src/cloudflare/types/api_gateway/operation_delete_response.py @@ -1,7 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing_extensions import Literal + +from .message import Message +from ..._models import BaseModel __all__ = ["OperationDeleteResponse"] -OperationDeleteResponse = Union[Optional[str], Optional[object]] + +class OperationDeleteResponse(BaseModel): + errors: Message + + messages: Message + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/api_gateway/operation_get_response.py b/src/cloudflare/types/api_gateway/operation_get_response.py new file mode 100644 index 00000000000..70a9d927019 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_get_response.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = [ + "OperationGetResponse", + "Features", + "FeaturesAPIShieldOperationFeatureThresholds", + "FeaturesAPIShieldOperationFeatureThresholdsThresholds", + "FeaturesAPIShieldOperationFeatureParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureAPIRouting", + "FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting", + "FeaturesAPIShieldOperationFeatureConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99", + "FeaturesAPIShieldOperationFeatureSchemaInfo", + "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo", + "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema", +] + + +class FeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): + auth_id_tokens: Optional[int] = None + """The total number of auth-ids seen across this calculation.""" + + data_points: Optional[int] = None + """The number of data points used for the threshold suggestion calculation.""" + + last_updated: Optional[datetime] = None + + p50: Optional[int] = None + """The p50 quantile of requests (in period_seconds).""" + + p90: Optional[int] = None + """The p90 quantile of requests (in period_seconds).""" + + p99: Optional[int] = None + """The p99 quantile of requests (in period_seconds).""" + + period_seconds: Optional[int] = None + """The period over which this threshold is suggested.""" + + requests: Optional[int] = None + """The estimated number of requests covered by these calculations.""" + + suggested_threshold: Optional[int] = None + """The suggested threshold in requests done by the same auth_id or period_seconds.""" + + +class FeaturesAPIShieldOperationFeatureThresholds(BaseModel): + thresholds: Optional[FeaturesAPIShieldOperationFeatureThresholdsThresholds] = None + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas(BaseModel): + parameters: Optional[List[object]] = None + """An array containing the learned parameter schemas.""" + + responses: Optional[object] = None + """An empty response object. + + This field is required to yield a valid operation schema. + """ + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): + last_updated: Optional[datetime] = None + + parameter_schemas: Optional[ + FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas + ] = None + """An operation schema object containing a response.""" + + +class FeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): + parameter_schemas: FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas + + +class FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting(BaseModel): + last_updated: Optional[datetime] = None + + route: Optional[str] = None + """Target route.""" + + +class FeaturesAPIShieldOperationFeatureAPIRouting(BaseModel): + api_routing: Optional[FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting] = None + """API Routing settings on endpoint.""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals( + BaseModel +): + p90: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90 + ] = None + """Upper and lower bound for percentile estimate""" + + p95: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95 + ] = None + """Upper and lower bound for percentile estimate""" + + p99: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99 + ] = None + """Upper and lower bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold(BaseModel): + confidence_intervals: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals + ] = None + + mean: Optional[float] = None + """Suggested threshold.""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals(BaseModel): + last_updated: Optional[datetime] = None + + suggested_threshold: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold + ] = None + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): + confidence_intervals: Optional[FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals] = None + + +class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): + id: Optional[str] = None + """UUID""" + + created_at: Optional[datetime] = None + + is_learned: Optional[bool] = None + """True if schema is Cloudflare-provided.""" + + name: Optional[str] = None + """Schema file name.""" + + +class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo(BaseModel): + active_schema: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema] = None + """Schema active on endpoint.""" + + learned_available: Optional[bool] = None + """True if a Cloudflare-provided learned schema is available for this endpoint.""" + + mitigation_action: Optional[Literal["none", "log", "block"]] = None + """Action taken on requests failing validation.""" + + +class FeaturesAPIShieldOperationFeatureSchemaInfo(BaseModel): + schema_info: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo] = None + + +Features = Union[ + FeaturesAPIShieldOperationFeatureThresholds, + FeaturesAPIShieldOperationFeatureParameterSchemas, + FeaturesAPIShieldOperationFeatureAPIRouting, + FeaturesAPIShieldOperationFeatureConfidenceIntervals, + FeaturesAPIShieldOperationFeatureSchemaInfo, +] + + +class OperationGetResponse(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + operation_id: str + """UUID""" + + features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/operation_list_params.py b/src/cloudflare/types/api_gateway/operation_list_params.py index d36dac5d172..1244f5a078f 100644 --- a/src/cloudflare/types/api_gateway/operation_list_params.py +++ b/src/cloudflare/types/api_gateway/operation_list_params.py @@ -39,8 +39,8 @@ class OperationListParams(TypedDict, total=False): e.g., `thresholds.suggested_threshold`. """ - page: object + page: int """Page number of paginated results.""" - per_page: float - """Number of results to return per page""" + per_page: int + """Maximum number of results per page.""" diff --git a/src/cloudflare/types/api_gateway/operation_list_response.py b/src/cloudflare/types/api_gateway/operation_list_response.py new file mode 100644 index 00000000000..53c500cb16f --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_list_response.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = [ + "OperationListResponse", + "Features", + "FeaturesAPIShieldOperationFeatureThresholds", + "FeaturesAPIShieldOperationFeatureThresholdsThresholds", + "FeaturesAPIShieldOperationFeatureParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureAPIRouting", + "FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting", + "FeaturesAPIShieldOperationFeatureConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95", + "FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99", + "FeaturesAPIShieldOperationFeatureSchemaInfo", + "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo", + "FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema", +] + + +class FeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): + auth_id_tokens: Optional[int] = None + """The total number of auth-ids seen across this calculation.""" + + data_points: Optional[int] = None + """The number of data points used for the threshold suggestion calculation.""" + + last_updated: Optional[datetime] = None + + p50: Optional[int] = None + """The p50 quantile of requests (in period_seconds).""" + + p90: Optional[int] = None + """The p90 quantile of requests (in period_seconds).""" + + p99: Optional[int] = None + """The p99 quantile of requests (in period_seconds).""" + + period_seconds: Optional[int] = None + """The period over which this threshold is suggested.""" + + requests: Optional[int] = None + """The estimated number of requests covered by these calculations.""" + + suggested_threshold: Optional[int] = None + """The suggested threshold in requests done by the same auth_id or period_seconds.""" + + +class FeaturesAPIShieldOperationFeatureThresholds(BaseModel): + thresholds: Optional[FeaturesAPIShieldOperationFeatureThresholdsThresholds] = None + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas(BaseModel): + parameters: Optional[List[object]] = None + """An array containing the learned parameter schemas.""" + + responses: Optional[object] = None + """An empty response object. + + This field is required to yield a valid operation schema. + """ + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): + last_updated: Optional[datetime] = None + + parameter_schemas: Optional[ + FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas + ] = None + """An operation schema object containing a response.""" + + +class FeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): + parameter_schemas: FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas + + +class FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting(BaseModel): + last_updated: Optional[datetime] = None + + route: Optional[str] = None + """Target route.""" + + +class FeaturesAPIShieldOperationFeatureAPIRouting(BaseModel): + api_routing: Optional[FeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting] = None + """API Routing settings on endpoint.""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99( + BaseModel +): + lower: Optional[float] = None + """Lower bound for percentile estimate""" + + upper: Optional[float] = None + """Upper bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals( + BaseModel +): + p90: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90 + ] = None + """Upper and lower bound for percentile estimate""" + + p95: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95 + ] = None + """Upper and lower bound for percentile estimate""" + + p99: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99 + ] = None + """Upper and lower bound for percentile estimate""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold(BaseModel): + confidence_intervals: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals + ] = None + + mean: Optional[float] = None + """Suggested threshold.""" + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals(BaseModel): + last_updated: Optional[datetime] = None + + suggested_threshold: Optional[ + FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold + ] = None + + +class FeaturesAPIShieldOperationFeatureConfidenceIntervals(BaseModel): + confidence_intervals: Optional[FeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals] = None + + +class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema(BaseModel): + id: Optional[str] = None + """UUID""" + + created_at: Optional[datetime] = None + + is_learned: Optional[bool] = None + """True if schema is Cloudflare-provided.""" + + name: Optional[str] = None + """Schema file name.""" + + +class FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo(BaseModel): + active_schema: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema] = None + """Schema active on endpoint.""" + + learned_available: Optional[bool] = None + """True if a Cloudflare-provided learned schema is available for this endpoint.""" + + mitigation_action: Optional[Literal["none", "log", "block"]] = None + """Action taken on requests failing validation.""" + + +class FeaturesAPIShieldOperationFeatureSchemaInfo(BaseModel): + schema_info: Optional[FeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo] = None + + +Features = Union[ + FeaturesAPIShieldOperationFeatureThresholds, + FeaturesAPIShieldOperationFeatureParameterSchemas, + FeaturesAPIShieldOperationFeatureAPIRouting, + FeaturesAPIShieldOperationFeatureConfidenceIntervals, + FeaturesAPIShieldOperationFeatureSchemaInfo, +] + + +class OperationListResponse(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + operation_id: str + """UUID""" + + features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/public_schema.py b/src/cloudflare/types/api_gateway/public_schema.py index 6dabec42f5c..bdff5f529aa 100644 --- a/src/cloudflare/types/api_gateway/public_schema.py +++ b/src/cloudflare/types/api_gateway/public_schema.py @@ -19,7 +19,7 @@ class PublicSchema(BaseModel): """Name of the schema""" schema_id: str - """UUID identifier""" + """UUID""" source: Optional[str] = None """Source of the schema""" diff --git a/src/cloudflare/types/api_gateway/user_schema_delete_response.py b/src/cloudflare/types/api_gateway/user_schema_delete_response.py index 5a901e1de91..88f23ea6482 100644 --- a/src/cloudflare/types/api_gateway/user_schema_delete_response.py +++ b/src/cloudflare/types/api_gateway/user_schema_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union __all__ = ["UserSchemaDeleteResponse"] -UserSchemaDeleteResponse = Union[Optional[str], Optional[object]] +UserSchemaDeleteResponse = Union[str, object] diff --git a/src/cloudflare/types/api_gateway/user_schema_list_params.py b/src/cloudflare/types/api_gateway/user_schema_list_params.py index a46fd077690..faca68fa945 100644 --- a/src/cloudflare/types/api_gateway/user_schema_list_params.py +++ b/src/cloudflare/types/api_gateway/user_schema_list_params.py @@ -14,10 +14,10 @@ class UserSchemaListParams(TypedDict, total=False): omit_source: bool """Omit the source-files of schemas and only retrieve their meta-data.""" - page: object + page: int """Page number of paginated results.""" - per_page: object + per_page: int """Maximum number of results per page.""" validation_enabled: bool diff --git a/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py b/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py index 8e6eaebd97b..64cb5bdccae 100644 --- a/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py +++ b/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py @@ -37,8 +37,8 @@ class OperationListParams(TypedDict, total=False): schema that already exist in API Shield Endpoint Management. """ - page: object + page: int """Page number of paginated results.""" - per_page: object + per_page: int """Maximum number of results per page.""" diff --git a/tests/api_resources/api_gateway/discovery/test_operations.py b/tests/api_resources/api_gateway/discovery/test_operations.py index f88028bff92..b08333fa51c 100644 --- a/tests/api_resources/api_gateway/discovery/test_operations.py +++ b/tests/api_resources/api_gateway/discovery/test_operations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.api_gateway import DiscoveryOperation from cloudflare.types.api_gateway.discovery import OperationEditResponse @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: operation = client.api_gateway.discovery.operations.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -37,11 +37,11 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: method=["GET"], order="method", origin="ML", - page={}, - per_page={}, + page=1, + per_page=5, state="review", ) - assert_matches_type(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -52,7 +52,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(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -63,7 +63,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(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,7 +77,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_edit(self, client: Cloudflare) -> None: operation = client.api_gateway.discovery.operations.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(OperationEditResponse, operation, path=["response"]) @@ -85,7 +85,7 @@ def test_method_edit(self, client: Cloudflare) -> None: @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: operation = client.api_gateway.discovery.operations.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", state="review", ) @@ -94,7 +94,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.api_gateway.discovery.operations.with_raw_response.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -106,7 +106,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.api_gateway.discovery.operations.with_streaming_response.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -121,7 +121,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.api_gateway.discovery.operations.with_raw_response.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="", ) @@ -140,7 +140,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(AsyncSinglePage[DiscoveryOperation], 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: @@ -153,11 +153,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) method=["GET"], order="method", origin="ML", - page={}, - per_page={}, + page=1, + per_page=5, state="review", ) - assert_matches_type(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -168,7 +168,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(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -179,7 +179,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(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[DiscoveryOperation], operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -193,7 +193,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: operation = await async_client.api_gateway.discovery.operations.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(OperationEditResponse, operation, path=["response"]) @@ -201,7 +201,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: operation = await async_client.api_gateway.discovery.operations.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", state="review", ) @@ -210,7 +210,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.api_gateway.discovery.operations.with_raw_response.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -222,7 +222,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: async with async_client.api_gateway.discovery.operations.with_streaming_response.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -237,7 +237,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.api_gateway.discovery.operations.with_raw_response.edit( - operation_id="0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="", ) diff --git a/tests/api_resources/api_gateway/test_configurations.py b/tests/api_resources/api_gateway/test_configurations.py index 675123bd057..13bdbc85420 100644 --- a/tests/api_resources/api_gateway/test_configurations.py +++ b/tests/api_resources/api_gateway/test_configurations.py @@ -22,13 +22,6 @@ class TestConfigurations: @parametrize def test_method_update(self, client: Cloudflare) -> None: - configuration = client.api_gateway.configurations.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: configuration = client.api_gateway.configurations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", auth_id_characteristics=[ @@ -44,6 +37,12 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.api_gateway.configurations.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], ) assert response.is_closed is True @@ -55,6 +54,12 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.api_gateway.configurations.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,6 +74,12 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.api_gateway.configurations.with_raw_response.update( zone_id="", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], ) @parametrize @@ -123,13 +134,6 @@ class TestAsyncConfigurations: @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - configuration = await async_client.api_gateway.configurations.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.api_gateway.configurations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", auth_id_characteristics=[ @@ -145,6 +149,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.api_gateway.configurations.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], ) assert response.is_closed is True @@ -156,6 +166,12 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.api_gateway.configurations.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -170,6 +186,12 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.api_gateway.configurations.with_raw_response.update( zone_id="", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], ) @parametrize diff --git a/tests/api_resources/api_gateway/test_operations.py b/tests/api_resources/api_gateway/test_operations.py index e6b994c1ebb..2e4570286b5 100644 --- a/tests/api_resources/api_gateway/test_operations.py +++ b/tests/api_resources/api_gateway/test_operations.py @@ -3,15 +3,16 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.api_gateway import ( - APIShield, + OperationGetResponse, + OperationListResponse, OperationCreateResponse, OperationDeleteResponse, ) @@ -44,7 +45,7 @@ def test_method_create(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + assert_matches_type(OperationCreateResponse, operation, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -72,7 +73,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" operation = response.parse() - assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + assert_matches_type(OperationCreateResponse, operation, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -100,7 +101,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = response.parse() - assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + assert_matches_type(OperationCreateResponse, operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -133,7 +134,7 @@ def test_method_list(self, client: Cloudflare) -> None: operation = client.api_gateway.operations.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -145,10 +146,10 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: host=["api.cloudflare.com"], method=["GET"], order="method", - page={}, + page=1, per_page=5, ) - assert_matches_type(SyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -159,7 +160,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(SyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -170,7 +171,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(SyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -235,7 +236,7 @@ def test_method_get(self, client: Cloudflare) -> None: operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -244,7 +245,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", feature=["thresholds"], ) - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -256,7 +257,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" operation = response.parse() - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -268,7 +269,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = response.parse() - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -312,7 +313,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + assert_matches_type(OperationCreateResponse, operation, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -340,7 +341,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" operation = await response.parse() - assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + assert_matches_type(OperationCreateResponse, operation, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -368,7 +369,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = await response.parse() - assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + assert_matches_type(OperationCreateResponse, operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -401,7 +402,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: operation = await async_client.api_gateway.operations.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -413,10 +414,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) host=["api.cloudflare.com"], method=["GET"], order="method", - page={}, + page=1, per_page=5, ) - assert_matches_type(AsyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -427,7 +428,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(AsyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -438,7 +439,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(AsyncSinglePage[APIShield], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -503,7 +504,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: operation_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -512,7 +513,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - zone_id="023e105f4ecef8ad9ca31a8372d0c353", feature=["thresholds"], ) - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -524,7 +525,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" operation = await response.parse() - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -536,7 +537,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" operation = await response.parse() - assert_matches_type(APIShield, operation, path=["response"]) + assert_matches_type(OperationGetResponse, operation, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/api_gateway/test_user_schemas.py b/tests/api_resources/api_gateway/test_user_schemas.py index e4b1af33b96..287bc62373d 100644 --- a/tests/api_resources/api_gateway/test_user_schemas.py +++ b/tests/api_resources/api_gateway/test_user_schemas.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.api_gateway import ( PublicSchema, SchemaUpload, @@ -84,18 +84,18 @@ def test_method_list(self, client: Cloudflare) -> None: user_schema = client.api_gateway.user_schemas.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: user_schema = client.api_gateway.user_schemas.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", omit_source=True, - page={}, - per_page={}, + page=1, + per_page=5, validation_enabled=True, ) - assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -106,7 +106,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" user_schema = response.parse() - assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -117,7 +117,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_schema = response.parse() - assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) assert cast(Any, response.is_closed) is True @@ -134,7 +134,7 @@ def test_method_delete(self, client: Cloudflare) -> None: schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + assert_matches_type(Optional[UserSchemaDeleteResponse], user_schema, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -146,7 +146,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" user_schema = response.parse() - assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + assert_matches_type(Optional[UserSchemaDeleteResponse], user_schema, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -158,7 +158,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_schema = response.parse() - assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + assert_matches_type(Optional[UserSchemaDeleteResponse], user_schema, path=["response"]) assert cast(Any, response.is_closed) is True @@ -356,18 +356,18 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: user_schema = await async_client.api_gateway.user_schemas.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: user_schema = await async_client.api_gateway.user_schemas.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", omit_source=True, - page={}, - per_page={}, + page=1, + per_page=5, validation_enabled=True, ) - assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -378,7 +378,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" user_schema = await response.parse() - assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -389,7 +389,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_schema = await response.parse() - assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[PublicSchema], user_schema, path=["response"]) assert cast(Any, response.is_closed) is True @@ -406,7 +406,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + assert_matches_type(Optional[UserSchemaDeleteResponse], user_schema, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -418,7 +418,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" user_schema = await response.parse() - assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + assert_matches_type(Optional[UserSchemaDeleteResponse], user_schema, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -430,7 +430,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" user_schema = await response.parse() - assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + assert_matches_type(Optional[UserSchemaDeleteResponse], user_schema, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/api_gateway/user_schemas/test_operations.py b/tests/api_resources/api_gateway/user_schemas/test_operations.py index a613b248c2a..64234507893 100644 --- a/tests/api_resources/api_gateway/user_schemas/test_operations.py +++ b/tests/api_resources/api_gateway/user_schemas/test_operations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.api_gateway.user_schemas import OperationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -36,10 +36,10 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: host=["api.cloudflare.com"], method=["GET"], operation_status="new", - page={}, - per_page={}, + page=1, + per_page=5, ) - assert_matches_type(SyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -51,7 +51,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(SyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -63,7 +63,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(SyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -91,7 +91,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -103,10 +103,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) host=["api.cloudflare.com"], method=["GET"], operation_status="new", - page={}, - per_page={}, + page=1, + per_page=5, ) - assert_matches_type(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -118,7 +118,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(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -130,7 +130,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(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[OperationListResponse], operation, path=["response"]) assert cast(Any, response.is_closed) is True