From bef513fbe9c99abc3fcac9bae5661bdaca516493 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:20:52 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#296) --- api.md | 4 +- .../resources/waiting_rooms/events/events.py | 37 ++++++++++++++++++- .../resources/waiting_rooms/waiting_rooms.py | 37 ++++++++++++++++++- src/cloudflare/types/__init__.py | 1 + .../types/waiting_room_list_params.py | 18 +++++++++ .../types/waiting_rooms/__init__.py | 1 + .../types/waiting_rooms/event_list_params.py | 18 +++++++++ tests/api_resources/test_waiting_rooms.py | 20 ++++++++++ .../waiting_rooms/test_events.py | 22 +++++++++++ 9 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 src/cloudflare/types/waiting_room_list_params.py create mode 100644 src/cloudflare/types/waiting_rooms/event_list_params.py diff --git a/api.md b/api.md index 0b7174c7b49..ce47a59b65e 100644 --- a/api.md +++ b/api.md @@ -2448,7 +2448,7 @@ Methods: - client.waiting_rooms.create(\*, zone_id, \*\*params) -> WaitingRoom - client.waiting_rooms.update(waiting_room_id, \*, zone_id, \*\*params) -> WaitingRoom -- client.waiting_rooms.list(\*, zone_id) -> SyncSinglePage[WaitingRoom] +- client.waiting_rooms.list(\*, zone_id, \*\*params) -> SyncSinglePage[WaitingRoom] - client.waiting_rooms.delete(waiting_room_id, \*, zone_id, \*\*params) -> WaitingRoomDeleteResponse - client.waiting_rooms.edit(waiting_room_id, \*, zone_id, \*\*params) -> WaitingRoom - client.waiting_rooms.get(waiting_room_id, \*, zone_id) -> WaitingRoom @@ -2477,7 +2477,7 @@ Methods: - client.waiting_rooms.events.create(waiting_room_id, \*, zone_id, \*\*params) -> Event - client.waiting_rooms.events.update(event_id, \*, zone_id, waiting_room_id, \*\*params) -> Event -- client.waiting_rooms.events.list(waiting_room_id, \*, zone_id) -> SyncSinglePage[Event] +- client.waiting_rooms.events.list(waiting_room_id, \*, zone_id, \*\*params) -> SyncSinglePage[Event] - client.waiting_rooms.events.delete(event_id, \*, zone_id, waiting_room_id, \*\*params) -> EventDeleteResponse - client.waiting_rooms.events.edit(event_id, \*, zone_id, waiting_room_id, \*\*params) -> Event - client.waiting_rooms.events.get(event_id, \*, zone_id, waiting_room_id) -> Event diff --git a/src/cloudflare/resources/waiting_rooms/events/events.py b/src/cloudflare/resources/waiting_rooms/events/events.py index 28a144b780c..4d9f62ab2d4 100644 --- a/src/cloudflare/resources/waiting_rooms/events/events.py +++ b/src/cloudflare/resources/waiting_rooms/events/events.py @@ -37,6 +37,7 @@ Event, EventDeleteResponse, event_edit_params, + event_list_params, event_create_params, event_delete_params, event_update_params, @@ -308,6 +309,8 @@ def list( waiting_room_id: str, *, 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, @@ -321,6 +324,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 @@ -337,7 +344,17 @@ def list( f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events", page=SyncSinglePage[Event], 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, + }, + event_list_params.EventListParams, + ), ), model=Event, ) @@ -819,6 +836,8 @@ def list( waiting_room_id: str, *, 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, @@ -832,6 +851,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 @@ -848,7 +871,17 @@ def list( f"/zones/{zone_id}/waiting_rooms/{waiting_room_id}/events", page=AsyncSinglePage[Event], 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, + }, + event_list_params.EventListParams, + ), ), model=Event, ) diff --git a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py index 5c6ecff5ade..6eaa5f2a4a7 100644 --- a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py +++ b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py @@ -37,6 +37,7 @@ CookieAttributesParam, WaitingRoomDeleteResponse, waiting_room_edit_params, + waiting_room_list_params, waiting_room_create_params, waiting_room_delete_params, waiting_room_update_params, @@ -827,6 +828,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, @@ -840,6 +843,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 @@ -854,7 +861,17 @@ def list( f"/zones/{zone_id}/waiting_rooms", page=SyncSinglePage[WaitingRoom], 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, + }, + waiting_room_list_params.WaitingRoomListParams, + ), ), model=WaitingRoom, ) @@ -2050,6 +2067,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, @@ -2063,6 +2082,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 @@ -2077,7 +2100,17 @@ def list( f"/zones/{zone_id}/waiting_rooms", page=AsyncSinglePage[WaitingRoom], 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, + }, + waiting_room_list_params.WaitingRoomListParams, + ), ), model=WaitingRoom, ) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 383fb401c4e..3842e635ec8 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -200,6 +200,7 @@ from .rate_limit_edit_response import RateLimitEditResponse as RateLimitEditResponse from .speed_trends_list_params import SpeedTrendsListParams as SpeedTrendsListParams from .waiting_room_edit_params import WaitingRoomEditParams as WaitingRoomEditParams +from .waiting_room_list_params import WaitingRoomListParams as WaitingRoomListParams from .healthcheck_create_params import HealthcheckCreateParams as HealthcheckCreateParams from .healthcheck_delete_params import HealthcheckDeleteParams as HealthcheckDeleteParams from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams diff --git a/src/cloudflare/types/waiting_room_list_params.py b/src/cloudflare/types/waiting_room_list_params.py new file mode 100644 index 00000000000..d601612834c --- /dev/null +++ b/src/cloudflare/types/waiting_room_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__ = ["WaitingRoomListParams"] + + +class WaitingRoomListParams(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/src/cloudflare/types/waiting_rooms/__init__.py b/src/cloudflare/types/waiting_rooms/__init__.py index 08e31f76c0f..0ada620a2af 100644 --- a/src/cloudflare/types/waiting_rooms/__init__.py +++ b/src/cloudflare/types/waiting_rooms/__init__.py @@ -6,6 +6,7 @@ from .setting import Setting as Setting from .rule_edit_params import RuleEditParams as RuleEditParams from .event_edit_params import EventEditParams as EventEditParams +from .event_list_params import EventListParams as EventListParams from .waiting_room_rule import WaitingRoomRule as WaitingRoomRule from .rule_create_params import RuleCreateParams as RuleCreateParams from .rule_delete_params import RuleDeleteParams as RuleDeleteParams diff --git a/src/cloudflare/types/waiting_rooms/event_list_params.py b/src/cloudflare/types/waiting_rooms/event_list_params.py new file mode 100644 index 00000000000..99ae24766eb --- /dev/null +++ b/src/cloudflare/types/waiting_rooms/event_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__ = ["EventListParams"] + + +class EventListParams(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_waiting_rooms.py b/tests/api_resources/test_waiting_rooms.py index a6e9db38ca5..5ad93c23167 100644 --- a/tests/api_resources/test_waiting_rooms.py +++ b/tests/api_resources/test_waiting_rooms.py @@ -244,6 +244,16 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + waiting_room = client.waiting_rooms.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) + @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -729,6 +739,16 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + waiting_room = await async_client.waiting_rooms.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) + @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: diff --git a/tests/api_resources/waiting_rooms/test_events.py b/tests/api_resources/waiting_rooms/test_events.py index 1226bd78135..ef7836c59d5 100644 --- a/tests/api_resources/waiting_rooms/test_events.py +++ b/tests/api_resources/waiting_rooms/test_events.py @@ -224,6 +224,17 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(SyncSinglePage[Event], event, path=["response"]) + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + event = client.waiting_rooms.events.list( + "699d98642c564d2e855e9661899b7252", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(SyncSinglePage[Event], event, path=["response"]) + @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -713,6 +724,17 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(AsyncSinglePage[Event], event, path=["response"]) + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + event = await async_client.waiting_rooms.events.list( + "699d98642c564d2e855e9661899b7252", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + page={}, + per_page={}, + ) + assert_matches_type(AsyncSinglePage[Event], event, path=["response"]) + @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: