diff --git a/api.md b/api.md index 4970e2cf8d0..694893c6b7b 100644 --- a/api.md +++ b/api.md @@ -1994,7 +1994,7 @@ Methods: - client.healthchecks.create(\*, zone_id, \*\*params) -> Healthcheck - client.healthchecks.update(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck -- client.healthchecks.list(\*, zone_id) -> SyncSinglePage[Healthcheck] +- client.healthchecks.list(\*, zone_id, \*\*params) -> SyncSinglePage[Healthcheck] - client.healthchecks.delete(healthcheck_id, \*, zone_id, \*\*params) -> HealthcheckDeleteResponse - client.healthchecks.edit(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck - client.healthchecks.get(healthcheck_id, \*, zone_id) -> Healthcheck diff --git a/src/cloudflare/resources/healthchecks/healthchecks.py b/src/cloudflare/resources/healthchecks/healthchecks.py index e563f71073d..c57df5656cd 100644 --- a/src/cloudflare/resources/healthchecks/healthchecks.py +++ b/src/cloudflare/resources/healthchecks/healthchecks.py @@ -40,6 +40,7 @@ HTTPConfigurationParam, HealthcheckDeleteResponse, healthcheck_edit_params, + healthcheck_list_params, healthcheck_create_params, healthcheck_delete_params, healthcheck_update_params, @@ -278,6 +279,8 @@ def list( self, *, zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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, @@ -291,6 +294,10 @@ def list( Args: zone_id: Identifier + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -305,7 +312,17 @@ def list( f"/zones/{zone_id}/healthchecks", page=SyncSinglePage[Healthcheck], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + healthcheck_list_params.HealthcheckListParams, + ), ), model=Healthcheck, ) @@ -740,6 +757,8 @@ def list( self, *, zone_id: str, + page: object | NotGiven = NOT_GIVEN, + per_page: object | 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, @@ -753,6 +772,10 @@ def list( Args: zone_id: Identifier + page: Page number of paginated results. + + per_page: Maximum number of results per page. Must be a multiple of 5. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -767,7 +790,17 @@ def list( f"/zones/{zone_id}/healthchecks", page=AsyncSinglePage[Healthcheck], 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, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + healthcheck_list_params.HealthcheckListParams, + ), ), model=Healthcheck, ) diff --git a/src/cloudflare/types/healthchecks/__init__.py b/src/cloudflare/types/healthchecks/__init__.py index e815a8bb9f7..c40061ff8bb 100644 --- a/src/cloudflare/types/healthchecks/__init__.py +++ b/src/cloudflare/types/healthchecks/__init__.py @@ -9,6 +9,7 @@ from .preview_create_params import PreviewCreateParams as PreviewCreateParams from .preview_delete_params import PreviewDeleteParams as PreviewDeleteParams from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams +from .healthcheck_list_params import HealthcheckListParams as HealthcheckListParams from .preview_delete_response import PreviewDeleteResponse as PreviewDeleteResponse from .tcp_configuration_param import TCPConfigurationParam as TCPConfigurationParam from .http_configuration_param import HTTPConfigurationParam as HTTPConfigurationParam diff --git a/src/cloudflare/types/healthchecks/healthcheck_list_params.py b/src/cloudflare/types/healthchecks/healthcheck_list_params.py new file mode 100644 index 00000000000..a2d33808065 --- /dev/null +++ b/src/cloudflare/types/healthchecks/healthcheck_list_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["HealthcheckListParams"] + + +class HealthcheckListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page. Must be a multiple of 5.""" diff --git a/tests/api_resources/test_healthchecks.py b/tests/api_resources/test_healthchecks.py index 48d0902ff92..9103f49468f 100644 --- a/tests/api_resources/test_healthchecks.py +++ b/tests/api_resources/test_healthchecks.py @@ -214,6 +214,16 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + healthcheck = client.healthchecks.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -653,6 +663,16 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + healthcheck = await async_client.healthchecks.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) + @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: