From 27c7d71f276ea8330a9aeee0f011a34e39f85759 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 00:58:24 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#234) --- .stats.yml | 2 +- api.md | 136 +--- src/cloudflare/resources/workers/__init__.py | 56 -- .../resources/workers/deployments/__init__.py | 33 - .../deployments/by_scripts/__init__.py | 33 - .../deployments/by_scripts/by_scripts.py | 196 ----- .../workers/deployments/by_scripts/details.py | 170 ---- .../workers/deployments/deployments.py | 81 -- src/cloudflare/resources/workers/filters.py | 495 ------------ src/cloudflare/resources/workers/routes.py | 617 -------------- .../resources/workers/scripts/__init__.py | 42 - .../resources/workers/scripts/bindings.py | 158 ---- .../resources/workers/scripts/content.py | 106 +++ .../resources/workers/scripts/content_v2.py | 166 ---- .../resources/workers/scripts/scripts.py | 97 --- .../resources/workers/scripts/usage_model.py | 280 ------- .../scripts/{versions => }/versions.py | 48 +- .../workers/scripts/versions/__init__.py | 33 - .../workers/scripts/versions/settings.py | 276 ------- .../resources/workers/services/__init__.py | 33 - .../workers/services/environments/__init__.py | 47 -- .../workers/services/environments/content.py | 350 -------- .../services/environments/environments.py | 112 --- .../workers/services/environments/settings.py | 325 -------- .../resources/workers/services/services.py | 81 -- src/cloudflare/resources/workers/workers.py | 130 --- src/cloudflare/resources/zones/__init__.py | 14 - .../resources/zones/workers/__init__.py | 33 - .../resources/zones/workers/script.py | 367 --------- .../resources/zones/workers/workers.py | 80 -- src/cloudflare/resources/zones/zones.py | 33 - src/cloudflare/types/__init__.py | 13 - .../types/addressing/prefixes/bgp/__init__.py | 1 - .../prefixes/bgp/service_binding_param.py | 29 - src/cloudflare/types/binding_param.py | 36 - src/cloudflare/types/d1_binding_param.py | 18 - .../types/dispatch_namespace_binding_param.py | 38 - .../types/durable_object_binding_param.py | 23 - .../types/kv_namespace_binding_param.py | 12 - src/cloudflare/types/migration_step.py | 40 - .../types/mtls_cert_binding_param.py | 17 - .../types/placement_configuration.py | 17 - src/cloudflare/types/r2_binding_param.py | 15 - src/cloudflare/types/service_binding_param.py | 18 - src/cloudflare/types/settings_param.py | 15 - src/cloudflare/types/single_step_migration.py | 49 -- src/cloudflare/types/stepped_migration.py | 22 - src/cloudflare/types/workers/__init__.py | 10 - .../types/workers/deployments/__init__.py | 5 - .../deployments/by_script_get_response.py | 13 - .../deployments/by_scripts/__init__.py | 5 - .../by_scripts/detail_get_response.py | 17 - .../types/workers/filter_create_params.py | 16 - .../types/workers/filter_create_response.py | 10 - .../types/workers/filter_delete_params.py | 14 - .../types/workers/filter_delete_response.py | 10 - .../types/workers/filter_update_params.py | 16 - .../types/workers/route_create_params.py | 17 - .../types/workers/route_delete_params.py | 14 - .../types/workers/route_update_params.py | 17 - .../types/workers/scripts/__init__.py | 4 - .../workers/scripts/binding_get_response.py | 22 - .../scripts/usage_model_get_response.py | 11 - .../scripts/usage_model_update_params.py | 14 - .../scripts/usage_model_update_response.py | 11 - .../workers/scripts/versions/__init__.py | 9 - .../scripts/versions/compatibility_flags.py | 6 - .../scripts/versions/setting_edit_params.py | 16 - .../workers/scripts/versions/settings.py | 44 - .../scripts/versions/settings_param.py | 46 -- .../types/workers/scripts/versions/tags.py | 6 - .../types/workers/services/__init__.py | 3 - .../workers/services/environments/__init__.py | 6 - .../environments/content_update_params.py | 33 - .../environments/setting_edit_params.py | 28 - .../types/workers/workers_filter.py | 14 - src/cloudflare/types/workers/workers_route.py | 15 - .../types/zones/workers/__init__.py | 6 - .../zones/workers/script_delete_params.py | 14 - .../zones/workers/script_update_params.py | 14 - .../workers/deployments/__init__.py | 1 - .../deployments/by_scripts/__init__.py | 1 - .../deployments/by_scripts/test_details.py | 150 ---- .../workers/deployments/test_by_scripts.py | 126 --- .../workers/scripts/test_bindings.py | 106 --- .../workers/scripts/test_content.py | 148 ++++ .../workers/scripts/test_content_v2.py | 168 ---- .../workers/scripts/test_usage_model.py | 240 ------ .../workers/scripts/versions/__init__.py | 1 - .../workers/scripts/versions/test_settings.py | 382 --------- .../workers/services/__init__.py | 1 - .../workers/services/environments/__init__.py | 1 - .../services/environments/test_content.py | 352 -------- .../services/environments/test_settings.py | 756 ------------------ tests/api_resources/workers/test_filters.py | 449 ----------- tests/api_resources/workers/test_routes.py | 574 ------------- tests/api_resources/zones/workers/__init__.py | 1 - .../zones/workers/test_script.py | 334 -------- 98 files changed, 267 insertions(+), 9003 deletions(-) delete mode 100644 src/cloudflare/resources/workers/deployments/__init__.py delete mode 100644 src/cloudflare/resources/workers/deployments/by_scripts/__init__.py delete mode 100644 src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py delete mode 100644 src/cloudflare/resources/workers/deployments/by_scripts/details.py delete mode 100644 src/cloudflare/resources/workers/deployments/deployments.py delete mode 100644 src/cloudflare/resources/workers/filters.py delete mode 100644 src/cloudflare/resources/workers/routes.py delete mode 100644 src/cloudflare/resources/workers/scripts/bindings.py delete mode 100644 src/cloudflare/resources/workers/scripts/content_v2.py delete mode 100644 src/cloudflare/resources/workers/scripts/usage_model.py rename src/cloudflare/resources/workers/scripts/{versions => }/versions.py (92%) delete mode 100644 src/cloudflare/resources/workers/scripts/versions/__init__.py delete mode 100644 src/cloudflare/resources/workers/scripts/versions/settings.py delete mode 100644 src/cloudflare/resources/workers/services/__init__.py delete mode 100644 src/cloudflare/resources/workers/services/environments/__init__.py delete mode 100644 src/cloudflare/resources/workers/services/environments/content.py delete mode 100644 src/cloudflare/resources/workers/services/environments/environments.py delete mode 100644 src/cloudflare/resources/workers/services/environments/settings.py delete mode 100644 src/cloudflare/resources/workers/services/services.py delete mode 100644 src/cloudflare/resources/zones/workers/__init__.py delete mode 100644 src/cloudflare/resources/zones/workers/script.py delete mode 100644 src/cloudflare/resources/zones/workers/workers.py delete mode 100644 src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.py delete mode 100644 src/cloudflare/types/binding_param.py delete mode 100644 src/cloudflare/types/d1_binding_param.py delete mode 100644 src/cloudflare/types/dispatch_namespace_binding_param.py delete mode 100644 src/cloudflare/types/durable_object_binding_param.py delete mode 100644 src/cloudflare/types/kv_namespace_binding_param.py delete mode 100644 src/cloudflare/types/migration_step.py delete mode 100644 src/cloudflare/types/mtls_cert_binding_param.py delete mode 100644 src/cloudflare/types/placement_configuration.py delete mode 100644 src/cloudflare/types/r2_binding_param.py delete mode 100644 src/cloudflare/types/service_binding_param.py delete mode 100644 src/cloudflare/types/settings_param.py delete mode 100644 src/cloudflare/types/single_step_migration.py delete mode 100644 src/cloudflare/types/stepped_migration.py delete mode 100644 src/cloudflare/types/workers/deployments/__init__.py delete mode 100644 src/cloudflare/types/workers/deployments/by_script_get_response.py delete mode 100644 src/cloudflare/types/workers/deployments/by_scripts/__init__.py delete mode 100644 src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.py delete mode 100644 src/cloudflare/types/workers/filter_create_params.py delete mode 100644 src/cloudflare/types/workers/filter_create_response.py delete mode 100644 src/cloudflare/types/workers/filter_delete_params.py delete mode 100644 src/cloudflare/types/workers/filter_delete_response.py delete mode 100644 src/cloudflare/types/workers/filter_update_params.py delete mode 100644 src/cloudflare/types/workers/route_create_params.py delete mode 100644 src/cloudflare/types/workers/route_delete_params.py delete mode 100644 src/cloudflare/types/workers/route_update_params.py delete mode 100644 src/cloudflare/types/workers/scripts/binding_get_response.py delete mode 100644 src/cloudflare/types/workers/scripts/usage_model_get_response.py delete mode 100644 src/cloudflare/types/workers/scripts/usage_model_update_params.py delete mode 100644 src/cloudflare/types/workers/scripts/usage_model_update_response.py delete mode 100644 src/cloudflare/types/workers/scripts/versions/__init__.py delete mode 100644 src/cloudflare/types/workers/scripts/versions/compatibility_flags.py delete mode 100644 src/cloudflare/types/workers/scripts/versions/setting_edit_params.py delete mode 100644 src/cloudflare/types/workers/scripts/versions/settings.py delete mode 100644 src/cloudflare/types/workers/scripts/versions/settings_param.py delete mode 100644 src/cloudflare/types/workers/scripts/versions/tags.py delete mode 100644 src/cloudflare/types/workers/services/__init__.py delete mode 100644 src/cloudflare/types/workers/services/environments/__init__.py delete mode 100644 src/cloudflare/types/workers/services/environments/content_update_params.py delete mode 100644 src/cloudflare/types/workers/services/environments/setting_edit_params.py delete mode 100644 src/cloudflare/types/workers/workers_filter.py delete mode 100644 src/cloudflare/types/workers/workers_route.py delete mode 100644 src/cloudflare/types/zones/workers/__init__.py delete mode 100644 src/cloudflare/types/zones/workers/script_delete_params.py delete mode 100644 src/cloudflare/types/zones/workers/script_update_params.py delete mode 100644 tests/api_resources/workers/deployments/__init__.py delete mode 100644 tests/api_resources/workers/deployments/by_scripts/__init__.py delete mode 100644 tests/api_resources/workers/deployments/by_scripts/test_details.py delete mode 100644 tests/api_resources/workers/deployments/test_by_scripts.py delete mode 100644 tests/api_resources/workers/scripts/test_bindings.py delete mode 100644 tests/api_resources/workers/scripts/test_content_v2.py delete mode 100644 tests/api_resources/workers/scripts/test_usage_model.py delete mode 100644 tests/api_resources/workers/scripts/versions/__init__.py delete mode 100644 tests/api_resources/workers/scripts/versions/test_settings.py delete mode 100644 tests/api_resources/workers/services/__init__.py delete mode 100644 tests/api_resources/workers/services/environments/__init__.py delete mode 100644 tests/api_resources/workers/services/environments/test_content.py delete mode 100644 tests/api_resources/workers/services/environments/test_settings.py delete mode 100644 tests/api_resources/workers/test_filters.py delete mode 100644 tests/api_resources/workers/test_routes.py delete mode 100644 tests/api_resources/zones/workers/__init__.py delete mode 100644 tests/api_resources/zones/workers/test_script.py diff --git a/.stats.yml b/.stats.yml index c4813cf44d2..71e1621688b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1297 +configured_endpoints: 1274 diff --git a/api.md b/api.md index 3e23505bc40..c4f49ad9d35 100644 --- a/api.md +++ b/api.md @@ -1080,16 +1080,6 @@ Methods: - client.zones.holds.delete(\*, zone_id, \*\*params) -> Optional - client.zones.holds.get(\*, zone_id) -> ZoneHold -## Workers - -### Script - -Methods: - -- client.zones.workers.script.update(\*, zone_id, \*\*params) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a -- client.zones.workers.script.delete(\*, zone_id, \*\*params) -> None -- client.zones.workers.script.get(\*, zone_id) -> BinaryAPIResponse - ## Subscriptions Methods: @@ -2665,18 +2655,6 @@ Methods: - client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> None - client.workers.scripts.get(script_name, \*, account_id) -> BinaryAPIResponse -### Bindings - -Types: - -```python -from cloudflare.types.workers.scripts import BindingGetResponse -``` - -Methods: - -- client.workers.scripts.bindings.get(\*, zone_id) -> BindingGetResponse - ### Schedules Types: @@ -2713,30 +2691,12 @@ Methods: - client.workers.scripts.tail.delete(id, \*, account_id, script_name, \*\*params) -> UnnamedSchemaRefEc4d85c3d1bcc6b3b7e99c199ae99846 - client.workers.scripts.tail.get(script_name, \*, account_id) -> TailGetResponse -### UsageModel - -Types: - -```python -from cloudflare.types.workers.scripts import UsageModelUpdateResponse, UsageModelGetResponse -``` - -Methods: - -- client.workers.scripts.usage_model.update(script_name, \*, account_id, \*\*params) -> UsageModelUpdateResponse -- client.workers.scripts.usage_model.get(script_name, \*, account_id) -> UsageModelGetResponse - ### Content Methods: - client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Script - -### ContentV2 - -Methods: - -- client.workers.scripts.content_v2.get(script_name, \*, account_id) -> BinaryAPIResponse +- client.workers.scripts.content.get(script_name, \*, account_id) -> BinaryAPIResponse ### Settings @@ -2776,53 +2736,9 @@ from cloudflare.types.workers.scripts import ( Methods: -- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> VersionCreateResponse -- client.workers.scripts.versions.list(script_name, \*, account_id) -> VersionListResponse -- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> VersionGetResponse - -#### Settings - -Types: - -```python -from cloudflare.types.workers.scripts.versions import CompatibilityFlags, Settings, Tags -``` - -Methods: - -- client.workers.scripts.versions.settings.edit(script_name, \*, account_id, \*\*params) -> Settings -- client.workers.scripts.versions.settings.get(script_name, \*, account_id) -> Settings - -## Filters - -Types: - -```python -from cloudflare.types.workers import WorkersFilter, FilterCreateResponse, FilterDeleteResponse -``` - -Methods: - -- client.workers.filters.create(\*, zone_id, \*\*params) -> Optional -- client.workers.filters.update(filter_id, \*, zone_id, \*\*params) -> WorkersFilter -- client.workers.filters.list(\*, zone_id) -> SyncSinglePage[WorkersFilter] -- client.workers.filters.delete(filter_id, \*, zone_id, \*\*params) -> Optional - -## Routes - -Types: - -```python -from cloudflare.types.workers import WorkersRoute -``` - -Methods: - -- client.workers.routes.create(\*, zone_id, \*\*params) -> UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f -- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> WorkersRoute -- client.workers.routes.list(\*, zone_id) -> SyncSinglePage[WorkersRoute] -- client.workers.routes.delete(route_id, \*, zone_id, \*\*params) -> UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f -- client.workers.routes.get(route_id, \*, zone_id) -> WorkersRoute +- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> VersionCreateResponse +- client.workers.scripts.versions.list(script_name, \*, account_id) -> VersionListResponse +- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> VersionGetResponse ## AccountSettings @@ -2837,32 +2753,6 @@ Methods: - client.workers.account_settings.update(\*, account_id, \*\*params) -> AccountSettingUpdateResponse - client.workers.account_settings.get(\*, account_id) -> AccountSettingGetResponse -## Deployments - -### ByScripts - -Types: - -```python -from cloudflare.types.workers.deployments import ByScriptGetResponse -``` - -Methods: - -- client.workers.deployments.by_scripts.get(script_id, \*, account_id) -> ByScriptGetResponse - -#### Details - -Types: - -```python -from cloudflare.types.workers.deployments.by_scripts import DetailGetResponse -``` - -Methods: - -- client.workers.deployments.by_scripts.details.get(deployment_id, \*, account_id, script_id) -> DetailGetResponse - ## Domains Types: @@ -2891,24 +2781,6 @@ Methods: - client.workers.subdomains.update(\*, account_id, \*\*params) -> SubdomainUpdateResponse - client.workers.subdomains.get(\*, account_id) -> SubdomainGetResponse -## Services - -### Environments - -#### Content - -Methods: - -- client.workers.services.environments.content.update(environment_name, \*, account_id, service_name, \*\*params) -> Script -- client.workers.services.environments.content.get(environment_name, \*, account_id, service_name) -> BinaryAPIResponse - -#### Settings - -Methods: - -- client.workers.services.environments.settings.edit(environment_name, \*, account_id, service_name, \*\*params) -> ScriptSetting -- client.workers.services.environments.settings.get(environment_name, \*, account_id, service_name) -> ScriptSetting - # KV ## Namespaces diff --git a/src/cloudflare/resources/workers/__init__.py b/src/cloudflare/resources/workers/__init__.py index 031bbab828a..f8851f76e58 100644 --- a/src/cloudflare/resources/workers/__init__.py +++ b/src/cloudflare/resources/workers/__init__.py @@ -8,14 +8,6 @@ AIWithStreamingResponse, AsyncAIWithStreamingResponse, ) -from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, -) from .domains import ( Domains, AsyncDomains, @@ -24,14 +16,6 @@ DomainsWithStreamingResponse, AsyncDomainsWithStreamingResponse, ) -from .filters import ( - Filters, - AsyncFilters, - FiltersWithRawResponse, - AsyncFiltersWithRawResponse, - FiltersWithStreamingResponse, - AsyncFiltersWithStreamingResponse, -) from .scripts import ( Scripts, AsyncScripts, @@ -48,14 +32,6 @@ WorkersWithStreamingResponse, AsyncWorkersWithStreamingResponse, ) -from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, -) from .subdomains import ( Subdomains, AsyncSubdomains, @@ -64,14 +40,6 @@ SubdomainsWithStreamingResponse, AsyncSubdomainsWithStreamingResponse, ) -from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, -) from .account_settings import ( AccountSettings, AsyncAccountSettings, @@ -94,30 +62,12 @@ "AsyncScriptsWithRawResponse", "ScriptsWithStreamingResponse", "AsyncScriptsWithStreamingResponse", - "Filters", - "AsyncFilters", - "FiltersWithRawResponse", - "AsyncFiltersWithRawResponse", - "FiltersWithStreamingResponse", - "AsyncFiltersWithStreamingResponse", - "Routes", - "AsyncRoutes", - "RoutesWithRawResponse", - "AsyncRoutesWithRawResponse", - "RoutesWithStreamingResponse", - "AsyncRoutesWithStreamingResponse", "AccountSettings", "AsyncAccountSettings", "AccountSettingsWithRawResponse", "AsyncAccountSettingsWithRawResponse", "AccountSettingsWithStreamingResponse", "AsyncAccountSettingsWithStreamingResponse", - "Deployments", - "AsyncDeployments", - "DeploymentsWithRawResponse", - "AsyncDeploymentsWithRawResponse", - "DeploymentsWithStreamingResponse", - "AsyncDeploymentsWithStreamingResponse", "Domains", "AsyncDomains", "DomainsWithRawResponse", @@ -130,12 +80,6 @@ "AsyncSubdomainsWithRawResponse", "SubdomainsWithStreamingResponse", "AsyncSubdomainsWithStreamingResponse", - "Services", - "AsyncServices", - "ServicesWithRawResponse", - "AsyncServicesWithRawResponse", - "ServicesWithStreamingResponse", - "AsyncServicesWithStreamingResponse", "Workers", "AsyncWorkers", "WorkersWithRawResponse", diff --git a/src/cloudflare/resources/workers/deployments/__init__.py b/src/cloudflare/resources/workers/deployments/__init__.py deleted file mode 100644 index 82159ecdf63..00000000000 --- a/src/cloudflare/resources/workers/deployments/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .by_scripts import ( - ByScripts, - AsyncByScripts, - ByScriptsWithRawResponse, - AsyncByScriptsWithRawResponse, - ByScriptsWithStreamingResponse, - AsyncByScriptsWithStreamingResponse, -) -from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, -) - -__all__ = [ - "ByScripts", - "AsyncByScripts", - "ByScriptsWithRawResponse", - "AsyncByScriptsWithRawResponse", - "ByScriptsWithStreamingResponse", - "AsyncByScriptsWithStreamingResponse", - "Deployments", - "AsyncDeployments", - "DeploymentsWithRawResponse", - "AsyncDeploymentsWithRawResponse", - "DeploymentsWithStreamingResponse", - "AsyncDeploymentsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/deployments/by_scripts/__init__.py b/src/cloudflare/resources/workers/deployments/by_scripts/__init__.py deleted file mode 100644 index ca888b7a109..00000000000 --- a/src/cloudflare/resources/workers/deployments/by_scripts/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, -) -from .by_scripts import ( - ByScripts, - AsyncByScripts, - ByScriptsWithRawResponse, - AsyncByScriptsWithRawResponse, - ByScriptsWithStreamingResponse, - AsyncByScriptsWithStreamingResponse, -) - -__all__ = [ - "Details", - "AsyncDetails", - "DetailsWithRawResponse", - "AsyncDetailsWithRawResponse", - "DetailsWithStreamingResponse", - "AsyncDetailsWithStreamingResponse", - "ByScripts", - "AsyncByScripts", - "ByScriptsWithRawResponse", - "AsyncByScriptsWithRawResponse", - "ByScriptsWithStreamingResponse", - "AsyncByScriptsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py b/src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py deleted file mode 100644 index a79795ff480..00000000000 --- a/src/cloudflare/resources/workers/deployments/by_scripts/by_scripts.py +++ /dev/null @@ -1,196 +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 .details import ( - Details, - AsyncDetails, - DetailsWithRawResponse, - AsyncDetailsWithRawResponse, - DetailsWithStreamingResponse, - AsyncDetailsWithStreamingResponse, -) -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.workers.deployments import ByScriptGetResponse - -__all__ = ["ByScripts", "AsyncByScripts"] - - -class ByScripts(SyncAPIResource): - @cached_property - def details(self) -> Details: - return Details(self._client) - - @cached_property - def with_raw_response(self) -> ByScriptsWithRawResponse: - return ByScriptsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ByScriptsWithStreamingResponse: - return ByScriptsWithStreamingResponse(self) - - def get( - self, - script_id: str, - *, - account_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, - ) -> ByScriptGetResponse: - """ - List Deployments - - Args: - account_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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - return self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_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[ByScriptGetResponse], ResultWrapper[ByScriptGetResponse]), - ) - - -class AsyncByScripts(AsyncAPIResource): - @cached_property - def details(self) -> AsyncDetails: - return AsyncDetails(self._client) - - @cached_property - def with_raw_response(self) -> AsyncByScriptsWithRawResponse: - return AsyncByScriptsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncByScriptsWithStreamingResponse: - return AsyncByScriptsWithStreamingResponse(self) - - async def get( - self, - script_id: str, - *, - account_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, - ) -> ByScriptGetResponse: - """ - List Deployments - - Args: - account_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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - return await self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_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[ByScriptGetResponse], ResultWrapper[ByScriptGetResponse]), - ) - - -class ByScriptsWithRawResponse: - def __init__(self, by_scripts: ByScripts) -> None: - self._by_scripts = by_scripts - - self.get = to_raw_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> DetailsWithRawResponse: - return DetailsWithRawResponse(self._by_scripts.details) - - -class AsyncByScriptsWithRawResponse: - def __init__(self, by_scripts: AsyncByScripts) -> None: - self._by_scripts = by_scripts - - self.get = async_to_raw_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> AsyncDetailsWithRawResponse: - return AsyncDetailsWithRawResponse(self._by_scripts.details) - - -class ByScriptsWithStreamingResponse: - def __init__(self, by_scripts: ByScripts) -> None: - self._by_scripts = by_scripts - - self.get = to_streamed_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> DetailsWithStreamingResponse: - return DetailsWithStreamingResponse(self._by_scripts.details) - - -class AsyncByScriptsWithStreamingResponse: - def __init__(self, by_scripts: AsyncByScripts) -> None: - self._by_scripts = by_scripts - - self.get = async_to_streamed_response_wrapper( - by_scripts.get, - ) - - @cached_property - def details(self) -> AsyncDetailsWithStreamingResponse: - return AsyncDetailsWithStreamingResponse(self._by_scripts.details) diff --git a/src/cloudflare/resources/workers/deployments/by_scripts/details.py b/src/cloudflare/resources/workers/deployments/by_scripts/details.py deleted file mode 100644 index 2cefee37462..00000000000 --- a/src/cloudflare/resources/workers/deployments/by_scripts/details.py +++ /dev/null @@ -1,170 +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.workers.deployments.by_scripts import DetailGetResponse - -__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, - deployment_id: str, - *, - account_id: str, - script_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, - ) -> DetailGetResponse: - """ - Get Deployment Detail - - Args: - account_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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - if not deployment_id: - raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") - return self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_id}/detail/{deployment_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[DetailGetResponse], ResultWrapper[DetailGetResponse]), - ) - - -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, - deployment_id: str, - *, - account_id: str, - script_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, - ) -> DetailGetResponse: - """ - Get Deployment Detail - - Args: - account_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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_id: - raise ValueError(f"Expected a non-empty value for `script_id` but received {script_id!r}") - if not deployment_id: - raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") - return await self._get( - f"/accounts/{account_id}/workers/deployments/by-script/{script_id}/detail/{deployment_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[DetailGetResponse], ResultWrapper[DetailGetResponse]), - ) - - -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/workers/deployments/deployments.py b/src/cloudflare/resources/workers/deployments/deployments.py deleted file mode 100644 index fc2375aa29e..00000000000 --- a/src/cloudflare/resources/workers/deployments/deployments.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from .by_scripts import ( - ByScripts, - AsyncByScripts, - ByScriptsWithRawResponse, - AsyncByScriptsWithRawResponse, - ByScriptsWithStreamingResponse, - AsyncByScriptsWithStreamingResponse, -) -from ...._resource import SyncAPIResource, AsyncAPIResource -from .by_scripts.by_scripts import ByScripts, AsyncByScripts - -__all__ = ["Deployments", "AsyncDeployments"] - - -class Deployments(SyncAPIResource): - @cached_property - def by_scripts(self) -> ByScripts: - return ByScripts(self._client) - - @cached_property - def with_raw_response(self) -> DeploymentsWithRawResponse: - return DeploymentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DeploymentsWithStreamingResponse: - return DeploymentsWithStreamingResponse(self) - - -class AsyncDeployments(AsyncAPIResource): - @cached_property - def by_scripts(self) -> AsyncByScripts: - return AsyncByScripts(self._client) - - @cached_property - def with_raw_response(self) -> AsyncDeploymentsWithRawResponse: - return AsyncDeploymentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDeploymentsWithStreamingResponse: - return AsyncDeploymentsWithStreamingResponse(self) - - -class DeploymentsWithRawResponse: - def __init__(self, deployments: Deployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> ByScriptsWithRawResponse: - return ByScriptsWithRawResponse(self._deployments.by_scripts) - - -class AsyncDeploymentsWithRawResponse: - def __init__(self, deployments: AsyncDeployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> AsyncByScriptsWithRawResponse: - return AsyncByScriptsWithRawResponse(self._deployments.by_scripts) - - -class DeploymentsWithStreamingResponse: - def __init__(self, deployments: Deployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> ByScriptsWithStreamingResponse: - return ByScriptsWithStreamingResponse(self._deployments.by_scripts) - - -class AsyncDeploymentsWithStreamingResponse: - def __init__(self, deployments: AsyncDeployments) -> None: - self._deployments = deployments - - @cached_property - def by_scripts(self) -> AsyncByScriptsWithStreamingResponse: - return AsyncByScriptsWithStreamingResponse(self._deployments.by_scripts) diff --git a/src/cloudflare/resources/workers/filters.py b/src/cloudflare/resources/workers/filters.py deleted file mode 100644 index 6efc1244bac..00000000000 --- a/src/cloudflare/resources/workers/filters.py +++ /dev/null @@ -1,495 +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 ..._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 ( - WorkersFilter, - FilterCreateResponse, - FilterDeleteResponse, - filter_create_params, - filter_delete_params, - filter_update_params, -) - -__all__ = ["Filters", "AsyncFilters"] - - -class Filters(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FiltersWithRawResponse: - return FiltersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FiltersWithStreamingResponse: - return FiltersWithStreamingResponse(self) - - def create( - self, - *, - zone_id: str, - enabled: bool, - pattern: 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[FilterCreateResponse]: - """ - Create Filter - - 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._post( - f"/zones/{zone_id}/workers/filters", - body=maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_create_params.FilterCreateParams, - ), - 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[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), - ) - - def update( - self, - filter_id: str, - *, - zone_id: str, - enabled: bool, - pattern: 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, - ) -> WorkersFilter: - """ - Update Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return self._put( - f"/zones/{zone_id}/workers/filters/{filter_id}", - body=maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_update_params.FilterUpdateParams, - ), - 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[WorkersFilter], ResultWrapper[WorkersFilter]), - ) - - 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[WorkersFilter]: - """ - List Filters - - 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/filters", - page=SyncSinglePage[WorkersFilter], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersFilter, - ) - - def delete( - self, - filter_id: str, - *, - zone_id: str, - body: object, - # 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[FilterDeleteResponse]: - """ - Delete Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return self._delete( - f"/zones/{zone_id}/workers/filters/{filter_id}", - body=maybe_transform(body, filter_delete_params.FilterDeleteParams), - 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[FilterDeleteResponse]], ResultWrapper[FilterDeleteResponse]), - ) - - -class AsyncFilters(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFiltersWithRawResponse: - return AsyncFiltersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFiltersWithStreamingResponse: - return AsyncFiltersWithStreamingResponse(self) - - async def create( - self, - *, - zone_id: str, - enabled: bool, - pattern: 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[FilterCreateResponse]: - """ - Create Filter - - 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 await self._post( - f"/zones/{zone_id}/workers/filters", - body=await async_maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_create_params.FilterCreateParams, - ), - 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[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), - ) - - async def update( - self, - filter_id: str, - *, - zone_id: str, - enabled: bool, - pattern: 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, - ) -> WorkersFilter: - """ - Update Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return await self._put( - f"/zones/{zone_id}/workers/filters/{filter_id}", - body=await async_maybe_transform( - { - "enabled": enabled, - "pattern": pattern, - }, - filter_update_params.FilterUpdateParams, - ), - 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[WorkersFilter], ResultWrapper[WorkersFilter]), - ) - - 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[WorkersFilter, AsyncSinglePage[WorkersFilter]]: - """ - List Filters - - 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/filters", - page=AsyncSinglePage[WorkersFilter], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersFilter, - ) - - async def delete( - self, - filter_id: str, - *, - zone_id: str, - body: object, - # 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[FilterDeleteResponse]: - """ - Delete Filter - - Args: - zone_id: Identifier - - filter_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 filter_id: - raise ValueError(f"Expected a non-empty value for `filter_id` but received {filter_id!r}") - return await self._delete( - f"/zones/{zone_id}/workers/filters/{filter_id}", - body=await async_maybe_transform(body, filter_delete_params.FilterDeleteParams), - 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[FilterDeleteResponse]], ResultWrapper[FilterDeleteResponse]), - ) - - -class FiltersWithRawResponse: - def __init__(self, filters: Filters) -> None: - self._filters = filters - - self.create = to_raw_response_wrapper( - filters.create, - ) - self.update = to_raw_response_wrapper( - filters.update, - ) - self.list = to_raw_response_wrapper( - filters.list, - ) - self.delete = to_raw_response_wrapper( - filters.delete, - ) - - -class AsyncFiltersWithRawResponse: - def __init__(self, filters: AsyncFilters) -> None: - self._filters = filters - - self.create = async_to_raw_response_wrapper( - filters.create, - ) - self.update = async_to_raw_response_wrapper( - filters.update, - ) - self.list = async_to_raw_response_wrapper( - filters.list, - ) - self.delete = async_to_raw_response_wrapper( - filters.delete, - ) - - -class FiltersWithStreamingResponse: - def __init__(self, filters: Filters) -> None: - self._filters = filters - - self.create = to_streamed_response_wrapper( - filters.create, - ) - self.update = to_streamed_response_wrapper( - filters.update, - ) - self.list = to_streamed_response_wrapper( - filters.list, - ) - self.delete = to_streamed_response_wrapper( - filters.delete, - ) - - -class AsyncFiltersWithStreamingResponse: - def __init__(self, filters: AsyncFilters) -> None: - self._filters = filters - - self.create = async_to_streamed_response_wrapper( - filters.create, - ) - self.update = async_to_streamed_response_wrapper( - filters.update, - ) - self.list = async_to_streamed_response_wrapper( - filters.list, - ) - self.delete = async_to_streamed_response_wrapper( - filters.delete, - ) diff --git a/src/cloudflare/resources/workers/routes.py b/src/cloudflare/resources/workers/routes.py deleted file mode 100644 index 275351e5168..00000000000 --- a/src/cloudflare/resources/workers/routes.py +++ /dev/null @@ -1,617 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, 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 ...pagination import SyncSinglePage, AsyncSinglePage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.shared import UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f -from ...types.workers import WorkersRoute, route_create_params, route_delete_params, route_update_params - -__all__ = ["Routes", "AsyncRoutes"] - - -class Routes(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(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, - ) -> UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f: - """ - 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 cast( - UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, - 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, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - 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[WorkersRoute]: - """ - 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[WorkersRoute], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersRoute, - ) - - def delete( - self, - route_id: str, - *, - zone_id: str, - body: object, - # 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, - ) -> UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f: - """ - 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 cast( - UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, - self._delete( - f"/zones/{zone_id}/workers/routes/{route_id}", - body=maybe_transform(body, route_delete_params.RouteDeleteParams), - 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( - Any, ResultWrapper[UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - -class AsyncRoutes(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(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, - ) -> UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f: - """ - 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 cast( - UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, - 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, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - 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[WorkersRoute, AsyncSinglePage[WorkersRoute]]: - """ - 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[WorkersRoute], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=WorkersRoute, - ) - - async def delete( - self, - route_id: str, - *, - zone_id: str, - body: object, - # 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, - ) -> UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f: - """ - 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 cast( - UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, - await self._delete( - f"/zones/{zone_id}/workers/routes/{route_id}", - body=await async_maybe_transform(body, route_delete_params.RouteDeleteParams), - 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( - Any, ResultWrapper[UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - 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, - ) -> WorkersRoute: - """ - 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._unwrapper, - ), - cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), - ) - - -class RoutesWithRawResponse: - def __init__(self, routes: Routes) -> 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 AsyncRoutesWithRawResponse: - def __init__(self, routes: AsyncRoutes) -> 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 RoutesWithStreamingResponse: - def __init__(self, routes: Routes) -> 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 AsyncRoutesWithStreamingResponse: - def __init__(self, routes: AsyncRoutes) -> 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/scripts/__init__.py b/src/cloudflare/resources/workers/scripts/__init__.py index 744428090ea..03f80b90bad 100644 --- a/src/cloudflare/resources/workers/scripts/__init__.py +++ b/src/cloudflare/resources/workers/scripts/__init__.py @@ -24,14 +24,6 @@ ScriptsWithStreamingResponse, AsyncScriptsWithStreamingResponse, ) -from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, -) from .settings import ( Settings, AsyncSettings, @@ -56,14 +48,6 @@ SchedulesWithStreamingResponse, AsyncSchedulesWithStreamingResponse, ) -from .content_v2 import ( - ContentV2, - AsyncContentV2, - ContentV2WithRawResponse, - AsyncContentV2WithRawResponse, - ContentV2WithStreamingResponse, - AsyncContentV2WithStreamingResponse, -) from .deployments import ( Deployments, AsyncDeployments, @@ -72,22 +56,8 @@ DeploymentsWithStreamingResponse, AsyncDeploymentsWithStreamingResponse, ) -from .usage_model import ( - UsageModel, - AsyncUsageModel, - UsageModelWithRawResponse, - AsyncUsageModelWithRawResponse, - UsageModelWithStreamingResponse, - AsyncUsageModelWithStreamingResponse, -) __all__ = [ - "Bindings", - "AsyncBindings", - "BindingsWithRawResponse", - "AsyncBindingsWithRawResponse", - "BindingsWithStreamingResponse", - "AsyncBindingsWithStreamingResponse", "Schedules", "AsyncSchedules", "SchedulesWithRawResponse", @@ -100,24 +70,12 @@ "AsyncTailWithRawResponse", "TailWithStreamingResponse", "AsyncTailWithStreamingResponse", - "UsageModel", - "AsyncUsageModel", - "UsageModelWithRawResponse", - "AsyncUsageModelWithRawResponse", - "UsageModelWithStreamingResponse", - "AsyncUsageModelWithStreamingResponse", "Content", "AsyncContent", "ContentWithRawResponse", "AsyncContentWithRawResponse", "ContentWithStreamingResponse", "AsyncContentWithStreamingResponse", - "ContentV2", - "AsyncContentV2", - "ContentV2WithRawResponse", - "AsyncContentV2WithRawResponse", - "ContentV2WithStreamingResponse", - "AsyncContentV2WithStreamingResponse", "Settings", "AsyncSettings", "SettingsWithRawResponse", diff --git a/src/cloudflare/resources/workers/scripts/bindings.py b/src/cloudflare/resources/workers/scripts/bindings.py deleted file mode 100644 index c02a306bd31..00000000000 --- a/src/cloudflare/resources/workers/scripts/bindings.py +++ /dev/null @@ -1,158 +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.workers.scripts import BindingGetResponse - -__all__ = ["Bindings", "AsyncBindings"] - - -class Bindings(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self) - - def get( - 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, - ) -> BindingGetResponse: - """ - List the bindings for a Workers script. - - 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( - f"/zones/{zone_id}/workers/script/bindings", - 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[BindingGetResponse], ResultWrapper[BindingGetResponse]), - ) - - -class AsyncBindings(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self) - - async def get( - 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, - ) -> BindingGetResponse: - """ - List the bindings for a Workers script. - - 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 await self._get( - f"/zones/{zone_id}/workers/script/bindings", - 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[BindingGetResponse], ResultWrapper[BindingGetResponse]), - ) - - -class BindingsWithRawResponse: - def __init__(self, bindings: Bindings) -> None: - self._bindings = bindings - - self.get = to_raw_response_wrapper( - bindings.get, - ) - - -class AsyncBindingsWithRawResponse: - def __init__(self, bindings: AsyncBindings) -> None: - self._bindings = bindings - - self.get = async_to_raw_response_wrapper( - bindings.get, - ) - - -class BindingsWithStreamingResponse: - def __init__(self, bindings: Bindings) -> None: - self._bindings = bindings - - self.get = to_streamed_response_wrapper( - bindings.get, - ) - - -class AsyncBindingsWithStreamingResponse: - def __init__(self, bindings: AsyncBindings) -> None: - self._bindings = bindings - - self.get = async_to_streamed_response_wrapper( - bindings.get, - ) diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py index d104e21090a..20439245e8a 100644 --- a/src/cloudflare/resources/workers/scripts/content.py +++ b/src/cloudflare/resources/workers/scripts/content.py @@ -17,10 +17,18 @@ from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, + to_custom_raw_response_wrapper, async_to_streamed_response_wrapper, + to_custom_streamed_response_wrapper, + async_to_custom_raw_response_wrapper, + async_to_custom_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper from ...._base_client import ( @@ -109,6 +117,47 @@ def update( cast_to=cast(Type[Script], ResultWrapper[Script]), ) + def get( + self, + script_name: str, + *, + account_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, + ) -> BinaryAPIResponse: + """ + Fetch script content only + + Args: + account_id: Identifier + + script_name: 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 account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = {"Accept": "string", **(extra_headers or {})} + return self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryAPIResponse, + ) + class AsyncContent(AsyncAPIResource): @cached_property @@ -187,6 +236,47 @@ async def update( cast_to=cast(Type[Script], ResultWrapper[Script]), ) + async def get( + self, + script_name: str, + *, + account_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, + ) -> AsyncBinaryAPIResponse: + """ + Fetch script content only + + Args: + account_id: Identifier + + script_name: 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 account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = {"Accept": "string", **(extra_headers or {})} + return await self._get( + f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AsyncBinaryAPIResponse, + ) + class ContentWithRawResponse: def __init__(self, content: Content) -> None: @@ -195,6 +285,10 @@ def __init__(self, content: Content) -> None: self.update = to_raw_response_wrapper( content.update, ) + self.get = to_custom_raw_response_wrapper( + content.get, + BinaryAPIResponse, + ) class AsyncContentWithRawResponse: @@ -204,6 +298,10 @@ def __init__(self, content: AsyncContent) -> None: self.update = async_to_raw_response_wrapper( content.update, ) + self.get = async_to_custom_raw_response_wrapper( + content.get, + AsyncBinaryAPIResponse, + ) class ContentWithStreamingResponse: @@ -213,6 +311,10 @@ def __init__(self, content: Content) -> None: self.update = to_streamed_response_wrapper( content.update, ) + self.get = to_custom_streamed_response_wrapper( + content.get, + StreamedBinaryAPIResponse, + ) class AsyncContentWithStreamingResponse: @@ -222,3 +324,7 @@ def __init__(self, content: AsyncContent) -> None: self.update = async_to_streamed_response_wrapper( content.update, ) + self.get = async_to_custom_streamed_response_wrapper( + content.get, + AsyncStreamedBinaryAPIResponse, + ) diff --git a/src/cloudflare/resources/workers/scripts/content_v2.py b/src/cloudflare/resources/workers/scripts/content_v2.py deleted file mode 100644 index 0066d76d0a0..00000000000 --- a/src/cloudflare/resources/workers/scripts/content_v2.py +++ /dev/null @@ -1,166 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, - to_custom_raw_response_wrapper, - to_custom_streamed_response_wrapper, - async_to_custom_raw_response_wrapper, - async_to_custom_streamed_response_wrapper, -) -from ...._base_client import ( - make_request_options, -) - -__all__ = ["ContentV2", "AsyncContentV2"] - - -class ContentV2(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ContentV2WithRawResponse: - return ContentV2WithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContentV2WithStreamingResponse: - return ContentV2WithStreamingResponse(self) - - def get( - self, - script_name: str, - *, - account_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, - ) -> BinaryAPIResponse: - """ - Fetch script content only - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncContentV2(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncContentV2WithRawResponse: - return AsyncContentV2WithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContentV2WithStreamingResponse: - return AsyncContentV2WithStreamingResponse(self) - - async def get( - self, - script_name: str, - *, - account_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, - ) -> AsyncBinaryAPIResponse: - """ - Fetch script content only - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return await self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class ContentV2WithRawResponse: - def __init__(self, content_v2: ContentV2) -> None: - self._content_v2 = content_v2 - - self.get = to_custom_raw_response_wrapper( - content_v2.get, - BinaryAPIResponse, - ) - - -class AsyncContentV2WithRawResponse: - def __init__(self, content_v2: AsyncContentV2) -> None: - self._content_v2 = content_v2 - - self.get = async_to_custom_raw_response_wrapper( - content_v2.get, - AsyncBinaryAPIResponse, - ) - - -class ContentV2WithStreamingResponse: - def __init__(self, content_v2: ContentV2) -> None: - self._content_v2 = content_v2 - - self.get = to_custom_streamed_response_wrapper( - content_v2.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncContentV2WithStreamingResponse: - def __init__(self, content_v2: AsyncContentV2) -> None: - self._content_v2 = content_v2 - - self.get = async_to_custom_streamed_response_wrapper( - content_v2.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index f0aacc83a14..a23838b3bad 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -22,14 +22,6 @@ ContentWithStreamingResponse, AsyncContentWithStreamingResponse, ) -from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, -) from .settings import ( Settings, AsyncSettings, @@ -61,14 +53,6 @@ AsyncSchedulesWithStreamingResponse, ) from ...._compat import cached_property -from .content_v2 import ( - ContentV2, - AsyncContentV2, - ContentV2WithRawResponse, - AsyncContentV2WithRawResponse, - ContentV2WithStreamingResponse, - AsyncContentV2WithStreamingResponse, -) from .deployments import ( Deployments, AsyncDeployments, @@ -77,14 +61,6 @@ DeploymentsWithStreamingResponse, AsyncDeploymentsWithStreamingResponse, ) -from .usage_model import ( - UsageModel, - AsyncUsageModel, - UsageModelWithRawResponse, - AsyncUsageModelWithRawResponse, - UsageModelWithStreamingResponse, - AsyncUsageModelWithStreamingResponse, -) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( BinaryAPIResponse, @@ -107,16 +83,11 @@ make_request_options, ) from ....types.workers import Script, script_delete_params, script_update_params -from .versions.versions import Versions, AsyncVersions __all__ = ["Scripts", "AsyncScripts"] class Scripts(SyncAPIResource): - @cached_property - def bindings(self) -> Bindings: - return Bindings(self._client) - @cached_property def schedules(self) -> Schedules: return Schedules(self._client) @@ -125,18 +96,10 @@ def schedules(self) -> Schedules: def tail(self) -> Tail: return Tail(self._client) - @cached_property - def usage_model(self) -> UsageModel: - return UsageModel(self._client) - @cached_property def content(self) -> Content: return Content(self._client) - @cached_property - def content_v2(self) -> ContentV2: - return ContentV2(self._client) - @cached_property def settings(self) -> Settings: return Settings(self._client) @@ -417,10 +380,6 @@ def get( class AsyncScripts(AsyncAPIResource): - @cached_property - def bindings(self) -> AsyncBindings: - return AsyncBindings(self._client) - @cached_property def schedules(self) -> AsyncSchedules: return AsyncSchedules(self._client) @@ -429,18 +388,10 @@ def schedules(self) -> AsyncSchedules: def tail(self) -> AsyncTail: return AsyncTail(self._client) - @cached_property - def usage_model(self) -> AsyncUsageModel: - return AsyncUsageModel(self._client) - @cached_property def content(self) -> AsyncContent: return AsyncContent(self._client) - @cached_property - def content_v2(self) -> AsyncContentV2: - return AsyncContentV2(self._client) - @cached_property def settings(self) -> AsyncSettings: return AsyncSettings(self._client) @@ -740,10 +691,6 @@ def __init__(self, scripts: Scripts) -> None: BinaryAPIResponse, ) - @cached_property - def bindings(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self._scripts.bindings) - @cached_property def schedules(self) -> SchedulesWithRawResponse: return SchedulesWithRawResponse(self._scripts.schedules) @@ -752,18 +699,10 @@ def schedules(self) -> SchedulesWithRawResponse: def tail(self) -> TailWithRawResponse: return TailWithRawResponse(self._scripts.tail) - @cached_property - def usage_model(self) -> UsageModelWithRawResponse: - return UsageModelWithRawResponse(self._scripts.usage_model) - @cached_property def content(self) -> ContentWithRawResponse: return ContentWithRawResponse(self._scripts.content) - @cached_property - def content_v2(self) -> ContentV2WithRawResponse: - return ContentV2WithRawResponse(self._scripts.content_v2) - @cached_property def settings(self) -> SettingsWithRawResponse: return SettingsWithRawResponse(self._scripts.settings) @@ -795,10 +734,6 @@ def __init__(self, scripts: AsyncScripts) -> None: AsyncBinaryAPIResponse, ) - @cached_property - def bindings(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self._scripts.bindings) - @cached_property def schedules(self) -> AsyncSchedulesWithRawResponse: return AsyncSchedulesWithRawResponse(self._scripts.schedules) @@ -807,18 +742,10 @@ def schedules(self) -> AsyncSchedulesWithRawResponse: def tail(self) -> AsyncTailWithRawResponse: return AsyncTailWithRawResponse(self._scripts.tail) - @cached_property - def usage_model(self) -> AsyncUsageModelWithRawResponse: - return AsyncUsageModelWithRawResponse(self._scripts.usage_model) - @cached_property def content(self) -> AsyncContentWithRawResponse: return AsyncContentWithRawResponse(self._scripts.content) - @cached_property - def content_v2(self) -> AsyncContentV2WithRawResponse: - return AsyncContentV2WithRawResponse(self._scripts.content_v2) - @cached_property def settings(self) -> AsyncSettingsWithRawResponse: return AsyncSettingsWithRawResponse(self._scripts.settings) @@ -850,10 +777,6 @@ def __init__(self, scripts: Scripts) -> None: StreamedBinaryAPIResponse, ) - @cached_property - def bindings(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self._scripts.bindings) - @cached_property def schedules(self) -> SchedulesWithStreamingResponse: return SchedulesWithStreamingResponse(self._scripts.schedules) @@ -862,18 +785,10 @@ def schedules(self) -> SchedulesWithStreamingResponse: def tail(self) -> TailWithStreamingResponse: return TailWithStreamingResponse(self._scripts.tail) - @cached_property - def usage_model(self) -> UsageModelWithStreamingResponse: - return UsageModelWithStreamingResponse(self._scripts.usage_model) - @cached_property def content(self) -> ContentWithStreamingResponse: return ContentWithStreamingResponse(self._scripts.content) - @cached_property - def content_v2(self) -> ContentV2WithStreamingResponse: - return ContentV2WithStreamingResponse(self._scripts.content_v2) - @cached_property def settings(self) -> SettingsWithStreamingResponse: return SettingsWithStreamingResponse(self._scripts.settings) @@ -905,10 +820,6 @@ def __init__(self, scripts: AsyncScripts) -> None: AsyncStreamedBinaryAPIResponse, ) - @cached_property - def bindings(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self._scripts.bindings) - @cached_property def schedules(self) -> AsyncSchedulesWithStreamingResponse: return AsyncSchedulesWithStreamingResponse(self._scripts.schedules) @@ -917,18 +828,10 @@ def schedules(self) -> AsyncSchedulesWithStreamingResponse: def tail(self) -> AsyncTailWithStreamingResponse: return AsyncTailWithStreamingResponse(self._scripts.tail) - @cached_property - def usage_model(self) -> AsyncUsageModelWithStreamingResponse: - return AsyncUsageModelWithStreamingResponse(self._scripts.usage_model) - @cached_property def content(self) -> AsyncContentWithStreamingResponse: return AsyncContentWithStreamingResponse(self._scripts.content) - @cached_property - def content_v2(self) -> AsyncContentV2WithStreamingResponse: - return AsyncContentV2WithStreamingResponse(self._scripts.content_v2) - @cached_property def settings(self) -> AsyncSettingsWithStreamingResponse: return AsyncSettingsWithStreamingResponse(self._scripts.settings) diff --git a/src/cloudflare/resources/workers/scripts/usage_model.py b/src/cloudflare/resources/workers/scripts/usage_model.py deleted file mode 100644 index b008bdb3cca..00000000000 --- a/src/cloudflare/resources/workers/scripts/usage_model.py +++ /dev/null @@ -1,280 +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.workers.scripts import UsageModelGetResponse, UsageModelUpdateResponse, usage_model_update_params - -__all__ = ["UsageModel", "AsyncUsageModel"] - - -class UsageModel(SyncAPIResource): - @cached_property - def with_raw_response(self) -> UsageModelWithRawResponse: - return UsageModelWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsageModelWithStreamingResponse: - return UsageModelWithStreamingResponse(self) - - def update( - self, - script_name: str, - *, - account_id: str, - body: 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, - ) -> UsageModelUpdateResponse: - """Updates the Usage Model for a given Worker. - - Requires a Workers Paid - subscription. - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return self._put( - f"/accounts/{account_id}/workers/scripts/{script_name}/usage-model", - body=maybe_transform(body, usage_model_update_params.UsageModelUpdateParams), - 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[UsageModelUpdateResponse], ResultWrapper[UsageModelUpdateResponse]), - ) - - def get( - self, - script_name: str, - *, - account_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, - ) -> UsageModelGetResponse: - """ - Fetches the Usage Model for a given Worker. - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/usage-model", - 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[UsageModelGetResponse], ResultWrapper[UsageModelGetResponse]), - ) - - -class AsyncUsageModel(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncUsageModelWithRawResponse: - return AsyncUsageModelWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsageModelWithStreamingResponse: - return AsyncUsageModelWithStreamingResponse(self) - - async def update( - self, - script_name: str, - *, - account_id: str, - body: 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, - ) -> UsageModelUpdateResponse: - """Updates the Usage Model for a given Worker. - - Requires a Workers Paid - subscription. - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return await self._put( - f"/accounts/{account_id}/workers/scripts/{script_name}/usage-model", - body=await async_maybe_transform(body, usage_model_update_params.UsageModelUpdateParams), - 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[UsageModelUpdateResponse], ResultWrapper[UsageModelUpdateResponse]), - ) - - async def get( - self, - script_name: str, - *, - account_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, - ) -> UsageModelGetResponse: - """ - Fetches the Usage Model for a given Worker. - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return await self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/usage-model", - 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[UsageModelGetResponse], ResultWrapper[UsageModelGetResponse]), - ) - - -class UsageModelWithRawResponse: - def __init__(self, usage_model: UsageModel) -> None: - self._usage_model = usage_model - - self.update = to_raw_response_wrapper( - usage_model.update, - ) - self.get = to_raw_response_wrapper( - usage_model.get, - ) - - -class AsyncUsageModelWithRawResponse: - def __init__(self, usage_model: AsyncUsageModel) -> None: - self._usage_model = usage_model - - self.update = async_to_raw_response_wrapper( - usage_model.update, - ) - self.get = async_to_raw_response_wrapper( - usage_model.get, - ) - - -class UsageModelWithStreamingResponse: - def __init__(self, usage_model: UsageModel) -> None: - self._usage_model = usage_model - - self.update = to_streamed_response_wrapper( - usage_model.update, - ) - self.get = to_streamed_response_wrapper( - usage_model.get, - ) - - -class AsyncUsageModelWithStreamingResponse: - def __init__(self, usage_model: AsyncUsageModel) -> None: - self._usage_model = usage_model - - self.update = async_to_streamed_response_wrapper( - usage_model.update, - ) - self.get = async_to_streamed_response_wrapper( - usage_model.get, - ) diff --git a/src/cloudflare/resources/workers/scripts/versions/versions.py b/src/cloudflare/resources/workers/scripts/versions.py similarity index 92% rename from src/cloudflare/resources/workers/scripts/versions/versions.py rename to src/cloudflare/resources/workers/scripts/versions.py index bee6f8ccdd3..a1097ea6479 100644 --- a/src/cloudflare/resources/workers/scripts/versions/versions.py +++ b/src/cloudflare/resources/workers/scripts/versions.py @@ -6,34 +6,26 @@ import httpx -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ....._utils import ( +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ...._utils import ( extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform, ) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( +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 ( +from ...._wrappers import ResultWrapper +from ...._base_client import ( make_request_options, ) -from .....types.workers.scripts import ( +from ....types.workers.scripts import ( VersionGetResponse, VersionListResponse, VersionCreateResponse, @@ -44,10 +36,6 @@ class Versions(SyncAPIResource): - @cached_property - def settings(self) -> Settings: - return Settings(self._client) - @cached_property def with_raw_response(self) -> VersionsWithRawResponse: return VersionsWithRawResponse(self) @@ -216,10 +204,6 @@ def get( class AsyncVersions(AsyncAPIResource): - @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) - @cached_property def with_raw_response(self) -> AsyncVersionsWithRawResponse: return AsyncVersionsWithRawResponse(self) @@ -401,10 +385,6 @@ def __init__(self, versions: Versions) -> None: versions.get, ) - @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._versions.settings) - class AsyncVersionsWithRawResponse: def __init__(self, versions: AsyncVersions) -> None: @@ -420,10 +400,6 @@ def __init__(self, versions: AsyncVersions) -> None: versions.get, ) - @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._versions.settings) - class VersionsWithStreamingResponse: def __init__(self, versions: Versions) -> None: @@ -439,10 +415,6 @@ def __init__(self, versions: Versions) -> None: versions.get, ) - @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._versions.settings) - class AsyncVersionsWithStreamingResponse: def __init__(self, versions: AsyncVersions) -> None: @@ -457,7 +429,3 @@ def __init__(self, versions: AsyncVersions) -> None: self.get = async_to_streamed_response_wrapper( versions.get, ) - - @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._versions.settings) diff --git a/src/cloudflare/resources/workers/scripts/versions/__init__.py b/src/cloudflare/resources/workers/scripts/versions/__init__.py deleted file mode 100644 index de0fccf6d92..00000000000 --- a/src/cloudflare/resources/workers/scripts/versions/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from .versions import ( - Versions, - AsyncVersions, - VersionsWithRawResponse, - AsyncVersionsWithRawResponse, - VersionsWithStreamingResponse, - AsyncVersionsWithStreamingResponse, -) - -__all__ = [ - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Versions", - "AsyncVersions", - "VersionsWithRawResponse", - "AsyncVersionsWithRawResponse", - "VersionsWithStreamingResponse", - "AsyncVersionsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/scripts/versions/settings.py b/src/cloudflare/resources/workers/scripts/versions/settings.py deleted file mode 100644 index 0e6b518fad1..00000000000 --- a/src/cloudflare/resources/workers/scripts/versions/settings.py +++ /dev/null @@ -1,276 +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.workers.scripts.versions import Settings, SettingsParam, settings, setting_edit_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 edit( - self, - script_name: str, - *, - account_id: str, - settings: SettingsParam | 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, - ) -> settings.Settings: - """ - Patch metadata or config, such as bindings or usage model - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return self._patch( - f"/accounts/{account_id}/workers/scripts/{script_name}/settings", - body=maybe_transform({"settings": settings}, 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[settings.Settings], ResultWrapper[settings.Settings]), - ) - - def get( - self, - script_name: str, - *, - account_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, - ) -> settings.Settings: - """ - Get metadata and config, such as bindings or usage model - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/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[settings.Settings], ResultWrapper[settings.Settings]), - ) - - -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 edit( - self, - script_name: str, - *, - account_id: str, - settings: SettingsParam | 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, - ) -> settings.Settings: - """ - Patch metadata or config, such as bindings or usage model - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return await self._patch( - f"/accounts/{account_id}/workers/scripts/{script_name}/settings", - body=await async_maybe_transform({"settings": settings}, 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[settings.Settings], ResultWrapper[settings.Settings]), - ) - - async def get( - self, - script_name: str, - *, - account_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, - ) -> settings.Settings: - """ - Get metadata and config, such as bindings or usage model - - Args: - account_id: Identifier - - script_name: 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - return await self._get( - f"/accounts/{account_id}/workers/scripts/{script_name}/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[settings.Settings], ResultWrapper[settings.Settings]), - ) - - -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: - self._settings = settings - - 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.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.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.edit = async_to_streamed_response_wrapper( - settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - settings.get, - ) diff --git a/src/cloudflare/resources/workers/services/__init__.py b/src/cloudflare/resources/workers/services/__init__.py deleted file mode 100644 index 96650dff04d..00000000000 --- a/src/cloudflare/resources/workers/services/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, -) -from .environments import ( - Environments, - AsyncEnvironments, - EnvironmentsWithRawResponse, - AsyncEnvironmentsWithRawResponse, - EnvironmentsWithStreamingResponse, - AsyncEnvironmentsWithStreamingResponse, -) - -__all__ = [ - "Environments", - "AsyncEnvironments", - "EnvironmentsWithRawResponse", - "AsyncEnvironmentsWithRawResponse", - "EnvironmentsWithStreamingResponse", - "AsyncEnvironmentsWithStreamingResponse", - "Services", - "AsyncServices", - "ServicesWithRawResponse", - "AsyncServicesWithRawResponse", - "ServicesWithStreamingResponse", - "AsyncServicesWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/services/environments/__init__.py b/src/cloudflare/resources/workers/services/environments/__init__.py deleted file mode 100644 index 5717ce990a4..00000000000 --- a/src/cloudflare/resources/workers/services/environments/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from .environments import ( - Environments, - AsyncEnvironments, - EnvironmentsWithRawResponse, - AsyncEnvironmentsWithRawResponse, - EnvironmentsWithStreamingResponse, - AsyncEnvironmentsWithStreamingResponse, -) - -__all__ = [ - "Content", - "AsyncContent", - "ContentWithRawResponse", - "AsyncContentWithRawResponse", - "ContentWithStreamingResponse", - "AsyncContentWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Environments", - "AsyncEnvironments", - "EnvironmentsWithRawResponse", - "AsyncEnvironmentsWithRawResponse", - "EnvironmentsWithStreamingResponse", - "AsyncEnvironmentsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/services/environments/content.py b/src/cloudflare/resources/workers/services/environments/content.py deleted file mode 100644 index bfbbdd5204a..00000000000 --- a/src/cloudflare/resources/workers/services/environments/content.py +++ /dev/null @@ -1,350 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Type, Mapping, cast - -import httpx - -from .....types import shared_params -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ....._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - to_custom_raw_response_wrapper, - async_to_streamed_response_wrapper, - to_custom_streamed_response_wrapper, - async_to_custom_raw_response_wrapper, - async_to_custom_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.workers import Script -from .....types.workers.services.environments import content_update_params - -__all__ = ["Content", "AsyncContent"] - - -class Content(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self) - - def update( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: shared_params.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24 | 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, - ) -> Script: - """ - Put script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. - - metadata: JSON encoded metadata about the uploaded parts and Worker 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) - if files: - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return self._put( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, - 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[Script], ResultWrapper[Script]), - ) - - def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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, - ) -> BinaryAPIResponse: - """ - Get script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/content", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncContent(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self) - - async def update( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: shared_params.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24 | 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, - ) -> Script: - """ - Put script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. - - metadata: JSON encoded metadata about the uploaded parts and Worker 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) - if files: - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return await self._put( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/content", - body=await async_maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, - 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[Script], ResultWrapper[Script]), - ) - - async def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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, - ) -> AsyncBinaryAPIResponse: - """ - Get script content from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - extra_headers = {"Accept": "string", **(extra_headers or {})} - return await self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/content", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class ContentWithRawResponse: - def __init__(self, content: Content) -> None: - self._content = content - - self.update = to_raw_response_wrapper( - content.update, - ) - self.get = to_custom_raw_response_wrapper( - content.get, - BinaryAPIResponse, - ) - - -class AsyncContentWithRawResponse: - def __init__(self, content: AsyncContent) -> None: - self._content = content - - self.update = async_to_raw_response_wrapper( - content.update, - ) - self.get = async_to_custom_raw_response_wrapper( - content.get, - AsyncBinaryAPIResponse, - ) - - -class ContentWithStreamingResponse: - def __init__(self, content: Content) -> None: - self._content = content - - self.update = to_streamed_response_wrapper( - content.update, - ) - self.get = to_custom_streamed_response_wrapper( - content.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncContentWithStreamingResponse: - def __init__(self, content: AsyncContent) -> None: - self._content = content - - self.update = async_to_streamed_response_wrapper( - content.update, - ) - self.get = async_to_custom_streamed_response_wrapper( - content.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/workers/services/environments/environments.py b/src/cloudflare/resources/workers/services/environments/environments.py deleted file mode 100644 index 445c827e40a..00000000000 --- a/src/cloudflare/resources/workers/services/environments/environments.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .content import ( - Content, - AsyncContent, - ContentWithRawResponse, - AsyncContentWithRawResponse, - ContentWithStreamingResponse, - AsyncContentWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Environments", "AsyncEnvironments"] - - -class Environments(SyncAPIResource): - @cached_property - def content(self) -> Content: - return Content(self._client) - - @cached_property - def settings(self) -> Settings: - return Settings(self._client) - - @cached_property - def with_raw_response(self) -> EnvironmentsWithRawResponse: - return EnvironmentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EnvironmentsWithStreamingResponse: - return EnvironmentsWithStreamingResponse(self) - - -class AsyncEnvironments(AsyncAPIResource): - @cached_property - def content(self) -> AsyncContent: - return AsyncContent(self._client) - - @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) - - @cached_property - def with_raw_response(self) -> AsyncEnvironmentsWithRawResponse: - return AsyncEnvironmentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEnvironmentsWithStreamingResponse: - return AsyncEnvironmentsWithStreamingResponse(self) - - -class EnvironmentsWithRawResponse: - def __init__(self, environments: Environments) -> None: - self._environments = environments - - @cached_property - def content(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self._environments.content) - - @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._environments.settings) - - -class AsyncEnvironmentsWithRawResponse: - def __init__(self, environments: AsyncEnvironments) -> None: - self._environments = environments - - @cached_property - def content(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self._environments.content) - - @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._environments.settings) - - -class EnvironmentsWithStreamingResponse: - def __init__(self, environments: Environments) -> None: - self._environments = environments - - @cached_property - def content(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self._environments.content) - - @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._environments.settings) - - -class AsyncEnvironmentsWithStreamingResponse: - def __init__(self, environments: AsyncEnvironments) -> None: - self._environments = environments - - @cached_property - def content(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self._environments.content) - - @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._environments.settings) diff --git a/src/cloudflare/resources/workers/services/environments/settings.py b/src/cloudflare/resources/workers/services/environments/settings.py deleted file mode 100644 index 23fb4591624..00000000000 --- a/src/cloudflare/resources/workers/services/environments/settings.py +++ /dev/null @@ -1,325 +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 .....types import shared_params -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.workers import ScriptSetting, ScriptSettingParam -from .....types.workers.services.environments import setting_edit_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 edit( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - errors: Iterable[shared_params.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72], - messages: Iterable[shared_params.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72], - result: ScriptSettingParam, - success: Literal[True], - # 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, - ) -> ScriptSetting: - """ - Patch script metadata, such as bindings - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - success: Whether the API call was successful - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return self._patch( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/settings", - body=maybe_transform( - { - "errors": errors, - "messages": messages, - "result": result, - "success": success, - }, - 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[ScriptSetting], ResultWrapper[ScriptSetting]), - ) - - def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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, - ) -> ScriptSetting: - """ - Get script settings from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/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[ScriptSetting], ResultWrapper[ScriptSetting]), - ) - - -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 edit( - self, - environment_name: str, - *, - account_id: str, - service_name: str, - errors: Iterable[shared_params.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72], - messages: Iterable[shared_params.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72], - result: ScriptSettingParam, - success: Literal[True], - # 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, - ) -> ScriptSetting: - """ - Patch script metadata, such as bindings - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - success: Whether the API call was successful - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return await self._patch( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/settings", - body=await async_maybe_transform( - { - "errors": errors, - "messages": messages, - "result": result, - "success": success, - }, - 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[ScriptSetting], ResultWrapper[ScriptSetting]), - ) - - async def get( - self, - environment_name: str, - *, - account_id: str, - service_name: 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, - ) -> ScriptSetting: - """ - Get script settings from a worker with an environment - - Args: - account_id: Identifier - - service_name: Name of Worker to bind to - - environment_name: Optional environment if the Worker utilizes one. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not service_name: - raise ValueError(f"Expected a non-empty value for `service_name` but received {service_name!r}") - if not environment_name: - raise ValueError(f"Expected a non-empty value for `environment_name` but received {environment_name!r}") - return await self._get( - f"/accounts/{account_id}/workers/services/{service_name}/environments/{environment_name}/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[ScriptSetting], ResultWrapper[ScriptSetting]), - ) - - -class SettingsWithRawResponse: - def __init__(self, settings: Settings) -> None: - self._settings = settings - - 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.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.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.edit = async_to_streamed_response_wrapper( - settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - settings.get, - ) diff --git a/src/cloudflare/resources/workers/services/services.py b/src/cloudflare/resources/workers/services/services.py deleted file mode 100644 index 0f63305c3bd..00000000000 --- a/src/cloudflare/resources/workers/services/services.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .environments import ( - Environments, - AsyncEnvironments, - EnvironmentsWithRawResponse, - AsyncEnvironmentsWithRawResponse, - EnvironmentsWithStreamingResponse, - AsyncEnvironmentsWithStreamingResponse, -) -from .environments.environments import Environments, AsyncEnvironments - -__all__ = ["Services", "AsyncServices"] - - -class Services(SyncAPIResource): - @cached_property - def environments(self) -> Environments: - return Environments(self._client) - - @cached_property - def with_raw_response(self) -> ServicesWithRawResponse: - return ServicesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ServicesWithStreamingResponse: - return ServicesWithStreamingResponse(self) - - -class AsyncServices(AsyncAPIResource): - @cached_property - def environments(self) -> AsyncEnvironments: - return AsyncEnvironments(self._client) - - @cached_property - def with_raw_response(self) -> AsyncServicesWithRawResponse: - return AsyncServicesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncServicesWithStreamingResponse: - return AsyncServicesWithStreamingResponse(self) - - -class ServicesWithRawResponse: - def __init__(self, services: Services) -> None: - self._services = services - - @cached_property - def environments(self) -> EnvironmentsWithRawResponse: - return EnvironmentsWithRawResponse(self._services.environments) - - -class AsyncServicesWithRawResponse: - def __init__(self, services: AsyncServices) -> None: - self._services = services - - @cached_property - def environments(self) -> AsyncEnvironmentsWithRawResponse: - return AsyncEnvironmentsWithRawResponse(self._services.environments) - - -class ServicesWithStreamingResponse: - def __init__(self, services: Services) -> None: - self._services = services - - @cached_property - def environments(self) -> EnvironmentsWithStreamingResponse: - return EnvironmentsWithStreamingResponse(self._services.environments) - - -class AsyncServicesWithStreamingResponse: - def __init__(self, services: AsyncServices) -> None: - self._services = services - - @cached_property - def environments(self) -> AsyncEnvironmentsWithStreamingResponse: - return AsyncEnvironmentsWithStreamingResponse(self._services.environments) diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py index 9438f5c7ed2..03e68dd70c9 100644 --- a/src/cloudflare/resources/workers/workers.py +++ b/src/cloudflare/resources/workers/workers.py @@ -10,14 +10,6 @@ AIWithStreamingResponse, AsyncAIWithStreamingResponse, ) -from .routes import ( - Routes, - AsyncRoutes, - RoutesWithRawResponse, - AsyncRoutesWithRawResponse, - RoutesWithStreamingResponse, - AsyncRoutesWithStreamingResponse, -) from .domains import ( Domains, AsyncDomains, @@ -26,14 +18,6 @@ DomainsWithStreamingResponse, AsyncDomainsWithStreamingResponse, ) -from .filters import ( - Filters, - AsyncFilters, - FiltersWithRawResponse, - AsyncFiltersWithRawResponse, - FiltersWithStreamingResponse, - AsyncFiltersWithStreamingResponse, -) from .scripts import ( Scripts, AsyncScripts, @@ -42,14 +26,6 @@ ScriptsWithStreamingResponse, AsyncScriptsWithStreamingResponse, ) -from .services import ( - Services, - AsyncServices, - ServicesWithRawResponse, - AsyncServicesWithRawResponse, - ServicesWithStreamingResponse, - AsyncServicesWithStreamingResponse, -) from ..._compat import cached_property from .subdomains import ( Subdomains, @@ -60,14 +36,6 @@ AsyncSubdomainsWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .deployments import ( - Deployments, - AsyncDeployments, - DeploymentsWithRawResponse, - AsyncDeploymentsWithRawResponse, - DeploymentsWithStreamingResponse, - AsyncDeploymentsWithStreamingResponse, -) from .scripts.scripts import Scripts, AsyncScripts from .account_settings import ( AccountSettings, @@ -77,8 +45,6 @@ AccountSettingsWithStreamingResponse, AsyncAccountSettingsWithStreamingResponse, ) -from .services.services import Services, AsyncServices -from .deployments.deployments import Deployments, AsyncDeployments __all__ = ["Workers", "AsyncWorkers"] @@ -92,22 +58,10 @@ def ai(self) -> AI: def scripts(self) -> Scripts: return Scripts(self._client) - @cached_property - def filters(self) -> Filters: - return Filters(self._client) - - @cached_property - def routes(self) -> Routes: - return Routes(self._client) - @cached_property def account_settings(self) -> AccountSettings: return AccountSettings(self._client) - @cached_property - def deployments(self) -> Deployments: - return Deployments(self._client) - @cached_property def domains(self) -> Domains: return Domains(self._client) @@ -116,10 +70,6 @@ def domains(self) -> Domains: def subdomains(self) -> Subdomains: return Subdomains(self._client) - @cached_property - def services(self) -> Services: - return Services(self._client) - @cached_property def with_raw_response(self) -> WorkersWithRawResponse: return WorkersWithRawResponse(self) @@ -138,22 +88,10 @@ def ai(self) -> AsyncAI: def scripts(self) -> AsyncScripts: return AsyncScripts(self._client) - @cached_property - def filters(self) -> AsyncFilters: - return AsyncFilters(self._client) - - @cached_property - def routes(self) -> AsyncRoutes: - return AsyncRoutes(self._client) - @cached_property def account_settings(self) -> AsyncAccountSettings: return AsyncAccountSettings(self._client) - @cached_property - def deployments(self) -> AsyncDeployments: - return AsyncDeployments(self._client) - @cached_property def domains(self) -> AsyncDomains: return AsyncDomains(self._client) @@ -162,10 +100,6 @@ def domains(self) -> AsyncDomains: def subdomains(self) -> AsyncSubdomains: return AsyncSubdomains(self._client) - @cached_property - def services(self) -> AsyncServices: - return AsyncServices(self._client) - @cached_property def with_raw_response(self) -> AsyncWorkersWithRawResponse: return AsyncWorkersWithRawResponse(self) @@ -187,22 +121,10 @@ def ai(self) -> AIWithRawResponse: def scripts(self) -> ScriptsWithRawResponse: return ScriptsWithRawResponse(self._workers.scripts) - @cached_property - def filters(self) -> FiltersWithRawResponse: - return FiltersWithRawResponse(self._workers.filters) - - @cached_property - def routes(self) -> RoutesWithRawResponse: - return RoutesWithRawResponse(self._workers.routes) - @cached_property def account_settings(self) -> AccountSettingsWithRawResponse: return AccountSettingsWithRawResponse(self._workers.account_settings) - @cached_property - def deployments(self) -> DeploymentsWithRawResponse: - return DeploymentsWithRawResponse(self._workers.deployments) - @cached_property def domains(self) -> DomainsWithRawResponse: return DomainsWithRawResponse(self._workers.domains) @@ -211,10 +133,6 @@ def domains(self) -> DomainsWithRawResponse: def subdomains(self) -> SubdomainsWithRawResponse: return SubdomainsWithRawResponse(self._workers.subdomains) - @cached_property - def services(self) -> ServicesWithRawResponse: - return ServicesWithRawResponse(self._workers.services) - class AsyncWorkersWithRawResponse: def __init__(self, workers: AsyncWorkers) -> None: @@ -228,22 +146,10 @@ def ai(self) -> AsyncAIWithRawResponse: def scripts(self) -> AsyncScriptsWithRawResponse: return AsyncScriptsWithRawResponse(self._workers.scripts) - @cached_property - def filters(self) -> AsyncFiltersWithRawResponse: - return AsyncFiltersWithRawResponse(self._workers.filters) - - @cached_property - def routes(self) -> AsyncRoutesWithRawResponse: - return AsyncRoutesWithRawResponse(self._workers.routes) - @cached_property def account_settings(self) -> AsyncAccountSettingsWithRawResponse: return AsyncAccountSettingsWithRawResponse(self._workers.account_settings) - @cached_property - def deployments(self) -> AsyncDeploymentsWithRawResponse: - return AsyncDeploymentsWithRawResponse(self._workers.deployments) - @cached_property def domains(self) -> AsyncDomainsWithRawResponse: return AsyncDomainsWithRawResponse(self._workers.domains) @@ -252,10 +158,6 @@ def domains(self) -> AsyncDomainsWithRawResponse: def subdomains(self) -> AsyncSubdomainsWithRawResponse: return AsyncSubdomainsWithRawResponse(self._workers.subdomains) - @cached_property - def services(self) -> AsyncServicesWithRawResponse: - return AsyncServicesWithRawResponse(self._workers.services) - class WorkersWithStreamingResponse: def __init__(self, workers: Workers) -> None: @@ -269,22 +171,10 @@ def ai(self) -> AIWithStreamingResponse: def scripts(self) -> ScriptsWithStreamingResponse: return ScriptsWithStreamingResponse(self._workers.scripts) - @cached_property - def filters(self) -> FiltersWithStreamingResponse: - return FiltersWithStreamingResponse(self._workers.filters) - - @cached_property - def routes(self) -> RoutesWithStreamingResponse: - return RoutesWithStreamingResponse(self._workers.routes) - @cached_property def account_settings(self) -> AccountSettingsWithStreamingResponse: return AccountSettingsWithStreamingResponse(self._workers.account_settings) - @cached_property - def deployments(self) -> DeploymentsWithStreamingResponse: - return DeploymentsWithStreamingResponse(self._workers.deployments) - @cached_property def domains(self) -> DomainsWithStreamingResponse: return DomainsWithStreamingResponse(self._workers.domains) @@ -293,10 +183,6 @@ def domains(self) -> DomainsWithStreamingResponse: def subdomains(self) -> SubdomainsWithStreamingResponse: return SubdomainsWithStreamingResponse(self._workers.subdomains) - @cached_property - def services(self) -> ServicesWithStreamingResponse: - return ServicesWithStreamingResponse(self._workers.services) - class AsyncWorkersWithStreamingResponse: def __init__(self, workers: AsyncWorkers) -> None: @@ -310,22 +196,10 @@ def ai(self) -> AsyncAIWithStreamingResponse: def scripts(self) -> AsyncScriptsWithStreamingResponse: return AsyncScriptsWithStreamingResponse(self._workers.scripts) - @cached_property - def filters(self) -> AsyncFiltersWithStreamingResponse: - return AsyncFiltersWithStreamingResponse(self._workers.filters) - - @cached_property - def routes(self) -> AsyncRoutesWithStreamingResponse: - return AsyncRoutesWithStreamingResponse(self._workers.routes) - @cached_property def account_settings(self) -> AsyncAccountSettingsWithStreamingResponse: return AsyncAccountSettingsWithStreamingResponse(self._workers.account_settings) - @cached_property - def deployments(self) -> AsyncDeploymentsWithStreamingResponse: - return AsyncDeploymentsWithStreamingResponse(self._workers.deployments) - @cached_property def domains(self) -> AsyncDomainsWithStreamingResponse: return AsyncDomainsWithStreamingResponse(self._workers.domains) @@ -333,7 +207,3 @@ def domains(self) -> AsyncDomainsWithStreamingResponse: @cached_property def subdomains(self) -> AsyncSubdomainsWithStreamingResponse: return AsyncSubdomainsWithStreamingResponse(self._workers.subdomains) - - @cached_property - def services(self) -> AsyncServicesWithStreamingResponse: - return AsyncServicesWithStreamingResponse(self._workers.services) diff --git a/src/cloudflare/resources/zones/__init__.py b/src/cloudflare/resources/zones/__init__.py index f5c9439914a..31c426c3266 100644 --- a/src/cloudflare/resources/zones/__init__.py +++ b/src/cloudflare/resources/zones/__init__.py @@ -16,14 +16,6 @@ ZonesWithStreamingResponse, AsyncZonesWithStreamingResponse, ) -from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, -) from .settings import ( Settings, AsyncSettings, @@ -96,12 +88,6 @@ "AsyncHoldsWithRawResponse", "HoldsWithStreamingResponse", "AsyncHoldsWithStreamingResponse", - "Workers", - "AsyncWorkers", - "WorkersWithRawResponse", - "AsyncWorkersWithRawResponse", - "WorkersWithStreamingResponse", - "AsyncWorkersWithStreamingResponse", "Subscriptions", "AsyncSubscriptions", "SubscriptionsWithRawResponse", diff --git a/src/cloudflare/resources/zones/workers/__init__.py b/src/cloudflare/resources/zones/workers/__init__.py deleted file mode 100644 index 41dfe9b587e..00000000000 --- a/src/cloudflare/resources/zones/workers/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .script import ( - Script, - AsyncScript, - ScriptWithRawResponse, - AsyncScriptWithRawResponse, - ScriptWithStreamingResponse, - AsyncScriptWithStreamingResponse, -) -from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, -) - -__all__ = [ - "Script", - "AsyncScript", - "ScriptWithRawResponse", - "AsyncScriptWithRawResponse", - "ScriptWithStreamingResponse", - "AsyncScriptWithStreamingResponse", - "Workers", - "AsyncWorkers", - "WorkersWithRawResponse", - "AsyncWorkersWithRawResponse", - "WorkersWithStreamingResponse", - "AsyncWorkersWithStreamingResponse", -] diff --git a/src/cloudflare/resources/zones/workers/script.py b/src/cloudflare/resources/zones/workers/script.py deleted file mode 100644 index b86a8bc2fd9..00000000000 --- a/src/cloudflare/resources/zones/workers/script.py +++ /dev/null @@ -1,367 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - to_custom_raw_response_wrapper, - async_to_streamed_response_wrapper, - to_custom_streamed_response_wrapper, - async_to_custom_raw_response_wrapper, - async_to_custom_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a -from ....types.zones.workers import script_delete_params, script_update_params - -__all__ = ["Script", "AsyncScript"] - - -class Script(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ScriptWithRawResponse: - return ScriptWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ScriptWithStreamingResponse: - return ScriptWithStreamingResponse(self) - - def update( - self, - *, - zone_id: str, - body: object, - # 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, - ) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a: - """ - Upload a worker, or a new version of a worker. - - 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 cast( - UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, - self._put( - f"/zones/{zone_id}/workers/script", - body=maybe_transform(body, script_update_params.ScriptUpdateParams), - 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( - Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def delete( - self, - *, - zone_id: str, - body: object, - # 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, - ) -> None: - """Delete your Worker. - - This call has no response body on a successful delete. - - 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}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/zones/{zone_id}/workers/script", - body=maybe_transform(body, script_delete_params.ScriptDeleteParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def get( - 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, - ) -> BinaryAPIResponse: - """Fetch raw script content for your worker. - - Note this is the original script - content, not JSON encoded. - - 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}") - extra_headers = {"Accept": "undefined", **(extra_headers or {})} - return self._get( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncScript(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncScriptWithRawResponse: - return AsyncScriptWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncScriptWithStreamingResponse: - return AsyncScriptWithStreamingResponse(self) - - async def update( - self, - *, - zone_id: str, - body: object, - # 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, - ) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a: - """ - Upload a worker, or a new version of a worker. - - 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 cast( - UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, - await self._put( - f"/zones/{zone_id}/workers/script", - body=await async_maybe_transform(body, script_update_params.ScriptUpdateParams), - 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( - Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def delete( - self, - *, - zone_id: str, - body: object, - # 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, - ) -> None: - """Delete your Worker. - - This call has no response body on a successful delete. - - 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}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/zones/{zone_id}/workers/script", - body=await async_maybe_transform(body, script_delete_params.ScriptDeleteParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def get( - 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, - ) -> AsyncBinaryAPIResponse: - """Fetch raw script content for your worker. - - Note this is the original script - content, not JSON encoded. - - 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}") - extra_headers = {"Accept": "undefined", **(extra_headers or {})} - return await self._get( - f"/zones/{zone_id}/workers/script", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class ScriptWithRawResponse: - def __init__(self, script: Script) -> None: - self._script = script - - self.update = to_raw_response_wrapper( - script.update, - ) - self.delete = to_raw_response_wrapper( - script.delete, - ) - self.get = to_custom_raw_response_wrapper( - script.get, - BinaryAPIResponse, - ) - - -class AsyncScriptWithRawResponse: - def __init__(self, script: AsyncScript) -> None: - self._script = script - - self.update = async_to_raw_response_wrapper( - script.update, - ) - self.delete = async_to_raw_response_wrapper( - script.delete, - ) - self.get = async_to_custom_raw_response_wrapper( - script.get, - AsyncBinaryAPIResponse, - ) - - -class ScriptWithStreamingResponse: - def __init__(self, script: Script) -> None: - self._script = script - - self.update = to_streamed_response_wrapper( - script.update, - ) - self.delete = to_streamed_response_wrapper( - script.delete, - ) - self.get = to_custom_streamed_response_wrapper( - script.get, - StreamedBinaryAPIResponse, - ) - - -class AsyncScriptWithStreamingResponse: - def __init__(self, script: AsyncScript) -> None: - self._script = script - - self.update = async_to_streamed_response_wrapper( - script.update, - ) - self.delete = async_to_streamed_response_wrapper( - script.delete, - ) - self.get = async_to_custom_streamed_response_wrapper( - script.get, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/cloudflare/resources/zones/workers/workers.py b/src/cloudflare/resources/zones/workers/workers.py deleted file mode 100644 index 7a9895653a8..00000000000 --- a/src/cloudflare/resources/zones/workers/workers.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .script import ( - Script, - AsyncScript, - ScriptWithRawResponse, - AsyncScriptWithRawResponse, - ScriptWithStreamingResponse, - AsyncScriptWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Workers", "AsyncWorkers"] - - -class Workers(SyncAPIResource): - @cached_property - def script(self) -> Script: - return Script(self._client) - - @cached_property - def with_raw_response(self) -> WorkersWithRawResponse: - return WorkersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WorkersWithStreamingResponse: - return WorkersWithStreamingResponse(self) - - -class AsyncWorkers(AsyncAPIResource): - @cached_property - def script(self) -> AsyncScript: - return AsyncScript(self._client) - - @cached_property - def with_raw_response(self) -> AsyncWorkersWithRawResponse: - return AsyncWorkersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWorkersWithStreamingResponse: - return AsyncWorkersWithStreamingResponse(self) - - -class WorkersWithRawResponse: - def __init__(self, workers: Workers) -> None: - self._workers = workers - - @cached_property - def script(self) -> ScriptWithRawResponse: - return ScriptWithRawResponse(self._workers.script) - - -class AsyncWorkersWithRawResponse: - def __init__(self, workers: AsyncWorkers) -> None: - self._workers = workers - - @cached_property - def script(self) -> AsyncScriptWithRawResponse: - return AsyncScriptWithRawResponse(self._workers.script) - - -class WorkersWithStreamingResponse: - def __init__(self, workers: Workers) -> None: - self._workers = workers - - @cached_property - def script(self) -> ScriptWithStreamingResponse: - return ScriptWithStreamingResponse(self._workers.script) - - -class AsyncWorkersWithStreamingResponse: - def __init__(self, workers: AsyncWorkers) -> None: - self._workers = workers - - @cached_property - def script(self) -> AsyncScriptWithStreamingResponse: - return AsyncScriptWithStreamingResponse(self._workers.script) diff --git a/src/cloudflare/resources/zones/zones.py b/src/cloudflare/resources/zones/zones.py index cdfddc1a21f..cedf2b8eead 100644 --- a/src/cloudflare/resources/zones/zones.py +++ b/src/cloudflare/resources/zones/zones.py @@ -16,14 +16,6 @@ AsyncHoldsWithStreamingResponse, ) from ...types import Zone, ZoneDeleteResponse, zone_edit_params, zone_list_params, zone_create_params -from .workers import ( - Workers, - AsyncWorkers, - WorkersWithRawResponse, - AsyncWorkersWithRawResponse, - WorkersWithStreamingResponse, - AsyncWorkersWithStreamingResponse, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -67,7 +59,6 @@ AsyncPaginator, make_request_options, ) -from .workers.workers import Workers, AsyncWorkers from .activation_check import ( ActivationCheck, AsyncActivationCheck, @@ -110,10 +101,6 @@ def custom_nameservers(self) -> CustomNameservers: def holds(self) -> Holds: return Holds(self._client) - @cached_property - def workers(self) -> Workers: - return Workers(self._client) - @cached_property def subscriptions(self) -> Subscriptions: return Subscriptions(self._client) @@ -418,10 +405,6 @@ def custom_nameservers(self) -> AsyncCustomNameservers: def holds(self) -> AsyncHolds: return AsyncHolds(self._client) - @cached_property - def workers(self) -> AsyncWorkers: - return AsyncWorkers(self._client) - @cached_property def subscriptions(self) -> AsyncSubscriptions: return AsyncSubscriptions(self._client) @@ -745,10 +728,6 @@ def custom_nameservers(self) -> CustomNameserversWithRawResponse: def holds(self) -> HoldsWithRawResponse: return HoldsWithRawResponse(self._zones.holds) - @cached_property - def workers(self) -> WorkersWithRawResponse: - return WorkersWithRawResponse(self._zones.workers) - @cached_property def subscriptions(self) -> SubscriptionsWithRawResponse: return SubscriptionsWithRawResponse(self._zones.subscriptions) @@ -794,10 +773,6 @@ def custom_nameservers(self) -> AsyncCustomNameserversWithRawResponse: def holds(self) -> AsyncHoldsWithRawResponse: return AsyncHoldsWithRawResponse(self._zones.holds) - @cached_property - def workers(self) -> AsyncWorkersWithRawResponse: - return AsyncWorkersWithRawResponse(self._zones.workers) - @cached_property def subscriptions(self) -> AsyncSubscriptionsWithRawResponse: return AsyncSubscriptionsWithRawResponse(self._zones.subscriptions) @@ -843,10 +818,6 @@ def custom_nameservers(self) -> CustomNameserversWithStreamingResponse: def holds(self) -> HoldsWithStreamingResponse: return HoldsWithStreamingResponse(self._zones.holds) - @cached_property - def workers(self) -> WorkersWithStreamingResponse: - return WorkersWithStreamingResponse(self._zones.workers) - @cached_property def subscriptions(self) -> SubscriptionsWithStreamingResponse: return SubscriptionsWithStreamingResponse(self._zones.subscriptions) @@ -892,10 +863,6 @@ def custom_nameservers(self) -> AsyncCustomNameserversWithStreamingResponse: def holds(self) -> AsyncHoldsWithStreamingResponse: return AsyncHoldsWithStreamingResponse(self._zones.holds) - @cached_property - def workers(self) -> AsyncWorkersWithStreamingResponse: - return AsyncWorkersWithStreamingResponse(self._zones.workers) - @cached_property def subscriptions(self) -> AsyncSubscriptionsWithStreamingResponse: return AsyncSubscriptionsWithStreamingResponse(self._zones.subscriptions) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index a179e75a5e1..99778d1d5ed 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -81,7 +81,6 @@ from .targes_param import TargesParam as TargesParam from .tunnel_param import TunnelParam as TunnelParam from .waiting_room import WaitingRoom as WaitingRoom -from .binding_param import BindingParam as BindingParam from .configuration import Configuration as Configuration from .load_balancer import LoadBalancer as LoadBalancer from .load_shedding import LoadShedding as LoadShedding @@ -92,8 +91,6 @@ from .ip_list_params import IPListParams as IPListParams from .labeled_region import LabeledRegion as LabeledRegion from .log_rule_param import LogRuleParam as LogRuleParam -from .migration_step import MigrationStep as MigrationStep -from .settings_param import SettingsParam as SettingsParam from .custom_hostname import CustomHostname as CustomHostname from .origin_steering import OriginSteering as OriginSteering from .random_steering import RandomSteering as RandomSteering @@ -101,12 +98,10 @@ from .skip_rule_param import SkipRuleParam as SkipRuleParam from .adaptive_routing import AdaptiveRouting as AdaptiveRouting from .block_rule_param import BlockRuleParam as BlockRuleParam -from .d1_binding_param import D1BindingParam as D1BindingParam from .geo_restrictions import GeoRestrictions as GeoRestrictions from .ip_list_response import IPListResponse as IPListResponse from .mtls_certificate import MTLSCertificate as MTLSCertificate from .origin_dns_param import OriginDNSParam as OriginDNSParam -from .r2_binding_param import R2BindingParam as R2BindingParam from .rules_item_param import RulesItemParam as RulesItemParam from .user_edit_params import UserEditParams as UserEditParams from .zone_edit_params import ZoneEditParams as ZoneEditParams @@ -118,7 +113,6 @@ from .mtls_cert_binding import MTLSCERTBinding as MTLSCERTBinding from .origin_port_param import OriginPortParam as OriginPortParam from .pcap_get_response import PCAPGetResponse as PCAPGetResponse -from .stepped_migration import SteppedMigration as SteppedMigration from .tcp_configuration import TCPConfiguration as TCPConfiguration from .cache_purge_params import CachePurgeParams as CachePurgeParams from .call_create_params import CallCreateParams as CallCreateParams @@ -177,8 +171,6 @@ from .random_steering_param import RandomSteeringParam as RandomSteeringParam from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams -from .service_binding_param import ServiceBindingParam as ServiceBindingParam -from .single_step_migration import SingleStepMigration as SingleStepMigration from .snippet_update_params import SnippetUpdateParams as SnippetUpdateParams from .speed_delete_response import SpeedDeleteResponse as SpeedDeleteResponse from .adaptive_routing_param import AdaptiveRoutingParam as AdaptiveRoutingParam @@ -200,8 +192,6 @@ from .cookie_attributes_param import CookieAttributesParam as CookieAttributesParam from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams from .location_strategy_param import LocationStrategyParam as LocationStrategyParam -from .mtls_cert_binding_param import MTLSCERTBindingParam as MTLSCERTBindingParam -from .placement_configuration import PlacementConfiguration as PlacementConfiguration from .ruleset_create_response import RulesetCreateResponse as RulesetCreateResponse from .ruleset_update_response import RulesetUpdateResponse as RulesetUpdateResponse from .stepped_migration_param import SteppedMigrationParam as SteppedMigrationParam @@ -225,7 +215,6 @@ from .speed_schedule_get_params import SpeedScheduleGetParams as SpeedScheduleGetParams from .url_scanner_scan_response import URLScannerScanResponse as URLScannerScanResponse from .dispatch_namespace_binding import DispatchNamespaceBinding as DispatchNamespaceBinding -from .kv_namespace_binding_param import KVNamespaceBindingParam as KVNamespaceBindingParam from .managed_header_edit_params import ManagedHeaderEditParams as ManagedHeaderEditParams from .membership_delete_response import MembershipDeleteResponse as MembershipDeleteResponse from .rate_limit_delete_response import RateLimitDeleteResponse as RateLimitDeleteResponse @@ -252,7 +241,6 @@ from .additional_routes_item_param import AdditionalRoutesItemParam as AdditionalRoutesItemParam from .bot_fight_mode_configuration import BotFightModeConfiguration as BotFightModeConfiguration from .bot_management_update_params import BotManagementUpdateParams as BotManagementUpdateParams -from .durable_object_binding_param import DurableObjectBindingParam as DurableObjectBindingParam from .email_routing_disable_params import EmailRoutingDisableParams as EmailRoutingDisableParams from .managed_header_edit_response import ManagedHeaderEditResponse as ManagedHeaderEditResponse from .managed_header_list_response import ManagedHeaderListResponse as ManagedHeaderListResponse @@ -284,7 +272,6 @@ from .client_certificate_create_params import ClientCertificateCreateParams as ClientCertificateCreateParams from .custom_certificate_create_params import CustomCertificateCreateParams as CustomCertificateCreateParams from .custom_certificate_delete_params import CustomCertificateDeleteParams as CustomCertificateDeleteParams -from .dispatch_namespace_binding_param import DispatchNamespaceBindingParam as DispatchNamespaceBindingParam from .mtls_certificate_create_response import MTLSCertificateCreateResponse as MTLSCertificateCreateResponse from .custom_nameserver_verify_response import CustomNameserverVerifyResponse as CustomNameserverVerifyResponse from .keyless_certificate_create_params import KeylessCertificateCreateParams as KeylessCertificateCreateParams diff --git a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py index fc8e6fe6b97..f9a62e79c69 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py +++ b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py @@ -9,4 +9,3 @@ from .status_get_response import StatusGetResponse as StatusGetResponse from .status_edit_response import StatusEditResponse as StatusEditResponse from .binding_create_params import BindingCreateParams as BindingCreateParams -from .service_binding_param import ServiceBindingParam as ServiceBindingParam diff --git a/src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.py b/src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.py deleted file mode 100644 index 3dd61ede1cb..00000000000 --- a/src/cloudflare/types/addressing/prefixes/bgp/service_binding_param.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_extensions import Literal, TypedDict - -__all__ = ["ServiceBindingParam", "Provisioning"] - - -class Provisioning(TypedDict, total=False): - state: Literal["provisioning", "active"] - """ - When a binding has been deployed to a majority of Cloudflare datacenters, the - binding will become active and can be used with its associated service. - """ - - -class ServiceBindingParam(TypedDict, total=False): - cidr: str - """IP Prefix in Classless Inter-Domain Routing format.""" - - provisioning: Provisioning - """Status of a Service Binding's deployment to the Cloudflare network""" - - service_id: str - """Identifier""" - - service_name: str - """Name of a service running on the Cloudflare network""" diff --git a/src/cloudflare/types/binding_param.py b/src/cloudflare/types/binding_param.py deleted file mode 100644 index 478be46927b..00000000000 --- a/src/cloudflare/types/binding_param.py +++ /dev/null @@ -1,36 +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 - -from .d1_binding_param import D1BindingParam -from .r2_binding_param import R2BindingParam -from .service_binding_param import ServiceBindingParam -from .mtls_cert_binding_param import MTLSCERTBindingParam -from .kv_namespace_binding_param import KVNamespaceBindingParam -from .durable_object_binding_param import DurableObjectBindingParam -from .dispatch_namespace_binding_param import DispatchNamespaceBindingParam - -__all__ = ["BindingParam", "WorkersQueueBinding"] - - -class WorkersQueueBinding(TypedDict, total=False): - queue_name: Required[str] - """Name of the Queue to bind to""" - - type: Required[Literal["queue"]] - """The class of resource that the binding provides.""" - - -BindingParam = Union[ - KVNamespaceBindingParam, - ServiceBindingParam, - DurableObjectBindingParam, - R2BindingParam, - WorkersQueueBinding, - D1BindingParam, - DispatchNamespaceBindingParam, - MTLSCERTBindingParam, -] diff --git a/src/cloudflare/types/d1_binding_param.py b/src/cloudflare/types/d1_binding_param.py deleted file mode 100644 index 74face1628f..00000000000 --- a/src/cloudflare/types/d1_binding_param.py +++ /dev/null @@ -1,18 +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__ = ["D1BindingParam"] - - -class D1BindingParam(TypedDict, total=False): - id: Required[str] - """ID of the D1 database to bind to""" - - name: Required[str] - """The name of the D1 database associated with the 'id' provided.""" - - type: Required[Literal["d1"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/dispatch_namespace_binding_param.py b/src/cloudflare/types/dispatch_namespace_binding_param.py deleted file mode 100644 index 584c5d86e15..00000000000 --- a/src/cloudflare/types/dispatch_namespace_binding_param.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["DispatchNamespaceBindingParam", "Outbound", "OutboundWorker"] - - -class OutboundWorker(TypedDict, total=False): - environment: str - """Environment of the outbound worker""" - - service: str - """Name of the outbound worker""" - - -class Outbound(TypedDict, total=False): - params: List[str] - """ - Pass information from the Dispatch Worker to the Outbound Worker through the - parameters - """ - - worker: OutboundWorker - """Outbound worker""" - - -class DispatchNamespaceBindingParam(TypedDict, total=False): - namespace: Required[str] - """Namespace to bind to""" - - type: Required[Literal["dispatch_namespace"]] - """The class of resource that the binding provides.""" - - outbound: Outbound - """Outbound worker""" diff --git a/src/cloudflare/types/durable_object_binding_param.py b/src/cloudflare/types/durable_object_binding_param.py deleted file mode 100644 index 6c00bbd63a9..00000000000 --- a/src/cloudflare/types/durable_object_binding_param.py +++ /dev/null @@ -1,23 +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__ = ["DurableObjectBindingParam"] - - -class DurableObjectBindingParam(TypedDict, total=False): - class_name: Required[str] - """The exported class name of the Durable Object""" - - type: Required[Literal["durable_object_namespace"]] - """The class of resource that the binding provides.""" - - environment: str - """The environment of the script_name to bind to""" - - script_name: str - """ - The script where the Durable Object is defined, if it is external to this Worker - """ diff --git a/src/cloudflare/types/kv_namespace_binding_param.py b/src/cloudflare/types/kv_namespace_binding_param.py deleted file mode 100644 index 7dc97bab2a6..00000000000 --- a/src/cloudflare/types/kv_namespace_binding_param.py +++ /dev/null @@ -1,12 +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__ = ["KVNamespaceBindingParam"] - - -class KVNamespaceBindingParam(TypedDict, total=False): - type: Required[Literal["kv_namespace"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/migration_step.py b/src/cloudflare/types/migration_step.py deleted file mode 100644 index 24ba3dbed16..00000000000 --- a/src/cloudflare/types/migration_step.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["MigrationStep", "RenamedClass", "TransferredClass"] - - -class RenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class TransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class MigrationStep(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - renamed_classes: Optional[List[RenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[TransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ diff --git a/src/cloudflare/types/mtls_cert_binding_param.py b/src/cloudflare/types/mtls_cert_binding_param.py deleted file mode 100644 index e6d8c865b55..00000000000 --- a/src/cloudflare/types/mtls_cert_binding_param.py +++ /dev/null @@ -1,17 +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__ = ["MTLSCERTBindingParam"] - - -class MTLSCERTBindingParam(TypedDict, total=False): - certificate: Required[object] - - type: Required[Literal["mtls_certificate"]] - """The class of resource that the binding provides.""" - - certificate_id: str - """ID of the certificate to bind to""" diff --git a/src/cloudflare/types/placement_configuration.py b/src/cloudflare/types/placement_configuration.py deleted file mode 100644 index 13def2d7f05..00000000000 --- a/src/cloudflare/types/placement_configuration.py +++ /dev/null @@ -1,17 +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__ = ["PlacementConfiguration"] - - -class PlacementConfiguration(BaseModel): - mode: Optional[Literal["smart"]] = None - """ - Enables - [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - Only `"smart"` is currently supported - """ diff --git a/src/cloudflare/types/r2_binding_param.py b/src/cloudflare/types/r2_binding_param.py deleted file mode 100644 index 559667ded10..00000000000 --- a/src/cloudflare/types/r2_binding_param.py +++ /dev/null @@ -1,15 +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__ = ["R2BindingParam"] - - -class R2BindingParam(TypedDict, total=False): - bucket_name: Required[str] - """R2 bucket to bind to""" - - type: Required[Literal["r2_bucket"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/service_binding_param.py b/src/cloudflare/types/service_binding_param.py deleted file mode 100644 index 52ecb335075..00000000000 --- a/src/cloudflare/types/service_binding_param.py +++ /dev/null @@ -1,18 +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__ = ["ServiceBindingParam"] - - -class ServiceBindingParam(TypedDict, total=False): - environment: Required[str] - """Optional environment if the Worker utilizes one.""" - - service: Required[str] - """Name of Worker to bind to""" - - type: Required[Literal["service"]] - """The class of resource that the binding provides.""" diff --git a/src/cloudflare/types/settings_param.py b/src/cloudflare/types/settings_param.py deleted file mode 100644 index 21b777e24f3..00000000000 --- a/src/cloudflare/types/settings_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["SettingsParam"] - - -class SettingsParam(TypedDict, total=False): - enabled: Literal[True, False] - """State of the zone settings for Email Routing.""" - - skip_wizard: Literal[True, False] - """Flag to check if the user skipped the configuration wizard.""" diff --git a/src/cloudflare/types/single_step_migration.py b/src/cloudflare/types/single_step_migration.py deleted file mode 100644 index 615d51a4905..00000000000 --- a/src/cloudflare/types/single_step_migration.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["SingleStepMigration", "RenamedClass", "TransferredClass"] - - -class RenamedClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - to: Optional[str] = None - - -class TransferredClass(BaseModel): - from_: Optional[str] = FieldInfo(alias="from", default=None) - - from_script: Optional[str] = None - - to: Optional[str] = None - - -class SingleStepMigration(BaseModel): - deleted_classes: Optional[List[str]] = None - """A list of classes to delete Durable Object namespaces from.""" - - new_classes: Optional[List[str]] = None - """A list of classes to create Durable Object namespaces from.""" - - new_tag: Optional[str] = None - """Tag to set as the latest migration tag.""" - - old_tag: Optional[str] = None - """Tag used to verify against the latest migration tag for this Worker. - - If they don't match, the upload is rejected. - """ - - renamed_classes: Optional[List[RenamedClass]] = None - """A list of classes with Durable Object namespaces that were renamed.""" - - transferred_classes: Optional[List[TransferredClass]] = None - """ - A list of transfers for Durable Object namespaces from a different Worker and - class to a class defined in this Worker. - """ diff --git a/src/cloudflare/types/stepped_migration.py b/src/cloudflare/types/stepped_migration.py deleted file mode 100644 index f89090e3e66..00000000000 --- a/src/cloudflare/types/stepped_migration.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel -from .migration_step import MigrationStep - -__all__ = ["SteppedMigration"] - - -class SteppedMigration(BaseModel): - new_tag: Optional[str] = None - """Tag to set as the latest migration tag.""" - - old_tag: Optional[str] = None - """Tag used to verify against the latest migration tag for this Worker. - - If they don't match, the upload is rejected. - """ - - steps: Optional[List[MigrationStep]] = None - """Migrations to apply in order.""" diff --git a/src/cloudflare/types/workers/__init__.py b/src/cloudflare/types/workers/__init__.py index 97684f47af7..33c80609e12 100644 --- a/src/cloudflare/types/workers/__init__.py +++ b/src/cloudflare/types/workers/__init__.py @@ -5,24 +5,14 @@ from .domain import Domain as Domain from .script import Script as Script from .ai_run_params import AIRunParams as AIRunParams -from .workers_route import WorkersRoute as WorkersRoute from .script_setting import ScriptSetting as ScriptSetting -from .workers_filter import WorkersFilter as WorkersFilter from .ai_run_response import AIRunResponse as AIRunResponse from .domain_list_params import DomainListParams as DomainListParams -from .route_create_params import RouteCreateParams as RouteCreateParams -from .route_delete_params import RouteDeleteParams as RouteDeleteParams -from .route_update_params import RouteUpdateParams as RouteUpdateParams from .domain_delete_params import DomainDeleteParams as DomainDeleteParams from .domain_update_params import DomainUpdateParams as DomainUpdateParams -from .filter_create_params import FilterCreateParams as FilterCreateParams -from .filter_delete_params import FilterDeleteParams as FilterDeleteParams -from .filter_update_params import FilterUpdateParams as FilterUpdateParams from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams from .script_setting_param import ScriptSettingParam as ScriptSettingParam from .script_update_params import ScriptUpdateParams as ScriptUpdateParams -from .filter_create_response import FilterCreateResponse as FilterCreateResponse -from .filter_delete_response import FilterDeleteResponse as FilterDeleteResponse from .subdomain_get_response import SubdomainGetResponse as SubdomainGetResponse from .subdomain_update_params import SubdomainUpdateParams as SubdomainUpdateParams from .subdomain_update_response import SubdomainUpdateResponse as SubdomainUpdateResponse diff --git a/src/cloudflare/types/workers/deployments/__init__.py b/src/cloudflare/types/workers/deployments/__init__.py deleted file mode 100644 index ea1470ce8e2..00000000000 --- a/src/cloudflare/types/workers/deployments/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .by_script_get_response import ByScriptGetResponse as ByScriptGetResponse diff --git a/src/cloudflare/types/workers/deployments/by_script_get_response.py b/src/cloudflare/types/workers/deployments/by_script_get_response.py deleted file mode 100644 index fb8906f16fc..00000000000 --- a/src/cloudflare/types/workers/deployments/by_script_get_response.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["ByScriptGetResponse"] - - -class ByScriptGetResponse(BaseModel): - items: Optional[List[object]] = None - - latest: Optional[object] = None diff --git a/src/cloudflare/types/workers/deployments/by_scripts/__init__.py b/src/cloudflare/types/workers/deployments/by_scripts/__init__.py deleted file mode 100644 index 4c6d7381f8d..00000000000 --- a/src/cloudflare/types/workers/deployments/by_scripts/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .detail_get_response import DetailGetResponse as DetailGetResponse diff --git a/src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.py b/src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.py deleted file mode 100644 index 53d1943d50e..00000000000 --- a/src/cloudflare/types/workers/deployments/by_scripts/detail_get_response.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["DetailGetResponse"] - - -class DetailGetResponse(BaseModel): - id: Optional[str] = None - - metadata: Optional[object] = None - - number: Optional[float] = None - - resources: Optional[object] = None diff --git a/src/cloudflare/types/workers/filter_create_params.py b/src/cloudflare/types/workers/filter_create_params.py deleted file mode 100644 index 93ec5dfc940..00000000000 --- a/src/cloudflare/types/workers/filter_create_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 Required, TypedDict - -__all__ = ["FilterCreateParams"] - - -class FilterCreateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - enabled: Required[bool] - - pattern: Required[str] diff --git a/src/cloudflare/types/workers/filter_create_response.py b/src/cloudflare/types/workers/filter_create_response.py deleted file mode 100644 index 3d03316378c..00000000000 --- a/src/cloudflare/types/workers/filter_create_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["FilterCreateResponse"] - - -class FilterCreateResponse(BaseModel): - id: str - """Identifier""" diff --git a/src/cloudflare/types/workers/filter_delete_params.py b/src/cloudflare/types/workers/filter_delete_params.py deleted file mode 100644 index 5c54882d058..00000000000 --- a/src/cloudflare/types/workers/filter_delete_params.py +++ /dev/null @@ -1,14 +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__ = ["FilterDeleteParams"] - - -class FilterDeleteParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - body: Required[object] diff --git a/src/cloudflare/types/workers/filter_delete_response.py b/src/cloudflare/types/workers/filter_delete_response.py deleted file mode 100644 index 557d1f24790..00000000000 --- a/src/cloudflare/types/workers/filter_delete_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["FilterDeleteResponse"] - - -class FilterDeleteResponse(BaseModel): - id: str - """Identifier""" diff --git a/src/cloudflare/types/workers/filter_update_params.py b/src/cloudflare/types/workers/filter_update_params.py deleted file mode 100644 index 601049d7b5f..00000000000 --- a/src/cloudflare/types/workers/filter_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 Required, TypedDict - -__all__ = ["FilterUpdateParams"] - - -class FilterUpdateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - enabled: Required[bool] - - pattern: Required[str] diff --git a/src/cloudflare/types/workers/route_create_params.py b/src/cloudflare/types/workers/route_create_params.py deleted file mode 100644 index 479c701b0e9..00000000000 --- a/src/cloudflare/types/workers/route_create_params.py +++ /dev/null @@ -1,17 +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__ = ["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_delete_params.py b/src/cloudflare/types/workers/route_delete_params.py deleted file mode 100644 index 3c1852f10ce..00000000000 --- a/src/cloudflare/types/workers/route_delete_params.py +++ /dev/null @@ -1,14 +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__ = ["RouteDeleteParams"] - - -class RouteDeleteParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - body: Required[object] diff --git a/src/cloudflare/types/workers/route_update_params.py b/src/cloudflare/types/workers/route_update_params.py deleted file mode 100644 index d4954d0bd6a..00000000000 --- a/src/cloudflare/types/workers/route_update_params.py +++ /dev/null @@ -1,17 +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__ = ["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/scripts/__init__.py b/src/cloudflare/types/workers/scripts/__init__.py index 55140974d38..65d68f45a35 100644 --- a/src/cloudflare/types/workers/scripts/__init__.py +++ b/src/cloudflare/types/workers/scripts/__init__.py @@ -6,7 +6,6 @@ from .tail_create_params import TailCreateParams as TailCreateParams from .tail_delete_params import TailDeleteParams as TailDeleteParams from .setting_edit_params import SettingEditParams as SettingEditParams -from .binding_get_response import BindingGetResponse as BindingGetResponse from .consumer_script_item import ConsumerScriptItem as ConsumerScriptItem from .tail_create_response import TailCreateResponse as TailCreateResponse from .version_get_response import VersionGetResponse as VersionGetResponse @@ -19,11 +18,8 @@ from .version_create_response import VersionCreateResponse as VersionCreateResponse from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams from .schedule_update_response import ScheduleUpdateResponse as ScheduleUpdateResponse -from .usage_model_get_response import UsageModelGetResponse as UsageModelGetResponse -from .usage_model_update_params import UsageModelUpdateParams as UsageModelUpdateParams from .consumer_script_item_param import ConsumerScriptItemParam as ConsumerScriptItemParam from .deployment_create_response import DeploymentCreateResponse as DeploymentCreateResponse -from .usage_model_update_response import UsageModelUpdateResponse as UsageModelUpdateResponse from .unnamed_schema_ref_c8302c265937f9d6f96fd69644e56b26 import ( UnnamedSchemaRefC8302c265937f9d6f96fd69644e56b26 as UnnamedSchemaRefC8302c265937f9d6f96fd69644e56b26, ) diff --git a/src/cloudflare/types/workers/scripts/binding_get_response.py b/src/cloudflare/types/workers/scripts/binding_get_response.py deleted file mode 100644 index 8189c3af54d..00000000000 --- a/src/cloudflare/types/workers/scripts/binding_get_response.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union -from typing_extensions import Literal - -from ...._models import BaseModel -from ...kv_namespace_binding import KVNamespaceBinding - -__all__ = ["BindingGetResponse", "BindingGetResponseItem", "BindingGetResponseItemWorkersWasmModuleBinding"] - - -class BindingGetResponseItemWorkersWasmModuleBinding(BaseModel): - name: str - """A JavaScript variable name for the binding.""" - - type: Literal["wasm_module"] - """The class of resource that the binding provides.""" - - -BindingGetResponseItem = Union[KVNamespaceBinding, BindingGetResponseItemWorkersWasmModuleBinding] - -BindingGetResponse = List[BindingGetResponseItem] diff --git a/src/cloudflare/types/workers/scripts/usage_model_get_response.py b/src/cloudflare/types/workers/scripts/usage_model_get_response.py deleted file mode 100644 index 7c10aaeeb56..00000000000 --- a/src/cloudflare/types/workers/scripts/usage_model_get_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__ = ["UsageModelGetResponse"] - - -class UsageModelGetResponse(BaseModel): - usage_model: Optional[object] = None diff --git a/src/cloudflare/types/workers/scripts/usage_model_update_params.py b/src/cloudflare/types/workers/scripts/usage_model_update_params.py deleted file mode 100644 index 2958d1944ce..00000000000 --- a/src/cloudflare/types/workers/scripts/usage_model_update_params.py +++ /dev/null @@ -1,14 +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__ = ["UsageModelUpdateParams"] - - -class UsageModelUpdateParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - body: Required[str] diff --git a/src/cloudflare/types/workers/scripts/usage_model_update_response.py b/src/cloudflare/types/workers/scripts/usage_model_update_response.py deleted file mode 100644 index cbd4c307cf6..00000000000 --- a/src/cloudflare/types/workers/scripts/usage_model_update_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__ = ["UsageModelUpdateResponse"] - - -class UsageModelUpdateResponse(BaseModel): - usage_model: Optional[object] = None diff --git a/src/cloudflare/types/workers/scripts/versions/__init__.py b/src/cloudflare/types/workers/scripts/versions/__init__.py deleted file mode 100644 index 2ee94ead142..00000000000 --- a/src/cloudflare/types/workers/scripts/versions/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .tags import Tags as Tags -from .settings import Settings as Settings -from .settings_param import SettingsParam as SettingsParam -from .compatibility_flags import CompatibilityFlags as CompatibilityFlags -from .setting_edit_params import SettingEditParams as SettingEditParams diff --git a/src/cloudflare/types/workers/scripts/versions/compatibility_flags.py b/src/cloudflare/types/workers/scripts/versions/compatibility_flags.py deleted file mode 100644 index c01d304f855..00000000000 --- a/src/cloudflare/types/workers/scripts/versions/compatibility_flags.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["CompatibilityFlags"] - -CompatibilityFlags = str diff --git a/src/cloudflare/types/workers/scripts/versions/setting_edit_params.py b/src/cloudflare/types/workers/scripts/versions/setting_edit_params.py deleted file mode 100644 index a93a8644d1a..00000000000 --- a/src/cloudflare/types/workers/scripts/versions/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 Required, TypedDict - -from .settings_param import SettingsParam - -__all__ = ["SettingEditParams"] - - -class SettingEditParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - settings: SettingsParam diff --git a/src/cloudflare/types/workers/scripts/versions/settings.py b/src/cloudflare/types/workers/scripts/versions/settings.py deleted file mode 100644 index 596177c04d3..00000000000 --- a/src/cloudflare/types/workers/scripts/versions/settings.py +++ /dev/null @@ -1,44 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional - -from .tags import Tags -from ....binding import Binding -from ....._models import BaseModel -from .compatibility_flags import CompatibilityFlags -from ....stepped_migration import SteppedMigration -from ..consumer_script_item import ConsumerScriptItem -from ....single_step_migration import SingleStepMigration -from ....placement_configuration import PlacementConfiguration - -__all__ = ["Settings", "Migrations"] - -Migrations = Union[SingleStepMigration, SteppedMigration] - - -class Settings(BaseModel): - bindings: Optional[List[Binding]] = None - """List of bindings attached to this Worker""" - - compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" - - compatibility_flags: Optional[List[CompatibilityFlags]] = None - """Opt your Worker into specific changes""" - - logpush: Optional[bool] = None - """Whether Logpush is turned on for the Worker.""" - - migrations: Optional[Migrations] = None - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: Optional[PlacementConfiguration] = None - - tags: Optional[List[Tags]] = None - """Tags to help you manage your Workers""" - - tail_consumers: Optional[List[ConsumerScriptItem]] = None - """List of Workers that will consume logs from the attached Worker.""" - - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" diff --git a/src/cloudflare/types/workers/scripts/versions/settings_param.py b/src/cloudflare/types/workers/scripts/versions/settings_param.py deleted file mode 100644 index 27d7fd8ba3d..00000000000 --- a/src/cloudflare/types/workers/scripts/versions/settings_param.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import TypedDict - -from .tags import Tags -from ....binding_param import BindingParam -from .compatibility_flags import CompatibilityFlags -from ....stepped_migration_param import SteppedMigrationParam -from ..consumer_script_item_param import ConsumerScriptItemParam -from ....single_step_migration_param import SingleStepMigrationParam -from ....placement_configuration_param import PlacementConfigurationParam - -__all__ = ["SettingsParam", "Migrations"] - -Migrations = Union[SingleStepMigrationParam, SteppedMigrationParam] - - -class SettingsParam(TypedDict, total=False): - bindings: Iterable[BindingParam] - """List of bindings attached to this Worker""" - - compatibility_date: str - """Opt your Worker into changes after this date""" - - compatibility_flags: List[CompatibilityFlags] - """Opt your Worker into specific changes""" - - logpush: bool - """Whether Logpush is turned on for the Worker.""" - - migrations: Migrations - """Migrations to apply for Durable Objects associated with this Worker.""" - - placement: PlacementConfigurationParam - - tags: List[Tags] - """Tags to help you manage your Workers""" - - tail_consumers: Iterable[ConsumerScriptItemParam] - """List of Workers that will consume logs from the attached Worker.""" - - usage_model: str - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" diff --git a/src/cloudflare/types/workers/scripts/versions/tags.py b/src/cloudflare/types/workers/scripts/versions/tags.py deleted file mode 100644 index d727ca1e2b0..00000000000 --- a/src/cloudflare/types/workers/scripts/versions/tags.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -__all__ = ["Tags"] - -Tags = str diff --git a/src/cloudflare/types/workers/services/__init__.py b/src/cloudflare/types/workers/services/__init__.py deleted file mode 100644 index f8ee8b14b1c..00000000000 --- a/src/cloudflare/types/workers/services/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations diff --git a/src/cloudflare/types/workers/services/environments/__init__.py b/src/cloudflare/types/workers/services/environments/__init__.py deleted file mode 100644 index 5b2d8619a66..00000000000 --- a/src/cloudflare/types/workers/services/environments/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .setting_edit_params import SettingEditParams as SettingEditParams -from .content_update_params import ContentUpdateParams as ContentUpdateParams diff --git a/src/cloudflare/types/workers/services/environments/content_update_params.py b/src/cloudflare/types/workers/services/environments/content_update_params.py deleted file mode 100644 index a8367f23c92..00000000000 --- a/src/cloudflare/types/workers/services/environments/content_update_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, Annotated, TypedDict - -from .....types import shared_params -from ....._types import FileTypes -from ....._utils import PropertyInfo - -__all__ = ["ContentUpdateParams"] - - -class ContentUpdateParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - service_name: Required[str] - """Name of Worker to bind to""" - - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present. This should be referenced either in the metadata as - `main_module` (esm)/`body_part` (service worker) or as a header - `CF-WORKER-MAIN-MODULE-PART` (esm) /`CF-WORKER-BODY-PART` (service worker) by - part name. - """ - - metadata: shared_params.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24 - """JSON encoded metadata about the uploaded parts and Worker configuration.""" diff --git a/src/cloudflare/types/workers/services/environments/setting_edit_params.py b/src/cloudflare/types/workers/services/environments/setting_edit_params.py deleted file mode 100644 index 8328433df7d..00000000000 --- a/src/cloudflare/types/workers/services/environments/setting_edit_params.py +++ /dev/null @@ -1,28 +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 - -from .....types import shared_params -from ...script_setting_param import ScriptSettingParam - -__all__ = ["SettingEditParams"] - - -class SettingEditParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - service_name: Required[str] - """Name of Worker to bind to""" - - errors: Required[Iterable[shared_params.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72]] - - messages: Required[Iterable[shared_params.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72]] - - result: Required[ScriptSettingParam] - - success: Required[Literal[True]] - """Whether the API call was successful""" diff --git a/src/cloudflare/types/workers/workers_filter.py b/src/cloudflare/types/workers/workers_filter.py deleted file mode 100644 index 9d2862df88c..00000000000 --- a/src/cloudflare/types/workers/workers_filter.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__ = ["WorkersFilter"] - - -class WorkersFilter(BaseModel): - id: str - """Identifier""" - - enabled: bool - - pattern: str diff --git a/src/cloudflare/types/workers/workers_route.py b/src/cloudflare/types/workers/workers_route.py deleted file mode 100644 index 85b33f5124c..00000000000 --- a/src/cloudflare/types/workers/workers_route.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WorkersRoute"] - - -class WorkersRoute(BaseModel): - id: str - """Identifier""" - - pattern: str - - script: str - """Name of the script, used in URLs and route configuration.""" diff --git a/src/cloudflare/types/zones/workers/__init__.py b/src/cloudflare/types/zones/workers/__init__.py deleted file mode 100644 index 6f7e7554b05..00000000000 --- a/src/cloudflare/types/zones/workers/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams -from .script_update_params import ScriptUpdateParams as ScriptUpdateParams diff --git a/src/cloudflare/types/zones/workers/script_delete_params.py b/src/cloudflare/types/zones/workers/script_delete_params.py deleted file mode 100644 index 235462b968a..00000000000 --- a/src/cloudflare/types/zones/workers/script_delete_params.py +++ /dev/null @@ -1,14 +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__ = ["ScriptDeleteParams"] - - -class ScriptDeleteParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - body: Required[object] diff --git a/src/cloudflare/types/zones/workers/script_update_params.py b/src/cloudflare/types/zones/workers/script_update_params.py deleted file mode 100644 index d46e8e5c42a..00000000000 --- a/src/cloudflare/types/zones/workers/script_update_params.py +++ /dev/null @@ -1,14 +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__ = ["ScriptUpdateParams"] - - -class ScriptUpdateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - body: Required[object] diff --git a/tests/api_resources/workers/deployments/__init__.py b/tests/api_resources/workers/deployments/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/workers/deployments/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/deployments/by_scripts/__init__.py b/tests/api_resources/workers/deployments/by_scripts/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/workers/deployments/by_scripts/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/deployments/by_scripts/test_details.py b/tests/api_resources/workers/deployments/by_scripts/test_details.py deleted file mode 100644 index 24c8b7ed6f5..00000000000 --- a/tests/api_resources/workers/deployments/by_scripts/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.workers.deployments.by_scripts import DetailGetResponse - -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.workers.deployments.by_scripts.details.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - detail = response.parse() - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.deployments.by_scripts.details.with_streaming_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - detail = response.parse() - assert_matches_type(DetailGetResponse, 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 `account_id` but received ''"): - client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): - client.workers.deployments.by_scripts.details.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - -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.workers.deployments.by_scripts.details.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - detail = await response.parse() - assert_matches_type(DetailGetResponse, detail, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.deployments.by_scripts.details.with_streaming_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - detail = await response.parse() - assert_matches_type(DetailGetResponse, 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 `account_id` but received ''"): - await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "bcf48806-b317-4351-9ee7-36e7d557d4de", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): - await async_client.workers.deployments.by_scripts.details.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - script_id="8ee82b3a2c0f42928b8f14dae4a97121", - ) diff --git a/tests/api_resources/workers/deployments/test_by_scripts.py b/tests/api_resources/workers/deployments/test_by_scripts.py deleted file mode 100644 index e47639477f3..00000000000 --- a/tests/api_resources/workers/deployments/test_by_scripts.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.workers.deployments import ByScriptGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestByScripts: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - by_script = client.workers.deployments.by_scripts.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - by_script = response.parse() - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.deployments.by_scripts.with_streaming_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - by_script = response.parse() - assert_matches_type(ByScriptGetResponse, by_script, 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 `account_id` but received ''"): - client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - client.workers.deployments.by_scripts.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncByScripts: - 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: - by_script = await async_client.workers.deployments.by_scripts.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - by_script = await response.parse() - assert_matches_type(ByScriptGetResponse, by_script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.deployments.by_scripts.with_streaming_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - by_script = await response.parse() - assert_matches_type(ByScriptGetResponse, by_script, 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 `account_id` but received ''"): - await async_client.workers.deployments.by_scripts.with_raw_response.get( - "8ee82b3a2c0f42928b8f14dae4a97121", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_id` but received ''"): - await async_client.workers.deployments.by_scripts.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/scripts/test_bindings.py b/tests/api_resources/workers/scripts/test_bindings.py deleted file mode 100644 index 7bbf34efc37..00000000000 --- a/tests/api_resources/workers/scripts/test_bindings.py +++ /dev/null @@ -1,106 +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.workers.scripts import BindingGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBindings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - binding = client.workers.scripts.bindings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.scripts.bindings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.scripts.bindings.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = response.parse() - assert_matches_type(BindingGetResponse, binding, 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_id` but received ''"): - client.workers.scripts.bindings.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncBindings: - 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: - binding = await async_client.workers.scripts.bindings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.bindings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - binding = await response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.bindings.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - binding = await response.parse() - assert_matches_type(BindingGetResponse, binding, 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_id` but received ''"): - await async_client.workers.scripts.bindings.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py index 874362e56bd..37650bb7ded 100644 --- a/tests/api_resources/workers/scripts/test_content.py +++ b/tests/api_resources/workers/scripts/test_content.py @@ -5,10 +5,18 @@ import os from typing import Any, cast +import httpx import pytest +from respx import MockRouter from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, +) from cloudflare.types.workers import Script base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -83,6 +91,76 @@ def test_path_params_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + content = client.workers.scripts.content.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert content.is_closed + assert content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, BinaryAPIResponse) + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + content = client.workers.scripts.content.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert content.is_closed is True + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + assert content.json() == {"foo": "bar"} + assert isinstance(content, BinaryAPIResponse) + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + with client.workers.scripts.content.with_streaming_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as content: + assert not content.is_closed + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + + assert content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, StreamedBinaryAPIResponse) + + assert cast(Any, content.is_closed) is True + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.scripts.content.with_raw_response.get( + "this-is_my_script-01", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + client.workers.scripts.content.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + class TestAsyncContent: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -152,3 +230,73 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + content = await async_client.workers.scripts.content.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert content.is_closed + assert await content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, AsyncBinaryAPIResponse) + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + content = await async_client.workers.scripts.content.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert content.is_closed is True + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + assert await content.json() == {"foo": "bar"} + assert isinstance(content, AsyncBinaryAPIResponse) + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + async with async_client.workers.scripts.content.with_streaming_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as content: + assert not content.is_closed + assert content.http_request.headers.get("X-Stainless-Lang") == "python" + + assert await content.json() == {"foo": "bar"} + assert cast(Any, content.is_closed) is True + assert isinstance(content, AsyncStreamedBinaryAPIResponse) + + assert cast(Any, content.is_closed) is True + + @pytest.mark.skip() + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.scripts.content.with_raw_response.get( + "this-is_my_script-01", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): + await async_client.workers.scripts.content.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/workers/scripts/test_content_v2.py b/tests/api_resources/workers/scripts/test_content_v2.py deleted file mode 100644 index 31016e26535..00000000000 --- a/tests/api_resources/workers/scripts/test_content_v2.py +++ /dev/null @@ -1,168 +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 httpx -import pytest -from respx import MockRouter - -from cloudflare import Cloudflare, AsyncCloudflare -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestContentV2: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content_v2 = client.workers.scripts.content_v2.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert content_v2.is_closed - assert content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content_v2 = client.workers.scripts.content_v2.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert content_v2.is_closed is True - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - assert content_v2.json() == {"foo": "bar"} - assert isinstance(content_v2, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.workers.scripts.content_v2.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as content_v2: - assert not content_v2.is_closed - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - - assert content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, StreamedBinaryAPIResponse) - - assert cast(Any, content_v2.is_closed) is True - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.scripts.content_v2.with_raw_response.get( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.content_v2.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncContentV2: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content_v2 = await async_client.workers.scripts.content_v2.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert content_v2.is_closed - assert await content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content_v2 = await async_client.workers.scripts.content_v2.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert content_v2.is_closed is True - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - assert await content_v2.json() == {"foo": "bar"} - assert isinstance(content_v2, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/scripts/this-is_my_script-01/content/v2" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.workers.scripts.content_v2.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as content_v2: - assert not content_v2.is_closed - assert content_v2.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await content_v2.json() == {"foo": "bar"} - assert cast(Any, content_v2.is_closed) is True - assert isinstance(content_v2, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, content_v2.is_closed) is True - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.scripts.content_v2.with_raw_response.get( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.content_v2.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/scripts/test_usage_model.py b/tests/api_resources/workers/scripts/test_usage_model.py deleted file mode 100644 index a4a646e937c..00000000000 --- a/tests/api_resources/workers/scripts/test_usage_model.py +++ /dev/null @@ -1,240 +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.workers.scripts import UsageModelGetResponse, UsageModelUpdateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsageModel: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - usage_model = client.workers.scripts.usage_model.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.scripts.usage_model.with_streaming_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage_model = response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, 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 `account_id` but received ''"): - client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="", - body="{'usage_model': 'unbound'}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.usage_model.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - usage_model = client.workers.scripts.usage_model.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.scripts.usage_model.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.scripts.usage_model.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage_model = response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, 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 `account_id` but received ''"): - client.workers.scripts.usage_model.with_raw_response.get( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.usage_model.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncUsageModel: - 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: - usage_model = await async_client.workers.scripts.usage_model.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = await response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.usage_model.with_streaming_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage_model = await response.parse() - assert_matches_type(UsageModelUpdateResponse, usage_model, 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 `account_id` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.update( - "this-is_my_script-01", - account_id="", - body="{'usage_model': 'unbound'}", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body="{'usage_model': 'unbound'}", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - usage_model = await async_client.workers.scripts.usage_model.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.usage_model.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage_model = await response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.usage_model.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage_model = await response.parse() - assert_matches_type(UsageModelGetResponse, usage_model, 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 `account_id` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.get( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.usage_model.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/scripts/versions/__init__.py b/tests/api_resources/workers/scripts/versions/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/workers/scripts/versions/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/scripts/versions/test_settings.py b/tests/api_resources/workers/scripts/versions/test_settings.py deleted file mode 100644 index f53a9d35640..00000000000 --- a/tests/api_resources/workers/scripts/versions/test_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 - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.workers.scripts.versions import Settings - -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_edit(self, client: Cloudflare) -> None: - setting = client.workers.scripts.versions.settings.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - setting = client.workers.scripts.versions.settings.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - settings={ - "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": [ - "formdata_parser_supports_files", - "formdata_parser_supports_files", - "formdata_parser_supports_files", - ], - "logpush": False, - "migrations": { - "new_tag": "v2", - "old_tag": "v1", - "deleted_classes": ["string", "string", "string"], - "new_classes": ["string", "string", "string"], - "renamed_classes": [ - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - ], - "transferred_classes": [ - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - ], - }, - "placement": {"mode": "smart"}, - "tags": ["my-tag", "my-tag", "my-tag"], - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - "usage_model": "unbound", - }, - ) - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.workers.scripts.versions.settings.with_raw_response.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.workers.scripts.versions.settings.with_streaming_response.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(Settings, 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 `account_id` but received ''"): - client.workers.scripts.versions.settings.with_raw_response.edit( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.versions.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - setting = client.workers.scripts.versions.settings.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.scripts.versions.settings.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.scripts.versions.settings.with_streaming_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(Settings, 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 `account_id` but received ''"): - client.workers.scripts.versions.settings.with_raw_response.get( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.scripts.versions.settings.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.scripts.versions.settings.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.scripts.versions.settings.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - settings={ - "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": [ - "formdata_parser_supports_files", - "formdata_parser_supports_files", - "formdata_parser_supports_files", - ], - "logpush": False, - "migrations": { - "new_tag": "v2", - "old_tag": "v1", - "deleted_classes": ["string", "string", "string"], - "new_classes": ["string", "string", "string"], - "renamed_classes": [ - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - { - "from": "string", - "to": "string", - }, - ], - "transferred_classes": [ - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - { - "from": "string", - "from_script": "string", - "to": "string", - }, - ], - }, - "placement": {"mode": "smart"}, - "tags": ["my-tag", "my-tag", "my-tag"], - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - "usage_model": "unbound", - }, - ) - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.versions.settings.with_raw_response.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.versions.settings.with_streaming_response.edit( - "this-is_my_script-01", - account_id="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(Settings, 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 `account_id` but received ''"): - await async_client.workers.scripts.versions.settings.with_raw_response.edit( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.versions.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.scripts.versions.settings.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.scripts.versions.settings.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(Settings, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.scripts.versions.settings.with_streaming_response.get( - "this-is_my_script-01", - account_id="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(Settings, 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 `account_id` but received ''"): - await async_client.workers.scripts.versions.settings.with_raw_response.get( - "this-is_my_script-01", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.scripts.versions.settings.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/workers/services/__init__.py b/tests/api_resources/workers/services/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/workers/services/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/services/environments/__init__.py b/tests/api_resources/workers/services/environments/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/workers/services/environments/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/services/environments/test_content.py b/tests/api_resources/workers/services/environments/test_content.py deleted file mode 100644 index c4bd05f1a8d..00000000000 --- a/tests/api_resources/workers/services/environments/test_content.py +++ /dev/null @@ -1,352 +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 httpx -import pytest -from respx import MockRouter - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) -from cloudflare.types.workers import Script - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestContent: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - content = client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(Script, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - content = client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"], - metadata={ - "body_part": "worker.js", - "main_module": "worker.js", - }, - ) - assert_matches_type(Script, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = response.parse() - assert_matches_type(Script, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.services.environments.content.with_streaming_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = response.parse() - assert_matches_type(Script, content, 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 `account_id` but received ''"): - client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.content.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = client.workers.services.environments.content.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert content.is_closed - assert content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content = client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert content.is_closed is True - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - assert content.json() == {"foo": "bar"} - assert isinstance(content, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.workers.services.environments.content.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as content: - assert not content.is_closed - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - - assert content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, StreamedBinaryAPIResponse) - - assert cast(Any, content.is_closed) is True - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.content.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - -class TestAsyncContent: - 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: - content = await async_client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(Script, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - content = await async_client.workers.services.environments.content.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"], - metadata={ - "body_part": "worker.js", - "main_module": "worker.js", - }, - ) - assert_matches_type(Script, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = await response.parse() - assert_matches_type(Script, content, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.services.environments.content.with_streaming_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = await response.parse() - assert_matches_type(Script, content, 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 `account_id` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.update( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = await async_client.workers.services.environments.content.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert content.is_closed - assert await content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - content = await async_client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert content.is_closed is True - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - assert await content.json() == {"foo": "bar"} - assert isinstance(content, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get( - "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/services/my-worker/environments/production/content" - ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.workers.services.environments.content.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as content: - assert not content.is_closed - assert content.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, content.is_closed) is True - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.content.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) diff --git a/tests/api_resources/workers/services/environments/test_settings.py b/tests/api_resources/workers/services/environments/test_settings.py deleted file mode 100644 index 4d06a04a600..00000000000 --- a/tests/api_resources/workers/services/environments/test_settings.py +++ /dev/null @@ -1,756 +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.workers import ScriptSetting - -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_edit(self, client: Cloudflare) -> None: - setting = client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - setting = client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={ - "logpush": False, - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - }, - success=True, - ) - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.workers.services.environments.settings.with_streaming_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(ScriptSetting, 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 `account_id` but received ''"): - client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - setting = client.workers.services.environments.settings.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.services.environments.settings.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(ScriptSetting, 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 `account_id` but received ''"): - client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - client.workers.services.environments.settings.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - -class TestAsyncSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.services.environments.settings.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={ - "logpush": False, - "tail_consumers": [ - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - { - "environment": "production", - "namespace": "my-namespace", - "service": "my-log-consumer", - }, - ], - }, - success=True, - ) - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.services.environments.settings.with_streaming_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(ScriptSetting, 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 `account_id` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.edit( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - errors=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - messages=[ - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - { - "code": 1000, - "message": "string", - }, - ], - result={}, - success=True, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers.services.environments.settings.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.services.environments.settings.with_streaming_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(ScriptSetting, 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 `account_id` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="", - service_name="my-worker", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.get( - "production", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_name` but received ''"): - await async_client.workers.services.environments.settings.with_raw_response.get( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - service_name="my-worker", - ) diff --git a/tests/api_resources/workers/test_filters.py b/tests/api_resources/workers/test_filters.py deleted file mode 100644 index 77b9bd9c84b..00000000000 --- a/tests/api_resources/workers/test_filters.py +++ /dev/null @@ -1,449 +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.workers import ( - WorkersFilter, - FilterCreateResponse, - FilterDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFilters: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - filter = client.workers.filters.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, 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_id` but received ''"): - client.workers.filters.with_raw_response.create( - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - filter = client.workers.filters.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(WorkersFilter, filter, 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_id` but received ''"): - client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - client.workers.filters.with_raw_response.update( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - filter = client.workers.filters.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(SyncSinglePage[WorkersFilter], filter, 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_id` but received ''"): - client.workers.filters.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - filter = client.workers.filters.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.workers.filters.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, 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_id` but received ''"): - client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - client.workers.filters.with_raw_response.delete( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - -class TestAsyncFilters: - 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: - filter = await async_client.workers.filters.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(Optional[FilterCreateResponse], filter, 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_id` but received ''"): - await async_client.workers.filters.with_raw_response.create( - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(WorkersFilter, filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(WorkersFilter, filter, 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_id` but received ''"): - await async_client.workers.filters.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - enabled=True, - pattern="example.net/*", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - await async_client.workers.filters.with_raw_response.update( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - enabled=True, - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(AsyncSinglePage[WorkersFilter], filter, 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_id` but received ''"): - await async_client.workers.filters.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.workers.filters.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = await response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.filters.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - filter = await response.parse() - assert_matches_type(Optional[FilterDeleteResponse], filter, 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_id` but received ''"): - await async_client.workers.filters.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `filter_id` but received ''"): - await async_client.workers.filters.with_raw_response.delete( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) diff --git a/tests/api_resources/workers/test_routes.py b/tests/api_resources/workers/test_routes.py deleted file mode 100644 index 4e447461d81..00000000000 --- a/tests/api_resources/workers/test_routes.py +++ /dev/null @@ -1,574 +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.shared import UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f -from cloudflare.types.workers import WorkersRoute - -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"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - route = client.workers.routes.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @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(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @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(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @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(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, 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_id` but received ''"): - client.workers.routes.with_raw_response.create( - zone_id="", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - route = client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - route = client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - script="this-is_my_script-01", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.routes.with_raw_response.update( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.routes.with_streaming_response.update( - "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(WorkersRoute, route, 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_id` but received ''"): - client.workers.routes.with_raw_response.update( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - route = client.workers.routes.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, 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_id` but received ''"): - client.workers.routes.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - route = client.workers.routes.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.workers.routes.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - route = response.parse() - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.workers.routes.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - route = response.parse() - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, 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_id` but received ''"): - client.workers.routes.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.workers.routes.with_raw_response.delete( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - route = client.workers.routes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.routes.with_raw_response.get( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.routes.with_streaming_response.get( - "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(WorkersRoute, route, 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_id` but received ''"): - client.workers.routes.with_raw_response.get( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncRoutes: - 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: - route = await async_client.workers.routes.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @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(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @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(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @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(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, 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_id` but received ''"): - await async_client.workers.routes.with_raw_response.create( - zone_id="", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - script="this-is_my_script-01", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.routes.with_raw_response.update( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.routes.with_streaming_response.update( - "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(WorkersRoute, route, 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_id` but received ''"): - await async_client.workers.routes.with_raw_response.update( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - pattern="example.net/*", - ) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, path=["response"]) - - @pytest.mark.skip() - @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[WorkersRoute], route, 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_id` but received ''"): - await async_client.workers.routes.with_raw_response.list( - zone_id="", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.routes.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - route = await response.parse() - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.routes.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - route = await response.parse() - assert_matches_type(UnnamedSchemaRef8d6a37a1e4190f86652802244d29525f, route, 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_id` but received ''"): - await async_client.workers.routes.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - body={}, - ) - - 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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - route = await async_client.workers.routes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.routes.with_raw_response.get( - "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(WorkersRoute, route, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.routes.with_streaming_response.get( - "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(WorkersRoute, route, 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_id` but received ''"): - await async_client.workers.routes.with_raw_response.get( - "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( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/zones/workers/__init__.py b/tests/api_resources/zones/workers/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/zones/workers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/zones/workers/test_script.py b/tests/api_resources/zones/workers/test_script.py deleted file mode 100644 index bc03fee7b47..00000000000 --- a/tests/api_resources/zones/workers/test_script.py +++ /dev/null @@ -1,334 +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 httpx -import pytest -from respx import MockRouter - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) -from cloudflare.types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestScript: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - script = client.zones.workers.script.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zones.workers.script.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = response.parse() - assert_matches_type(UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zones.workers.script.with_streaming_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = response.parse() - assert_matches_type(UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, script, 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_id` but received ''"): - client.zones.workers.script.with_raw_response.update( - zone_id="", - body={}, - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - script = client.zones.workers.script.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert script is None - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zones.workers.script.with_raw_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = response.parse() - assert script is None - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zones.workers.script.with_streaming_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = response.parse() - assert script is None - - 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_id` but received ''"): - client.zones.workers.script.with_raw_response.delete( - zone_id="", - body={}, - ) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - script = client.zones.workers.script.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert script.is_closed - assert script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - - script = client.zones.workers.script.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert script.is_closed is True - assert script.http_request.headers.get("X-Stainless-Lang") == "python" - assert script.json() == {"foo": "bar"} - assert isinstance(script, BinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - with client.zones.workers.script.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as script: - assert not script.is_closed - assert script.http_request.headers.get("X-Stainless-Lang") == "python" - - assert script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, StreamedBinaryAPIResponse) - - assert cast(Any, script.is_closed) is True - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - 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.zones.workers.script.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncScript: - 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: - script = await async_client.zones.workers.script.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.workers.script.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = await response.parse() - assert_matches_type(UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, script, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.workers.script.with_streaming_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = await response.parse() - assert_matches_type(UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a, script, 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_id` but received ''"): - await async_client.zones.workers.script.with_raw_response.update( - zone_id="", - body={}, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - script = await async_client.zones.workers.script.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert script is None - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.workers.script.with_raw_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - script = await response.parse() - assert script is None - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.workers.script.with_streaming_response.delete( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - script = await response.parse() - assert script is None - - 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_id` but received ''"): - await async_client.zones.workers.script.with_raw_response.delete( - zone_id="", - body={}, - ) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - script = await async_client.zones.workers.script.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert script.is_closed - assert await script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - - script = await async_client.zones.workers.script.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert script.is_closed is True - assert script.http_request.headers.get("X-Stainless-Lang") == "python" - assert await script.json() == {"foo": "bar"} - assert isinstance(script, AsyncBinaryAPIResponse) - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: - respx_mock.get("/zones/023e105f4ecef8ad9ca31a8372d0c353/workers/script").mock( - return_value=httpx.Response(200, json={"foo": "bar"}) - ) - async with async_client.zones.workers.script.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as script: - assert not script.is_closed - assert script.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await script.json() == {"foo": "bar"} - assert cast(Any, script.is_closed) is True - assert isinstance(script, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, script.is_closed) is True - - @pytest.mark.skip() - @parametrize - @pytest.mark.respx(base_url=base_url) - 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.zones.workers.script.with_raw_response.get( - zone_id="", - )