diff --git a/.stats.yml b/.stats.yml index 0af34bafd24..3cb29ed2f8f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1462 +configured_endpoints: 1467 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-df037996f4a1d35cf34bb8d9deeee63b60463bb6f8814caec9fa4c659073fb0d.yml diff --git a/api.md b/api.md index c7fe853aa98..0f0865fcd33 100644 --- a/api.md +++ b/api.md @@ -2284,6 +2284,28 @@ from cloudflare.types.workers import ( ) ``` +## Routes + +Types: + +```python +from cloudflare.types.workers import ( + RouteCreateResponse, + RouteUpdateResponse, + RouteListResponse, + RouteDeleteResponse, + RouteGetResponse, +) +``` + +Methods: + +- client.workers.routes.create(\*, zone_id, \*\*params) -> RouteCreateResponse +- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> Optional[RouteUpdateResponse] +- client.workers.routes.list(\*, zone_id) -> SyncSinglePage[RouteListResponse] +- client.workers.routes.delete(route_id, \*, zone_id) -> RouteDeleteResponse +- client.workers.routes.get(route_id, \*, zone_id) -> Optional[RouteGetResponse] + ## Assets ### Upload diff --git a/src/cloudflare/resources/workers/__init__.py b/src/cloudflare/resources/workers/__init__.py index 581d9439279..2009583bd8f 100644 --- a/src/cloudflare/resources/workers/__init__.py +++ b/src/cloudflare/resources/workers/__init__.py @@ -8,6 +8,14 @@ AssetsResourceWithStreamingResponse, AsyncAssetsResourceWithStreamingResponse, ) +from .routes import ( + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, +) from .domains import ( DomainsResource, AsyncDomainsResource, @@ -50,6 +58,12 @@ ) __all__ = [ + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", "AssetsResource", "AsyncAssetsResource", "AssetsResourceWithRawResponse", diff --git a/src/cloudflare/resources/workers/routes.py b/src/cloudflare/resources/workers/routes.py new file mode 100644 index 00000000000..7af10337af1 --- /dev/null +++ b/src/cloudflare/resources/workers/routes.py @@ -0,0 +1,600 @@ +# 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 ..._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.workers import route_create_params, route_update_params +from ...types.workers.route_get_response import RouteGetResponse +from ...types.workers.route_list_response import RouteListResponse +from ...types.workers.route_create_response import RouteCreateResponse +from ...types.workers.route_delete_response import RouteDeleteResponse +from ...types.workers.route_update_response import RouteUpdateResponse + +__all__ = ["RoutesResource", "AsyncRoutesResource"] + + +class RoutesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoutesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return RoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return RoutesResourceWithStreamingResponse(self) + + def create( + self, + *, + zone_id: str, + pattern: str, + script: str | 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, + ) -> RouteCreateResponse: + """ + Creates a route that maps a URL pattern to a Worker. + + Args: + zone_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._post( + f"/zones/{zone_id}/workers/routes", + body=maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_create_params.RouteCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteCreateResponse, + ) + + def update( + self, + route_id: str, + *, + zone_id: str, + pattern: str, + script: str | 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[RouteUpdateResponse]: + """ + Updates the URL pattern or Worker associated with a route. + + Args: + zone_id: Identifier + + route_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._put( + f"/zones/{zone_id}/workers/routes/{route_id}", + body=maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_update_params.RouteUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteUpdateResponse]], ResultWrapper[RouteUpdateResponse]), + ) + + def list( + self, + *, + zone_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, + ) -> SyncSinglePage[RouteListResponse]: + """ + Returns routes for a zone. + + Args: + zone_id: 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/workers/routes", + page=SyncSinglePage[RouteListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RouteListResponse, + ) + + def delete( + self, + route_id: str, + *, + zone_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, + ) -> RouteDeleteResponse: + """ + Deletes a route. + + Args: + zone_id: Identifier + + route_id: 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._delete( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteDeleteResponse, + ) + + def get( + self, + route_id: str, + *, + zone_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[RouteGetResponse]: + """ + Returns information about a route, including URL pattern and Worker. + + Args: + zone_id: Identifier + + route_id: 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._get( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteGetResponse]], ResultWrapper[RouteGetResponse]), + ) + + +class AsyncRoutesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncRoutesResourceWithStreamingResponse(self) + + async def create( + self, + *, + zone_id: str, + pattern: str, + script: str | 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, + ) -> RouteCreateResponse: + """ + Creates a route that maps a URL pattern to a Worker. + + Args: + zone_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._post( + f"/zones/{zone_id}/workers/routes", + body=await async_maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_create_params.RouteCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteCreateResponse, + ) + + async def update( + self, + route_id: str, + *, + zone_id: str, + pattern: str, + script: str | 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[RouteUpdateResponse]: + """ + Updates the URL pattern or Worker associated with a route. + + Args: + zone_id: Identifier + + route_id: Identifier + + script: Name of the script, used in URLs and route configuration. + + 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._put( + f"/zones/{zone_id}/workers/routes/{route_id}", + body=await async_maybe_transform( + { + "pattern": pattern, + "script": script, + }, + route_update_params.RouteUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteUpdateResponse]], ResultWrapper[RouteUpdateResponse]), + ) + + def list( + self, + *, + zone_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, + ) -> AsyncPaginator[RouteListResponse, AsyncSinglePage[RouteListResponse]]: + """ + Returns routes for a zone. + + Args: + zone_id: 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/workers/routes", + page=AsyncSinglePage[RouteListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RouteListResponse, + ) + + async def delete( + self, + route_id: str, + *, + zone_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, + ) -> RouteDeleteResponse: + """ + Deletes a route. + + Args: + zone_id: Identifier + + route_id: 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._delete( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteDeleteResponse, + ) + + async def get( + self, + route_id: str, + *, + zone_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[RouteGetResponse]: + """ + Returns information about a route, including URL pattern and Worker. + + Args: + zone_id: Identifier + + route_id: 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_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._get( + f"/zones/{zone_id}/workers/routes/{route_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RouteGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RouteGetResponse]], ResultWrapper[RouteGetResponse]), + ) + + +class RoutesResourceWithRawResponse: + def __init__(self, routes: RoutesResource) -> None: + self._routes = routes + + self.create = to_raw_response_wrapper( + routes.create, + ) + self.update = to_raw_response_wrapper( + routes.update, + ) + self.list = to_raw_response_wrapper( + routes.list, + ) + self.delete = to_raw_response_wrapper( + routes.delete, + ) + self.get = to_raw_response_wrapper( + routes.get, + ) + + +class AsyncRoutesResourceWithRawResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: + self._routes = routes + + self.create = async_to_raw_response_wrapper( + routes.create, + ) + self.update = async_to_raw_response_wrapper( + routes.update, + ) + self.list = async_to_raw_response_wrapper( + routes.list, + ) + self.delete = async_to_raw_response_wrapper( + routes.delete, + ) + self.get = async_to_raw_response_wrapper( + routes.get, + ) + + +class RoutesResourceWithStreamingResponse: + def __init__(self, routes: RoutesResource) -> None: + self._routes = routes + + self.create = to_streamed_response_wrapper( + routes.create, + ) + self.update = to_streamed_response_wrapper( + routes.update, + ) + self.list = to_streamed_response_wrapper( + routes.list, + ) + self.delete = to_streamed_response_wrapper( + routes.delete, + ) + self.get = to_streamed_response_wrapper( + routes.get, + ) + + +class AsyncRoutesResourceWithStreamingResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: + self._routes = routes + + self.create = async_to_streamed_response_wrapper( + routes.create, + ) + self.update = async_to_streamed_response_wrapper( + routes.update, + ) + self.list = async_to_streamed_response_wrapper( + routes.list, + ) + self.delete = async_to_streamed_response_wrapper( + routes.delete, + ) + self.get = async_to_streamed_response_wrapper( + routes.get, + ) diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py index 57911025f5f..e167830c87d 100644 --- a/src/cloudflare/resources/workers/workers.py +++ b/src/cloudflare/resources/workers/workers.py @@ -2,6 +2,14 @@ from __future__ import annotations +from .routes import ( + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, +) from .domains import ( DomainsResource, AsyncDomainsResource, @@ -49,6 +57,10 @@ class WorkersResource(SyncAPIResource): + @cached_property + def routes(self) -> RoutesResource: + return RoutesResource(self._client) + @cached_property def assets(self) -> AssetsResource: return AssetsResource(self._client) @@ -90,6 +102,10 @@ def with_streaming_response(self) -> WorkersResourceWithStreamingResponse: class AsyncWorkersResource(AsyncAPIResource): + @cached_property + def routes(self) -> AsyncRoutesResource: + return AsyncRoutesResource(self._client) + @cached_property def assets(self) -> AsyncAssetsResource: return AsyncAssetsResource(self._client) @@ -134,6 +150,10 @@ class WorkersResourceWithRawResponse: def __init__(self, workers: WorkersResource) -> None: self._workers = workers + @cached_property + def routes(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self._workers.routes) + @cached_property def assets(self) -> AssetsResourceWithRawResponse: return AssetsResourceWithRawResponse(self._workers.assets) @@ -159,6 +179,10 @@ class AsyncWorkersResourceWithRawResponse: def __init__(self, workers: AsyncWorkersResource) -> None: self._workers = workers + @cached_property + def routes(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self._workers.routes) + @cached_property def assets(self) -> AsyncAssetsResourceWithRawResponse: return AsyncAssetsResourceWithRawResponse(self._workers.assets) @@ -184,6 +208,10 @@ class WorkersResourceWithStreamingResponse: def __init__(self, workers: WorkersResource) -> None: self._workers = workers + @cached_property + def routes(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self._workers.routes) + @cached_property def assets(self) -> AssetsResourceWithStreamingResponse: return AssetsResourceWithStreamingResponse(self._workers.assets) @@ -209,6 +237,10 @@ class AsyncWorkersResourceWithStreamingResponse: def __init__(self, workers: AsyncWorkersResource) -> None: self._workers = workers + @cached_property + def routes(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self._workers.routes) + @cached_property def assets(self) -> AsyncAssetsResourceWithStreamingResponse: return AsyncAssetsResourceWithStreamingResponse(self._workers.assets) diff --git a/src/cloudflare/types/workers/__init__.py b/src/cloudflare/types/workers/__init__.py index 979106d4abf..a467e783e03 100644 --- a/src/cloudflare/types/workers/__init__.py +++ b/src/cloudflare/types/workers/__init__.py @@ -16,11 +16,18 @@ from .mtls_cert_binding import MTLSCERTBinding as MTLSCERTBinding from .stepped_migration import SteppedMigration as SteppedMigration from .domain_list_params import DomainListParams as DomainListParams +from .route_get_response import RouteGetResponse as RouteGetResponse +from .route_create_params import RouteCreateParams as RouteCreateParams +from .route_list_response import RouteListResponse as RouteListResponse +from .route_update_params import RouteUpdateParams as RouteUpdateParams from .domain_update_params import DomainUpdateParams as DomainUpdateParams from .kv_namespace_binding import KVNamespaceBinding as KVNamespaceBinding from .migration_step_param import MigrationStepParam as MigrationStepParam from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams from .script_update_params import ScriptUpdateParams as ScriptUpdateParams +from .route_create_response import RouteCreateResponse as RouteCreateResponse +from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse +from .route_update_response import RouteUpdateResponse as RouteUpdateResponse from .service_binding_param import ServiceBindingParam as ServiceBindingParam from .single_step_migration import SingleStepMigration as SingleStepMigration from .worker_metadata_param import WorkerMetadataParam as WorkerMetadataParam diff --git a/src/cloudflare/types/workers/route_create_params.py b/src/cloudflare/types/workers/route_create_params.py new file mode 100644 index 00000000000..479c701b0e9 --- /dev/null +++ b/src/cloudflare/types/workers/route_create_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouteCreateParams"] + + +class RouteCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + pattern: Required[str] + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_create_response.py b/src/cloudflare/types/workers/route_create_response.py new file mode 100644 index 00000000000..9e27967d480 --- /dev/null +++ b/src/cloudflare/types/workers/route_create_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo + +__all__ = ["RouteCreateResponse"] + + +class RouteCreateResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/workers/route_delete_response.py b/src/cloudflare/types/workers/route_delete_response.py new file mode 100644 index 00000000000..df25ccce223 --- /dev/null +++ b/src/cloudflare/types/workers/route_delete_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo + +__all__ = ["RouteDeleteResponse"] + + +class RouteDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/workers/route_get_response.py b/src/cloudflare/types/workers/route_get_response.py new file mode 100644 index 00000000000..169dcf43ea2 --- /dev/null +++ b/src/cloudflare/types/workers/route_get_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["RouteGetResponse"] + + +class RouteGetResponse(BaseModel): + id: str + """Identifier""" + + pattern: str + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_list_response.py b/src/cloudflare/types/workers/route_list_response.py new file mode 100644 index 00000000000..b6002c20b63 --- /dev/null +++ b/src/cloudflare/types/workers/route_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["RouteListResponse"] + + +class RouteListResponse(BaseModel): + id: str + """Identifier""" + + pattern: str + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_update_params.py b/src/cloudflare/types/workers/route_update_params.py new file mode 100644 index 00000000000..d4954d0bd6a --- /dev/null +++ b/src/cloudflare/types/workers/route_update_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouteUpdateParams"] + + +class RouteUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + pattern: Required[str] + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/workers/route_update_response.py b/src/cloudflare/types/workers/route_update_response.py new file mode 100644 index 00000000000..1c2e70ac262 --- /dev/null +++ b/src/cloudflare/types/workers/route_update_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["RouteUpdateResponse"] + + +class RouteUpdateResponse(BaseModel): + id: str + """Identifier""" + + pattern: str + + script: str + """Name of the script, used in URLs and route configuration.""" diff --git a/tests/api_resources/workers/test_routes.py b/tests/api_resources/workers/test_routes.py new file mode 100644 index 00000000000..86895a348ba --- /dev/null +++ b/tests/api_resources/workers/test_routes.py @@ -0,0 +1,525 @@ +# 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.workers import ( + RouteGetResponse, + RouteListResponse, + RouteCreateResponse, + RouteDeleteResponse, + RouteUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRoutes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + route = client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + route = client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.create( + zone_id="", + pattern="example.net/*", + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + route = client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + route = client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + pattern="example.net/*", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.workers.routes.with_raw_response.update( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + route = client.workers.routes.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(SyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(SyncSinglePage[RouteListResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + route = client.workers.routes.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.workers.routes.with_raw_response.delete( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + route = client.workers.routes.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.workers.routes.with_streaming_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.workers.routes.with_raw_response.get( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncRoutes: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(RouteCreateResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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_id` but received ''"): + await async_client.workers.routes.with_raw_response.create( + zone_id="", + pattern="example.net/*", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + script="this-is_my_script-01", + ) + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(Optional[RouteUpdateResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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_id` but received ''"): + await async_client.workers.routes.with_raw_response.update( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + pattern="example.net/*", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.workers.routes.with_raw_response.update( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + pattern="example.net/*", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(AsyncSinglePage[RouteListResponse], route, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(AsyncSinglePage[RouteListResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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_id` but received ''"): + await async_client.workers.routes.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(RouteDeleteResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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_id` but received ''"): + await async_client.workers.routes.with_raw_response.delete( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.workers.routes.with_raw_response.delete( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + route = await async_client.workers.routes.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.routes.with_streaming_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(Optional[RouteGetResponse], route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @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_id` but received ''"): + await async_client.workers.routes.with_raw_response.get( + route_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.workers.routes.with_raw_response.get( + route_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + )