Skip to content

Commit 1dffe01

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#746)
1 parent dfa69f4 commit 1dffe01

File tree

6 files changed

+55
-39
lines changed

6 files changed

+55
-39
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1321
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-15ceeb11cd4134501a557652ceaeacda4b60ea635ea5ac2e0d06974b130cc60a.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1f68e176f43592631364d94df7670824a599296f6734ca70ffa94454c58da466.yml

api.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -6031,16 +6031,17 @@ from cloudflare.types.zero_trust.gateway import (
60316031
GatewayIPs,
60326032
ProxyEndpoint,
60336033
ProxyEndpointDeleteResponse,
6034+
ProxyEndpointGetResponse,
60346035
)
60356036
```
60366037

60376038
Methods:
60386039

60396040
- <code title="post /accounts/{account_id}/gateway/proxy_endpoints">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/proxy_endpoint_create_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py">Optional</a></code>
6040-
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py">SyncSinglePage[ProxyEndpoint]</a></code>
6041+
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py">Optional</a></code>
60416042
- <code title="delete /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">delete</a>(proxy_endpoint_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint_delete_response.py">Optional</a></code>
60426043
- <code title="patch /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">edit</a>(proxy_endpoint_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/proxy_endpoint_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py">Optional</a></code>
6043-
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">get</a>(proxy_endpoint_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint.py">Optional</a></code>
6044+
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.zero_trust.gateway.proxy_endpoints.<a href="./src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py">get</a>(proxy_endpoint_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/proxy_endpoint_get_response.py">Optional</a></code>
60446045

60456046
### Rules
60466047

src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py

+28-23
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
async_to_streamed_response_wrapper,
2121
)
2222
from ...._wrappers import ResultWrapper
23-
from ....pagination import SyncSinglePage, AsyncSinglePage
2423
from ...._base_client import (
25-
AsyncPaginator,
2624
make_request_options,
2725
)
2826
from ....types.zero_trust.gateway import proxy_endpoint_edit_params, proxy_endpoint_create_params
2927
from ....types.zero_trust.gateway.gateway_ips import GatewayIPs
3028
from ....types.zero_trust.gateway.proxy_endpoint import ProxyEndpoint
29+
from ....types.zero_trust.gateway.proxy_endpoint_get_response import ProxyEndpointGetResponse
3130
from ....types.zero_trust.gateway.proxy_endpoint_delete_response import ProxyEndpointDeleteResponse
3231

3332
__all__ = ["ProxyEndpointsResource", "AsyncProxyEndpointsResource"]
@@ -102,9 +101,9 @@ def list(
102101
extra_query: Query | None = None,
103102
extra_body: Body | None = None,
104103
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
105-
) -> SyncSinglePage[ProxyEndpoint]:
104+
) -> Optional[ProxyEndpoint]:
106105
"""
107-
Fetches a single Zero Trust Gateway proxy endpoint.
106+
Fetches all Zero Trust Gateway proxy endpoints for an account.
108107

109108
Args:
110109
extra_headers: Send extra headers
@@ -117,13 +116,16 @@ def list(
117116
"""
118117
if not account_id:
119118
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
120-
return self._get_api_list(
119+
return self._get(
121120
f"/accounts/{account_id}/gateway/proxy_endpoints",
122-
page=SyncSinglePage[ProxyEndpoint],
123121
options=make_request_options(
124-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
122+
extra_headers=extra_headers,
123+
extra_query=extra_query,
124+
extra_body=extra_body,
125+
timeout=timeout,
126+
post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper,
125127
),
126-
model=ProxyEndpoint,
128+
cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]),
127129
)
128130

129131
def delete(
@@ -235,9 +237,9 @@ def get(
235237
extra_query: Query | None = None,
236238
extra_body: Body | None = None,
237239
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
238-
) -> Optional[ProxyEndpoint]:
240+
) -> Optional[ProxyEndpointGetResponse]:
239241
"""
240-
Fetches all Zero Trust Gateway proxy endpoints for an account.
242+
Fetches a single Zero Trust Gateway proxy endpoint.
241243

242244
Args:
243245
extra_headers: Send extra headers
@@ -259,9 +261,9 @@ def get(
259261
extra_query=extra_query,
260262
extra_body=extra_body,
261263
timeout=timeout,
262-
post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper,
264+
post_parser=ResultWrapper[Optional[ProxyEndpointGetResponse]]._unwrapper,
263265
),
264-
cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]),
266+
cast_to=cast(Type[Optional[ProxyEndpointGetResponse]], ResultWrapper[ProxyEndpointGetResponse]),
265267
)
266268

267269

@@ -324,7 +326,7 @@ async def create(
324326
cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]),
325327
)
326328

327-
def list(
329+
async def list(
328330
self,
329331
*,
330332
account_id: str,
@@ -334,9 +336,9 @@ def list(
334336
extra_query: Query | None = None,
335337
extra_body: Body | None = None,
336338
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
337-
) -> AsyncPaginator[ProxyEndpoint, AsyncSinglePage[ProxyEndpoint]]:
339+
) -> Optional[ProxyEndpoint]:
338340
"""
339-
Fetches a single Zero Trust Gateway proxy endpoint.
341+
Fetches all Zero Trust Gateway proxy endpoints for an account.
340342

341343
Args:
342344
extra_headers: Send extra headers
@@ -349,13 +351,16 @@ def list(
349351
"""
350352
if not account_id:
351353
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
352-
return self._get_api_list(
354+
return await self._get(
353355
f"/accounts/{account_id}/gateway/proxy_endpoints",
354-
page=AsyncSinglePage[ProxyEndpoint],
355356
options=make_request_options(
356-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
357+
extra_headers=extra_headers,
358+
extra_query=extra_query,
359+
extra_body=extra_body,
360+
timeout=timeout,
361+
post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper,
357362
),
358-
model=ProxyEndpoint,
363+
cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]),
359364
)
360365

361366
async def delete(
@@ -467,9 +472,9 @@ async def get(
467472
extra_query: Query | None = None,
468473
extra_body: Body | None = None,
469474
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
470-
) -> Optional[ProxyEndpoint]:
475+
) -> Optional[ProxyEndpointGetResponse]:
471476
"""
472-
Fetches all Zero Trust Gateway proxy endpoints for an account.
477+
Fetches a single Zero Trust Gateway proxy endpoint.
473478

474479
Args:
475480
extra_headers: Send extra headers
@@ -491,9 +496,9 @@ async def get(
491496
extra_query=extra_query,
492497
extra_body=extra_body,
493498
timeout=timeout,
494-
post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper,
499+
post_parser=ResultWrapper[Optional[ProxyEndpointGetResponse]]._unwrapper,
495500
),
496-
cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]),
501+
cast_to=cast(Type[Optional[ProxyEndpointGetResponse]], ResultWrapper[ProxyEndpointGetResponse]),
497502
)
498503

499504

src/cloudflare/types/zero_trust/gateway/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams
5858
from .custom_certificate_settings import CustomCertificateSettings as CustomCertificateSettings
5959
from .notification_settings_param import NotificationSettingsParam as NotificationSettingsParam
60+
from .proxy_endpoint_get_response import ProxyEndpointGetResponse as ProxyEndpointGetResponse
6061
from .body_scanning_settings_param import BodyScanningSettingsParam as BodyScanningSettingsParam
6162
from .proxy_endpoint_create_params import ProxyEndpointCreateParams as ProxyEndpointCreateParams
6263
from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from .proxy_endpoint import ProxyEndpoint
6+
7+
__all__ = ["ProxyEndpointGetResponse"]
8+
9+
ProxyEndpointGetResponse = List[ProxyEndpoint]

tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
from cloudflare import Cloudflare, AsyncCloudflare
1111
from tests.utils import assert_matches_type
12-
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
1312
from cloudflare.types.zero_trust.gateway import (
1413
ProxyEndpoint,
14+
ProxyEndpointGetResponse,
1515
ProxyEndpointDeleteResponse,
1616
)
1717

@@ -72,7 +72,7 @@ def test_method_list(self, client: Cloudflare) -> None:
7272
proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.list(
7373
account_id="699d98642c564d2e855e9661899b7252",
7474
)
75-
assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"])
75+
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
7676

7777
@parametrize
7878
def test_raw_response_list(self, client: Cloudflare) -> None:
@@ -83,7 +83,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
8383
assert response.is_closed is True
8484
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
8585
proxy_endpoint = response.parse()
86-
assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"])
86+
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
8787

8888
@parametrize
8989
def test_streaming_response_list(self, client: Cloudflare) -> None:
@@ -94,7 +94,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
9494
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
9595

9696
proxy_endpoint = response.parse()
97-
assert_matches_type(SyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"])
97+
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
9898

9999
assert cast(Any, response.is_closed) is True
100100

@@ -217,7 +217,7 @@ def test_method_get(self, client: Cloudflare) -> None:
217217
"ed35569b41ce4d1facfe683550f54086",
218218
account_id="699d98642c564d2e855e9661899b7252",
219219
)
220-
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
220+
assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"])
221221

222222
@parametrize
223223
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -229,7 +229,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
229229
assert response.is_closed is True
230230
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
231231
proxy_endpoint = response.parse()
232-
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
232+
assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"])
233233

234234
@parametrize
235235
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -241,7 +241,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
241241
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
242242

243243
proxy_endpoint = response.parse()
244-
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
244+
assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"])
245245

246246
assert cast(Any, response.is_closed) is True
247247

@@ -314,7 +314,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
314314
proxy_endpoint = await async_client.zero_trust.gateway.proxy_endpoints.list(
315315
account_id="699d98642c564d2e855e9661899b7252",
316316
)
317-
assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"])
317+
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
318318

319319
@parametrize
320320
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:
325325
assert response.is_closed is True
326326
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
327327
proxy_endpoint = await response.parse()
328-
assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"])
328+
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
329329

330330
@parametrize
331331
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
336336
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
337337

338338
proxy_endpoint = await response.parse()
339-
assert_matches_type(AsyncSinglePage[ProxyEndpoint], proxy_endpoint, path=["response"])
339+
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
340340

341341
assert cast(Any, response.is_closed) is True
342342

@@ -459,7 +459,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
459459
"ed35569b41ce4d1facfe683550f54086",
460460
account_id="699d98642c564d2e855e9661899b7252",
461461
)
462-
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
462+
assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"])
463463

464464
@parametrize
465465
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:
471471
assert response.is_closed is True
472472
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
473473
proxy_endpoint = await response.parse()
474-
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
474+
assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"])
475475

476476
@parametrize
477477
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
483483
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
484484

485485
proxy_endpoint = await response.parse()
486-
assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"])
486+
assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"])
487487

488488
assert cast(Any, response.is_closed) is True
489489

0 commit comments

Comments
 (0)