From 683552a810b1619f4de9c27dcea155e772347b95 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:37:07 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#200) --- .stats.yml | 2 +- api.md | 84 +- src/cloudflare/_client.py | 8 - src/cloudflare/resources/__init__.py | 14 - .../resources/waiting_rooms/__init__.py | 89 - .../waiting_rooms/events/__init__.py | 33 - .../resources/waiting_rooms/events/details.py | 174 -- .../resources/waiting_rooms/events/events.py | 1174 ------- .../resources/waiting_rooms/page.py | 282 -- .../resources/waiting_rooms/rules.py | 682 ----- .../resources/waiting_rooms/settings.py | 382 --- .../resources/waiting_rooms/statuses.py | 200 -- .../resources/waiting_rooms/waiting_rooms.py | 2696 ----------------- src/cloudflare/types/__init__.py | 5 - src/cloudflare/types/waiting_room.py | 388 --- .../types/waiting_room_create_params.py | 373 --- .../types/waiting_room_delete_response.py | 11 - .../types/waiting_room_edit_params.py | 376 --- .../types/waiting_room_update_params.py | 376 --- .../types/waiting_rooms/__init__.py | 22 - .../waiting_rooms/event_create_params.py | 94 - .../waiting_rooms/event_delete_response.py | 11 - .../types/waiting_rooms/event_edit_params.py | 96 - .../waiting_rooms/event_update_params.py | 96 - .../types/waiting_rooms/events/__init__.py | 2 - .../events/waitingroom_event_details.py | 71 - .../waiting_rooms/page_preview_params.py | 34 - .../waiting_rooms/page_preview_response.py | 12 - .../types/waiting_rooms/rule_create_params.py | 24 - .../waiting_rooms/rule_create_response.py | 9 - .../waiting_rooms/rule_delete_response.py | 9 - .../types/waiting_rooms/rule_edit_params.py | 61 - .../types/waiting_rooms/rule_edit_response.py | 9 - .../types/waiting_rooms/rule_update_params.py | 29 - .../waiting_rooms/rule_update_response.py | 9 - .../waiting_rooms/setting_edit_params.py | 16 - .../waiting_rooms/setting_edit_response.py | 14 - .../waiting_rooms/setting_get_response.py | 14 - .../waiting_rooms/setting_update_params.py | 16 - .../waiting_rooms/setting_update_response.py | 14 - .../waiting_rooms/status_get_response.py | 20 - .../types/waiting_rooms/waitingroom_event.py | 97 - .../types/waiting_rooms/waitingroom_rule.py | 31 - tests/api_resources/test_waiting_rooms.py | 978 ------ .../waiting_rooms/events/test_details.py | 150 - .../waiting_rooms/test_events.py | 984 ------ .../api_resources/waiting_rooms/test_page.py | 114 - .../api_resources/waiting_rooms/test_rules.py | 837 ----- .../waiting_rooms/test_settings.py | 314 -- .../waiting_rooms/test_statuses.py | 126 - 50 files changed, 4 insertions(+), 11658 deletions(-) delete mode 100644 src/cloudflare/resources/waiting_rooms/__init__.py delete mode 100644 src/cloudflare/resources/waiting_rooms/events/__init__.py delete mode 100644 src/cloudflare/resources/waiting_rooms/events/details.py delete mode 100644 src/cloudflare/resources/waiting_rooms/events/events.py delete mode 100644 src/cloudflare/resources/waiting_rooms/page.py delete mode 100644 src/cloudflare/resources/waiting_rooms/rules.py delete mode 100644 src/cloudflare/resources/waiting_rooms/settings.py delete mode 100644 src/cloudflare/resources/waiting_rooms/statuses.py delete mode 100644 src/cloudflare/resources/waiting_rooms/waiting_rooms.py delete mode 100644 src/cloudflare/types/waiting_room.py delete mode 100644 src/cloudflare/types/waiting_room_create_params.py delete mode 100644 src/cloudflare/types/waiting_room_delete_response.py delete mode 100644 src/cloudflare/types/waiting_room_edit_params.py delete mode 100644 src/cloudflare/types/waiting_room_update_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/event_create_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/event_delete_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/event_edit_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/event_update_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py delete mode 100644 src/cloudflare/types/waiting_rooms/page_preview_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/page_preview_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_create_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_create_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_delete_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_edit_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_edit_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_update_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/rule_update_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/setting_edit_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/setting_edit_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/setting_get_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/setting_update_params.py delete mode 100644 src/cloudflare/types/waiting_rooms/setting_update_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/status_get_response.py delete mode 100644 src/cloudflare/types/waiting_rooms/waitingroom_event.py delete mode 100644 src/cloudflare/types/waiting_rooms/waitingroom_rule.py delete mode 100644 tests/api_resources/test_waiting_rooms.py delete mode 100644 tests/api_resources/waiting_rooms/events/test_details.py delete mode 100644 tests/api_resources/waiting_rooms/test_events.py delete mode 100644 tests/api_resources/waiting_rooms/test_page.py delete mode 100644 tests/api_resources/waiting_rooms/test_rules.py delete mode 100644 tests/api_resources/waiting_rooms/test_settings.py delete mode 100644 tests/api_resources/waiting_rooms/test_statuses.py diff --git a/.stats.yml b/.stats.yml index de12921cd5a..551751d6274 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1292 +configured_endpoints: 1269 diff --git a/api.md b/api.md index 503c59f2ae6..9256a3dcbc6 100644 --- a/api.md +++ b/api.md @@ -2459,47 +2459,17 @@ Methods: Types: ```python -from cloudflare.types import WaitingRoom, WaitingRoomDeleteResponse +from cloudflare.types import WaitingRoom ``` -Methods: - -- client.waiting_rooms.create(zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.update(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.list(zone_identifier) -> SyncSinglePage[WaitingRoom] -- client.waiting_rooms.delete(waiting_room_id, \*, zone_identifier) -> WaitingRoomDeleteResponse -- client.waiting_rooms.edit(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.get(waiting_room_id, \*, zone_identifier) -> WaitingRoom - -## Page - -Types: - -```python -from cloudflare.types.waiting_rooms import PagePreviewResponse -``` - -Methods: - -- client.waiting_rooms.page.preview(zone_identifier, \*\*params) -> PagePreviewResponse - ## Events Types: ```python -from cloudflare.types.waiting_rooms import WaitingroomEvent, EventDeleteResponse +from cloudflare.types.waiting_rooms import WaitingroomEvent ``` -Methods: - -- client.waiting_rooms.events.create(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.update(event_id, \*, zone_identifier, waiting_room_id, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.list(waiting_room_id, \*, zone_identifier) -> SyncSinglePage[WaitingroomEvent] -- client.waiting_rooms.events.delete(event_id, \*, zone_identifier, waiting_room_id) -> EventDeleteResponse -- client.waiting_rooms.events.edit(event_id, \*, zone_identifier, waiting_room_id, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.get(event_id, \*, zone_identifier, waiting_room_id) -> WaitingroomEvent - ### Details Types: @@ -2508,62 +2478,14 @@ Types: from cloudflare.types.waiting_rooms.events import WaitingroomEventDetails ``` -Methods: - -- client.waiting_rooms.events.details.get(event_id, \*, zone_identifier, waiting_room_id) -> WaitingroomEventDetails - ## Rules Types: ```python -from cloudflare.types.waiting_rooms import ( - WaitingroomRule, - RuleCreateResponse, - RuleUpdateResponse, - RuleDeleteResponse, - RuleEditResponse, -) +from cloudflare.types.waiting_rooms import WaitingroomRule ``` -Methods: - -- client.waiting_rooms.rules.create(waiting_room_id, \*, zone_identifier, \*\*params) -> Optional -- client.waiting_rooms.rules.update(waiting_room_id, \*, zone_identifier, \*\*params) -> Optional -- client.waiting_rooms.rules.list(waiting_room_id, \*, zone_identifier) -> SyncSinglePage[WaitingroomRule] -- client.waiting_rooms.rules.delete(rule_id, \*, zone_identifier, waiting_room_id) -> Optional -- client.waiting_rooms.rules.edit(rule_id, \*, zone_identifier, waiting_room_id, \*\*params) -> Optional - -## Statuses - -Types: - -```python -from cloudflare.types.waiting_rooms import StatusGetResponse -``` - -Methods: - -- client.waiting_rooms.statuses.get(waiting_room_id, \*, zone_identifier) -> StatusGetResponse - -## Settings - -Types: - -```python -from cloudflare.types.waiting_rooms import ( - SettingUpdateResponse, - SettingEditResponse, - SettingGetResponse, -) -``` - -Methods: - -- client.waiting_rooms.settings.update(zone_identifier, \*\*params) -> SettingUpdateResponse -- client.waiting_rooms.settings.edit(zone_identifier, \*\*params) -> SettingEditResponse -- client.waiting_rooms.settings.get(zone_identifier) -> SettingGetResponse - # Web3 ## Hostnames diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index 8951d5319e1..3bed530aeb0 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -79,7 +79,6 @@ class Cloudflare(SyncAPIClient): pagerules: resources.Pagerules rate_limits: resources.RateLimits secondary_dns: resources.SecondaryDNS - waiting_rooms: resources.WaitingRooms web3: resources.Web3 workers: resources.Workers kv: resources.KV @@ -232,7 +231,6 @@ def __init__( self.pagerules = resources.Pagerules(self) self.rate_limits = resources.RateLimits(self) self.secondary_dns = resources.SecondaryDNS(self) - self.waiting_rooms = resources.WaitingRooms(self) self.web3 = resources.Web3(self) self.workers = resources.Workers(self) self.kv = resources.KV(self) @@ -490,7 +488,6 @@ class AsyncCloudflare(AsyncAPIClient): pagerules: resources.AsyncPagerules rate_limits: resources.AsyncRateLimits secondary_dns: resources.AsyncSecondaryDNS - waiting_rooms: resources.AsyncWaitingRooms web3: resources.AsyncWeb3 workers: resources.AsyncWorkers kv: resources.AsyncKV @@ -643,7 +640,6 @@ def __init__( self.pagerules = resources.AsyncPagerules(self) self.rate_limits = resources.AsyncRateLimits(self) self.secondary_dns = resources.AsyncSecondaryDNS(self) - self.waiting_rooms = resources.AsyncWaitingRooms(self) self.web3 = resources.AsyncWeb3(self) self.workers = resources.AsyncWorkers(self) self.kv = resources.AsyncKV(self) @@ -902,7 +898,6 @@ def __init__(self, client: Cloudflare) -> None: self.pagerules = resources.PagerulesWithRawResponse(client.pagerules) self.rate_limits = resources.RateLimitsWithRawResponse(client.rate_limits) self.secondary_dns = resources.SecondaryDNSWithRawResponse(client.secondary_dns) - self.waiting_rooms = resources.WaitingRoomsWithRawResponse(client.waiting_rooms) self.web3 = resources.Web3WithRawResponse(client.web3) self.workers = resources.WorkersWithRawResponse(client.workers) self.kv = resources.KVWithRawResponse(client.kv) @@ -990,7 +985,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.pagerules = resources.AsyncPagerulesWithRawResponse(client.pagerules) self.rate_limits = resources.AsyncRateLimitsWithRawResponse(client.rate_limits) self.secondary_dns = resources.AsyncSecondaryDNSWithRawResponse(client.secondary_dns) - self.waiting_rooms = resources.AsyncWaitingRoomsWithRawResponse(client.waiting_rooms) self.web3 = resources.AsyncWeb3WithRawResponse(client.web3) self.workers = resources.AsyncWorkersWithRawResponse(client.workers) self.kv = resources.AsyncKVWithRawResponse(client.kv) @@ -1080,7 +1074,6 @@ def __init__(self, client: Cloudflare) -> None: self.pagerules = resources.PagerulesWithStreamingResponse(client.pagerules) self.rate_limits = resources.RateLimitsWithStreamingResponse(client.rate_limits) self.secondary_dns = resources.SecondaryDNSWithStreamingResponse(client.secondary_dns) - self.waiting_rooms = resources.WaitingRoomsWithStreamingResponse(client.waiting_rooms) self.web3 = resources.Web3WithStreamingResponse(client.web3) self.workers = resources.WorkersWithStreamingResponse(client.workers) self.kv = resources.KVWithStreamingResponse(client.kv) @@ -1174,7 +1167,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.pagerules = resources.AsyncPagerulesWithStreamingResponse(client.pagerules) self.rate_limits = resources.AsyncRateLimitsWithStreamingResponse(client.rate_limits) self.secondary_dns = resources.AsyncSecondaryDNSWithStreamingResponse(client.secondary_dns) - self.waiting_rooms = resources.AsyncWaitingRoomsWithStreamingResponse(client.waiting_rooms) self.web3 = resources.AsyncWeb3WithStreamingResponse(client.web3) self.workers = resources.AsyncWorkersWithStreamingResponse(client.workers) self.kv = resources.AsyncKVWithStreamingResponse(client.kv) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 84e182ac364..0988015bfaf 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -456,14 +456,6 @@ SubscriptionsWithStreamingResponse, AsyncSubscriptionsWithStreamingResponse, ) -from .waiting_rooms import ( - WaitingRooms, - AsyncWaitingRooms, - WaitingRoomsWithRawResponse, - AsyncWaitingRoomsWithRawResponse, - WaitingRoomsWithStreamingResponse, - AsyncWaitingRoomsWithStreamingResponse, -) from .bot_management import ( BotManagement, AsyncBotManagement, @@ -834,12 +826,6 @@ "AsyncSecondaryDNSWithRawResponse", "SecondaryDNSWithStreamingResponse", "AsyncSecondaryDNSWithStreamingResponse", - "WaitingRooms", - "AsyncWaitingRooms", - "WaitingRoomsWithRawResponse", - "AsyncWaitingRoomsWithRawResponse", - "WaitingRoomsWithStreamingResponse", - "AsyncWaitingRoomsWithStreamingResponse", "Web3", "AsyncWeb3", "Web3WithRawResponse", diff --git a/src/cloudflare/resources/waiting_rooms/__init__.py b/src/cloudflare/resources/waiting_rooms/__init__.py deleted file mode 100644 index 368198739b8..00000000000 --- a/src/cloudflare/resources/waiting_rooms/__init__.py +++ /dev/null @@ -1,89 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .page import ( - Page, - AsyncPage, - PageWithRawResponse, - AsyncPageWithRawResponse, - PageWithStreamingResponse, - AsyncPageWithStreamingResponse, -) -from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, -) -from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from .statuses import ( - Statuses, - AsyncStatuses, - StatusesWithRawResponse, - AsyncStatusesWithRawResponse, - StatusesWithStreamingResponse, - AsyncStatusesWithStreamingResponse, -) -from .waiting_rooms import ( - WaitingRooms, - AsyncWaitingRooms, - WaitingRoomsWithRawResponse, - AsyncWaitingRoomsWithRawResponse, - WaitingRoomsWithStreamingResponse, - AsyncWaitingRoomsWithStreamingResponse, -) - -__all__ = [ - "Page", - "AsyncPage", - "PageWithRawResponse", - "AsyncPageWithRawResponse", - "PageWithStreamingResponse", - "AsyncPageWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", - "Rules", - "AsyncRules", - "RulesWithRawResponse", - "AsyncRulesWithRawResponse", - "RulesWithStreamingResponse", - "AsyncRulesWithStreamingResponse", - "Statuses", - "AsyncStatuses", - "StatusesWithRawResponse", - "AsyncStatusesWithRawResponse", - "StatusesWithStreamingResponse", - "AsyncStatusesWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "WaitingRooms", - "AsyncWaitingRooms", - "WaitingRoomsWithRawResponse", - "AsyncWaitingRoomsWithRawResponse", - "WaitingRoomsWithStreamingResponse", - "AsyncWaitingRoomsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/waiting_rooms/events/__init__.py b/src/cloudflare/resources/waiting_rooms/events/__init__.py deleted file mode 100644 index f4fcffae591..00000000000 --- a/src/cloudflare/resources/waiting_rooms/events/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, -) -from .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, -) - -__all__ = [ - "Details", - "AsyncDetails", - "DetailsWithRawResponse", - "AsyncDetailsWithRawResponse", - "DetailsWithStreamingResponse", - "AsyncDetailsWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/waiting_rooms/events/details.py b/src/cloudflare/resources/waiting_rooms/events/details.py deleted file mode 100644 index 9cdb0fc0c8b..00000000000 --- a/src/cloudflare/resources/waiting_rooms/events/details.py +++ /dev/null @@ -1,174 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.waiting_rooms.events import WaitingroomEventDetails - -__all__ = ["Details", "AsyncDetails"] - - -class Details(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self) - - def get( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> WaitingroomEventDetails: - """Previews an event's configuration as if it was active. - - Inherited fields from the - waiting room will be displayed with their current values. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}/details", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEventDetails], ResultWrapper[WaitingroomEventDetails]), - ) - - -class AsyncDetails(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self) - - async def get( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> WaitingroomEventDetails: - """Previews an event's configuration as if it was active. - - Inherited fields from the - waiting room will be displayed with their current values. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}/details", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEventDetails], ResultWrapper[WaitingroomEventDetails]), - ) - - -class DetailsWithRawResponse: - def __init__(self, details: Details) -> None: - self._details = details - - self.get = to_raw_response_wrapper( - details.get, - ) - - -class AsyncDetailsWithRawResponse: - def __init__(self, details: AsyncDetails) -> None: - self._details = details - - self.get = async_to_raw_response_wrapper( - details.get, - ) - - -class DetailsWithStreamingResponse: - def __init__(self, details: Details) -> None: - self._details = details - - self.get = to_streamed_response_wrapper( - details.get, - ) - - -class AsyncDetailsWithStreamingResponse: - def __init__(self, details: AsyncDetails) -> None: - self._details = details - - self.get = async_to_streamed_response_wrapper( - details.get, - ) diff --git a/src/cloudflare/resources/waiting_rooms/events/events.py b/src/cloudflare/resources/waiting_rooms/events/events.py deleted file mode 100644 index 4f640e2a6c9..00000000000 --- a/src/cloudflare/resources/waiting_rooms/events/events.py +++ /dev/null @@ -1,1174 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, -) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) -from ....types.waiting_rooms import ( - WaitingroomEvent, - EventDeleteResponse, - event_edit_params, - event_create_params, - event_update_params, -) - -__all__ = ["Events", "AsyncEvents"] - - -class Events(SyncAPIResource): - @cached_property - def details(self) -> Details: - return Details(self._client) - - @cached_property - def with_raw_response(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self) - - def create( - self, - waiting_room_id: str, - *, - zone_identifier: str, - event_end_time: str, - event_start_time: str, - name: str, - custom_page_html: Optional[str] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: Optional[bool] | NotGiven = NOT_GIVEN, - new_users_per_minute: Optional[int] | NotGiven = NOT_GIVEN, - prequeue_start_time: Optional[str] | NotGiven = NOT_GIVEN, - queueing_method: Optional[str] | NotGiven = NOT_GIVEN, - session_duration: Optional[int] | NotGiven = NOT_GIVEN, - shuffle_at_event_start: bool | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - total_active_users: Optional[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, - ) -> WaitingroomEvent: - """Only available for the Waiting Room Advanced subscription. - - Creates an event for - a waiting room. An event takes place during a specified period of time, - temporarily changing the behavior of a waiting room. While the event is active, - some of the properties in the event's configuration may either override or - inherit from the waiting room's configuration. Note that events cannot overlap - with each other, so only one event can be active at a time. - - Args: - zone_identifier: Identifier - - event_end_time: An ISO 8601 timestamp that marks the end of the event. - - event_start_time: An ISO 8601 timestamp that marks the start of the event. At this time, queued - users will be processed with the event's configuration. The start time must be - at least one minute before `event_end_time`. - - name: A unique name to identify the event. Only alphanumeric characters, hyphens and - underscores are allowed. - - custom_page_html: If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - - description: A note that you can use to add more details about the event. - - disable_session_renewal: If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - - new_users_per_minute: If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - - prequeue_start_time: An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - - queueing_method: If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - - session_duration: If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - - shuffle_at_event_start: If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - - suspended: Suspends or allows an event. If set to `true`, the event is ignored and traffic - will be handled based on the waiting room configuration. - - total_active_users: If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", - body=maybe_transform( - { - "event_end_time": event_end_time, - "event_start_time": event_start_time, - "name": name, - "custom_page_html": custom_page_html, - "description": description, - "disable_session_renewal": disable_session_renewal, - "new_users_per_minute": new_users_per_minute, - "prequeue_start_time": prequeue_start_time, - "queueing_method": queueing_method, - "session_duration": session_duration, - "shuffle_at_event_start": shuffle_at_event_start, - "suspended": suspended, - "total_active_users": total_active_users, - }, - event_create_params.EventCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - def update( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - event_end_time: str, - event_start_time: str, - name: str, - custom_page_html: Optional[str] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: Optional[bool] | NotGiven = NOT_GIVEN, - new_users_per_minute: Optional[int] | NotGiven = NOT_GIVEN, - prequeue_start_time: Optional[str] | NotGiven = NOT_GIVEN, - queueing_method: Optional[str] | NotGiven = NOT_GIVEN, - session_duration: Optional[int] | NotGiven = NOT_GIVEN, - shuffle_at_event_start: bool | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - total_active_users: Optional[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, - ) -> WaitingroomEvent: - """ - Updates a configured event for a waiting room. - - Args: - zone_identifier: Identifier - - event_end_time: An ISO 8601 timestamp that marks the end of the event. - - event_start_time: An ISO 8601 timestamp that marks the start of the event. At this time, queued - users will be processed with the event's configuration. The start time must be - at least one minute before `event_end_time`. - - name: A unique name to identify the event. Only alphanumeric characters, hyphens and - underscores are allowed. - - custom_page_html: If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - - description: A note that you can use to add more details about the event. - - disable_session_renewal: If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - - new_users_per_minute: If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - - prequeue_start_time: An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - - queueing_method: If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - - session_duration: If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - - shuffle_at_event_start: If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - - suspended: Suspends or allows an event. If set to `true`, the event is ignored and traffic - will be handled based on the waiting room configuration. - - total_active_users: If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - body=maybe_transform( - { - "event_end_time": event_end_time, - "event_start_time": event_start_time, - "name": name, - "custom_page_html": custom_page_html, - "description": description, - "disable_session_renewal": disable_session_renewal, - "new_users_per_minute": new_users_per_minute, - "prequeue_start_time": prequeue_start_time, - "queueing_method": queueing_method, - "session_duration": session_duration, - "shuffle_at_event_start": shuffle_at_event_start, - "suspended": suspended, - "total_active_users": total_active_users, - }, - event_update_params.EventUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - def list( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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[WaitingroomEvent]: - """ - Lists events for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", - page=SyncSinglePage[WaitingroomEvent], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WaitingroomEvent, - ) - - def delete( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> EventDeleteResponse: - """ - Deletes an event for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[EventDeleteResponse], ResultWrapper[EventDeleteResponse]), - ) - - def edit( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - event_end_time: str, - event_start_time: str, - name: str, - custom_page_html: Optional[str] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: Optional[bool] | NotGiven = NOT_GIVEN, - new_users_per_minute: Optional[int] | NotGiven = NOT_GIVEN, - prequeue_start_time: Optional[str] | NotGiven = NOT_GIVEN, - queueing_method: Optional[str] | NotGiven = NOT_GIVEN, - session_duration: Optional[int] | NotGiven = NOT_GIVEN, - shuffle_at_event_start: bool | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - total_active_users: Optional[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, - ) -> WaitingroomEvent: - """ - Patches a configured event for a waiting room. - - Args: - zone_identifier: Identifier - - event_end_time: An ISO 8601 timestamp that marks the end of the event. - - event_start_time: An ISO 8601 timestamp that marks the start of the event. At this time, queued - users will be processed with the event's configuration. The start time must be - at least one minute before `event_end_time`. - - name: A unique name to identify the event. Only alphanumeric characters, hyphens and - underscores are allowed. - - custom_page_html: If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - - description: A note that you can use to add more details about the event. - - disable_session_renewal: If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - - new_users_per_minute: If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - - prequeue_start_time: An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - - queueing_method: If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - - session_duration: If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - - shuffle_at_event_start: If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - - suspended: Suspends or allows an event. If set to `true`, the event is ignored and traffic - will be handled based on the waiting room configuration. - - total_active_users: If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - body=maybe_transform( - { - "event_end_time": event_end_time, - "event_start_time": event_start_time, - "name": name, - "custom_page_html": custom_page_html, - "description": description, - "disable_session_renewal": disable_session_renewal, - "new_users_per_minute": new_users_per_minute, - "prequeue_start_time": prequeue_start_time, - "queueing_method": queueing_method, - "session_duration": session_duration, - "shuffle_at_event_start": shuffle_at_event_start, - "suspended": suspended, - "total_active_users": total_active_users, - }, - event_edit_params.EventEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - def get( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> WaitingroomEvent: - """ - Fetches a single configured event for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - -class AsyncEvents(AsyncAPIResource): - @cached_property - def details(self) -> AsyncDetails: - return AsyncDetails(self._client) - - @cached_property - def with_raw_response(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self) - - async def create( - self, - waiting_room_id: str, - *, - zone_identifier: str, - event_end_time: str, - event_start_time: str, - name: str, - custom_page_html: Optional[str] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: Optional[bool] | NotGiven = NOT_GIVEN, - new_users_per_minute: Optional[int] | NotGiven = NOT_GIVEN, - prequeue_start_time: Optional[str] | NotGiven = NOT_GIVEN, - queueing_method: Optional[str] | NotGiven = NOT_GIVEN, - session_duration: Optional[int] | NotGiven = NOT_GIVEN, - shuffle_at_event_start: bool | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - total_active_users: Optional[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, - ) -> WaitingroomEvent: - """Only available for the Waiting Room Advanced subscription. - - Creates an event for - a waiting room. An event takes place during a specified period of time, - temporarily changing the behavior of a waiting room. While the event is active, - some of the properties in the event's configuration may either override or - inherit from the waiting room's configuration. Note that events cannot overlap - with each other, so only one event can be active at a time. - - Args: - zone_identifier: Identifier - - event_end_time: An ISO 8601 timestamp that marks the end of the event. - - event_start_time: An ISO 8601 timestamp that marks the start of the event. At this time, queued - users will be processed with the event's configuration. The start time must be - at least one minute before `event_end_time`. - - name: A unique name to identify the event. Only alphanumeric characters, hyphens and - underscores are allowed. - - custom_page_html: If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - - description: A note that you can use to add more details about the event. - - disable_session_renewal: If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - - new_users_per_minute: If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - - prequeue_start_time: An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - - queueing_method: If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - - session_duration: If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - - shuffle_at_event_start: If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - - suspended: Suspends or allows an event. If set to `true`, the event is ignored and traffic - will be handled based on the waiting room configuration. - - total_active_users: If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", - body=await async_maybe_transform( - { - "event_end_time": event_end_time, - "event_start_time": event_start_time, - "name": name, - "custom_page_html": custom_page_html, - "description": description, - "disable_session_renewal": disable_session_renewal, - "new_users_per_minute": new_users_per_minute, - "prequeue_start_time": prequeue_start_time, - "queueing_method": queueing_method, - "session_duration": session_duration, - "shuffle_at_event_start": shuffle_at_event_start, - "suspended": suspended, - "total_active_users": total_active_users, - }, - event_create_params.EventCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - async def update( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - event_end_time: str, - event_start_time: str, - name: str, - custom_page_html: Optional[str] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: Optional[bool] | NotGiven = NOT_GIVEN, - new_users_per_minute: Optional[int] | NotGiven = NOT_GIVEN, - prequeue_start_time: Optional[str] | NotGiven = NOT_GIVEN, - queueing_method: Optional[str] | NotGiven = NOT_GIVEN, - session_duration: Optional[int] | NotGiven = NOT_GIVEN, - shuffle_at_event_start: bool | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - total_active_users: Optional[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, - ) -> WaitingroomEvent: - """ - Updates a configured event for a waiting room. - - Args: - zone_identifier: Identifier - - event_end_time: An ISO 8601 timestamp that marks the end of the event. - - event_start_time: An ISO 8601 timestamp that marks the start of the event. At this time, queued - users will be processed with the event's configuration. The start time must be - at least one minute before `event_end_time`. - - name: A unique name to identify the event. Only alphanumeric characters, hyphens and - underscores are allowed. - - custom_page_html: If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - - description: A note that you can use to add more details about the event. - - disable_session_renewal: If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - - new_users_per_minute: If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - - prequeue_start_time: An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - - queueing_method: If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - - session_duration: If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - - shuffle_at_event_start: If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - - suspended: Suspends or allows an event. If set to `true`, the event is ignored and traffic - will be handled based on the waiting room configuration. - - total_active_users: If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - body=await async_maybe_transform( - { - "event_end_time": event_end_time, - "event_start_time": event_start_time, - "name": name, - "custom_page_html": custom_page_html, - "description": description, - "disable_session_renewal": disable_session_renewal, - "new_users_per_minute": new_users_per_minute, - "prequeue_start_time": prequeue_start_time, - "queueing_method": queueing_method, - "session_duration": session_duration, - "shuffle_at_event_start": shuffle_at_event_start, - "suspended": suspended, - "total_active_users": total_active_users, - }, - event_update_params.EventUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - def list( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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[WaitingroomEvent, AsyncSinglePage[WaitingroomEvent]]: - """ - Lists events for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", - page=AsyncSinglePage[WaitingroomEvent], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WaitingroomEvent, - ) - - async def delete( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> EventDeleteResponse: - """ - Deletes an event for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return await self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[EventDeleteResponse], ResultWrapper[EventDeleteResponse]), - ) - - async def edit( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - event_end_time: str, - event_start_time: str, - name: str, - custom_page_html: Optional[str] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: Optional[bool] | NotGiven = NOT_GIVEN, - new_users_per_minute: Optional[int] | NotGiven = NOT_GIVEN, - prequeue_start_time: Optional[str] | NotGiven = NOT_GIVEN, - queueing_method: Optional[str] | NotGiven = NOT_GIVEN, - session_duration: Optional[int] | NotGiven = NOT_GIVEN, - shuffle_at_event_start: bool | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - total_active_users: Optional[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, - ) -> WaitingroomEvent: - """ - Patches a configured event for a waiting room. - - Args: - zone_identifier: Identifier - - event_end_time: An ISO 8601 timestamp that marks the end of the event. - - event_start_time: An ISO 8601 timestamp that marks the start of the event. At this time, queued - users will be processed with the event's configuration. The start time must be - at least one minute before `event_end_time`. - - name: A unique name to identify the event. Only alphanumeric characters, hyphens and - underscores are allowed. - - custom_page_html: If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - - description: A note that you can use to add more details about the event. - - disable_session_renewal: If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - - new_users_per_minute: If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - - prequeue_start_time: An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - - queueing_method: If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - - session_duration: If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - - shuffle_at_event_start: If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - - suspended: Suspends or allows an event. If set to `true`, the event is ignored and traffic - will be handled based on the waiting room configuration. - - total_active_users: If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return await self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - body=await async_maybe_transform( - { - "event_end_time": event_end_time, - "event_start_time": event_start_time, - "name": name, - "custom_page_html": custom_page_html, - "description": description, - "disable_session_renewal": disable_session_renewal, - "new_users_per_minute": new_users_per_minute, - "prequeue_start_time": prequeue_start_time, - "queueing_method": queueing_method, - "session_duration": session_duration, - "shuffle_at_event_start": shuffle_at_event_start, - "suspended": suspended, - "total_active_users": total_active_users, - }, - event_edit_params.EventEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - async def get( - self, - event_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> WaitingroomEvent: - """ - Fetches a single configured event for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events/{event_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), - ) - - -class EventsWithRawResponse: - def __init__(self, events: Events) -> None: - self._events = events - - self.create = to_raw_response_wrapper( - events.create, - ) - self.update = to_raw_response_wrapper( - events.update, - ) - self.list = to_raw_response_wrapper( - events.list, - ) - self.delete = to_raw_response_wrapper( - events.delete, - ) - self.edit = to_raw_response_wrapper( - events.edit, - ) - self.get = to_raw_response_wrapper( - events.get, - ) - - @cached_property - def details(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self._events.details) - - -class AsyncEventsWithRawResponse: - def __init__(self, events: AsyncEvents) -> None: - self._events = events - - self.create = async_to_raw_response_wrapper( - events.create, - ) - self.update = async_to_raw_response_wrapper( - events.update, - ) - self.list = async_to_raw_response_wrapper( - events.list, - ) - self.delete = async_to_raw_response_wrapper( - events.delete, - ) - self.edit = async_to_raw_response_wrapper( - events.edit, - ) - self.get = async_to_raw_response_wrapper( - events.get, - ) - - @cached_property - def details(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self._events.details) - - -class EventsWithStreamingResponse: - def __init__(self, events: Events) -> None: - self._events = events - - self.create = to_streamed_response_wrapper( - events.create, - ) - self.update = to_streamed_response_wrapper( - events.update, - ) - self.list = to_streamed_response_wrapper( - events.list, - ) - self.delete = to_streamed_response_wrapper( - events.delete, - ) - self.edit = to_streamed_response_wrapper( - events.edit, - ) - self.get = to_streamed_response_wrapper( - events.get, - ) - - @cached_property - def details(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self._events.details) - - -class AsyncEventsWithStreamingResponse: - def __init__(self, events: AsyncEvents) -> None: - self._events = events - - self.create = async_to_streamed_response_wrapper( - events.create, - ) - self.update = async_to_streamed_response_wrapper( - events.update, - ) - self.list = async_to_streamed_response_wrapper( - events.list, - ) - self.delete = async_to_streamed_response_wrapper( - events.delete, - ) - self.edit = async_to_streamed_response_wrapper( - events.edit, - ) - self.get = async_to_streamed_response_wrapper( - events.get, - ) - - @cached_property - def details(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self._events.details) diff --git a/src/cloudflare/resources/waiting_rooms/page.py b/src/cloudflare/resources/waiting_rooms/page.py deleted file mode 100644 index 70559f56214..00000000000 --- a/src/cloudflare/resources/waiting_rooms/page.py +++ /dev/null @@ -1,282 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) -from ...types.waiting_rooms import PagePreviewResponse, page_preview_params - -__all__ = ["Page", "AsyncPage"] - - -class Page(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PageWithRawResponse: - return PageWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PageWithStreamingResponse: - return PageWithStreamingResponse(self) - - def preview( - self, - zone_identifier: str, - *, - custom_html: str, - # 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, - ) -> PagePreviewResponse: - """Creates a waiting room page preview. - - Upload a custom waiting room page for - preview. You will receive a preview URL in the form - `http://waitingrooms.dev/preview/`. You can use the following query - parameters to change the state of the preview: - - 1. `force_queue`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website (also known as queueAll). - 2. `queue_is_full`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 3. `queueing_method`: The queueing method currently used by the waiting room. - - **fifo** indicates a FIFO queue. - - **random** indicates a Random queue. - - **passthrough** indicates a Passthrough queue. Keep in mind that the - waiting room page will only be displayed if `force_queue=true` or - `event=prequeueing` — for other cases the request will pass through to the - origin. For our preview, this will be a fake origin website returning - "Welcome". - - **reject** indicates a Reject queue. - 4. `event`: Used to preview a waiting room event. - - **none** indicates no event is occurring. - - **prequeueing** indicates that an event is prequeueing (between - `prequeue_start_time` and `event_start_time`). - - **started** indicates that an event has started (between `event_start_time` - and `event_end_time`). - 5. `shuffle_at_event_start`: Boolean indicating if the event will shuffle users - in the prequeue when it starts. This can only be set to **true** if an event - is active (`event` is not **none**). - - For example, you can make a request to - `http://waitingrooms.dev/preview/?force_queue=false&queue_is_full=false&queueing_method=random&event=started&shuffle_at_event_start=true` 6. - `waitTime`: Non-zero, positive integer indicating the estimated wait time in - minutes. The default value is 10 minutes. - - For example, you can make a request to - `http://waitingrooms.dev/preview/?waitTime=50` to configure the estimated - wait time as 50 minutes. - - Args: - zone_identifier: Identifier - - custom_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._post( - f"/zones/{zone_identifier}/waiting_rooms/preview", - body=maybe_transform({"custom_html": custom_html}, page_preview_params.PagePreviewParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PagePreviewResponse], ResultWrapper[PagePreviewResponse]), - ) - - -class AsyncPage(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPageWithRawResponse: - return AsyncPageWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPageWithStreamingResponse: - return AsyncPageWithStreamingResponse(self) - - async def preview( - self, - zone_identifier: str, - *, - custom_html: str, - # 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, - ) -> PagePreviewResponse: - """Creates a waiting room page preview. - - Upload a custom waiting room page for - preview. You will receive a preview URL in the form - `http://waitingrooms.dev/preview/`. You can use the following query - parameters to change the state of the preview: - - 1. `force_queue`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website (also known as queueAll). - 2. `queue_is_full`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 3. `queueing_method`: The queueing method currently used by the waiting room. - - **fifo** indicates a FIFO queue. - - **random** indicates a Random queue. - - **passthrough** indicates a Passthrough queue. Keep in mind that the - waiting room page will only be displayed if `force_queue=true` or - `event=prequeueing` — for other cases the request will pass through to the - origin. For our preview, this will be a fake origin website returning - "Welcome". - - **reject** indicates a Reject queue. - 4. `event`: Used to preview a waiting room event. - - **none** indicates no event is occurring. - - **prequeueing** indicates that an event is prequeueing (between - `prequeue_start_time` and `event_start_time`). - - **started** indicates that an event has started (between `event_start_time` - and `event_end_time`). - 5. `shuffle_at_event_start`: Boolean indicating if the event will shuffle users - in the prequeue when it starts. This can only be set to **true** if an event - is active (`event` is not **none**). - - For example, you can make a request to - `http://waitingrooms.dev/preview/?force_queue=false&queue_is_full=false&queueing_method=random&event=started&shuffle_at_event_start=true` 6. - `waitTime`: Non-zero, positive integer indicating the estimated wait time in - minutes. The default value is 10 minutes. - - For example, you can make a request to - `http://waitingrooms.dev/preview/?waitTime=50` to configure the estimated - wait time as 50 minutes. - - Args: - zone_identifier: Identifier - - custom_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._post( - f"/zones/{zone_identifier}/waiting_rooms/preview", - body=await async_maybe_transform({"custom_html": custom_html}, page_preview_params.PagePreviewParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PagePreviewResponse], ResultWrapper[PagePreviewResponse]), - ) - - -class PageWithRawResponse: - def __init__(self, page: Page) -> None: - self._page = page - - self.preview = to_raw_response_wrapper( - page.preview, - ) - - -class AsyncPageWithRawResponse: - def __init__(self, page: AsyncPage) -> None: - self._page = page - - self.preview = async_to_raw_response_wrapper( - page.preview, - ) - - -class PageWithStreamingResponse: - def __init__(self, page: Page) -> None: - self._page = page - - self.preview = to_streamed_response_wrapper( - page.preview, - ) - - -class AsyncPageWithStreamingResponse: - def __init__(self, page: AsyncPage) -> None: - self._page = page - - self.preview = async_to_streamed_response_wrapper( - page.preview, - ) diff --git a/src/cloudflare/resources/waiting_rooms/rules.py b/src/cloudflare/resources/waiting_rooms/rules.py deleted file mode 100644 index 78bd8d41228..00000000000 --- a/src/cloudflare/resources/waiting_rooms/rules.py +++ /dev/null @@ -1,682 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Iterable, Optional, cast -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ...pagination import SyncSinglePage, AsyncSinglePage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.waiting_rooms import ( - WaitingroomRule, - RuleEditResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, - rule_edit_params, - rule_create_params, - rule_update_params, -) - -__all__ = ["Rules", "AsyncRules"] - - -class Rules(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self) - - def create( - self, - waiting_room_id: str, - *, - zone_identifier: str, - action: Literal["bypass_waiting_room"], - expression: str, - description: str | NotGiven = NOT_GIVEN, - 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleCreateResponse]: - """Only available for the Waiting Room Advanced subscription. - - Creates a rule for a - waiting room. - - Args: - zone_identifier: Identifier - - action: The action to take when the expression matches. - - expression: Criteria defining when there is a match for the current rule. - - description: The description of the rule. - - enabled: When set to true, the rule is enabled. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - body=maybe_transform( - { - "action": action, - "expression": expression, - "description": description, - "enabled": enabled, - }, - rule_create_params.RuleCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), - ) - - def update( - self, - waiting_room_id: str, - *, - zone_identifier: str, - body: Iterable[rule_update_params.Body], - # 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, - ) -> Optional[RuleUpdateResponse]: - """Only available for the Waiting Room Advanced subscription. - - Replaces all rules - for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - body=maybe_transform(body, rule_update_params.RuleUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), - ) - - def list( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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[WaitingroomRule]: - """ - Lists rules for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - page=SyncSinglePage[WaitingroomRule], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WaitingroomRule, - ) - - def delete( - self, - rule_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> Optional[RuleDeleteResponse]: - """ - Deletes a rule for a waiting room. - - Args: - zone_identifier: Identifier - - rule_id: The ID of the rule. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not rule_id: - raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - return self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), - ) - - def edit( - self, - rule_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - action: Literal["bypass_waiting_room"], - expression: str, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - position: rule_edit_params.Position | 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, - ) -> Optional[RuleEditResponse]: - """ - Patches a rule for a waiting room. - - Args: - zone_identifier: Identifier - - rule_id: The ID of the rule. - - action: The action to take when the expression matches. - - expression: Criteria defining when there is a match for the current rule. - - description: The description of the rule. - - enabled: When set to true, the rule is enabled. - - position: Reorder the position of a rule - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not rule_id: - raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", - body=maybe_transform( - { - "action": action, - "expression": expression, - "description": description, - "enabled": enabled, - "position": position, - }, - rule_edit_params.RuleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), - ) - - -class AsyncRules(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self) - - async def create( - self, - waiting_room_id: str, - *, - zone_identifier: str, - action: Literal["bypass_waiting_room"], - expression: str, - description: str | NotGiven = NOT_GIVEN, - 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleCreateResponse]: - """Only available for the Waiting Room Advanced subscription. - - Creates a rule for a - waiting room. - - Args: - zone_identifier: Identifier - - action: The action to take when the expression matches. - - expression: Criteria defining when there is a match for the current rule. - - description: The description of the rule. - - enabled: When set to true, the rule is enabled. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._post( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - body=await async_maybe_transform( - { - "action": action, - "expression": expression, - "description": description, - "enabled": enabled, - }, - rule_create_params.RuleCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), - ) - - async def update( - self, - waiting_room_id: str, - *, - zone_identifier: str, - body: Iterable[rule_update_params.Body], - # 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, - ) -> Optional[RuleUpdateResponse]: - """Only available for the Waiting Room Advanced subscription. - - Replaces all rules - for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - body=await async_maybe_transform(body, rule_update_params.RuleUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), - ) - - def list( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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[WaitingroomRule, AsyncSinglePage[WaitingroomRule]]: - """ - Lists rules for a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", - page=AsyncSinglePage[WaitingroomRule], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WaitingroomRule, - ) - - async def delete( - self, - rule_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - # 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, - ) -> Optional[RuleDeleteResponse]: - """ - Deletes a rule for a waiting room. - - Args: - zone_identifier: Identifier - - rule_id: The ID of the rule. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not rule_id: - raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - return await self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleDeleteResponse]], ResultWrapper[RuleDeleteResponse]), - ) - - async def edit( - self, - rule_id: str, - *, - zone_identifier: str, - waiting_room_id: str, - action: Literal["bypass_waiting_room"], - expression: str, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - position: rule_edit_params.Position | 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, - ) -> Optional[RuleEditResponse]: - """ - Patches a rule for a waiting room. - - Args: - zone_identifier: Identifier - - rule_id: The ID of the rule. - - action: The action to take when the expression matches. - - expression: Criteria defining when there is a match for the current rule. - - description: The description of the rule. - - enabled: When set to true, the rule is enabled. - - position: Reorder the position of a rule - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - if not rule_id: - raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") - return await self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules/{rule_id}", - body=await async_maybe_transform( - { - "action": action, - "expression": expression, - "description": description, - "enabled": enabled, - "position": position, - }, - rule_edit_params.RuleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), - ) - - -class RulesWithRawResponse: - def __init__(self, rules: Rules) -> None: - self._rules = rules - - self.create = to_raw_response_wrapper( - rules.create, - ) - self.update = to_raw_response_wrapper( - rules.update, - ) - self.list = to_raw_response_wrapper( - rules.list, - ) - self.delete = to_raw_response_wrapper( - rules.delete, - ) - self.edit = to_raw_response_wrapper( - rules.edit, - ) - - -class AsyncRulesWithRawResponse: - def __init__(self, rules: AsyncRules) -> None: - self._rules = rules - - self.create = async_to_raw_response_wrapper( - rules.create, - ) - self.update = async_to_raw_response_wrapper( - rules.update, - ) - self.list = async_to_raw_response_wrapper( - rules.list, - ) - self.delete = async_to_raw_response_wrapper( - rules.delete, - ) - self.edit = async_to_raw_response_wrapper( - rules.edit, - ) - - -class RulesWithStreamingResponse: - def __init__(self, rules: Rules) -> None: - self._rules = rules - - self.create = to_streamed_response_wrapper( - rules.create, - ) - self.update = to_streamed_response_wrapper( - rules.update, - ) - self.list = to_streamed_response_wrapper( - rules.list, - ) - self.delete = to_streamed_response_wrapper( - rules.delete, - ) - self.edit = to_streamed_response_wrapper( - rules.edit, - ) - - -class AsyncRulesWithStreamingResponse: - def __init__(self, rules: AsyncRules) -> None: - self._rules = rules - - self.create = async_to_streamed_response_wrapper( - rules.create, - ) - self.update = async_to_streamed_response_wrapper( - rules.update, - ) - self.list = async_to_streamed_response_wrapper( - rules.list, - ) - self.delete = async_to_streamed_response_wrapper( - rules.delete, - ) - self.edit = async_to_streamed_response_wrapper( - rules.edit, - ) diff --git a/src/cloudflare/resources/waiting_rooms/settings.py b/src/cloudflare/resources/waiting_rooms/settings.py deleted file mode 100644 index 0f942309554..00000000000 --- a/src/cloudflare/resources/waiting_rooms/settings.py +++ /dev/null @@ -1,382 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) -from ...types.waiting_rooms import ( - SettingGetResponse, - SettingEditResponse, - SettingUpdateResponse, - setting_edit_params, - setting_update_params, -) - -__all__ = ["Settings", "AsyncSettings"] - - -class Settings(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self) - - def update( - self, - zone_identifier: str, - *, - search_engine_crawler_bypass: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingUpdateResponse: - """ - Update zone-level Waiting Room settings - - Args: - zone_identifier: Identifier - - search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._put( - f"/zones/{zone_identifier}/waiting_rooms/settings", - body=maybe_transform( - {"search_engine_crawler_bypass": search_engine_crawler_bypass}, - setting_update_params.SettingUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingUpdateResponse], ResultWrapper[SettingUpdateResponse]), - ) - - def edit( - self, - zone_identifier: str, - *, - search_engine_crawler_bypass: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingEditResponse: - """ - Patch zone-level Waiting Room settings - - Args: - zone_identifier: Identifier - - search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/settings", - body=maybe_transform( - {"search_engine_crawler_bypass": search_engine_crawler_bypass}, setting_edit_params.SettingEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), - ) - - def get( - self, - zone_identifier: str, - *, - # 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, - ) -> SettingGetResponse: - """ - Get zone-level Waiting Room settings - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( - f"/zones/{zone_identifier}/waiting_rooms/settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), - ) - - -class AsyncSettings(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self) - - async def update( - self, - zone_identifier: str, - *, - search_engine_crawler_bypass: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingUpdateResponse: - """ - Update zone-level Waiting Room settings - - Args: - zone_identifier: Identifier - - search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/settings", - body=await async_maybe_transform( - {"search_engine_crawler_bypass": search_engine_crawler_bypass}, - setting_update_params.SettingUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingUpdateResponse], ResultWrapper[SettingUpdateResponse]), - ) - - async def edit( - self, - zone_identifier: str, - *, - search_engine_crawler_bypass: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingEditResponse: - """ - Patch zone-level Waiting Room settings - - Args: - zone_identifier: Identifier - - search_engine_crawler_bypass: Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._patch( - f"/zones/{zone_identifier}/waiting_rooms/settings", - body=await async_maybe_transform( - {"search_engine_crawler_bypass": search_engine_crawler_bypass}, setting_edit_params.SettingEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), - ) - - async def get( - self, - zone_identifier: str, - *, - # 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, - ) -> SettingGetResponse: - """ - Get zone-level Waiting Room settings - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), - ) - - -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: - self._settings = settings - - self.update = to_raw_response_wrapper( - settings.update, - ) - self.edit = to_raw_response_wrapper( - settings.edit, - ) - self.get = to_raw_response_wrapper( - settings.get, - ) - - -class AsyncSettingsWithRawResponse: - def __init__(self, settings: AsyncSettings) -> None: - self._settings = settings - - self.update = async_to_raw_response_wrapper( - settings.update, - ) - self.edit = async_to_raw_response_wrapper( - settings.edit, - ) - self.get = async_to_raw_response_wrapper( - settings.get, - ) - - -class SettingsWithStreamingResponse: - def __init__(self, settings: Settings) -> None: - self._settings = settings - - self.update = to_streamed_response_wrapper( - settings.update, - ) - self.edit = to_streamed_response_wrapper( - settings.edit, - ) - self.get = to_streamed_response_wrapper( - settings.get, - ) - - -class AsyncSettingsWithStreamingResponse: - def __init__(self, settings: AsyncSettings) -> None: - self._settings = settings - - self.update = async_to_streamed_response_wrapper( - settings.update, - ) - self.edit = async_to_streamed_response_wrapper( - settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - settings.get, - ) diff --git a/src/cloudflare/resources/waiting_rooms/statuses.py b/src/cloudflare/resources/waiting_rooms/statuses.py deleted file mode 100644 index 5c5348f0345..00000000000 --- a/src/cloudflare/resources/waiting_rooms/statuses.py +++ /dev/null @@ -1,200 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) -from ...types.waiting_rooms import StatusGetResponse - -__all__ = ["Statuses", "AsyncStatuses"] - - -class Statuses(SyncAPIResource): - @cached_property - def with_raw_response(self) -> StatusesWithRawResponse: - return StatusesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> StatusesWithStreamingResponse: - return StatusesWithStreamingResponse(self) - - def get( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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, - ) -> StatusGetResponse: - """Fetches the status of a configured waiting room. - - Response fields include: - - 1. `status`: String indicating the status of the waiting room. The possible - status are: - - **not_queueing** indicates that the configured thresholds have not been met - and all users are going through to the origin. - - **queueing** indicates that the thresholds have been met and some users are - held in the waiting room. - - **event_prequeueing** indicates that an event is active and is currently - prequeueing users before it starts. - 2. `event_id`: String of the current event's `id` if an event is active, - otherwise an empty string. - 3. `estimated_queued_users`: Integer of the estimated number of users currently - waiting in the queue. - 4. `estimated_total_active_users`: Integer of the estimated number of users - currently active on the origin. - 5. `max_estimated_time_minutes`: Integer of the maximum estimated time currently - presented to the users. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/status", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), - ) - - -class AsyncStatuses(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncStatusesWithRawResponse: - return AsyncStatusesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncStatusesWithStreamingResponse: - return AsyncStatusesWithStreamingResponse(self) - - async def get( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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, - ) -> StatusGetResponse: - """Fetches the status of a configured waiting room. - - Response fields include: - - 1. `status`: String indicating the status of the waiting room. The possible - status are: - - **not_queueing** indicates that the configured thresholds have not been met - and all users are going through to the origin. - - **queueing** indicates that the thresholds have been met and some users are - held in the waiting room. - - **event_prequeueing** indicates that an event is active and is currently - prequeueing users before it starts. - 2. `event_id`: String of the current event's `id` if an event is active, - otherwise an empty string. - 3. `estimated_queued_users`: Integer of the estimated number of users currently - waiting in the queue. - 4. `estimated_total_active_users`: Integer of the estimated number of users - currently active on the origin. - 5. `max_estimated_time_minutes`: Integer of the maximum estimated time currently - presented to the users. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/status", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), - ) - - -class StatusesWithRawResponse: - def __init__(self, statuses: Statuses) -> None: - self._statuses = statuses - - self.get = to_raw_response_wrapper( - statuses.get, - ) - - -class AsyncStatusesWithRawResponse: - def __init__(self, statuses: AsyncStatuses) -> None: - self._statuses = statuses - - self.get = async_to_raw_response_wrapper( - statuses.get, - ) - - -class StatusesWithStreamingResponse: - def __init__(self, statuses: Statuses) -> None: - self._statuses = statuses - - self.get = to_streamed_response_wrapper( - statuses.get, - ) - - -class AsyncStatusesWithStreamingResponse: - def __init__(self, statuses: AsyncStatuses) -> None: - self._statuses = statuses - - self.get = async_to_streamed_response_wrapper( - statuses.get, - ) diff --git a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py deleted file mode 100644 index d7db5dfc32a..00000000000 --- a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py +++ /dev/null @@ -1,2696 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Iterable, cast -from typing_extensions import Literal - -import httpx - -from .page import ( - Page, - AsyncPage, - PageWithRawResponse, - AsyncPageWithRawResponse, - PageWithStreamingResponse, - AsyncPageWithStreamingResponse, -) -from .rules import ( - Rules, - AsyncRules, - RulesWithRawResponse, - AsyncRulesWithRawResponse, - RulesWithStreamingResponse, - AsyncRulesWithStreamingResponse, -) -from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, -) -from ...types import ( - WaitingRoom, - WaitingRoomDeleteResponse, - waiting_room_edit_params, - waiting_room_create_params, - waiting_room_update_params, -) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from .statuses import ( - Statuses, - AsyncStatuses, - StatusesWithRawResponse, - AsyncStatusesWithRawResponse, - StatusesWithStreamingResponse, - AsyncStatusesWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ...pagination import SyncSinglePage, AsyncSinglePage -from .events.events import Events, AsyncEvents -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) - -__all__ = ["WaitingRooms", "AsyncWaitingRooms"] - - -class WaitingRooms(SyncAPIResource): - @cached_property - def page(self) -> Page: - return Page(self._client) - - @cached_property - def events(self) -> Events: - return Events(self._client) - - @cached_property - def rules(self) -> Rules: - return Rules(self._client) - - @cached_property - def statuses(self) -> Statuses: - return Statuses(self._client) - - @cached_property - def settings(self) -> Settings: - return Settings(self._client) - - @cached_property - def with_raw_response(self) -> WaitingRoomsWithRawResponse: - return WaitingRoomsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WaitingRoomsWithStreamingResponse: - return WaitingRoomsWithStreamingResponse(self) - - def create( - self, - zone_identifier: str, - *, - host: str, - name: str, - new_users_per_minute: int, - total_active_users: int, - additional_routes: Iterable[waiting_room_create_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_create_params.CookieAttributes | NotGiven = NOT_GIVEN, - cookie_suffix: str | NotGiven = NOT_GIVEN, - custom_page_html: str | NotGiven = NOT_GIVEN, - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: bool | NotGiven = NOT_GIVEN, - json_response_enabled: bool | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - queue_all: bool | NotGiven = NOT_GIVEN, - queueing_method: Literal["fifo", "random", "passthrough", "reject"] | NotGiven = NOT_GIVEN, - queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, - session_duration: int | NotGiven = NOT_GIVEN, - suspended: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingRoom: - """ - Creates a new waiting room. - - Args: - zone_identifier: Identifier - - host: The host name to which the waiting room will be applied (no wildcards). Please - do not include the scheme (http:// or https://). The host and path combination - must be unique. - - name: A unique name to identify the waiting room. Only alphanumeric characters, - hyphens and underscores are allowed. - - new_users_per_minute: Sets the number of new users that will be let into the route every minute. This - value is used as baseline for the number of users that are let in per minute. So - it is possible that there is a little more or little less traffic coming to the - route based on the traffic patterns at that time around the world. - - total_active_users: Sets the total number of active user sessions on the route at a point in time. A - route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - - additional_routes: Only available for the Waiting Room Advanced subscription. Additional hostname - and path combinations to which this waiting room will be applied. There is an - implied wildcard at the end of the path. The hostname and path combination must - be unique to this and all other waiting rooms. - - cookie_attributes: Configures cookie attributes for the waiting room cookie. This encrypted cookie - stores a user's status in the waiting room, such as queue position. - - cookie_suffix: Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - - custom_page_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - default_template_language: The language of the default page template. If no default_template_language is - provided, then `en-US` (English) will be used. - - description: A note that you can use to add more details about the waiting room. - - disable_session_renewal: Only available for the Waiting Room Advanced subscription. Disables automatic - renewal of session cookies. If `true`, an accepted user will have - session_duration minutes to browse the site. After that, they will have to go - through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - - json_response_enabled: Only available for the Waiting Room Advanced subscription. If `true`, requests - to the waiting room with the header `Accept: application/json` will receive a - JSON response object with information on the user's status in the waiting room - as opposed to the configured static HTML page. This JSON response object has one - property `cfWaitingRoom` which is an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - - path: Sets the path within the host to enable the waiting room on. The waiting room - will be enabled for all subpaths as well. If there are two waiting rooms on the - same subpath, the waiting room for the most specific path will be chosen. - Wildcards and query parameters are not supported. - - queue_all: If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - - queueing_method: Sets the queueing method used by the waiting room. Changing this parameter from - the **default** queueing method is only available for the Waiting Room Advanced - subscription. Regardless of the queueing method, if `queue_all` is enabled or an - event is prequeueing, users in the waiting room will not be accepted to the - origin. These users will always see a waiting room page that refreshes - automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - - queueing_status_code: HTTP status code returned to a user while in the queue. - - session_duration: Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - - suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the - traffic will not go to the waiting room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._post( - f"/zones/{zone_identifier}/waiting_rooms", - body=maybe_transform( - { - "host": host, - "name": name, - "new_users_per_minute": new_users_per_minute, - "total_active_users": total_active_users, - "additional_routes": additional_routes, - "cookie_attributes": cookie_attributes, - "cookie_suffix": cookie_suffix, - "custom_page_html": custom_page_html, - "default_template_language": default_template_language, - "description": description, - "disable_session_renewal": disable_session_renewal, - "json_response_enabled": json_response_enabled, - "path": path, - "queue_all": queue_all, - "queueing_method": queueing_method, - "queueing_status_code": queueing_status_code, - "session_duration": session_duration, - "suspended": suspended, - }, - waiting_room_create_params.WaitingRoomCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - def update( - self, - waiting_room_id: str, - *, - zone_identifier: str, - host: str, - name: str, - new_users_per_minute: int, - total_active_users: int, - additional_routes: Iterable[waiting_room_update_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_update_params.CookieAttributes | NotGiven = NOT_GIVEN, - cookie_suffix: str | NotGiven = NOT_GIVEN, - custom_page_html: str | NotGiven = NOT_GIVEN, - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: bool | NotGiven = NOT_GIVEN, - json_response_enabled: bool | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - queue_all: bool | NotGiven = NOT_GIVEN, - queueing_method: Literal["fifo", "random", "passthrough", "reject"] | NotGiven = NOT_GIVEN, - queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, - session_duration: int | NotGiven = NOT_GIVEN, - suspended: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingRoom: - """ - Updates a configured waiting room. - - Args: - zone_identifier: Identifier - - host: The host name to which the waiting room will be applied (no wildcards). Please - do not include the scheme (http:// or https://). The host and path combination - must be unique. - - name: A unique name to identify the waiting room. Only alphanumeric characters, - hyphens and underscores are allowed. - - new_users_per_minute: Sets the number of new users that will be let into the route every minute. This - value is used as baseline for the number of users that are let in per minute. So - it is possible that there is a little more or little less traffic coming to the - route based on the traffic patterns at that time around the world. - - total_active_users: Sets the total number of active user sessions on the route at a point in time. A - route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - - additional_routes: Only available for the Waiting Room Advanced subscription. Additional hostname - and path combinations to which this waiting room will be applied. There is an - implied wildcard at the end of the path. The hostname and path combination must - be unique to this and all other waiting rooms. - - cookie_attributes: Configures cookie attributes for the waiting room cookie. This encrypted cookie - stores a user's status in the waiting room, such as queue position. - - cookie_suffix: Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - - custom_page_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - default_template_language: The language of the default page template. If no default_template_language is - provided, then `en-US` (English) will be used. - - description: A note that you can use to add more details about the waiting room. - - disable_session_renewal: Only available for the Waiting Room Advanced subscription. Disables automatic - renewal of session cookies. If `true`, an accepted user will have - session_duration minutes to browse the site. After that, they will have to go - through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - - json_response_enabled: Only available for the Waiting Room Advanced subscription. If `true`, requests - to the waiting room with the header `Accept: application/json` will receive a - JSON response object with information on the user's status in the waiting room - as opposed to the configured static HTML page. This JSON response object has one - property `cfWaitingRoom` which is an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - - path: Sets the path within the host to enable the waiting room on. The waiting room - will be enabled for all subpaths as well. If there are two waiting rooms on the - same subpath, the waiting room for the most specific path will be chosen. - Wildcards and query parameters are not supported. - - queue_all: If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - - queueing_method: Sets the queueing method used by the waiting room. Changing this parameter from - the **default** queueing method is only available for the Waiting Room Advanced - subscription. Regardless of the queueing method, if `queue_all` is enabled or an - event is prequeueing, users in the waiting room will not be accepted to the - origin. These users will always see a waiting room page that refreshes - automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - - queueing_status_code: HTTP status code returned to a user while in the queue. - - session_duration: Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - - suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the - traffic will not go to the waiting room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - body=maybe_transform( - { - "host": host, - "name": name, - "new_users_per_minute": new_users_per_minute, - "total_active_users": total_active_users, - "additional_routes": additional_routes, - "cookie_attributes": cookie_attributes, - "cookie_suffix": cookie_suffix, - "custom_page_html": custom_page_html, - "default_template_language": default_template_language, - "description": description, - "disable_session_renewal": disable_session_renewal, - "json_response_enabled": json_response_enabled, - "path": path, - "queue_all": queue_all, - "queueing_method": queueing_method, - "queueing_status_code": queueing_status_code, - "session_duration": session_duration, - "suspended": suspended, - }, - waiting_room_update_params.WaitingRoomUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - def list( - self, - zone_identifier: str, - *, - # 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[WaitingRoom]: - """ - Lists waiting rooms. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms", - page=SyncSinglePage[WaitingRoom], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WaitingRoom, - ) - - def delete( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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, - ) -> WaitingRoomDeleteResponse: - """ - Deletes a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoomDeleteResponse], ResultWrapper[WaitingRoomDeleteResponse]), - ) - - def edit( - self, - waiting_room_id: str, - *, - zone_identifier: str, - host: str, - name: str, - new_users_per_minute: int, - total_active_users: int, - additional_routes: Iterable[waiting_room_edit_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_edit_params.CookieAttributes | NotGiven = NOT_GIVEN, - cookie_suffix: str | NotGiven = NOT_GIVEN, - custom_page_html: str | NotGiven = NOT_GIVEN, - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: bool | NotGiven = NOT_GIVEN, - json_response_enabled: bool | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - queue_all: bool | NotGiven = NOT_GIVEN, - queueing_method: Literal["fifo", "random", "passthrough", "reject"] | NotGiven = NOT_GIVEN, - queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, - session_duration: int | NotGiven = NOT_GIVEN, - suspended: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingRoom: - """ - Patches a configured waiting room. - - Args: - zone_identifier: Identifier - - host: The host name to which the waiting room will be applied (no wildcards). Please - do not include the scheme (http:// or https://). The host and path combination - must be unique. - - name: A unique name to identify the waiting room. Only alphanumeric characters, - hyphens and underscores are allowed. - - new_users_per_minute: Sets the number of new users that will be let into the route every minute. This - value is used as baseline for the number of users that are let in per minute. So - it is possible that there is a little more or little less traffic coming to the - route based on the traffic patterns at that time around the world. - - total_active_users: Sets the total number of active user sessions on the route at a point in time. A - route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - - additional_routes: Only available for the Waiting Room Advanced subscription. Additional hostname - and path combinations to which this waiting room will be applied. There is an - implied wildcard at the end of the path. The hostname and path combination must - be unique to this and all other waiting rooms. - - cookie_attributes: Configures cookie attributes for the waiting room cookie. This encrypted cookie - stores a user's status in the waiting room, such as queue position. - - cookie_suffix: Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - - custom_page_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - default_template_language: The language of the default page template. If no default_template_language is - provided, then `en-US` (English) will be used. - - description: A note that you can use to add more details about the waiting room. - - disable_session_renewal: Only available for the Waiting Room Advanced subscription. Disables automatic - renewal of session cookies. If `true`, an accepted user will have - session_duration minutes to browse the site. After that, they will have to go - through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - - json_response_enabled: Only available for the Waiting Room Advanced subscription. If `true`, requests - to the waiting room with the header `Accept: application/json` will receive a - JSON response object with information on the user's status in the waiting room - as opposed to the configured static HTML page. This JSON response object has one - property `cfWaitingRoom` which is an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - - path: Sets the path within the host to enable the waiting room on. The waiting room - will be enabled for all subpaths as well. If there are two waiting rooms on the - same subpath, the waiting room for the most specific path will be chosen. - Wildcards and query parameters are not supported. - - queue_all: If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - - queueing_method: Sets the queueing method used by the waiting room. Changing this parameter from - the **default** queueing method is only available for the Waiting Room Advanced - subscription. Regardless of the queueing method, if `queue_all` is enabled or an - event is prequeueing, users in the waiting room will not be accepted to the - origin. These users will always see a waiting room page that refreshes - automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - - queueing_status_code: HTTP status code returned to a user while in the queue. - - session_duration: Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - - suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the - traffic will not go to the waiting room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - body=maybe_transform( - { - "host": host, - "name": name, - "new_users_per_minute": new_users_per_minute, - "total_active_users": total_active_users, - "additional_routes": additional_routes, - "cookie_attributes": cookie_attributes, - "cookie_suffix": cookie_suffix, - "custom_page_html": custom_page_html, - "default_template_language": default_template_language, - "description": description, - "disable_session_renewal": disable_session_renewal, - "json_response_enabled": json_response_enabled, - "path": path, - "queue_all": queue_all, - "queueing_method": queueing_method, - "queueing_status_code": queueing_status_code, - "session_duration": session_duration, - "suspended": suspended, - }, - waiting_room_edit_params.WaitingRoomEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - def get( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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, - ) -> WaitingRoom: - """ - Fetches a single configured waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - -class AsyncWaitingRooms(AsyncAPIResource): - @cached_property - def page(self) -> AsyncPage: - return AsyncPage(self._client) - - @cached_property - def events(self) -> AsyncEvents: - return AsyncEvents(self._client) - - @cached_property - def rules(self) -> AsyncRules: - return AsyncRules(self._client) - - @cached_property - def statuses(self) -> AsyncStatuses: - return AsyncStatuses(self._client) - - @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) - - @cached_property - def with_raw_response(self) -> AsyncWaitingRoomsWithRawResponse: - return AsyncWaitingRoomsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWaitingRoomsWithStreamingResponse: - return AsyncWaitingRoomsWithStreamingResponse(self) - - async def create( - self, - zone_identifier: str, - *, - host: str, - name: str, - new_users_per_minute: int, - total_active_users: int, - additional_routes: Iterable[waiting_room_create_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_create_params.CookieAttributes | NotGiven = NOT_GIVEN, - cookie_suffix: str | NotGiven = NOT_GIVEN, - custom_page_html: str | NotGiven = NOT_GIVEN, - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: bool | NotGiven = NOT_GIVEN, - json_response_enabled: bool | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - queue_all: bool | NotGiven = NOT_GIVEN, - queueing_method: Literal["fifo", "random", "passthrough", "reject"] | NotGiven = NOT_GIVEN, - queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, - session_duration: int | NotGiven = NOT_GIVEN, - suspended: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingRoom: - """ - Creates a new waiting room. - - Args: - zone_identifier: Identifier - - host: The host name to which the waiting room will be applied (no wildcards). Please - do not include the scheme (http:// or https://). The host and path combination - must be unique. - - name: A unique name to identify the waiting room. Only alphanumeric characters, - hyphens and underscores are allowed. - - new_users_per_minute: Sets the number of new users that will be let into the route every minute. This - value is used as baseline for the number of users that are let in per minute. So - it is possible that there is a little more or little less traffic coming to the - route based on the traffic patterns at that time around the world. - - total_active_users: Sets the total number of active user sessions on the route at a point in time. A - route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - - additional_routes: Only available for the Waiting Room Advanced subscription. Additional hostname - and path combinations to which this waiting room will be applied. There is an - implied wildcard at the end of the path. The hostname and path combination must - be unique to this and all other waiting rooms. - - cookie_attributes: Configures cookie attributes for the waiting room cookie. This encrypted cookie - stores a user's status in the waiting room, such as queue position. - - cookie_suffix: Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - - custom_page_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - default_template_language: The language of the default page template. If no default_template_language is - provided, then `en-US` (English) will be used. - - description: A note that you can use to add more details about the waiting room. - - disable_session_renewal: Only available for the Waiting Room Advanced subscription. Disables automatic - renewal of session cookies. If `true`, an accepted user will have - session_duration minutes to browse the site. After that, they will have to go - through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - - json_response_enabled: Only available for the Waiting Room Advanced subscription. If `true`, requests - to the waiting room with the header `Accept: application/json` will receive a - JSON response object with information on the user's status in the waiting room - as opposed to the configured static HTML page. This JSON response object has one - property `cfWaitingRoom` which is an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - - path: Sets the path within the host to enable the waiting room on. The waiting room - will be enabled for all subpaths as well. If there are two waiting rooms on the - same subpath, the waiting room for the most specific path will be chosen. - Wildcards and query parameters are not supported. - - queue_all: If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - - queueing_method: Sets the queueing method used by the waiting room. Changing this parameter from - the **default** queueing method is only available for the Waiting Room Advanced - subscription. Regardless of the queueing method, if `queue_all` is enabled or an - event is prequeueing, users in the waiting room will not be accepted to the - origin. These users will always see a waiting room page that refreshes - automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - - queueing_status_code: HTTP status code returned to a user while in the queue. - - session_duration: Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - - suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the - traffic will not go to the waiting room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._post( - f"/zones/{zone_identifier}/waiting_rooms", - body=await async_maybe_transform( - { - "host": host, - "name": name, - "new_users_per_minute": new_users_per_minute, - "total_active_users": total_active_users, - "additional_routes": additional_routes, - "cookie_attributes": cookie_attributes, - "cookie_suffix": cookie_suffix, - "custom_page_html": custom_page_html, - "default_template_language": default_template_language, - "description": description, - "disable_session_renewal": disable_session_renewal, - "json_response_enabled": json_response_enabled, - "path": path, - "queue_all": queue_all, - "queueing_method": queueing_method, - "queueing_status_code": queueing_status_code, - "session_duration": session_duration, - "suspended": suspended, - }, - waiting_room_create_params.WaitingRoomCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - async def update( - self, - waiting_room_id: str, - *, - zone_identifier: str, - host: str, - name: str, - new_users_per_minute: int, - total_active_users: int, - additional_routes: Iterable[waiting_room_update_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_update_params.CookieAttributes | NotGiven = NOT_GIVEN, - cookie_suffix: str | NotGiven = NOT_GIVEN, - custom_page_html: str | NotGiven = NOT_GIVEN, - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: bool | NotGiven = NOT_GIVEN, - json_response_enabled: bool | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - queue_all: bool | NotGiven = NOT_GIVEN, - queueing_method: Literal["fifo", "random", "passthrough", "reject"] | NotGiven = NOT_GIVEN, - queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, - session_duration: int | NotGiven = NOT_GIVEN, - suspended: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingRoom: - """ - Updates a configured waiting room. - - Args: - zone_identifier: Identifier - - host: The host name to which the waiting room will be applied (no wildcards). Please - do not include the scheme (http:// or https://). The host and path combination - must be unique. - - name: A unique name to identify the waiting room. Only alphanumeric characters, - hyphens and underscores are allowed. - - new_users_per_minute: Sets the number of new users that will be let into the route every minute. This - value is used as baseline for the number of users that are let in per minute. So - it is possible that there is a little more or little less traffic coming to the - route based on the traffic patterns at that time around the world. - - total_active_users: Sets the total number of active user sessions on the route at a point in time. A - route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - - additional_routes: Only available for the Waiting Room Advanced subscription. Additional hostname - and path combinations to which this waiting room will be applied. There is an - implied wildcard at the end of the path. The hostname and path combination must - be unique to this and all other waiting rooms. - - cookie_attributes: Configures cookie attributes for the waiting room cookie. This encrypted cookie - stores a user's status in the waiting room, such as queue position. - - cookie_suffix: Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - - custom_page_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - default_template_language: The language of the default page template. If no default_template_language is - provided, then `en-US` (English) will be used. - - description: A note that you can use to add more details about the waiting room. - - disable_session_renewal: Only available for the Waiting Room Advanced subscription. Disables automatic - renewal of session cookies. If `true`, an accepted user will have - session_duration minutes to browse the site. After that, they will have to go - through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - - json_response_enabled: Only available for the Waiting Room Advanced subscription. If `true`, requests - to the waiting room with the header `Accept: application/json` will receive a - JSON response object with information on the user's status in the waiting room - as opposed to the configured static HTML page. This JSON response object has one - property `cfWaitingRoom` which is an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - - path: Sets the path within the host to enable the waiting room on. The waiting room - will be enabled for all subpaths as well. If there are two waiting rooms on the - same subpath, the waiting room for the most specific path will be chosen. - Wildcards and query parameters are not supported. - - queue_all: If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - - queueing_method: Sets the queueing method used by the waiting room. Changing this parameter from - the **default** queueing method is only available for the Waiting Room Advanced - subscription. Regardless of the queueing method, if `queue_all` is enabled or an - event is prequeueing, users in the waiting room will not be accepted to the - origin. These users will always see a waiting room page that refreshes - automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - - queueing_status_code: HTTP status code returned to a user while in the queue. - - session_duration: Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - - suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the - traffic will not go to the waiting room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._put( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - body=await async_maybe_transform( - { - "host": host, - "name": name, - "new_users_per_minute": new_users_per_minute, - "total_active_users": total_active_users, - "additional_routes": additional_routes, - "cookie_attributes": cookie_attributes, - "cookie_suffix": cookie_suffix, - "custom_page_html": custom_page_html, - "default_template_language": default_template_language, - "description": description, - "disable_session_renewal": disable_session_renewal, - "json_response_enabled": json_response_enabled, - "path": path, - "queue_all": queue_all, - "queueing_method": queueing_method, - "queueing_status_code": queueing_status_code, - "session_duration": session_duration, - "suspended": suspended, - }, - waiting_room_update_params.WaitingRoomUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - def list( - self, - zone_identifier: str, - *, - # 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[WaitingRoom, AsyncSinglePage[WaitingRoom]]: - """ - Lists waiting rooms. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get_api_list( - f"/zones/{zone_identifier}/waiting_rooms", - page=AsyncSinglePage[WaitingRoom], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WaitingRoom, - ) - - async def delete( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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, - ) -> WaitingRoomDeleteResponse: - """ - Deletes a waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._delete( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoomDeleteResponse], ResultWrapper[WaitingRoomDeleteResponse]), - ) - - async def edit( - self, - waiting_room_id: str, - *, - zone_identifier: str, - host: str, - name: str, - new_users_per_minute: int, - total_active_users: int, - additional_routes: Iterable[waiting_room_edit_params.AdditionalRoute] | NotGiven = NOT_GIVEN, - cookie_attributes: waiting_room_edit_params.CookieAttributes | NotGiven = NOT_GIVEN, - cookie_suffix: str | NotGiven = NOT_GIVEN, - custom_page_html: str | NotGiven = NOT_GIVEN, - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - disable_session_renewal: bool | NotGiven = NOT_GIVEN, - json_response_enabled: bool | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - queue_all: bool | NotGiven = NOT_GIVEN, - queueing_method: Literal["fifo", "random", "passthrough", "reject"] | NotGiven = NOT_GIVEN, - queueing_status_code: Literal[200, 202, 429] | NotGiven = NOT_GIVEN, - session_duration: int | NotGiven = NOT_GIVEN, - suspended: 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaitingRoom: - """ - Patches a configured waiting room. - - Args: - zone_identifier: Identifier - - host: The host name to which the waiting room will be applied (no wildcards). Please - do not include the scheme (http:// or https://). The host and path combination - must be unique. - - name: A unique name to identify the waiting room. Only alphanumeric characters, - hyphens and underscores are allowed. - - new_users_per_minute: Sets the number of new users that will be let into the route every minute. This - value is used as baseline for the number of users that are let in per minute. So - it is possible that there is a little more or little less traffic coming to the - route based on the traffic patterns at that time around the world. - - total_active_users: Sets the total number of active user sessions on the route at a point in time. A - route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - - additional_routes: Only available for the Waiting Room Advanced subscription. Additional hostname - and path combinations to which this waiting room will be applied. There is an - implied wildcard at the end of the path. The hostname and path combination must - be unique to this and all other waiting rooms. - - cookie_attributes: Configures cookie attributes for the waiting room cookie. This encrypted cookie - stores a user's status in the waiting room, such as queue position. - - cookie_suffix: Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - - custom_page_html: Only available for the Waiting Room Advanced subscription. This is a template - html file that will be rendered at the edge. If no custom_page_html is provided, - the default waiting room will be used. The template is based on mustache ( - https://mustache.github.io/ ). There are several variables that are evaluated by - the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - - default_template_language: The language of the default page template. If no default_template_language is - provided, then `en-US` (English) will be used. - - description: A note that you can use to add more details about the waiting room. - - disable_session_renewal: Only available for the Waiting Room Advanced subscription. Disables automatic - renewal of session cookies. If `true`, an accepted user will have - session_duration minutes to browse the site. After that, they will have to go - through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - - json_response_enabled: Only available for the Waiting Room Advanced subscription. If `true`, requests - to the waiting room with the header `Accept: application/json` will receive a - JSON response object with information on the user's status in the waiting room - as opposed to the configured static HTML page. This JSON response object has one - property `cfWaitingRoom` which is an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - - path: Sets the path within the host to enable the waiting room on. The waiting room - will be enabled for all subpaths as well. If there are two waiting rooms on the - same subpath, the waiting room for the most specific path will be chosen. - Wildcards and query parameters are not supported. - - queue_all: If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - - queueing_method: Sets the queueing method used by the waiting room. Changing this parameter from - the **default** queueing method is only available for the Waiting Room Advanced - subscription. Regardless of the queueing method, if `queue_all` is enabled or an - event is prequeueing, users in the waiting room will not be accepted to the - origin. These users will always see a waiting room page that refreshes - automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - - queueing_status_code: HTTP status code returned to a user while in the queue. - - session_duration: Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - - suspended: Suspends or allows traffic going to the waiting room. If set to `true`, the - traffic will not go to the waiting room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._patch( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - body=await async_maybe_transform( - { - "host": host, - "name": name, - "new_users_per_minute": new_users_per_minute, - "total_active_users": total_active_users, - "additional_routes": additional_routes, - "cookie_attributes": cookie_attributes, - "cookie_suffix": cookie_suffix, - "custom_page_html": custom_page_html, - "default_template_language": default_template_language, - "description": description, - "disable_session_renewal": disable_session_renewal, - "json_response_enabled": json_response_enabled, - "path": path, - "queue_all": queue_all, - "queueing_method": queueing_method, - "queueing_status_code": queueing_status_code, - "session_duration": session_duration, - "suspended": suspended, - }, - waiting_room_edit_params.WaitingRoomEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - async def get( - self, - waiting_room_id: str, - *, - zone_identifier: str, - # 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, - ) -> WaitingRoom: - """ - Fetches a single configured waiting room. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not waiting_room_id: - raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._get( - f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), - ) - - -class WaitingRoomsWithRawResponse: - def __init__(self, waiting_rooms: WaitingRooms) -> None: - self._waiting_rooms = waiting_rooms - - self.create = to_raw_response_wrapper( - waiting_rooms.create, - ) - self.update = to_raw_response_wrapper( - waiting_rooms.update, - ) - self.list = to_raw_response_wrapper( - waiting_rooms.list, - ) - self.delete = to_raw_response_wrapper( - waiting_rooms.delete, - ) - self.edit = to_raw_response_wrapper( - waiting_rooms.edit, - ) - self.get = to_raw_response_wrapper( - waiting_rooms.get, - ) - - @cached_property - def page(self) -> PageWithRawResponse: - return PageWithRawResponse(self._waiting_rooms.page) - - @cached_property - def events(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self._waiting_rooms.events) - - @cached_property - def rules(self) -> RulesWithRawResponse: - return RulesWithRawResponse(self._waiting_rooms.rules) - - @cached_property - def statuses(self) -> StatusesWithRawResponse: - return StatusesWithRawResponse(self._waiting_rooms.statuses) - - @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._waiting_rooms.settings) - - -class AsyncWaitingRoomsWithRawResponse: - def __init__(self, waiting_rooms: AsyncWaitingRooms) -> None: - self._waiting_rooms = waiting_rooms - - self.create = async_to_raw_response_wrapper( - waiting_rooms.create, - ) - self.update = async_to_raw_response_wrapper( - waiting_rooms.update, - ) - self.list = async_to_raw_response_wrapper( - waiting_rooms.list, - ) - self.delete = async_to_raw_response_wrapper( - waiting_rooms.delete, - ) - self.edit = async_to_raw_response_wrapper( - waiting_rooms.edit, - ) - self.get = async_to_raw_response_wrapper( - waiting_rooms.get, - ) - - @cached_property - def page(self) -> AsyncPageWithRawResponse: - return AsyncPageWithRawResponse(self._waiting_rooms.page) - - @cached_property - def events(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self._waiting_rooms.events) - - @cached_property - def rules(self) -> AsyncRulesWithRawResponse: - return AsyncRulesWithRawResponse(self._waiting_rooms.rules) - - @cached_property - def statuses(self) -> AsyncStatusesWithRawResponse: - return AsyncStatusesWithRawResponse(self._waiting_rooms.statuses) - - @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._waiting_rooms.settings) - - -class WaitingRoomsWithStreamingResponse: - def __init__(self, waiting_rooms: WaitingRooms) -> None: - self._waiting_rooms = waiting_rooms - - self.create = to_streamed_response_wrapper( - waiting_rooms.create, - ) - self.update = to_streamed_response_wrapper( - waiting_rooms.update, - ) - self.list = to_streamed_response_wrapper( - waiting_rooms.list, - ) - self.delete = to_streamed_response_wrapper( - waiting_rooms.delete, - ) - self.edit = to_streamed_response_wrapper( - waiting_rooms.edit, - ) - self.get = to_streamed_response_wrapper( - waiting_rooms.get, - ) - - @cached_property - def page(self) -> PageWithStreamingResponse: - return PageWithStreamingResponse(self._waiting_rooms.page) - - @cached_property - def events(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self._waiting_rooms.events) - - @cached_property - def rules(self) -> RulesWithStreamingResponse: - return RulesWithStreamingResponse(self._waiting_rooms.rules) - - @cached_property - def statuses(self) -> StatusesWithStreamingResponse: - return StatusesWithStreamingResponse(self._waiting_rooms.statuses) - - @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._waiting_rooms.settings) - - -class AsyncWaitingRoomsWithStreamingResponse: - def __init__(self, waiting_rooms: AsyncWaitingRooms) -> None: - self._waiting_rooms = waiting_rooms - - self.create = async_to_streamed_response_wrapper( - waiting_rooms.create, - ) - self.update = async_to_streamed_response_wrapper( - waiting_rooms.update, - ) - self.list = async_to_streamed_response_wrapper( - waiting_rooms.list, - ) - self.delete = async_to_streamed_response_wrapper( - waiting_rooms.delete, - ) - self.edit = async_to_streamed_response_wrapper( - waiting_rooms.edit, - ) - self.get = async_to_streamed_response_wrapper( - waiting_rooms.get, - ) - - @cached_property - def page(self) -> AsyncPageWithStreamingResponse: - return AsyncPageWithStreamingResponse(self._waiting_rooms.page) - - @cached_property - def events(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self._waiting_rooms.events) - - @cached_property - def rules(self) -> AsyncRulesWithStreamingResponse: - return AsyncRulesWithStreamingResponse(self._waiting_rooms.rules) - - @cached_property - def statuses(self) -> AsyncStatusesWithStreamingResponse: - return AsyncStatusesWithStreamingResponse(self._waiting_rooms.statuses) - - @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._waiting_rooms.settings) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 9d99cc14a2a..2a14d439e90 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -13,7 +13,6 @@ from .membership import Membership as Membership from .healthcheck import Healthcheck as Healthcheck from .jdcloud_ips import JDCloudIPs as JDCloudIPs -from .waiting_room import WaitingRoom as WaitingRoom from .load_balancer import LoadBalancer as LoadBalancer from .stream_videos import StreamVideos as StreamVideos from .ip_list_params import IPListParams as IPListParams @@ -97,7 +96,6 @@ from .rate_limit_edit_response import RateLimitEditResponse as RateLimitEditResponse from .rate_limit_list_response import RateLimitListResponse as RateLimitListResponse from .speed_trends_list_params import SpeedTrendsListParams as SpeedTrendsListParams -from .waiting_room_edit_params import WaitingRoomEditParams as WaitingRoomEditParams from .healthcheck_create_params import HealthcheckCreateParams as HealthcheckCreateParams from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams from .intel_phishing_url_submit import IntelPhishingURLSubmit as IntelPhishingURLSubmit @@ -115,8 +113,6 @@ from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams -from .waiting_room_create_params import WaitingRoomCreateParams as WaitingRoomCreateParams -from .waiting_room_update_params import WaitingRoomUpdateParams as WaitingRoomUpdateParams from .warp_connector_edit_params import WARPConnectorEditParams as WARPConnectorEditParams from .warp_connector_list_params import WARPConnectorListParams as WARPConnectorListParams from .bot_management_get_response import BotManagementGetResponse as BotManagementGetResponse @@ -135,7 +131,6 @@ from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse from .subscription_delete_response import SubscriptionDeleteResponse as SubscriptionDeleteResponse from .subscription_update_response import SubscriptionUpdateResponse as SubscriptionUpdateResponse -from .waiting_room_delete_response import WaitingRoomDeleteResponse as WaitingRoomDeleteResponse from .warp_connector_create_params import WARPConnectorCreateParams as WARPConnectorCreateParams from .warp_connector_delete_params import WARPConnectorDeleteParams as WARPConnectorDeleteParams from .warp_connector_edit_response import WARPConnectorEditResponse as WARPConnectorEditResponse diff --git a/src/cloudflare/types/waiting_room.py b/src/cloudflare/types/waiting_room.py deleted file mode 100644 index 7c45f1f0099..00000000000 --- a/src/cloudflare/types/waiting_room.py +++ /dev/null @@ -1,388 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["WaitingRoom", "AdditionalRoute", "CookieAttributes"] - - -class AdditionalRoute(BaseModel): - host: Optional[str] = None - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: Optional[str] = None - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(BaseModel): - samesite: Optional[Literal["auto", "lax", "none", "strict"]] = None - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Optional[Literal["auto", "always", "never"]] = None - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ - - -class WaitingRoom(BaseModel): - id: Optional[str] = None - - additional_routes: Optional[List[AdditionalRoute]] = None - """Only available for the Waiting Room Advanced subscription. - - Additional hostname and path combinations to which this waiting room will be - applied. There is an implied wildcard at the end of the path. The hostname and - path combination must be unique to this and all other waiting rooms. - """ - - cookie_attributes: Optional[CookieAttributes] = None - """Configures cookie attributes for the waiting room cookie. - - This encrypted cookie stores a user's status in the waiting room, such as queue - position. - """ - - cookie_suffix: Optional[str] = None - """ - Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - """ - - created_on: Optional[datetime] = None - - custom_page_html: Optional[str] = None - """Only available for the Waiting Room Advanced subscription. - - This is a template html file that will be rendered at the edge. If no - custom_page_html is provided, the default waiting room will be used. The - template is based on mustache ( https://mustache.github.io/ ). There are several - variables that are evaluated by the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - """ - - default_template_language: Optional[ - Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - ] = None - """The language of the default page template. - - If no default_template_language is provided, then `en-US` (English) will be - used. - """ - - description: Optional[str] = None - """A note that you can use to add more details about the waiting room.""" - - disable_session_renewal: Optional[bool] = None - """Only available for the Waiting Room Advanced subscription. - - Disables automatic renewal of session cookies. If `true`, an accepted user will - have session_duration minutes to browse the site. After that, they will have to - go through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - """ - - host: Optional[str] = None - """The host name to which the waiting room will be applied (no wildcards). - - Please do not include the scheme (http:// or https://). The host and path - combination must be unique. - """ - - json_response_enabled: Optional[bool] = None - """Only available for the Waiting Room Advanced subscription. - - If `true`, requests to the waiting room with the header - `Accept: application/json` will receive a JSON response object with information - on the user's status in the waiting room as opposed to the configured static - HTML page. This JSON response object has one property `cfWaitingRoom` which is - an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A unique name to identify the waiting room. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Optional[int] = None - """Sets the number of new users that will be let into the route every minute. - - This value is used as baseline for the number of users that are let in per - minute. So it is possible that there is a little more or little less traffic - coming to the route based on the traffic patterns at that time around the world. - """ - - next_event_prequeue_start_time: Optional[str] = None - """An ISO 8601 timestamp that marks when the next event will begin queueing.""" - - next_event_start_time: Optional[str] = None - """An ISO 8601 timestamp that marks when the next event will start.""" - - path: Optional[str] = None - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - queue_all: Optional[bool] = None - """ - If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - """ - - queueing_method: Optional[Literal["fifo", "random", "passthrough", "reject"]] = None - """Sets the queueing method used by the waiting room. - - Changing this parameter from the **default** queueing method is only available - for the Waiting Room Advanced subscription. Regardless of the queueing method, - if `queue_all` is enabled or an event is prequeueing, users in the waiting room - will not be accepted to the origin. These users will always see a waiting room - page that refreshes automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - """ - - queueing_status_code: Optional[Literal[200, 202, 429]] = None - """HTTP status code returned to a user while in the queue.""" - - session_duration: Optional[int] = None - """ - Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - """ - - suspended: Optional[bool] = None - """Suspends or allows traffic going to the waiting room. - - If set to `true`, the traffic will not go to the waiting room. - """ - - total_active_users: Optional[int] = None - """Sets the total number of active user sessions on the route at a point in time. - - A route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - """ diff --git a/src/cloudflare/types/waiting_room_create_params.py b/src/cloudflare/types/waiting_room_create_params.py deleted file mode 100644 index 175b8436280..00000000000 --- a/src/cloudflare/types/waiting_room_create_params.py +++ /dev/null @@ -1,373 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["WaitingRoomCreateParams", "AdditionalRoute", "CookieAttributes"] - - -class WaitingRoomCreateParams(TypedDict, total=False): - host: Required[str] - """The host name to which the waiting room will be applied (no wildcards). - - Please do not include the scheme (http:// or https://). The host and path - combination must be unique. - """ - - name: Required[str] - """A unique name to identify the waiting room. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Required[int] - """Sets the number of new users that will be let into the route every minute. - - This value is used as baseline for the number of users that are let in per - minute. So it is possible that there is a little more or little less traffic - coming to the route based on the traffic patterns at that time around the world. - """ - - total_active_users: Required[int] - """Sets the total number of active user sessions on the route at a point in time. - - A route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - """ - - additional_routes: Iterable[AdditionalRoute] - """Only available for the Waiting Room Advanced subscription. - - Additional hostname and path combinations to which this waiting room will be - applied. There is an implied wildcard at the end of the path. The hostname and - path combination must be unique to this and all other waiting rooms. - """ - - cookie_attributes: CookieAttributes - """Configures cookie attributes for the waiting room cookie. - - This encrypted cookie stores a user's status in the waiting room, such as queue - position. - """ - - cookie_suffix: str - """ - Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - """ - - custom_page_html: str - """Only available for the Waiting Room Advanced subscription. - - This is a template html file that will be rendered at the edge. If no - custom_page_html is provided, the default waiting room will be used. The - template is based on mustache ( https://mustache.github.io/ ). There are several - variables that are evaluated by the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - """ - - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - """The language of the default page template. - - If no default_template_language is provided, then `en-US` (English) will be - used. - """ - - description: str - """A note that you can use to add more details about the waiting room.""" - - disable_session_renewal: bool - """Only available for the Waiting Room Advanced subscription. - - Disables automatic renewal of session cookies. If `true`, an accepted user will - have session_duration minutes to browse the site. After that, they will have to - go through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - """ - - json_response_enabled: bool - """Only available for the Waiting Room Advanced subscription. - - If `true`, requests to the waiting room with the header - `Accept: application/json` will receive a JSON response object with information - on the user's status in the waiting room as opposed to the configured static - HTML page. This JSON response object has one property `cfWaitingRoom` which is - an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - queue_all: bool - """ - If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - """ - - queueing_method: Literal["fifo", "random", "passthrough", "reject"] - """Sets the queueing method used by the waiting room. - - Changing this parameter from the **default** queueing method is only available - for the Waiting Room Advanced subscription. Regardless of the queueing method, - if `queue_all` is enabled or an event is prequeueing, users in the waiting room - will not be accepted to the origin. These users will always see a waiting room - page that refreshes automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - """ - - queueing_status_code: Literal[200, 202, 429] - """HTTP status code returned to a user while in the queue.""" - - session_duration: int - """ - Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - """ - - suspended: bool - """Suspends or allows traffic going to the waiting room. - - If set to `true`, the traffic will not go to the waiting room. - """ - - -class AdditionalRoute(TypedDict, total=False): - host: str - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(TypedDict, total=False): - samesite: Literal["auto", "lax", "none", "strict"] - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Literal["auto", "always", "never"] - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ diff --git a/src/cloudflare/types/waiting_room_delete_response.py b/src/cloudflare/types/waiting_room_delete_response.py deleted file mode 100644 index 75446852d17..00000000000 --- a/src/cloudflare/types/waiting_room_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["WaitingRoomDeleteResponse"] - - -class WaitingRoomDeleteResponse(BaseModel): - id: Optional[str] = None diff --git a/src/cloudflare/types/waiting_room_edit_params.py b/src/cloudflare/types/waiting_room_edit_params.py deleted file mode 100644 index 15b838a5acb..00000000000 --- a/src/cloudflare/types/waiting_room_edit_params.py +++ /dev/null @@ -1,376 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["WaitingRoomEditParams", "AdditionalRoute", "CookieAttributes"] - - -class WaitingRoomEditParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - host: Required[str] - """The host name to which the waiting room will be applied (no wildcards). - - Please do not include the scheme (http:// or https://). The host and path - combination must be unique. - """ - - name: Required[str] - """A unique name to identify the waiting room. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Required[int] - """Sets the number of new users that will be let into the route every minute. - - This value is used as baseline for the number of users that are let in per - minute. So it is possible that there is a little more or little less traffic - coming to the route based on the traffic patterns at that time around the world. - """ - - total_active_users: Required[int] - """Sets the total number of active user sessions on the route at a point in time. - - A route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - """ - - additional_routes: Iterable[AdditionalRoute] - """Only available for the Waiting Room Advanced subscription. - - Additional hostname and path combinations to which this waiting room will be - applied. There is an implied wildcard at the end of the path. The hostname and - path combination must be unique to this and all other waiting rooms. - """ - - cookie_attributes: CookieAttributes - """Configures cookie attributes for the waiting room cookie. - - This encrypted cookie stores a user's status in the waiting room, such as queue - position. - """ - - cookie_suffix: str - """ - Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - """ - - custom_page_html: str - """Only available for the Waiting Room Advanced subscription. - - This is a template html file that will be rendered at the edge. If no - custom_page_html is provided, the default waiting room will be used. The - template is based on mustache ( https://mustache.github.io/ ). There are several - variables that are evaluated by the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - """ - - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - """The language of the default page template. - - If no default_template_language is provided, then `en-US` (English) will be - used. - """ - - description: str - """A note that you can use to add more details about the waiting room.""" - - disable_session_renewal: bool - """Only available for the Waiting Room Advanced subscription. - - Disables automatic renewal of session cookies. If `true`, an accepted user will - have session_duration minutes to browse the site. After that, they will have to - go through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - """ - - json_response_enabled: bool - """Only available for the Waiting Room Advanced subscription. - - If `true`, requests to the waiting room with the header - `Accept: application/json` will receive a JSON response object with information - on the user's status in the waiting room as opposed to the configured static - HTML page. This JSON response object has one property `cfWaitingRoom` which is - an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - queue_all: bool - """ - If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - """ - - queueing_method: Literal["fifo", "random", "passthrough", "reject"] - """Sets the queueing method used by the waiting room. - - Changing this parameter from the **default** queueing method is only available - for the Waiting Room Advanced subscription. Regardless of the queueing method, - if `queue_all` is enabled or an event is prequeueing, users in the waiting room - will not be accepted to the origin. These users will always see a waiting room - page that refreshes automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - """ - - queueing_status_code: Literal[200, 202, 429] - """HTTP status code returned to a user while in the queue.""" - - session_duration: int - """ - Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - """ - - suspended: bool - """Suspends or allows traffic going to the waiting room. - - If set to `true`, the traffic will not go to the waiting room. - """ - - -class AdditionalRoute(TypedDict, total=False): - host: str - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(TypedDict, total=False): - samesite: Literal["auto", "lax", "none", "strict"] - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Literal["auto", "always", "never"] - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ diff --git a/src/cloudflare/types/waiting_room_update_params.py b/src/cloudflare/types/waiting_room_update_params.py deleted file mode 100644 index dd73542e4a4..00000000000 --- a/src/cloudflare/types/waiting_room_update_params.py +++ /dev/null @@ -1,376 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["WaitingRoomUpdateParams", "AdditionalRoute", "CookieAttributes"] - - -class WaitingRoomUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - host: Required[str] - """The host name to which the waiting room will be applied (no wildcards). - - Please do not include the scheme (http:// or https://). The host and path - combination must be unique. - """ - - name: Required[str] - """A unique name to identify the waiting room. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Required[int] - """Sets the number of new users that will be let into the route every minute. - - This value is used as baseline for the number of users that are let in per - minute. So it is possible that there is a little more or little less traffic - coming to the route based on the traffic patterns at that time around the world. - """ - - total_active_users: Required[int] - """Sets the total number of active user sessions on the route at a point in time. - - A route is a combination of host and path on which a waiting room is available. - This value is used as a baseline for the total number of active user sessions on - the route. It is possible to have a situation where there are more or less - active users sessions on the route based on the traffic patterns at that time - around the world. - """ - - additional_routes: Iterable[AdditionalRoute] - """Only available for the Waiting Room Advanced subscription. - - Additional hostname and path combinations to which this waiting room will be - applied. There is an implied wildcard at the end of the path. The hostname and - path combination must be unique to this and all other waiting rooms. - """ - - cookie_attributes: CookieAttributes - """Configures cookie attributes for the waiting room cookie. - - This encrypted cookie stores a user's status in the waiting room, such as queue - position. - """ - - cookie_suffix: str - """ - Appends a '\\__' + a custom suffix to the end of Cloudflare Waiting Room's cookie - name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - """ - - custom_page_html: str - """Only available for the Waiting Room Advanced subscription. - - This is a template html file that will be rendered at the edge. If no - custom_page_html is provided, the default waiting room will be used. The - template is based on mustache ( https://mustache.github.io/ ). There are several - variables that are evaluated by the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - """ - - default_template_language: Literal[ - "en-US", - "es-ES", - "de-DE", - "fr-FR", - "it-IT", - "ja-JP", - "ko-KR", - "pt-BR", - "zh-CN", - "zh-TW", - "nl-NL", - "pl-PL", - "id-ID", - "tr-TR", - "ar-EG", - "ru-RU", - "fa-IR", - ] - """The language of the default page template. - - If no default_template_language is provided, then `en-US` (English) will be - used. - """ - - description: str - """A note that you can use to add more details about the waiting room.""" - - disable_session_renewal: bool - """Only available for the Waiting Room Advanced subscription. - - Disables automatic renewal of session cookies. If `true`, an accepted user will - have session_duration minutes to browse the site. After that, they will have to - go through the waiting room again. If `false`, a user's session cookie will be - automatically renewed on every request. - """ - - json_response_enabled: bool - """Only available for the Waiting Room Advanced subscription. - - If `true`, requests to the waiting room with the header - `Accept: application/json` will receive a JSON response object with information - on the user's status in the waiting room as opposed to the configured static - HTML page. This JSON response object has one property `cfWaitingRoom` which is - an object containing the following fields: - - 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - (always **true**). - 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - accurate. If **false**, they are not available. - 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - the current estimated time in minutes the user will wait in the waiting room. - When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 25% of users that gain entry the fastest (25th percentile). - 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 50% of users that gain entry the fastest (50th percentile). - In other words, half of the queued users are expected to let into the origin - website before `waitTime50Percentile` and half are expected to be let in - after it. - 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - wait time for the 75% of users that gain entry the fastest (75th percentile). - 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - **unavailable**. - 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - full and not accepting new users at the moment. - 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - room and no one will be let into the origin website. - 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - user's last attempt to leave the waiting room and be let into the origin - website. The user is able to make another attempt after - `refreshIntervalSeconds` past this time. If the user makes a request too - soon, it will be ignored and `lastUpdated` will not change. - 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - `lastUpdated` until the user is able to make another attempt to leave the - waiting room and be let into the origin website. When the `queueingMethod` - is `reject`, there is no specified refresh time — it will always be - **zero**. - 12. `queueingMethod`: The queueing method currently used by the waiting room. It - is either **fifo**, **random**, **passthrough**, or **reject**. - 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - (First-In-First-Out) queue. - 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - where users gain access randomly. - 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - passthrough queue. Keep in mind that when passthrough is enabled, this JSON - response will only exist when `queueAll` is **true** or `isEventPrequeueing` - is **true** because in all other cases requests will go directly to the - origin. - 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - 17. `isEventActive`: Boolean indicating if an event is currently occurring. - Events are able to change a waiting room's behavior during a specified - period of time. For additional information, look at the event properties - `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - documentation for creating waiting room events. Events are considered active - between these start and end times, as well as during the prequeueing period - if it exists. - 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - indicating if an event is currently prequeueing users before it starts. - 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - Integer indicating the number of minutes until the event starts. - 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - formatted in English for users. If `isEventPrequeueing` is **false**, - `timeUntilEventStartFormatted` will display **unavailable**. - 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - indicating the number of minutes until the event ends. - 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - formatted in English for users. If `isEventActive` is **false**, - `timeUntilEventEndFormatted` will display **unavailable**. - 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - indicating if the users in the prequeue are shuffled randomly when the event - starts. - - An example cURL to a waiting room could be: - - curl -X GET "https://example.com/waitingroom" \\ - -H "Accept: application/json" - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **fifo** and no event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 0, - "waitTime50Percentile": 0, - "waitTime75Percentile": 0, - "waitTimeFormatted": "10 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "fifo", - "isFIFOQueue": true, - "isRandomQueue": false, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": false, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 0, - "timeUntilEventEndFormatted": "unavailable", - "shuffleAtEventStart": false - } - } - - If `json_response_enabled` is **true** and the request hits the waiting room, an - example JSON response when `queueingMethod` is **random** and an event is active - could be: - - { - "cfWaitingRoom": { - "inWaitingRoom": true, - "waitTimeKnown": true, - "waitTime": 10, - "waitTime25Percentile": 5, - "waitTime50Percentile": 10, - "waitTime75Percentile": 15, - "waitTimeFormatted": "5 minutes to 15 minutes", - "queueIsFull": false, - "queueAll": false, - "lastUpdated": "2020-08-03T23:46:00.000Z", - "refreshIntervalSeconds": 20, - "queueingMethod": "random", - "isFIFOQueue": false, - "isRandomQueue": true, - "isPassthroughQueue": false, - "isRejectQueue": false, - "isEventActive": true, - "isEventPrequeueing": false, - "timeUntilEventStart": 0, - "timeUntilEventStartFormatted": "unavailable", - "timeUntilEventEnd": 15, - "timeUntilEventEndFormatted": "15 minutes", - "shuffleAtEventStart": true - } - }. - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - queue_all: bool - """ - If queue_all is `true`, all the traffic that is coming to a route will be sent - to the waiting room. No new traffic can get to the route once this field is set - and estimated time will become unavailable. - """ - - queueing_method: Literal["fifo", "random", "passthrough", "reject"] - """Sets the queueing method used by the waiting room. - - Changing this parameter from the **default** queueing method is only available - for the Waiting Room Advanced subscription. Regardless of the queueing method, - if `queue_all` is enabled or an event is prequeueing, users in the waiting room - will not be accepted to the origin. These users will always see a waiting room - page that refreshes automatically. The valid queueing methods are: - - 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - the order they arrived. - 2. `random`: Random queue where customers gain access randomly, regardless of - arrival time. - 3. `passthrough`: Users will pass directly through the waiting room and into the - origin website. As a result, any configured limits will not be respected - while this is enabled. This method can be used as an alternative to disabling - a waiting room (with `suspended`) so that analytics are still reported. This - can be used if you wish to allow all traffic normally, but want to restrict - traffic during a waiting room event, or vice versa. - 4. `reject`: Users will be immediately rejected from the waiting room. As a - result, no users will reach the origin website while this is enabled. This - can be used if you wish to reject all traffic while performing maintenance, - block traffic during a specified period of time (an event), or block traffic - while events are not occurring. Consider a waiting room used for vaccine - distribution that only allows traffic during sign-up events, and otherwise - blocks all traffic. For this case, the waiting room uses `reject`, and its - events override this with `fifo`, `random`, or `passthrough`. When this - queueing method is enabled and neither `queueAll` is enabled nor an event is - prequeueing, the waiting room page **will not refresh automatically**. - """ - - queueing_status_code: Literal[200, 202, 429] - """HTTP status code returned to a user while in the queue.""" - - session_duration: int - """ - Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - the route. If a user is not seen by Cloudflare again in that time period, they - will be treated as a new user that visits the route. - """ - - suspended: bool - """Suspends or allows traffic going to the waiting room. - - If set to `true`, the traffic will not go to the waiting room. - """ - - -class AdditionalRoute(TypedDict, total=False): - host: str - """The hostname to which this waiting room will be applied (no wildcards). - - The hostname must be the primary domain, subdomain, or custom hostname (if using - SSL for SaaS) of this zone. Please do not include the scheme (http:// or - https://). - """ - - path: str - """Sets the path within the host to enable the waiting room on. - - The waiting room will be enabled for all subpaths as well. If there are two - waiting rooms on the same subpath, the waiting room for the most specific path - will be chosen. Wildcards and query parameters are not supported. - """ - - -class CookieAttributes(TypedDict, total=False): - samesite: Literal["auto", "lax", "none", "strict"] - """Configures the SameSite attribute on the waiting room cookie. - - Value `auto` will be translated to `lax` or `none` depending if **Always Use - HTTPS** is enabled. Note that when using value `none`, the secure attribute - cannot be set to `never`. - """ - - secure: Literal["auto", "always", "never"] - """Configures the Secure attribute on the waiting room cookie. - - Value `always` indicates that the Secure attribute will be set in the Set-Cookie - header, `never` indicates that the Secure attribute will not be set, and `auto` - will set the Secure attribute depending if **Always Use HTTPS** is enabled. - """ diff --git a/src/cloudflare/types/waiting_rooms/__init__.py b/src/cloudflare/types/waiting_rooms/__init__.py index 0ca5f4aadf1..f8ee8b14b1c 100644 --- a/src/cloudflare/types/waiting_rooms/__init__.py +++ b/src/cloudflare/types/waiting_rooms/__init__.py @@ -1,25 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .rule_edit_params import RuleEditParams as RuleEditParams -from .waitingroom_rule import WaitingroomRule as WaitingroomRule -from .event_edit_params import EventEditParams as EventEditParams -from .waitingroom_event import WaitingroomEvent as WaitingroomEvent -from .rule_create_params import RuleCreateParams as RuleCreateParams -from .rule_edit_response import RuleEditResponse as RuleEditResponse -from .rule_update_params import RuleUpdateParams as RuleUpdateParams -from .event_create_params import EventCreateParams as EventCreateParams -from .event_update_params import EventUpdateParams as EventUpdateParams -from .page_preview_params import PagePreviewParams as PagePreviewParams -from .setting_edit_params import SettingEditParams as SettingEditParams -from .status_get_response import StatusGetResponse as StatusGetResponse -from .rule_create_response import RuleCreateResponse as RuleCreateResponse -from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse -from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse -from .setting_get_response import SettingGetResponse as SettingGetResponse -from .event_delete_response import EventDeleteResponse as EventDeleteResponse -from .page_preview_response import PagePreviewResponse as PagePreviewResponse -from .setting_edit_response import SettingEditResponse as SettingEditResponse -from .setting_update_params import SettingUpdateParams as SettingUpdateParams -from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse diff --git a/src/cloudflare/types/waiting_rooms/event_create_params.py b/src/cloudflare/types/waiting_rooms/event_create_params.py deleted file mode 100644 index 202372165ea..00000000000 --- a/src/cloudflare/types/waiting_rooms/event_create_params.py +++ /dev/null @@ -1,94 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["EventCreateParams"] - - -class EventCreateParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - event_end_time: Required[str] - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Required[str] - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - name: Required[str] - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - custom_page_html: Optional[str] - """ - If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - """ - - description: str - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] - """ - If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - """ - - new_users_per_minute: Optional[int] - """ - If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - """ - - prequeue_start_time: Optional[str] - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] - """ - If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - """ - - session_duration: Optional[int] - """ - If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - """ - - shuffle_at_event_start: bool - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: bool - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] - """ - If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - """ diff --git a/src/cloudflare/types/waiting_rooms/event_delete_response.py b/src/cloudflare/types/waiting_rooms/event_delete_response.py deleted file mode 100644 index f9e72e340ef..00000000000 --- a/src/cloudflare/types/waiting_rooms/event_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["EventDeleteResponse"] - - -class EventDeleteResponse(BaseModel): - id: Optional[str] = None diff --git a/src/cloudflare/types/waiting_rooms/event_edit_params.py b/src/cloudflare/types/waiting_rooms/event_edit_params.py deleted file mode 100644 index 681f80ae773..00000000000 --- a/src/cloudflare/types/waiting_rooms/event_edit_params.py +++ /dev/null @@ -1,96 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["EventEditParams"] - - -class EventEditParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - waiting_room_id: Required[str] - - event_end_time: Required[str] - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Required[str] - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - name: Required[str] - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - custom_page_html: Optional[str] - """ - If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - """ - - description: str - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] - """ - If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - """ - - new_users_per_minute: Optional[int] - """ - If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - """ - - prequeue_start_time: Optional[str] - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] - """ - If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - """ - - session_duration: Optional[int] - """ - If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - """ - - shuffle_at_event_start: bool - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: bool - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] - """ - If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - """ diff --git a/src/cloudflare/types/waiting_rooms/event_update_params.py b/src/cloudflare/types/waiting_rooms/event_update_params.py deleted file mode 100644 index eb2da5bd225..00000000000 --- a/src/cloudflare/types/waiting_rooms/event_update_params.py +++ /dev/null @@ -1,96 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["EventUpdateParams"] - - -class EventUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - waiting_room_id: Required[str] - - event_end_time: Required[str] - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Required[str] - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - name: Required[str] - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - custom_page_html: Optional[str] - """ - If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - """ - - description: str - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] - """ - If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - """ - - new_users_per_minute: Optional[int] - """ - If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - """ - - prequeue_start_time: Optional[str] - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] - """ - If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - """ - - session_duration: Optional[int] - """ - If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - """ - - shuffle_at_event_start: bool - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: bool - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] - """ - If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - """ diff --git a/src/cloudflare/types/waiting_rooms/events/__init__.py b/src/cloudflare/types/waiting_rooms/events/__init__.py index cbaf1d11ff9..f8ee8b14b1c 100644 --- a/src/cloudflare/types/waiting_rooms/events/__init__.py +++ b/src/cloudflare/types/waiting_rooms/events/__init__.py @@ -1,5 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .waitingroom_event_details import WaitingroomEventDetails as WaitingroomEventDetails diff --git a/src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py b/src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py deleted file mode 100644 index c366a49bc46..00000000000 --- a/src/cloudflare/types/waiting_rooms/events/waitingroom_event_details.py +++ /dev/null @@ -1,71 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["WaitingroomEventDetails"] - - -class WaitingroomEventDetails(BaseModel): - id: Optional[str] = None - - created_on: Optional[datetime] = None - - custom_page_html: Optional[str] = None - - description: Optional[str] = None - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] = None - - event_end_time: Optional[str] = None - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Optional[str] = None - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Optional[int] = None - - prequeue_start_time: Optional[str] = None - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] = None - - session_duration: Optional[int] = None - - shuffle_at_event_start: Optional[bool] = None - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: Optional[bool] = None - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] = None diff --git a/src/cloudflare/types/waiting_rooms/page_preview_params.py b/src/cloudflare/types/waiting_rooms/page_preview_params.py deleted file mode 100644 index abad091d6b5..00000000000 --- a/src/cloudflare/types/waiting_rooms/page_preview_params.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["PagePreviewParams"] - - -class PagePreviewParams(TypedDict, total=False): - custom_html: Required[str] - """Only available for the Waiting Room Advanced subscription. - - This is a template html file that will be rendered at the edge. If no - custom_page_html is provided, the default waiting room will be used. The - template is based on mustache ( https://mustache.github.io/ ). There are several - variables that are evaluated by the Cloudflare edge: - - 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - take when wait time is not available, for instance when queue_all is - **true**. - 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - minutes. Alternatively, you can use: - 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - (`Math.floor(waitTime/60)`). - 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - (`waitTime%60`). - 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - queue. - - To view the full list of variables, look at the `cfWaitingRoom` object described - under the `json_response_enabled` property in other Waiting Room API calls. - """ diff --git a/src/cloudflare/types/waiting_rooms/page_preview_response.py b/src/cloudflare/types/waiting_rooms/page_preview_response.py deleted file mode 100644 index 04279415712..00000000000 --- a/src/cloudflare/types/waiting_rooms/page_preview_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["PagePreviewResponse"] - - -class PagePreviewResponse(BaseModel): - preview_url: Optional[str] = None - """URL where the custom waiting room page can temporarily be previewed.""" diff --git a/src/cloudflare/types/waiting_rooms/rule_create_params.py b/src/cloudflare/types/waiting_rooms/rule_create_params.py deleted file mode 100644 index 6460270cab9..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_create_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["RuleCreateParams"] - - -class RuleCreateParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - action: Required[Literal["bypass_waiting_room"]] - """The action to take when the expression matches.""" - - expression: Required[str] - """Criteria defining when there is a match for the current rule.""" - - description: str - """The description of the rule.""" - - enabled: bool - """When set to true, the rule is enabled.""" diff --git a/src/cloudflare/types/waiting_rooms/rule_create_response.py b/src/cloudflare/types/waiting_rooms/rule_create_response.py deleted file mode 100644 index 0b669b7e5da..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_create_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waitingroom_rule import WaitingroomRule - -__all__ = ["RuleCreateResponse"] - -RuleCreateResponse = List[WaitingroomRule] diff --git a/src/cloudflare/types/waiting_rooms/rule_delete_response.py b/src/cloudflare/types/waiting_rooms/rule_delete_response.py deleted file mode 100644 index 6c5de05a3fe..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_delete_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waitingroom_rule import WaitingroomRule - -__all__ = ["RuleDeleteResponse"] - -RuleDeleteResponse = List[WaitingroomRule] diff --git a/src/cloudflare/types/waiting_rooms/rule_edit_params.py b/src/cloudflare/types/waiting_rooms/rule_edit_params.py deleted file mode 100644 index 5c4e42e1be6..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_edit_params.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["RuleEditParams", "Position", "PositionIndex", "PositionBefore", "PositionAfter"] - - -class RuleEditParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - waiting_room_id: Required[str] - - action: Required[Literal["bypass_waiting_room"]] - """The action to take when the expression matches.""" - - expression: Required[str] - """Criteria defining when there is a match for the current rule.""" - - description: str - """The description of the rule.""" - - enabled: bool - """When set to true, the rule is enabled.""" - - position: Position - """Reorder the position of a rule""" - - -class PositionIndex(TypedDict, total=False): - index: int - """ - Places the rule in the exact position specified by the integer number - . Position numbers start with 1. Existing rules in the ruleset - from the specified position number onward are shifted one position (no rule is - overwritten). - """ - - -class PositionBefore(TypedDict, total=False): - before: str - """Places the rule before rule . - - Use this argument with an empty rule ID value ("") to set the rule as the first - rule in the ruleset. - """ - - -class PositionAfter(TypedDict, total=False): - after: str - """Places the rule after rule . - - Use this argument with an empty rule ID value ("") to set the rule as the last - rule in the ruleset. - """ - - -Position = Union[PositionIndex, PositionBefore, PositionAfter] diff --git a/src/cloudflare/types/waiting_rooms/rule_edit_response.py b/src/cloudflare/types/waiting_rooms/rule_edit_response.py deleted file mode 100644 index 326fed99592..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_edit_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waitingroom_rule import WaitingroomRule - -__all__ = ["RuleEditResponse"] - -RuleEditResponse = List[WaitingroomRule] diff --git a/src/cloudflare/types/waiting_rooms/rule_update_params.py b/src/cloudflare/types/waiting_rooms/rule_update_params.py deleted file mode 100644 index 298673d0c76..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_update_params.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["RuleUpdateParams", "Body"] - - -class RuleUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - body: Required[Iterable[Body]] - - -class Body(TypedDict, total=False): - action: Required[Literal["bypass_waiting_room"]] - """The action to take when the expression matches.""" - - expression: Required[str] - """Criteria defining when there is a match for the current rule.""" - - description: str - """The description of the rule.""" - - enabled: bool - """When set to true, the rule is enabled.""" diff --git a/src/cloudflare/types/waiting_rooms/rule_update_response.py b/src/cloudflare/types/waiting_rooms/rule_update_response.py deleted file mode 100644 index e3fb52ec9c0..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_update_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waitingroom_rule import WaitingroomRule - -__all__ = ["RuleUpdateResponse"] - -RuleUpdateResponse = List[WaitingroomRule] diff --git a/src/cloudflare/types/waiting_rooms/setting_edit_params.py b/src/cloudflare/types/waiting_rooms/setting_edit_params.py deleted file mode 100644 index 6591e2b3177..00000000000 --- a/src/cloudflare/types/waiting_rooms/setting_edit_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["SettingEditParams"] - - -class SettingEditParams(TypedDict, total=False): - search_engine_crawler_bypass: bool - """ - Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - """ diff --git a/src/cloudflare/types/waiting_rooms/setting_edit_response.py b/src/cloudflare/types/waiting_rooms/setting_edit_response.py deleted file mode 100644 index 26f3670ed99..00000000000 --- a/src/cloudflare/types/waiting_rooms/setting_edit_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["SettingEditResponse"] - - -class SettingEditResponse(BaseModel): - search_engine_crawler_bypass: bool - """ - Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - """ diff --git a/src/cloudflare/types/waiting_rooms/setting_get_response.py b/src/cloudflare/types/waiting_rooms/setting_get_response.py deleted file mode 100644 index 098bb2df1ed..00000000000 --- a/src/cloudflare/types/waiting_rooms/setting_get_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["SettingGetResponse"] - - -class SettingGetResponse(BaseModel): - search_engine_crawler_bypass: bool - """ - Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - """ diff --git a/src/cloudflare/types/waiting_rooms/setting_update_params.py b/src/cloudflare/types/waiting_rooms/setting_update_params.py deleted file mode 100644 index 68c2f6dab20..00000000000 --- a/src/cloudflare/types/waiting_rooms/setting_update_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["SettingUpdateParams"] - - -class SettingUpdateParams(TypedDict, total=False): - search_engine_crawler_bypass: bool - """ - Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - """ diff --git a/src/cloudflare/types/waiting_rooms/setting_update_response.py b/src/cloudflare/types/waiting_rooms/setting_update_response.py deleted file mode 100644 index e613bcf0f93..00000000000 --- a/src/cloudflare/types/waiting_rooms/setting_update_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["SettingUpdateResponse"] - - -class SettingUpdateResponse(BaseModel): - search_engine_crawler_bypass: bool - """ - Whether to allow verified search engine crawlers to bypass all waiting rooms on - this zone. Verified search engine crawlers will not be tracked or counted by the - waiting room system, and will not appear in waiting room analytics. - """ diff --git a/src/cloudflare/types/waiting_rooms/status_get_response.py b/src/cloudflare/types/waiting_rooms/status_get_response.py deleted file mode 100644 index 6114ed2cad0..00000000000 --- a/src/cloudflare/types/waiting_rooms/status_get_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["StatusGetResponse"] - - -class StatusGetResponse(BaseModel): - estimated_queued_users: Optional[int] = None - - estimated_total_active_users: Optional[int] = None - - event_id: Optional[str] = None - - max_estimated_time_minutes: Optional[int] = None - - status: Optional[Literal["event_prequeueing", "not_queueing", "queueing"]] = None diff --git a/src/cloudflare/types/waiting_rooms/waitingroom_event.py b/src/cloudflare/types/waiting_rooms/waitingroom_event.py deleted file mode 100644 index d44568e4b15..00000000000 --- a/src/cloudflare/types/waiting_rooms/waitingroom_event.py +++ /dev/null @@ -1,97 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ..._models import BaseModel - -__all__ = ["WaitingroomEvent"] - - -class WaitingroomEvent(BaseModel): - id: Optional[str] = None - - created_on: Optional[datetime] = None - - custom_page_html: Optional[str] = None - """ - If set, the event will override the waiting room's `custom_page_html` property - while it is active. If null, the event will inherit it. - """ - - description: Optional[str] = None - """A note that you can use to add more details about the event.""" - - disable_session_renewal: Optional[bool] = None - """ - If set, the event will override the waiting room's `disable_session_renewal` - property while it is active. If null, the event will inherit it. - """ - - event_end_time: Optional[str] = None - """An ISO 8601 timestamp that marks the end of the event.""" - - event_start_time: Optional[str] = None - """An ISO 8601 timestamp that marks the start of the event. - - At this time, queued users will be processed with the event's configuration. The - start time must be at least one minute before `event_end_time`. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A unique name to identify the event. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - new_users_per_minute: Optional[int] = None - """ - If set, the event will override the waiting room's `new_users_per_minute` - property while it is active. If null, the event will inherit it. This can only - be set if the event's `total_active_users` property is also set. - """ - - prequeue_start_time: Optional[str] = None - """ - An ISO 8601 timestamp that marks when to begin queueing all users before the - event starts. The prequeue must start at least five minutes before - `event_start_time`. - """ - - queueing_method: Optional[str] = None - """ - If set, the event will override the waiting room's `queueing_method` property - while it is active. If null, the event will inherit it. - """ - - session_duration: Optional[int] = None - """ - If set, the event will override the waiting room's `session_duration` property - while it is active. If null, the event will inherit it. - """ - - shuffle_at_event_start: Optional[bool] = None - """ - If enabled, users in the prequeue will be shuffled randomly at the - `event_start_time`. Requires that `prequeue_start_time` is not null. This is - useful for situations when many users will join the event prequeue at the same - time and you want to shuffle them to ensure fairness. Naturally, it makes the - most sense to enable this feature when the `queueing_method` during the event - respects ordering such as **fifo**, or else the shuffling may be unnecessary. - """ - - suspended: Optional[bool] = None - """Suspends or allows an event. - - If set to `true`, the event is ignored and traffic will be handled based on the - waiting room configuration. - """ - - total_active_users: Optional[int] = None - """ - If set, the event will override the waiting room's `total_active_users` property - while it is active. If null, the event will inherit it. This can only be set if - the event's `new_users_per_minute` property is also set. - """ diff --git a/src/cloudflare/types/waiting_rooms/waitingroom_rule.py b/src/cloudflare/types/waiting_rooms/waitingroom_rule.py deleted file mode 100644 index 1d5a191aad7..00000000000 --- a/src/cloudflare/types/waiting_rooms/waitingroom_rule.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["WaitingroomRule"] - - -class WaitingroomRule(BaseModel): - id: Optional[str] = None - """The ID of the rule.""" - - action: Optional[Literal["bypass_waiting_room"]] = None - """The action to take when the expression matches.""" - - description: Optional[str] = None - """The description of the rule.""" - - enabled: Optional[bool] = None - """When set to true, the rule is enabled.""" - - expression: Optional[str] = None - """Criteria defining when there is a match for the current rule.""" - - last_updated: Optional[datetime] = None - - version: Optional[str] = None - """The version of the rule.""" diff --git a/tests/api_resources/test_waiting_rooms.py b/tests/api_resources/test_waiting_rooms.py deleted file mode 100644 index b1cbfb03038..00000000000 --- a/tests/api_resources/test_waiting_rooms.py +++ /dev/null @@ -1,978 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types import ( - WaitingRoom, - WaitingRoomDeleteResponse, -) -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestWaitingRooms: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - additional_routes=[ - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - ], - cookie_attributes={ - "samesite": "auto", - "secure": "auto", - }, - cookie_suffix="abcd", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - default_template_language="es-ES", - description="Production - DO NOT MODIFY", - disable_session_renewal=False, - json_response_enabled=False, - path="/shop/checkout", - queue_all=True, - queueing_method="fifo", - queueing_status_code=202, - session_duration=1, - suspended=True, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.waiting_rooms.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.waiting_rooms.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.with_raw_response.create( - "", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - additional_routes=[ - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - ], - cookie_attributes={ - "samesite": "auto", - "secure": "auto", - }, - cookie_suffix="abcd", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - default_template_language="es-ES", - description="Production - DO NOT MODIFY", - disable_session_renewal=False, - json_response_enabled=False, - path="/shop/checkout", - queue_all=True, - queueing_method="fifo", - queueing_status_code=202, - session_duration=1, - suspended=True, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.waiting_rooms.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.waiting_rooms.with_streaming_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.waiting_rooms.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = response.parse() - assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.waiting_rooms.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = response.parse() - assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.with_raw_response.list( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.waiting_rooms.with_raw_response.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = response.parse() - assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.waiting_rooms.with_streaming_response.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = response.parse() - assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.with_raw_response.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - additional_routes=[ - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - ], - cookie_attributes={ - "samesite": "auto", - "secure": "auto", - }, - cookie_suffix="abcd", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - default_template_language="es-ES", - description="Production - DO NOT MODIFY", - disable_session_renewal=False, - json_response_enabled=False, - path="/shop/checkout", - queue_all=True, - queueing_method="fifo", - queueing_status_code=202, - session_duration=1, - suspended=True, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.waiting_rooms.with_raw_response.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.waiting_rooms.with_streaming_response.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.with_raw_response.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - waiting_room = client.waiting_rooms.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.waiting_rooms.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.waiting_rooms.with_streaming_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncWaitingRooms: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - additional_routes=[ - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - ], - cookie_attributes={ - "samesite": "auto", - "secure": "auto", - }, - cookie_suffix="abcd", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - default_template_language="es-ES", - description="Production - DO NOT MODIFY", - disable_session_renewal=False, - json_response_enabled=False, - path="/shop/checkout", - queue_all=True, - queueing_method="fifo", - queueing_status_code=202, - session_duration=1, - suspended=True, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.with_raw_response.create( - "", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - additional_routes=[ - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - ], - cookie_attributes={ - "samesite": "auto", - "secure": "auto", - }, - cookie_suffix="abcd", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - default_template_language="es-ES", - description="Production - DO NOT MODIFY", - disable_session_renewal=False, - json_response_enabled=False, - path="/shop/checkout", - queue_all=True, - queueing_method="fifo", - queueing_status_code=202, - session_duration=1, - suspended=True, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.with_streaming_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.with_raw_response.list( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.with_raw_response.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = await response.parse() - assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.with_streaming_response.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = await response.parse() - assert_matches_type(WaitingRoomDeleteResponse, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.with_raw_response.delete( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - additional_routes=[ - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - { - "host": "shop2.example.com", - "path": "/shop2/checkout", - }, - ], - cookie_attributes={ - "samesite": "auto", - "secure": "auto", - }, - cookie_suffix="abcd", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - default_template_language="es-ES", - description="Production - DO NOT MODIFY", - disable_session_renewal=False, - json_response_enabled=False, - path="/shop/checkout", - queue_all=True, - queueing_method="fifo", - queueing_status_code=202, - session_duration=1, - suspended=True, - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.with_raw_response.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.with_streaming_response.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.with_raw_response.edit( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - host="shop.example.com", - name="production_webinar", - new_users_per_minute=200, - total_active_users=200, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - waiting_room = await async_client.waiting_rooms.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.with_streaming_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waiting_room = await response.parse() - assert_matches_type(WaitingRoom, waiting_room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/waiting_rooms/events/test_details.py b/tests/api_resources/waiting_rooms/events/test_details.py deleted file mode 100644 index 0de30ba6d50..00000000000 --- a/tests/api_resources/waiting_rooms/events/test_details.py +++ /dev/null @@ -1,150 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms.events import WaitingroomEventDetails - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDetails: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - detail = client.waiting_rooms.events.details.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.details.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - detail = response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.details.with_streaming_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - detail = response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.details.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.details.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - client.waiting_rooms.events.details.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - -class TestAsyncDetails: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - detail = await async_client.waiting_rooms.events.details.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.details.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - detail = await response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.details.with_streaming_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - detail = await response.parse() - assert_matches_type(WaitingroomEventDetails, detail, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.details.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.details.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - await async_client.waiting_rooms.events.details.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) diff --git a/tests/api_resources/waiting_rooms/test_events.py b/tests/api_resources/waiting_rooms/test_events.py deleted file mode 100644 index 85413cb8950..00000000000 --- a/tests/api_resources/waiting_rooms/test_events.py +++ /dev/null @@ -1,984 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -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.types.waiting_rooms import ( - WaitingroomEvent, - EventDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEvents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}", - description="Production event - DO NOT MODIFY", - disable_session_renewal=True, - new_users_per_minute=200, - prequeue_start_time="2021-09-28T15:00:00.000Z", - queueing_method="random", - session_duration=1, - shuffle_at_event_start=True, - suspended=True, - total_active_users=200, - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.with_streaming_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.with_raw_response.create( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}", - description="Production event - DO NOT MODIFY", - disable_session_renewal=True, - new_users_per_minute=200, - prequeue_start_time="2021-09-28T15:00:00.000Z", - queueing_method="random", - session_duration=1, - shuffle_at_event_start=True, - suspended=True, - total_active_users=200, - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.with_raw_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.with_streaming_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.with_raw_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.with_raw_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - client.waiting_rooms.events.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.with_raw_response.list( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(EventDeleteResponse, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(EventDeleteResponse, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.with_streaming_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(EventDeleteResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - client.waiting_rooms.events.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}", - description="Production event - DO NOT MODIFY", - disable_session_renewal=True, - new_users_per_minute=200, - prequeue_start_time="2021-09-28T15:00:00.000Z", - queueing_method="random", - session_duration=1, - shuffle_at_event_start=True, - suspended=True, - total_active_users=200, - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.with_streaming_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - client.waiting_rooms.events.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - event = client.waiting_rooms.events.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.waiting_rooms.events.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.waiting_rooms.events.with_streaming_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.events.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.events.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - client.waiting_rooms.events.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - -class TestAsyncEvents: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}", - description="Production event - DO NOT MODIFY", - disable_session_renewal=True, - new_users_per_minute=200, - prequeue_start_time="2021-09-28T15:00:00.000Z", - queueing_method="random", - session_duration=1, - shuffle_at_event_start=True, - suspended=True, - total_active_users=200, - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.with_streaming_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.create( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}", - description="Production event - DO NOT MODIFY", - disable_session_renewal=True, - new_users_per_minute=200, - prequeue_start_time="2021-09-28T15:00:00.000Z", - queueing_method="random", - session_duration=1, - shuffle_at_event_start=True, - suspended=True, - total_active_users=200, - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.with_raw_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.with_streaming_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.update( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.list( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(EventDeleteResponse, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(EventDeleteResponse, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.with_streaming_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(EventDeleteResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - custom_page_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}", - description="Production event - DO NOT MODIFY", - disable_session_renewal=True, - new_users_per_minute=200, - prequeue_start_time="2021-09-28T15:00:00.000Z", - queueing_method="random", - session_duration=1, - shuffle_at_event_start=True, - suspended=True, - total_active_users=200, - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.with_streaming_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - event_end_time="2021-09-28T17:00:00.000Z", - event_start_time="2021-09-28T15:30:00.000Z", - name="production_webinar_event", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - event = await async_client.waiting_rooms.events.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.events.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.events.with_streaming_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(WaitingroomEvent, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.get( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - await async_client.waiting_rooms.events.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) diff --git a/tests/api_resources/waiting_rooms/test_page.py b/tests/api_resources/waiting_rooms/test_page.py deleted file mode 100644 index 5a53a2ac826..00000000000 --- a/tests/api_resources/waiting_rooms/test_page.py +++ /dev/null @@ -1,114 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms import PagePreviewResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_preview(self, client: Cloudflare) -> None: - page = client.waiting_rooms.page.preview( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) - assert_matches_type(PagePreviewResponse, page, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_preview(self, client: Cloudflare) -> None: - response = client.waiting_rooms.page.with_raw_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - page = response.parse() - assert_matches_type(PagePreviewResponse, page, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_preview(self, client: Cloudflare) -> None: - with client.waiting_rooms.page.with_streaming_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - page = response.parse() - assert_matches_type(PagePreviewResponse, page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_preview(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.page.with_raw_response.preview( - "", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) - - -class TestAsyncPage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_preview(self, async_client: AsyncCloudflare) -> None: - page = await async_client.waiting_rooms.page.preview( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) - assert_matches_type(PagePreviewResponse, page, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.page.with_raw_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - page = await response.parse() - assert_matches_type(PagePreviewResponse, page, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.page.with_streaming_response.preview( - "023e105f4ecef8ad9ca31a8372d0c353", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - page = await response.parse() - assert_matches_type(PagePreviewResponse, page, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.page.with_raw_response.preview( - "", - custom_html="{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}", - ) diff --git a/tests/api_resources/waiting_rooms/test_rules.py b/tests/api_resources/waiting_rooms/test_rules.py deleted file mode 100644 index cbd401c1043..00000000000 --- a/tests/api_resources/waiting_rooms/test_rules.py +++ /dev/null @@ -1,837 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -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.types.waiting_rooms import ( - WaitingroomRule, - RuleEditResponse, - RuleCreateResponse, - RuleDeleteResponse, - RuleUpdateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRules: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - description="allow all traffic from 10.20.30.40", - enabled=True, - ) - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.waiting_rooms.rules.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.waiting_rooms.rules.with_streaming_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.rules.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.create( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.waiting_rooms.rules.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.waiting_rooms.rules.with_streaming_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.rules.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.waiting_rooms.rules.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.waiting_rooms.rules.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.rules.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.list( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.waiting_rooms.rules.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.waiting_rooms.rules.with_streaming_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.rules.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - rule = client.waiting_rooms.rules.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - description="allow all traffic from 10.20.30.40", - enabled=True, - position={"index": 0}, - ) - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.waiting_rooms.rules.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.waiting_rooms.rules.with_streaming_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.rules.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.waiting_rooms.rules.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - -class TestAsyncRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - description="allow all traffic from 10.20.30.40", - enabled=True, - ) - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.rules.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.rules.with_streaming_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.create( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.create( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.rules.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.rules.with_streaming_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.update( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body=[ - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - { - "action": "bypass_waiting_room", - "expression": "ip.src in {10.20.30.40}", - }, - ], - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.rules.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.rules.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.list( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.rules.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.rules.with_streaming_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(Optional[RuleDeleteResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.delete( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.waiting_rooms.rules.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - description="allow all traffic from 10.20.30.40", - enabled=True, - position={"index": 0}, - ) - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.rules.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.rules.with_streaming_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.edit( - "25756b2dfe6e378a06b033b670413757", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.waiting_rooms.rules.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - waiting_room_id="699d98642c564d2e855e9661899b7252", - action="bypass_waiting_room", - expression="ip.src in {10.20.30.40}", - ) diff --git a/tests/api_resources/waiting_rooms/test_settings.py b/tests/api_resources/waiting_rooms/test_settings.py deleted file mode 100644 index 1610b9935cf..00000000000 --- a/tests/api_resources/waiting_rooms/test_settings.py +++ /dev/null @@ -1,314 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms import ( - SettingGetResponse, - SettingEditResponse, - SettingUpdateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSettings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - setting = client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - setting = client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", - search_engine_crawler_bypass=True, - ) - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.waiting_rooms.settings.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.waiting_rooms.settings.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.settings.with_raw_response.update( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - setting = client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - setting = client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - search_engine_crawler_bypass=True, - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.waiting_rooms.settings.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.waiting_rooms.settings.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.settings.with_raw_response.edit( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - setting = client.waiting_rooms.settings.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.waiting_rooms.settings.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.waiting_rooms.settings.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.settings.with_raw_response.get( - "", - ) - - -class TestAsyncSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.waiting_rooms.settings.update( - "023e105f4ecef8ad9ca31a8372d0c353", - search_engine_crawler_bypass=True, - ) - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.settings.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.settings.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(SettingUpdateResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.settings.with_raw_response.update( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.waiting_rooms.settings.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - search_engine_crawler_bypass=True, - ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.settings.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.settings.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.settings.with_raw_response.edit( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.waiting_rooms.settings.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.settings.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.settings.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.settings.with_raw_response.get( - "", - ) diff --git a/tests/api_resources/waiting_rooms/test_statuses.py b/tests/api_resources/waiting_rooms/test_statuses.py deleted file mode 100644 index 2e33c51c5cd..00000000000 --- a/tests/api_resources/waiting_rooms/test_statuses.py +++ /dev/null @@ -1,126 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.waiting_rooms import StatusGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestStatuses: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - status = client.waiting_rooms.statuses.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(StatusGetResponse, status, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.waiting_rooms.statuses.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.waiting_rooms.statuses.with_streaming_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.waiting_rooms.statuses.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - client.waiting_rooms.statuses.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncStatuses: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - status = await async_client.waiting_rooms.statuses.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(StatusGetResponse, status, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.waiting_rooms.statuses.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = await response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.waiting_rooms.statuses.with_streaming_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = await response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.waiting_rooms.statuses.with_raw_response.get( - "699d98642c564d2e855e9661899b7252", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `waiting_room_id` but received ''"): - await async_client.waiting_rooms.statuses.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - )