feat(api): api update

This commit is contained in:
stainless-app[bot] 2025-05-15 20:37:48 +00:00
parent de6f1d0f6c
commit 91316eea8a
58 changed files with 485 additions and 545 deletions

View file

@ -1,4 +1,4 @@
configured_endpoints: 1739
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b72014943bc6bde8ed494affec4cdf2c6a2cbd211ba3508c2e8382dd66ac7e7e.yml
openapi_spec_hash: b54d48a49098a068d0aa04dab5d7ea4d
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3aece65d7edbec57da9e16fa099f38686e16568788b0ae16ce4f1ed106b91807.yml
openapi_spec_hash: f6cbf2f7f81d082d83f3c6526814311e
config_hash: 428cd5372293bd6f28ee41c3a277c71b

62
api.md
View file

@ -2336,14 +2336,20 @@ Methods:
Types:
```python
from cloudflare.types.workers import Script, ScriptSetting, ScriptUpdateResponse, ScriptGetResponse
from cloudflare.types.workers import (
Script,
ScriptSetting,
ScriptUpdateResponse,
ScriptDeleteResponse,
ScriptGetResponse,
)
```
Methods:
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/script_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_update_response.py">Optional[ScriptUpdateResponse]</a></code>
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/script_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_update_response.py">ScriptUpdateResponse</a></code>
- <code title="get /accounts/{account_id}/workers/scripts">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers/script.py">SyncSinglePage[Script]</a></code>
- <code title="delete /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">delete</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/script_delete_params.py">params</a>) -> None</code>
- <code title="delete /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">delete</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/script_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_delete_response.py">object</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">get</a>(script_name, \*, account_id) -> str</code>
### Assets
@ -2383,13 +2389,13 @@ Methods:
Types:
```python
from cloudflare.types.workers.scripts import Schedule, ScheduleUpdateResponse, ScheduleGetResponse
from cloudflare.types.workers.scripts import ScheduleUpdateResponse, ScheduleGetResponse
```
Methods:
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}/schedules">client.workers.scripts.schedules.<a href="./src/cloudflare/resources/workers/scripts/schedules.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/schedule_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/schedule_update_response.py">Optional[ScheduleUpdateResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/schedules">client.workers.scripts.schedules.<a href="./src/cloudflare/resources/workers/scripts/schedules.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/scripts/schedule_get_response.py">Optional[ScheduleGetResponse]</a></code>
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}/schedules">client.workers.scripts.schedules.<a href="./src/cloudflare/resources/workers/scripts/schedules.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/schedule_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/schedule_update_response.py">ScheduleUpdateResponse</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/schedules">client.workers.scripts.schedules.<a href="./src/cloudflare/resources/workers/scripts/schedules.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/scripts/schedule_get_response.py">ScheduleGetResponse</a></code>
### Tail
@ -2406,23 +2412,23 @@ from cloudflare.types.workers.scripts import (
Methods:
- <code title="post /accounts/{account_id}/workers/scripts/{script_name}/tails">client.workers.scripts.tail.<a href="./src/cloudflare/resources/workers/scripts/tail.py">create</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/tail_create_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/tail_create_response.py">Optional[TailCreateResponse]</a></code>
- <code title="post /accounts/{account_id}/workers/scripts/{script_name}/tails">client.workers.scripts.tail.<a href="./src/cloudflare/resources/workers/scripts/tail.py">create</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/tail_create_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/tail_create_response.py">TailCreateResponse</a></code>
- <code title="delete /accounts/{account_id}/workers/scripts/{script_name}/tails/{id}">client.workers.scripts.tail.<a href="./src/cloudflare/resources/workers/scripts/tail.py">delete</a>(id, \*, account_id, script_name) -> <a href="./src/cloudflare/types/workers/scripts/tail_delete_response.py">TailDeleteResponse</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/tails">client.workers.scripts.tail.<a href="./src/cloudflare/resources/workers/scripts/tail.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/scripts/tail_get_response.py">Optional[TailGetResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/tails">client.workers.scripts.tail.<a href="./src/cloudflare/resources/workers/scripts/tail.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/scripts/tail_get_response.py">TailGetResponse</a></code>
### Content
Methods:
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}/content">client.workers.scripts.content.<a href="./src/cloudflare/resources/workers/scripts/content.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/content_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script.py">Optional[Script]</a></code>
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}/content">client.workers.scripts.content.<a href="./src/cloudflare/resources/workers/scripts/content.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/content_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script.py">Script</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/content/v2">client.workers.scripts.content.<a href="./src/cloudflare/resources/workers/scripts/content.py">get</a>(script_name, \*, account_id) -> BinaryAPIResponse</code>
### Settings
Methods:
- <code title="patch /accounts/{account_id}/workers/scripts/{script_name}/script-settings">client.workers.scripts.settings.<a href="./src/cloudflare/resources/workers/scripts/settings.py">edit</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_setting.py">Optional[ScriptSetting]</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/script-settings">client.workers.scripts.settings.<a href="./src/cloudflare/resources/workers/scripts/settings.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/script_setting.py">Optional[ScriptSetting]</a></code>
- <code title="patch /accounts/{account_id}/workers/scripts/{script_name}/script-settings">client.workers.scripts.settings.<a href="./src/cloudflare/resources/workers/scripts/settings.py">edit</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_setting.py">ScriptSetting</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/script-settings">client.workers.scripts.settings.<a href="./src/cloudflare/resources/workers/scripts/settings.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/script_setting.py">ScriptSetting</a></code>
### Deployments
@ -2455,9 +2461,9 @@ from cloudflare.types.workers.scripts import (
Methods:
- <code title="post /accounts/{account_id}/workers/scripts/{script_name}/versions">client.workers.scripts.versions.<a href="./src/cloudflare/resources/workers/scripts/versions.py">create</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/version_create_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/version_create_response.py">Optional[VersionCreateResponse]</a></code>
- <code title="post /accounts/{account_id}/workers/scripts/{script_name}/versions">client.workers.scripts.versions.<a href="./src/cloudflare/resources/workers/scripts/versions.py">create</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/version_create_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/version_create_response.py">VersionCreateResponse</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/versions">client.workers.scripts.versions.<a href="./src/cloudflare/resources/workers/scripts/versions.py">list</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/version_list_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/version_list_response.py">SyncV4PagePagination[VersionListResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}">client.workers.scripts.versions.<a href="./src/cloudflare/resources/workers/scripts/versions.py">get</a>(version_id, \*, account_id, script_name) -> <a href="./src/cloudflare/types/workers/scripts/version_get_response.py">Optional[VersionGetResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}">client.workers.scripts.versions.<a href="./src/cloudflare/resources/workers/scripts/versions.py">get</a>(version_id, \*, account_id, script_name) -> <a href="./src/cloudflare/types/workers/scripts/version_get_response.py">VersionGetResponse</a></code>
### Secrets
@ -2492,8 +2498,8 @@ from cloudflare.types.workers.scripts import (
Methods:
- <code title="patch /accounts/{account_id}/workers/scripts/{script_name}/settings">client.workers.scripts.script_and_version_settings.<a href="./src/cloudflare/resources/workers/scripts/script_and_version_settings.py">edit</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/script_and_version_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/script_and_version_setting_edit_response.py">Optional[ScriptAndVersionSettingEditResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/settings">client.workers.scripts.script_and_version_settings.<a href="./src/cloudflare/resources/workers/scripts/script_and_version_settings.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/scripts/script_and_version_setting_get_response.py">Optional[ScriptAndVersionSettingGetResponse]</a></code>
- <code title="patch /accounts/{account_id}/workers/scripts/{script_name}/settings">client.workers.scripts.script_and_version_settings.<a href="./src/cloudflare/resources/workers/scripts/script_and_version_settings.py">edit</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/scripts/script_and_version_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/scripts/script_and_version_setting_edit_response.py">ScriptAndVersionSettingEditResponse</a></code>
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}/settings">client.workers.scripts.script_and_version_settings.<a href="./src/cloudflare/resources/workers/scripts/script_and_version_settings.py">get</a>(script_name, \*, account_id) -> <a href="./src/cloudflare/types/workers/scripts/script_and_version_setting_get_response.py">ScriptAndVersionSettingGetResponse</a></code>
## AccountSettings
@ -2505,8 +2511,8 @@ from cloudflare.types.workers import AccountSettingUpdateResponse, AccountSettin
Methods:
- <code title="put /accounts/{account_id}/workers/account-settings">client.workers.account_settings.<a href="./src/cloudflare/resources/workers/account_settings.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workers/account_setting_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/account_setting_update_response.py">Optional[AccountSettingUpdateResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/account-settings">client.workers.account_settings.<a href="./src/cloudflare/resources/workers/account_settings.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers/account_setting_get_response.py">Optional[AccountSettingGetResponse]</a></code>
- <code title="put /accounts/{account_id}/workers/account-settings">client.workers.account_settings.<a href="./src/cloudflare/resources/workers/account_settings.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workers/account_setting_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/account_setting_update_response.py">AccountSettingUpdateResponse</a></code>
- <code title="get /accounts/{account_id}/workers/account-settings">client.workers.account_settings.<a href="./src/cloudflare/resources/workers/account_settings.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers/account_setting_get_response.py">AccountSettingGetResponse</a></code>
## Domains
@ -2533,8 +2539,8 @@ from cloudflare.types.workers import SubdomainUpdateResponse, SubdomainGetRespon
Methods:
- <code title="put /accounts/{account_id}/workers/subdomain">client.workers.subdomains.<a href="./src/cloudflare/resources/workers/subdomains.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workers/subdomain_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/subdomain_update_response.py">Optional[SubdomainUpdateResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/subdomain">client.workers.subdomains.<a href="./src/cloudflare/resources/workers/subdomains.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers/subdomain_get_response.py">Optional[SubdomainGetResponse]</a></code>
- <code title="put /accounts/{account_id}/workers/subdomain">client.workers.subdomains.<a href="./src/cloudflare/resources/workers/subdomains.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workers/subdomain_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/subdomain_update_response.py">SubdomainUpdateResponse</a></code>
- <code title="get /accounts/{account_id}/workers/subdomain">client.workers.subdomains.<a href="./src/cloudflare/resources/workers/subdomains.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers/subdomain_get_response.py">SubdomainGetResponse</a></code>
## Observability
@ -5141,14 +5147,18 @@ Methods:
Types:
```python
from cloudflare.types.workers_for_platforms.dispatch.namespaces import Script, ScriptUpdateResponse
from cloudflare.types.workers_for_platforms.dispatch.namespaces import (
Script,
ScriptUpdateResponse,
ScriptDeleteResponse,
)
```
Methods:
- <code title="put /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}">client.workers_for_platforms.dispatch.namespaces.scripts.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py">update</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py">Optional[ScriptUpdateResponse]</a></code>
- <code title="delete /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}">client.workers_for_platforms.dispatch.namespaces.scripts.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py">delete</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py">params</a>) -> None</code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}">client.workers_for_platforms.dispatch.namespaces.scripts.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script.py">Optional[Script]</a></code>
- <code title="put /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}">client.workers_for_platforms.dispatch.namespaces.scripts.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py">update</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py">ScriptUpdateResponse</a></code>
- <code title="delete /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}">client.workers_for_platforms.dispatch.namespaces.scripts.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py">delete</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_delete_response.py">object</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}">client.workers_for_platforms.dispatch.namespaces.scripts.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script.py">Script</a></code>
##### AssetUpload
@ -5168,7 +5178,7 @@ Methods:
Methods:
- <code title="put /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content">client.workers_for_platforms.dispatch.namespaces.scripts.content.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py">update</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script.py">Optional[Script]</a></code>
- <code title="put /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content">client.workers_for_platforms.dispatch.namespaces.scripts.content.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py">update</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script.py">Script</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content">client.workers_for_platforms.dispatch.namespaces.scripts.content.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse</code>
##### Settings
@ -5214,10 +5224,10 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
Methods:
- <code title="put /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets">client.workers_for_platforms.dispatch.namespaces.scripts.secrets.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py">update</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py">Optional[SecretUpdateResponse]</a></code>
- <code title="put /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets">client.workers_for_platforms.dispatch.namespaces.scripts.secrets.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py">update</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py">SecretUpdateResponse</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets">client.workers_for_platforms.dispatch.namespaces.scripts.secrets.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py">list</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py">SyncSinglePage[SecretListResponse]</a></code>
- <code title="delete /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}">client.workers_for_platforms.dispatch.namespaces.scripts.secrets.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py">delete</a>(secret_name, \*, account_id, dispatch_namespace, script_name) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_delete_response.py">object</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}">client.workers_for_platforms.dispatch.namespaces.scripts.secrets.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py">get</a>(secret_name, \*, account_id, dispatch_namespace, script_name) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_get_response.py">Optional[SecretGetResponse]</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}">client.workers_for_platforms.dispatch.namespaces.scripts.secrets.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py">get</a>(secret_name, \*, account_id, dispatch_namespace, script_name) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_get_response.py">SecretGetResponse</a></code>
##### Tags

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -57,7 +57,7 @@ class AccountSettingsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[AccountSettingUpdateResponse]:
) -> AccountSettingUpdateResponse:
"""
Creates Worker account settings for an account.
@ -88,9 +88,9 @@ class AccountSettingsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountSettingUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[AccountSettingUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[AccountSettingUpdateResponse]], ResultWrapper[AccountSettingUpdateResponse]),
cast_to=cast(Type[AccountSettingUpdateResponse], ResultWrapper[AccountSettingUpdateResponse]),
)
def get(
@ -103,7 +103,7 @@ class AccountSettingsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[AccountSettingGetResponse]:
) -> AccountSettingGetResponse:
"""
Fetches Worker account settings for an account.
@ -127,9 +127,9 @@ class AccountSettingsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountSettingGetResponse]]._unwrapper,
post_parser=ResultWrapper[AccountSettingGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[AccountSettingGetResponse]], ResultWrapper[AccountSettingGetResponse]),
cast_to=cast(Type[AccountSettingGetResponse], ResultWrapper[AccountSettingGetResponse]),
)
@ -165,7 +165,7 @@ class AsyncAccountSettingsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[AccountSettingUpdateResponse]:
) -> AccountSettingUpdateResponse:
"""
Creates Worker account settings for an account.
@ -196,9 +196,9 @@ class AsyncAccountSettingsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountSettingUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[AccountSettingUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[AccountSettingUpdateResponse]], ResultWrapper[AccountSettingUpdateResponse]),
cast_to=cast(Type[AccountSettingUpdateResponse], ResultWrapper[AccountSettingUpdateResponse]),
)
async def get(
@ -211,7 +211,7 @@ class AsyncAccountSettingsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[AccountSettingGetResponse]:
) -> AccountSettingGetResponse:
"""
Fetches Worker account settings for an account.
@ -235,9 +235,9 @@ class AsyncAccountSettingsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountSettingGetResponse]]._unwrapper,
post_parser=ResultWrapper[AccountSettingGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[AccountSettingGetResponse]], ResultWrapper[AccountSettingGetResponse]),
cast_to=cast(Type[AccountSettingGetResponse], ResultWrapper[AccountSettingGetResponse]),
)

View file

@ -62,7 +62,7 @@ class UploadResource(SyncAPIResource):
To learn more about the direct
uploads of assets, see
https://developers.cloudflare.com/workers/static-assets/direct-upload/
https://developers.cloudflare.com/workers/static-assets/direct-upload/.
Args:
account_id: Identifier.
@ -135,7 +135,7 @@ class AsyncUploadResource(AsyncAPIResource):
To learn more about the direct
uploads of assets, see
https://developers.cloudflare.com/workers/static-assets/direct-upload/
https://developers.cloudflare.com/workers/static-assets/direct-upload/.
Args:
account_id: Identifier.

View file

@ -61,7 +61,7 @@ class UploadResource(SyncAPIResource):
To learn
more about the direct uploads of assets, see
https://developers.cloudflare.com/workers/static-assets/direct-upload/
https://developers.cloudflare.com/workers/static-assets/direct-upload/.
Args:
account_id: Identifier.
@ -134,7 +134,7 @@ class AsyncUploadResource(AsyncAPIResource):
To learn
more about the direct uploads of assets, see
https://developers.cloudflare.com/workers/static-assets/direct-upload/
https://developers.cloudflare.com/workers/static-assets/direct-upload/.
Args:
account_id: Identifier.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -67,9 +67,9 @@ class ContentResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Script]:
) -> Script:
"""
Put script content without touching config or metadata
Put script content without touching config or metadata.
Args:
account_id: Identifier.
@ -111,9 +111,9 @@ class ContentResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Script]]._unwrapper,
post_parser=ResultWrapper[Script]._unwrapper,
),
cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]),
cast_to=cast(Type[Script], ResultWrapper[Script]),
)
def get(
@ -129,7 +129,7 @@ class ContentResource(SyncAPIResource):
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BinaryAPIResponse:
"""
Fetch script content only
Fetch script content only.
Args:
account_id: Identifier.
@ -192,9 +192,9 @@ class AsyncContentResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Script]:
) -> Script:
"""
Put script content without touching config or metadata
Put script content without touching config or metadata.
Args:
account_id: Identifier.
@ -236,9 +236,9 @@ class AsyncContentResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Script]]._unwrapper,
post_parser=ResultWrapper[Script]._unwrapper,
),
cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]),
cast_to=cast(Type[Script], ResultWrapper[Script]),
)
async def get(
@ -254,7 +254,7 @@ class AsyncContentResource(AsyncAPIResource):
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncBinaryAPIResponse:
"""
Fetch script content only
Fetch script content only.
Args:
account_id: Identifier.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Iterable, Optional, cast
from typing import Type, Iterable, cast
import httpx
@ -18,7 +18,7 @@ from ...._response import (
)
from ...._wrappers import ResultWrapper
from ...._base_client import make_request_options
from ....types.workers.scripts.schedule_param import ScheduleParam
from ....types.workers.scripts import schedule_update_params
from ....types.workers.scripts.schedule_get_response import ScheduleGetResponse
from ....types.workers.scripts.schedule_update_response import ScheduleUpdateResponse
@ -50,14 +50,14 @@ class SchedulesResource(SyncAPIResource):
script_name: str,
*,
account_id: str,
body: Iterable[ScheduleParam],
body: Iterable[schedule_update_params.Body],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScheduleUpdateResponse]:
) -> ScheduleUpdateResponse:
"""
Updates Cron Triggers for a Worker.
@ -80,15 +80,15 @@ class SchedulesResource(SyncAPIResource):
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._put(
f"/accounts/{account_id}/workers/scripts/{script_name}/schedules",
body=maybe_transform(body, Iterable[ScheduleParam]),
body=maybe_transform(body, Iterable[schedule_update_params.Body]),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScheduleUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[ScheduleUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScheduleUpdateResponse]], ResultWrapper[ScheduleUpdateResponse]),
cast_to=cast(Type[ScheduleUpdateResponse], ResultWrapper[ScheduleUpdateResponse]),
)
def get(
@ -102,7 +102,7 @@ class SchedulesResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScheduleGetResponse]:
) -> ScheduleGetResponse:
"""
Fetches Cron Triggers for a Worker.
@ -130,9 +130,9 @@ class SchedulesResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScheduleGetResponse]]._unwrapper,
post_parser=ResultWrapper[ScheduleGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScheduleGetResponse]], ResultWrapper[ScheduleGetResponse]),
cast_to=cast(Type[ScheduleGetResponse], ResultWrapper[ScheduleGetResponse]),
)
@ -161,14 +161,14 @@ class AsyncSchedulesResource(AsyncAPIResource):
script_name: str,
*,
account_id: str,
body: Iterable[ScheduleParam],
body: Iterable[schedule_update_params.Body],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScheduleUpdateResponse]:
) -> ScheduleUpdateResponse:
"""
Updates Cron Triggers for a Worker.
@ -191,15 +191,15 @@ class AsyncSchedulesResource(AsyncAPIResource):
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._put(
f"/accounts/{account_id}/workers/scripts/{script_name}/schedules",
body=await async_maybe_transform(body, Iterable[ScheduleParam]),
body=await async_maybe_transform(body, Iterable[schedule_update_params.Body]),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScheduleUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[ScheduleUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScheduleUpdateResponse]], ResultWrapper[ScheduleUpdateResponse]),
cast_to=cast(Type[ScheduleUpdateResponse], ResultWrapper[ScheduleUpdateResponse]),
)
async def get(
@ -213,7 +213,7 @@ class AsyncSchedulesResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScheduleGetResponse]:
) -> ScheduleGetResponse:
"""
Fetches Cron Triggers for a Worker.
@ -241,9 +241,9 @@ class AsyncSchedulesResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScheduleGetResponse]]._unwrapper,
post_parser=ResultWrapper[ScheduleGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScheduleGetResponse]], ResultWrapper[ScheduleGetResponse]),
cast_to=cast(Type[ScheduleGetResponse], ResultWrapper[ScheduleGetResponse]),
)

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -57,9 +57,9 @@ class ScriptAndVersionSettingsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptAndVersionSettingEditResponse]:
) -> ScriptAndVersionSettingEditResponse:
"""
Patch metadata or config, such as bindings or usage model
Patch metadata or config, such as bindings or usage model.
Args:
account_id: Identifier.
@ -92,11 +92,9 @@ class ScriptAndVersionSettingsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptAndVersionSettingEditResponse]]._unwrapper,
),
cast_to=cast(
Type[Optional[ScriptAndVersionSettingEditResponse]], ResultWrapper[ScriptAndVersionSettingEditResponse]
post_parser=ResultWrapper[ScriptAndVersionSettingEditResponse]._unwrapper,
),
cast_to=cast(Type[ScriptAndVersionSettingEditResponse], ResultWrapper[ScriptAndVersionSettingEditResponse]),
)
def get(
@ -110,9 +108,9 @@ class ScriptAndVersionSettingsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptAndVersionSettingGetResponse]:
) -> ScriptAndVersionSettingGetResponse:
"""
Get metadata and config, such as bindings or usage model
Get metadata and config, such as bindings or usage model.
Args:
account_id: Identifier.
@ -138,11 +136,9 @@ class ScriptAndVersionSettingsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptAndVersionSettingGetResponse]]._unwrapper,
),
cast_to=cast(
Type[Optional[ScriptAndVersionSettingGetResponse]], ResultWrapper[ScriptAndVersionSettingGetResponse]
post_parser=ResultWrapper[ScriptAndVersionSettingGetResponse]._unwrapper,
),
cast_to=cast(Type[ScriptAndVersionSettingGetResponse], ResultWrapper[ScriptAndVersionSettingGetResponse]),
)
@ -178,9 +174,9 @@ class AsyncScriptAndVersionSettingsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptAndVersionSettingEditResponse]:
) -> ScriptAndVersionSettingEditResponse:
"""
Patch metadata or config, such as bindings or usage model
Patch metadata or config, such as bindings or usage model.
Args:
account_id: Identifier.
@ -213,11 +209,9 @@ class AsyncScriptAndVersionSettingsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptAndVersionSettingEditResponse]]._unwrapper,
),
cast_to=cast(
Type[Optional[ScriptAndVersionSettingEditResponse]], ResultWrapper[ScriptAndVersionSettingEditResponse]
post_parser=ResultWrapper[ScriptAndVersionSettingEditResponse]._unwrapper,
),
cast_to=cast(Type[ScriptAndVersionSettingEditResponse], ResultWrapper[ScriptAndVersionSettingEditResponse]),
)
async def get(
@ -231,9 +225,9 @@ class AsyncScriptAndVersionSettingsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptAndVersionSettingGetResponse]:
) -> ScriptAndVersionSettingGetResponse:
"""
Get metadata and config, such as bindings or usage model
Get metadata and config, such as bindings or usage model.
Args:
account_id: Identifier.
@ -259,11 +253,9 @@ class AsyncScriptAndVersionSettingsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptAndVersionSettingGetResponse]]._unwrapper,
),
cast_to=cast(
Type[Optional[ScriptAndVersionSettingGetResponse]], ResultWrapper[ScriptAndVersionSettingGetResponse]
post_parser=ResultWrapper[ScriptAndVersionSettingGetResponse]._unwrapper,
),
cast_to=cast(Type[ScriptAndVersionSettingGetResponse], ResultWrapper[ScriptAndVersionSettingGetResponse]),
)

