diff --git a/.stats.yml b/.stats.yml index fbcd944afc9..35ba8798674 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1321 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-15ceeb11cd4134501a557652ceaeacda4b60ea635ea5ac2e0d06974b130cc60a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1f68e176f43592631364d94df7670824a599296f6734ca70ffa94454c58da466.yml diff --git a/api.md b/api.md index ba42f34eec6..8d42917a9ec 100644 --- a/api.md +++ b/api.md @@ -6031,16 +6031,17 @@ from cloudflare.types.zero_trust.gateway import ( GatewayIPs, ProxyEndpoint, ProxyEndpointDeleteResponse, + ProxyEndpointGetResponse, ) ``` Methods: - client.zero_trust.gateway.proxy_endpoints.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> SyncSinglePage[ProxyEndpoint] +- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> Optional - client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id) -> Optional - client.zero_trust.gateway.proxy_endpoints.edit(proxy_endpoint_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> Optional +- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> Optional ### Rules diff --git a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py index c1b0d3b653f..6ff679a7bc6 100644 --- a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py +++ b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py @@ -20,14 +20,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( - AsyncPaginator, make_request_options, ) from ....types.zero_trust.gateway import proxy_endpoint_edit_params, proxy_endpoint_create_params from ....types.zero_trust.gateway.gateway_ips import GatewayIPs from ....types.zero_trust.gateway.proxy_endpoint import ProxyEndpoint +from ....types.zero_trust.gateway.proxy_endpoint_get_response import ProxyEndpointGetResponse from ....types.zero_trust.gateway.proxy_endpoint_delete_response import ProxyEndpointDeleteResponse __all__ = ["ProxyEndpointsResource", "AsyncProxyEndpointsResource"] @@ -102,9 +101,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ProxyEndpoint]: + ) -> Optional[ProxyEndpoint]: """ - Fetches a single Zero Trust Gateway proxy endpoint. + Fetches all Zero Trust Gateway proxy endpoints for an account. Args: extra_headers: Send extra headers @@ -117,13 +116,16 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get_api_list( + return self._get( f"/accounts/{account_id}/gateway/proxy_endpoints", - page=SyncSinglePage[ProxyEndpoint], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - model=ProxyEndpoint, + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) def delete( @@ -235,9 +237,9 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyEndpoint]: + ) -> Optional[ProxyEndpointGetResponse]: """ - Fetches all Zero Trust Gateway proxy endpoints for an account. + Fetches a single Zero Trust Gateway proxy endpoint. Args: extra_headers: Send extra headers @@ -259,9 +261,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpointGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), + cast_to=cast(Type[Optional[ProxyEndpointGetResponse]], ResultWrapper[ProxyEndpointGetResponse]), ) @@ -324,7 +326,7 @@ async def create( cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) - def list( + async def list( self, *, account_id: str, @@ -334,9 +336,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ProxyEndpoint, AsyncSinglePage[ProxyEndpoint]]: + ) -> Optional[ProxyEndpoint]: """ - Fetches a single Zero Trust Gateway proxy endpoint. + Fetches all Zero Trust Gateway proxy endpoints for an account. Args: extra_headers: Send extra headers @@ -349,13 +351,16 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get_api_list( + return await self._get( f"/accounts/{account_id}/gateway/proxy_endpoints", - page=AsyncSinglePage[ProxyEndpoint], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - model=ProxyEndpoint, + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) async def delete( @@ -467,9 +472,9 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyEndpoint]: + ) -> Optional[ProxyEndpointGetResponse]: """ - Fetches all Zero Trust Gateway proxy endpoints for an account. + Fetches a single Zero Trust Gateway proxy endpoint. Args: extra_headers: Send extra headers @@ -491,9 +496,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpointGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), + cast_to=cast(Type[Optional[ProxyEndpointGetResponse]], ResultWrapper[ProxyEndpointGetResponse]), ) diff --git a/src/cloudflare/types/zero_trust/gateway/__init__.py b/src/cloudflare/types/zero_trust/gateway/__init__.py index b8627d5f6fc..c3abd0c2212 100644 --- a/src/cloudflare/types/zero_trust/gateway/__init__.py +++ b/src/cloudflare/types/zero_trust/gateway/__init__.py @@ -57,6 +57,7 @@ from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams from .custom_certificate_settings import CustomCertificateSettings as CustomCertificateSettings from .notification_settings_param import NotificationSettingsParam as NotificationSettingsParam +from .proxy_endpoint_get_response import ProxyEndpointGetResponse as ProxyEndpointGetResponse from .body_scanning_settings_param import BodyScanningSettingsParam as BodyScanningSettingsParam from .proxy_endpoint_create_params import ProxyEndpointCreateParams as ProxyEndpointCreateParams from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_get_response.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_get_response.py new file mode 100644 index 00000000000..225dd8730e2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_get_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .proxy_endpoint import ProxyEndpoint + +__all__ = ["ProxyEndpointGetResponse"] + +ProxyEndpointGetResponse = List[ProxyEndpoint] diff --git a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py index d46c4b8884e..2d5b505ed3c 100644 --- a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py +++ b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway import ( ProxyEndpoint, + ProxyEndpointGetResponse, ProxyEndpointDeleteResponse, ) @@ -72,7 +72,7 @@ def test_method_list(self, client: Cloudflare) -> None: proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -83,7 +83,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" proxy_endpoint = response.parse() - assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -94,7 +94,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -217,7 +217,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -229,7 +229,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" proxy_endpoint = response.parse() - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -241,7 +241,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -314,7 +314,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: proxy_endpoint = await async_client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -325,7 +325,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" proxy_endpoint = await response.parse() - assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -336,7 +336,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -459,7 +459,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -471,7 +471,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" proxy_endpoint = await response.parse() - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -483,7 +483,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True