From 400d4d04c15caf57b790855f5eedc383fc0f0f49 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 02:18:51 +0000 Subject: [PATCH] feat: update via SDK Studio (#79) --- api.md | 233 +++++---- src/cloudflare/_client.py | 40 +- src/cloudflare/resources/__init__.py | 66 +-- src/cloudflare/resources/accounts/__init__.py | 14 + src/cloudflare/resources/accounts/accounts.py | 32 ++ .../resources/{ => accounts}/roles.py | 14 +- .../resources/dcv_delegation/__init__.py | 24 +- .../dcv_delegation/dcv_delegation.py | 38 +- src/cloudflare/resources/radar/__init__.py | 24 +- .../resources/radar/as112/__init__.py | 24 +- src/cloudflare/resources/radar/as112/as112.py | 52 +- src/cloudflare/resources/radar/radar.py | 38 +- src/cloudflare/resources/snippets/__init__.py | 28 +- .../snippets/{snippet_rules.py => rules.py} | 88 ++-- src/cloudflare/resources/snippets/snippets.py | 40 +- ...normalizations.py => url_normalization.py} | 62 +-- src/cloudflare/resources/workers/__init__.py | 14 - .../resources/workers/dispatch/__init__.py | 33 -- .../resources/workers/dispatch/dispatch.py | 81 --- .../workers/dispatch/namespaces/__init__.py | 33 -- .../workers/dispatch/namespaces/namespaces.py | 80 --- .../workers/dispatch/namespaces/scripts.py | 460 ----------------- src/cloudflare/resources/workers/workers.py | 33 -- .../dispatch/namespaces/scripts/__init__.py | 28 - .../namespaces/scripts/content/__init__.py | 61 +++ .../scripts/{ => content}/bindings.py | 12 +- .../namespaces/scripts/content/content.py | 144 ++++++ .../{content.py => content/scripts.py} | 97 ++-- .../scripts/{ => content}/settings.py | 16 +- .../dispatch/namespaces/scripts/scripts.py | 477 +++++++++++++++--- .../resources/zero_trust/__init__.py | 42 ++ .../resources/zero_trust/access/__init__.py | 42 -- .../resources/zero_trust/access/access.py | 96 ---- .../{access => }/identity_providers.py | 16 +- .../zero_trust/{access => }/organizations.py | 16 +- .../zero_trust/{access => }/seats.py | 16 +- .../resources/zero_trust/zero_trust.py | 96 ++++ src/cloudflare/resources/zones/__init__.py | 14 + .../resources/zones/subscriptions.py | 411 +++++++++++++++ src/cloudflare/resources/zones/zones.py | 32 ++ src/cloudflare/types/__init__.py | 2 - src/cloudflare/types/accounts/__init__.py | 2 + .../types/{ => accounts}/role_get_response.py | 0 .../{ => accounts}/role_list_response.py | 2 +- src/cloudflare/types/radar/__init__.py | 4 +- .../types/radar/as112_timeseries_params.py | 4 +- .../types/radar/as112_timeseries_response.py | 4 +- src/cloudflare/types/snippets/__init__.py | 6 +- ...list_response.py => rule_list_response.py} | 6 +- ...update_params.py => rule_update_params.py} | 4 +- ...te_response.py => rule_update_response.py} | 6 +- .../types/workers/dispatch/__init__.py | 3 - .../workers/dispatch/namespaces/__init__.py | 8 - .../dispatch/namespaces/__init__.py | 5 + .../namespaces/script_delete_params.py | 0 .../namespaces/script_get_response.py | 0 .../namespaces/script_update_params.py | 0 .../namespaces/script_update_response.py | 0 .../dispatch/namespaces/scripts/__init__.py | 7 - .../namespaces/scripts/content/__init__.py | 10 + .../{ => content}/binding_get_response.py | 2 +- .../script_update_params.py} | 8 +- .../script_update_response.py} | 6 +- .../{ => content}/setting_edit_params.py | 0 .../{ => content}/setting_edit_response.py | 2 +- .../{ => content}/setting_get_response.py | 2 +- src/cloudflare/types/zero_trust/__init__.py | 16 + .../types/zero_trust/access/__init__.py | 16 - .../identity_provider_create_params.py | 0 .../identity_provider_create_response.py | 2 +- .../identity_provider_delete_response.py | 2 +- .../identity_provider_get_response.py | 2 +- .../identity_provider_list_response.py | 2 +- .../identity_provider_update_params.py | 0 .../identity_provider_update_response.py | 2 +- .../organization_create_params.py | 0 .../organization_create_response.py | 2 +- .../organization_list_response.py | 2 +- .../organization_revoke_users_params.py | 0 .../organization_revoke_users_response.py | 0 .../organization_update_params.py | 0 .../organization_update_response.py | 2 +- .../{access => }/seat_edit_params.py | 0 .../{access => }/seat_edit_response.py | 2 +- src/cloudflare/types/zones/__init__.py | 4 + .../types/zones/subscription_create_params.py | 70 +++ .../zones/subscription_create_response.py | 7 + .../types/zones/subscription_get_response.py | 7 + .../types/zones/subscription_list_response.py | 106 ++++ .../{ => accounts}/test_roles.py | 26 +- tests/api_resources/radar/test_as112.py | 22 +- .../{test_snippet_rules.py => test_rules.py} | 86 ++-- ...lizations.py => test_url_normalization.py} | 40 +- .../workers/dispatch/namespaces/__init__.py | 1 - .../namespaces/scripts/content}/__init__.py | 0 .../scripts/{ => content}/test_bindings.py | 34 +- .../test_scripts.py} | 184 +++---- .../scripts/{ => content}/test_settings.py | 266 +++++----- .../dispatch/namespaces/test_scripts.py | 82 +-- .../{access => }/test_identity_providers.py | 134 ++--- .../{access => }/test_organizations.py | 98 ++-- .../zero_trust/{access => }/test_seats.py | 18 +- .../api_resources/zones/test_subscriptions.py | 358 +++++++++++++ 103 files changed, 2857 insertions(+), 1996 deletions(-) rename src/cloudflare/resources/{ => accounts}/roles.py (96%) rename src/cloudflare/resources/snippets/{snippet_rules.py => rules.py} (73%) rename src/cloudflare/resources/{url_normalizations.py => url_normalization.py} (81%) delete mode 100644 src/cloudflare/resources/workers/dispatch/__init__.py delete mode 100644 src/cloudflare/resources/workers/dispatch/dispatch.py delete mode 100644 src/cloudflare/resources/workers/dispatch/namespaces/__init__.py delete mode 100644 src/cloudflare/resources/workers/dispatch/namespaces/namespaces.py delete mode 100644 src/cloudflare/resources/workers/dispatch/namespaces/scripts.py create mode 100644 src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py rename src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/bindings.py (94%) create mode 100644 src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/content.py rename src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/{content.py => content/scripts.py} (83%) rename src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/settings.py (96%) rename src/cloudflare/resources/zero_trust/{access => }/identity_providers.py (99%) rename src/cloudflare/resources/zero_trust/{access => }/organizations.py (99%) rename src/cloudflare/resources/zero_trust/{access => }/seats.py (93%) create mode 100644 src/cloudflare/resources/zones/subscriptions.py rename src/cloudflare/types/{ => accounts}/role_get_response.py (100%) rename src/cloudflare/types/{ => accounts}/role_list_response.py (93%) rename src/cloudflare/types/snippets/{snippet_rule_list_response.py => rule_list_response.py} (64%) rename src/cloudflare/types/snippets/{snippet_rule_update_params.py => rule_update_params.py} (78%) rename src/cloudflare/types/snippets/{snippet_rule_update_response.py => rule_update_response.py} (62%) delete mode 100644 src/cloudflare/types/workers/dispatch/__init__.py delete mode 100644 src/cloudflare/types/workers/dispatch/namespaces/__init__.py rename src/cloudflare/types/{workers => workers_for_platforms}/dispatch/namespaces/script_delete_params.py (100%) rename src/cloudflare/types/{workers => workers_for_platforms}/dispatch/namespaces/script_get_response.py (100%) rename src/cloudflare/types/{workers => workers_for_platforms}/dispatch/namespaces/script_update_params.py (100%) rename src/cloudflare/types/{workers => workers_for_platforms}/dispatch/namespaces/script_update_response.py (100%) create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py rename src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/binding_get_response.py (99%) rename src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/{content_update_params.py => content/script_update_params.py} (88%) rename src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/{content_update_response.py => content/script_update_response.py} (91%) rename src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/setting_edit_params.py (100%) rename src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/setting_edit_response.py (99%) rename src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/setting_get_response.py (99%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_create_params.py (100%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_create_response.py (99%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_delete_response.py (86%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_get_response.py (99%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_list_response.py (99%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_update_params.py (100%) rename src/cloudflare/types/zero_trust/{access => }/identity_provider_update_response.py (99%) rename src/cloudflare/types/zero_trust/{access => }/organization_create_params.py (100%) rename src/cloudflare/types/zero_trust/{access => }/organization_create_response.py (98%) rename src/cloudflare/types/zero_trust/{access => }/organization_list_response.py (98%) rename src/cloudflare/types/zero_trust/{access => }/organization_revoke_users_params.py (100%) rename src/cloudflare/types/zero_trust/{access => }/organization_revoke_users_response.py (100%) rename src/cloudflare/types/zero_trust/{access => }/organization_update_params.py (100%) rename src/cloudflare/types/zero_trust/{access => }/organization_update_response.py (98%) rename src/cloudflare/types/zero_trust/{access => }/seat_edit_params.py (100%) rename src/cloudflare/types/zero_trust/{access => }/seat_edit_response.py (94%) create mode 100644 src/cloudflare/types/zones/subscription_create_params.py create mode 100644 src/cloudflare/types/zones/subscription_create_response.py create mode 100644 src/cloudflare/types/zones/subscription_get_response.py create mode 100644 src/cloudflare/types/zones/subscription_list_response.py rename tests/api_resources/{ => accounts}/test_roles.py (85%) rename tests/api_resources/snippets/{test_snippet_rules.py => test_rules.py} (69%) rename tests/api_resources/{test_url_normalizations.py => test_url_normalization.py} (86%) delete mode 100644 tests/api_resources/workers/dispatch/namespaces/__init__.py rename tests/api_resources/{workers/dispatch => workers_for_platforms/dispatch/namespaces/scripts/content}/__init__.py (100%) rename tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/test_bindings.py (86%) rename tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/{test_content.py => content/test_scripts.py} (70%) rename tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/{ => content}/test_settings.py (83%) rename tests/api_resources/{workers => workers_for_platforms}/dispatch/namespaces/test_scripts.py (84%) rename tests/api_resources/zero_trust/{access => }/test_identity_providers.py (86%) rename tests/api_resources/zero_trust/{access => }/test_organizations.py (85%) rename tests/api_resources/zero_trust/{access => }/test_seats.py (91%) create mode 100644 tests/api_resources/zones/test_subscriptions.py diff --git a/api.md b/api.md index 7edbed867fc..4890ed31f93 100644 --- a/api.md +++ b/api.md @@ -34,6 +34,19 @@ Methods: - client.accounts.members.delete(member_id, \*, account_id) -> Optional - client.accounts.members.get(member_id, \*, account_id) -> MemberGetResponse +## Roles + +Types: + +```python +from cloudflare.types.accounts import RoleListResponse, RoleGetResponse +``` + +Methods: + +- client.accounts.roles.list(\*, account_id) -> Optional +- client.accounts.roles.get(role_id, \*, account_id) -> RoleGetResponse + # Certificates Types: @@ -1139,6 +1152,24 @@ Methods: - client.zones.workers.script.delete(\*, zone_id) -> None - client.zones.workers.script.get(\*, zone_id) -> BinaryAPIResponse +## Subscriptions + +Types: + +```python +from cloudflare.types.zones import ( + SubscriptionCreateResponse, + SubscriptionListResponse, + SubscriptionGetResponse, +) +``` + +Methods: + +- client.zones.subscriptions.create(identifier, \*\*params) -> SubscriptionCreateResponse +- client.zones.subscriptions.list(account_identifier) -> Optional +- client.zones.subscriptions.get(identifier) -> SubscriptionGetResponse + # LoadBalancers Types: @@ -2783,24 +2814,6 @@ Methods: # Workers -## Dispatch - -### Namespaces - -#### Scripts - -Types: - -```python -from cloudflare.types.workers.dispatch.namespaces import ScriptUpdateResponse, ScriptGetResponse -``` - -Methods: - -- client.workers.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ScriptUpdateResponse -- client.workers.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> None -- client.workers.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> ScriptGetResponse - ## AI Types: @@ -3348,7 +3361,7 @@ Methods: - client.rulesets.versions.by_tags.get(rule_tag, \*, account_id, ruleset_id, ruleset_version) -> ByTagGetResponse -# URLNormalizations +# URLNormalization Types: @@ -3358,8 +3371,8 @@ from cloudflare.types import URLNormalizationUpdateResponse, URLNormalizationGet Methods: -- client.url_normalizations.update(\*, zone_id, \*\*params) -> URLNormalizationUpdateResponse -- client.url_normalizations.get(\*, zone_id) -> URLNormalizationGetResponse +- client.url_normalization.update(\*, zone_id, \*\*params) -> URLNormalizationUpdateResponse +- client.url_normalization.get(\*, zone_id) -> URLNormalizationGetResponse # Spectrum @@ -4305,19 +4318,6 @@ Methods: - client.request_tracers.traces.create(account_identifier, \*\*params) -> TraceCreateResponse -# Roles - -Types: - -```python -from cloudflare.types import RoleListResponse, RoleGetResponse -``` - -Methods: - -- client.roles.list(\*, account_id) -> Optional -- client.roles.get(role_id, \*, account_id) -> RoleGetResponse - # Rules ## Lists @@ -5056,25 +5056,44 @@ Methods: #### Scripts +Types: + +```python +from cloudflare.types.workers_for_platforms.dispatch.namespaces import ( + ScriptUpdateResponse, + ScriptGetResponse, +) +``` + +Methods: + +- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ScriptUpdateResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> None +- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> ScriptGetResponse + ##### Content +###### Scripts + Types: ```python -from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ContentUpdateResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.content import ( + ScriptUpdateResponse, +) ``` Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ContentUpdateResponse -- client.workers_for_platforms.dispatch.namespaces.scripts.content.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ScriptUpdateResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse -##### Settings +###### Settings Types: ```python -from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.content import ( SettingEditResponse, SettingGetResponse, ) @@ -5082,23 +5101,79 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SettingEditResponse -- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> SettingGetResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SettingEditResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.get(script_name, \*, account_id, dispatch_namespace) -> SettingGetResponse -##### Bindings +###### Bindings Types: ```python -from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.content import ( + BindingGetResponse, +) ``` Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> BindingGetResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.get(script_name, \*, account_id, dispatch_namespace) -> BindingGetResponse # ZeroTrust +## IdentityProviders + +Types: + +```python +from cloudflare.types.zero_trust import ( + IdentityProviderCreateResponse, + IdentityProviderUpdateResponse, + IdentityProviderListResponse, + IdentityProviderDeleteResponse, + IdentityProviderGetResponse, +) +``` + +Methods: + +- client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> IdentityProviderCreateResponse +- client.zero_trust.identity_providers.update(uuid, \*, account_id, zone_id, \*\*params) -> IdentityProviderUpdateResponse +- client.zero_trust.identity_providers.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.identity_providers.delete(uuid, \*, account_id, zone_id) -> IdentityProviderDeleteResponse +- client.zero_trust.identity_providers.get(uuid, \*, account_id, zone_id) -> IdentityProviderGetResponse + +## Organizations + +Types: + +```python +from cloudflare.types.zero_trust import ( + OrganizationCreateResponse, + OrganizationUpdateResponse, + OrganizationListResponse, + OrganizationRevokeUsersResponse, +) +``` + +Methods: + +- client.zero_trust.organizations.create(\*, account_id, zone_id, \*\*params) -> OrganizationCreateResponse +- client.zero_trust.organizations.update(\*, account_id, zone_id, \*\*params) -> OrganizationUpdateResponse +- client.zero_trust.organizations.list(\*, account_id, zone_id) -> OrganizationListResponse +- client.zero_trust.organizations.revoke_users(\*, account_id, zone_id, \*\*params) -> Optional + +## Seats + +Types: + +```python +from cloudflare.types.zero_trust import SeatEditResponse +``` + +Methods: + +- client.zero_trust.seats.edit(identifier, \*\*params) -> Optional + ## Access ### Applications @@ -5239,48 +5314,6 @@ Methods: - client.zero_trust.access.groups.delete(uuid, \*, account_id, zone_id) -> GroupDeleteResponse - client.zero_trust.access.groups.get(uuid, \*, account_id, zone_id) -> GroupGetResponse -### IdentityProviders - -Types: - -```python -from cloudflare.types.zero_trust.access import ( - IdentityProviderCreateResponse, - IdentityProviderUpdateResponse, - IdentityProviderListResponse, - IdentityProviderDeleteResponse, - IdentityProviderGetResponse, -) -``` - -Methods: - -- client.zero_trust.access.identity_providers.create(\*, account_id, zone_id, \*\*params) -> IdentityProviderCreateResponse -- client.zero_trust.access.identity_providers.update(uuid, \*, account_id, zone_id, \*\*params) -> IdentityProviderUpdateResponse -- client.zero_trust.access.identity_providers.list(\*, account_id, zone_id) -> Optional -- client.zero_trust.access.identity_providers.delete(uuid, \*, account_id, zone_id) -> IdentityProviderDeleteResponse -- client.zero_trust.access.identity_providers.get(uuid, \*, account_id, zone_id) -> IdentityProviderGetResponse - -### Organizations - -Types: - -```python -from cloudflare.types.zero_trust.access import ( - OrganizationCreateResponse, - OrganizationUpdateResponse, - OrganizationListResponse, - OrganizationRevokeUsersResponse, -) -``` - -Methods: - -- client.zero_trust.access.organizations.create(\*, account_id, zone_id, \*\*params) -> OrganizationCreateResponse -- client.zero_trust.access.organizations.update(\*, account_id, zone_id, \*\*params) -> OrganizationUpdateResponse -- client.zero_trust.access.organizations.list(\*, account_id, zone_id) -> OrganizationListResponse -- client.zero_trust.access.organizations.revoke_users(\*, account_id, zone_id, \*\*params) -> Optional - ### ServiceTokens Types: @@ -5355,18 +5388,6 @@ Methods: - client.zero_trust.access.logs.access_requests.list(identifier) -> Optional -### Seats - -Types: - -```python -from cloudflare.types.zero_trust.access import SeatEditResponse -``` - -Methods: - -- client.zero_trust.access.seats.edit(identifier, \*\*params) -> Optional - ### Users Types: @@ -6393,17 +6414,17 @@ Methods: - client.radar.verified_bots.top.bots(\*\*params) -> TopBotsResponse - client.radar.verified_bots.top.categories(\*\*params) -> TopCategoriesResponse -## As112 +## AS112 Types: ```python -from cloudflare.types.radar import As112TimeseriesResponse +from cloudflare.types.radar import AS112TimeseriesResponse ``` Methods: -- client.radar.as112.timeseries(\*\*params) -> As112TimeseriesResponse +- client.radar.as112.timeseries(\*\*params) -> AS112TimeseriesResponse ### Summary @@ -7354,7 +7375,7 @@ Methods: - client.speed.pages.list(\*, zone_id) -> Optional -# DcvDelegation +# DCVDelegation ## UUID @@ -7412,18 +7433,18 @@ Methods: - client.snippets.content.get(snippet_name, \*, zone_identifier) -> BinaryAPIResponse -## SnippetRules +## Rules Types: ```python -from cloudflare.types.snippets import SnippetRuleUpdateResponse, SnippetRuleListResponse +from cloudflare.types.snippets import RuleUpdateResponse, RuleListResponse ``` Methods: -- client.snippets.snippet_rules.update(zone_identifier, \*\*params) -> SnippetRuleUpdateResponse -- client.snippets.snippet_rules.list(zone_identifier) -> SnippetRuleListResponse +- client.snippets.rules.update(zone_identifier, \*\*params) -> RuleUpdateResponse +- client.snippets.rules.list(zone_identifier) -> RuleListResponse # Calls diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index cd6f2a86b07..bf5b71f49b3 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -87,7 +87,7 @@ class Cloudflare(SyncAPIClient): managed_headers: resources.ManagedHeaders page_shield: resources.PageShield rulesets: resources.Rulesets - url_normalizations: resources.URLNormalizations + url_normalization: resources.URLNormalization spectrum: resources.Spectrum addressing: resources.Addressing audit_logs: resources.AuditLogs @@ -103,7 +103,6 @@ class Cloudflare(SyncAPIClient): pcaps: resources.PCAPs registrar: resources.Registrar request_tracers: resources.RequestTracers - roles: resources.Roles rules: resources.Rules storage: resources.Storage stream: resources.Stream @@ -123,7 +122,7 @@ class Cloudflare(SyncAPIClient): bot_management: resources.BotManagement origin_post_quantum_encryption: resources.OriginPostQuantumEncryption speed: resources.Speed - dcv_delegation: resources.DcvDelegation + dcv_delegation: resources.DCVDelegation hostnames: resources.Hostnames snippets: resources.Snippets calls: resources.Calls @@ -258,7 +257,7 @@ def __init__( self.managed_headers = resources.ManagedHeaders(self) self.page_shield = resources.PageShield(self) self.rulesets = resources.Rulesets(self) - self.url_normalizations = resources.URLNormalizations(self) + self.url_normalization = resources.URLNormalization(self) self.spectrum = resources.Spectrum(self) self.addressing = resources.Addressing(self) self.audit_logs = resources.AuditLogs(self) @@ -274,7 +273,6 @@ def __init__( self.pcaps = resources.PCAPs(self) self.registrar = resources.Registrar(self) self.request_tracers = resources.RequestTracers(self) - self.roles = resources.Roles(self) self.rules = resources.Rules(self) self.storage = resources.Storage(self) self.stream = resources.Stream(self) @@ -294,7 +292,7 @@ def __init__( self.bot_management = resources.BotManagement(self) self.origin_post_quantum_encryption = resources.OriginPostQuantumEncryption(self) self.speed = resources.Speed(self) - self.dcv_delegation = resources.DcvDelegation(self) + self.dcv_delegation = resources.DCVDelegation(self) self.hostnames = resources.Hostnames(self) self.snippets = resources.Snippets(self) self.calls = resources.Calls(self) @@ -483,7 +481,7 @@ class AsyncCloudflare(AsyncAPIClient): managed_headers: resources.AsyncManagedHeaders page_shield: resources.AsyncPageShield rulesets: resources.AsyncRulesets - url_normalizations: resources.AsyncURLNormalizations + url_normalization: resources.AsyncURLNormalization spectrum: resources.AsyncSpectrum addressing: resources.AsyncAddressing audit_logs: resources.AsyncAuditLogs @@ -499,7 +497,6 @@ class AsyncCloudflare(AsyncAPIClient): pcaps: resources.AsyncPCAPs registrar: resources.AsyncRegistrar request_tracers: resources.AsyncRequestTracers - roles: resources.AsyncRoles rules: resources.AsyncRules storage: resources.AsyncStorage stream: resources.AsyncStream @@ -519,7 +516,7 @@ class AsyncCloudflare(AsyncAPIClient): bot_management: resources.AsyncBotManagement origin_post_quantum_encryption: resources.AsyncOriginPostQuantumEncryption speed: resources.AsyncSpeed - dcv_delegation: resources.AsyncDcvDelegation + dcv_delegation: resources.AsyncDCVDelegation hostnames: resources.AsyncHostnames snippets: resources.AsyncSnippets calls: resources.AsyncCalls @@ -654,7 +651,7 @@ def __init__( self.managed_headers = resources.AsyncManagedHeaders(self) self.page_shield = resources.AsyncPageShield(self) self.rulesets = resources.AsyncRulesets(self) - self.url_normalizations = resources.AsyncURLNormalizations(self) + self.url_normalization = resources.AsyncURLNormalization(self) self.spectrum = resources.AsyncSpectrum(self) self.addressing = resources.AsyncAddressing(self) self.audit_logs = resources.AsyncAuditLogs(self) @@ -670,7 +667,6 @@ def __init__( self.pcaps = resources.AsyncPCAPs(self) self.registrar = resources.AsyncRegistrar(self) self.request_tracers = resources.AsyncRequestTracers(self) - self.roles = resources.AsyncRoles(self) self.rules = resources.AsyncRules(self) self.storage = resources.AsyncStorage(self) self.stream = resources.AsyncStream(self) @@ -690,7 +686,7 @@ def __init__( self.bot_management = resources.AsyncBotManagement(self) self.origin_post_quantum_encryption = resources.AsyncOriginPostQuantumEncryption(self) self.speed = resources.AsyncSpeed(self) - self.dcv_delegation = resources.AsyncDcvDelegation(self) + self.dcv_delegation = resources.AsyncDCVDelegation(self) self.hostnames = resources.AsyncHostnames(self) self.snippets = resources.AsyncSnippets(self) self.calls = resources.AsyncCalls(self) @@ -880,7 +876,7 @@ def __init__(self, client: Cloudflare) -> None: self.managed_headers = resources.ManagedHeadersWithRawResponse(client.managed_headers) self.page_shield = resources.PageShieldWithRawResponse(client.page_shield) self.rulesets = resources.RulesetsWithRawResponse(client.rulesets) - self.url_normalizations = resources.URLNormalizationsWithRawResponse(client.url_normalizations) + self.url_normalization = resources.URLNormalizationWithRawResponse(client.url_normalization) self.spectrum = resources.SpectrumWithRawResponse(client.spectrum) self.addressing = resources.AddressingWithRawResponse(client.addressing) self.audit_logs = resources.AuditLogsWithRawResponse(client.audit_logs) @@ -896,7 +892,6 @@ def __init__(self, client: Cloudflare) -> None: self.pcaps = resources.PCAPsWithRawResponse(client.pcaps) self.registrar = resources.RegistrarWithRawResponse(client.registrar) self.request_tracers = resources.RequestTracersWithRawResponse(client.request_tracers) - self.roles = resources.RolesWithRawResponse(client.roles) self.rules = resources.RulesWithRawResponse(client.rules) self.storage = resources.StorageWithRawResponse(client.storage) self.stream = resources.StreamWithRawResponse(client.stream) @@ -918,7 +913,7 @@ def __init__(self, client: Cloudflare) -> None: client.origin_post_quantum_encryption ) self.speed = resources.SpeedWithRawResponse(client.speed) - self.dcv_delegation = resources.DcvDelegationWithRawResponse(client.dcv_delegation) + self.dcv_delegation = resources.DCVDelegationWithRawResponse(client.dcv_delegation) self.hostnames = resources.HostnamesWithRawResponse(client.hostnames) self.snippets = resources.SnippetsWithRawResponse(client.snippets) self.calls = resources.CallsWithRawResponse(client.calls) @@ -970,7 +965,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.managed_headers = resources.AsyncManagedHeadersWithRawResponse(client.managed_headers) self.page_shield = resources.AsyncPageShieldWithRawResponse(client.page_shield) self.rulesets = resources.AsyncRulesetsWithRawResponse(client.rulesets) - self.url_normalizations = resources.AsyncURLNormalizationsWithRawResponse(client.url_normalizations) + self.url_normalization = resources.AsyncURLNormalizationWithRawResponse(client.url_normalization) self.spectrum = resources.AsyncSpectrumWithRawResponse(client.spectrum) self.addressing = resources.AsyncAddressingWithRawResponse(client.addressing) self.audit_logs = resources.AsyncAuditLogsWithRawResponse(client.audit_logs) @@ -988,7 +983,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.pcaps = resources.AsyncPCAPsWithRawResponse(client.pcaps) self.registrar = resources.AsyncRegistrarWithRawResponse(client.registrar) self.request_tracers = resources.AsyncRequestTracersWithRawResponse(client.request_tracers) - self.roles = resources.AsyncRolesWithRawResponse(client.roles) self.rules = resources.AsyncRulesWithRawResponse(client.rules) self.storage = resources.AsyncStorageWithRawResponse(client.storage) self.stream = resources.AsyncStreamWithRawResponse(client.stream) @@ -1010,7 +1004,7 @@ def __init__(self, client: AsyncCloudflare) -> None: client.origin_post_quantum_encryption ) self.speed = resources.AsyncSpeedWithRawResponse(client.speed) - self.dcv_delegation = resources.AsyncDcvDelegationWithRawResponse(client.dcv_delegation) + self.dcv_delegation = resources.AsyncDCVDelegationWithRawResponse(client.dcv_delegation) self.hostnames = resources.AsyncHostnamesWithRawResponse(client.hostnames) self.snippets = resources.AsyncSnippetsWithRawResponse(client.snippets) self.calls = resources.AsyncCallsWithRawResponse(client.calls) @@ -1062,7 +1056,7 @@ def __init__(self, client: Cloudflare) -> None: self.managed_headers = resources.ManagedHeadersWithStreamingResponse(client.managed_headers) self.page_shield = resources.PageShieldWithStreamingResponse(client.page_shield) self.rulesets = resources.RulesetsWithStreamingResponse(client.rulesets) - self.url_normalizations = resources.URLNormalizationsWithStreamingResponse(client.url_normalizations) + self.url_normalization = resources.URLNormalizationWithStreamingResponse(client.url_normalization) self.spectrum = resources.SpectrumWithStreamingResponse(client.spectrum) self.addressing = resources.AddressingWithStreamingResponse(client.addressing) self.audit_logs = resources.AuditLogsWithStreamingResponse(client.audit_logs) @@ -1080,7 +1074,6 @@ def __init__(self, client: Cloudflare) -> None: self.pcaps = resources.PCAPsWithStreamingResponse(client.pcaps) self.registrar = resources.RegistrarWithStreamingResponse(client.registrar) self.request_tracers = resources.RequestTracersWithStreamingResponse(client.request_tracers) - self.roles = resources.RolesWithStreamingResponse(client.roles) self.rules = resources.RulesWithStreamingResponse(client.rules) self.storage = resources.StorageWithStreamingResponse(client.storage) self.stream = resources.StreamWithStreamingResponse(client.stream) @@ -1102,7 +1095,7 @@ def __init__(self, client: Cloudflare) -> None: client.origin_post_quantum_encryption ) self.speed = resources.SpeedWithStreamingResponse(client.speed) - self.dcv_delegation = resources.DcvDelegationWithStreamingResponse(client.dcv_delegation) + self.dcv_delegation = resources.DCVDelegationWithStreamingResponse(client.dcv_delegation) self.hostnames = resources.HostnamesWithStreamingResponse(client.hostnames) self.snippets = resources.SnippetsWithStreamingResponse(client.snippets) self.calls = resources.CallsWithStreamingResponse(client.calls) @@ -1156,7 +1149,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.managed_headers = resources.AsyncManagedHeadersWithStreamingResponse(client.managed_headers) self.page_shield = resources.AsyncPageShieldWithStreamingResponse(client.page_shield) self.rulesets = resources.AsyncRulesetsWithStreamingResponse(client.rulesets) - self.url_normalizations = resources.AsyncURLNormalizationsWithStreamingResponse(client.url_normalizations) + self.url_normalization = resources.AsyncURLNormalizationWithStreamingResponse(client.url_normalization) self.spectrum = resources.AsyncSpectrumWithStreamingResponse(client.spectrum) self.addressing = resources.AsyncAddressingWithStreamingResponse(client.addressing) self.audit_logs = resources.AsyncAuditLogsWithStreamingResponse(client.audit_logs) @@ -1174,7 +1167,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.pcaps = resources.AsyncPCAPsWithStreamingResponse(client.pcaps) self.registrar = resources.AsyncRegistrarWithStreamingResponse(client.registrar) self.request_tracers = resources.AsyncRequestTracersWithStreamingResponse(client.request_tracers) - self.roles = resources.AsyncRolesWithStreamingResponse(client.roles) self.rules = resources.AsyncRulesWithStreamingResponse(client.rules) self.storage = resources.AsyncStorageWithStreamingResponse(client.storage) self.stream = resources.AsyncStreamWithStreamingResponse(client.stream) @@ -1198,7 +1190,7 @@ def __init__(self, client: AsyncCloudflare) -> None: client.origin_post_quantum_encryption ) self.speed = resources.AsyncSpeedWithStreamingResponse(client.speed) - self.dcv_delegation = resources.AsyncDcvDelegationWithStreamingResponse(client.dcv_delegation) + self.dcv_delegation = resources.AsyncDCVDelegationWithStreamingResponse(client.dcv_delegation) self.hostnames = resources.AsyncHostnamesWithStreamingResponse(client.hostnames) self.snippets = resources.AsyncSnippetsWithStreamingResponse(client.snippets) self.calls = resources.AsyncCallsWithStreamingResponse(client.calls) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 717dd87cd59..19daf3bbd01 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -144,14 +144,6 @@ RadarWithStreamingResponse, AsyncRadarWithStreamingResponse, ) -from .roles import ( - Roles, - AsyncRoles, - RolesWithRawResponse, - AsyncRolesWithRawResponse, - RolesWithStreamingResponse, - AsyncRolesWithStreamingResponse, -) from .rules import ( Rules, AsyncRules, @@ -489,12 +481,12 @@ AsyncCloudforceOneWithStreamingResponse, ) from .dcv_delegation import ( - DcvDelegation, - AsyncDcvDelegation, - DcvDelegationWithRawResponse, - AsyncDcvDelegationWithRawResponse, - DcvDelegationWithStreamingResponse, - AsyncDcvDelegationWithStreamingResponse, + DCVDelegation, + AsyncDCVDelegation, + DCVDelegationWithRawResponse, + AsyncDCVDelegationWithRawResponse, + DCVDelegationWithStreamingResponse, + AsyncDCVDelegationWithStreamingResponse, ) from .load_balancers import ( LoadBalancers, @@ -568,6 +560,14 @@ MTLSCertificatesWithStreamingResponse, AsyncMTLSCertificatesWithStreamingResponse, ) +from .url_normalization import ( + URLNormalization, + AsyncURLNormalization, + URLNormalizationWithRawResponse, + AsyncURLNormalizationWithRawResponse, + URLNormalizationWithStreamingResponse, + AsyncURLNormalizationWithStreamingResponse, +) from .custom_nameservers import ( CustomNameservers, AsyncCustomNameservers, @@ -576,14 +576,6 @@ CustomNameserversWithStreamingResponse, AsyncCustomNameserversWithStreamingResponse, ) -from .url_normalizations import ( - URLNormalizations, - AsyncURLNormalizations, - URLNormalizationsWithRawResponse, - AsyncURLNormalizationsWithRawResponse, - URLNormalizationsWithStreamingResponse, - AsyncURLNormalizationsWithStreamingResponse, -) from .client_certificates import ( ClientCertificates, AsyncClientCertificates, @@ -904,12 +896,12 @@ "AsyncRulesetsWithRawResponse", "RulesetsWithStreamingResponse", "AsyncRulesetsWithStreamingResponse", - "URLNormalizations", - "AsyncURLNormalizations", - "URLNormalizationsWithRawResponse", - "AsyncURLNormalizationsWithRawResponse", - "URLNormalizationsWithStreamingResponse", - "AsyncURLNormalizationsWithStreamingResponse", + "URLNormalization", + "AsyncURLNormalization", + "URLNormalizationWithRawResponse", + "AsyncURLNormalizationWithRawResponse", + "URLNormalizationWithStreamingResponse", + "AsyncURLNormalizationWithStreamingResponse", "Spectrum", "AsyncSpectrum", "SpectrumWithRawResponse", @@ -1000,12 +992,6 @@ "AsyncRequestTracersWithRawResponse", "RequestTracersWithStreamingResponse", "AsyncRequestTracersWithStreamingResponse", - "Roles", - "AsyncRoles", - "RolesWithRawResponse", - "AsyncRolesWithRawResponse", - "RolesWithStreamingResponse", - "AsyncRolesWithStreamingResponse", "Rules", "AsyncRules", "RulesWithRawResponse", @@ -1120,12 +1106,12 @@ "AsyncSpeedWithRawResponse", "SpeedWithStreamingResponse", "AsyncSpeedWithStreamingResponse", - "DcvDelegation", - "AsyncDcvDelegation", - "DcvDelegationWithRawResponse", - "AsyncDcvDelegationWithRawResponse", - "DcvDelegationWithStreamingResponse", - "AsyncDcvDelegationWithStreamingResponse", + "DCVDelegation", + "AsyncDCVDelegation", + "DCVDelegationWithRawResponse", + "AsyncDCVDelegationWithRawResponse", + "DCVDelegationWithStreamingResponse", + "AsyncDCVDelegationWithStreamingResponse", "Hostnames", "AsyncHostnames", "HostnamesWithRawResponse", diff --git a/src/cloudflare/resources/accounts/__init__.py b/src/cloudflare/resources/accounts/__init__.py index 1dc4dc5f5d1..603d100b9d8 100644 --- a/src/cloudflare/resources/accounts/__init__.py +++ b/src/cloudflare/resources/accounts/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. +from .roles import ( + Roles, + AsyncRoles, + RolesWithRawResponse, + AsyncRolesWithRawResponse, + RolesWithStreamingResponse, + AsyncRolesWithStreamingResponse, +) from .members import ( Members, AsyncMembers, @@ -24,6 +32,12 @@ "AsyncMembersWithRawResponse", "MembersWithStreamingResponse", "AsyncMembersWithStreamingResponse", + "Roles", + "AsyncRoles", + "RolesWithRawResponse", + "AsyncRolesWithRawResponse", + "RolesWithStreamingResponse", + "AsyncRolesWithStreamingResponse", "Accounts", "AsyncAccounts", "AccountsWithRawResponse", diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py index cd96bdcdb9a..47ce5224d0b 100644 --- a/src/cloudflare/resources/accounts/accounts.py +++ b/src/cloudflare/resources/accounts/accounts.py @@ -7,6 +7,14 @@ import httpx +from .roles import ( + Roles, + AsyncRoles, + RolesWithRawResponse, + AsyncRolesWithRawResponse, + RolesWithStreamingResponse, + AsyncRolesWithStreamingResponse, +) from ...types import ( AccountGetResponse, AccountUpdateResponse, @@ -46,6 +54,10 @@ class Accounts(SyncAPIResource): def members(self) -> Members: return Members(self._client) + @cached_property + def roles(self) -> Roles: + return Roles(self._client) + @cached_property def with_raw_response(self) -> AccountsWithRawResponse: return AccountsWithRawResponse(self) @@ -204,6 +216,10 @@ class AsyncAccounts(AsyncAPIResource): def members(self) -> AsyncMembers: return AsyncMembers(self._client) + @cached_property + def roles(self) -> AsyncRoles: + return AsyncRoles(self._client) + @cached_property def with_raw_response(self) -> AsyncAccountsWithRawResponse: return AsyncAccountsWithRawResponse(self) @@ -375,6 +391,10 @@ def __init__(self, accounts: Accounts) -> None: def members(self) -> MembersWithRawResponse: return MembersWithRawResponse(self._accounts.members) + @cached_property + def roles(self) -> RolesWithRawResponse: + return RolesWithRawResponse(self._accounts.roles) + class AsyncAccountsWithRawResponse: def __init__(self, accounts: AsyncAccounts) -> None: @@ -394,6 +414,10 @@ def __init__(self, accounts: AsyncAccounts) -> None: def members(self) -> AsyncMembersWithRawResponse: return AsyncMembersWithRawResponse(self._accounts.members) + @cached_property + def roles(self) -> AsyncRolesWithRawResponse: + return AsyncRolesWithRawResponse(self._accounts.roles) + class AccountsWithStreamingResponse: def __init__(self, accounts: Accounts) -> None: @@ -413,6 +437,10 @@ def __init__(self, accounts: Accounts) -> None: def members(self) -> MembersWithStreamingResponse: return MembersWithStreamingResponse(self._accounts.members) + @cached_property + def roles(self) -> RolesWithStreamingResponse: + return RolesWithStreamingResponse(self._accounts.roles) + class AsyncAccountsWithStreamingResponse: def __init__(self, accounts: AsyncAccounts) -> None: @@ -431,3 +459,7 @@ def __init__(self, accounts: AsyncAccounts) -> None: @cached_property def members(self) -> AsyncMembersWithStreamingResponse: return AsyncMembersWithStreamingResponse(self._accounts.members) + + @cached_property + def roles(self) -> AsyncRolesWithStreamingResponse: + return AsyncRolesWithStreamingResponse(self._accounts.roles) diff --git a/src/cloudflare/resources/roles.py b/src/cloudflare/resources/accounts/roles.py similarity index 96% rename from src/cloudflare/resources/roles.py rename to src/cloudflare/resources/accounts/roles.py index 1d00cf0dab2..c6753e106c5 100644 --- a/src/cloudflare/resources/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -6,20 +6,20 @@ import httpx -from ..types import RoleGetResponse, RoleListResponse -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( +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 ( +from ..._wrappers import ResultWrapper +from ..._base_client import ( make_request_options, ) +from ...types.accounts import RoleGetResponse, RoleListResponse __all__ = ["Roles", "AsyncRoles"] diff --git a/src/cloudflare/resources/dcv_delegation/__init__.py b/src/cloudflare/resources/dcv_delegation/__init__.py index 4294c7a985e..e8124345cf6 100644 --- a/src/cloudflare/resources/dcv_delegation/__init__.py +++ b/src/cloudflare/resources/dcv_delegation/__init__.py @@ -9,12 +9,12 @@ AsyncUUIDWithStreamingResponse, ) from .dcv_delegation import ( - DcvDelegation, - AsyncDcvDelegation, - DcvDelegationWithRawResponse, - AsyncDcvDelegationWithRawResponse, - DcvDelegationWithStreamingResponse, - AsyncDcvDelegationWithStreamingResponse, + DCVDelegation, + AsyncDCVDelegation, + DCVDelegationWithRawResponse, + AsyncDCVDelegationWithRawResponse, + DCVDelegationWithStreamingResponse, + AsyncDCVDelegationWithStreamingResponse, ) __all__ = [ @@ -24,10 +24,10 @@ "AsyncUUIDWithRawResponse", "UUIDWithStreamingResponse", "AsyncUUIDWithStreamingResponse", - "DcvDelegation", - "AsyncDcvDelegation", - "DcvDelegationWithRawResponse", - "AsyncDcvDelegationWithRawResponse", - "DcvDelegationWithStreamingResponse", - "AsyncDcvDelegationWithStreamingResponse", + "DCVDelegation", + "AsyncDCVDelegation", + "DCVDelegationWithRawResponse", + "AsyncDCVDelegationWithRawResponse", + "DCVDelegationWithStreamingResponse", + "AsyncDCVDelegationWithStreamingResponse", ] diff --git a/src/cloudflare/resources/dcv_delegation/dcv_delegation.py b/src/cloudflare/resources/dcv_delegation/dcv_delegation.py index 1c1f8562c58..56eeaab5ad1 100644 --- a/src/cloudflare/resources/dcv_delegation/dcv_delegation.py +++ b/src/cloudflare/resources/dcv_delegation/dcv_delegation.py @@ -13,39 +13,39 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -__all__ = ["DcvDelegation", "AsyncDcvDelegation"] +__all__ = ["DCVDelegation", "AsyncDCVDelegation"] -class DcvDelegation(SyncAPIResource): +class DCVDelegation(SyncAPIResource): @cached_property def uuid(self) -> UUID: return UUID(self._client) @cached_property - def with_raw_response(self) -> DcvDelegationWithRawResponse: - return DcvDelegationWithRawResponse(self) + def with_raw_response(self) -> DCVDelegationWithRawResponse: + return DCVDelegationWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DcvDelegationWithStreamingResponse: - return DcvDelegationWithStreamingResponse(self) + def with_streaming_response(self) -> DCVDelegationWithStreamingResponse: + return DCVDelegationWithStreamingResponse(self) -class AsyncDcvDelegation(AsyncAPIResource): +class AsyncDCVDelegation(AsyncAPIResource): @cached_property def uuid(self) -> AsyncUUID: return AsyncUUID(self._client) @cached_property - def with_raw_response(self) -> AsyncDcvDelegationWithRawResponse: - return AsyncDcvDelegationWithRawResponse(self) + def with_raw_response(self) -> AsyncDCVDelegationWithRawResponse: + return AsyncDCVDelegationWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDcvDelegationWithStreamingResponse: - return AsyncDcvDelegationWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDCVDelegationWithStreamingResponse: + return AsyncDCVDelegationWithStreamingResponse(self) -class DcvDelegationWithRawResponse: - def __init__(self, dcv_delegation: DcvDelegation) -> None: +class DCVDelegationWithRawResponse: + def __init__(self, dcv_delegation: DCVDelegation) -> None: self._dcv_delegation = dcv_delegation @cached_property @@ -53,8 +53,8 @@ def uuid(self) -> UUIDWithRawResponse: return UUIDWithRawResponse(self._dcv_delegation.uuid) -class AsyncDcvDelegationWithRawResponse: - def __init__(self, dcv_delegation: AsyncDcvDelegation) -> None: +class AsyncDCVDelegationWithRawResponse: + def __init__(self, dcv_delegation: AsyncDCVDelegation) -> None: self._dcv_delegation = dcv_delegation @cached_property @@ -62,8 +62,8 @@ def uuid(self) -> AsyncUUIDWithRawResponse: return AsyncUUIDWithRawResponse(self._dcv_delegation.uuid) -class DcvDelegationWithStreamingResponse: - def __init__(self, dcv_delegation: DcvDelegation) -> None: +class DCVDelegationWithStreamingResponse: + def __init__(self, dcv_delegation: DCVDelegation) -> None: self._dcv_delegation = dcv_delegation @cached_property @@ -71,8 +71,8 @@ def uuid(self) -> UUIDWithStreamingResponse: return UUIDWithStreamingResponse(self._dcv_delegation.uuid) -class AsyncDcvDelegationWithStreamingResponse: - def __init__(self, dcv_delegation: AsyncDcvDelegation) -> None: +class AsyncDCVDelegationWithStreamingResponse: + def __init__(self, dcv_delegation: AsyncDCVDelegation) -> None: self._dcv_delegation = dcv_delegation @cached_property diff --git a/src/cloudflare/resources/radar/__init__.py b/src/cloudflare/resources/radar/__init__.py index c0d502e727f..f963a2fb11d 100644 --- a/src/cloudflare/resources/radar/__init__.py +++ b/src/cloudflare/resources/radar/__init__.py @@ -25,12 +25,12 @@ AsyncHTTPWithStreamingResponse, ) from .as112 import ( - As112, - AsyncAs112, - As112WithRawResponse, - AsyncAs112WithRawResponse, - As112WithStreamingResponse, - AsyncAs112WithStreamingResponse, + AS112, + AsyncAS112, + AS112WithRawResponse, + AsyncAS112WithRawResponse, + AS112WithStreamingResponse, + AsyncAS112WithStreamingResponse, ) from .email import ( Email, @@ -180,12 +180,12 @@ "AsyncVerifiedBotsWithRawResponse", "VerifiedBotsWithStreamingResponse", "AsyncVerifiedBotsWithStreamingResponse", - "As112", - "AsyncAs112", - "As112WithRawResponse", - "AsyncAs112WithRawResponse", - "As112WithStreamingResponse", - "AsyncAs112WithStreamingResponse", + "AS112", + "AsyncAS112", + "AS112WithRawResponse", + "AsyncAS112WithRawResponse", + "AS112WithStreamingResponse", + "AsyncAS112WithStreamingResponse", "ConnectionTampering", "AsyncConnectionTampering", "ConnectionTamperingWithRawResponse", diff --git a/src/cloudflare/resources/radar/as112/__init__.py b/src/cloudflare/resources/radar/as112/__init__.py index b8df1130ffc..24a0babf872 100644 --- a/src/cloudflare/resources/radar/as112/__init__.py +++ b/src/cloudflare/resources/radar/as112/__init__.py @@ -9,12 +9,12 @@ AsyncTopWithStreamingResponse, ) from .as112 import ( - As112, - AsyncAs112, - As112WithRawResponse, - AsyncAs112WithRawResponse, - As112WithStreamingResponse, - AsyncAs112WithStreamingResponse, + AS112, + AsyncAS112, + AS112WithRawResponse, + AsyncAS112WithRawResponse, + AS112WithStreamingResponse, + AsyncAS112WithStreamingResponse, ) from .summary import ( Summary, @@ -52,10 +52,10 @@ "AsyncTopWithRawResponse", "TopWithStreamingResponse", "AsyncTopWithStreamingResponse", - "As112", - "AsyncAs112", - "As112WithRawResponse", - "AsyncAs112WithRawResponse", - "As112WithStreamingResponse", - "AsyncAs112WithStreamingResponse", + "AS112", + "AsyncAS112", + "AS112WithRawResponse", + "AsyncAS112WithRawResponse", + "AS112WithStreamingResponse", + "AsyncAS112WithStreamingResponse", ] diff --git a/src/cloudflare/resources/radar/as112/as112.py b/src/cloudflare/resources/radar/as112/as112.py index 91b42237ee7..b8b675862a8 100644 --- a/src/cloudflare/resources/radar/as112/as112.py +++ b/src/cloudflare/resources/radar/as112/as112.py @@ -35,7 +35,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.radar import As112TimeseriesResponse, as112_timeseries_params +from ....types.radar import AS112TimeseriesResponse, as112_timeseries_params from ...._base_client import ( make_request_options, ) @@ -48,10 +48,10 @@ AsyncTimeseriesGroupsWithStreamingResponse, ) -__all__ = ["As112", "AsyncAs112"] +__all__ = ["AS112", "AsyncAS112"] -class As112(SyncAPIResource): +class AS112(SyncAPIResource): @cached_property def summary(self) -> Summary: return Summary(self._client) @@ -65,12 +65,12 @@ def top(self) -> Top: return Top(self._client) @cached_property - def with_raw_response(self) -> As112WithRawResponse: - return As112WithRawResponse(self) + def with_raw_response(self) -> AS112WithRawResponse: + return AS112WithRawResponse(self) @cached_property - def with_streaming_response(self) -> As112WithStreamingResponse: - return As112WithStreamingResponse(self) + def with_streaming_response(self) -> AS112WithStreamingResponse: + return AS112WithStreamingResponse(self) def timeseries( self, @@ -109,7 +109,7 @@ def timeseries( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> As112TimeseriesResponse: + ) -> AS112TimeseriesResponse: """ Get AS112 queries change over time. @@ -169,15 +169,15 @@ def timeseries( "location": location, "name": name, }, - as112_timeseries_params.As112TimeseriesParams, + as112_timeseries_params.AS112TimeseriesParams, ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[As112TimeseriesResponse], ResultWrapper[As112TimeseriesResponse]), + cast_to=cast(Type[AS112TimeseriesResponse], ResultWrapper[AS112TimeseriesResponse]), ) -class AsyncAs112(AsyncAPIResource): +class AsyncAS112(AsyncAPIResource): @cached_property def summary(self) -> AsyncSummary: return AsyncSummary(self._client) @@ -191,12 +191,12 @@ def top(self) -> AsyncTop: return AsyncTop(self._client) @cached_property - def with_raw_response(self) -> AsyncAs112WithRawResponse: - return AsyncAs112WithRawResponse(self) + def with_raw_response(self) -> AsyncAS112WithRawResponse: + return AsyncAS112WithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAs112WithStreamingResponse: - return AsyncAs112WithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAS112WithStreamingResponse: + return AsyncAS112WithStreamingResponse(self) async def timeseries( self, @@ -235,7 +235,7 @@ async def timeseries( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> As112TimeseriesResponse: + ) -> AS112TimeseriesResponse: """ Get AS112 queries change over time. @@ -295,16 +295,16 @@ async def timeseries( "location": location, "name": name, }, - as112_timeseries_params.As112TimeseriesParams, + as112_timeseries_params.AS112TimeseriesParams, ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[As112TimeseriesResponse], ResultWrapper[As112TimeseriesResponse]), + cast_to=cast(Type[AS112TimeseriesResponse], ResultWrapper[AS112TimeseriesResponse]), ) -class As112WithRawResponse: - def __init__(self, as112: As112) -> None: +class AS112WithRawResponse: + def __init__(self, as112: AS112) -> None: self._as112 = as112 self.timeseries = to_raw_response_wrapper( @@ -324,8 +324,8 @@ def top(self) -> TopWithRawResponse: return TopWithRawResponse(self._as112.top) -class AsyncAs112WithRawResponse: - def __init__(self, as112: AsyncAs112) -> None: +class AsyncAS112WithRawResponse: + def __init__(self, as112: AsyncAS112) -> None: self._as112 = as112 self.timeseries = async_to_raw_response_wrapper( @@ -345,8 +345,8 @@ def top(self) -> AsyncTopWithRawResponse: return AsyncTopWithRawResponse(self._as112.top) -class As112WithStreamingResponse: - def __init__(self, as112: As112) -> None: +class AS112WithStreamingResponse: + def __init__(self, as112: AS112) -> None: self._as112 = as112 self.timeseries = to_streamed_response_wrapper( @@ -366,8 +366,8 @@ def top(self) -> TopWithStreamingResponse: return TopWithStreamingResponse(self._as112.top) -class AsyncAs112WithStreamingResponse: - def __init__(self, as112: AsyncAs112) -> None: +class AsyncAS112WithStreamingResponse: + def __init__(self, as112: AsyncAS112) -> None: self._as112 = as112 self.timeseries = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/radar/radar.py b/src/cloudflare/resources/radar/radar.py index 3c33df8f76e..e2ff51b4596 100644 --- a/src/cloudflare/resources/radar/radar.py +++ b/src/cloudflare/resources/radar/radar.py @@ -27,12 +27,12 @@ AsyncHTTPWithStreamingResponse, ) from .as112 import ( - As112, - AsyncAs112, - As112WithRawResponse, - AsyncAs112WithRawResponse, - As112WithStreamingResponse, - AsyncAs112WithStreamingResponse, + AS112, + AsyncAS112, + AS112WithRawResponse, + AsyncAS112WithRawResponse, + AS112WithStreamingResponse, + AsyncAS112WithStreamingResponse, ) from .email import ( Email, @@ -111,7 +111,7 @@ AnnotationsWithStreamingResponse, AsyncAnnotationsWithStreamingResponse, ) -from .as112.as112 import As112, AsyncAs112 +from .as112.as112 import AS112, AsyncAS112 from .email.email import Email, AsyncEmail from .verified_bots import ( VerifiedBots, @@ -179,8 +179,8 @@ def verified_bots(self) -> VerifiedBots: return VerifiedBots(self._client) @cached_property - def as112(self) -> As112: - return As112(self._client) + def as112(self) -> AS112: + return AS112(self._client) @cached_property def connection_tampering(self) -> ConnectionTampering: @@ -253,8 +253,8 @@ def verified_bots(self) -> AsyncVerifiedBots: return AsyncVerifiedBots(self._client) @cached_property - def as112(self) -> AsyncAs112: - return AsyncAs112(self._client) + def as112(self) -> AsyncAS112: + return AsyncAS112(self._client) @cached_property def connection_tampering(self) -> AsyncConnectionTampering: @@ -330,8 +330,8 @@ def verified_bots(self) -> VerifiedBotsWithRawResponse: return VerifiedBotsWithRawResponse(self._radar.verified_bots) @cached_property - def as112(self) -> As112WithRawResponse: - return As112WithRawResponse(self._radar.as112) + def as112(self) -> AS112WithRawResponse: + return AS112WithRawResponse(self._radar.as112) @cached_property def connection_tampering(self) -> ConnectionTamperingWithRawResponse: @@ -399,8 +399,8 @@ def verified_bots(self) -> AsyncVerifiedBotsWithRawResponse: return AsyncVerifiedBotsWithRawResponse(self._radar.verified_bots) @cached_property - def as112(self) -> AsyncAs112WithRawResponse: - return AsyncAs112WithRawResponse(self._radar.as112) + def as112(self) -> AsyncAS112WithRawResponse: + return AsyncAS112WithRawResponse(self._radar.as112) @cached_property def connection_tampering(self) -> AsyncConnectionTamperingWithRawResponse: @@ -468,8 +468,8 @@ def verified_bots(self) -> VerifiedBotsWithStreamingResponse: return VerifiedBotsWithStreamingResponse(self._radar.verified_bots) @cached_property - def as112(self) -> As112WithStreamingResponse: - return As112WithStreamingResponse(self._radar.as112) + def as112(self) -> AS112WithStreamingResponse: + return AS112WithStreamingResponse(self._radar.as112) @cached_property def connection_tampering(self) -> ConnectionTamperingWithStreamingResponse: @@ -537,8 +537,8 @@ def verified_bots(self) -> AsyncVerifiedBotsWithStreamingResponse: return AsyncVerifiedBotsWithStreamingResponse(self._radar.verified_bots) @cached_property - def as112(self) -> AsyncAs112WithStreamingResponse: - return AsyncAs112WithStreamingResponse(self._radar.as112) + def as112(self) -> AsyncAS112WithStreamingResponse: + return AsyncAS112WithStreamingResponse(self._radar.as112) @cached_property def connection_tampering(self) -> AsyncConnectionTamperingWithStreamingResponse: diff --git a/src/cloudflare/resources/snippets/__init__.py b/src/cloudflare/resources/snippets/__init__.py index 30e93e2c505..b2f2259f5a2 100644 --- a/src/cloudflare/resources/snippets/__init__.py +++ b/src/cloudflare/resources/snippets/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. +from .rules import ( + Rules, + AsyncRules, + RulesWithRawResponse, + AsyncRulesWithRawResponse, + RulesWithStreamingResponse, + AsyncRulesWithStreamingResponse, +) from .content import ( Content, AsyncContent, @@ -16,14 +24,6 @@ SnippetsWithStreamingResponse, AsyncSnippetsWithStreamingResponse, ) -from .snippet_rules import ( - SnippetRules, - AsyncSnippetRules, - SnippetRulesWithRawResponse, - AsyncSnippetRulesWithRawResponse, - SnippetRulesWithStreamingResponse, - AsyncSnippetRulesWithStreamingResponse, -) __all__ = [ "Content", @@ -32,12 +32,12 @@ "AsyncContentWithRawResponse", "ContentWithStreamingResponse", "AsyncContentWithStreamingResponse", - "SnippetRules", - "AsyncSnippetRules", - "SnippetRulesWithRawResponse", - "AsyncSnippetRulesWithRawResponse", - "SnippetRulesWithStreamingResponse", - "AsyncSnippetRulesWithStreamingResponse", + "Rules", + "AsyncRules", + "RulesWithRawResponse", + "AsyncRulesWithRawResponse", + "RulesWithStreamingResponse", + "AsyncRulesWithStreamingResponse", "Snippets", "AsyncSnippets", "SnippetsWithRawResponse", diff --git a/src/cloudflare/resources/snippets/snippet_rules.py b/src/cloudflare/resources/snippets/rules.py similarity index 73% rename from src/cloudflare/resources/snippets/snippet_rules.py rename to src/cloudflare/resources/snippets/rules.py index 7afb4e6ebda..20581384b2c 100644 --- a/src/cloudflare/resources/snippets/snippet_rules.py +++ b/src/cloudflare/resources/snippets/rules.py @@ -20,32 +20,32 @@ from ..._base_client import ( make_request_options, ) -from ...types.snippets import SnippetRuleListResponse, SnippetRuleUpdateResponse, snippet_rule_update_params +from ...types.snippets import RuleListResponse, RuleUpdateResponse, rule_update_params -__all__ = ["SnippetRules", "AsyncSnippetRules"] +__all__ = ["Rules", "AsyncRules"] -class SnippetRules(SyncAPIResource): +class Rules(SyncAPIResource): @cached_property - def with_raw_response(self) -> SnippetRulesWithRawResponse: - return SnippetRulesWithRawResponse(self) + def with_raw_response(self) -> RulesWithRawResponse: + return RulesWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SnippetRulesWithStreamingResponse: - return SnippetRulesWithStreamingResponse(self) + def with_streaming_response(self) -> RulesWithStreamingResponse: + return RulesWithStreamingResponse(self) def update( self, zone_identifier: str, *, - rules: Iterable[snippet_rule_update_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[rule_update_params.Rule] | 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, - ) -> SnippetRuleUpdateResponse: + ) -> RuleUpdateResponse: """ Put Rules @@ -66,7 +66,7 @@ def update( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._put( f"/zones/{zone_identifier}/snippets/snippet_rules", - body=maybe_transform({"rules": rules}, snippet_rule_update_params.SnippetRuleUpdateParams), + body=maybe_transform({"rules": rules}, rule_update_params.RuleUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -74,7 +74,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SnippetRuleUpdateResponse], ResultWrapper[SnippetRuleUpdateResponse]), + cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), ) def list( @@ -87,7 +87,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SnippetRuleListResponse: + ) -> RuleListResponse: """ Rules @@ -113,31 +113,31 @@ def list( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SnippetRuleListResponse], ResultWrapper[SnippetRuleListResponse]), + cast_to=cast(Type[RuleListResponse], ResultWrapper[RuleListResponse]), ) -class AsyncSnippetRules(AsyncAPIResource): +class AsyncRules(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSnippetRulesWithRawResponse: - return AsyncSnippetRulesWithRawResponse(self) + def with_raw_response(self) -> AsyncRulesWithRawResponse: + return AsyncRulesWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSnippetRulesWithStreamingResponse: - return AsyncSnippetRulesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: + return AsyncRulesWithStreamingResponse(self) async def update( self, zone_identifier: str, *, - rules: Iterable[snippet_rule_update_params.Rule] | NotGiven = NOT_GIVEN, + rules: Iterable[rule_update_params.Rule] | 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, - ) -> SnippetRuleUpdateResponse: + ) -> RuleUpdateResponse: """ Put Rules @@ -158,7 +158,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return await self._put( f"/zones/{zone_identifier}/snippets/snippet_rules", - body=maybe_transform({"rules": rules}, snippet_rule_update_params.SnippetRuleUpdateParams), + body=maybe_transform({"rules": rules}, rule_update_params.RuleUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -166,7 +166,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SnippetRuleUpdateResponse], ResultWrapper[SnippetRuleUpdateResponse]), + cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), ) async def list( @@ -179,7 +179,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SnippetRuleListResponse: + ) -> RuleListResponse: """ Rules @@ -205,53 +205,53 @@ async def list( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SnippetRuleListResponse], ResultWrapper[SnippetRuleListResponse]), + cast_to=cast(Type[RuleListResponse], ResultWrapper[RuleListResponse]), ) -class SnippetRulesWithRawResponse: - def __init__(self, snippet_rules: SnippetRules) -> None: - self._snippet_rules = snippet_rules +class RulesWithRawResponse: + def __init__(self, rules: Rules) -> None: + self._rules = rules self.update = to_raw_response_wrapper( - snippet_rules.update, + rules.update, ) self.list = to_raw_response_wrapper( - snippet_rules.list, + rules.list, ) -class AsyncSnippetRulesWithRawResponse: - def __init__(self, snippet_rules: AsyncSnippetRules) -> None: - self._snippet_rules = snippet_rules +class AsyncRulesWithRawResponse: + def __init__(self, rules: AsyncRules) -> None: + self._rules = rules self.update = async_to_raw_response_wrapper( - snippet_rules.update, + rules.update, ) self.list = async_to_raw_response_wrapper( - snippet_rules.list, + rules.list, ) -class SnippetRulesWithStreamingResponse: - def __init__(self, snippet_rules: SnippetRules) -> None: - self._snippet_rules = snippet_rules +class RulesWithStreamingResponse: + def __init__(self, rules: Rules) -> None: + self._rules = rules self.update = to_streamed_response_wrapper( - snippet_rules.update, + rules.update, ) self.list = to_streamed_response_wrapper( - snippet_rules.list, + rules.list, ) -class AsyncSnippetRulesWithStreamingResponse: - def __init__(self, snippet_rules: AsyncSnippetRules) -> None: - self._snippet_rules = snippet_rules +class AsyncRulesWithStreamingResponse: + def __init__(self, rules: AsyncRules) -> None: + self._rules = rules self.update = async_to_streamed_response_wrapper( - snippet_rules.update, + rules.update, ) self.list = async_to_streamed_response_wrapper( - snippet_rules.list, + rules.list, ) diff --git a/src/cloudflare/resources/snippets/snippets.py b/src/cloudflare/resources/snippets/snippets.py index 8b22e200ed5..d9a37cb25f4 100644 --- a/src/cloudflare/resources/snippets/snippets.py +++ b/src/cloudflare/resources/snippets/snippets.py @@ -6,6 +6,14 @@ import httpx +from .rules import ( + Rules, + AsyncRules, + RulesWithRawResponse, + AsyncRulesWithRawResponse, + RulesWithStreamingResponse, + AsyncRulesWithStreamingResponse, +) from ...types import ( SnippetGetResponse, SnippetListResponse, @@ -32,14 +40,6 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from .snippet_rules import ( - SnippetRules, - AsyncSnippetRules, - SnippetRulesWithRawResponse, - AsyncSnippetRulesWithRawResponse, - SnippetRulesWithStreamingResponse, - AsyncSnippetRulesWithStreamingResponse, -) from ..._base_client import ( make_request_options, ) @@ -53,8 +53,8 @@ def content(self) -> Content: return Content(self._client) @cached_property - def snippet_rules(self) -> SnippetRules: - return SnippetRules(self._client) + def rules(self) -> Rules: + return Rules(self._client) @cached_property def with_raw_response(self) -> SnippetsWithRawResponse: @@ -258,8 +258,8 @@ def content(self) -> AsyncContent: return AsyncContent(self._client) @cached_property - def snippet_rules(self) -> AsyncSnippetRules: - return AsyncSnippetRules(self._client) + def rules(self) -> AsyncRules: + return AsyncRules(self._client) @cached_property def with_raw_response(self) -> AsyncSnippetsWithRawResponse: @@ -479,8 +479,8 @@ def content(self) -> ContentWithRawResponse: return ContentWithRawResponse(self._snippets.content) @cached_property - def snippet_rules(self) -> SnippetRulesWithRawResponse: - return SnippetRulesWithRawResponse(self._snippets.snippet_rules) + def rules(self) -> RulesWithRawResponse: + return RulesWithRawResponse(self._snippets.rules) class AsyncSnippetsWithRawResponse: @@ -505,8 +505,8 @@ def content(self) -> AsyncContentWithRawResponse: return AsyncContentWithRawResponse(self._snippets.content) @cached_property - def snippet_rules(self) -> AsyncSnippetRulesWithRawResponse: - return AsyncSnippetRulesWithRawResponse(self._snippets.snippet_rules) + def rules(self) -> AsyncRulesWithRawResponse: + return AsyncRulesWithRawResponse(self._snippets.rules) class SnippetsWithStreamingResponse: @@ -531,8 +531,8 @@ def content(self) -> ContentWithStreamingResponse: return ContentWithStreamingResponse(self._snippets.content) @cached_property - def snippet_rules(self) -> SnippetRulesWithStreamingResponse: - return SnippetRulesWithStreamingResponse(self._snippets.snippet_rules) + def rules(self) -> RulesWithStreamingResponse: + return RulesWithStreamingResponse(self._snippets.rules) class AsyncSnippetsWithStreamingResponse: @@ -557,5 +557,5 @@ def content(self) -> AsyncContentWithStreamingResponse: return AsyncContentWithStreamingResponse(self._snippets.content) @cached_property - def snippet_rules(self) -> AsyncSnippetRulesWithStreamingResponse: - return AsyncSnippetRulesWithStreamingResponse(self._snippets.snippet_rules) + def rules(self) -> AsyncRulesWithStreamingResponse: + return AsyncRulesWithStreamingResponse(self._snippets.rules) diff --git a/src/cloudflare/resources/url_normalizations.py b/src/cloudflare/resources/url_normalization.py similarity index 81% rename from src/cloudflare/resources/url_normalizations.py rename to src/cloudflare/resources/url_normalization.py index 908b8519f20..6a73c1c0fe5 100644 --- a/src/cloudflare/resources/url_normalizations.py +++ b/src/cloudflare/resources/url_normalization.py @@ -23,17 +23,17 @@ make_request_options, ) -__all__ = ["URLNormalizations", "AsyncURLNormalizations"] +__all__ = ["URLNormalization", "AsyncURLNormalization"] -class URLNormalizations(SyncAPIResource): +class URLNormalization(SyncAPIResource): @cached_property - def with_raw_response(self) -> URLNormalizationsWithRawResponse: - return URLNormalizationsWithRawResponse(self) + def with_raw_response(self) -> URLNormalizationWithRawResponse: + return URLNormalizationWithRawResponse(self) @cached_property - def with_streaming_response(self) -> URLNormalizationsWithStreamingResponse: - return URLNormalizationsWithStreamingResponse(self) + def with_streaming_response(self) -> URLNormalizationWithStreamingResponse: + return URLNormalizationWithStreamingResponse(self) def update( self, @@ -119,14 +119,14 @@ def get( ) -class AsyncURLNormalizations(AsyncAPIResource): +class AsyncURLNormalization(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncURLNormalizationsWithRawResponse: - return AsyncURLNormalizationsWithRawResponse(self) + def with_raw_response(self) -> AsyncURLNormalizationWithRawResponse: + return AsyncURLNormalizationWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncURLNormalizationsWithStreamingResponse: - return AsyncURLNormalizationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncURLNormalizationWithStreamingResponse: + return AsyncURLNormalizationWithStreamingResponse(self) async def update( self, @@ -212,49 +212,49 @@ async def get( ) -class URLNormalizationsWithRawResponse: - def __init__(self, url_normalizations: URLNormalizations) -> None: - self._url_normalizations = url_normalizations +class URLNormalizationWithRawResponse: + def __init__(self, url_normalization: URLNormalization) -> None: + self._url_normalization = url_normalization self.update = to_raw_response_wrapper( - url_normalizations.update, + url_normalization.update, ) self.get = to_raw_response_wrapper( - url_normalizations.get, + url_normalization.get, ) -class AsyncURLNormalizationsWithRawResponse: - def __init__(self, url_normalizations: AsyncURLNormalizations) -> None: - self._url_normalizations = url_normalizations +class AsyncURLNormalizationWithRawResponse: + def __init__(self, url_normalization: AsyncURLNormalization) -> None: + self._url_normalization = url_normalization self.update = async_to_raw_response_wrapper( - url_normalizations.update, + url_normalization.update, ) self.get = async_to_raw_response_wrapper( - url_normalizations.get, + url_normalization.get, ) -class URLNormalizationsWithStreamingResponse: - def __init__(self, url_normalizations: URLNormalizations) -> None: - self._url_normalizations = url_normalizations +class URLNormalizationWithStreamingResponse: + def __init__(self, url_normalization: URLNormalization) -> None: + self._url_normalization = url_normalization self.update = to_streamed_response_wrapper( - url_normalizations.update, + url_normalization.update, ) self.get = to_streamed_response_wrapper( - url_normalizations.get, + url_normalization.get, ) -class AsyncURLNormalizationsWithStreamingResponse: - def __init__(self, url_normalizations: AsyncURLNormalizations) -> None: - self._url_normalizations = url_normalizations +class AsyncURLNormalizationWithStreamingResponse: + def __init__(self, url_normalization: AsyncURLNormalization) -> None: + self._url_normalization = url_normalization self.update = async_to_streamed_response_wrapper( - url_normalizations.update, + url_normalization.update, ) self.get = async_to_streamed_response_wrapper( - url_normalizations.get, + url_normalization.get, ) diff --git a/src/cloudflare/resources/workers/__init__.py b/src/cloudflare/resources/workers/__init__.py index a24d3b0fe33..bee5460feee 100644 --- a/src/cloudflare/resources/workers/__init__.py +++ b/src/cloudflare/resources/workers/__init__.py @@ -48,14 +48,6 @@ WorkersWithStreamingResponse, AsyncWorkersWithStreamingResponse, ) -from .dispatch import ( - Dispatch, - AsyncDispatch, - DispatchWithRawResponse, - AsyncDispatchWithRawResponse, - DispatchWithStreamingResponse, - AsyncDispatchWithStreamingResponse, -) from .services import ( Services, AsyncServices, @@ -90,12 +82,6 @@ ) __all__ = [ - "Dispatch", - "AsyncDispatch", - "DispatchWithRawResponse", - "AsyncDispatchWithRawResponse", - "DispatchWithStreamingResponse", - "AsyncDispatchWithStreamingResponse", "AI", "AsyncAI", "AIWithRawResponse", diff --git a/src/cloudflare/resources/workers/dispatch/__init__.py b/src/cloudflare/resources/workers/dispatch/__init__.py deleted file mode 100644 index 201c7a1a42a..00000000000 --- a/src/cloudflare/resources/workers/dispatch/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from .dispatch import ( - Dispatch, - AsyncDispatch, - DispatchWithRawResponse, - AsyncDispatchWithRawResponse, - DispatchWithStreamingResponse, - AsyncDispatchWithStreamingResponse, -) -from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, -) - -__all__ = [ - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", - "Dispatch", - "AsyncDispatch", - "DispatchWithRawResponse", - "AsyncDispatchWithRawResponse", - "DispatchWithStreamingResponse", - "AsyncDispatchWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/dispatch/dispatch.py b/src/cloudflare/resources/workers/dispatch/dispatch.py deleted file mode 100644 index 557802d79d8..00000000000 --- a/src/cloudflare/resources/workers/dispatch/dispatch.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from ...._compat import cached_property -from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, -) -from ...._resource import SyncAPIResource, AsyncAPIResource -from .namespaces.namespaces import Namespaces, AsyncNamespaces - -__all__ = ["Dispatch", "AsyncDispatch"] - - -class Dispatch(SyncAPIResource): - @cached_property - def namespaces(self) -> Namespaces: - return Namespaces(self._client) - - @cached_property - def with_raw_response(self) -> DispatchWithRawResponse: - return DispatchWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DispatchWithStreamingResponse: - return DispatchWithStreamingResponse(self) - - -class AsyncDispatch(AsyncAPIResource): - @cached_property - def namespaces(self) -> AsyncNamespaces: - return AsyncNamespaces(self._client) - - @cached_property - def with_raw_response(self) -> AsyncDispatchWithRawResponse: - return AsyncDispatchWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDispatchWithStreamingResponse: - return AsyncDispatchWithStreamingResponse(self) - - -class DispatchWithRawResponse: - def __init__(self, dispatch: Dispatch) -> None: - self._dispatch = dispatch - - @cached_property - def namespaces(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self._dispatch.namespaces) - - -class AsyncDispatchWithRawResponse: - def __init__(self, dispatch: AsyncDispatch) -> None: - self._dispatch = dispatch - - @cached_property - def namespaces(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self._dispatch.namespaces) - - -class DispatchWithStreamingResponse: - def __init__(self, dispatch: Dispatch) -> None: - self._dispatch = dispatch - - @cached_property - def namespaces(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self._dispatch.namespaces) - - -class AsyncDispatchWithStreamingResponse: - def __init__(self, dispatch: AsyncDispatch) -> None: - self._dispatch = dispatch - - @cached_property - def namespaces(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self._dispatch.namespaces) diff --git a/src/cloudflare/resources/workers/dispatch/namespaces/__init__.py b/src/cloudflare/resources/workers/dispatch/namespaces/__init__.py deleted file mode 100644 index 5ee6d6e955a..00000000000 --- a/src/cloudflare/resources/workers/dispatch/namespaces/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, -) -from .namespaces import ( - Namespaces, - AsyncNamespaces, - NamespacesWithRawResponse, - AsyncNamespacesWithRawResponse, - NamespacesWithStreamingResponse, - AsyncNamespacesWithStreamingResponse, -) - -__all__ = [ - "Scripts", - "AsyncScripts", - "ScriptsWithRawResponse", - "AsyncScriptsWithRawResponse", - "ScriptsWithStreamingResponse", - "AsyncScriptsWithStreamingResponse", - "Namespaces", - "AsyncNamespaces", - "NamespacesWithRawResponse", - "AsyncNamespacesWithRawResponse", - "NamespacesWithStreamingResponse", - "AsyncNamespacesWithStreamingResponse", -] diff --git a/src/cloudflare/resources/workers/dispatch/namespaces/namespaces.py b/src/cloudflare/resources/workers/dispatch/namespaces/namespaces.py deleted file mode 100644 index b04722ff1cf..00000000000 --- a/src/cloudflare/resources/workers/dispatch/namespaces/namespaces.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from .scripts import ( - Scripts, - AsyncScripts, - ScriptsWithRawResponse, - AsyncScriptsWithRawResponse, - ScriptsWithStreamingResponse, - AsyncScriptsWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Namespaces", "AsyncNamespaces"] - - -class Namespaces(SyncAPIResource): - @cached_property - def scripts(self) -> Scripts: - return Scripts(self._client) - - @cached_property - def with_raw_response(self) -> NamespacesWithRawResponse: - return NamespacesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> NamespacesWithStreamingResponse: - return NamespacesWithStreamingResponse(self) - - -class AsyncNamespaces(AsyncAPIResource): - @cached_property - def scripts(self) -> AsyncScripts: - return AsyncScripts(self._client) - - @cached_property - def with_raw_response(self) -> AsyncNamespacesWithRawResponse: - return AsyncNamespacesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncNamespacesWithStreamingResponse: - return AsyncNamespacesWithStreamingResponse(self) - - -class NamespacesWithRawResponse: - def __init__(self, namespaces: Namespaces) -> None: - self._namespaces = namespaces - - @cached_property - def scripts(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self._namespaces.scripts) - - -class AsyncNamespacesWithRawResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: - self._namespaces = namespaces - - @cached_property - def scripts(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self._namespaces.scripts) - - -class NamespacesWithStreamingResponse: - def __init__(self, namespaces: Namespaces) -> None: - self._namespaces = namespaces - - @cached_property - def scripts(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self._namespaces.scripts) - - -class AsyncNamespacesWithStreamingResponse: - def __init__(self, namespaces: AsyncNamespaces) -> None: - self._namespaces = namespaces - - @cached_property - def scripts(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self._namespaces.scripts) diff --git a/src/cloudflare/resources/workers/dispatch/namespaces/scripts.py b/src/cloudflare/resources/workers/dispatch/namespaces/scripts.py deleted file mode 100644 index 9892a854e7d..00000000000 --- a/src/cloudflare/resources/workers/dispatch/namespaces/scripts.py +++ /dev/null @@ -1,460 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from typing import List, Type, cast - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes -from ....._utils import 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.dispatch.namespaces import ( - ScriptGetResponse, - ScriptUpdateResponse, - script_delete_params, - script_update_params, -) - -__all__ = ["Scripts", "AsyncScripts"] - - -class Scripts(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ScriptsWithRawResponse: - return ScriptsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ScriptsWithStreamingResponse: - return ScriptsWithStreamingResponse(self) - - def update( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - message: str | NotGiven = NOT_GIVEN, - metadata: script_update_params.Metadata | 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, - ) -> ScriptUpdateResponse: - """ - Upload a worker module to a Workers for Platforms namespace. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - script_name: Name of the script, used in URLs and route configuration. - - 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 - and referenced in the metadata as `main_module` or `body_part` by part name. - - message: Rollback message to be associated with this deployment. Only parsed when query - param `"rollback_to"` is present. - - 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 dispatch_namespace: - raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - body=maybe_transform( - { - "any_part_name": any_part_name, - "message": message, - "metadata": metadata, - }, - 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(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]), - ) - - def delete( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - force: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """Delete a worker from a Workers for Platforms namespace. - - This call has no - response body on a successful delete. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - script_name: Name of the script, used in URLs and route configuration. - - force: If set to true, delete will not be stopped by associated service binding, - durable object, or other binding. Any of these associated bindings/durable - objects will be deleted along with the script. - - 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 dispatch_namespace: - raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams), - ), - cast_to=NoneType, - ) - - def get( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: 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, - ) -> ScriptGetResponse: - """ - Fetch information about a script uploaded to a Workers for Platforms namespace. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - 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 dispatch_namespace: - raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - 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[ScriptGetResponse], ResultWrapper[ScriptGetResponse]), - ) - - -class AsyncScripts(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncScriptsWithRawResponse: - return AsyncScriptsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: - return AsyncScriptsWithStreamingResponse(self) - - async def update( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - message: str | NotGiven = NOT_GIVEN, - metadata: script_update_params.Metadata | 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, - ) -> ScriptUpdateResponse: - """ - Upload a worker module to a Workers for Platforms namespace. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - script_name: Name of the script, used in URLs and route configuration. - - 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 - and referenced in the metadata as `main_module` or `body_part` by part name. - - message: Rollback message to be associated with this deployment. Only parsed when query - param `"rollback_to"` is present. - - 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 dispatch_namespace: - raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - body=maybe_transform( - { - "any_part_name": any_part_name, - "message": message, - "metadata": metadata, - }, - 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(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]), - ) - - async def delete( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: str, - force: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """Delete a worker from a Workers for Platforms namespace. - - This call has no - response body on a successful delete. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - script_name: Name of the script, used in URLs and route configuration. - - force: If set to true, delete will not be stopped by associated service binding, - durable object, or other binding. Any of these associated bindings/durable - objects will be deleted along with the script. - - 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 dispatch_namespace: - raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}") - if not script_name: - raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams), - ), - cast_to=NoneType, - ) - - async def get( - self, - script_name: str, - *, - account_id: str, - dispatch_namespace: 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, - ) -> ScriptGetResponse: - """ - Fetch information about a script uploaded to a Workers for Platforms namespace. - - Args: - account_id: Identifier - - dispatch_namespace: Name of the Workers for Platforms dispatch namespace. - - 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 dispatch_namespace: - raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", - 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[ScriptGetResponse], ResultWrapper[ScriptGetResponse]), - ) - - -class ScriptsWithRawResponse: - def __init__(self, scripts: Scripts) -> None: - self._scripts = scripts - - self.update = to_raw_response_wrapper( - scripts.update, - ) - self.delete = to_raw_response_wrapper( - scripts.delete, - ) - self.get = to_raw_response_wrapper( - scripts.get, - ) - - -class AsyncScriptsWithRawResponse: - def __init__(self, scripts: AsyncScripts) -> None: - self._scripts = scripts - - self.update = async_to_raw_response_wrapper( - scripts.update, - ) - self.delete = async_to_raw_response_wrapper( - scripts.delete, - ) - self.get = async_to_raw_response_wrapper( - scripts.get, - ) - - -class ScriptsWithStreamingResponse: - def __init__(self, scripts: Scripts) -> None: - self._scripts = scripts - - self.update = to_streamed_response_wrapper( - scripts.update, - ) - self.delete = to_streamed_response_wrapper( - scripts.delete, - ) - self.get = to_streamed_response_wrapper( - scripts.get, - ) - - -class AsyncScriptsWithStreamingResponse: - def __init__(self, scripts: AsyncScripts) -> None: - self._scripts = scripts - - self.update = async_to_streamed_response_wrapper( - scripts.update, - ) - self.delete = async_to_streamed_response_wrapper( - scripts.delete, - ) - self.get = async_to_streamed_response_wrapper( - scripts.get, - ) diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py index 319108c8373..cfe0d909d35 100644 --- a/src/cloudflare/resources/workers/workers.py +++ b/src/cloudflare/resources/workers/workers.py @@ -42,14 +42,6 @@ ScriptsWithStreamingResponse, AsyncScriptsWithStreamingResponse, ) -from .dispatch import ( - Dispatch, - AsyncDispatch, - DispatchWithRawResponse, - AsyncDispatchWithRawResponse, - DispatchWithStreamingResponse, - AsyncDispatchWithStreamingResponse, -) from .services import ( Services, AsyncServices, @@ -85,7 +77,6 @@ AccountSettingsWithStreamingResponse, AsyncAccountSettingsWithStreamingResponse, ) -from .dispatch.dispatch import Dispatch, AsyncDispatch from .services.services import Services, AsyncServices from .deployments.deployments import Deployments, AsyncDeployments @@ -93,10 +84,6 @@ class Workers(SyncAPIResource): - @cached_property - def dispatch(self) -> Dispatch: - return Dispatch(self._client) - @cached_property def ai(self) -> AI: return AI(self._client) @@ -143,10 +130,6 @@ def with_streaming_response(self) -> WorkersWithStreamingResponse: class AsyncWorkers(AsyncAPIResource): - @cached_property - def dispatch(self) -> AsyncDispatch: - return AsyncDispatch(self._client) - @cached_property def ai(self) -> AsyncAI: return AsyncAI(self._client) @@ -196,10 +179,6 @@ class WorkersWithRawResponse: def __init__(self, workers: Workers) -> None: self._workers = workers - @cached_property - def dispatch(self) -> DispatchWithRawResponse: - return DispatchWithRawResponse(self._workers.dispatch) - @cached_property def ai(self) -> AIWithRawResponse: return AIWithRawResponse(self._workers.ai) @@ -241,10 +220,6 @@ class AsyncWorkersWithRawResponse: def __init__(self, workers: AsyncWorkers) -> None: self._workers = workers - @cached_property - def dispatch(self) -> AsyncDispatchWithRawResponse: - return AsyncDispatchWithRawResponse(self._workers.dispatch) - @cached_property def ai(self) -> AsyncAIWithRawResponse: return AsyncAIWithRawResponse(self._workers.ai) @@ -286,10 +261,6 @@ class WorkersWithStreamingResponse: def __init__(self, workers: Workers) -> None: self._workers = workers - @cached_property - def dispatch(self) -> DispatchWithStreamingResponse: - return DispatchWithStreamingResponse(self._workers.dispatch) - @cached_property def ai(self) -> AIWithStreamingResponse: return AIWithStreamingResponse(self._workers.ai) @@ -331,10 +302,6 @@ class AsyncWorkersWithStreamingResponse: def __init__(self, workers: AsyncWorkers) -> None: self._workers = workers - @cached_property - def dispatch(self) -> AsyncDispatchWithStreamingResponse: - return AsyncDispatchWithStreamingResponse(self._workers.dispatch) - @cached_property def ai(self) -> AsyncAIWithStreamingResponse: return AsyncAIWithStreamingResponse(self._workers.ai) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py index 95c095883db..31d89f7256e 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py @@ -16,22 +16,6 @@ ScriptsWithStreamingResponse, AsyncScriptsWithStreamingResponse, ) -from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) __all__ = [ "Content", @@ -40,18 +24,6 @@ "AsyncContentWithRawResponse", "ContentWithStreamingResponse", "AsyncContentWithStreamingResponse", - "Settings", - "AsyncSettings", - "SettingsWithRawResponse", - "AsyncSettingsWithRawResponse", - "SettingsWithStreamingResponse", - "AsyncSettingsWithStreamingResponse", - "Bindings", - "AsyncBindings", - "BindingsWithRawResponse", - "AsyncBindingsWithRawResponse", - "BindingsWithStreamingResponse", - "AsyncBindingsWithStreamingResponse", "Scripts", "AsyncScripts", "ScriptsWithRawResponse", diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py new file mode 100644 index 00000000000..d12a7d761e2 --- /dev/null +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. + +from .content import ( + Content, + AsyncContent, + ContentWithRawResponse, + AsyncContentWithRawResponse, + ContentWithStreamingResponse, + AsyncContentWithStreamingResponse, +) +from .scripts import ( + Scripts, + AsyncScripts, + ScriptsWithRawResponse, + AsyncScriptsWithRawResponse, + ScriptsWithStreamingResponse, + AsyncScriptsWithStreamingResponse, +) +from .bindings import ( + Bindings, + AsyncBindings, + BindingsWithRawResponse, + AsyncBindingsWithRawResponse, + BindingsWithStreamingResponse, + AsyncBindingsWithStreamingResponse, +) +from .settings import ( + Settings, + AsyncSettings, + SettingsWithRawResponse, + AsyncSettingsWithRawResponse, + SettingsWithStreamingResponse, + AsyncSettingsWithStreamingResponse, +) + +__all__ = [ + "Scripts", + "AsyncScripts", + "ScriptsWithRawResponse", + "AsyncScriptsWithRawResponse", + "ScriptsWithStreamingResponse", + "AsyncScriptsWithStreamingResponse", + "Settings", + "AsyncSettings", + "SettingsWithRawResponse", + "AsyncSettingsWithRawResponse", + "SettingsWithStreamingResponse", + "AsyncSettingsWithStreamingResponse", + "Bindings", + "AsyncBindings", + "BindingsWithRawResponse", + "AsyncBindingsWithRawResponse", + "BindingsWithStreamingResponse", + "AsyncBindingsWithStreamingResponse", + "Content", + "AsyncContent", + "ContentWithRawResponse", + "AsyncContentWithRawResponse", + "ContentWithStreamingResponse", + "AsyncContentWithStreamingResponse", +] diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/bindings.py similarity index 94% rename from src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py rename to src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/bindings.py index 4449d9d2f4a..6b9f05d6d7b 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/bindings.py @@ -6,19 +6,19 @@ import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ......_compat import cached_property -from ......_resource import SyncAPIResource, AsyncAPIResource -from ......_response import ( +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 ......_base_client import ( +from ......._base_client import ( make_request_options, ) -from ......types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse +from .......types.workers_for_platforms.dispatch.namespaces.scripts.content import BindingGetResponse __all__ = ["Bindings", "AsyncBindings"] diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/content.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/content.py new file mode 100644 index 00000000000..66072c9971c --- /dev/null +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/content.py @@ -0,0 +1,144 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from .scripts import ( + Scripts, + AsyncScripts, + ScriptsWithRawResponse, + AsyncScriptsWithRawResponse, + ScriptsWithStreamingResponse, + AsyncScriptsWithStreamingResponse, +) +from .bindings import ( + Bindings, + AsyncBindings, + BindingsWithRawResponse, + AsyncBindingsWithRawResponse, + BindingsWithStreamingResponse, + AsyncBindingsWithStreamingResponse, +) +from .settings import ( + Settings, + AsyncSettings, + SettingsWithRawResponse, + AsyncSettingsWithRawResponse, + SettingsWithStreamingResponse, + AsyncSettingsWithStreamingResponse, +) +from ......._compat import cached_property +from ......._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["Content", "AsyncContent"] + + +class Content(SyncAPIResource): + @cached_property + def scripts(self) -> Scripts: + return Scripts(self._client) + + @cached_property + def settings(self) -> Settings: + return Settings(self._client) + + @cached_property + def bindings(self) -> Bindings: + return Bindings(self._client) + + @cached_property + def with_raw_response(self) -> ContentWithRawResponse: + return ContentWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ContentWithStreamingResponse: + return ContentWithStreamingResponse(self) + + +class AsyncContent(AsyncAPIResource): + @cached_property + def scripts(self) -> AsyncScripts: + return AsyncScripts(self._client) + + @cached_property + def settings(self) -> AsyncSettings: + return AsyncSettings(self._client) + + @cached_property + def bindings(self) -> AsyncBindings: + return AsyncBindings(self._client) + + @cached_property + def with_raw_response(self) -> AsyncContentWithRawResponse: + return AsyncContentWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncContentWithStreamingResponse: + return AsyncContentWithStreamingResponse(self) + + +class ContentWithRawResponse: + def __init__(self, content: Content) -> None: + self._content = content + + @cached_property + def scripts(self) -> ScriptsWithRawResponse: + return ScriptsWithRawResponse(self._content.scripts) + + @cached_property + def settings(self) -> SettingsWithRawResponse: + return SettingsWithRawResponse(self._content.settings) + + @cached_property + def bindings(self) -> BindingsWithRawResponse: + return BindingsWithRawResponse(self._content.bindings) + + +class AsyncContentWithRawResponse: + def __init__(self, content: AsyncContent) -> None: + self._content = content + + @cached_property + def scripts(self) -> AsyncScriptsWithRawResponse: + return AsyncScriptsWithRawResponse(self._content.scripts) + + @cached_property + def settings(self) -> AsyncSettingsWithRawResponse: + return AsyncSettingsWithRawResponse(self._content.settings) + + @cached_property + def bindings(self) -> AsyncBindingsWithRawResponse: + return AsyncBindingsWithRawResponse(self._content.bindings) + + +class ContentWithStreamingResponse: + def __init__(self, content: Content) -> None: + self._content = content + + @cached_property + def scripts(self) -> ScriptsWithStreamingResponse: + return ScriptsWithStreamingResponse(self._content.scripts) + + @cached_property + def settings(self) -> SettingsWithStreamingResponse: + return SettingsWithStreamingResponse(self._content.settings) + + @cached_property + def bindings(self) -> BindingsWithStreamingResponse: + return BindingsWithStreamingResponse(self._content.bindings) + + +class AsyncContentWithStreamingResponse: + def __init__(self, content: AsyncContent) -> None: + self._content = content + + @cached_property + def scripts(self) -> AsyncScriptsWithStreamingResponse: + return AsyncScriptsWithStreamingResponse(self._content.scripts) + + @cached_property + def settings(self) -> AsyncSettingsWithStreamingResponse: + return AsyncSettingsWithStreamingResponse(self._content.settings) + + @cached_property + def bindings(self) -> AsyncBindingsWithStreamingResponse: + return AsyncBindingsWithStreamingResponse(self._content.bindings) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/scripts.py similarity index 83% rename from src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py rename to src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/scripts.py index f4b21a43de9..4f23388056b 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/scripts.py @@ -6,11 +6,11 @@ import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ......_utils import extract_files, maybe_transform, deepcopy_minimal -from ......_compat import cached_property -from ......_resource import SyncAPIResource, AsyncAPIResource -from ......_response import ( +from ......._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ......._utils import extract_files, maybe_transform, deepcopy_minimal +from ......._compat import cached_property +from ......._resource import SyncAPIResource, AsyncAPIResource +from ......._response import ( BinaryAPIResponse, AsyncBinaryAPIResponse, StreamedBinaryAPIResponse, @@ -24,23 +24,26 @@ async_to_custom_raw_response_wrapper, async_to_custom_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_for_platforms.dispatch.namespaces.scripts import ContentUpdateResponse, content_update_params +from .......types.workers_for_platforms.dispatch.namespaces.scripts.content import ( + ScriptUpdateResponse, + script_update_params, +) -__all__ = ["Content", "AsyncContent"] +__all__ = ["Scripts", "AsyncScripts"] -class Content(SyncAPIResource): +class Scripts(SyncAPIResource): @cached_property - def with_raw_response(self) -> ContentWithRawResponse: - return ContentWithRawResponse(self) + def with_raw_response(self) -> ScriptsWithRawResponse: + return ScriptsWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ContentWithStreamingResponse: - return ContentWithStreamingResponse(self) + def with_streaming_response(self) -> ScriptsWithStreamingResponse: + return ScriptsWithStreamingResponse(self) def update( self, @@ -49,14 +52,14 @@ def update( account_id: str, dispatch_namespace: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata | 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, - ) -> ContentUpdateResponse: + ) -> ScriptUpdateResponse: """ Put script content for a script uploaded to a Workers for Platforms namespace. @@ -103,7 +106,7 @@ def update( extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), + body=maybe_transform(body, script_update_params.ScriptUpdateParams), files=files, options=make_request_options( extra_headers=extra_headers, @@ -112,7 +115,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ContentUpdateResponse], ResultWrapper[ContentUpdateResponse]), + cast_to=cast(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]), ) def get( @@ -163,14 +166,14 @@ def get( ) -class AsyncContent(AsyncAPIResource): +class AsyncScripts(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncContentWithRawResponse: - return AsyncContentWithRawResponse(self) + def with_raw_response(self) -> AsyncScriptsWithRawResponse: + return AsyncScriptsWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncContentWithStreamingResponse: - return AsyncContentWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: + return AsyncScriptsWithStreamingResponse(self) async def update( self, @@ -179,14 +182,14 @@ async def update( account_id: str, dispatch_namespace: str, any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: content_update_params.Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata | 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, - ) -> ContentUpdateResponse: + ) -> ScriptUpdateResponse: """ Put script content for a script uploaded to a Workers for Platforms namespace. @@ -233,7 +236,7 @@ async def update( extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), + body=maybe_transform(body, script_update_params.ScriptUpdateParams), files=files, options=make_request_options( extra_headers=extra_headers, @@ -242,7 +245,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ContentUpdateResponse], ResultWrapper[ContentUpdateResponse]), + cast_to=cast(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]), ) async def get( @@ -293,53 +296,53 @@ async def get( ) -class ContentWithRawResponse: - def __init__(self, content: Content) -> None: - self._content = content +class ScriptsWithRawResponse: + def __init__(self, scripts: Scripts) -> None: + self._scripts = scripts self.update = to_raw_response_wrapper( - content.update, + scripts.update, ) self.get = to_custom_raw_response_wrapper( - content.get, + scripts.get, BinaryAPIResponse, ) -class AsyncContentWithRawResponse: - def __init__(self, content: AsyncContent) -> None: - self._content = content +class AsyncScriptsWithRawResponse: + def __init__(self, scripts: AsyncScripts) -> None: + self._scripts = scripts self.update = async_to_raw_response_wrapper( - content.update, + scripts.update, ) self.get = async_to_custom_raw_response_wrapper( - content.get, + scripts.get, AsyncBinaryAPIResponse, ) -class ContentWithStreamingResponse: - def __init__(self, content: Content) -> None: - self._content = content +class ScriptsWithStreamingResponse: + def __init__(self, scripts: Scripts) -> None: + self._scripts = scripts self.update = to_streamed_response_wrapper( - content.update, + scripts.update, ) self.get = to_custom_streamed_response_wrapper( - content.get, + scripts.get, StreamedBinaryAPIResponse, ) -class AsyncContentWithStreamingResponse: - def __init__(self, content: AsyncContent) -> None: - self._content = content +class AsyncScriptsWithStreamingResponse: + def __init__(self, scripts: AsyncScripts) -> None: + self._scripts = scripts self.update = async_to_streamed_response_wrapper( - content.update, + scripts.update, ) self.get = async_to_custom_streamed_response_wrapper( - content.get, + scripts.get, AsyncStreamedBinaryAPIResponse, ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/settings.py similarity index 96% rename from src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py rename to src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/settings.py index af259a5e7b1..7f4e78e97a6 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content/settings.py @@ -7,21 +7,21 @@ import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ......_utils import maybe_transform -from ......_compat import cached_property -from ......_resource import SyncAPIResource, AsyncAPIResource -from ......_response import ( +from ......._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ......._utils import 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 ( +from ......._wrappers import ResultWrapper +from ......._base_client import ( make_request_options, ) -from ......types.workers_for_platforms.dispatch.namespaces.scripts import ( +from .......types.workers_for_platforms.dispatch.namespaces.scripts.content import ( SettingGetResponse, SettingEditResponse, setting_edit_params, diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py index 17714bf12c1..ebdb105b412 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py @@ -2,6 +2,10 @@ from __future__ import annotations +from typing import List, Type, cast + +import httpx + from .content import ( Content, AsyncContent, @@ -10,24 +14,27 @@ ContentWithStreamingResponse, AsyncContentWithStreamingResponse, ) -from .bindings import ( - Bindings, - AsyncBindings, - BindingsWithRawResponse, - AsyncBindingsWithRawResponse, - BindingsWithStreamingResponse, - AsyncBindingsWithStreamingResponse, -) -from .settings import ( - Settings, - AsyncSettings, - SettingsWithRawResponse, - AsyncSettingsWithRawResponse, - SettingsWithStreamingResponse, - AsyncSettingsWithStreamingResponse, -) +from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes +from ......_utils import 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 .content.content import Content, AsyncContent +from ......_base_client import ( + make_request_options, +) +from ......types.workers_for_platforms.dispatch.namespaces import ( + ScriptGetResponse, + ScriptUpdateResponse, + script_delete_params, + script_update_params, +) __all__ = ["Scripts", "AsyncScripts"] @@ -37,14 +44,6 @@ class Scripts(SyncAPIResource): def content(self) -> Content: return Content(self._client) - @cached_property - def settings(self) -> Settings: - return Settings(self._client) - - @cached_property - def bindings(self) -> Bindings: - return Bindings(self._client) - @cached_property def with_raw_response(self) -> ScriptsWithRawResponse: return ScriptsWithRawResponse(self) @@ -53,20 +52,187 @@ def with_raw_response(self) -> ScriptsWithRawResponse: def with_streaming_response(self) -> ScriptsWithStreamingResponse: return ScriptsWithStreamingResponse(self) + def update( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, + message: str | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata | 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, + ) -> ScriptUpdateResponse: + """ + Upload a worker module to a Workers for Platforms namespace. + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + script_name: Name of the script, used in URLs and route configuration. + + 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 + and referenced in the metadata as `main_module` or `body_part` by part name. + + message: Rollback message to be associated with this deployment. Only parsed when query + param `"rollback_to"` is present. + + 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 dispatch_namespace: + raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + body=maybe_transform( + { + "any_part_name": any_part_name, + "message": message, + "metadata": metadata, + }, + 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(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]), + ) + + def delete( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete a worker from a Workers for Platforms namespace. + + This call has no + response body on a successful delete. + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + script_name: Name of the script, used in URLs and route configuration. + + force: If set to true, delete will not be stopped by associated service binding, + durable object, or other binding. Any of these associated bindings/durable + objects will be deleted along with the script. + + 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 dispatch_namespace: + raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}") + if not script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams), + ), + cast_to=NoneType, + ) + + def get( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: 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, + ) -> ScriptGetResponse: + """ + Fetch information about a script uploaded to a Workers for Platforms namespace. + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + 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 dispatch_namespace: + raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + 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[ScriptGetResponse], ResultWrapper[ScriptGetResponse]), + ) + class AsyncScripts(AsyncAPIResource): @cached_property def content(self) -> AsyncContent: return AsyncContent(self._client) - @cached_property - def settings(self) -> AsyncSettings: - return AsyncSettings(self._client) - - @cached_property - def bindings(self) -> AsyncBindings: - return AsyncBindings(self._client) - @cached_property def with_raw_response(self) -> AsyncScriptsWithRawResponse: return AsyncScriptsWithRawResponse(self) @@ -75,70 +241,253 @@ def with_raw_response(self) -> AsyncScriptsWithRawResponse: def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: return AsyncScriptsWithStreamingResponse(self) + async def update( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, + message: str | NotGiven = NOT_GIVEN, + metadata: script_update_params.Metadata | 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, + ) -> ScriptUpdateResponse: + """ + Upload a worker module to a Workers for Platforms namespace. + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + script_name: Name of the script, used in URLs and route configuration. + + 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 + and referenced in the metadata as `main_module` or `body_part` by part name. + + message: Rollback message to be associated with this deployment. Only parsed when query + param `"rollback_to"` is present. + + 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 dispatch_namespace: + raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + body=maybe_transform( + { + "any_part_name": any_part_name, + "message": message, + "metadata": metadata, + }, + 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(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]), + ) + + async def delete( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: str, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete a worker from a Workers for Platforms namespace. + + This call has no + response body on a successful delete. + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + script_name: Name of the script, used in URLs and route configuration. + + force: If set to true, delete will not be stopped by associated service binding, + durable object, or other binding. Any of these associated bindings/durable + objects will be deleted along with the script. + + 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 dispatch_namespace: + raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}") + if not script_name: + raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams), + ), + cast_to=NoneType, + ) + + async def get( + self, + script_name: str, + *, + account_id: str, + dispatch_namespace: 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, + ) -> ScriptGetResponse: + """ + Fetch information about a script uploaded to a Workers for Platforms namespace. + + Args: + account_id: Identifier + + dispatch_namespace: Name of the Workers for Platforms dispatch namespace. + + 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 dispatch_namespace: + raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!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/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", + 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[ScriptGetResponse], ResultWrapper[ScriptGetResponse]), + ) + class ScriptsWithRawResponse: def __init__(self, scripts: Scripts) -> None: self._scripts = scripts + self.update = to_raw_response_wrapper( + scripts.update, + ) + self.delete = to_raw_response_wrapper( + scripts.delete, + ) + self.get = to_raw_response_wrapper( + scripts.get, + ) + @cached_property def content(self) -> ContentWithRawResponse: return ContentWithRawResponse(self._scripts.content) - @cached_property - def settings(self) -> SettingsWithRawResponse: - return SettingsWithRawResponse(self._scripts.settings) - - @cached_property - def bindings(self) -> BindingsWithRawResponse: - return BindingsWithRawResponse(self._scripts.bindings) - class AsyncScriptsWithRawResponse: def __init__(self, scripts: AsyncScripts) -> None: self._scripts = scripts + self.update = async_to_raw_response_wrapper( + scripts.update, + ) + self.delete = async_to_raw_response_wrapper( + scripts.delete, + ) + self.get = async_to_raw_response_wrapper( + scripts.get, + ) + @cached_property def content(self) -> AsyncContentWithRawResponse: return AsyncContentWithRawResponse(self._scripts.content) - @cached_property - def settings(self) -> AsyncSettingsWithRawResponse: - return AsyncSettingsWithRawResponse(self._scripts.settings) - - @cached_property - def bindings(self) -> AsyncBindingsWithRawResponse: - return AsyncBindingsWithRawResponse(self._scripts.bindings) - class ScriptsWithStreamingResponse: def __init__(self, scripts: Scripts) -> None: self._scripts = scripts + self.update = to_streamed_response_wrapper( + scripts.update, + ) + self.delete = to_streamed_response_wrapper( + scripts.delete, + ) + self.get = to_streamed_response_wrapper( + scripts.get, + ) + @cached_property def content(self) -> ContentWithStreamingResponse: return ContentWithStreamingResponse(self._scripts.content) - @cached_property - def settings(self) -> SettingsWithStreamingResponse: - return SettingsWithStreamingResponse(self._scripts.settings) - - @cached_property - def bindings(self) -> BindingsWithStreamingResponse: - return BindingsWithStreamingResponse(self._scripts.bindings) - class AsyncScriptsWithStreamingResponse: def __init__(self, scripts: AsyncScripts) -> None: self._scripts = scripts + self.update = async_to_streamed_response_wrapper( + scripts.update, + ) + self.delete = async_to_streamed_response_wrapper( + scripts.delete, + ) + self.get = async_to_streamed_response_wrapper( + scripts.get, + ) + @cached_property def content(self) -> AsyncContentWithStreamingResponse: return AsyncContentWithStreamingResponse(self._scripts.content) - - @cached_property - def settings(self) -> AsyncSettingsWithStreamingResponse: - return AsyncSettingsWithStreamingResponse(self._scripts.settings) - - @cached_property - def bindings(self) -> AsyncBindingsWithStreamingResponse: - return AsyncBindingsWithStreamingResponse(self._scripts.bindings) diff --git a/src/cloudflare/resources/zero_trust/__init__.py b/src/cloudflare/resources/zero_trust/__init__.py index d5a100de2e2..97273f9ecac 100644 --- a/src/cloudflare/resources/zero_trust/__init__.py +++ b/src/cloudflare/resources/zero_trust/__init__.py @@ -16,6 +16,14 @@ DLPWithStreamingResponse, AsyncDLPWithStreamingResponse, ) +from .seats import ( + Seats, + AsyncSeats, + SeatsWithRawResponse, + AsyncSeatsWithRawResponse, + SeatsWithStreamingResponse, + AsyncSeatsWithStreamingResponse, +) from .access import ( Access, AsyncAccess, @@ -56,6 +64,22 @@ ZeroTrustWithStreamingResponse, AsyncZeroTrustWithStreamingResponse, ) +from .organizations import ( + Organizations, + AsyncOrganizations, + OrganizationsWithRawResponse, + AsyncOrganizationsWithRawResponse, + OrganizationsWithStreamingResponse, + AsyncOrganizationsWithStreamingResponse, +) +from .identity_providers import ( + IdentityProviders, + AsyncIdentityProviders, + IdentityProvidersWithRawResponse, + AsyncIdentityProvidersWithRawResponse, + IdentityProvidersWithStreamingResponse, + AsyncIdentityProvidersWithStreamingResponse, +) from .connectivity_settings import ( ConnectivitySettings, AsyncConnectivitySettings, @@ -66,6 +90,24 @@ ) __all__ = [ + "IdentityProviders", + "AsyncIdentityProviders", + "IdentityProvidersWithRawResponse", + "AsyncIdentityProvidersWithRawResponse", + "IdentityProvidersWithStreamingResponse", + "AsyncIdentityProvidersWithStreamingResponse", + "Organizations", + "AsyncOrganizations", + "OrganizationsWithRawResponse", + "AsyncOrganizationsWithRawResponse", + "OrganizationsWithStreamingResponse", + "AsyncOrganizationsWithStreamingResponse", + "Seats", + "AsyncSeats", + "SeatsWithRawResponse", + "AsyncSeatsWithRawResponse", + "SeatsWithStreamingResponse", + "AsyncSeatsWithStreamingResponse", "Access", "AsyncAccess", "AccessWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/__init__.py b/src/cloudflare/resources/zero_trust/access/__init__.py index bad57fe19b8..f2f3f859f9c 100644 --- a/src/cloudflare/resources/zero_trust/access/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/__init__.py @@ -24,14 +24,6 @@ TagsWithStreamingResponse, AsyncTagsWithStreamingResponse, ) -from .seats import ( - Seats, - AsyncSeats, - SeatsWithRawResponse, - AsyncSeatsWithRawResponse, - SeatsWithStreamingResponse, - AsyncSeatsWithStreamingResponse, -) from .users import ( Users, AsyncUsers, @@ -88,14 +80,6 @@ CustomPagesWithStreamingResponse, AsyncCustomPagesWithStreamingResponse, ) -from .organizations import ( - Organizations, - AsyncOrganizations, - OrganizationsWithRawResponse, - AsyncOrganizationsWithRawResponse, - OrganizationsWithStreamingResponse, - AsyncOrganizationsWithStreamingResponse, -) from .service_tokens import ( ServiceTokens, AsyncServiceTokens, @@ -104,14 +88,6 @@ ServiceTokensWithStreamingResponse, AsyncServiceTokensWithStreamingResponse, ) -from .identity_providers import ( - IdentityProviders, - AsyncIdentityProviders, - IdentityProvidersWithRawResponse, - AsyncIdentityProvidersWithRawResponse, - IdentityProvidersWithStreamingResponse, - AsyncIdentityProvidersWithStreamingResponse, -) __all__ = [ "Applications", @@ -132,18 +108,6 @@ "AsyncGroupsWithRawResponse", "GroupsWithStreamingResponse", "AsyncGroupsWithStreamingResponse", - "IdentityProviders", - "AsyncIdentityProviders", - "IdentityProvidersWithRawResponse", - "AsyncIdentityProvidersWithRawResponse", - "IdentityProvidersWithStreamingResponse", - "AsyncIdentityProvidersWithStreamingResponse", - "Organizations", - "AsyncOrganizations", - "OrganizationsWithRawResponse", - "AsyncOrganizationsWithRawResponse", - "OrganizationsWithStreamingResponse", - "AsyncOrganizationsWithStreamingResponse", "ServiceTokens", "AsyncServiceTokens", "ServiceTokensWithRawResponse", @@ -168,12 +132,6 @@ "AsyncLogsWithRawResponse", "LogsWithStreamingResponse", "AsyncLogsWithStreamingResponse", - "Seats", - "AsyncSeats", - "SeatsWithRawResponse", - "AsyncSeatsWithRawResponse", - "SeatsWithStreamingResponse", - "AsyncSeatsWithStreamingResponse", "Users", "AsyncUsers", "UsersWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/access.py b/src/cloudflare/resources/zero_trust/access/access.py index 9768dde6c5d..adce89bf59a 100644 --- a/src/cloudflare/resources/zero_trust/access/access.py +++ b/src/cloudflare/resources/zero_trust/access/access.py @@ -26,14 +26,6 @@ TagsWithStreamingResponse, AsyncTagsWithStreamingResponse, ) -from .seats import ( - Seats, - AsyncSeats, - SeatsWithRawResponse, - AsyncSeatsWithRawResponse, - SeatsWithStreamingResponse, - AsyncSeatsWithStreamingResponse, -) from .users import ( Users, AsyncUsers, @@ -86,14 +78,6 @@ CustomPagesWithStreamingResponse, AsyncCustomPagesWithStreamingResponse, ) -from .organizations import ( - Organizations, - AsyncOrganizations, - OrganizationsWithRawResponse, - AsyncOrganizationsWithRawResponse, - OrganizationsWithStreamingResponse, - AsyncOrganizationsWithStreamingResponse, -) from .service_tokens import ( ServiceTokens, AsyncServiceTokens, @@ -102,14 +86,6 @@ ServiceTokensWithStreamingResponse, AsyncServiceTokensWithStreamingResponse, ) -from .identity_providers import ( - IdentityProviders, - AsyncIdentityProviders, - IdentityProvidersWithRawResponse, - AsyncIdentityProvidersWithRawResponse, - IdentityProvidersWithStreamingResponse, - AsyncIdentityProvidersWithStreamingResponse, -) from .applications.applications import Applications, AsyncApplications from .certificates.certificates import Certificates, AsyncCertificates @@ -129,14 +105,6 @@ def certificates(self) -> Certificates: def groups(self) -> Groups: return Groups(self._client) - @cached_property - def identity_providers(self) -> IdentityProviders: - return IdentityProviders(self._client) - - @cached_property - def organizations(self) -> Organizations: - return Organizations(self._client) - @cached_property def service_tokens(self) -> ServiceTokens: return ServiceTokens(self._client) @@ -153,10 +121,6 @@ def keys(self) -> Keys: def logs(self) -> Logs: return Logs(self._client) - @cached_property - def seats(self) -> Seats: - return Seats(self._client) - @cached_property def users(self) -> Users: return Users(self._client) @@ -191,14 +155,6 @@ def certificates(self) -> AsyncCertificates: def groups(self) -> AsyncGroups: return AsyncGroups(self._client) - @cached_property - def identity_providers(self) -> AsyncIdentityProviders: - return AsyncIdentityProviders(self._client) - - @cached_property - def organizations(self) -> AsyncOrganizations: - return AsyncOrganizations(self._client) - @cached_property def service_tokens(self) -> AsyncServiceTokens: return AsyncServiceTokens(self._client) @@ -215,10 +171,6 @@ def keys(self) -> AsyncKeys: def logs(self) -> AsyncLogs: return AsyncLogs(self._client) - @cached_property - def seats(self) -> AsyncSeats: - return AsyncSeats(self._client) - @cached_property def users(self) -> AsyncUsers: return AsyncUsers(self._client) @@ -256,14 +208,6 @@ def certificates(self) -> CertificatesWithRawResponse: def groups(self) -> GroupsWithRawResponse: return GroupsWithRawResponse(self._access.groups) - @cached_property - def identity_providers(self) -> IdentityProvidersWithRawResponse: - return IdentityProvidersWithRawResponse(self._access.identity_providers) - - @cached_property - def organizations(self) -> OrganizationsWithRawResponse: - return OrganizationsWithRawResponse(self._access.organizations) - @cached_property def service_tokens(self) -> ServiceTokensWithRawResponse: return ServiceTokensWithRawResponse(self._access.service_tokens) @@ -280,10 +224,6 @@ def keys(self) -> KeysWithRawResponse: def logs(self) -> LogsWithRawResponse: return LogsWithRawResponse(self._access.logs) - @cached_property - def seats(self) -> SeatsWithRawResponse: - return SeatsWithRawResponse(self._access.seats) - @cached_property def users(self) -> UsersWithRawResponse: return UsersWithRawResponse(self._access.users) @@ -313,14 +253,6 @@ def certificates(self) -> AsyncCertificatesWithRawResponse: def groups(self) -> AsyncGroupsWithRawResponse: return AsyncGroupsWithRawResponse(self._access.groups) - @cached_property - def identity_providers(self) -> AsyncIdentityProvidersWithRawResponse: - return AsyncIdentityProvidersWithRawResponse(self._access.identity_providers) - - @cached_property - def organizations(self) -> AsyncOrganizationsWithRawResponse: - return AsyncOrganizationsWithRawResponse(self._access.organizations) - @cached_property def service_tokens(self) -> AsyncServiceTokensWithRawResponse: return AsyncServiceTokensWithRawResponse(self._access.service_tokens) @@ -337,10 +269,6 @@ def keys(self) -> AsyncKeysWithRawResponse: def logs(self) -> AsyncLogsWithRawResponse: return AsyncLogsWithRawResponse(self._access.logs) - @cached_property - def seats(self) -> AsyncSeatsWithRawResponse: - return AsyncSeatsWithRawResponse(self._access.seats) - @cached_property def users(self) -> AsyncUsersWithRawResponse: return AsyncUsersWithRawResponse(self._access.users) @@ -370,14 +298,6 @@ def certificates(self) -> CertificatesWithStreamingResponse: def groups(self) -> GroupsWithStreamingResponse: return GroupsWithStreamingResponse(self._access.groups) - @cached_property - def identity_providers(self) -> IdentityProvidersWithStreamingResponse: - return IdentityProvidersWithStreamingResponse(self._access.identity_providers) - - @cached_property - def organizations(self) -> OrganizationsWithStreamingResponse: - return OrganizationsWithStreamingResponse(self._access.organizations) - @cached_property def service_tokens(self) -> ServiceTokensWithStreamingResponse: return ServiceTokensWithStreamingResponse(self._access.service_tokens) @@ -394,10 +314,6 @@ def keys(self) -> KeysWithStreamingResponse: def logs(self) -> LogsWithStreamingResponse: return LogsWithStreamingResponse(self._access.logs) - @cached_property - def seats(self) -> SeatsWithStreamingResponse: - return SeatsWithStreamingResponse(self._access.seats) - @cached_property def users(self) -> UsersWithStreamingResponse: return UsersWithStreamingResponse(self._access.users) @@ -427,14 +343,6 @@ def certificates(self) -> AsyncCertificatesWithStreamingResponse: def groups(self) -> AsyncGroupsWithStreamingResponse: return AsyncGroupsWithStreamingResponse(self._access.groups) - @cached_property - def identity_providers(self) -> AsyncIdentityProvidersWithStreamingResponse: - return AsyncIdentityProvidersWithStreamingResponse(self._access.identity_providers) - - @cached_property - def organizations(self) -> AsyncOrganizationsWithStreamingResponse: - return AsyncOrganizationsWithStreamingResponse(self._access.organizations) - @cached_property def service_tokens(self) -> AsyncServiceTokensWithStreamingResponse: return AsyncServiceTokensWithStreamingResponse(self._access.service_tokens) @@ -451,10 +359,6 @@ def keys(self) -> AsyncKeysWithStreamingResponse: def logs(self) -> AsyncLogsWithStreamingResponse: return AsyncLogsWithStreamingResponse(self._access.logs) - @cached_property - def seats(self) -> AsyncSeatsWithStreamingResponse: - return AsyncSeatsWithStreamingResponse(self._access.seats) - @cached_property def users(self) -> AsyncUsersWithStreamingResponse: return AsyncUsersWithStreamingResponse(self._access.users) diff --git a/src/cloudflare/resources/zero_trust/access/identity_providers.py b/src/cloudflare/resources/zero_trust/identity_providers.py similarity index 99% rename from src/cloudflare/resources/zero_trust/access/identity_providers.py rename to src/cloudflare/resources/zero_trust/identity_providers.py index 19f763b370e..1e543ca0beb 100644 --- a/src/cloudflare/resources/zero_trust/access/identity_providers.py +++ b/src/cloudflare/resources/zero_trust/identity_providers.py @@ -7,21 +7,21 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import 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 ( +from ..._wrappers import ResultWrapper +from ..._base_client import ( make_request_options, ) -from ....types.zero_trust.access import ( +from ...types.zero_trust import ( IdentityProviderGetResponse, IdentityProviderListResponse, IdentityProviderCreateResponse, diff --git a/src/cloudflare/resources/zero_trust/access/organizations.py b/src/cloudflare/resources/zero_trust/organizations.py similarity index 99% rename from src/cloudflare/resources/zero_trust/access/organizations.py rename to src/cloudflare/resources/zero_trust/organizations.py index ac418969097..c2ab8da9452 100644 --- a/src/cloudflare/resources/zero_trust/access/organizations.py +++ b/src/cloudflare/resources/zero_trust/organizations.py @@ -6,21 +6,21 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import 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 ( +from ..._wrappers import ResultWrapper +from ..._base_client import ( make_request_options, ) -from ....types.zero_trust.access import ( +from ...types.zero_trust import ( OrganizationListResponse, OrganizationCreateResponse, OrganizationUpdateResponse, diff --git a/src/cloudflare/resources/zero_trust/access/seats.py b/src/cloudflare/resources/zero_trust/seats.py similarity index 93% rename from src/cloudflare/resources/zero_trust/access/seats.py rename to src/cloudflare/resources/zero_trust/seats.py index 3dd3ab661ee..576cc753250 100644 --- a/src/cloudflare/resources/zero_trust/access/seats.py +++ b/src/cloudflare/resources/zero_trust/seats.py @@ -6,21 +6,21 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import 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 ( +from ..._wrappers import ResultWrapper +from ..._base_client import ( make_request_options, ) -from ....types.zero_trust.access import SeatEditResponse, seat_edit_params +from ...types.zero_trust import SeatEditResponse, seat_edit_params __all__ = ["Seats", "AsyncSeats"] diff --git a/src/cloudflare/resources/zero_trust/zero_trust.py b/src/cloudflare/resources/zero_trust/zero_trust.py index 6e9eb2ce1a7..1e6a1c0405f 100644 --- a/src/cloudflare/resources/zero_trust/zero_trust.py +++ b/src/cloudflare/resources/zero_trust/zero_trust.py @@ -18,6 +18,14 @@ DLPWithStreamingResponse, AsyncDLPWithStreamingResponse, ) +from .seats import ( + Seats, + AsyncSeats, + SeatsWithRawResponse, + AsyncSeatsWithRawResponse, + SeatsWithStreamingResponse, + AsyncSeatsWithStreamingResponse, +) from .access import ( Access, AsyncAccess, @@ -55,9 +63,25 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .access.access import Access, AsyncAccess +from .organizations import ( + Organizations, + AsyncOrganizations, + OrganizationsWithRawResponse, + AsyncOrganizationsWithRawResponse, + OrganizationsWithStreamingResponse, + AsyncOrganizationsWithStreamingResponse, +) from .gateway.gateway import Gateway, AsyncGateway from .tunnels.tunnels import Tunnels, AsyncTunnels from .networks.networks import Networks, AsyncNetworks +from .identity_providers import ( + IdentityProviders, + AsyncIdentityProviders, + IdentityProvidersWithRawResponse, + AsyncIdentityProvidersWithRawResponse, + IdentityProvidersWithStreamingResponse, + AsyncIdentityProvidersWithStreamingResponse, +) from .connectivity_settings import ( ConnectivitySettings, AsyncConnectivitySettings, @@ -71,6 +95,18 @@ class ZeroTrust(SyncAPIResource): + @cached_property + def identity_providers(self) -> IdentityProviders: + return IdentityProviders(self._client) + + @cached_property + def organizations(self) -> Organizations: + return Organizations(self._client) + + @cached_property + def seats(self) -> Seats: + return Seats(self._client) + @cached_property def access(self) -> Access: return Access(self._client) @@ -109,6 +145,18 @@ def with_streaming_response(self) -> ZeroTrustWithStreamingResponse: class AsyncZeroTrust(AsyncAPIResource): + @cached_property + def identity_providers(self) -> AsyncIdentityProviders: + return AsyncIdentityProviders(self._client) + + @cached_property + def organizations(self) -> AsyncOrganizations: + return AsyncOrganizations(self._client) + + @cached_property + def seats(self) -> AsyncSeats: + return AsyncSeats(self._client) + @cached_property def access(self) -> AsyncAccess: return AsyncAccess(self._client) @@ -150,6 +198,18 @@ class ZeroTrustWithRawResponse: def __init__(self, zero_trust: ZeroTrust) -> None: self._zero_trust = zero_trust + @cached_property + def identity_providers(self) -> IdentityProvidersWithRawResponse: + return IdentityProvidersWithRawResponse(self._zero_trust.identity_providers) + + @cached_property + def organizations(self) -> OrganizationsWithRawResponse: + return OrganizationsWithRawResponse(self._zero_trust.organizations) + + @cached_property + def seats(self) -> SeatsWithRawResponse: + return SeatsWithRawResponse(self._zero_trust.seats) + @cached_property def access(self) -> AccessWithRawResponse: return AccessWithRawResponse(self._zero_trust.access) @@ -183,6 +243,18 @@ class AsyncZeroTrustWithRawResponse: def __init__(self, zero_trust: AsyncZeroTrust) -> None: self._zero_trust = zero_trust + @cached_property + def identity_providers(self) -> AsyncIdentityProvidersWithRawResponse: + return AsyncIdentityProvidersWithRawResponse(self._zero_trust.identity_providers) + + @cached_property + def organizations(self) -> AsyncOrganizationsWithRawResponse: + return AsyncOrganizationsWithRawResponse(self._zero_trust.organizations) + + @cached_property + def seats(self) -> AsyncSeatsWithRawResponse: + return AsyncSeatsWithRawResponse(self._zero_trust.seats) + @cached_property def access(self) -> AsyncAccessWithRawResponse: return AsyncAccessWithRawResponse(self._zero_trust.access) @@ -216,6 +288,18 @@ class ZeroTrustWithStreamingResponse: def __init__(self, zero_trust: ZeroTrust) -> None: self._zero_trust = zero_trust + @cached_property + def identity_providers(self) -> IdentityProvidersWithStreamingResponse: + return IdentityProvidersWithStreamingResponse(self._zero_trust.identity_providers) + + @cached_property + def organizations(self) -> OrganizationsWithStreamingResponse: + return OrganizationsWithStreamingResponse(self._zero_trust.organizations) + + @cached_property + def seats(self) -> SeatsWithStreamingResponse: + return SeatsWithStreamingResponse(self._zero_trust.seats) + @cached_property def access(self) -> AccessWithStreamingResponse: return AccessWithStreamingResponse(self._zero_trust.access) @@ -249,6 +333,18 @@ class AsyncZeroTrustWithStreamingResponse: def __init__(self, zero_trust: AsyncZeroTrust) -> None: self._zero_trust = zero_trust + @cached_property + def identity_providers(self) -> AsyncIdentityProvidersWithStreamingResponse: + return AsyncIdentityProvidersWithStreamingResponse(self._zero_trust.identity_providers) + + @cached_property + def organizations(self) -> AsyncOrganizationsWithStreamingResponse: + return AsyncOrganizationsWithStreamingResponse(self._zero_trust.organizations) + + @cached_property + def seats(self) -> AsyncSeatsWithStreamingResponse: + return AsyncSeatsWithStreamingResponse(self._zero_trust.seats) + @cached_property def access(self) -> AsyncAccessWithStreamingResponse: return AsyncAccessWithStreamingResponse(self._zero_trust.access) diff --git a/src/cloudflare/resources/zones/__init__.py b/src/cloudflare/resources/zones/__init__.py index 961f6b0cdf5..3748e0324ec 100644 --- a/src/cloudflare/resources/zones/__init__.py +++ b/src/cloudflare/resources/zones/__init__.py @@ -32,6 +32,14 @@ SettingsWithStreamingResponse, AsyncSettingsWithStreamingResponse, ) +from .subscriptions import ( + Subscriptions, + AsyncSubscriptions, + SubscriptionsWithRawResponse, + AsyncSubscriptionsWithRawResponse, + SubscriptionsWithStreamingResponse, + AsyncSubscriptionsWithStreamingResponse, +) from .activation_check import ( ActivationCheck, AsyncActivationCheck, @@ -80,6 +88,12 @@ "AsyncWorkersWithRawResponse", "WorkersWithStreamingResponse", "AsyncWorkersWithStreamingResponse", + "Subscriptions", + "AsyncSubscriptions", + "SubscriptionsWithRawResponse", + "AsyncSubscriptionsWithRawResponse", + "SubscriptionsWithStreamingResponse", + "AsyncSubscriptionsWithStreamingResponse", "Zones", "AsyncZones", "ZonesWithRawResponse", diff --git a/src/cloudflare/resources/zones/subscriptions.py b/src/cloudflare/resources/zones/subscriptions.py new file mode 100644 index 00000000000..b0e803029e4 --- /dev/null +++ b/src/cloudflare/resources/zones/subscriptions.py @@ -0,0 +1,411 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import Any, Type, Iterable, Optional, cast +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +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 ...types.zones import ( + SubscriptionGetResponse, + SubscriptionListResponse, + SubscriptionCreateResponse, + subscription_create_params, +) +from ..._base_client import ( + make_request_options, +) + +__all__ = ["Subscriptions", "AsyncSubscriptions"] + + +class Subscriptions(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SubscriptionsWithRawResponse: + return SubscriptionsWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SubscriptionsWithStreamingResponse: + return SubscriptionsWithStreamingResponse(self) + + def create( + self, + identifier: str, + *, + app: subscription_create_params.App | NotGiven = NOT_GIVEN, + component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, + rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, + zone: subscription_create_params.Zone | 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, + ) -> SubscriptionCreateResponse: + """ + Create a zone subscription, either plan or add-ons. + + Args: + identifier: Subscription identifier tag. + + component_values: The list of add-ons subscribed to. + + frequency: How often the subscription is renewed automatically. + + rate_plan: The rate plan applied to the subscription. + + zone: A simple zone object. May have null properties if not a zone subscription. + + 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 identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return cast( + SubscriptionCreateResponse, + self._post( + f"/zones/{identifier}/subscription", + body=maybe_transform( + { + "app": app, + "component_values": component_values, + "frequency": frequency, + "rate_plan": rate_plan, + "zone": zone, + }, + subscription_create_params.SubscriptionCreateParams, + ), + 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[SubscriptionCreateResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def list( + self, + account_identifier: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SubscriptionListResponse]: + """ + Lists all of an account's subscriptions. + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return self._get( + f"/accounts/{account_identifier}/subscriptions", + 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[SubscriptionListResponse]], ResultWrapper[SubscriptionListResponse]), + ) + + def get( + self, + identifier: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SubscriptionGetResponse: + """ + Lists zone subscription details. + + Args: + identifier: Subscription identifier tag. + + 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 identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return cast( + SubscriptionGetResponse, + self._get( + f"/zones/{identifier}/subscription", + 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[SubscriptionGetResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class AsyncSubscriptions(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSubscriptionsWithRawResponse: + return AsyncSubscriptionsWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSubscriptionsWithStreamingResponse: + return AsyncSubscriptionsWithStreamingResponse(self) + + async def create( + self, + identifier: str, + *, + app: subscription_create_params.App | NotGiven = NOT_GIVEN, + component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN, + frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN, + rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN, + zone: subscription_create_params.Zone | 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, + ) -> SubscriptionCreateResponse: + """ + Create a zone subscription, either plan or add-ons. + + Args: + identifier: Subscription identifier tag. + + component_values: The list of add-ons subscribed to. + + frequency: How often the subscription is renewed automatically. + + rate_plan: The rate plan applied to the subscription. + + zone: A simple zone object. May have null properties if not a zone subscription. + + 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 identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return cast( + SubscriptionCreateResponse, + await self._post( + f"/zones/{identifier}/subscription", + body=maybe_transform( + { + "app": app, + "component_values": component_values, + "frequency": frequency, + "rate_plan": rate_plan, + "zone": zone, + }, + subscription_create_params.SubscriptionCreateParams, + ), + 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[SubscriptionCreateResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def list( + self, + account_identifier: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SubscriptionListResponse]: + """ + Lists all of an account's subscriptions. + + Args: + account_identifier: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_identifier: + raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") + return await self._get( + f"/accounts/{account_identifier}/subscriptions", + 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[SubscriptionListResponse]], ResultWrapper[SubscriptionListResponse]), + ) + + async def get( + self, + identifier: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SubscriptionGetResponse: + """ + Lists zone subscription details. + + Args: + identifier: Subscription identifier tag. + + 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 identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return cast( + SubscriptionGetResponse, + await self._get( + f"/zones/{identifier}/subscription", + 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[SubscriptionGetResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class SubscriptionsWithRawResponse: + def __init__(self, subscriptions: Subscriptions) -> None: + self._subscriptions = subscriptions + + self.create = to_raw_response_wrapper( + subscriptions.create, + ) + self.list = to_raw_response_wrapper( + subscriptions.list, + ) + self.get = to_raw_response_wrapper( + subscriptions.get, + ) + + +class AsyncSubscriptionsWithRawResponse: + def __init__(self, subscriptions: AsyncSubscriptions) -> None: + self._subscriptions = subscriptions + + self.create = async_to_raw_response_wrapper( + subscriptions.create, + ) + self.list = async_to_raw_response_wrapper( + subscriptions.list, + ) + self.get = async_to_raw_response_wrapper( + subscriptions.get, + ) + + +class SubscriptionsWithStreamingResponse: + def __init__(self, subscriptions: Subscriptions) -> None: + self._subscriptions = subscriptions + + self.create = to_streamed_response_wrapper( + subscriptions.create, + ) + self.list = to_streamed_response_wrapper( + subscriptions.list, + ) + self.get = to_streamed_response_wrapper( + subscriptions.get, + ) + + +class AsyncSubscriptionsWithStreamingResponse: + def __init__(self, subscriptions: AsyncSubscriptions) -> None: + self._subscriptions = subscriptions + + self.create = async_to_streamed_response_wrapper( + subscriptions.create, + ) + self.list = async_to_streamed_response_wrapper( + subscriptions.list, + ) + self.get = async_to_streamed_response_wrapper( + subscriptions.get, + ) diff --git a/src/cloudflare/resources/zones/zones.py b/src/cloudflare/resources/zones/zones.py index 37a09f5564d..a105f4d2432 100644 --- a/src/cloudflare/resources/zones/zones.py +++ b/src/cloudflare/resources/zones/zones.py @@ -53,6 +53,14 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from .subscriptions import ( + Subscriptions, + AsyncSubscriptions, + SubscriptionsWithRawResponse, + AsyncSubscriptionsWithRawResponse, + SubscriptionsWithStreamingResponse, + AsyncSubscriptionsWithStreamingResponse, +) from ..._base_client import ( AsyncPaginator, make_request_options, @@ -100,6 +108,10 @@ def holds(self) -> Holds: def workers(self) -> Workers: return Workers(self._client) + @cached_property + def subscriptions(self) -> Subscriptions: + return Subscriptions(self._client) + @cached_property def with_raw_response(self) -> ZonesWithRawResponse: return ZonesWithRawResponse(self) @@ -400,6 +412,10 @@ def holds(self) -> AsyncHolds: def workers(self) -> AsyncWorkers: return AsyncWorkers(self._client) + @cached_property + def subscriptions(self) -> AsyncSubscriptions: + return AsyncSubscriptions(self._client) + @cached_property def with_raw_response(self) -> AsyncZonesWithRawResponse: return AsyncZonesWithRawResponse(self) @@ -719,6 +735,10 @@ def holds(self) -> HoldsWithRawResponse: def workers(self) -> WorkersWithRawResponse: return WorkersWithRawResponse(self._zones.workers) + @cached_property + def subscriptions(self) -> SubscriptionsWithRawResponse: + return SubscriptionsWithRawResponse(self._zones.subscriptions) + class AsyncZonesWithRawResponse: def __init__(self, zones: AsyncZones) -> None: @@ -760,6 +780,10 @@ def holds(self) -> AsyncHoldsWithRawResponse: def workers(self) -> AsyncWorkersWithRawResponse: return AsyncWorkersWithRawResponse(self._zones.workers) + @cached_property + def subscriptions(self) -> AsyncSubscriptionsWithRawResponse: + return AsyncSubscriptionsWithRawResponse(self._zones.subscriptions) + class ZonesWithStreamingResponse: def __init__(self, zones: Zones) -> None: @@ -801,6 +825,10 @@ def holds(self) -> HoldsWithStreamingResponse: def workers(self) -> WorkersWithStreamingResponse: return WorkersWithStreamingResponse(self._zones.workers) + @cached_property + def subscriptions(self) -> SubscriptionsWithStreamingResponse: + return SubscriptionsWithStreamingResponse(self._zones.subscriptions) + class AsyncZonesWithStreamingResponse: def __init__(self, zones: AsyncZones) -> None: @@ -841,3 +869,7 @@ def holds(self) -> AsyncHoldsWithStreamingResponse: @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 88b43561797..c81cebe7379 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -9,7 +9,6 @@ from .zone_list_params import ZoneListParams as ZoneListParams from .call_get_response import CallGetResponse as CallGetResponse from .pcap_get_response import PCAPGetResponse as PCAPGetResponse -from .role_get_response import RoleGetResponse as RoleGetResponse from .zone_get_response import ZoneGetResponse as ZoneGetResponse from .cache_purge_params import CachePurgeParams as CachePurgeParams from .call_create_params import CallCreateParams as CallCreateParams @@ -20,7 +19,6 @@ from .pcap_create_params import PCAPCreateParams as PCAPCreateParams from .pcap_list_response import PCAPListResponse as PCAPListResponse from .queue_get_response import QueueGetResponse as QueueGetResponse -from .role_list_response import RoleListResponse as RoleListResponse from .stream_list_params import StreamListParams as StreamListParams from .user_edit_response import UserEditResponse as UserEditResponse from .user_list_response import UserListResponse as UserListResponse diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index 663d1a60cc2..cb3d50da154 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -2,7 +2,9 @@ from __future__ import annotations +from .role_get_response import RoleGetResponse as RoleGetResponse from .member_list_params import MemberListParams as MemberListParams +from .role_list_response import RoleListResponse as RoleListResponse from .member_get_response import MemberGetResponse as MemberGetResponse from .member_create_params import MemberCreateParams as MemberCreateParams from .member_list_response import MemberListResponse as MemberListResponse diff --git a/src/cloudflare/types/role_get_response.py b/src/cloudflare/types/accounts/role_get_response.py similarity index 100% rename from src/cloudflare/types/role_get_response.py rename to src/cloudflare/types/accounts/role_get_response.py diff --git a/src/cloudflare/types/role_list_response.py b/src/cloudflare/types/accounts/role_list_response.py similarity index 93% rename from src/cloudflare/types/role_list_response.py rename to src/cloudflare/types/accounts/role_list_response.py index 9271cf31235..d48603b575a 100644 --- a/src/cloudflare/types/role_list_response.py +++ b/src/cloudflare/types/accounts/role_list_response.py @@ -2,7 +2,7 @@ from typing import List -from .._models import BaseModel +from ..._models import BaseModel __all__ = ["RoleListResponse", "RoleListResponseItem"] diff --git a/src/cloudflare/types/radar/__init__.py b/src/cloudflare/types/radar/__init__.py index 1a700998bb3..408fa0dfac4 100644 --- a/src/cloudflare/types/radar/__init__.py +++ b/src/cloudflare/types/radar/__init__.py @@ -13,10 +13,10 @@ from .bgp_timeseries_params import BGPTimeseriesParams as BGPTimeseriesParams from .dataset_list_response import DatasetListResponse as DatasetListResponse from .search_global_response import SearchGlobalResponse as SearchGlobalResponse -from .as112_timeseries_params import As112TimeseriesParams as As112TimeseriesParams +from .as112_timeseries_params import AS112TimeseriesParams as AS112TimeseriesParams from .bgp_timeseries_response import BGPTimeseriesResponse as BGPTimeseriesResponse from .dataset_download_params import DatasetDownloadParams as DatasetDownloadParams -from .as112_timeseries_response import As112TimeseriesResponse as As112TimeseriesResponse +from .as112_timeseries_response import AS112TimeseriesResponse as AS112TimeseriesResponse from .dataset_download_response import DatasetDownloadResponse as DatasetDownloadResponse from .netflow_timeseries_params import NetflowTimeseriesParams as NetflowTimeseriesParams from .traffic_anomaly_get_params import TrafficAnomalyGetParams as TrafficAnomalyGetParams diff --git a/src/cloudflare/types/radar/as112_timeseries_params.py b/src/cloudflare/types/radar/as112_timeseries_params.py index 4a4d00f7822..1029cbc31bf 100644 --- a/src/cloudflare/types/radar/as112_timeseries_params.py +++ b/src/cloudflare/types/radar/as112_timeseries_params.py @@ -8,10 +8,10 @@ from ..._utils import PropertyInfo -__all__ = ["As112TimeseriesParams"] +__all__ = ["AS112TimeseriesParams"] -class As112TimeseriesParams(TypedDict, total=False): +class AS112TimeseriesParams(TypedDict, total=False): agg_interval: Annotated[Literal["15m", "1h", "1d", "1w"], PropertyInfo(alias="aggInterval")] """ Aggregation interval results should be returned in (for example, in 15 minutes diff --git a/src/cloudflare/types/radar/as112_timeseries_response.py b/src/cloudflare/types/radar/as112_timeseries_response.py index f194ba6a8fa..8186e2dd482 100644 --- a/src/cloudflare/types/radar/as112_timeseries_response.py +++ b/src/cloudflare/types/radar/as112_timeseries_response.py @@ -8,7 +8,7 @@ from ..._models import BaseModel __all__ = [ - "As112TimeseriesResponse", + "AS112TimeseriesResponse", "Meta", "MetaDateRange", "MetaConfidenceInfo", @@ -63,7 +63,7 @@ class Serie0(BaseModel): values: List[str] -class As112TimeseriesResponse(BaseModel): +class AS112TimeseriesResponse(BaseModel): meta: Meta serie_0: Serie0 diff --git a/src/cloudflare/types/snippets/__init__.py b/src/cloudflare/types/snippets/__init__.py index 2dc7e7067c1..63fd1d4a311 100644 --- a/src/cloudflare/types/snippets/__init__.py +++ b/src/cloudflare/types/snippets/__init__.py @@ -2,6 +2,6 @@ from __future__ import annotations -from .snippet_rule_list_response import SnippetRuleListResponse as SnippetRuleListResponse -from .snippet_rule_update_params import SnippetRuleUpdateParams as SnippetRuleUpdateParams -from .snippet_rule_update_response import SnippetRuleUpdateResponse as SnippetRuleUpdateResponse +from .rule_list_response import RuleListResponse as RuleListResponse +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse diff --git a/src/cloudflare/types/snippets/snippet_rule_list_response.py b/src/cloudflare/types/snippets/rule_list_response.py similarity index 64% rename from src/cloudflare/types/snippets/snippet_rule_list_response.py rename to src/cloudflare/types/snippets/rule_list_response.py index aaf15b57bb1..0ef2e865124 100644 --- a/src/cloudflare/types/snippets/snippet_rule_list_response.py +++ b/src/cloudflare/types/snippets/rule_list_response.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["SnippetRuleListResponse", "SnippetRuleListResponseItem"] +__all__ = ["RuleListResponse", "RuleListResponseItem"] -class SnippetRuleListResponseItem(BaseModel): +class RuleListResponseItem(BaseModel): description: Optional[str] = None enabled: Optional[bool] = None @@ -18,4 +18,4 @@ class SnippetRuleListResponseItem(BaseModel): """Snippet identifying name""" -SnippetRuleListResponse = List[SnippetRuleListResponseItem] +RuleListResponse = List[RuleListResponseItem] diff --git a/src/cloudflare/types/snippets/snippet_rule_update_params.py b/src/cloudflare/types/snippets/rule_update_params.py similarity index 78% rename from src/cloudflare/types/snippets/snippet_rule_update_params.py rename to src/cloudflare/types/snippets/rule_update_params.py index d24135240cc..207fcdc257c 100644 --- a/src/cloudflare/types/snippets/snippet_rule_update_params.py +++ b/src/cloudflare/types/snippets/rule_update_params.py @@ -5,10 +5,10 @@ from typing import Iterable from typing_extensions import TypedDict -__all__ = ["SnippetRuleUpdateParams", "Rule"] +__all__ = ["RuleUpdateParams", "Rule"] -class SnippetRuleUpdateParams(TypedDict, total=False): +class RuleUpdateParams(TypedDict, total=False): rules: Iterable[Rule] """List of snippet rules""" diff --git a/src/cloudflare/types/snippets/snippet_rule_update_response.py b/src/cloudflare/types/snippets/rule_update_response.py similarity index 62% rename from src/cloudflare/types/snippets/snippet_rule_update_response.py rename to src/cloudflare/types/snippets/rule_update_response.py index 52d2561ccb3..41f2141814a 100644 --- a/src/cloudflare/types/snippets/snippet_rule_update_response.py +++ b/src/cloudflare/types/snippets/rule_update_response.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["SnippetRuleUpdateResponse", "SnippetRuleUpdateResponseItem"] +__all__ = ["RuleUpdateResponse", "RuleUpdateResponseItem"] -class SnippetRuleUpdateResponseItem(BaseModel): +class RuleUpdateResponseItem(BaseModel): description: Optional[str] = None enabled: Optional[bool] = None @@ -18,4 +18,4 @@ class SnippetRuleUpdateResponseItem(BaseModel): """Snippet identifying name""" -SnippetRuleUpdateResponse = List[SnippetRuleUpdateResponseItem] +RuleUpdateResponse = List[RuleUpdateResponseItem] diff --git a/src/cloudflare/types/workers/dispatch/__init__.py b/src/cloudflare/types/workers/dispatch/__init__.py deleted file mode 100644 index b2f53e35258..00000000000 --- a/src/cloudflare/types/workers/dispatch/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations diff --git a/src/cloudflare/types/workers/dispatch/namespaces/__init__.py b/src/cloudflare/types/workers/dispatch/namespaces/__init__.py deleted file mode 100644 index fc27379f5ad..00000000000 --- a/src/cloudflare/types/workers/dispatch/namespaces/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from .script_get_response import ScriptGetResponse as ScriptGetResponse -from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams -from .script_update_params import ScriptUpdateParams as ScriptUpdateParams -from .script_update_response import ScriptUpdateResponse as ScriptUpdateResponse diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py index b2f53e35258..fc27379f5ad 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/__init__.py @@ -1,3 +1,8 @@ # File generated from our OpenAPI spec by Stainless. from __future__ import annotations + +from .script_get_response import ScriptGetResponse as ScriptGetResponse +from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams +from .script_update_params import ScriptUpdateParams as ScriptUpdateParams +from .script_update_response import ScriptUpdateResponse as ScriptUpdateResponse diff --git a/src/cloudflare/types/workers/dispatch/namespaces/script_delete_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py similarity index 100% rename from src/cloudflare/types/workers/dispatch/namespaces/script_delete_params.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py diff --git a/src/cloudflare/types/workers/dispatch/namespaces/script_get_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_get_response.py similarity index 100% rename from src/cloudflare/types/workers/dispatch/namespaces/script_get_response.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_get_response.py diff --git a/src/cloudflare/types/workers/dispatch/namespaces/script_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py similarity index 100% rename from src/cloudflare/types/workers/dispatch/namespaces/script_update_params.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py diff --git a/src/cloudflare/types/workers/dispatch/namespaces/script_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py similarity index 100% rename from src/cloudflare/types/workers/dispatch/namespaces/script_update_response.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py index e305726412e..b2f53e35258 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py @@ -1,10 +1,3 @@ # File generated from our OpenAPI spec by Stainless. from __future__ import annotations - -from .setting_edit_params import SettingEditParams as SettingEditParams -from .binding_get_response import BindingGetResponse as BindingGetResponse -from .setting_get_response import SettingGetResponse as SettingGetResponse -from .content_update_params import ContentUpdateParams as ContentUpdateParams -from .setting_edit_response import SettingEditResponse as SettingEditResponse -from .content_update_response import ContentUpdateResponse as ContentUpdateResponse diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py new file mode 100644 index 00000000000..6b95e8f5dcc --- /dev/null +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from .setting_edit_params import SettingEditParams as SettingEditParams +from .binding_get_response import BindingGetResponse as BindingGetResponse +from .script_update_params import ScriptUpdateParams as ScriptUpdateParams +from .setting_get_response import SettingGetResponse as SettingGetResponse +from .setting_edit_response import SettingEditResponse as SettingEditResponse +from .script_update_response import ScriptUpdateResponse as ScriptUpdateResponse diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/binding_get_response.py similarity index 99% rename from src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/binding_get_response.py index 022a206aba6..0ff183cd20a 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/binding_get_response.py @@ -3,7 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal -from ......_models import BaseModel +from ......._models import BaseModel __all__ = [ "BindingGetResponse", diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/script_update_params.py similarity index 88% rename from src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/script_update_params.py index dfa0fa598bf..be614cf3db8 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/script_update_params.py @@ -5,13 +5,13 @@ from typing import List from typing_extensions import Required, Annotated, TypedDict -from ......_types import FileTypes -from ......_utils import PropertyInfo +from ......._types import FileTypes +from ......._utils import PropertyInfo -__all__ = ["ContentUpdateParams", "Metadata"] +__all__ = ["ScriptUpdateParams", "Metadata"] -class ContentUpdateParams(TypedDict, total=False): +class ScriptUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/script_update_response.py similarity index 91% rename from src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_response.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/script_update_response.py index 3a6aa6ddf43..b1d3cc30523 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/script_update_response.py @@ -3,9 +3,9 @@ from typing import List, Optional from datetime import datetime -from ......_models import BaseModel +from ......._models import BaseModel -__all__ = ["ContentUpdateResponse", "TailConsumer"] +__all__ = ["ScriptUpdateResponse", "TailConsumer"] class TailConsumer(BaseModel): @@ -19,7 +19,7 @@ class TailConsumer(BaseModel): """Optional dispatch namespace the script belongs to.""" -class ContentUpdateResponse(BaseModel): +class ScriptUpdateResponse(BaseModel): id: Optional[str] = None """The id of the script in the Workers system. Usually the script name.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_edit_params.py similarity index 100% rename from src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_edit_params.py diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_edit_response.py similarity index 99% rename from src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_edit_response.py index ef932fd46b2..fd4affc7b11 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_edit_response.py @@ -5,7 +5,7 @@ from pydantic import Field as FieldInfo -from ......_models import BaseModel +from ......._models import BaseModel __all__ = [ "SettingEditResponse", diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_get_response.py similarity index 99% rename from src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py rename to src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_get_response.py index db4face5107..eec56e0acaf 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content/setting_get_response.py @@ -5,7 +5,7 @@ from pydantic import Field as FieldInfo -from ......_models import BaseModel +from ......._models import BaseModel __all__ = [ "SettingGetResponse", diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index b1a4f08fcb9..1b6f6e49740 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -2,6 +2,8 @@ from __future__ import annotations +from .seat_edit_params import SeatEditParams as SeatEditParams +from .seat_edit_response import SeatEditResponse as SeatEditResponse from .tunnel_edit_params import TunnelEditParams as TunnelEditParams from .tunnel_list_params import TunnelListParams as TunnelListParams from .tunnel_get_response import TunnelGetResponse as TunnelGetResponse @@ -13,6 +15,20 @@ from .tunnel_create_response import TunnelCreateResponse as TunnelCreateResponse from .tunnel_delete_response import TunnelDeleteResponse as TunnelDeleteResponse from .gateway_create_response import GatewayCreateResponse as GatewayCreateResponse +from .organization_create_params import OrganizationCreateParams as OrganizationCreateParams +from .organization_list_response import OrganizationListResponse as OrganizationListResponse +from .organization_update_params import OrganizationUpdateParams as OrganizationUpdateParams +from .organization_create_response import OrganizationCreateResponse as OrganizationCreateResponse +from .organization_update_response import OrganizationUpdateResponse as OrganizationUpdateResponse +from .identity_provider_get_response import IdentityProviderGetResponse as IdentityProviderGetResponse +from .identity_provider_create_params import IdentityProviderCreateParams as IdentityProviderCreateParams +from .identity_provider_list_response import IdentityProviderListResponse as IdentityProviderListResponse +from .identity_provider_update_params import IdentityProviderUpdateParams as IdentityProviderUpdateParams from .connectivity_setting_edit_params import ConnectivitySettingEditParams as ConnectivitySettingEditParams +from .organization_revoke_users_params import OrganizationRevokeUsersParams as OrganizationRevokeUsersParams from .connectivity_setting_get_response import ConnectivitySettingGetResponse as ConnectivitySettingGetResponse +from .identity_provider_create_response import IdentityProviderCreateResponse as IdentityProviderCreateResponse +from .identity_provider_delete_response import IdentityProviderDeleteResponse as IdentityProviderDeleteResponse +from .identity_provider_update_response import IdentityProviderUpdateResponse as IdentityProviderUpdateResponse from .connectivity_setting_edit_response import ConnectivitySettingEditResponse as ConnectivitySettingEditResponse +from .organization_revoke_users_response import OrganizationRevokeUsersResponse as OrganizationRevokeUsersResponse diff --git a/src/cloudflare/types/zero_trust/access/__init__.py b/src/cloudflare/types/zero_trust/access/__init__.py index 87e2f8ec78d..3a2a4666a23 100644 --- a/src/cloudflare/types/zero_trust/access/__init__.py +++ b/src/cloudflare/types/zero_trust/access/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .seat_edit_params import SeatEditParams as SeatEditParams from .tag_get_response import TagGetResponse as TagGetResponse from .key_list_response import KeyListResponse as KeyListResponse from .key_update_params import KeyUpdateParams as KeyUpdateParams @@ -10,7 +9,6 @@ from .tag_list_response import TagListResponse as TagListResponse from .tag_update_params import TagUpdateParams as TagUpdateParams from .group_get_response import GroupGetResponse as GroupGetResponse -from .seat_edit_response import SeatEditResponse as SeatEditResponse from .user_list_response import UserListResponse as UserListResponse from .group_create_params import GroupCreateParams as GroupCreateParams from .group_list_response import GroupListResponse as GroupListResponse @@ -40,9 +38,6 @@ from .custom_page_create_params import CustomPageCreateParams as CustomPageCreateParams from .custom_page_list_response import CustomPageListResponse as CustomPageListResponse from .custom_page_update_params import CustomPageUpdateParams as CustomPageUpdateParams -from .organization_create_params import OrganizationCreateParams as OrganizationCreateParams -from .organization_list_response import OrganizationListResponse as OrganizationListResponse -from .organization_update_params import OrganizationUpdateParams as OrganizationUpdateParams from .application_create_response import ApplicationCreateResponse as ApplicationCreateResponse from .application_delete_response import ApplicationDeleteResponse as ApplicationDeleteResponse from .application_update_response import ApplicationUpdateResponse as ApplicationUpdateResponse @@ -55,19 +50,8 @@ from .service_token_create_params import ServiceTokenCreateParams as ServiceTokenCreateParams from .service_token_list_response import ServiceTokenListResponse as ServiceTokenListResponse from .service_token_update_params import ServiceTokenUpdateParams as ServiceTokenUpdateParams -from .organization_create_response import OrganizationCreateResponse as OrganizationCreateResponse -from .organization_update_response import OrganizationUpdateResponse as OrganizationUpdateResponse from .service_token_create_response import ServiceTokenCreateResponse as ServiceTokenCreateResponse from .service_token_delete_response import ServiceTokenDeleteResponse as ServiceTokenDeleteResponse from .service_token_rotate_response import ServiceTokenRotateResponse as ServiceTokenRotateResponse from .service_token_update_response import ServiceTokenUpdateResponse as ServiceTokenUpdateResponse -from .identity_provider_get_response import IdentityProviderGetResponse as IdentityProviderGetResponse from .service_token_refresh_response import ServiceTokenRefreshResponse as ServiceTokenRefreshResponse -from .identity_provider_create_params import IdentityProviderCreateParams as IdentityProviderCreateParams -from .identity_provider_list_response import IdentityProviderListResponse as IdentityProviderListResponse -from .identity_provider_update_params import IdentityProviderUpdateParams as IdentityProviderUpdateParams -from .organization_revoke_users_params import OrganizationRevokeUsersParams as OrganizationRevokeUsersParams -from .identity_provider_create_response import IdentityProviderCreateResponse as IdentityProviderCreateResponse -from .identity_provider_delete_response import IdentityProviderDeleteResponse as IdentityProviderDeleteResponse -from .identity_provider_update_response import IdentityProviderUpdateResponse as IdentityProviderUpdateResponse -from .organization_revoke_users_response import OrganizationRevokeUsersResponse as OrganizationRevokeUsersResponse diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_create_params.py b/src/cloudflare/types/zero_trust/identity_provider_create_params.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/identity_provider_create_params.py rename to src/cloudflare/types/zero_trust/identity_provider_create_params.py diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_create_response.py b/src/cloudflare/types/zero_trust/identity_provider_create_response.py similarity index 99% rename from src/cloudflare/types/zero_trust/access/identity_provider_create_response.py rename to src/cloudflare/types/zero_trust/identity_provider_create_response.py index bbb1b49ae86..50a5afd0754 100644 --- a/src/cloudflare/types/zero_trust/access/identity_provider_create_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_create_response.py @@ -3,7 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = [ "IdentityProviderCreateResponse", diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_delete_response.py b/src/cloudflare/types/zero_trust/identity_provider_delete_response.py similarity index 86% rename from src/cloudflare/types/zero_trust/access/identity_provider_delete_response.py rename to src/cloudflare/types/zero_trust/identity_provider_delete_response.py index 9710a65c1b5..e72acf80ecd 100644 --- a/src/cloudflare/types/zero_trust/access/identity_provider_delete_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_delete_response.py @@ -2,7 +2,7 @@ from typing import Optional -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["IdentityProviderDeleteResponse"] diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_get_response.py b/src/cloudflare/types/zero_trust/identity_provider_get_response.py similarity index 99% rename from src/cloudflare/types/zero_trust/access/identity_provider_get_response.py rename to src/cloudflare/types/zero_trust/identity_provider_get_response.py index a03fcf39287..c34714363ee 100644 --- a/src/cloudflare/types/zero_trust/access/identity_provider_get_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_get_response.py @@ -3,7 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = [ "IdentityProviderGetResponse", diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_list_response.py b/src/cloudflare/types/zero_trust/identity_provider_list_response.py similarity index 99% rename from src/cloudflare/types/zero_trust/access/identity_provider_list_response.py rename to src/cloudflare/types/zero_trust/identity_provider_list_response.py index 129d861a4df..39d3e3c1e1b 100644 --- a/src/cloudflare/types/zero_trust/access/identity_provider_list_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_list_response.py @@ -3,7 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = [ "IdentityProviderListResponse", diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_update_params.py b/src/cloudflare/types/zero_trust/identity_provider_update_params.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/identity_provider_update_params.py rename to src/cloudflare/types/zero_trust/identity_provider_update_params.py diff --git a/src/cloudflare/types/zero_trust/access/identity_provider_update_response.py b/src/cloudflare/types/zero_trust/identity_provider_update_response.py similarity index 99% rename from src/cloudflare/types/zero_trust/access/identity_provider_update_response.py rename to src/cloudflare/types/zero_trust/identity_provider_update_response.py index 19b6a04b018..061ef0e672e 100644 --- a/src/cloudflare/types/zero_trust/access/identity_provider_update_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_update_response.py @@ -3,7 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = [ "IdentityProviderUpdateResponse", diff --git a/src/cloudflare/types/zero_trust/access/organization_create_params.py b/src/cloudflare/types/zero_trust/organization_create_params.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/organization_create_params.py rename to src/cloudflare/types/zero_trust/organization_create_params.py diff --git a/src/cloudflare/types/zero_trust/access/organization_create_response.py b/src/cloudflare/types/zero_trust/organization_create_response.py similarity index 98% rename from src/cloudflare/types/zero_trust/access/organization_create_response.py rename to src/cloudflare/types/zero_trust/organization_create_response.py index 171377282fb..5954874cc33 100644 --- a/src/cloudflare/types/zero_trust/access/organization_create_response.py +++ b/src/cloudflare/types/zero_trust/organization_create_response.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OrganizationCreateResponse", "CustomPages", "LoginDesign"] diff --git a/src/cloudflare/types/zero_trust/access/organization_list_response.py b/src/cloudflare/types/zero_trust/organization_list_response.py similarity index 98% rename from src/cloudflare/types/zero_trust/access/organization_list_response.py rename to src/cloudflare/types/zero_trust/organization_list_response.py index d176f993ad8..aea3af2d293 100644 --- a/src/cloudflare/types/zero_trust/access/organization_list_response.py +++ b/src/cloudflare/types/zero_trust/organization_list_response.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OrganizationListResponse", "CustomPages", "LoginDesign"] diff --git a/src/cloudflare/types/zero_trust/access/organization_revoke_users_params.py b/src/cloudflare/types/zero_trust/organization_revoke_users_params.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/organization_revoke_users_params.py rename to src/cloudflare/types/zero_trust/organization_revoke_users_params.py diff --git a/src/cloudflare/types/zero_trust/access/organization_revoke_users_response.py b/src/cloudflare/types/zero_trust/organization_revoke_users_response.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/organization_revoke_users_response.py rename to src/cloudflare/types/zero_trust/organization_revoke_users_response.py diff --git a/src/cloudflare/types/zero_trust/access/organization_update_params.py b/src/cloudflare/types/zero_trust/organization_update_params.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/organization_update_params.py rename to src/cloudflare/types/zero_trust/organization_update_params.py diff --git a/src/cloudflare/types/zero_trust/access/organization_update_response.py b/src/cloudflare/types/zero_trust/organization_update_response.py similarity index 98% rename from src/cloudflare/types/zero_trust/access/organization_update_response.py rename to src/cloudflare/types/zero_trust/organization_update_response.py index 41f24f66900..afd40fcdff2 100644 --- a/src/cloudflare/types/zero_trust/access/organization_update_response.py +++ b/src/cloudflare/types/zero_trust/organization_update_response.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OrganizationUpdateResponse", "CustomPages", "LoginDesign"] diff --git a/src/cloudflare/types/zero_trust/access/seat_edit_params.py b/src/cloudflare/types/zero_trust/seat_edit_params.py similarity index 100% rename from src/cloudflare/types/zero_trust/access/seat_edit_params.py rename to src/cloudflare/types/zero_trust/seat_edit_params.py diff --git a/src/cloudflare/types/zero_trust/access/seat_edit_response.py b/src/cloudflare/types/zero_trust/seat_edit_response.py similarity index 94% rename from src/cloudflare/types/zero_trust/access/seat_edit_response.py rename to src/cloudflare/types/zero_trust/seat_edit_response.py index 604909f32c9..2bf92907a4e 100644 --- a/src/cloudflare/types/zero_trust/access/seat_edit_response.py +++ b/src/cloudflare/types/zero_trust/seat_edit_response.py @@ -3,7 +3,7 @@ from typing import List, Optional from datetime import datetime -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["SeatEditResponse", "SeatEditResponseItem"] diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index 6d699352276..e1b31c56f34 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -10,6 +10,10 @@ from .hold_delete_response import HoldDeleteResponse as HoldDeleteResponse from .setting_edit_response import SettingEditResponse as SettingEditResponse from .setting_list_response import SettingListResponse as SettingListResponse +from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse +from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams +from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse +from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse from .custom_nameserver_update_params import CustomNameserverUpdateParams as CustomNameserverUpdateParams from .activation_check_trigger_response import ActivationCheckTriggerResponse as ActivationCheckTriggerResponse diff --git a/src/cloudflare/types/zones/subscription_create_params.py b/src/cloudflare/types/zones/subscription_create_params.py new file mode 100644 index 00000000000..6845b6799c0 --- /dev/null +++ b/src/cloudflare/types/zones/subscription_create_params.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, TypedDict + +__all__ = ["SubscriptionCreateParams", "App", "ComponentValue", "RatePlan", "Zone"] + + +class SubscriptionCreateParams(TypedDict, total=False): + app: App + + component_values: Iterable[ComponentValue] + """The list of add-ons subscribed to.""" + + frequency: Literal["weekly", "monthly", "quarterly", "yearly"] + """How often the subscription is renewed automatically.""" + + rate_plan: RatePlan + """The rate plan applied to the subscription.""" + + zone: Zone + """A simple zone object. May have null properties if not a zone subscription.""" + + +class App(TypedDict, total=False): + install_id: str + """app install id.""" + + +class ComponentValue(TypedDict, total=False): + default: float + """The default amount assigned.""" + + name: str + """The name of the component value.""" + + price: float + """The unit price for the component value.""" + + value: float + """The amount of the component value assigned.""" + + +class RatePlan(TypedDict, total=False): + id: object + """The ID of the rate plan.""" + + currency: str + """The currency applied to the rate plan subscription.""" + + externally_managed: bool + """Whether this rate plan is managed externally from Cloudflare.""" + + is_contract: bool + """Whether a rate plan is enterprise-based (or newly adopted term contract).""" + + public_name: str + """The full name of the rate plan.""" + + scope: str + """The scope that this rate plan applies to.""" + + sets: List[str] + """The list of sets this rate plan applies to.""" + + +class Zone(TypedDict, total=False): + pass diff --git a/src/cloudflare/types/zones/subscription_create_response.py b/src/cloudflare/types/zones/subscription_create_response.py new file mode 100644 index 00000000000..7b702f6189f --- /dev/null +++ b/src/cloudflare/types/zones/subscription_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import Union, Optional + +__all__ = ["SubscriptionCreateResponse"] + +SubscriptionCreateResponse = Union[Optional[object], Optional[str]] diff --git a/src/cloudflare/types/zones/subscription_get_response.py b/src/cloudflare/types/zones/subscription_get_response.py new file mode 100644 index 00000000000..0cb7db3bf35 --- /dev/null +++ b/src/cloudflare/types/zones/subscription_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import Union, Optional + +__all__ = ["SubscriptionGetResponse"] + +SubscriptionGetResponse = Union[Optional[object], Optional[str]] diff --git a/src/cloudflare/types/zones/subscription_list_response.py b/src/cloudflare/types/zones/subscription_list_response.py new file mode 100644 index 00000000000..9a79ac6a5dd --- /dev/null +++ b/src/cloudflare/types/zones/subscription_list_response.py @@ -0,0 +1,106 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = [ + "SubscriptionListResponse", + "SubscriptionListResponseItem", + "SubscriptionListResponseItemApp", + "SubscriptionListResponseItemComponentValue", + "SubscriptionListResponseItemRatePlan", + "SubscriptionListResponseItemZone", +] + + +class SubscriptionListResponseItemApp(BaseModel): + install_id: Optional[str] = None + """app install id.""" + + +class SubscriptionListResponseItemComponentValue(BaseModel): + default: Optional[float] = None + """The default amount assigned.""" + + name: Optional[str] = None + """The name of the component value.""" + + price: Optional[float] = None + """The unit price for the component value.""" + + value: Optional[float] = None + """The amount of the component value assigned.""" + + +class SubscriptionListResponseItemRatePlan(BaseModel): + id: Optional[object] = None + """The ID of the rate plan.""" + + currency: Optional[str] = None + """The currency applied to the rate plan subscription.""" + + externally_managed: Optional[bool] = None + """Whether this rate plan is managed externally from Cloudflare.""" + + is_contract: Optional[bool] = None + """Whether a rate plan is enterprise-based (or newly adopted term contract).""" + + public_name: Optional[str] = None + """The full name of the rate plan.""" + + scope: Optional[str] = None + """The scope that this rate plan applies to.""" + + sets: Optional[List[str]] = None + """The list of sets this rate plan applies to.""" + + +class SubscriptionListResponseItemZone(BaseModel): + id: Optional[str] = None + """Identifier""" + + name: Optional[str] = None + """The domain name""" + + +class SubscriptionListResponseItem(BaseModel): + id: Optional[str] = None + """Subscription identifier tag.""" + + app: Optional[SubscriptionListResponseItemApp] = None + + component_values: Optional[List[SubscriptionListResponseItemComponentValue]] = None + """The list of add-ons subscribed to.""" + + currency: Optional[str] = None + """The monetary unit in which pricing information is displayed.""" + + current_period_end: Optional[datetime] = None + """The end of the current period and also when the next billing is due.""" + + current_period_start: Optional[datetime] = None + """When the current billing period started. + + May match initial_period_start if this is the first period. + """ + + frequency: Optional[Literal["weekly", "monthly", "quarterly", "yearly"]] = None + """How often the subscription is renewed automatically.""" + + price: Optional[float] = None + """The price of the subscription that will be billed, in US dollars.""" + + rate_plan: Optional[SubscriptionListResponseItemRatePlan] = None + """The rate plan applied to the subscription.""" + + state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None + """The state that the subscription is in.""" + + zone: Optional[SubscriptionListResponseItemZone] = None + """A simple zone object. May have null properties if not a zone subscription.""" + + +SubscriptionListResponse = List[SubscriptionListResponseItem] diff --git a/tests/api_resources/test_roles.py b/tests/api_resources/accounts/test_roles.py similarity index 85% rename from tests/api_resources/test_roles.py rename to tests/api_resources/accounts/test_roles.py index 46202e7e7c5..2032b5a48fc 100644 --- a/tests/api_resources/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import RoleGetResponse, RoleListResponse +from cloudflare.types.accounts import RoleGetResponse, RoleListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestRoles: @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - role = client.roles.list( + role = client.accounts.roles.list( account_id={}, ) assert_matches_type(Optional[RoleListResponse], role, path=["response"]) @@ -28,7 +28,7 @@ def test_method_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.roles.with_raw_response.list( + response = client.accounts.roles.with_raw_response.list( account_id={}, ) @@ -40,7 +40,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.roles.with_streaming_response.list( + with client.accounts.roles.with_streaming_response.list( account_id={}, ) as response: assert not response.is_closed @@ -54,7 +54,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - role = client.roles.get( + role = client.accounts.roles.get( {}, account_id={}, ) @@ -63,7 +63,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.roles.with_raw_response.get( + response = client.accounts.roles.with_raw_response.get( {}, account_id={}, ) @@ -76,7 +76,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.roles.with_streaming_response.get( + with client.accounts.roles.with_streaming_response.get( {}, account_id={}, ) as response: @@ -95,7 +95,7 @@ class TestAsyncRoles: @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - role = await async_client.roles.list( + role = await async_client.accounts.roles.list( account_id={}, ) assert_matches_type(Optional[RoleListResponse], role, path=["response"]) @@ -103,7 +103,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.roles.with_raw_response.list( + response = await async_client.accounts.roles.with_raw_response.list( account_id={}, ) @@ -115,7 +115,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.roles.with_streaming_response.list( + async with async_client.accounts.roles.with_streaming_response.list( account_id={}, ) as response: assert not response.is_closed @@ -129,7 +129,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - role = await async_client.roles.get( + role = await async_client.accounts.roles.get( {}, account_id={}, ) @@ -138,7 +138,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.roles.with_raw_response.get( + response = await async_client.accounts.roles.with_raw_response.get( {}, account_id={}, ) @@ -151,7 +151,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.roles.with_streaming_response.get( + async with async_client.accounts.roles.with_streaming_response.get( {}, account_id={}, ) as response: diff --git a/tests/api_resources/radar/test_as112.py b/tests/api_resources/radar/test_as112.py index edd50df664f..229c6dfba46 100644 --- a/tests/api_resources/radar/test_as112.py +++ b/tests/api_resources/radar/test_as112.py @@ -10,19 +10,19 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar import As112TimeseriesResponse +from cloudflare.types.radar import AS112TimeseriesResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestAs112: +class TestAS112: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize def test_method_timeseries(self, client: Cloudflare) -> None: as112 = client.radar.as112.timeseries() - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,7 +46,7 @@ def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None: location=["string", "string", "string"], name=["string", "string", "string"], ) - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_raw_response_timeseries(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" as112 = response.parse() - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) @pytest.mark.skip() @parametrize @@ -66,19 +66,19 @@ def test_streaming_response_timeseries(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" as112 = response.parse() - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncAs112: +class TestAsyncAS112: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize async def test_method_timeseries(self, async_client: AsyncCloudflare) -> None: as112 = await async_client.radar.as112.timeseries() - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +102,7 @@ async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudf location=["string", "string", "string"], name=["string", "string", "string"], ) - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ async def test_raw_response_timeseries(self, async_client: AsyncCloudflare) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" as112 = await response.parse() - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,6 +122,6 @@ async def test_streaming_response_timeseries(self, async_client: AsyncCloudflare assert response.http_request.headers.get("X-Stainless-Lang") == "python" as112 = await response.parse() - assert_matches_type(As112TimeseriesResponse, as112, path=["response"]) + assert_matches_type(AS112TimeseriesResponse, as112, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/snippets/test_snippet_rules.py b/tests/api_resources/snippets/test_rules.py similarity index 69% rename from tests/api_resources/snippets/test_snippet_rules.py rename to tests/api_resources/snippets/test_rules.py index b35ef54611f..0858db43b6b 100644 --- a/tests/api_resources/snippets/test_snippet_rules.py +++ b/tests/api_resources/snippets/test_rules.py @@ -9,26 +9,26 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.snippets import SnippetRuleListResponse, SnippetRuleUpdateResponse +from cloudflare.types.snippets import RuleListResponse, RuleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestSnippetRules: +class TestRules: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - snippet_rule = client.snippets.snippet_rules.update( + rule = client.snippets.rules.update( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - snippet_rule = client.snippets.snippet_rules.update( + rule = client.snippets.rules.update( "023e105f4ecef8ad9ca31a8372d0c353", rules=[ { @@ -51,31 +51,31 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.snippets.snippet_rules.with_raw_response.update( + response = client.snippets.rules.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = response.parse() - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + rule = response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.snippets.snippet_rules.with_streaming_response.update( + with client.snippets.rules.with_streaming_response.update( "023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = response.parse() - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + rule = response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -83,41 +83,41 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.snippets.snippet_rules.with_raw_response.update( + client.snippets.rules.with_raw_response.update( "", ) @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - snippet_rule = client.snippets.snippet_rules.list( + rule = client.snippets.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SnippetRuleListResponse, snippet_rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.snippets.snippet_rules.with_raw_response.list( + response = client.snippets.rules.with_raw_response.list( "023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = response.parse() - assert_matches_type(SnippetRuleListResponse, snippet_rule, path=["response"]) + rule = response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.snippets.snippet_rules.with_streaming_response.list( + with client.snippets.rules.with_streaming_response.list( "023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = response.parse() - assert_matches_type(SnippetRuleListResponse, snippet_rule, path=["response"]) + rule = response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -125,26 +125,26 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.snippets.snippet_rules.with_raw_response.list( + client.snippets.rules.with_raw_response.list( "", ) -class TestAsyncSnippetRules: +class TestAsyncRules: 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: - snippet_rule = await async_client.snippets.snippet_rules.update( + rule = await async_client.snippets.rules.update( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - snippet_rule = await async_client.snippets.snippet_rules.update( + rule = await async_client.snippets.rules.update( "023e105f4ecef8ad9ca31a8372d0c353", rules=[ { @@ -167,31 +167,31 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, ], ) - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.snippets.snippet_rules.with_raw_response.update( + response = await async_client.snippets.rules.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = await response.parse() - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.snippets.snippet_rules.with_streaming_response.update( + async with async_client.snippets.rules.with_streaming_response.update( "023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = await response.parse() - assert_matches_type(SnippetRuleUpdateResponse, snippet_rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -199,41 +199,41 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.snippets.snippet_rules.with_raw_response.update( + await async_client.snippets.rules.with_raw_response.update( "", ) @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - snippet_rule = await async_client.snippets.snippet_rules.list( + rule = await async_client.snippets.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SnippetRuleListResponse, snippet_rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.snippets.snippet_rules.with_raw_response.list( + response = await async_client.snippets.rules.with_raw_response.list( "023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = await response.parse() - assert_matches_type(SnippetRuleListResponse, snippet_rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.snippets.snippet_rules.with_streaming_response.list( + async with async_client.snippets.rules.with_streaming_response.list( "023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - snippet_rule = await response.parse() - assert_matches_type(SnippetRuleListResponse, snippet_rule, path=["response"]) + rule = await response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -241,6 +241,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.snippets.snippet_rules.with_raw_response.list( + await async_client.snippets.rules.with_raw_response.list( "", ) diff --git a/tests/api_resources/test_url_normalizations.py b/tests/api_resources/test_url_normalization.py similarity index 86% rename from tests/api_resources/test_url_normalizations.py rename to tests/api_resources/test_url_normalization.py index 60cc946b807..e2a263d824a 100644 --- a/tests/api_resources/test_url_normalizations.py +++ b/tests/api_resources/test_url_normalization.py @@ -17,13 +17,13 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestURLNormalizations: +class TestURLNormalization: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - url_normalization = client.url_normalizations.update( + url_normalization = client.url_normalization.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) @@ -31,7 +31,7 @@ def test_method_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - url_normalization = client.url_normalizations.update( + url_normalization = client.url_normalization.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", scope="incoming", type="cloudflare", @@ -41,7 +41,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.url_normalizations.with_raw_response.update( + response = client.url_normalization.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -53,7 +53,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.url_normalizations.with_streaming_response.update( + with client.url_normalization.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -68,14 +68,14 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @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.url_normalizations.with_raw_response.update( + client.url_normalization.with_raw_response.update( zone_id="", ) @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - url_normalization = client.url_normalizations.get( + url_normalization = client.url_normalization.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(URLNormalizationGetResponse, url_normalization, path=["response"]) @@ -83,7 +83,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.url_normalizations.with_raw_response.get( + response = client.url_normalization.with_raw_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -95,7 +95,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.url_normalizations.with_streaming_response.get( + with client.url_normalization.with_streaming_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -110,18 +110,18 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @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.url_normalizations.with_raw_response.get( + client.url_normalization.with_raw_response.get( zone_id="", ) -class TestAsyncURLNormalizations: +class TestAsyncURLNormalization: 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: - url_normalization = await async_client.url_normalizations.update( + url_normalization = await async_client.url_normalization.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(URLNormalizationUpdateResponse, url_normalization, path=["response"]) @@ -129,7 +129,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - url_normalization = await async_client.url_normalizations.update( + url_normalization = await async_client.url_normalization.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", scope="incoming", type="cloudflare", @@ -139,7 +139,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.url_normalizations.with_raw_response.update( + response = await async_client.url_normalization.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -151,7 +151,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.url_normalizations.with_streaming_response.update( + async with async_client.url_normalization.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -166,14 +166,14 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @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.url_normalizations.with_raw_response.update( + await async_client.url_normalization.with_raw_response.update( zone_id="", ) @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - url_normalization = await async_client.url_normalizations.get( + url_normalization = await async_client.url_normalization.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(URLNormalizationGetResponse, url_normalization, path=["response"]) @@ -181,7 +181,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.url_normalizations.with_raw_response.get( + response = await async_client.url_normalization.with_raw_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -193,7 +193,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.url_normalizations.with_streaming_response.get( + async with async_client.url_normalization.with_streaming_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -208,6 +208,6 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @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.url_normalizations.with_raw_response.get( + await async_client.url_normalization.with_raw_response.get( zone_id="", ) diff --git a/tests/api_resources/workers/dispatch/namespaces/__init__.py b/tests/api_resources/workers/dispatch/namespaces/__init__.py deleted file mode 100644 index 1016754ef33..00000000000 --- a/tests/api_resources/workers/dispatch/namespaces/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. diff --git a/tests/api_resources/workers/dispatch/__init__.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py similarity index 100% rename from tests/api_resources/workers/dispatch/__init__.py rename to tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/__init__.py diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_bindings.py similarity index 86% rename from tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py rename to tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_bindings.py index 018f763e07c..e1890438f27 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_bindings.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.content import BindingGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestBindings: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - binding = client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get( + binding = client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -30,7 +30,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + response = client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -44,7 +44,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_streaming_response.get( + with client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -61,21 +61,21 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @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_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -88,7 +88,7 @@ class TestAsyncBindings: @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - binding = await async_client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get( + binding = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -98,10 +98,12 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", + response = ( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) ) assert response.is_closed is True @@ -112,7 +114,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_streaming_response.get( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -129,21 +131,21 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @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_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.bindings.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.bindings.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_scripts.py similarity index 70% rename from tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py rename to tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_scripts.py index 939c02115ba..fb83f50f007 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_scripts.py @@ -17,30 +17,30 @@ StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) -from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( - ContentUpdateResponse, +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.content import ( + ScriptUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestContent: +class TestScripts: 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_for_platforms.dispatch.namespaces.scripts.content.update( + script = client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - content = client.workers_for_platforms.dispatch.namespaces.scripts.content.update( + script = client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -50,12 +50,12 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "main_module": "worker.js", }, ) - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( + response = client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -63,13 +63,13 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = response.parse() - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + script = response.parse() + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers_for_platforms.dispatch.namespaces.scripts.content.with_streaming_response.update( + with client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_streaming_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -77,8 +77,8 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = response.parse() - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + script = response.parse() + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,21 +86,21 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @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_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( + client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( + client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( + client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -113,15 +113,15 @@ def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: respx_mock.get( "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/dispatch/namespaces/my-dispatch-namespace/scripts/this-is_my_script-01/content" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = client.workers_for_platforms.dispatch.namespaces.scripts.content.get( + script = client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert content.is_closed - assert content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, BinaryAPIResponse) + 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 @@ -131,16 +131,16 @@ def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> N "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/dispatch/namespaces/my-dispatch-namespace/scripts/this-is_my_script-01/content" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + script = client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - 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) + 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 @@ -149,63 +149,63 @@ def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter respx_mock.get( "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/dispatch/namespaces/my-dispatch-namespace/scripts/this-is_my_script-01/content" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.workers_for_platforms.dispatch.namespaces.scripts.content.with_streaming_response.get( + with client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - ) as content: - assert not content.is_closed - assert content.http_request.headers.get("X-Stainless-Lang") == "python" + ) as script: + assert not script.is_closed + assert script.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 script.json() == {"foo": "bar"} + assert cast(Any, script.is_closed) is True + assert isinstance(script, StreamedBinaryAPIResponse) - assert cast(Any, content.is_closed) is True + 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 `account_id` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) -class TestAsyncContent: +class TestAsyncScripts: 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_for_platforms.dispatch.namespaces.scripts.content.update( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - content = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.update( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -215,28 +215,26 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "main_module": "worker.js", }, ) - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = ( - await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - ) + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = await response.parse() - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + script = await response.parse() + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_streaming_response.update( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_streaming_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -244,8 +242,8 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = await response.parse() - assert_matches_type(ContentUpdateResponse, content, path=["response"]) + script = await response.parse() + assert_matches_type(ScriptUpdateResponse, script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -253,24 +251,30 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @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_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( - "this-is_my_script-01", - account_id="", - dispatch_namespace="my-dispatch-namespace", + await ( + async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( + "this-is_my_script-01", + account_id="", + dispatch_namespace="my-dispatch-namespace", + ) ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="", + await ( + async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + ) ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.update( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", + await ( + async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) ) @pytest.mark.skip() @@ -280,15 +284,15 @@ async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockR respx_mock.get( "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/dispatch/namespaces/my-dispatch-namespace/scripts/this-is_my_script-01/content" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.get( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert content.is_closed - assert await content.json() == {"foo": "bar"} - assert cast(Any, content.is_closed) is True - assert isinstance(content, AsyncBinaryAPIResponse) + 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 @@ -298,16 +302,18 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/dispatch/namespaces/my-dispatch-namespace/scripts/this-is_my_script-01/content" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - content = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", + script = ( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) ) - 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) + 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 @@ -316,40 +322,40 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx respx_mock.get( "/accounts/023e105f4ecef8ad9ca31a8372d0c353/workers/dispatch/namespaces/my-dispatch-namespace/scripts/this-is_my_script-01/content" ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_streaming_response.get( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - ) as content: - assert not content.is_closed - assert content.http_request.headers.get("X-Stainless-Lang") == "python" + ) as script: + assert not script.is_closed + assert script.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 await script.json() == {"foo": "bar"} + assert cast(Any, script.is_closed) is True + assert isinstance(script, AsyncStreamedBinaryAPIResponse) - assert cast(Any, content.is_closed) is True + 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 `account_id` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.scripts.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_settings.py similarity index 83% rename from tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py rename to tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_settings.py index 5ae7dc8711b..a00a31ee66b 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/content/test_settings.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( +from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts.content import ( SettingGetResponse, SettingEditResponse, ) @@ -23,7 +23,7 @@ class TestSettings: @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: - setting = client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit( + setting = client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -63,7 +63,7 @@ def test_method_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - setting = client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit( + setting = client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -169,7 +169,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( + response = client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -213,7 +213,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_streaming_response.edit( + with client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_streaming_response.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -260,7 +260,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @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_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( + client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", @@ -297,7 +297,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( + client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", @@ -334,7 +334,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( + client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -373,7 +373,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - setting = client.workers_for_platforms.dispatch.namespaces.scripts.settings.get( + setting = client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -383,7 +383,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + response = client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -397,7 +397,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_streaming_response.get( + with client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -414,21 +414,21 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @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_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -441,7 +441,7 @@ class TestAsyncSettings: @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit( + setting = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -481,7 +481,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - setting = await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit( + setting = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -587,7 +587,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -631,7 +631,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_streaming_response.edit( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_streaming_response.edit( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -678,120 +678,126 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @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_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( - "this-is_my_script-01", - account_id="", - dispatch_namespace="my-dispatch-namespace", - 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, + await ( + async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( + "this-is_my_script-01", + account_id="", + dispatch_namespace="my-dispatch-namespace", + 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 `dispatch_namespace` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="", - 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, + await ( + async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="", + 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 `script_name` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.edit( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", - 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, + await ( + async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + 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_for_platforms.dispatch.namespaces.scripts.settings.get( + setting = await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -801,10 +807,12 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( - "this-is_my_script-01", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - dispatch_namespace="my-dispatch-namespace", + response = ( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + dispatch_namespace="my-dispatch-namespace", + ) ) assert response.is_closed is True @@ -815,7 +823,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_streaming_response.get( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -832,21 +840,21 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @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_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers_for_platforms.dispatch.namespaces.scripts.settings.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.content.settings.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", diff --git a/tests/api_resources/workers/dispatch/namespaces/test_scripts.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py similarity index 84% rename from tests/api_resources/workers/dispatch/namespaces/test_scripts.py rename to tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py index 4ad17f3a805..3eb4769d8e3 100644 --- a/tests/api_resources/workers/dispatch/namespaces/test_scripts.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.workers.dispatch.namespaces import ( +from cloudflare.types.workers_for_platforms.dispatch.namespaces import ( ScriptGetResponse, ScriptUpdateResponse, ) @@ -23,7 +23,7 @@ class TestScripts: @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - script = client.workers.dispatch.namespaces.scripts.update( + script = client.workers_for_platforms.dispatch.namespaces.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -33,7 +33,7 @@ def test_method_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - script = client.workers.dispatch.namespaces.scripts.update( + script = client.workers_for_platforms.dispatch.namespaces.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -112,7 +112,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.workers.dispatch.namespaces.scripts.with_raw_response.update( + response = client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -126,7 +126,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.workers.dispatch.namespaces.scripts.with_streaming_response.update( + with client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -143,21 +143,21 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @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.dispatch.namespaces.scripts.with_raw_response.update( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.update( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.update( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -166,7 +166,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_delete(self, client: Cloudflare) -> None: - script = client.workers.dispatch.namespaces.scripts.delete( + script = client.workers_for_platforms.dispatch.namespaces.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -176,7 +176,7 @@ def test_method_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - script = client.workers.dispatch.namespaces.scripts.delete( + script = client.workers_for_platforms.dispatch.namespaces.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -187,7 +187,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + response = client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -201,7 +201,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.workers.dispatch.namespaces.scripts.with_streaming_response.delete( + with client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -218,21 +218,21 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -241,7 +241,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - script = client.workers.dispatch.namespaces.scripts.get( + script = client.workers_for_platforms.dispatch.namespaces.scripts.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -251,7 +251,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.workers.dispatch.namespaces.scripts.with_raw_response.get( + response = client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -265,7 +265,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.workers.dispatch.namespaces.scripts.with_streaming_response.get( + with client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -282,21 +282,21 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @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.dispatch.namespaces.scripts.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - client.workers.dispatch.namespaces.scripts.with_raw_response.get( + client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -309,7 +309,7 @@ class TestAsyncScripts: @pytest.mark.skip() @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.dispatch.namespaces.scripts.update( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -319,7 +319,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.dispatch.namespaces.scripts.update( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -398,7 +398,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.dispatch.namespaces.scripts.with_raw_response.update( + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -412,7 +412,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.dispatch.namespaces.scripts.with_streaming_response.update( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -429,21 +429,21 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @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.dispatch.namespaces.scripts.with_raw_response.update( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers.dispatch.namespaces.scripts.with_raw_response.update( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.dispatch.namespaces.scripts.with_raw_response.update( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.update( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -452,7 +452,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.dispatch.namespaces.scripts.delete( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -462,7 +462,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.dispatch.namespaces.scripts.delete( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -473,7 +473,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -487,7 +487,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.dispatch.namespaces.scripts.with_streaming_response.delete( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -504,21 +504,21 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_delete(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.dispatch.namespaces.scripts.with_raw_response.delete( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.dispatch.namespaces.scripts.with_raw_response.delete( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.delete( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -527,7 +527,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - script = await async_client.workers.dispatch.namespaces.scripts.get( + script = await async_client.workers_for_platforms.dispatch.namespaces.scripts.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -537,7 +537,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.dispatch.namespaces.scripts.with_raw_response.get( + response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -551,7 +551,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.dispatch.namespaces.scripts.with_streaming_response.get( + async with async_client.workers_for_platforms.dispatch.namespaces.scripts.with_streaming_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", @@ -568,21 +568,21 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @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.dispatch.namespaces.scripts.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): - await async_client.workers.dispatch.namespaces.scripts.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): - await async_client.workers.dispatch.namespaces.scripts.with_raw_response.get( + await async_client.workers_for_platforms.dispatch.namespaces.scripts.with_raw_response.get( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", diff --git a/tests/api_resources/zero_trust/access/test_identity_providers.py b/tests/api_resources/zero_trust/test_identity_providers.py similarity index 86% rename from tests/api_resources/zero_trust/access/test_identity_providers.py rename to tests/api_resources/zero_trust/test_identity_providers.py index 5d19da97aa7..23064c5d7d0 100644 --- a/tests/api_resources/zero_trust/access/test_identity_providers.py +++ b/tests/api_resources/zero_trust/test_identity_providers.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import ( +from cloudflare.types.zero_trust import ( IdentityProviderGetResponse, IdentityProviderListResponse, IdentityProviderCreateResponse, @@ -26,7 +26,7 @@ class TestIdentityProviders: @pytest.mark.skip() @parametrize def test_method_create(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.create( + identity_provider = client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -38,7 +38,7 @@ def test_method_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.create( + identity_provider = client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -96,7 +96,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.identity_providers.with_raw_response.create( + response = client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -112,7 +112,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.identity_providers.with_streaming_response.create( + with client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -131,7 +131,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @parametrize def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.create( + client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -140,7 +140,7 @@ 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.zero_trust.access.identity_providers.with_raw_response.create( + client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -151,7 +151,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.update( + identity_provider = client.zero_trust.identity_providers.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -164,7 +164,7 @@ def test_method_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.update( + identity_provider = client.zero_trust.identity_providers.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={ "client_id": "", @@ -223,7 +223,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.identity_providers.with_raw_response.update( + response = client.zero_trust.identity_providers.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -240,7 +240,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.identity_providers.with_streaming_response.update( + with client.zero_trust.identity_providers.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -260,7 +260,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.update( + client.zero_trust.identity_providers.with_raw_response.update( "", config={}, name="Widget Corps IDP", @@ -270,7 +270,7 @@ 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.zero_trust.access.identity_providers.with_raw_response.update( + client.zero_trust.identity_providers.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -280,7 +280,7 @@ 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.zero_trust.access.identity_providers.with_raw_response.update( + client.zero_trust.identity_providers.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -292,7 +292,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.list( + identity_provider = client.zero_trust.identity_providers.list( account_id="string", zone_id="string", ) @@ -301,7 +301,7 @@ def test_method_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.list( + identity_provider = client.zero_trust.identity_providers.list( account_id="string", zone_id="string", ) @@ -310,7 +310,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.identity_providers.with_raw_response.list( + response = client.zero_trust.identity_providers.with_raw_response.list( account_id="string", zone_id="string", ) @@ -323,7 +323,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.identity_providers.with_streaming_response.list( + with client.zero_trust.identity_providers.with_streaming_response.list( account_id="string", zone_id="string", ) as response: @@ -339,13 +339,13 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.list( + client.zero_trust.identity_providers.with_raw_response.list( account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.list( + client.zero_trust.identity_providers.with_raw_response.list( account_id="string", zone_id="", ) @@ -353,7 +353,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_delete(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.delete( + identity_provider = client.zero_trust.identity_providers.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -363,7 +363,7 @@ def test_method_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_delete_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.delete( + identity_provider = client.zero_trust.identity_providers.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -373,7 +373,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.access.identity_providers.with_raw_response.delete( + response = client.zero_trust.identity_providers.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -387,7 +387,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.access.identity_providers.with_streaming_response.delete( + with client.zero_trust.identity_providers.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -404,21 +404,21 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.delete( + client.zero_trust.identity_providers.with_raw_response.delete( "", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.delete( + client.zero_trust.identity_providers.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.delete( + client.zero_trust.identity_providers.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="", @@ -427,7 +427,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.get( + identity_provider = client.zero_trust.identity_providers.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -437,7 +437,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: - identity_provider = client.zero_trust.access.identity_providers.get( + identity_provider = client.zero_trust.identity_providers.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -447,7 +447,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.access.identity_providers.with_raw_response.get( + response = client.zero_trust.identity_providers.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -461,7 +461,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.access.identity_providers.with_streaming_response.get( + with client.zero_trust.identity_providers.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -478,21 +478,21 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.get( + client.zero_trust.identity_providers.with_raw_response.get( "", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.get( + client.zero_trust.identity_providers.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.identity_providers.with_raw_response.get( + client.zero_trust.identity_providers.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="", @@ -505,7 +505,7 @@ class TestAsyncIdentityProviders: @pytest.mark.skip() @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.create( + identity_provider = await async_client.zero_trust.identity_providers.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -517,7 +517,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.create( + identity_provider = await async_client.zero_trust.identity_providers.create( config={ "client_id": "", "client_secret": "", @@ -575,7 +575,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.identity_providers.with_raw_response.create( + response = await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -591,7 +591,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.identity_providers.with_streaming_response.create( + async with async_client.zero_trust.identity_providers.with_streaming_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -610,7 +610,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.create( + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -619,7 +619,7 @@ 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.zero_trust.access.identity_providers.with_raw_response.create( + await async_client.zero_trust.identity_providers.with_raw_response.create( config={}, name="Widget Corps IDP", type="onetimepin", @@ -630,7 +630,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.update( + identity_provider = await async_client.zero_trust.identity_providers.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -643,7 +643,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.update( + identity_provider = await async_client.zero_trust.identity_providers.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={ "client_id": "", @@ -702,7 +702,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.identity_providers.with_raw_response.update( + response = await async_client.zero_trust.identity_providers.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -719,7 +719,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.identity_providers.with_streaming_response.update( + async with async_client.zero_trust.identity_providers.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -739,7 +739,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.update( + await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, name="Widget Corps IDP", @@ -749,7 +749,7 @@ 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.zero_trust.access.identity_providers.with_raw_response.update( + await async_client.zero_trust.identity_providers.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -759,7 +759,7 @@ 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.zero_trust.access.identity_providers.with_raw_response.update( + await async_client.zero_trust.identity_providers.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", config={}, name="Widget Corps IDP", @@ -771,7 +771,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.list( + identity_provider = await async_client.zero_trust.identity_providers.list( account_id="string", zone_id="string", ) @@ -780,7 +780,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.list( + identity_provider = await async_client.zero_trust.identity_providers.list( account_id="string", zone_id="string", ) @@ -789,7 +789,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.identity_providers.with_raw_response.list( + response = await async_client.zero_trust.identity_providers.with_raw_response.list( account_id="string", zone_id="string", ) @@ -802,7 +802,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.identity_providers.with_streaming_response.list( + async with async_client.zero_trust.identity_providers.with_streaming_response.list( account_id="string", zone_id="string", ) as response: @@ -818,13 +818,13 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.list( + await async_client.zero_trust.identity_providers.with_raw_response.list( account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.list( + await async_client.zero_trust.identity_providers.with_raw_response.list( account_id="string", zone_id="", ) @@ -832,7 +832,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.delete( + identity_provider = await async_client.zero_trust.identity_providers.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -842,7 +842,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.delete( + identity_provider = await async_client.zero_trust.identity_providers.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -852,7 +852,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.identity_providers.with_raw_response.delete( + response = await async_client.zero_trust.identity_providers.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -866,7 +866,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.identity_providers.with_streaming_response.delete( + async with async_client.zero_trust.identity_providers.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -883,21 +883,21 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.delete( + await async_client.zero_trust.identity_providers.with_raw_response.delete( "", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.delete( + await async_client.zero_trust.identity_providers.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.delete( + await async_client.zero_trust.identity_providers.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="", @@ -906,7 +906,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.get( + identity_provider = await async_client.zero_trust.identity_providers.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -916,7 +916,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - identity_provider = await async_client.zero_trust.access.identity_providers.get( + identity_provider = await async_client.zero_trust.identity_providers.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -926,7 +926,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.identity_providers.with_raw_response.get( + response = await async_client.zero_trust.identity_providers.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -940,7 +940,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.identity_providers.with_streaming_response.get( + async with async_client.zero_trust.identity_providers.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="string", @@ -957,21 +957,21 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.get( + await async_client.zero_trust.identity_providers.with_raw_response.get( "", account_id="string", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.get( + await async_client.zero_trust.identity_providers.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.identity_providers.with_raw_response.get( + await async_client.zero_trust.identity_providers.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", zone_id="", diff --git a/tests/api_resources/zero_trust/access/test_organizations.py b/tests/api_resources/zero_trust/test_organizations.py similarity index 85% rename from tests/api_resources/zero_trust/access/test_organizations.py rename to tests/api_resources/zero_trust/test_organizations.py index ddff807d44f..4fe95179f59 100644 --- a/tests/api_resources/zero_trust/access/test_organizations.py +++ b/tests/api_resources/zero_trust/test_organizations.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import ( +from cloudflare.types.zero_trust import ( OrganizationListResponse, OrganizationCreateResponse, OrganizationUpdateResponse, @@ -25,7 +25,7 @@ class TestOrganizations: @pytest.mark.skip() @parametrize def test_method_create(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.create( + organization = client.zero_trust.organizations.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -36,7 +36,7 @@ def test_method_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.create( + organization = client.zero_trust.organizations.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -61,7 +61,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.access.organizations.with_raw_response.create( + response = client.zero_trust.organizations.with_raw_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -76,7 +76,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.access.organizations.with_streaming_response.create( + with client.zero_trust.organizations.with_streaming_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -94,7 +94,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @parametrize def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.organizations.with_raw_response.create( + client.zero_trust.organizations.with_raw_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="", @@ -102,7 +102,7 @@ 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.zero_trust.access.organizations.with_raw_response.create( + client.zero_trust.organizations.with_raw_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -112,7 +112,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.update( + organization = client.zero_trust.organizations.update( account_id="string", zone_id="string", ) @@ -121,7 +121,7 @@ def test_method_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.update( + organization = client.zero_trust.organizations.update( account_id="string", zone_id="string", allow_authenticate_via_warp=True, @@ -150,7 +150,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.access.organizations.with_raw_response.update( + response = client.zero_trust.organizations.with_raw_response.update( account_id="string", zone_id="string", ) @@ -163,7 +163,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.access.organizations.with_streaming_response.update( + with client.zero_trust.organizations.with_streaming_response.update( account_id="string", zone_id="string", ) as response: @@ -179,13 +179,13 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @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.zero_trust.access.organizations.with_raw_response.update( + client.zero_trust.organizations.with_raw_response.update( account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.organizations.with_raw_response.update( + client.zero_trust.organizations.with_raw_response.update( account_id="string", zone_id="", ) @@ -193,7 +193,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.list( + organization = client.zero_trust.organizations.list( account_id="string", zone_id="string", ) @@ -202,7 +202,7 @@ def test_method_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.list( + organization = client.zero_trust.organizations.list( account_id="string", zone_id="string", ) @@ -211,7 +211,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.access.organizations.with_raw_response.list( + response = client.zero_trust.organizations.with_raw_response.list( account_id="string", zone_id="string", ) @@ -224,7 +224,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.access.organizations.with_streaming_response.list( + with client.zero_trust.organizations.with_streaming_response.list( account_id="string", zone_id="string", ) as response: @@ -240,13 +240,13 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.organizations.with_raw_response.list( + client.zero_trust.organizations.with_raw_response.list( account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.organizations.with_raw_response.list( + client.zero_trust.organizations.with_raw_response.list( account_id="string", zone_id="", ) @@ -254,7 +254,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_revoke_users(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.revoke_users( + organization = client.zero_trust.organizations.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -264,7 +264,7 @@ def test_method_revoke_users(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_revoke_users_with_all_params(self, client: Cloudflare) -> None: - organization = client.zero_trust.access.organizations.revoke_users( + organization = client.zero_trust.organizations.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -274,7 +274,7 @@ def test_method_revoke_users_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_revoke_users(self, client: Cloudflare) -> None: - response = client.zero_trust.access.organizations.with_raw_response.revoke_users( + response = client.zero_trust.organizations.with_raw_response.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -288,7 +288,7 @@ def test_raw_response_revoke_users(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_revoke_users(self, client: Cloudflare) -> None: - with client.zero_trust.access.organizations.with_streaming_response.revoke_users( + with client.zero_trust.organizations.with_streaming_response.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -305,14 +305,14 @@ def test_streaming_response_revoke_users(self, client: Cloudflare) -> None: @parametrize def test_path_params_revoke_users(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.access.organizations.with_raw_response.revoke_users( + client.zero_trust.organizations.with_raw_response.revoke_users( email="test@example.com", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zero_trust.access.organizations.with_raw_response.revoke_users( + client.zero_trust.organizations.with_raw_response.revoke_users( email="test@example.com", account_id="string", zone_id="", @@ -325,7 +325,7 @@ class TestAsyncOrganizations: @pytest.mark.skip() @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.create( + organization = await async_client.zero_trust.organizations.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -336,7 +336,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.create( + organization = await async_client.zero_trust.organizations.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -361,7 +361,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.organizations.with_raw_response.create( + response = await async_client.zero_trust.organizations.with_raw_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -376,7 +376,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.organizations.with_streaming_response.create( + async with async_client.zero_trust.organizations.with_streaming_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -394,7 +394,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.organizations.with_raw_response.create( + await async_client.zero_trust.organizations.with_raw_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="", @@ -402,7 +402,7 @@ 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.zero_trust.access.organizations.with_raw_response.create( + await async_client.zero_trust.organizations.with_raw_response.create( auth_domain="test.cloudflareaccess.com", name="Widget Corps Internal Applications", account_id="string", @@ -412,7 +412,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.update( + organization = await async_client.zero_trust.organizations.update( account_id="string", zone_id="string", ) @@ -421,7 +421,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.update( + organization = await async_client.zero_trust.organizations.update( account_id="string", zone_id="string", allow_authenticate_via_warp=True, @@ -450,7 +450,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.organizations.with_raw_response.update( + response = await async_client.zero_trust.organizations.with_raw_response.update( account_id="string", zone_id="string", ) @@ -463,7 +463,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.organizations.with_streaming_response.update( + async with async_client.zero_trust.organizations.with_streaming_response.update( account_id="string", zone_id="string", ) as response: @@ -479,13 +479,13 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @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.zero_trust.access.organizations.with_raw_response.update( + await async_client.zero_trust.organizations.with_raw_response.update( account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.organizations.with_raw_response.update( + await async_client.zero_trust.organizations.with_raw_response.update( account_id="string", zone_id="", ) @@ -493,7 +493,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.list( + organization = await async_client.zero_trust.organizations.list( account_id="string", zone_id="string", ) @@ -502,7 +502,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.list( + organization = await async_client.zero_trust.organizations.list( account_id="string", zone_id="string", ) @@ -511,7 +511,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.organizations.with_raw_response.list( + response = await async_client.zero_trust.organizations.with_raw_response.list( account_id="string", zone_id="string", ) @@ -524,7 +524,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.organizations.with_streaming_response.list( + async with async_client.zero_trust.organizations.with_streaming_response.list( account_id="string", zone_id="string", ) as response: @@ -540,13 +540,13 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.organizations.with_raw_response.list( + await async_client.zero_trust.organizations.with_raw_response.list( account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.organizations.with_raw_response.list( + await async_client.zero_trust.organizations.with_raw_response.list( account_id="string", zone_id="", ) @@ -554,7 +554,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_revoke_users(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.revoke_users( + organization = await async_client.zero_trust.organizations.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -564,7 +564,7 @@ async def test_method_revoke_users(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_revoke_users_with_all_params(self, async_client: AsyncCloudflare) -> None: - organization = await async_client.zero_trust.access.organizations.revoke_users( + organization = await async_client.zero_trust.organizations.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -574,7 +574,7 @@ async def test_method_revoke_users_with_all_params(self, async_client: AsyncClou @pytest.mark.skip() @parametrize async def test_raw_response_revoke_users(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.organizations.with_raw_response.revoke_users( + response = await async_client.zero_trust.organizations.with_raw_response.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -588,7 +588,7 @@ async def test_raw_response_revoke_users(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_streaming_response_revoke_users(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.organizations.with_streaming_response.revoke_users( + async with async_client.zero_trust.organizations.with_streaming_response.revoke_users( email="test@example.com", account_id="string", zone_id="string", @@ -605,14 +605,14 @@ async def test_streaming_response_revoke_users(self, async_client: AsyncCloudfla @parametrize async def test_path_params_revoke_users(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.access.organizations.with_raw_response.revoke_users( + await async_client.zero_trust.organizations.with_raw_response.revoke_users( email="test@example.com", account_id="", zone_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zero_trust.access.organizations.with_raw_response.revoke_users( + await async_client.zero_trust.organizations.with_raw_response.revoke_users( email="test@example.com", account_id="string", zone_id="", diff --git a/tests/api_resources/zero_trust/access/test_seats.py b/tests/api_resources/zero_trust/test_seats.py similarity index 91% rename from tests/api_resources/zero_trust/access/test_seats.py rename to tests/api_resources/zero_trust/test_seats.py index cf6fa509015..b0912c28e24 100644 --- a/tests/api_resources/zero_trust/access/test_seats.py +++ b/tests/api_resources/zero_trust/test_seats.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import SeatEditResponse +from cloudflare.types.zero_trust import SeatEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestSeats: @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: - seat = client.zero_trust.access.seats.edit( + seat = client.zero_trust.seats.edit( "023e105f4ecef8ad9ca31a8372d0c353", body=[ { @@ -42,7 +42,7 @@ def test_method_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zero_trust.access.seats.with_raw_response.edit( + response = client.zero_trust.seats.with_raw_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", body=[ { @@ -68,7 +68,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zero_trust.access.seats.with_streaming_response.edit( + with client.zero_trust.seats.with_streaming_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", body=[ { @@ -97,7 +97,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.zero_trust.access.seats.with_raw_response.edit( + client.zero_trust.seats.with_raw_response.edit( "", body=[ { @@ -122,7 +122,7 @@ class TestAsyncSeats: @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - seat = await async_client.zero_trust.access.seats.edit( + seat = await async_client.zero_trust.seats.edit( "023e105f4ecef8ad9ca31a8372d0c353", body=[ { @@ -144,7 +144,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.access.seats.with_raw_response.edit( + response = await async_client.zero_trust.seats.with_raw_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", body=[ { @@ -170,7 +170,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.access.seats.with_streaming_response.edit( + async with async_client.zero_trust.seats.with_streaming_response.edit( "023e105f4ecef8ad9ca31a8372d0c353", body=[ { @@ -199,7 +199,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.zero_trust.access.seats.with_raw_response.edit( + await async_client.zero_trust.seats.with_raw_response.edit( "", body=[ { diff --git a/tests/api_resources/zones/test_subscriptions.py b/tests/api_resources/zones/test_subscriptions.py new file mode 100644 index 00000000000..9eaf0025f5e --- /dev/null +++ b/tests/api_resources/zones/test_subscriptions.py @@ -0,0 +1,358 @@ +# File generated from our OpenAPI spec by Stainless. + +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.types.zones import ( + SubscriptionGetResponse, + SubscriptionListResponse, + SubscriptionCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSubscriptions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + subscription = client.zones.subscriptions.create( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + assert_matches_type(SubscriptionCreateResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + subscription = client.zones.subscriptions.create( + "506e3185e9c882d175a2d0cb0093d9f2", + app={"install_id": "string"}, + component_values=[ + { + "default": 5, + "name": "page_rules", + "price": 5, + "value": 20, + }, + { + "default": 5, + "name": "page_rules", + "price": 5, + "value": 20, + }, + { + "default": 5, + "name": "page_rules", + "price": 5, + "value": 20, + }, + ], + frequency="monthly", + rate_plan={ + "currency": "USD", + "externally_managed": False, + "id": "free", + "is_contract": False, + "public_name": "Business Plan", + "scope": "zone", + "sets": ["string", "string", "string"], + }, + zone={}, + ) + assert_matches_type(SubscriptionCreateResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.zones.subscriptions.with_raw_response.create( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subscription = response.parse() + assert_matches_type(SubscriptionCreateResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.zones.subscriptions.with_streaming_response.create( + "506e3185e9c882d175a2d0cb0093d9f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subscription = response.parse() + assert_matches_type(SubscriptionCreateResponse, subscription, 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 `identifier` but received ''"): + client.zones.subscriptions.with_raw_response.create( + "", + ) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + subscription = client.zones.subscriptions.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zones.subscriptions.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subscription = response.parse() + assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zones.subscriptions.with_streaming_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subscription = response.parse() + assert_matches_type(Optional[SubscriptionListResponse], subscription, 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 `account_identifier` but received ''"): + client.zones.subscriptions.with_raw_response.list( + "", + ) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + subscription = client.zones.subscriptions.get( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + assert_matches_type(SubscriptionGetResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zones.subscriptions.with_raw_response.get( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subscription = response.parse() + assert_matches_type(SubscriptionGetResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zones.subscriptions.with_streaming_response.get( + "506e3185e9c882d175a2d0cb0093d9f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subscription = response.parse() + assert_matches_type(SubscriptionGetResponse, subscription, 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 `identifier` but received ''"): + client.zones.subscriptions.with_raw_response.get( + "", + ) + + +class TestAsyncSubscriptions: + 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: + subscription = await async_client.zones.subscriptions.create( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + assert_matches_type(SubscriptionCreateResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + subscription = await async_client.zones.subscriptions.create( + "506e3185e9c882d175a2d0cb0093d9f2", + app={"install_id": "string"}, + component_values=[ + { + "default": 5, + "name": "page_rules", + "price": 5, + "value": 20, + }, + { + "default": 5, + "name": "page_rules", + "price": 5, + "value": 20, + }, + { + "default": 5, + "name": "page_rules", + "price": 5, + "value": 20, + }, + ], + frequency="monthly", + rate_plan={ + "currency": "USD", + "externally_managed": False, + "id": "free", + "is_contract": False, + "public_name": "Business Plan", + "scope": "zone", + "sets": ["string", "string", "string"], + }, + zone={}, + ) + assert_matches_type(SubscriptionCreateResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zones.subscriptions.with_raw_response.create( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subscription = await response.parse() + assert_matches_type(SubscriptionCreateResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.zones.subscriptions.with_streaming_response.create( + "506e3185e9c882d175a2d0cb0093d9f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subscription = await response.parse() + assert_matches_type(SubscriptionCreateResponse, subscription, 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 `identifier` but received ''"): + await async_client.zones.subscriptions.with_raw_response.create( + "", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + subscription = await async_client.zones.subscriptions.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zones.subscriptions.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subscription = await response.parse() + assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zones.subscriptions.with_streaming_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subscription = await response.parse() + assert_matches_type(Optional[SubscriptionListResponse], subscription, 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 `account_identifier` but received ''"): + await async_client.zones.subscriptions.with_raw_response.list( + "", + ) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + subscription = await async_client.zones.subscriptions.get( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + assert_matches_type(SubscriptionGetResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zones.subscriptions.with_raw_response.get( + "506e3185e9c882d175a2d0cb0093d9f2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subscription = await response.parse() + assert_matches_type(SubscriptionGetResponse, subscription, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zones.subscriptions.with_streaming_response.get( + "506e3185e9c882d175a2d0cb0093d9f2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subscription = await response.parse() + assert_matches_type(SubscriptionGetResponse, subscription, 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 `identifier` but received ''"): + await async_client.zones.subscriptions.with_raw_response.get( + "", + )