View file

@ -46,7 +46,7 @@ from .versions import (
VersionsResourceWithStreamingResponse,
AsyncVersionsResourceWithStreamingResponse,
)
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
from ...._utils import maybe_transform, async_maybe_transform
from .schedules import (
SchedulesResource,
@ -179,7 +179,7 @@ class ScriptsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptUpdateResponse]:
) -> ScriptUpdateResponse:
"""Upload a worker module.
You can find more about the multipart metadata on our
@ -214,9 +214,9 @@ class ScriptsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[ScriptUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptUpdateResponse]], ResultWrapper[ScriptUpdateResponse]),
cast_to=cast(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]),
)
def list(
@ -267,7 +267,7 @@ class ScriptsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
) -> object:
"""Delete your worker.
This call has no response body on a successful delete.
@ -293,7 +293,6 @@ class ScriptsResource(SyncAPIResource):
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
f"/accounts/{account_id}/workers/scripts/{script_name}",
options=make_request_options(
@ -302,8 +301,9 @@ class ScriptsResource(SyncAPIResource):
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams),
post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
cast_to=NoneType,
cast_to=cast(Type[object], ResultWrapper[object]),
)
def get(
@ -423,7 +423,7 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptUpdateResponse]:
) -> ScriptUpdateResponse:
"""Upload a worker module.
You can find more about the multipart metadata on our
@ -458,9 +458,9 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[ScriptUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptUpdateResponse]], ResultWrapper[ScriptUpdateResponse]),
cast_to=cast(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]),
)
def list(
@ -511,7 +511,7 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
) -> object:
"""Delete your worker.
This call has no response body on a successful delete.
@ -537,7 +537,6 @@ class AsyncScriptsResource(AsyncAPIResource):
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
f"/accounts/{account_id}/workers/scripts/{script_name}",
options=make_request_options(
@ -546,8 +545,9 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams),
post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
cast_to=NoneType,
cast_to=cast(Type[object], ResultWrapper[object]),
)
async def get(

View file

@ -59,7 +59,7 @@ class SettingsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptSetting]:
) -> ScriptSetting:
"""
Patch script-level settings when using
[Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
@ -103,9 +103,9 @@ class SettingsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper,
post_parser=ResultWrapper[ScriptSetting]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]),
cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]),
)
def get(
@ -119,7 +119,7 @@ class SettingsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptSetting]:
) -> ScriptSetting:
"""
Get script-level settings when using
[Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
@ -149,9 +149,9 @@ class SettingsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper,
post_parser=ResultWrapper[ScriptSetting]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]),
cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]),
)
@ -189,7 +189,7 @@ class AsyncSettingsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptSetting]:
) -> ScriptSetting:
"""
Patch script-level settings when using
[Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
@ -233,9 +233,9 @@ class AsyncSettingsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper,
post_parser=ResultWrapper[ScriptSetting]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]),
cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]),
)
async def get(
@ -249,7 +249,7 @@ class AsyncSettingsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptSetting]:
) -> ScriptSetting:
"""
Get script-level settings when using
[Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
@ -279,9 +279,9 @@ class AsyncSettingsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptSetting]]._unwrapper,
post_parser=ResultWrapper[ScriptSetting]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]),
cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]),
)

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -58,7 +58,7 @@ class TailResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[TailCreateResponse]:
) -> TailCreateResponse:
"""
Starts a tail that receives logs and exception from a Worker.
@ -87,9 +87,9 @@ class TailResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[TailCreateResponse]]._unwrapper,
post_parser=ResultWrapper[TailCreateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[TailCreateResponse]], ResultWrapper[TailCreateResponse]),
cast_to=cast(Type[TailCreateResponse], ResultWrapper[TailCreateResponse]),
)
def delete(
@ -113,7 +113,7 @@ class TailResource(SyncAPIResource):
script_name: Name of the script, used in URLs and route configuration.
id: Identifier for the tail.
id: Identifier.
extra_headers: Send extra headers
@ -148,7 +148,7 @@ class TailResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[TailGetResponse]:
) -> TailGetResponse:
"""
Get list of tails currently deployed on a Worker.
@ -176,9 +176,9 @@ class TailResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[TailGetResponse]]._unwrapper,
post_parser=ResultWrapper[TailGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[TailGetResponse]], ResultWrapper[TailGetResponse]),
cast_to=cast(Type[TailGetResponse], ResultWrapper[TailGetResponse]),
)
@ -214,7 +214,7 @@ class AsyncTailResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[TailCreateResponse]:
) -> TailCreateResponse:
"""
Starts a tail that receives logs and exception from a Worker.
@ -243,9 +243,9 @@ class AsyncTailResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[TailCreateResponse]]._unwrapper,
post_parser=ResultWrapper[TailCreateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[TailCreateResponse]], ResultWrapper[TailCreateResponse]),
cast_to=cast(Type[TailCreateResponse], ResultWrapper[TailCreateResponse]),
)
async def delete(
@ -269,7 +269,7 @@ class AsyncTailResource(AsyncAPIResource):
script_name: Name of the script, used in URLs and route configuration.
id: Identifier for the tail.
id: Identifier.
extra_headers: Send extra headers
@ -304,7 +304,7 @@ class AsyncTailResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[TailGetResponse]:
) -> TailGetResponse:
"""
Get list of tails currently deployed on a Worker.
@ -332,9 +332,9 @@ class AsyncTailResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[TailGetResponse]]._unwrapper,
post_parser=ResultWrapper[TailGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[TailGetResponse]], ResultWrapper[TailGetResponse]),
cast_to=cast(Type[TailGetResponse], ResultWrapper[TailGetResponse]),
)

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -59,7 +59,7 @@ class VersionsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[VersionCreateResponse]:
) -> VersionCreateResponse:
"""Upload a Worker Version without deploying to Cloudflare's network.
You can find
@ -97,9 +97,9 @@ class VersionsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[VersionCreateResponse]]._unwrapper,
post_parser=ResultWrapper[VersionCreateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]),
cast_to=cast(Type[VersionCreateResponse], ResultWrapper[VersionCreateResponse]),
)
def list(
@ -176,7 +176,7 @@ class VersionsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[VersionGetResponse]:
) -> VersionGetResponse:
"""
Get Version Detail
@ -206,9 +206,9 @@ class VersionsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[VersionGetResponse]]._unwrapper,
post_parser=ResultWrapper[VersionGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[VersionGetResponse]], ResultWrapper[VersionGetResponse]),
cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
)
@ -244,7 +244,7 @@ class AsyncVersionsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[VersionCreateResponse]:
) -> VersionCreateResponse:
"""Upload a Worker Version without deploying to Cloudflare's network.
You can find
@ -282,9 +282,9 @@ class AsyncVersionsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[VersionCreateResponse]]._unwrapper,
post_parser=ResultWrapper[VersionCreateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]),
cast_to=cast(Type[VersionCreateResponse], ResultWrapper[VersionCreateResponse]),
)
def list(
@ -361,7 +361,7 @@ class AsyncVersionsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[VersionGetResponse]:
) -> VersionGetResponse:
"""
Get Version Detail
@ -391,9 +391,9 @@ class AsyncVersionsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[VersionGetResponse]]._unwrapper,
post_parser=ResultWrapper[VersionGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[VersionGetResponse]], ResultWrapper[VersionGetResponse]),
cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
)

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -49,14 +49,14 @@ class SubdomainsResource(SyncAPIResource):
self,
*,
account_id: str,
subdomain: str | NotGiven = NOT_GIVEN,
subdomain: 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[SubdomainUpdateResponse]:
) -> SubdomainUpdateResponse:
"""
Creates a Workers subdomain for an account.
@ -81,9 +81,9 @@ class SubdomainsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SubdomainUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[SubdomainUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[SubdomainUpdateResponse]], ResultWrapper[SubdomainUpdateResponse]),
cast_to=cast(Type[SubdomainUpdateResponse], ResultWrapper[SubdomainUpdateResponse]),
)
def get(
@ -96,7 +96,7 @@ class SubdomainsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SubdomainGetResponse]:
) -> SubdomainGetResponse:
"""
Returns a Workers subdomain for an account.
@ -120,9 +120,9 @@ class SubdomainsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SubdomainGetResponse]]._unwrapper,
post_parser=ResultWrapper[SubdomainGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[SubdomainGetResponse]], ResultWrapper[SubdomainGetResponse]),
cast_to=cast(Type[SubdomainGetResponse], ResultWrapper[SubdomainGetResponse]),
)
@ -150,14 +150,14 @@ class AsyncSubdomainsResource(AsyncAPIResource):
self,
*,
account_id: str,
subdomain: str | NotGiven = NOT_GIVEN,
subdomain: 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[SubdomainUpdateResponse]:
) -> SubdomainUpdateResponse:
"""
Creates a Workers subdomain for an account.
@ -182,9 +182,9 @@ class AsyncSubdomainsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SubdomainUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[SubdomainUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[SubdomainUpdateResponse]], ResultWrapper[SubdomainUpdateResponse]),
cast_to=cast(Type[SubdomainUpdateResponse], ResultWrapper[SubdomainUpdateResponse]),
)
async def get(
@ -197,7 +197,7 @@ class AsyncSubdomainsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SubdomainGetResponse]:
) -> SubdomainGetResponse:
"""
Returns a Workers subdomain for an account.
@ -221,9 +221,9 @@ class AsyncSubdomainsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SubdomainGetResponse]]._unwrapper,
post_parser=ResultWrapper[SubdomainGetResponse]._unwrapper,
),
cast_to=cast(Type[Optional[SubdomainGetResponse]], ResultWrapper[SubdomainGetResponse]),
cast_to=cast(Type[SubdomainGetResponse], ResultWrapper[SubdomainGetResponse]),
)

View file

@ -77,7 +77,7 @@ class NamespacesResource(SyncAPIResource):
Args:
account_id: Identifier.
name: The name of the dispatch namespace
name: The name of the dispatch namespace.
extra_headers: Send extra headers
@ -269,7 +269,7 @@ class AsyncNamespacesResource(AsyncAPIResource):
Args:
account_id: Identifier.
name: The name of the dispatch namespace
name: The name of the dispatch namespace.
extra_headers: Send extra headers

View file

@ -64,7 +64,7 @@ class AssetUploadResource(SyncAPIResource):
To learn
more about the direct uploads of assets, see
https://developers.cloudflare.com/workers/static-assets/direct-upload/
https://developers.cloudflare.com/workers/static-assets/direct-upload/.
Args:
account_id: Identifier.
@ -142,7 +142,7 @@ class AsyncAssetUploadResource(AsyncAPIResource):
To learn
more about the direct uploads of assets, see
https://developers.cloudflare.com/workers/static-assets/direct-upload/
https://developers.cloudflare.com/workers/static-assets/direct-upload/.
Args:
account_id: Identifier.

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Type, Optional, cast
from typing import Type, cast
import httpx
@ -68,7 +68,7 @@ class ContentResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Script]:
) -> Script:
"""
Put script content for a script uploaded to a Workers for Platforms namespace.
@ -116,9 +116,9 @@ class ContentResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Script]]._unwrapper,
post_parser=ResultWrapper[Script]._unwrapper,
),
cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]),
cast_to=cast(Type[Script], ResultWrapper[Script]),
)
def get(
@ -204,7 +204,7 @@ class AsyncContentResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Script]:
) -> Script:
"""
Put script content for a script uploaded to a Workers for Platforms namespace.
@ -252,9 +252,9 @@ class AsyncContentResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Script]]._unwrapper,
post_parser=ResultWrapper[Script]._unwrapper,
),
cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]),
cast_to=cast(Type[Script], ResultWrapper[Script]),
)
async def get(

View file

@ -46,7 +46,7 @@ from .settings import (
SettingsResourceWithStreamingResponse,
AsyncSettingsResourceWithStreamingResponse,
)
from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
from ......_utils import maybe_transform, async_maybe_transform
from ......_compat import cached_property
from .asset_upload import (
@ -131,7 +131,7 @@ class ScriptsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptUpdateResponse]:
) -> ScriptUpdateResponse:
"""Upload a worker module to a Workers for Platforms namespace.
You can find more
@ -170,9 +170,9 @@ class ScriptsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[ScriptUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptUpdateResponse]], ResultWrapper[ScriptUpdateResponse]),
cast_to=cast(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]),
)
def delete(
@ -188,7 +188,7 @@ class ScriptsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
) -> object:
"""Delete a worker from a Workers for Platforms namespace.
This call has no
@ -219,7 +219,6 @@ class ScriptsResource(SyncAPIResource):
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(
@ -228,8 +227,9 @@ class ScriptsResource(SyncAPIResource):
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams),
post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
cast_to=NoneType,
cast_to=cast(Type[object], ResultWrapper[object]),
)
def get(
@ -244,7 +244,7 @@ class ScriptsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Script]:
) -> Script:
"""
Fetch information about a script uploaded to a Workers for Platforms namespace.
@ -276,9 +276,9 @@ class ScriptsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Script]]._unwrapper,
post_parser=ResultWrapper[Script]._unwrapper,
),
cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]),
cast_to=cast(Type[Script], ResultWrapper[Script]),
)
@ -340,7 +340,7 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ScriptUpdateResponse]:
) -> ScriptUpdateResponse:
"""Upload a worker module to a Workers for Platforms namespace.
You can find more
@ -379,9 +379,9 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[ScriptUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[ScriptUpdateResponse]._unwrapper,
),
cast_to=cast(Type[Optional[ScriptUpdateResponse]], ResultWrapper[ScriptUpdateResponse]),
cast_to=cast(Type[ScriptUpdateResponse], ResultWrapper[ScriptUpdateResponse]),
)
async def delete(
@ -397,7 +397,7 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
) -> object:
"""Delete a worker from a Workers for Platforms namespace.
This call has no
@ -428,7 +428,6 @@ class AsyncScriptsResource(AsyncAPIResource):
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(
@ -437,8 +436,9 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform({"force": force}, script_delete_params.ScriptDeleteParams),
post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
cast_to=NoneType,
cast_to=cast(Type[object], ResultWrapper[object]),
)
async def get(
@ -453,7 +453,7 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Script]:
) -> Script:
"""
Fetch information about a script uploaded to a Workers for Platforms namespace.
@ -485,9 +485,9 @@ class AsyncScriptsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Script]]._unwrapper,
post_parser=ResultWrapper[Script]._unwrapper,
),
cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]),
cast_to=cast(Type[Script], ResultWrapper[Script]),
)

View file

@ -64,7 +64,7 @@ class SecretsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretUpdateResponse]:
) -> SecretUpdateResponse:
"""
Add a secret to a script uploaded to a Workers for Platforms namespace.
@ -113,7 +113,7 @@ class SecretsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretUpdateResponse]:
) -> SecretUpdateResponse:
"""
Add a secret to a script uploaded to a Workers for Platforms namespace.
@ -178,7 +178,7 @@ class SecretsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretUpdateResponse]:
) -> SecretUpdateResponse:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not dispatch_namespace:
@ -186,7 +186,7 @@ class SecretsResource(SyncAPIResource):
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return cast(
Optional[SecretUpdateResponse],
SecretUpdateResponse,
self._put(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets",
body=maybe_transform(
@ -207,7 +207,7 @@ class SecretsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SecretUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[SecretUpdateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[SecretUpdateResponse]
@ -328,7 +328,7 @@ class SecretsResource(SyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretGetResponse]:
) -> SecretGetResponse:
"""
Get a given secret binding (value omitted) on a script uploaded to a Workers for
Platforms namespace.
@ -359,7 +359,7 @@ class SecretsResource(SyncAPIResource):
if not secret_name:
raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}")
return cast(
Optional[SecretGetResponse],
SecretGetResponse,
self._get(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}",
options=make_request_options(
@ -367,7 +367,7 @@ class SecretsResource(SyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SecretGetResponse]]._unwrapper,
post_parser=ResultWrapper[SecretGetResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[SecretGetResponse]
@ -412,7 +412,7 @@ class AsyncSecretsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretUpdateResponse]:
) -> SecretUpdateResponse:
"""
Add a secret to a script uploaded to a Workers for Platforms namespace.
@ -461,7 +461,7 @@ class AsyncSecretsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretUpdateResponse]:
) -> SecretUpdateResponse:
"""
Add a secret to a script uploaded to a Workers for Platforms namespace.
@ -526,7 +526,7 @@ class AsyncSecretsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretUpdateResponse]:
) -> SecretUpdateResponse:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not dispatch_namespace:
@ -534,7 +534,7 @@ class AsyncSecretsResource(AsyncAPIResource):
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return cast(
Optional[SecretUpdateResponse],
SecretUpdateResponse,
await self._put(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets",
body=await async_maybe_transform(
@ -555,7 +555,7 @@ class AsyncSecretsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SecretUpdateResponse]]._unwrapper,
post_parser=ResultWrapper[SecretUpdateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[SecretUpdateResponse]
@ -676,7 +676,7 @@ class AsyncSecretsResource(AsyncAPIResource):
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SecretGetResponse]:
) -> SecretGetResponse:
"""
Get a given secret binding (value omitted) on a script uploaded to a Workers for
Platforms namespace.
@ -707,7 +707,7 @@ class AsyncSecretsResource(AsyncAPIResource):
if not secret_name:
raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}")
return cast(
Optional[SecretGetResponse],
SecretGetResponse,
await self._get(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}",
options=make_request_options(
@ -715,7 +715,7 @@ class AsyncSecretsResource(AsyncAPIResource):
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SecretGetResponse]]._unwrapper,
post_parser=ResultWrapper[SecretGetResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[SecretGetResponse]

View file

@ -60,7 +60,7 @@ class SettingsResource(SyncAPIResource):
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SettingEditResponse]:
"""
Patch script metadata, such as bindings
Patch script metadata, such as bindings.
Args:
account_id: Identifier.
@ -185,7 +185,7 @@ class AsyncSettingsResource(AsyncAPIResource):
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SettingEditResponse]:
"""
Patch script metadata, such as bindings
Patch script metadata, such as bindings.
Args:
account_id: Identifier.

View file

@ -69,7 +69,7 @@ class TagsResource(SyncAPIResource):
script_name: Name of the script, used in URLs and route configuration.
body: Tags to help you manage your Workers
body: Tags to help you manage your Workers.
extra_headers: Send extra headers
@ -166,7 +166,7 @@ class TagsResource(SyncAPIResource):
script_name: Name of the script, used in URLs and route configuration.
tag: Tag to help you manage your Worker
tag: Tag to help you manage your Worker.
extra_headers: Send extra headers
@ -241,7 +241,7 @@ class AsyncTagsResource(AsyncAPIResource):
script_name: Name of the script, used in URLs and route configuration.
body: Tags to help you manage your Workers
body: Tags to help you manage your Workers.
extra_headers: Send extra headers
@ -338,7 +338,7 @@ class AsyncTagsResource(AsyncAPIResource):
script_name: Name of the script, used in URLs and route configuration.
tag: Tag to help you manage your Worker
tag: Tag to help you manage your Worker.
extra_headers: Send extra headers

View file

@ -59,13 +59,13 @@ class MetadataAssetsConfig(TypedDict, total=False):
_headers: str
"""
The contents of a \\__headers file (used to attach custom headers on asset
responses)
responses).
"""
_redirects: str
"""
The contents of a \\__redirects file (used to apply redirects or proxy paths ahead
of asset serving)
of asset serving).
"""
html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]
@ -479,7 +479,7 @@ class MetadataPlacement(TypedDict, total=False):
class Metadata(TypedDict, total=False):
assets: MetadataAssets
"""Configuration for assets within a Worker"""
"""Configuration for assets within a Worker."""
bindings: Iterable[MetadataBinding]
"""List of bindings attached to a Worker.

View file

@ -31,6 +31,8 @@ class Placement(BaseModel):
class ScriptUpdateResponse(BaseModel):
startup_time_ms: int
id: Optional[str] = None
"""The id of the script in the Workers system. Usually the script name."""
@ -59,18 +61,8 @@ class ScriptUpdateResponse(BaseModel):
"""
placement_mode: Optional[Literal["smart"]] = None
"""
Enables
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
startup_time_ms: Optional[int] = None
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -2,9 +2,7 @@
from __future__ import annotations
from .schedule import Schedule as Schedule
from .deployment import Deployment as Deployment
from .schedule_param import ScheduleParam as ScheduleParam
from .consumer_script import ConsumerScript as ConsumerScript
from .deployment_param import DeploymentParam as DeploymentParam
from .tail_get_response import TailGetResponse as TailGetResponse

View file

@ -1,15 +0,0 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
from ...._models import BaseModel
__all__ = ["Schedule"]
class Schedule(BaseModel):
created_on: Optional[str] = None
cron: Optional[str] = None
modified_on: Optional[str] = None

View file

@ -2,11 +2,18 @@
from typing import List, Optional
from .schedule import Schedule
from ...._models import BaseModel
__all__ = ["ScheduleGetResponse"]
__all__ = ["ScheduleGetResponse", "Schedule"]
class Schedule(BaseModel):
cron: str
created_on: Optional[str] = None
modified_on: Optional[str] = None
class ScheduleGetResponse(BaseModel):
schedules: Optional[List[Schedule]] = None
schedules: List[Schedule]

View file

@ -1,11 +0,0 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing_extensions import TypedDict
__all__ = ["ScheduleParam"]
class ScheduleParam(TypedDict, total=False):
cron: str

View file

@ -5,13 +5,15 @@ from __future__ import annotations
from typing import Iterable
from typing_extensions import Required, TypedDict
from .schedule_param import ScheduleParam
__all__ = ["ScheduleUpdateParams"]
__all__ = ["ScheduleUpdateParams", "Body"]
class ScheduleUpdateParams(TypedDict, total=False):
account_id: Required[str]
"""Identifier."""
body: Required[Iterable[ScheduleParam]]
body: Required[Iterable[Body]]
class Body(TypedDict, total=False):
cron: Required[str]

View file

@ -2,11 +2,18 @@
from typing import List, Optional
from .schedule import Schedule
from ...._models import BaseModel
__all__ = ["ScheduleUpdateResponse"]
__all__ = ["ScheduleUpdateResponse", "Schedule"]
class Schedule(BaseModel):
cron: str
created_on: Optional[str] = None
modified_on: Optional[str] = None
class ScheduleUpdateResponse(BaseModel):
schedules: Optional[List[Schedule]] = None
schedules: List[Schedule]

View file

@ -476,7 +476,7 @@ class Settings(TypedDict, total=False):
"""
tags: List[str]
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""
tail_consumers: Iterable[ConsumerScriptParam]
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -458,7 +458,7 @@ class ScriptAndVersionSettingEditResponse(BaseModel):
"""
tags: Optional[List[str]] = None
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -458,7 +458,7 @@ class ScriptAndVersionSettingGetResponse(BaseModel):
"""
tags: Optional[List[str]] = None
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -1,15 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
from ...._models import BaseModel
__all__ = ["TailCreateResponse"]
class TailCreateResponse(BaseModel):
id: Optional[str] = None
id: str
"""Identifier."""
expires_at: Optional[str] = None
expires_at: str
url: Optional[str] = None
url: str

View file

@ -1,15 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
from ...._models import BaseModel
__all__ = ["TailGetResponse"]
class TailGetResponse(BaseModel):
id: Optional[str] = None
id: str
"""Identifier."""
expires_at: Optional[str] = None
expires_at: str
url: Optional[str] = None
url: str

View file

@ -1,11 +1,9 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
from ..._models import BaseModel
__all__ = ["SubdomainGetResponse"]
class SubdomainGetResponse(BaseModel):
subdomain: Optional[str] = None
subdomain: str

View file

@ -11,4 +11,4 @@ class SubdomainUpdateParams(TypedDict, total=False):
account_id: Required[str]
"""Identifier."""
subdomain: str
subdomain: Required[str]

View file

@ -1,11 +1,9 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
from ..._models import BaseModel
__all__ = ["SubdomainUpdateResponse"]
class SubdomainUpdateResponse(BaseModel):
subdomain: Optional[str] = None
subdomain: str

View file

@ -12,4 +12,4 @@ class NamespaceCreateParams(TypedDict, total=False):
"""Identifier."""
name: str
"""The name of the dispatch namespace"""
"""The name of the dispatch namespace."""

View file

@ -28,4 +28,4 @@ class NamespaceCreateResponse(BaseModel):
"""Name of the Workers for Platforms dispatch namespace."""
script_count: Optional[int] = None
"""The current number of scripts in this Dispatch Namespace"""
"""The current number of scripts in this Dispatch Namespace."""

View file

@ -28,4 +28,4 @@ class NamespaceGetResponse(BaseModel):
"""Name of the Workers for Platforms dispatch namespace."""
script_count: Optional[int] = None
"""The current number of scripts in this Dispatch Namespace"""
"""The current number of scripts in this Dispatch Namespace."""

View file

@ -28,4 +28,4 @@ class NamespaceListResponse(BaseModel):
"""Name of the Workers for Platforms dispatch namespace."""
script_count: Optional[int] = None
"""The current number of scripts in this Dispatch Namespace"""
"""The current number of scripts in this Dispatch Namespace."""

View file

@ -62,13 +62,13 @@ class MetadataAssetsConfig(TypedDict, total=False):
_headers: str
"""
The contents of a \\__headers file (used to attach custom headers on asset
responses)
responses).
"""
_redirects: str
"""
The contents of a \\__redirects file (used to apply redirects or proxy paths ahead
of asset serving)
of asset serving).
"""
html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]
@ -482,7 +482,7 @@ class MetadataPlacement(TypedDict, total=False):
class Metadata(TypedDict, total=False):
assets: MetadataAssets
"""Configuration for assets within a Worker"""
"""Configuration for assets within a Worker."""
bindings: Iterable[MetadataBinding]
"""List of bindings attached to a Worker.

View file

@ -31,6 +31,8 @@ class Placement(BaseModel):
class ScriptUpdateResponse(BaseModel):
startup_time_ms: int
id: Optional[str] = None
"""The id of the script in the Workers system. Usually the script name."""
@ -59,18 +61,8 @@ class ScriptUpdateResponse(BaseModel):
"""
placement_mode: Optional[Literal["smart"]] = None
"""
Enables
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
startup_time_ms: Optional[int] = None
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -479,7 +479,7 @@ class Settings(TypedDict, total=False):
"""
tags: List[str]
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""
tail_consumers: Iterable[ConsumerScriptParam]
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -458,7 +458,7 @@ class SettingEditResponse(BaseModel):
"""
tags: Optional[List[str]] = None
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -458,7 +458,7 @@ class SettingGetResponse(BaseModel):
"""
tags: Optional[List[str]] = None
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""

View file

@ -16,4 +16,4 @@ class TagUpdateParams(TypedDict, total=False):
"""Name of the Workers for Platforms dispatch namespace."""
body: Required[List[str]]
"""Tags to help you manage your Workers"""
"""Tags to help you manage your Workers."""

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import httpx
import pytest
@ -33,7 +33,7 @@ class TestContent:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={},
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -48,7 +48,7 @@ class TestContent:
cf_worker_body_part="CF-WORKER-BODY-PART",
cf_worker_main_module_part="CF-WORKER-MAIN-MODULE-PART",
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -62,7 +62,7 @@ class TestContent:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -76,7 +76,7 @@ class TestContent:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
assert cast(Any, response.is_closed) is True
@ -175,7 +175,7 @@ class TestAsyncContent:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={},
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -190,7 +190,7 @@ class TestAsyncContent:
cf_worker_body_part="CF-WORKER-BODY-PART",
cf_worker_main_module_part="CF-WORKER-MAIN-MODULE-PART",
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -204,7 +204,7 @@ class TestAsyncContent:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = await response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -218,7 +218,7 @@ class TestAsyncContent:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = await response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -22,35 +22,35 @@ class TestSchedules:
schedule = client.workers.scripts.schedules.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"])
assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"])
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
response = client.workers.scripts.schedules.with_raw_response.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = response.parse()
assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"])
assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
with client.workers.scripts.schedules.with_streaming_response.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = response.parse()
assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"])
assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"])
assert cast(Any, response.is_closed) is True
@ -60,14 +60,14 @@ class TestSchedules:
client.workers.scripts.schedules.with_raw_response.update(
script_name="this-is_my_script-01",
account_id="",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
client.workers.scripts.schedules.with_raw_response.update(
script_name="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
@parametrize
@ -76,7 +76,7 @@ class TestSchedules:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"])
assert_matches_type(ScheduleGetResponse, schedule, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -88,7 +88,7 @@ class TestSchedules:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = response.parse()
assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"])
assert_matches_type(ScheduleGetResponse, schedule, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -100,7 +100,7 @@ class TestSchedules:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = response.parse()
assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"])
assert_matches_type(ScheduleGetResponse, schedule, path=["response"])
assert cast(Any, response.is_closed) is True
@ -127,35 +127,35 @@ class TestAsyncSchedules:
schedule = await async_client.workers.scripts.schedules.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"])
assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
response = await async_client.workers.scripts.schedules.with_raw_response.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = await response.parse()
assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"])
assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
async with async_client.workers.scripts.schedules.with_streaming_response.update(
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = await response.parse()
assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"])
assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"])
assert cast(Any, response.is_closed) is True
@ -165,14 +165,14 @@ class TestAsyncSchedules:
await async_client.workers.scripts.schedules.with_raw_response.update(
script_name="this-is_my_script-01",
account_id="",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
await async_client.workers.scripts.schedules.with_raw_response.update(
script_name="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{}],
body=[{"cron": "*/30 * * * *"}],
)
@parametrize
@ -181,7 +181,7 @@ class TestAsyncSchedules:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"])
assert_matches_type(ScheduleGetResponse, schedule, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -193,7 +193,7 @@ class TestAsyncSchedules:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = await response.parse()
assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"])
assert_matches_type(ScheduleGetResponse, schedule, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -205,7 +205,7 @@ class TestAsyncSchedules:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
schedule = await response.parse()
assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"])
assert_matches_type(ScheduleGetResponse, schedule, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -26,9 +26,7 @@ class TestScriptAndVersionSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
@parametrize
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
@ -88,9 +86,7 @@ class TestScriptAndVersionSettings:
"usage_model": "standard",
},
)
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
@parametrize
def test_raw_response_edit(self, client: Cloudflare) -> None:
@ -102,9 +98,7 @@ class TestScriptAndVersionSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = response.parse()
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
@parametrize
def test_streaming_response_edit(self, client: Cloudflare) -> None:
@ -116,9 +110,7 @@ class TestScriptAndVersionSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = response.parse()
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -142,7 +134,7 @@ class TestScriptAndVersionSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScriptAndVersionSettingGetResponse], script_and_version_setting, path=["response"])
assert_matches_type(ScriptAndVersionSettingGetResponse, script_and_version_setting, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -154,7 +146,7 @@ class TestScriptAndVersionSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = response.parse()
assert_matches_type(Optional[ScriptAndVersionSettingGetResponse], script_and_version_setting, path=["response"])
assert_matches_type(ScriptAndVersionSettingGetResponse, script_and_version_setting, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -166,9 +158,7 @@ class TestScriptAndVersionSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = response.parse()
assert_matches_type(
Optional[ScriptAndVersionSettingGetResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingGetResponse, script_and_version_setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -196,9 +186,7 @@ class TestAsyncScriptAndVersionSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
@parametrize
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
@ -258,9 +246,7 @@ class TestAsyncScriptAndVersionSettings:
"usage_model": "standard",
},
)
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
@parametrize
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
@ -272,9 +258,7 @@ class TestAsyncScriptAndVersionSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = await response.parse()
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
@parametrize
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
@ -286,9 +270,7 @@ class TestAsyncScriptAndVersionSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = await response.parse()
assert_matches_type(
Optional[ScriptAndVersionSettingEditResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingEditResponse, script_and_version_setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -312,7 +294,7 @@ class TestAsyncScriptAndVersionSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScriptAndVersionSettingGetResponse], script_and_version_setting, path=["response"])
assert_matches_type(ScriptAndVersionSettingGetResponse, script_and_version_setting, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -324,7 +306,7 @@ class TestAsyncScriptAndVersionSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = await response.parse()
assert_matches_type(Optional[ScriptAndVersionSettingGetResponse], script_and_version_setting, path=["response"])
assert_matches_type(ScriptAndVersionSettingGetResponse, script_and_version_setting, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -336,9 +318,7 @@ class TestAsyncScriptAndVersionSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script_and_version_setting = await response.parse()
assert_matches_type(
Optional[ScriptAndVersionSettingGetResponse], script_and_version_setting, path=["response"]
)
assert_matches_type(ScriptAndVersionSettingGetResponse, script_and_version_setting, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -23,7 +23,7 @@ class TestSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
@ -48,7 +48,7 @@ class TestSettings:
}
],
)
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
def test_raw_response_edit(self, client: Cloudflare) -> None:
@ -60,7 +60,7 @@ class TestSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
def test_streaming_response_edit(self, client: Cloudflare) -> None:
@ -72,7 +72,7 @@ class TestSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -96,7 +96,7 @@ class TestSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -108,7 +108,7 @@ class TestSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -120,7 +120,7 @@ class TestSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -148,7 +148,7 @@ class TestAsyncSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
@ -173,7 +173,7 @@ class TestAsyncSettings:
}
],
)
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
@ -185,7 +185,7 @@ class TestAsyncSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = await response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
@ -197,7 +197,7 @@ class TestAsyncSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = await response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -221,7 +221,7 @@ class TestAsyncSettings:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -233,7 +233,7 @@ class TestAsyncSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = await response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -245,7 +245,7 @@ class TestAsyncSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = await response.parse()
assert_matches_type(Optional[ScriptSetting], setting, path=["response"])
assert_matches_type(ScriptSetting, setting, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -24,7 +24,7 @@ class TestTail:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={},
)
assert_matches_type(Optional[TailCreateResponse], tail, path=["response"])
assert_matches_type(TailCreateResponse, tail, path=["response"])
@parametrize
def test_raw_response_create(self, client: Cloudflare) -> None:
@ -37,7 +37,7 @@ class TestTail:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = response.parse()
assert_matches_type(Optional[TailCreateResponse], tail, path=["response"])
assert_matches_type(TailCreateResponse, tail, path=["response"])
@parametrize
def test_streaming_response_create(self, client: Cloudflare) -> None:
@ -50,7 +50,7 @@ class TestTail:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = response.parse()
assert_matches_type(Optional[TailCreateResponse], tail, path=["response"])
assert_matches_type(TailCreateResponse, tail, path=["response"])
assert cast(Any, response.is_closed) is True
@ -73,7 +73,7 @@ class TestTail:
@parametrize
def test_method_delete(self, client: Cloudflare) -> None:
tail = client.workers.scripts.tail.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
@ -82,7 +82,7 @@ class TestTail:
@parametrize
def test_raw_response_delete(self, client: Cloudflare) -> None:
response = client.workers.scripts.tail.with_raw_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
@ -95,7 +95,7 @@ class TestTail:
@parametrize
def test_streaming_response_delete(self, client: Cloudflare) -> None:
with client.workers.scripts.tail.with_streaming_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
) as response:
@ -111,14 +111,14 @@ class TestTail:
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.scripts.tail.with_raw_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="",
script_name="this-is_my_script-01",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
client.workers.scripts.tail.with_raw_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="",
)
@ -136,7 +136,7 @@ class TestTail:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[TailGetResponse], tail, path=["response"])
assert_matches_type(TailGetResponse, tail, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -148,7 +148,7 @@ class TestTail:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = response.parse()
assert_matches_type(Optional[TailGetResponse], tail, path=["response"])
assert_matches_type(TailGetResponse, tail, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -160,7 +160,7 @@ class TestTail:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = response.parse()
assert_matches_type(Optional[TailGetResponse], tail, path=["response"])
assert_matches_type(TailGetResponse, tail, path=["response"])
assert cast(Any, response.is_closed) is True
@ -189,7 +189,7 @@ class TestAsyncTail:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={},
)
assert_matches_type(Optional[TailCreateResponse], tail, path=["response"])
assert_matches_type(TailCreateResponse, tail, path=["response"])
@parametrize
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
@ -202,7 +202,7 @@ class TestAsyncTail:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = await response.parse()
assert_matches_type(Optional[TailCreateResponse], tail, path=["response"])
assert_matches_type(TailCreateResponse, tail, path=["response"])
@parametrize
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
@ -215,7 +215,7 @@ class TestAsyncTail:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = await response.parse()
assert_matches_type(Optional[TailCreateResponse], tail, path=["response"])
assert_matches_type(TailCreateResponse, tail, path=["response"])
assert cast(Any, response.is_closed) is True
@ -238,7 +238,7 @@ class TestAsyncTail:
@parametrize
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
tail = await async_client.workers.scripts.tail.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
@ -247,7 +247,7 @@ class TestAsyncTail:
@parametrize
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
response = await async_client.workers.scripts.tail.with_raw_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
@ -260,7 +260,7 @@ class TestAsyncTail:
@parametrize
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
async with async_client.workers.scripts.tail.with_streaming_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
) as response:
@ -276,14 +276,14 @@ class TestAsyncTail:
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.scripts.tail.with_raw_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="",
script_name="this-is_my_script-01",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
await async_client.workers.scripts.tail.with_raw_response.delete(
id="03dc9f77817b488fb26c5861ec18f791",
id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="",
)
@ -301,7 +301,7 @@ class TestAsyncTail:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[TailGetResponse], tail, path=["response"])
assert_matches_type(TailGetResponse, tail, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -313,7 +313,7 @@ class TestAsyncTail:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = await response.parse()
assert_matches_type(Optional[TailGetResponse], tail, path=["response"])
assert_matches_type(TailGetResponse, tail, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -325,7 +325,7 @@ class TestAsyncTail:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tail = await response.parse()
assert_matches_type(Optional[TailGetResponse], tail, path=["response"])
assert_matches_type(TailGetResponse, tail, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -30,7 +30,7 @@ class TestVersions:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={"main_module": "worker.js"},
)
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -57,7 +57,7 @@ class TestVersions:
"usage_model": "standard",
},
)
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -71,7 +71,7 @@ class TestVersions:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -85,7 +85,7 @@ class TestVersions:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
@ -172,7 +172,7 @@ class TestVersions:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
assert_matches_type(Optional[VersionGetResponse], version, path=["response"])
assert_matches_type(VersionGetResponse, version, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -185,7 +185,7 @@ class TestVersions:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
assert_matches_type(Optional[VersionGetResponse], version, path=["response"])
assert_matches_type(VersionGetResponse, version, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -198,7 +198,7 @@ class TestVersions:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
assert_matches_type(Optional[VersionGetResponse], version, path=["response"])
assert_matches_type(VersionGetResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
@ -237,7 +237,7 @@ class TestAsyncVersions:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={"main_module": "worker.js"},
)
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -264,7 +264,7 @@ class TestAsyncVersions:
"usage_model": "standard",
},
)
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -278,7 +278,7 @@ class TestAsyncVersions:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -292,7 +292,7 @@ class TestAsyncVersions:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
assert_matches_type(Optional[VersionCreateResponse], version, path=["response"])
assert_matches_type(VersionCreateResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
@ -379,7 +379,7 @@ class TestAsyncVersions:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
script_name="this-is_my_script-01",
)
assert_matches_type(Optional[VersionGetResponse], version, path=["response"])
assert_matches_type(VersionGetResponse, version, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -392,7 +392,7 @@ class TestAsyncVersions:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
assert_matches_type(Optional[VersionGetResponse], version, path=["response"])
assert_matches_type(VersionGetResponse, version, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -405,7 +405,7 @@ class TestAsyncVersions:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
assert_matches_type(Optional[VersionGetResponse], version, path=["response"])
assert_matches_type(VersionGetResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -25,7 +25,7 @@ class TestAccountSettings:
account_setting = client.workers.account_settings.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
@parametrize
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
@ -34,7 +34,7 @@ class TestAccountSettings:
default_usage_model="default_usage_model",
green_compute=True,
)
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
@ -45,7 +45,7 @@ class TestAccountSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = response.parse()
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
@ -56,7 +56,7 @@ class TestAccountSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = response.parse()
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -72,7 +72,7 @@ class TestAccountSettings:
account_setting = client.workers.account_settings.get(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -83,7 +83,7 @@ class TestAccountSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = response.parse()
assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -94,7 +94,7 @@ class TestAccountSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = response.parse()
assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -114,7 +114,7 @@ class TestAsyncAccountSettings:
account_setting = await async_client.workers.account_settings.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
@ -123,7 +123,7 @@ class TestAsyncAccountSettings:
default_usage_model="default_usage_model",
green_compute=True,
)
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
@ -134,7 +134,7 @@ class TestAsyncAccountSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = await response.parse()
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
@ -145,7 +145,7 @@ class TestAsyncAccountSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = await response.parse()
assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"])
assert cast(Any, response.is_closed) is True
@ -161,7 +161,7 @@ class TestAsyncAccountSettings:
account_setting = await async_client.workers.account_settings.get(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -172,7 +172,7 @@ class TestAsyncAccountSettings:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = await response.parse()
assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -183,7 +183,7 @@ class TestAsyncAccountSettings:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account_setting = await response.parse()
assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"])
assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -29,7 +29,7 @@ class TestScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -104,7 +104,7 @@ class TestScripts:
"usage_model": "standard",
},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -118,7 +118,7 @@ class TestScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -132,7 +132,7 @@ class TestScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -197,7 +197,7 @@ class TestScripts:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
def test_method_delete_with_all_params(self, client: Cloudflare) -> None:
@ -206,7 +206,7 @@ class TestScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
force=True,
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
def test_raw_response_delete(self, client: Cloudflare) -> None:
@ -218,7 +218,7 @@ class TestScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
def test_streaming_response_delete(self, client: Cloudflare) -> None:
@ -230,7 +230,7 @@ class TestScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -308,7 +308,7 @@ class TestAsyncScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
metadata={},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -383,7 +383,7 @@ class TestAsyncScripts:
"usage_model": "standard",
},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -397,7 +397,7 @@ class TestAsyncScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -411,7 +411,7 @@ class TestAsyncScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -476,7 +476,7 @@ class TestAsyncScripts:
script_name="this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None:
@ -485,7 +485,7 @@ class TestAsyncScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
force=True,
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
@ -497,7 +497,7 @@ class TestAsyncScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
@ -509,7 +509,7 @@ class TestAsyncScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -21,38 +21,33 @@ class TestSubdomains:
def test_method_update(self, client: Cloudflare) -> None:
subdomain = client.workers.subdomains.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="my-subdomain",
)
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
@parametrize
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
subdomain = client.workers.subdomains.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="example-subdomain",
)
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"])
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
response = client.workers.subdomains.with_raw_response.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="my-subdomain",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = response.parse()
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
with client.workers.subdomains.with_streaming_response.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="my-subdomain",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = response.parse()
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"])
assert cast(Any, response.is_closed) is True
@ -61,6 +56,7 @@ class TestSubdomains:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.workers.subdomains.with_raw_response.update(
account_id="",
subdomain="my-subdomain",
)
@parametrize
@ -68,7 +64,7 @@ class TestSubdomains:
subdomain = client.workers.subdomains.get(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"])
assert_matches_type(SubdomainGetResponse, subdomain, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -79,7 +75,7 @@ class TestSubdomains:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = response.parse()
assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"])
assert_matches_type(SubdomainGetResponse, subdomain, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -90,7 +86,7 @@ class TestSubdomains:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = response.parse()
assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"])
assert_matches_type(SubdomainGetResponse, subdomain, path=["response"])
assert cast(Any, response.is_closed) is True
@ -109,38 +105,33 @@ class TestAsyncSubdomains:
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
subdomain = await async_client.workers.subdomains.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="my-subdomain",
)
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
subdomain = await async_client.workers.subdomains.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="example-subdomain",
)
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
response = await async_client.workers.subdomains.with_raw_response.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="my-subdomain",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = await response.parse()
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
async with async_client.workers.subdomains.with_streaming_response.update(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
subdomain="my-subdomain",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = await response.parse()
assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"])
assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"])
assert cast(Any, response.is_closed) is True
@ -149,6 +140,7 @@ class TestAsyncSubdomains:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.workers.subdomains.with_raw_response.update(
account_id="",
subdomain="my-subdomain",
)
@parametrize
@ -156,7 +148,7 @@ class TestAsyncSubdomains:
subdomain = await async_client.workers.subdomains.get(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"])
assert_matches_type(SubdomainGetResponse, subdomain, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -167,7 +159,7 @@ class TestAsyncSubdomains:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = await response.parse()
assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"])
assert_matches_type(SubdomainGetResponse, subdomain, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -178,7 +170,7 @@ class TestAsyncSubdomains:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
subdomain = await response.parse()
assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"])
assert_matches_type(SubdomainGetResponse, subdomain, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import httpx
import pytest
@ -34,7 +34,7 @@ class TestContent:
dispatch_namespace="my-dispatch-namespace",
metadata={},
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -50,7 +50,7 @@ class TestContent:
cf_worker_body_part="CF-WORKER-BODY-PART",
cf_worker_main_module_part="CF-WORKER-MAIN-MODULE-PART",
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -65,7 +65,7 @@ class TestContent:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -80,7 +80,7 @@ class TestContent:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
assert cast(Any, response.is_closed) is True
@ -202,7 +202,7 @@ class TestAsyncContent:
dispatch_namespace="my-dispatch-namespace",
metadata={},
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -218,7 +218,7 @@ class TestAsyncContent:
cf_worker_body_part="CF-WORKER-BODY-PART",
cf_worker_main_module_part="CF-WORKER-MAIN-MODULE-PART",
)
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -235,7 +235,7 @@ class TestAsyncContent:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = await response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -252,7 +252,7 @@ class TestAsyncContent:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
content = await response.parse()
assert_matches_type(Optional[Script], content, path=["response"])
assert_matches_type(Script, content, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -32,7 +32,7 @@ class TestSecrets:
text="My secret.",
type="secret_text",
)
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
def test_raw_response_update_overload_1(self, client: Cloudflare) -> None:
@ -48,7 +48,7 @@ class TestSecrets:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None:
@ -64,7 +64,7 @@ class TestSecrets:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
assert cast(Any, response.is_closed) is True
@ -112,7 +112,7 @@ class TestSecrets:
type="secret_key",
usages=["encrypt", "decrypt"],
)
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> None:
@ -128,7 +128,7 @@ class TestSecrets:
key_base64="key_base64",
key_jwk={},
)
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
def test_raw_response_update_overload_2(self, client: Cloudflare) -> None:
@ -146,7 +146,7 @@ class TestSecrets:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None:
@ -164,7 +164,7 @@ class TestSecrets:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
assert cast(Any, response.is_closed) is True
@ -348,7 +348,7 @@ class TestSecrets:
dispatch_namespace="my-dispatch-namespace",
script_name="this-is_my_script-01",
)
assert_matches_type(Optional[SecretGetResponse], secret, path=["response"])
assert_matches_type(SecretGetResponse, secret, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -362,7 +362,7 @@ class TestSecrets:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = response.parse()
assert_matches_type(Optional[SecretGetResponse], secret, path=["response"])
assert_matches_type(SecretGetResponse, secret, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -376,7 +376,7 @@ class TestSecrets:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = response.parse()
assert_matches_type(Optional[SecretGetResponse], secret, path=["response"])
assert_matches_type(SecretGetResponse, secret, path=["response"])
assert cast(Any, response.is_closed) is True
@ -428,7 +428,7 @@ class TestAsyncSecrets:
text="My secret.",
type="secret_text",
)
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None:
@ -446,7 +446,7 @@ class TestAsyncSecrets:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = await response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None:
@ -464,7 +464,7 @@ class TestAsyncSecrets:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = await response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
assert cast(Any, response.is_closed) is True
@ -512,7 +512,7 @@ class TestAsyncSecrets:
type="secret_key",
usages=["encrypt", "decrypt"],
)
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
async def test_method_update_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None:
@ -528,7 +528,7 @@ class TestAsyncSecrets:
key_base64="key_base64",
key_jwk={},
)
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None:
@ -548,7 +548,7 @@ class TestAsyncSecrets:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = await response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
@parametrize
async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None:
@ -568,7 +568,7 @@ class TestAsyncSecrets:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = await response.parse()
assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"])
assert_matches_type(SecretUpdateResponse, secret, path=["response"])
assert cast(Any, response.is_closed) is True
@ -756,7 +756,7 @@ class TestAsyncSecrets:
dispatch_namespace="my-dispatch-namespace",
script_name="this-is_my_script-01",
)
assert_matches_type(Optional[SecretGetResponse], secret, path=["response"])
assert_matches_type(SecretGetResponse, secret, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -770,7 +770,7 @@ class TestAsyncSecrets:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = await response.parse()
assert_matches_type(Optional[SecretGetResponse], secret, path=["response"])
assert_matches_type(SecretGetResponse, secret, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -784,7 +784,7 @@ class TestAsyncSecrets:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
secret = await response.parse()
assert_matches_type(Optional[SecretGetResponse], secret, path=["response"])
assert_matches_type(SecretGetResponse, secret, path=["response"])
assert cast(Any, response.is_closed) is True

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import os
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
@ -29,7 +29,7 @@ class TestScripts:
dispatch_namespace="my-dispatch-namespace",
metadata={},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -105,7 +105,7 @@ class TestScripts:
"usage_model": "standard",
},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -120,7 +120,7 @@ class TestScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -135,7 +135,7 @@ class TestScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -173,7 +173,7 @@ class TestScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
dispatch_namespace="my-dispatch-namespace",
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
def test_method_delete_with_all_params(self, client: Cloudflare) -> None:
@ -183,7 +183,7 @@ class TestScripts:
dispatch_namespace="my-dispatch-namespace",
force=True,
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
def test_raw_response_delete(self, client: Cloudflare) -> None:
@ -196,7 +196,7 @@ class TestScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
def test_streaming_response_delete(self, client: Cloudflare) -> None:
@ -209,7 +209,7 @@ class TestScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -243,7 +243,7 @@ class TestScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
dispatch_namespace="my-dispatch-namespace",
)
assert_matches_type(Optional[Script], script, path=["response"])
assert_matches_type(Script, script, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@ -256,7 +256,7 @@ class TestScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert_matches_type(Optional[Script], script, path=["response"])
assert_matches_type(Script, script, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@ -269,7 +269,7 @@ class TestScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = response.parse()
assert_matches_type(Optional[Script], script, path=["response"])
assert_matches_type(Script, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -309,7 +309,7 @@ class TestAsyncScripts:
dispatch_namespace="my-dispatch-namespace",
metadata={},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -385,7 +385,7 @@ class TestAsyncScripts:
"usage_model": "standard",
},
)
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -400,7 +400,7 @@ class TestAsyncScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@ -415,7 +415,7 @@ class TestAsyncScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -453,7 +453,7 @@ class TestAsyncScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
dispatch_namespace="my-dispatch-namespace",
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None:
@ -463,7 +463,7 @@ class TestAsyncScripts:
dispatch_namespace="my-dispatch-namespace",
force=True,
)
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
@ -476,7 +476,7 @@ class TestAsyncScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
@parametrize
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
@ -489,7 +489,7 @@ class TestAsyncScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert script is None
assert_matches_type(object, script, path=["response"])
assert cast(Any, response.is_closed) is True
@ -523,7 +523,7 @@ class TestAsyncScripts:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
dispatch_namespace="my-dispatch-namespace",
)
assert_matches_type(Optional[Script], script, path=["response"])
assert_matches_type(Script, script, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@ -536,7 +536,7 @@ class TestAsyncScripts:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert_matches_type(Optional[Script], script, path=["response"])
assert_matches_type(Script, script, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@ -549,7 +549,7 @@ class TestAsyncScripts:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
script = await response.parse()
assert_matches_type(Optional[Script], script, path=["response"])
assert_matches_type(Script, script, path=["response"])
assert cast(Any, response.is_closed) is True