diff --git a/src/cloudflare/resources/custom_pages/api.md b/src/cloudflare/resources/custom_pages/api.md
new file mode 100644
index 00000000000..19546e842fc
--- /dev/null
+++ b/src/cloudflare/resources/custom_pages/api.md
@@ -0,0 +1,38 @@
+# CustomPages
+
+Types:
+
+```python
+from cloudflare.types.custom_pages import (
+ CustomPageUpdateResponse,
+ CustomPageListResponse,
+ CustomPageGetResponse,
+)
+```
+
+Methods:
+
+- client.custom_pages.update(identifier, \*, account_id, zone_id, \*\*params) -> Optional[CustomPageUpdateResponse]
+- client.custom_pages.list(\*, account_id, zone_id) -> SyncSinglePage[CustomPageListResponse]
+- client.custom_pages.get(identifier, \*, account_id, zone_id) -> Optional[CustomPageGetResponse]
+
+## Assets
+
+Types:
+
+```python
+from cloudflare.types.custom_pages import (
+ AssetCreateResponse,
+ AssetUpdateResponse,
+ AssetListResponse,
+ AssetGetResponse,
+)
+```
+
+Methods:
+
+- client.custom_pages.assets.create(\*, account_id, zone_id, \*\*params) -> Optional[AssetCreateResponse]
+- client.custom_pages.assets.update(asset_name, \*, account_id, zone_id, \*\*params) -> Optional[AssetUpdateResponse]
+- client.custom_pages.assets.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[AssetListResponse]
+- client.custom_pages.assets.delete(asset_name, \*, account_id, zone_id) -> None
+- client.custom_pages.assets.get(asset_name, \*, account_id, zone_id) -> Optional[AssetGetResponse]
diff --git a/src/cloudflare/resources/custom_pages/assets.py b/src/cloudflare/resources/custom_pages/assets.py
index 015ed93d46e..ff10ccab5ab 100644
--- a/src/cloudflare/resources/custom_pages/assets.py
+++ b/src/cloudflare/resources/custom_pages/assets.py
@@ -7,7 +7,7 @@
import httpx
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -54,8 +54,8 @@ def create(
description: str,
name: str,
url: str,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -86,6 +86,10 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -99,7 +103,11 @@ def create(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._post(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
body=maybe_transform(
{
"description": description,
@@ -124,8 +132,8 @@ def update(
*,
description: str,
url: str,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -158,6 +166,10 @@ def update(
"""
if not asset_name:
raise ValueError(f"Expected a non-empty value for `asset_name` but received {asset_name!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -171,7 +183,12 @@ def update(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._put(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ asset_name=asset_name,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
body=maybe_transform(
{
"description": description,
@@ -192,8 +209,8 @@ def update(
def list(
self,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
page: int | Omit = omit,
per_page: int | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -219,6 +236,10 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -232,7 +253,11 @@ def list(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get_api_list(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
page=SyncV4PagePaginationArray[AssetListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -254,8 +279,8 @@ def delete(
self,
asset_name: str,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -284,6 +309,10 @@ def delete(
"""
if not asset_name:
raise ValueError(f"Expected a non-empty value for `asset_name` but received {asset_name!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -298,7 +327,12 @@ def delete(
account_or_zone_id = zone_id
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ asset_name=asset_name,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -309,8 +343,8 @@ def get(
self,
asset_name: str,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -339,6 +373,10 @@ def get(
"""
if not asset_name:
raise ValueError(f"Expected a non-empty value for `asset_name` but received {asset_name!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -352,7 +390,12 @@ def get(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ asset_name=asset_name,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -390,8 +433,8 @@ async def create(
description: str,
name: str,
url: str,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -422,6 +465,10 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -435,7 +482,11 @@ async def create(
account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._post(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
body=await async_maybe_transform(
{
"description": description,
@@ -460,8 +511,8 @@ async def update(
*,
description: str,
url: str,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -494,6 +545,10 @@ async def update(
"""
if not asset_name:
raise ValueError(f"Expected a non-empty value for `asset_name` but received {asset_name!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -507,7 +562,12 @@ async def update(
account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._put(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ asset_name=asset_name,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
body=await async_maybe_transform(
{
"description": description,
@@ -528,8 +588,8 @@ async def update(
def list(
self,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
page: int | Omit = omit,
per_page: int | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -555,6 +615,10 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -568,7 +632,11 @@ def list(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get_api_list(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets",
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
page=AsyncV4PagePaginationArray[AssetListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -590,8 +658,8 @@ async def delete(
self,
asset_name: str,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -620,6 +688,10 @@ async def delete(
"""
if not asset_name:
raise ValueError(f"Expected a non-empty value for `asset_name` but received {asset_name!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -634,7 +706,12 @@ async def delete(
account_or_zone_id = zone_id
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ asset_name=asset_name,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -645,8 +722,8 @@ async def get(
self,
asset_name: str,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -675,6 +752,10 @@ async def get(
"""
if not asset_name:
raise ValueError(f"Expected a non-empty value for `asset_name` but received {asset_name!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -688,7 +769,12 @@ async def get(
account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._get(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/assets/{asset_name}",
+ asset_name=asset_name,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/custom_pages/custom_pages.py b/src/cloudflare/resources/custom_pages/custom_pages.py
index 3d7169bb8de..79f52ab25bf 100644
--- a/src/cloudflare/resources/custom_pages/custom_pages.py
+++ b/src/cloudflare/resources/custom_pages/custom_pages.py
@@ -15,8 +15,8 @@
AssetsResourceWithStreamingResponse,
AsyncAssetsResourceWithStreamingResponse,
)
-from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._types import Body, Query, Headers, NotGiven, not_given
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -77,8 +77,8 @@ def update(
*,
state: Literal["default", "customized"],
url: str,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -110,6 +110,10 @@ def update(
"""
if not identifier:
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -123,7 +127,12 @@ def update(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._put(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ identifier=identifier,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
body=maybe_transform(
{
"state": state,
@@ -144,8 +153,8 @@ def update(
def list(
self,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -169,6 +178,10 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -182,7 +195,11 @@ def list(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get_api_list(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages",
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
page=SyncSinglePage[CustomPageListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -205,8 +222,8 @@ def get(
"waf_challenge",
],
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -234,6 +251,10 @@ def get(
"""
if not identifier:
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -247,7 +268,12 @@ def get(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ identifier=identifier,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -300,8 +326,8 @@ async def update(
*,
state: Literal["default", "customized"],
url: str,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -333,6 +359,10 @@ async def update(
"""
if not identifier:
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -346,7 +376,12 @@ async def update(
account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._put(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ identifier=identifier,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
body=await async_maybe_transform(
{
"state": state,
@@ -367,8 +402,8 @@ async def update(
def list(
self,
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -392,6 +427,10 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -405,7 +444,11 @@ def list(
account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get_api_list(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages",
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
page=AsyncSinglePage[CustomPageListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -428,8 +471,8 @@ async def get(
"waf_challenge",
],
*,
- account_id: str | Omit = omit,
- zone_id: str | Omit = omit,
+ account_id: str | None = None,
+ zone_id: str | None = None,
# 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,
@@ -457,6 +500,10 @@ async def get(
"""
if not identifier:
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")
@@ -470,7 +517,12 @@ async def get(
account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._get(
- f"/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ path_template(
+ "/{account_or_zone}/{account_or_zone_id}/custom_pages/{identifier}",
+ identifier=identifier,
+ account_or_zone=account_or_zone,
+ account_or_zone_id=account_or_zone_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/registrar/api.md b/src/cloudflare/resources/registrar/api.md
new file mode 100644
index 00000000000..3f77ba8afed
--- /dev/null
+++ b/src/cloudflare/resources/registrar/api.md
@@ -0,0 +1,52 @@
+# Registrar
+
+Types:
+
+```python
+from cloudflare.types.registrar import (
+ Registration,
+ WorkflowStatus,
+ RegistrarCheckResponse,
+ RegistrarSearchResponse,
+)
+```
+
+Methods:
+
+- client.registrar.check(\*, account_id, \*\*params) -> RegistrarCheckResponse
+- client.registrar.search(\*, account_id, \*\*params) -> RegistrarSearchResponse
+
+## Domains
+
+Types:
+
+```python
+from cloudflare.types.registrar import Domain
+```
+
+Methods:
+
+- client.registrar.domains.update(domain_name, \*, account_id, \*\*params) -> object
+- client.registrar.domains.list(\*, account_id) -> SyncSinglePage[Domain]
+- client.registrar.domains.get(domain_name, \*, account_id) -> object
+
+## Registrations
+
+Methods:
+
+- client.registrar.registrations.create(\*, account_id, \*\*params) -> WorkflowStatus
+- client.registrar.registrations.list(\*, account_id, \*\*params) -> SyncCursorPagination[Registration]
+- client.registrar.registrations.edit(domain_name, \*, account_id, \*\*params) -> WorkflowStatus
+- client.registrar.registrations.get(domain_name, \*, account_id) -> Registration
+
+## RegistrationStatus
+
+Methods:
+
+- client.registrar.registration_status.get(domain_name, \*, account_id) -> WorkflowStatus
+
+## UpdateStatus
+
+Methods:
+
+- client.registrar.update_status.get(domain_name, \*, account_id) -> WorkflowStatus
diff --git a/src/cloudflare/resources/registrar/domains.py b/src/cloudflare/resources/registrar/domains.py
index a2c17f77951..ce5c9324207 100644
--- a/src/cloudflare/resources/registrar/domains.py
+++ b/src/cloudflare/resources/registrar/domains.py
@@ -8,7 +8,7 @@
import httpx
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -53,7 +53,7 @@ def update(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
auto_renew: bool | Omit = omit,
locked: bool | Omit = omit,
privacy: bool | Omit = omit,
@@ -90,12 +90,16 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return self._put(
- f"/accounts/{account_id}/registrar/domains/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/domains/{domain_name}", account_id=account_id, domain_name=domain_name
+ ),
body=maybe_transform(
{
"auto_renew": auto_renew,
@@ -120,7 +124,7 @@ def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -142,10 +146,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/registrar/domains",
+ path_template("/accounts/{account_id}/registrar/domains", account_id=account_id),
page=SyncSinglePage[Domain],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -160,7 +166,7 @@ def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -187,12 +193,16 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return self._get(
- f"/accounts/{account_id}/registrar/domains/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/domains/{domain_name}", account_id=account_id, domain_name=domain_name
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -231,7 +241,7 @@ async def update(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
auto_renew: bool | Omit = omit,
locked: bool | Omit = omit,
privacy: bool | Omit = omit,
@@ -268,12 +278,16 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return await self._put(
- f"/accounts/{account_id}/registrar/domains/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/domains/{domain_name}", account_id=account_id, domain_name=domain_name
+ ),
body=await async_maybe_transform(
{
"auto_renew": auto_renew,
@@ -298,7 +312,7 @@ async def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -320,10 +334,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/registrar/domains",
+ path_template("/accounts/{account_id}/registrar/domains", account_id=account_id),
page=AsyncSinglePage[Domain],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -338,7 +354,7 @@ async def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -365,12 +381,16 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return await self._get(
- f"/accounts/{account_id}/registrar/domains/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/domains/{domain_name}", account_id=account_id, domain_name=domain_name
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/registrar/registrar.py b/src/cloudflare/resources/registrar/registrar.py
index 23e73fac298..4fd37350fa0 100644
--- a/src/cloudflare/resources/registrar/registrar.py
+++ b/src/cloudflare/resources/registrar/registrar.py
@@ -15,7 +15,7 @@
AsyncDomainsResourceWithStreamingResponse,
)
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -96,7 +96,7 @@ def with_streaming_response(self) -> RegistrarResourceWithStreamingResponse:
def check(
self,
*,
- account_id: str,
+ account_id: str | None = None,
domains: SequenceNotStr[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.
@@ -175,10 +175,12 @@ def check(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
- f"/accounts/{account_id}/registrar/domain-check",
+ path_template("/accounts/{account_id}/registrar/domain-check", account_id=account_id),
body=maybe_transform({"domains": domains}, registrar_check_params.RegistrarCheckParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -193,7 +195,7 @@ def check(
def search(
self,
*,
- account_id: str,
+ account_id: str | None = None,
q: str,
extensions: SequenceNotStr[str] | Omit = omit,
limit: int | Omit = omit,
@@ -215,8 +217,7 @@ def search(
Suggestions are scoped to extensions supported for programmatic registration via
this API (`POST /registrations`). Domains on unsupported extensions will not
- appear in results, even if they are available at the registry level. See the
- supported extensions list in `info.description`.
+ appear in results, even if they are available at the registry level.
### Use cases
@@ -262,10 +263,12 @@ def search(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get(
- f"/accounts/{account_id}/registrar/domain-search",
+ path_template("/accounts/{account_id}/registrar/domain-search", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -324,7 +327,7 @@ def with_streaming_response(self) -> AsyncRegistrarResourceWithStreamingResponse
async def check(
self,
*,
- account_id: str,
+ account_id: str | None = None,
domains: SequenceNotStr[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.
@@ -403,10 +406,12 @@ async def check(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
- f"/accounts/{account_id}/registrar/domain-check",
+ path_template("/accounts/{account_id}/registrar/domain-check", account_id=account_id),
body=await async_maybe_transform({"domains": domains}, registrar_check_params.RegistrarCheckParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -421,7 +426,7 @@ async def check(
async def search(
self,
*,
- account_id: str,
+ account_id: str | None = None,
q: str,
extensions: SequenceNotStr[str] | Omit = omit,
limit: int | Omit = omit,
@@ -443,8 +448,7 @@ async def search(
Suggestions are scoped to extensions supported for programmatic registration via
this API (`POST /registrations`). Domains on unsupported extensions will not
- appear in results, even if they are available at the registry level. See the
- supported extensions list in `info.description`.
+ appear in results, even if they are available at the registry level.
### Use cases
@@ -490,10 +494,12 @@ async def search(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._get(
- f"/accounts/{account_id}/registrar/domain-search",
+ path_template("/accounts/{account_id}/registrar/domain-search", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/registrar/registration_status.py b/src/cloudflare/resources/registrar/registration_status.py
index dc001c2f59a..d386ee60acb 100644
--- a/src/cloudflare/resources/registrar/registration_status.py
+++ b/src/cloudflare/resources/registrar/registration_status.py
@@ -7,6 +7,7 @@
import httpx
from ..._types import Body, Query, Headers, NotGiven, not_given
+from ..._utils import path_template
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -46,7 +47,7 @@ def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -113,12 +114,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return self._get(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}/registration-status",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}/registration-status",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -154,7 +161,7 @@ async def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -221,12 +228,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return await self._get(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}/registration-status",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}/registration-status",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/registrar/registrations.py b/src/cloudflare/resources/registrar/registrations.py
index e22fa1ce3e2..48b0db22b7e 100644
--- a/src/cloudflare/resources/registrar/registrations.py
+++ b/src/cloudflare/resources/registrar/registrations.py
@@ -8,7 +8,7 @@
import httpx
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform
+from ..._utils import is_given, path_template, maybe_transform, strip_not_given, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -18,8 +18,9 @@
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
-from ..._base_client import make_request_options
-from ...types.registrar import registration_edit_params, registration_create_params
+from ...pagination import SyncCursorPagination, AsyncCursorPagination
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.registrar import registration_edit_params, registration_list_params, registration_create_params
from ...types.registrar.registration import Registration
from ...types.registrar.workflow_status import WorkflowStatus
@@ -49,7 +50,7 @@ def with_streaming_response(self) -> RegistrationsResourceWithStreamingResponse:
def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
domain_name: str,
auto_renew: bool | Omit = omit,
contacts: registration_create_params.Contacts | Omit = omit,
@@ -78,10 +79,27 @@ def create(
- The account must not already be at the maximum supported domain limit. A
single account may own up to 100 domains in total across registrations created
through either the dashboard or this API.
- - The domain must be on a supported extension listed in `info.description`.
+ - The domain must be on a supported extension for programmatic registration.
- Use `POST /domain-check` immediately before calling this endpoint to confirm
real-time availability and pricing.
+ ### Supported extensions
+
+ In this API, "extension" means the full registrable suffix after the domain
+ label. For example, in `example.co.uk`, the extension is `co.uk`.
+
+ Programmatic registration is currently supported for:
+
+ `com`, `org`, `net`, `app`, `dev`, `cc`, `xyz`, `info`, `cloud`, `studio`,
+ `live`, `link`, `pro`, `tech`, `fyi`, `shop`, `online`, `tools`, `run`, `games`,
+ `build`, `systems`, `world`, `news`, `site`, `network`, `chat`, `space`,
+ `family`, `page`, `life`, `group`, `email`, `solutions`, `day`, `blog`, `ing`,
+ `icu`, `academy`, `today`
+
+ Cloudflare Registrar supports 400+ extensions in the dashboard. Extensions not
+ listed above can still be registered at
+ `https://dash.cloudflare.com/{account_id}/domains/registrations`.
+
### Express mode
The only required field is `domain_name`. If `contacts` is omitted, the system
@@ -168,11 +186,13 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
extra_headers = {**strip_not_given({"Prefer": prefer}), **(extra_headers or {})}
return self._post(
- f"/accounts/{account_id}/registrar/registrations",
+ path_template("/accounts/{account_id}/registrar/registrations", account_id=account_id),
body=maybe_transform(
{
"domain_name": domain_name,
@@ -193,11 +213,81 @@ def create(
cast_to=cast(Type[WorkflowStatus], ResultWrapper[WorkflowStatus]),
)
+ def list(
+ self,
+ *,
+ account_id: str | None = None,
+ cursor: str | Omit = omit,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ per_page: int | Omit = omit,
+ sort_by: Literal["registry_created_at", "registry_expires_at", "name"] | Omit = omit,
+ # 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,
+ ) -> SyncCursorPagination[Registration]:
+ """
+ Returns a paginated list of domain registrations owned by the account.
+
+ This endpoint uses cursor-based pagination. Results are ordered by registration
+ date by default. To fetch the next page, pass the `cursor` value from the
+ `result_info` object in the response as the `cursor` query parameter in your
+ next request. An empty `cursor` string indicates there are no more pages.
+
+ Args:
+ account_id: Identifier
+
+ cursor: Opaque token from a previous response's `result_info.cursor`. Pass this value to
+ fetch the next page of results. Omit (or pass an empty string) for the first
+ page.
+
+ direction: Sort direction for results. Defaults to ascending order.
+
+ per_page: Number of items to return per page.
+
+ sort_by: Column to sort results by. Defaults to registration date (`registry_created_at`)
+ when omitted.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ path_template("/accounts/{account_id}/registrar/registrations", account_id=account_id),
+ page=SyncCursorPagination[Registration],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "cursor": cursor,
+ "direction": direction,
+ "per_page": per_page,
+ "sort_by": sort_by,
+ },
+ registration_list_params.RegistrationListParams,
+ ),
+ ),
+ model=Registration,
+ )
+
def edit(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
auto_renew: bool | Omit = omit,
prefer: Literal["respond-async"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -242,6 +332,8 @@ def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
@@ -251,7 +343,11 @@ def edit(
**(extra_headers or {}),
}
return self._patch(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
body=maybe_transform({"auto_renew": auto_renew}, registration_edit_params.RegistrationEditParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -267,7 +363,7 @@ def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -299,12 +395,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return self._get(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -339,7 +441,7 @@ def with_streaming_response(self) -> AsyncRegistrationsResourceWithStreamingResp
async def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
domain_name: str,
auto_renew: bool | Omit = omit,
contacts: registration_create_params.Contacts | Omit = omit,
@@ -368,10 +470,27 @@ async def create(
- The account must not already be at the maximum supported domain limit. A
single account may own up to 100 domains in total across registrations created
through either the dashboard or this API.
- - The domain must be on a supported extension listed in `info.description`.
+ - The domain must be on a supported extension for programmatic registration.
- Use `POST /domain-check` immediately before calling this endpoint to confirm
real-time availability and pricing.
+ ### Supported extensions
+
+ In this API, "extension" means the full registrable suffix after the domain
+ label. For example, in `example.co.uk`, the extension is `co.uk`.
+
+ Programmatic registration is currently supported for:
+
+ `com`, `org`, `net`, `app`, `dev`, `cc`, `xyz`, `info`, `cloud`, `studio`,
+ `live`, `link`, `pro`, `tech`, `fyi`, `shop`, `online`, `tools`, `run`, `games`,
+ `build`, `systems`, `world`, `news`, `site`, `network`, `chat`, `space`,
+ `family`, `page`, `life`, `group`, `email`, `solutions`, `day`, `blog`, `ing`,
+ `icu`, `academy`, `today`
+
+ Cloudflare Registrar supports 400+ extensions in the dashboard. Extensions not
+ listed above can still be registered at
+ `https://dash.cloudflare.com/{account_id}/domains/registrations`.
+
### Express mode
The only required field is `domain_name`. If `contacts` is omitted, the system
@@ -458,11 +577,13 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
extra_headers = {**strip_not_given({"Prefer": prefer}), **(extra_headers or {})}
return await self._post(
- f"/accounts/{account_id}/registrar/registrations",
+ path_template("/accounts/{account_id}/registrar/registrations", account_id=account_id),
body=await async_maybe_transform(
{
"domain_name": domain_name,
@@ -483,11 +604,81 @@ async def create(
cast_to=cast(Type[WorkflowStatus], ResultWrapper[WorkflowStatus]),
)
+ def list(
+ self,
+ *,
+ account_id: str | None = None,
+ cursor: str | Omit = omit,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ per_page: int | Omit = omit,
+ sort_by: Literal["registry_created_at", "registry_expires_at", "name"] | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AsyncPaginator[Registration, AsyncCursorPagination[Registration]]:
+ """
+ Returns a paginated list of domain registrations owned by the account.
+
+ This endpoint uses cursor-based pagination. Results are ordered by registration
+ date by default. To fetch the next page, pass the `cursor` value from the
+ `result_info` object in the response as the `cursor` query parameter in your
+ next request. An empty `cursor` string indicates there are no more pages.
+
+ Args:
+ account_id: Identifier
+
+ cursor: Opaque token from a previous response's `result_info.cursor`. Pass this value to
+ fetch the next page of results. Omit (or pass an empty string) for the first
+ page.
+
+ direction: Sort direction for results. Defaults to ascending order.
+
+ per_page: Number of items to return per page.
+
+ sort_by: Column to sort results by. Defaults to registration date (`registry_created_at`)
+ when omitted.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get_api_list(
+ path_template("/accounts/{account_id}/registrar/registrations", account_id=account_id),
+ page=AsyncCursorPagination[Registration],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "cursor": cursor,
+ "direction": direction,
+ "per_page": per_page,
+ "sort_by": sort_by,
+ },
+ registration_list_params.RegistrationListParams,
+ ),
+ ),
+ model=Registration,
+ )
+
async def edit(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
auto_renew: bool | Omit = omit,
prefer: Literal["respond-async"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -532,6 +723,8 @@ async def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
@@ -541,7 +734,11 @@ async def edit(
**(extra_headers or {}),
}
return await self._patch(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
body=await async_maybe_transform(
{"auto_renew": auto_renew}, registration_edit_params.RegistrationEditParams
),
@@ -559,7 +756,7 @@ async def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -591,12 +788,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return await self._get(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -615,6 +818,9 @@ def __init__(self, registrations: RegistrationsResource) -> None:
self.create = to_raw_response_wrapper(
registrations.create,
)
+ self.list = to_raw_response_wrapper(
+ registrations.list,
+ )
self.edit = to_raw_response_wrapper(
registrations.edit,
)
@@ -630,6 +836,9 @@ def __init__(self, registrations: AsyncRegistrationsResource) -> None:
self.create = async_to_raw_response_wrapper(
registrations.create,
)
+ self.list = async_to_raw_response_wrapper(
+ registrations.list,
+ )
self.edit = async_to_raw_response_wrapper(
registrations.edit,
)
@@ -645,6 +854,9 @@ def __init__(self, registrations: RegistrationsResource) -> None:
self.create = to_streamed_response_wrapper(
registrations.create,
)
+ self.list = to_streamed_response_wrapper(
+ registrations.list,
+ )
self.edit = to_streamed_response_wrapper(
registrations.edit,
)
@@ -660,6 +872,9 @@ def __init__(self, registrations: AsyncRegistrationsResource) -> None:
self.create = async_to_streamed_response_wrapper(
registrations.create,
)
+ self.list = async_to_streamed_response_wrapper(
+ registrations.list,
+ )
self.edit = async_to_streamed_response_wrapper(
registrations.edit,
)
diff --git a/src/cloudflare/resources/registrar/update_status.py b/src/cloudflare/resources/registrar/update_status.py
index 693737a8348..089c42b4f32 100644
--- a/src/cloudflare/resources/registrar/update_status.py
+++ b/src/cloudflare/resources/registrar/update_status.py
@@ -7,6 +7,7 @@
import httpx
from ..._types import Body, Query, Headers, NotGiven, not_given
+from ..._utils import path_template
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -46,7 +47,7 @@ def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -83,12 +84,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return self._get(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}/update-status",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}/update-status",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -124,7 +131,7 @@ async def get(
self,
domain_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -161,12 +168,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_name:
raise ValueError(f"Expected a non-empty value for `domain_name` but received {domain_name!r}")
return await self._get(
- f"/accounts/{account_id}/registrar/registrations/{domain_name}/update-status",
+ path_template(
+ "/accounts/{account_id}/registrar/registrations/{domain_name}/update-status",
+ account_id=account_id,
+ domain_name=domain_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/account_settings.py b/src/cloudflare/resources/workers/account_settings.py
index ad45917e32d..fa107160931 100644
--- a/src/cloudflare/resources/workers/account_settings.py
+++ b/src/cloudflare/resources/workers/account_settings.py
@@ -7,7 +7,7 @@
import httpx
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -48,7 +48,7 @@ def with_streaming_response(self) -> AccountSettingsResourceWithStreamingRespons
def update(
self,
*,
- account_id: str,
+ account_id: str | None = None,
default_usage_model: str | Omit = omit,
green_compute: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -72,10 +72,12 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._put(
- f"/accounts/{account_id}/workers/account-settings",
+ path_template("/accounts/{account_id}/workers/account-settings", account_id=account_id),
body=maybe_transform(
{
"default_usage_model": default_usage_model,
@@ -96,7 +98,7 @@ def update(
def get(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -118,10 +120,12 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/account-settings",
+ path_template("/accounts/{account_id}/workers/account-settings", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -156,7 +160,7 @@ def with_streaming_response(self) -> AsyncAccountSettingsResourceWithStreamingRe
async def update(
self,
*,
- account_id: str,
+ account_id: str | None = None,
default_usage_model: str | Omit = omit,
green_compute: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -180,10 +184,12 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._put(
- f"/accounts/{account_id}/workers/account-settings",
+ path_template("/accounts/{account_id}/workers/account-settings", account_id=account_id),
body=await async_maybe_transform(
{
"default_usage_model": default_usage_model,
@@ -204,7 +210,7 @@ async def update(
async def get(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -226,10 +232,12 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/account-settings",
+ path_template("/accounts/{account_id}/workers/account-settings", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/api.md b/src/cloudflare/resources/workers/api.md
new file mode 100644
index 00000000000..888b67dbe94
--- /dev/null
+++ b/src/cloudflare/resources/workers/api.md
@@ -0,0 +1,337 @@
+# Workers
+
+Types:
+
+```python
+from cloudflare.types.workers import MigrationStep, SingleStepMigration, WorkerMetadata
+```
+
+## Beta
+
+### Workers
+
+Types:
+
+```python
+from cloudflare.types.workers.beta import Worker, WorkerDeleteResponse
+```
+
+Methods:
+
+- client.workers.beta.workers.create(\*, account_id, \*\*params) -> Worker
+- client.workers.beta.workers.update(worker_id, \*, account_id, \*\*params) -> Worker
+- client.workers.beta.workers.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Worker]
+- client.workers.beta.workers.delete(worker_id, \*, account_id) -> WorkerDeleteResponse
+- client.workers.beta.workers.edit(worker_id, \*, account_id, \*\*params) -> Worker
+- client.workers.beta.workers.get(worker_id, \*, account_id) -> Worker
+
+#### Versions
+
+Types:
+
+```python
+from cloudflare.types.workers.beta.workers import Version, VersionDeleteResponse
+```
+
+Methods:
+
+- client.workers.beta.workers.versions.create(worker_id, \*, account_id, \*\*params) -> Version
+- client.workers.beta.workers.versions.list(worker_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[Version]
+- client.workers.beta.workers.versions.delete(version_id, \*, account_id, worker_id) -> VersionDeleteResponse
+- client.workers.beta.workers.versions.get(version_id, \*, account_id, worker_id, \*\*params) -> Version
+
+## Routes
+
+Types:
+
+```python
+from cloudflare.types.workers import (
+ RouteCreateResponse,
+ RouteUpdateResponse,
+ RouteListResponse,
+ RouteDeleteResponse,
+ RouteGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.routes.create(\*, zone_id, \*\*params) -> RouteCreateResponse
+- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> RouteUpdateResponse
+- client.workers.routes.list(\*, zone_id) -> SyncSinglePage[RouteListResponse]
+- client.workers.routes.delete(route_id, \*, zone_id) -> RouteDeleteResponse
+- client.workers.routes.get(route_id, \*, zone_id) -> RouteGetResponse
+
+## Assets
+
+### Upload
+
+Types:
+
+```python
+from cloudflare.types.workers.assets import UploadCreateResponse
+```
+
+Methods:
+
+- client.workers.assets.upload.create(\*, account_id, \*\*params) -> Optional[UploadCreateResponse]
+
+## Scripts
+
+Types:
+
+```python
+from cloudflare.types.workers import (
+ Script,
+ ScriptSetting,
+ ScriptUpdateResponse,
+ ScriptListResponse,
+ ScriptGetResponse,
+ ScriptSearchResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> ScriptUpdateResponse
+- client.workers.scripts.list(\*, account_id, \*\*params) -> SyncSinglePage[ScriptListResponse]
+- client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> object
+- client.workers.scripts.get(script_name, \*, account_id) -> str
+- client.workers.scripts.search(\*, account_id, \*\*params) -> ScriptSearchResponse
+
+### Assets
+
+#### Upload
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts.assets import UploadCreateResponse
+```
+
+Methods:
+
+- client.workers.scripts.assets.upload.create(script_name, \*, account_id, \*\*params) -> Optional[UploadCreateResponse]
+
+### Subdomain
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ SubdomainCreateResponse,
+ SubdomainDeleteResponse,
+ SubdomainGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.subdomain.create(script_name, \*, account_id, \*\*params) -> SubdomainCreateResponse
+- client.workers.scripts.subdomain.delete(script_name, \*, account_id) -> SubdomainDeleteResponse
+- client.workers.scripts.subdomain.get(script_name, \*, account_id) -> SubdomainGetResponse
+
+### Schedules
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import ScheduleUpdateResponse, ScheduleGetResponse
+```
+
+Methods:
+
+- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> ScheduleUpdateResponse
+- client.workers.scripts.schedules.get(script_name, \*, account_id) -> ScheduleGetResponse
+
+### Tail
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ ConsumerScript,
+ TailCreateResponse,
+ TailDeleteResponse,
+ TailGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.tail.create(script_name, \*, account_id, \*\*params) -> TailCreateResponse
+- client.workers.scripts.tail.delete(id, \*, account_id, script_name) -> TailDeleteResponse
+- client.workers.scripts.tail.get(script_name, \*, account_id) -> TailGetResponse
+
+### Content
+
+Methods:
+
+- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Script
+- client.workers.scripts.content.get(script_name, \*, account_id) -> BinaryAPIResponse
+
+### Settings
+
+Methods:
+
+- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> ScriptSetting
+- client.workers.scripts.settings.get(script_name, \*, account_id) -> ScriptSetting
+
+### Deployments
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ Deployment,
+ DeploymentListResponse,
+ DeploymentDeleteResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> Deployment
+- client.workers.scripts.deployments.list(script_name, \*, account_id) -> DeploymentListResponse
+- client.workers.scripts.deployments.delete(deployment_id, \*, account_id, script_name) -> DeploymentDeleteResponse
+- client.workers.scripts.deployments.get(deployment_id, \*, account_id, script_name) -> Deployment
+
+### Versions
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ VersionCreateResponse,
+ VersionListResponse,
+ VersionGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> VersionCreateResponse
+- client.workers.scripts.versions.list(script_name, \*, account_id, \*\*params) -> SyncV4PagePagination[VersionListResponse]
+- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> VersionGetResponse
+
+### Secrets
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ SecretUpdateResponse,
+ SecretListResponse,
+ SecretGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.secrets.update(script_name, \*, account_id, \*\*params) -> Optional[SecretUpdateResponse]
+- client.workers.scripts.secrets.list(script_name, \*, account_id) -> SyncSinglePage[SecretListResponse]
+- client.workers.scripts.secrets.delete(secret_name, \*, account_id, script_name, \*\*params) -> object
+- client.workers.scripts.secrets.get(secret_name, \*, account_id, script_name, \*\*params) -> Optional[SecretGetResponse]
+
+### ScriptAndVersionSettings
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ ScriptAndVersionSettingEditResponse,
+ ScriptAndVersionSettingGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.script_and_version_settings.edit(script_name, \*, account_id, \*\*params) -> ScriptAndVersionSettingEditResponse
+- client.workers.scripts.script_and_version_settings.get(script_name, \*, account_id) -> ScriptAndVersionSettingGetResponse
+
+## AccountSettings
+
+Types:
+
+```python
+from cloudflare.types.workers import AccountSettingUpdateResponse, AccountSettingGetResponse
+```
+
+Methods:
+
+- client.workers.account_settings.update(\*, account_id, \*\*params) -> AccountSettingUpdateResponse
+- client.workers.account_settings.get(\*, account_id) -> AccountSettingGetResponse
+
+## Domains
+
+Types:
+
+```python
+from cloudflare.types.workers import (
+ DomainUpdateResponse,
+ DomainListResponse,
+ DomainDeleteResponse,
+ DomainGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.domains.update(\*, account_id, \*\*params) -> DomainUpdateResponse
+- client.workers.domains.list(\*, account_id, \*\*params) -> SyncSinglePage[DomainListResponse]
+- client.workers.domains.delete(domain_id, \*, account_id) -> DomainDeleteResponse
+- client.workers.domains.get(domain_id, \*, account_id) -> DomainGetResponse
+
+## Subdomains
+
+Types:
+
+```python
+from cloudflare.types.workers import SubdomainUpdateResponse, SubdomainGetResponse
+```
+
+Methods:
+
+- client.workers.subdomains.update(\*, account_id, \*\*params) -> SubdomainUpdateResponse
+- client.workers.subdomains.delete(\*, account_id) -> None
+- client.workers.subdomains.get(\*, account_id) -> SubdomainGetResponse
+
+## Observability
+
+### Telemetry
+
+Types:
+
+```python
+from cloudflare.types.workers.observability import (
+ TelemetryKeysResponse,
+ TelemetryQueryResponse,
+ TelemetryValuesResponse,
+)
+```
+
+Methods:
+
+- client.workers.observability.telemetry.keys(\*, account_id, \*\*params) -> SyncSinglePage[TelemetryKeysResponse]
+- client.workers.observability.telemetry.query(\*, account_id, \*\*params) -> TelemetryQueryResponse
+- client.workers.observability.telemetry.values(\*, account_id, \*\*params) -> SyncSinglePage[TelemetryValuesResponse]
+
+### Destinations
+
+Types:
+
+```python
+from cloudflare.types.workers.observability import (
+ DestinationCreateResponse,
+ DestinationUpdateResponse,
+ DestinationListResponse,
+ DestinationDeleteResponse,
+)
+```
+
+Methods:
+
+- client.workers.observability.destinations.create(\*, account_id, \*\*params) -> DestinationCreateResponse
+- client.workers.observability.destinations.update(slug, \*, account_id, \*\*params) -> DestinationUpdateResponse
+- client.workers.observability.destinations.list(\*, account_id, \*\*params) -> SyncSinglePage[DestinationListResponse]
+- client.workers.observability.destinations.delete(slug, \*, account_id) -> Optional[DestinationDeleteResponse]
diff --git a/src/cloudflare/resources/workers/assets/upload.py b/src/cloudflare/resources/workers/assets/upload.py
index 4ece6d4d094..b59d9ea76d4 100644
--- a/src/cloudflare/resources/workers/assets/upload.py
+++ b/src/cloudflare/resources/workers/assets/upload.py
@@ -8,7 +8,7 @@
import httpx
from ...._types import Body, Query, Headers, NotGiven, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -48,7 +48,7 @@ def with_streaming_response(self) -> UploadResourceWithStreamingResponse:
def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
base64: Literal[True],
body: Dict[str, str],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -77,6 +77,8 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
# It should be noted that the actual Content-Type header that will be
@@ -84,7 +86,7 @@ def create(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._post(
- f"/accounts/{account_id}/workers/assets/upload",
+ path_template("/accounts/{account_id}/workers/assets/upload", account_id=account_id),
body=maybe_transform(body, upload_create_params.UploadCreateParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -121,7 +123,7 @@ def with_streaming_response(self) -> AsyncUploadResourceWithStreamingResponse:
async def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
base64: Literal[True],
body: Dict[str, str],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -150,6 +152,8 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
# It should be noted that the actual Content-Type header that will be
@@ -157,7 +161,7 @@ async def create(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._post(
- f"/accounts/{account_id}/workers/assets/upload",
+ path_template("/accounts/{account_id}/workers/assets/upload", account_id=account_id),
body=await async_maybe_transform(body, upload_create_params.UploadCreateParams),
options=make_request_options(
extra_headers=extra_headers,
diff --git a/src/cloudflare/resources/workers/beta/workers/versions.py b/src/cloudflare/resources/workers/beta/workers/versions.py
index c8add11372c..a0aac19c2cc 100644
--- a/src/cloudflare/resources/workers/beta/workers/versions.py
+++ b/src/cloudflare/resources/workers/beta/workers/versions.py
@@ -8,7 +8,7 @@
import httpx
from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
-from ....._utils import maybe_transform, async_maybe_transform
+from ....._utils import path_template, maybe_transform, async_maybe_transform
from ....._compat import cached_property
from ....._resource import SyncAPIResource, AsyncAPIResource
from ....._response import (
@@ -51,7 +51,7 @@ def create(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
deploy: bool | Omit = omit,
annotations: version_create_params.Annotations | Omit = omit,
assets: version_create_params.Assets | Omit = omit,
@@ -140,12 +140,18 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._post(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ account_id=account_id,
+ worker_id=worker_id,
+ ),
body=maybe_transform(
{
"annotations": annotations,
@@ -178,7 +184,7 @@ def list(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
page: int | Omit = omit,
per_page: int | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -208,12 +214,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ account_id=account_id,
+ worker_id=worker_id,
+ ),
page=SyncV4PagePaginationArray[Version],
options=make_request_options(
extra_headers=extra_headers,
@@ -235,7 +247,7 @@ def delete(
self,
version_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
worker_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -263,6 +275,8 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
@@ -270,7 +284,12 @@ def delete(
if not version_id:
raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
return self._delete(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ account_id=account_id,
+ worker_id=worker_id,
+ version_id=version_id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -281,7 +300,7 @@ def get(
self,
version_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
worker_id: str,
include: Literal["modules"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -314,6 +333,8 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
@@ -321,7 +342,12 @@ def get(
if not version_id:
raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ account_id=account_id,
+ worker_id=worker_id,
+ version_id=version_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -358,7 +384,7 @@ async def create(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
deploy: bool | Omit = omit,
annotations: version_create_params.Annotations | Omit = omit,
assets: version_create_params.Assets | Omit = omit,
@@ -447,12 +473,18 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return await self._post(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ account_id=account_id,
+ worker_id=worker_id,
+ ),
body=await async_maybe_transform(
{
"annotations": annotations,
@@ -485,7 +517,7 @@ def list(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
page: int | Omit = omit,
per_page: int | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -515,12 +547,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions",
+ account_id=account_id,
+ worker_id=worker_id,
+ ),
page=AsyncV4PagePaginationArray[Version],
options=make_request_options(
extra_headers=extra_headers,
@@ -542,7 +580,7 @@ async def delete(
self,
version_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
worker_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -570,6 +608,8 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
@@ -577,7 +617,12 @@ async def delete(
if not version_id:
raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ account_id=account_id,
+ worker_id=worker_id,
+ version_id=version_id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -588,7 +633,7 @@ async def get(
self,
version_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
worker_id: str,
include: Literal["modules"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -621,6 +666,8 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
@@ -628,7 +675,12 @@ async def get(
if not version_id:
raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}/versions/{version_id}",
+ account_id=account_id,
+ worker_id=worker_id,
+ version_id=version_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/beta/workers/workers.py b/src/cloudflare/resources/workers/beta/workers/workers.py
index 00cca91310c..5c0d76c2857 100644
--- a/src/cloudflare/resources/workers/beta/workers/workers.py
+++ b/src/cloudflare/resources/workers/beta/workers/workers.py
@@ -16,7 +16,7 @@
AsyncVersionsResourceWithStreamingResponse,
)
from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
-from ....._utils import maybe_transform, async_maybe_transform
+from ....._utils import path_template, maybe_transform, async_maybe_transform
from ....._compat import cached_property
from ....._resource import SyncAPIResource, AsyncAPIResource
from ....._response import (
@@ -62,7 +62,7 @@ def with_streaming_response(self) -> WorkersResourceWithStreamingResponse:
def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
logpush: bool | Omit = omit,
observability: worker_create_params.Observability | Omit = omit,
@@ -102,10 +102,12 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
- f"/accounts/{account_id}/workers/workers",
+ path_template("/accounts/{account_id}/workers/workers", account_id=account_id),
body=maybe_transform(
{
"name": name,
@@ -131,7 +133,7 @@ def update(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
logpush: bool | Omit = omit,
observability: worker_update_params.Observability | Omit = omit,
@@ -176,12 +178,16 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._put(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
body=maybe_transform(
{
"name": name,
@@ -206,7 +212,7 @@ def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
order: Literal["asc", "desc"] | Omit = omit,
order_by: Literal["deployed_on", "updated_on", "created_on", "name"] | Omit = omit,
page: int | Omit = omit,
@@ -240,10 +246,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/workers",
+ path_template("/accounts/{account_id}/workers/workers", account_id=account_id),
page=SyncV4PagePaginationArray[Worker],
options=make_request_options(
extra_headers=extra_headers,
@@ -267,7 +275,7 @@ def delete(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -291,12 +299,16 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._delete(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -307,7 +319,7 @@ def edit(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
logpush: bool,
name: str,
observability: worker_edit_params.Observability,
@@ -350,12 +362,16 @@ def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._patch(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
body=maybe_transform(
{
"logpush": logpush,
@@ -381,7 +397,7 @@ def get(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -405,12 +421,16 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -449,7 +469,7 @@ def with_streaming_response(self) -> AsyncWorkersResourceWithStreamingResponse:
async def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
logpush: bool | Omit = omit,
observability: worker_create_params.Observability | Omit = omit,
@@ -489,10 +509,12 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
- f"/accounts/{account_id}/workers/workers",
+ path_template("/accounts/{account_id}/workers/workers", account_id=account_id),
body=await async_maybe_transform(
{
"name": name,
@@ -518,7 +540,7 @@ async def update(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
logpush: bool | Omit = omit,
observability: worker_update_params.Observability | Omit = omit,
@@ -563,12 +585,16 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return await self._put(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
body=await async_maybe_transform(
{
"name": name,
@@ -593,7 +619,7 @@ async def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
order: Literal["asc", "desc"] | Omit = omit,
order_by: Literal["deployed_on", "updated_on", "created_on", "name"] | Omit = omit,
page: int | Omit = omit,
@@ -627,10 +653,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/workers",
+ path_template("/accounts/{account_id}/workers/workers", account_id=account_id),
page=AsyncV4PagePaginationArray[Worker],
options=make_request_options(
extra_headers=extra_headers,
@@ -654,7 +682,7 @@ async def delete(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -678,12 +706,16 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -694,7 +726,7 @@ async def edit(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
logpush: bool,
name: str,
observability: worker_edit_params.Observability,
@@ -737,12 +769,16 @@ async def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return await self._patch(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
body=await async_maybe_transform(
{
"logpush": logpush,
@@ -768,7 +804,7 @@ async def get(
self,
worker_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -792,12 +828,16 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not worker_id:
raise ValueError(f"Expected a non-empty value for `worker_id` but received {worker_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/workers/{worker_id}",
+ path_template(
+ "/accounts/{account_id}/workers/workers/{worker_id}", account_id=account_id, worker_id=worker_id
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/domains.py b/src/cloudflare/resources/workers/domains.py
index c038483acd1..f4333194f55 100644
--- a/src/cloudflare/resources/workers/domains.py
+++ b/src/cloudflare/resources/workers/domains.py
@@ -7,7 +7,7 @@
import httpx
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -51,7 +51,7 @@ def with_streaming_response(self) -> DomainsResourceWithStreamingResponse:
def update(
self,
*,
- account_id: str,
+ account_id: str | None = None,
hostname: str,
service: str,
environment: str | Omit = omit,
@@ -90,10 +90,12 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._put(
- f"/accounts/{account_id}/workers/domains",
+ path_template("/accounts/{account_id}/workers/domains", account_id=account_id),
body=maybe_transform(
{
"hostname": hostname,
@@ -117,7 +119,7 @@ def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
environment: str | Omit = omit,
hostname: str | Omit = omit,
service: str | Omit = omit,
@@ -154,10 +156,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/domains",
+ path_template("/accounts/{account_id}/workers/domains", account_id=account_id),
page=SyncSinglePage[DomainListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -182,7 +186,7 @@ def delete(
self,
domain_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -208,12 +212,16 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_id:
raise ValueError(f"Expected a non-empty value for `domain_id` but received {domain_id!r}")
return self._delete(
- f"/accounts/{account_id}/workers/domains/{domain_id}",
+ path_template(
+ "/accounts/{account_id}/workers/domains/{domain_id}", account_id=account_id, domain_id=domain_id
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -224,7 +232,7 @@ def get(
self,
domain_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -248,12 +256,16 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_id:
raise ValueError(f"Expected a non-empty value for `domain_id` but received {domain_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/domains/{domain_id}",
+ path_template(
+ "/accounts/{account_id}/workers/domains/{domain_id}", account_id=account_id, domain_id=domain_id
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -288,7 +300,7 @@ def with_streaming_response(self) -> AsyncDomainsResourceWithStreamingResponse:
async def update(
self,
*,
- account_id: str,
+ account_id: str | None = None,
hostname: str,
service: str,
environment: str | Omit = omit,
@@ -327,10 +339,12 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._put(
- f"/accounts/{account_id}/workers/domains",
+ path_template("/accounts/{account_id}/workers/domains", account_id=account_id),
body=await async_maybe_transform(
{
"hostname": hostname,
@@ -354,7 +368,7 @@ async def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
environment: str | Omit = omit,
hostname: str | Omit = omit,
service: str | Omit = omit,
@@ -391,10 +405,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/domains",
+ path_template("/accounts/{account_id}/workers/domains", account_id=account_id),
page=AsyncSinglePage[DomainListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -419,7 +435,7 @@ async def delete(
self,
domain_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -445,12 +461,16 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_id:
raise ValueError(f"Expected a non-empty value for `domain_id` but received {domain_id!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/domains/{domain_id}",
+ path_template(
+ "/accounts/{account_id}/workers/domains/{domain_id}", account_id=account_id, domain_id=domain_id
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -461,7 +481,7 @@ async def get(
self,
domain_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -485,12 +505,16 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not domain_id:
raise ValueError(f"Expected a non-empty value for `domain_id` but received {domain_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/domains/{domain_id}",
+ path_template(
+ "/accounts/{account_id}/workers/domains/{domain_id}", account_id=account_id, domain_id=domain_id
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/observability/destinations.py b/src/cloudflare/resources/workers/observability/destinations.py
index 26a156b902d..21fc2089c5b 100644
--- a/src/cloudflare/resources/workers/observability/destinations.py
+++ b/src/cloudflare/resources/workers/observability/destinations.py
@@ -8,7 +8,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -56,7 +56,7 @@ def with_streaming_response(self) -> DestinationsResourceWithStreamingResponse:
def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
configuration: destination_create_params.Configuration,
enabled: bool,
name: str,
@@ -80,10 +80,12 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
- f"/accounts/{account_id}/workers/observability/destinations",
+ path_template("/accounts/{account_id}/workers/observability/destinations", account_id=account_id),
body=maybe_transform(
{
"configuration": configuration,
@@ -107,7 +109,7 @@ def update(
self,
slug: str,
*,
- account_id: str,
+ account_id: str | None = None,
configuration: destination_update_params.Configuration,
enabled: bool,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -129,12 +131,16 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not slug:
raise ValueError(f"Expected a non-empty value for `slug` but received {slug!r}")
return self._patch(
- f"/accounts/{account_id}/workers/observability/destinations/{slug}",
+ path_template(
+ "/accounts/{account_id}/workers/observability/destinations/{slug}", account_id=account_id, slug=slug
+ ),
body=maybe_transform(
{
"configuration": configuration,
@@ -155,7 +161,7 @@ def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
order: Literal["asc", "desc"] | Omit = omit,
order_by: Literal["created", "updated"] | Omit = omit,
page: float | Omit = omit,
@@ -179,10 +185,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/observability/destinations",
+ path_template("/accounts/{account_id}/workers/observability/destinations", account_id=account_id),
page=SyncSinglePage[DestinationListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -206,7 +214,7 @@ def delete(
self,
slug: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -226,12 +234,16 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not slug:
raise ValueError(f"Expected a non-empty value for `slug` but received {slug!r}")
return self._delete(
- f"/accounts/{account_id}/workers/observability/destinations/{slug}",
+ path_template(
+ "/accounts/{account_id}/workers/observability/destinations/{slug}", account_id=account_id, slug=slug
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -266,7 +278,7 @@ def with_streaming_response(self) -> AsyncDestinationsResourceWithStreamingRespo
async def create(
self,
*,
- account_id: str,
+ account_id: str | None = None,
configuration: destination_create_params.Configuration,
enabled: bool,
name: str,
@@ -290,10 +302,12 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
- f"/accounts/{account_id}/workers/observability/destinations",
+ path_template("/accounts/{account_id}/workers/observability/destinations", account_id=account_id),
body=await async_maybe_transform(
{
"configuration": configuration,
@@ -317,7 +331,7 @@ async def update(
self,
slug: str,
*,
- account_id: str,
+ account_id: str | None = None,
configuration: destination_update_params.Configuration,
enabled: bool,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -339,12 +353,16 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not slug:
raise ValueError(f"Expected a non-empty value for `slug` but received {slug!r}")
return await self._patch(
- f"/accounts/{account_id}/workers/observability/destinations/{slug}",
+ path_template(
+ "/accounts/{account_id}/workers/observability/destinations/{slug}", account_id=account_id, slug=slug
+ ),
body=await async_maybe_transform(
{
"configuration": configuration,
@@ -365,7 +383,7 @@ async def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
order: Literal["asc", "desc"] | Omit = omit,
order_by: Literal["created", "updated"] | Omit = omit,
page: float | Omit = omit,
@@ -389,10 +407,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/observability/destinations",
+ path_template("/accounts/{account_id}/workers/observability/destinations", account_id=account_id),
page=AsyncSinglePage[DestinationListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -416,7 +436,7 @@ async def delete(
self,
slug: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -436,12 +456,16 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not slug:
raise ValueError(f"Expected a non-empty value for `slug` but received {slug!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/observability/destinations/{slug}",
+ path_template(
+ "/accounts/{account_id}/workers/observability/destinations/{slug}", account_id=account_id, slug=slug
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/observability/telemetry.py b/src/cloudflare/resources/workers/observability/telemetry.py
index c1535dc15f8..4faecf1dcf7 100644
--- a/src/cloudflare/resources/workers/observability/telemetry.py
+++ b/src/cloudflare/resources/workers/observability/telemetry.py
@@ -8,7 +8,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -51,7 +51,7 @@ def with_streaming_response(self) -> TelemetryResourceWithStreamingResponse:
def keys(
self,
*,
- account_id: str,
+ account_id: str | None = None,
datasets: SequenceNotStr[str] | Omit = omit,
filters: Iterable[telemetry_keys_params.Filter] | Omit = omit,
from_: float | Omit = omit,
@@ -91,10 +91,12 @@ def keys(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/observability/telemetry/keys",
+ path_template("/accounts/{account_id}/workers/observability/telemetry/keys", account_id=account_id),
page=SyncSinglePage[TelemetryKeysResponse],
body=maybe_transform(
{
@@ -118,7 +120,7 @@ def keys(
def query(
self,
*,
- account_id: str,
+ account_id: str | None = None,
query_id: str,
timeframe: telemetry_query_params.Timeframe,
chart: bool | Omit = omit,
@@ -186,10 +188,12 @@ def query(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
- f"/accounts/{account_id}/workers/observability/telemetry/query",
+ path_template("/accounts/{account_id}/workers/observability/telemetry/query", account_id=account_id),
body=maybe_transform(
{
"query_id": query_id,
@@ -221,7 +225,7 @@ def query(
def values(
self,
*,
- account_id: str,
+ account_id: str | None = None,
datasets: SequenceNotStr[str],
key: str,
timeframe: telemetry_values_params.Timeframe,
@@ -255,10 +259,12 @@ def values(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/observability/telemetry/values",
+ path_template("/accounts/{account_id}/workers/observability/telemetry/values", account_id=account_id),
page=SyncSinglePage[TelemetryValuesResponse],
body=maybe_transform(
{
@@ -303,7 +309,7 @@ def with_streaming_response(self) -> AsyncTelemetryResourceWithStreamingResponse
def keys(
self,
*,
- account_id: str,
+ account_id: str | None = None,
datasets: SequenceNotStr[str] | Omit = omit,
filters: Iterable[telemetry_keys_params.Filter] | Omit = omit,
from_: float | Omit = omit,
@@ -343,10 +349,12 @@ def keys(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/observability/telemetry/keys",
+ path_template("/accounts/{account_id}/workers/observability/telemetry/keys", account_id=account_id),
page=AsyncSinglePage[TelemetryKeysResponse],
body=maybe_transform(
{
@@ -370,7 +378,7 @@ def keys(
async def query(
self,
*,
- account_id: str,
+ account_id: str | None = None,
query_id: str,
timeframe: telemetry_query_params.Timeframe,
chart: bool | Omit = omit,
@@ -438,10 +446,12 @@ async def query(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
- f"/accounts/{account_id}/workers/observability/telemetry/query",
+ path_template("/accounts/{account_id}/workers/observability/telemetry/query", account_id=account_id),
body=await async_maybe_transform(
{
"query_id": query_id,
@@ -473,7 +483,7 @@ async def query(
def values(
self,
*,
- account_id: str,
+ account_id: str | None = None,
datasets: SequenceNotStr[str],
key: str,
timeframe: telemetry_values_params.Timeframe,
@@ -507,10 +517,12 @@ def values(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/observability/telemetry/values",
+ path_template("/accounts/{account_id}/workers/observability/telemetry/values", account_id=account_id),
page=AsyncSinglePage[TelemetryValuesResponse],
body=maybe_transform(
{
diff --git a/src/cloudflare/resources/workers/routes.py b/src/cloudflare/resources/workers/routes.py
index 68304d512b8..68afd113ea4 100644
--- a/src/cloudflare/resources/workers/routes.py
+++ b/src/cloudflare/resources/workers/routes.py
@@ -7,7 +7,7 @@
import httpx
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -52,7 +52,7 @@ def with_streaming_response(self) -> RoutesResourceWithStreamingResponse:
def create(
self,
*,
- zone_id: str,
+ zone_id: str | None = None,
pattern: str,
script: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -81,10 +81,12 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._post(
- f"/zones/{zone_id}/workers/routes",
+ path_template("/zones/{zone_id}/workers/routes", zone_id=zone_id),
body=maybe_transform(
{
"pattern": pattern,
@@ -106,7 +108,7 @@ def update(
self,
route_id: str,
*,
- zone_id: str,
+ zone_id: str | None = None,
pattern: str,
script: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -137,12 +139,14 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return self._put(
- f"/zones/{zone_id}/workers/routes/{route_id}",
+ path_template("/zones/{zone_id}/workers/routes/{route_id}", zone_id=zone_id, route_id=route_id),
body=maybe_transform(
{
"pattern": pattern,
@@ -163,7 +167,7 @@ def update(
def list(
self,
*,
- zone_id: str,
+ zone_id: str | None = None,
# 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,
@@ -185,10 +189,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
- f"/zones/{zone_id}/workers/routes",
+ path_template("/zones/{zone_id}/workers/routes", zone_id=zone_id),
page=SyncSinglePage[RouteListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -200,7 +206,7 @@ def delete(
self,
route_id: str,
*,
- zone_id: str,
+ zone_id: str | None = None,
# 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,
@@ -224,12 +230,14 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return self._delete(
- f"/zones/{zone_id}/workers/routes/{route_id}",
+ path_template("/zones/{zone_id}/workers/routes/{route_id}", zone_id=zone_id, route_id=route_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -244,7 +252,7 @@ def get(
self,
route_id: str,
*,
- zone_id: str,
+ zone_id: str | None = None,
# 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,
@@ -268,12 +276,14 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return self._get(
- f"/zones/{zone_id}/workers/routes/{route_id}",
+ path_template("/zones/{zone_id}/workers/routes/{route_id}", zone_id=zone_id, route_id=route_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -308,7 +318,7 @@ def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse:
async def create(
self,
*,
- zone_id: str,
+ zone_id: str | None = None,
pattern: str,
script: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -337,10 +347,12 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return await self._post(
- f"/zones/{zone_id}/workers/routes",
+ path_template("/zones/{zone_id}/workers/routes", zone_id=zone_id),
body=await async_maybe_transform(
{
"pattern": pattern,
@@ -362,7 +374,7 @@ async def update(
self,
route_id: str,
*,
- zone_id: str,
+ zone_id: str | None = None,
pattern: str,
script: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -393,12 +405,14 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return await self._put(
- f"/zones/{zone_id}/workers/routes/{route_id}",
+ path_template("/zones/{zone_id}/workers/routes/{route_id}", zone_id=zone_id, route_id=route_id),
body=await async_maybe_transform(
{
"pattern": pattern,
@@ -419,7 +433,7 @@ async def update(
def list(
self,
*,
- zone_id: str,
+ zone_id: str | None = None,
# 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,
@@ -441,10 +455,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
- f"/zones/{zone_id}/workers/routes",
+ path_template("/zones/{zone_id}/workers/routes", zone_id=zone_id),
page=AsyncSinglePage[RouteListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -456,7 +472,7 @@ async def delete(
self,
route_id: str,
*,
- zone_id: str,
+ zone_id: str | None = None,
# 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,
@@ -480,12 +496,14 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return await self._delete(
- f"/zones/{zone_id}/workers/routes/{route_id}",
+ path_template("/zones/{zone_id}/workers/routes/{route_id}", zone_id=zone_id, route_id=route_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -500,7 +518,7 @@ async def get(
self,
route_id: str,
*,
- zone_id: str,
+ zone_id: str | None = None,
# 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,
@@ -524,12 +542,14 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if zone_id is None:
+ zone_id = self._client._get_zone_id_path_param()
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return await self._get(
- f"/zones/{zone_id}/workers/routes/{route_id}",
+ path_template("/zones/{zone_id}/workers/routes/{route_id}", zone_id=zone_id, route_id=route_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/assets/upload.py b/src/cloudflare/resources/workers/scripts/assets/upload.py
index a4680e0f1d8..1ba6bba3d53 100644
--- a/src/cloudflare/resources/workers/scripts/assets/upload.py
+++ b/src/cloudflare/resources/workers/scripts/assets/upload.py
@@ -7,7 +7,7 @@
import httpx
from ....._types import Body, Query, Headers, NotGiven, not_given
-from ....._utils import maybe_transform, async_maybe_transform
+from ....._utils import path_template, maybe_transform, async_maybe_transform
from ....._compat import cached_property
from ....._resource import SyncAPIResource, AsyncAPIResource
from ....._response import (
@@ -48,7 +48,7 @@ def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
manifest: Dict[str, upload_create_params.Manifest],
# 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.
@@ -79,12 +79,18 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform({"manifest": manifest}, upload_create_params.UploadCreateParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -121,7 +127,7 @@ async def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
manifest: Dict[str, upload_create_params.Manifest],
# 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.
@@ -152,12 +158,18 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform({"manifest": manifest}, upload_create_params.UploadCreateParams),
options=make_request_options(
extra_headers=extra_headers,
diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py
index 166a0085820..19b75a320a7 100644
--- a/src/cloudflare/resources/workers/scripts/content.py
+++ b/src/cloudflare/resources/workers/scripts/content.py
@@ -19,6 +19,7 @@
)
from ...._utils import (
extract_files,
+ path_template,
maybe_transform,
strip_not_given,
deepcopy_minimal,
@@ -72,7 +73,7 @@ def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
metadata: content_update_params.Metadata,
files: SequenceNotStr[FileTypes] | Omit = omit,
cf_worker_body_part: str | Omit = omit,
@@ -110,6 +111,8 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -135,7 +138,11 @@ def update(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}/content",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/content",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(body, content_update_params.ContentUpdateParams),
files=extracted_files,
options=make_request_options(
@@ -153,7 +160,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -177,13 +184,19 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
extra_headers = {"Accept": "string", **(extra_headers or {})}
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/content/v2",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -215,7 +228,7 @@ async def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
metadata: content_update_params.Metadata,
files: SequenceNotStr[FileTypes] | Omit = omit,
cf_worker_body_part: str | Omit = omit,
@@ -253,6 +266,8 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -278,7 +293,11 @@ async def update(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}/content",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/content",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(body, content_update_params.ContentUpdateParams),
files=extracted_files,
options=make_request_options(
@@ -296,7 +315,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -320,13 +339,19 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
extra_headers = {"Accept": "string", **(extra_headers or {})}
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/content/v2",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/content/v2",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/cloudflare/resources/workers/scripts/deployments.py b/src/cloudflare/resources/workers/scripts/deployments.py
index 16ea873159f..9274c7e45b0 100644
--- a/src/cloudflare/resources/workers/scripts/deployments.py
+++ b/src/cloudflare/resources/workers/scripts/deployments.py
@@ -8,7 +8,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -51,7 +51,7 @@ def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
strategy: Literal["percentage"],
versions: Iterable[deployment_create_params.Version],
force: bool | Omit = omit,
@@ -85,12 +85,18 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(
{
"strategy": strategy,
@@ -114,7 +120,7 @@ def list(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -140,12 +146,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -160,7 +172,7 @@ def delete(
self,
deployment_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -187,6 +199,8 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -194,7 +208,12 @@ def delete(
if not deployment_id:
raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}")
return self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ account_id=account_id,
+ script_name=script_name,
+ deployment_id=deployment_id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -205,7 +224,7 @@ def get(
self,
deployment_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -230,6 +249,8 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -237,7 +258,12 @@ def get(
if not deployment_id:
raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ account_id=account_id,
+ script_name=script_name,
+ deployment_id=deployment_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -273,7 +299,7 @@ async def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
strategy: Literal["percentage"],
versions: Iterable[deployment_create_params.Version],
force: bool | Omit = omit,
@@ -307,12 +333,18 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(
{
"strategy": strategy,
@@ -336,7 +368,7 @@ async def list(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -362,12 +394,18 @@ async def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -382,7 +420,7 @@ async def delete(
self,
deployment_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -409,6 +447,8 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -416,7 +456,12 @@ async def delete(
if not deployment_id:
raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ account_id=account_id,
+ script_name=script_name,
+ deployment_id=deployment_id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -427,7 +472,7 @@ async def get(
self,
deployment_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -452,6 +497,8 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -459,7 +506,12 @@ async def get(
if not deployment_id:
raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/deployments/{deployment_id}",
+ account_id=account_id,
+ script_name=script_name,
+ deployment_id=deployment_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/schedules.py b/src/cloudflare/resources/workers/scripts/schedules.py
index 07db257b926..ca2230b3aaa 100644
--- a/src/cloudflare/resources/workers/scripts/schedules.py
+++ b/src/cloudflare/resources/workers/scripts/schedules.py
@@ -7,7 +7,7 @@
import httpx
from ...._types import Body, Query, Headers, NotGiven, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -49,7 +49,7 @@ def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
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.
@@ -74,12 +74,18 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(body, Iterable[schedule_update_params.Body]),
options=make_request_options(
extra_headers=extra_headers,
@@ -95,7 +101,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -119,12 +125,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -160,7 +172,7 @@ async def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
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.
@@ -185,12 +197,18 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(body, Iterable[schedule_update_params.Body]),
options=make_request_options(
extra_headers=extra_headers,
@@ -206,7 +224,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -230,12 +248,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/schedules",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/script_and_version_settings.py b/src/cloudflare/resources/workers/scripts/script_and_version_settings.py
index 1d863218932..c6b4c3406e3 100644
--- a/src/cloudflare/resources/workers/scripts/script_and_version_settings.py
+++ b/src/cloudflare/resources/workers/scripts/script_and_version_settings.py
@@ -7,7 +7,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -49,7 +49,7 @@ def edit(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
settings: script_and_version_setting_edit_params.Settings | Omit = omit,
# 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.
@@ -74,6 +74,8 @@ def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -83,7 +85,11 @@ def edit(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._patch(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(
{"settings": settings}, script_and_version_setting_edit_params.ScriptAndVersionSettingEditParams
),
@@ -102,7 +108,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -126,12 +132,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -167,7 +179,7 @@ async def edit(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
settings: script_and_version_setting_edit_params.Settings | Omit = omit,
# 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.
@@ -192,6 +204,8 @@ async def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -201,7 +215,11 @@ async def edit(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._patch(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(
{"settings": settings}, script_and_version_setting_edit_params.ScriptAndVersionSettingEditParams
),
@@ -220,7 +238,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -244,12 +262,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py
index f4f5877b34f..4f1dfe0682a 100644
--- a/src/cloudflare/resources/workers/scripts/scripts.py
+++ b/src/cloudflare/resources/workers/scripts/scripts.py
@@ -58,7 +58,7 @@
omit,
not_given,
)
-from ...._utils import is_given, maybe_transform, deepcopy_minimal, async_maybe_transform
+from ...._utils import is_given, path_template, maybe_transform, deepcopy_minimal, async_maybe_transform
from .schedules import (
SchedulesResource,
AsyncSchedulesResource,
@@ -182,7 +182,7 @@ def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
metadata: script_update_params.Metadata,
bindings_inherit: Literal["strict"] | Omit = omit,
files: SequenceNotStr[FileTypes] | Omit = omit,
@@ -226,6 +226,8 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -242,7 +244,9 @@ def update(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}", account_id=account_id, script_name=script_name
+ ),
body=maybe_transform(body, script_update_params.ScriptUpdateParams),
files=extracted_files,
options=make_request_options(
@@ -260,7 +264,7 @@ def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
tags: str | Omit = omit,
# 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.
@@ -286,10 +290,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/scripts",
+ path_template("/accounts/{account_id}/workers/scripts", account_id=account_id),
page=SyncSinglePage[ScriptListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -305,7 +311,7 @@ def delete(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
force: bool | Omit = omit,
# 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.
@@ -335,12 +341,16 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}", account_id=account_id, script_name=script_name
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -356,7 +366,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -382,13 +392,17 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
extra_headers = {"Accept": "application/javascript", **(extra_headers or {})}
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}", account_id=account_id, script_name=script_name
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -398,7 +412,7 @@ def get(
def search(
self,
*,
- account_id: str,
+ account_id: str | None = None,
id: str | Omit = omit,
name: str | Omit = omit,
order_by: Literal["created_on", "modified_on", "name"] | Omit = omit,
@@ -435,10 +449,12 @@ def search(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts-search",
+ path_template("/accounts/{account_id}/workers/scripts-search", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -524,7 +540,7 @@ async def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
metadata: script_update_params.Metadata,
bindings_inherit: Literal["strict"] | Omit = omit,
files: SequenceNotStr[FileTypes] | Omit = omit,
@@ -568,6 +584,8 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -584,7 +602,9 @@ async def update(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}", account_id=account_id, script_name=script_name
+ ),
body=await async_maybe_transform(body, script_update_params.ScriptUpdateParams),
files=extracted_files,
options=make_request_options(
@@ -604,7 +624,7 @@ async def update(
def list(
self,
*,
- account_id: str,
+ account_id: str | None = None,
tags: str | Omit = omit,
# 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.
@@ -630,10 +650,12 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/scripts",
+ path_template("/accounts/{account_id}/workers/scripts", account_id=account_id),
page=AsyncSinglePage[ScriptListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -649,7 +671,7 @@ async def delete(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
force: bool | Omit = omit,
# 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.
@@ -679,12 +701,16 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}", account_id=account_id, script_name=script_name
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -700,7 +726,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -726,13 +752,17 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
extra_headers = {"Accept": "application/javascript", **(extra_headers or {})}
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}", account_id=account_id, script_name=script_name
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -742,7 +772,7 @@ async def get(
async def search(
self,
*,
- account_id: str,
+ account_id: str | None = None,
id: str | Omit = omit,
name: str | Omit = omit,
order_by: Literal["created_on", "modified_on", "name"] | Omit = omit,
@@ -779,10 +809,12 @@ async def search(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts-search",
+ path_template("/accounts/{account_id}/workers/scripts-search", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/secrets.py b/src/cloudflare/resources/workers/scripts/secrets.py
index de30c08f9da..6a789239704 100644
--- a/src/cloudflare/resources/workers/scripts/secrets.py
+++ b/src/cloudflare/resources/workers/scripts/secrets.py
@@ -8,7 +8,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ...._utils import required_args, maybe_transform, async_maybe_transform
+from ...._utils import path_template, required_args, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -53,7 +53,7 @@ def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
text: str,
type: Literal["secret_text"],
@@ -93,7 +93,7 @@ def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
algorithm: object,
format: Literal["raw", "pkcs8", "spki", "jwk"],
name: str,
@@ -147,14 +147,12 @@ def update(
"""
...
- @required_args(
- ["account_id", "name", "text", "type"], ["account_id", "algorithm", "format", "name", "type", "usages"]
- )
+ @required_args(["name", "text", "type"], ["algorithm", "format", "name", "type", "usages"])
def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
text: str | Omit = omit,
type: Literal["secret_text"] | Literal["secret_key"],
@@ -171,6 +169,8 @@ def update(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[SecretUpdateResponse]:
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -178,7 +178,11 @@ def update(
return cast(
Optional[SecretUpdateResponse],
self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(
{
"name": name,
@@ -209,7 +213,7 @@ def list(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -233,12 +237,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ account_id=account_id,
+ script_name=script_name,
+ ),
page=SyncSinglePage[SecretListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -250,7 +260,7 @@ def delete(
self,
secret_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
url_encoded: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -280,6 +290,8 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -287,7 +299,12 @@ def delete(
if not secret_name:
raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}")
return self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ account_id=account_id,
+ script_name=script_name,
+ secret_name=secret_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -303,7 +320,7 @@ def get(
self,
secret_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
url_encoded: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -333,6 +350,8 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -342,7 +361,12 @@ def get(
return cast(
Optional[SecretGetResponse],
self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ account_id=account_id,
+ script_name=script_name,
+ secret_name=secret_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -383,7 +407,7 @@ async def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
text: str,
type: Literal["secret_text"],
@@ -423,7 +447,7 @@ async def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
algorithm: object,
format: Literal["raw", "pkcs8", "spki", "jwk"],
name: str,
@@ -477,14 +501,12 @@ async def update(
"""
...
- @required_args(
- ["account_id", "name", "text", "type"], ["account_id", "algorithm", "format", "name", "type", "usages"]
- )
+ @required_args(["name", "text", "type"], ["algorithm", "format", "name", "type", "usages"])
async def update(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
name: str,
text: str | Omit = omit,
type: Literal["secret_text"] | Literal["secret_key"],
@@ -501,6 +523,8 @@ async def update(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[SecretUpdateResponse]:
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -508,7 +532,11 @@ async def update(
return cast(
Optional[SecretUpdateResponse],
await self._put(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(
{
"name": name,
@@ -539,7 +567,7 @@ def list(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -563,12 +591,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets",
+ account_id=account_id,
+ script_name=script_name,
+ ),
page=AsyncSinglePage[SecretListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -580,7 +614,7 @@ async def delete(
self,
secret_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
url_encoded: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -610,6 +644,8 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -617,7 +653,12 @@ async def delete(
if not secret_name:
raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ account_id=account_id,
+ script_name=script_name,
+ secret_name=secret_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -635,7 +676,7 @@ async def get(
self,
secret_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
url_encoded: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -665,6 +706,8 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -674,7 +717,12 @@ async def get(
return cast(
Optional[SecretGetResponse],
await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name}",
+ account_id=account_id,
+ script_name=script_name,
+ secret_name=secret_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/settings.py b/src/cloudflare/resources/workers/scripts/settings.py
index 01e5d5600d8..949e0428051 100644
--- a/src/cloudflare/resources/workers/scripts/settings.py
+++ b/src/cloudflare/resources/workers/scripts/settings.py
@@ -7,7 +7,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -49,7 +49,7 @@ def edit(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
logpush: bool | Omit = omit,
observability: Optional[setting_edit_params.Observability] | Omit = omit,
tags: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -87,12 +87,18 @@ def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._patch(
- f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(
{
"logpush": logpush,
@@ -116,7 +122,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -142,12 +148,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -183,7 +195,7 @@ async def edit(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
logpush: bool | Omit = omit,
observability: Optional[setting_edit_params.Observability] | Omit = omit,
tags: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -221,12 +233,18 @@ async def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._patch(
- f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(
{
"logpush": logpush,
@@ -250,7 +268,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -276,12 +294,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/subdomain.py b/src/cloudflare/resources/workers/scripts/subdomain.py
index ee6e690dabd..6479681a5e8 100644
--- a/src/cloudflare/resources/workers/scripts/subdomain.py
+++ b/src/cloudflare/resources/workers/scripts/subdomain.py
@@ -7,7 +7,7 @@
import httpx
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -50,7 +50,7 @@ def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
enabled: bool,
previews_enabled: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -81,12 +81,18 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(
{
"enabled": enabled,
@@ -108,7 +114,7 @@ def delete(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -132,12 +138,18 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -152,7 +164,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -176,12 +188,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -217,7 +235,7 @@ async def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
enabled: bool,
previews_enabled: bool | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -248,12 +266,18 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(
{
"enabled": enabled,
@@ -275,7 +299,7 @@ async def delete(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -299,12 +323,18 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -319,7 +349,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -343,12 +373,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/tail.py b/src/cloudflare/resources/workers/scripts/tail.py
index 50f03689386..82e99589d54 100644
--- a/src/cloudflare/resources/workers/scripts/tail.py
+++ b/src/cloudflare/resources/workers/scripts/tail.py
@@ -7,7 +7,7 @@
import httpx
from ...._types import Body, Query, Headers, NotGiven, not_given
-from ...._utils import maybe_transform, async_maybe_transform
+from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -50,7 +50,7 @@ def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
body: object,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -75,12 +75,18 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(body, tail_create_params.TailCreateParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -96,7 +102,7 @@ def delete(
self,
id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -123,6 +129,8 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -130,7 +138,12 @@ def delete(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}",
+ account_id=account_id,
+ script_name=script_name,
+ id=id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -141,7 +154,7 @@ def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -165,12 +178,18 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -206,7 +225,7 @@ async def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
body: object,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -231,12 +250,18 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(body, tail_create_params.TailCreateParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -252,7 +277,7 @@ async def delete(
self,
id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -279,6 +304,8 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -286,7 +313,12 @@ async def delete(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._delete(
- f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}",
+ account_id=account_id,
+ script_name=script_name,
+ id=id,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -297,7 +329,7 @@ async def get(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -321,12 +353,18 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/tails",
+ account_id=account_id,
+ script_name=script_name,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/versions.py b/src/cloudflare/resources/workers/scripts/versions.py
index 3c8f95ecbc1..12caaf824fc 100644
--- a/src/cloudflare/resources/workers/scripts/versions.py
+++ b/src/cloudflare/resources/workers/scripts/versions.py
@@ -18,7 +18,7 @@
omit,
not_given,
)
-from ...._utils import is_given, maybe_transform, deepcopy_minimal, async_maybe_transform
+from ...._utils import is_given, path_template, maybe_transform, deepcopy_minimal, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -62,7 +62,7 @@ def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
metadata: version_create_params.Metadata,
bindings_inherit: Literal["strict"] | Omit = omit,
files: SequenceNotStr[FileTypes] | Omit = omit,
@@ -106,6 +106,8 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -122,7 +124,11 @@ def create(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=maybe_transform(body, version_create_params.VersionCreateParams),
files=extracted_files,
options=make_request_options(
@@ -143,7 +149,7 @@ def list(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
deployable: bool | Omit = omit,
page: int | Omit = omit,
per_page: int | Omit = omit,
@@ -177,12 +183,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ account_id=account_id,
+ script_name=script_name,
+ ),
page=SyncV4PagePagination[VersionListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -205,7 +217,7 @@ def get(
self,
version_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -230,6 +242,8 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -237,7 +251,12 @@ def get(
if not version_id:
raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}",
+ account_id=account_id,
+ script_name=script_name,
+ version_id=version_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -273,7 +292,7 @@ async def create(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
metadata: version_create_params.Metadata,
bindings_inherit: Literal["strict"] | Omit = omit,
files: SequenceNotStr[FileTypes] | Omit = omit,
@@ -317,6 +336,8 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -332,7 +353,11 @@ async def create(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._post(
- f"/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ account_id=account_id,
+ script_name=script_name,
+ ),
body=await async_maybe_transform(body, version_create_params.VersionCreateParams),
files=extracted_files,
options=make_request_options(
@@ -353,7 +378,7 @@ def list(
self,
script_name: str,
*,
- account_id: str,
+ account_id: str | None = None,
deployable: bool | Omit = omit,
page: int | Omit = omit,
per_page: int | Omit = omit,
@@ -387,12 +412,18 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get_api_list(
- f"/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ account_id=account_id,
+ script_name=script_name,
+ ),
page=AsyncV4PagePagination[VersionListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -415,7 +446,7 @@ async def get(
self,
version_id: str,
*,
- account_id: str,
+ account_id: str | None = None,
script_name: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -440,6 +471,8 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not script_name:
@@ -447,7 +480,12 @@ async def get(
if not version_id:
raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}",
+ path_template(
+ "/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}",
+ account_id=account_id,
+ script_name=script_name,
+ version_id=version_id,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/subdomains.py b/src/cloudflare/resources/workers/subdomains.py
index 9e20a222431..3bec3af310d 100644
--- a/src/cloudflare/resources/workers/subdomains.py
+++ b/src/cloudflare/resources/workers/subdomains.py
@@ -7,7 +7,7 @@
import httpx
from ..._types import Body, Query, Headers, NoneType, NotGiven, not_given
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -48,7 +48,7 @@ def with_streaming_response(self) -> SubdomainsResourceWithStreamingResponse:
def update(
self,
*,
- account_id: str,
+ account_id: str | None = None,
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.
@@ -71,10 +71,12 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._put(
- f"/accounts/{account_id}/workers/subdomain",
+ path_template("/accounts/{account_id}/workers/subdomain", account_id=account_id),
body=maybe_transform({"subdomain": subdomain}, subdomain_update_params.SubdomainUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -89,7 +91,7 @@ def update(
def delete(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -111,11 +113,13 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/accounts/{account_id}/workers/subdomain",
+ path_template("/accounts/{account_id}/workers/subdomain", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -125,7 +129,7 @@ def delete(
def get(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -147,10 +151,12 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get(
- f"/accounts/{account_id}/workers/subdomain",
+ path_template("/accounts/{account_id}/workers/subdomain", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -185,7 +191,7 @@ def with_streaming_response(self) -> AsyncSubdomainsResourceWithStreamingRespons
async def update(
self,
*,
- account_id: str,
+ account_id: str | None = None,
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.
@@ -208,10 +214,12 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._put(
- f"/accounts/{account_id}/workers/subdomain",
+ path_template("/accounts/{account_id}/workers/subdomain", account_id=account_id),
body=await async_maybe_transform({"subdomain": subdomain}, subdomain_update_params.SubdomainUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
@@ -226,7 +234,7 @@ async def update(
async def delete(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -248,11 +256,13 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/accounts/{account_id}/workers/subdomain",
+ path_template("/accounts/{account_id}/workers/subdomain", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -262,7 +272,7 @@ async def delete(
async def get(
self,
*,
- account_id: str,
+ account_id: str | None = None,
# 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,
@@ -284,10 +294,12 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ if account_id is None:
+ account_id = self._client._get_account_id_path_param()
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._get(
- f"/accounts/{account_id}/workers/subdomain",
+ path_template("/accounts/{account_id}/workers/subdomain", account_id=account_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/types/registrar/__init__.py b/src/cloudflare/types/registrar/__init__.py
index b6e29688280..720eb9554d8 100644
--- a/src/cloudflare/types/registrar/__init__.py
+++ b/src/cloudflare/types/registrar/__init__.py
@@ -10,5 +10,6 @@
from .registrar_search_params import RegistrarSearchParams as RegistrarSearchParams
from .registrar_check_response import RegistrarCheckResponse as RegistrarCheckResponse
from .registration_edit_params import RegistrationEditParams as RegistrationEditParams
+from .registration_list_params import RegistrationListParams as RegistrationListParams
from .registrar_search_response import RegistrarSearchResponse as RegistrarSearchResponse
from .registration_create_params import RegistrationCreateParams as RegistrationCreateParams
diff --git a/src/cloudflare/types/registrar/domain_update_params.py b/src/cloudflare/types/registrar/domain_update_params.py
index c69ee2fe840..5c6da427594 100644
--- a/src/cloudflare/types/registrar/domain_update_params.py
+++ b/src/cloudflare/types/registrar/domain_update_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["DomainUpdateParams"]
class DomainUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier"""
auto_renew: bool
diff --git a/src/cloudflare/types/registrar/registrar_check_params.py b/src/cloudflare/types/registrar/registrar_check_params.py
index fd48b15dc15..663932047ff 100644
--- a/src/cloudflare/types/registrar/registrar_check_params.py
+++ b/src/cloudflare/types/registrar/registrar_check_params.py
@@ -10,7 +10,7 @@
class RegistrarCheckParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier"""
domains: Required[SequenceNotStr[str]]
diff --git a/src/cloudflare/types/registrar/registrar_search_params.py b/src/cloudflare/types/registrar/registrar_search_params.py
index 4dc2945e42c..bbd35e7e9b5 100644
--- a/src/cloudflare/types/registrar/registrar_search_params.py
+++ b/src/cloudflare/types/registrar/registrar_search_params.py
@@ -10,7 +10,7 @@
class RegistrarSearchParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier"""
q: Required[str]
diff --git a/src/cloudflare/types/registrar/registration_create_params.py b/src/cloudflare/types/registrar/registration_create_params.py
index 6ff16a019ed..b4b5022a4c2 100644
--- a/src/cloudflare/types/registrar/registration_create_params.py
+++ b/src/cloudflare/types/registrar/registration_create_params.py
@@ -16,7 +16,7 @@
class RegistrationCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier"""
domain_name: Required[str]
diff --git a/src/cloudflare/types/registrar/registration_edit_params.py b/src/cloudflare/types/registrar/registration_edit_params.py
index 348b9fb99bd..48f70de8f16 100644
--- a/src/cloudflare/types/registrar/registration_edit_params.py
+++ b/src/cloudflare/types/registrar/registration_edit_params.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing_extensions import Literal, Required, Annotated, TypedDict
+from typing_extensions import Literal, Annotated, TypedDict
from ..._utils import PropertyInfo
@@ -10,7 +10,7 @@
class RegistrationEditParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier"""
auto_renew: bool
diff --git a/src/cloudflare/types/registrar/registration_list_params.py b/src/cloudflare/types/registrar/registration_list_params.py
new file mode 100644
index 00000000000..962e7562dfd
--- /dev/null
+++ b/src/cloudflare/types/registrar/registration_list_params.py
@@ -0,0 +1,31 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+__all__ = ["RegistrationListParams"]
+
+
+class RegistrationListParams(TypedDict, total=False):
+ account_id: str
+ """Identifier"""
+
+ cursor: str
+ """
+ Opaque token from a previous response's `result_info.cursor`. Pass this value to
+ fetch the next page of results. Omit (or pass an empty string) for the first
+ page.
+ """
+
+ direction: Literal["asc", "desc"]
+ """Sort direction for results. Defaults to ascending order."""
+
+ per_page: int
+ """Number of items to return per page."""
+
+ sort_by: Literal["registry_created_at", "registry_expires_at", "name"]
+ """Column to sort results by.
+
+ Defaults to registration date (`registry_created_at`) when omitted.
+ """
diff --git a/src/cloudflare/types/workers/account_setting_update_params.py b/src/cloudflare/types/workers/account_setting_update_params.py
index 9dd07e89cf4..8f21932344d 100644
--- a/src/cloudflare/types/workers/account_setting_update_params.py
+++ b/src/cloudflare/types/workers/account_setting_update_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["AccountSettingUpdateParams"]
class AccountSettingUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
default_usage_model: str
diff --git a/src/cloudflare/types/workers/assets/upload_create_params.py b/src/cloudflare/types/workers/assets/upload_create_params.py
index 9e1388f5e55..4279447512f 100644
--- a/src/cloudflare/types/workers/assets/upload_create_params.py
+++ b/src/cloudflare/types/workers/assets/upload_create_params.py
@@ -9,7 +9,7 @@
class UploadCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
base64: Required[Literal[True]]
diff --git a/src/cloudflare/types/workers/beta/worker_create_params.py b/src/cloudflare/types/workers/beta/worker_create_params.py
index a5453a6e771..278236f44d3 100644
--- a/src/cloudflare/types/workers/beta/worker_create_params.py
+++ b/src/cloudflare/types/workers/beta/worker_create_params.py
@@ -18,7 +18,7 @@
class WorkerCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
name: Required[str]
diff --git a/src/cloudflare/types/workers/beta/worker_edit_params.py b/src/cloudflare/types/workers/beta/worker_edit_params.py
index e0dfe008859..5ea5b5cbbd3 100644
--- a/src/cloudflare/types/workers/beta/worker_edit_params.py
+++ b/src/cloudflare/types/workers/beta/worker_edit_params.py
@@ -11,7 +11,7 @@
class WorkerEditParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
logpush: Required[bool]
diff --git a/src/cloudflare/types/workers/beta/worker_list_params.py b/src/cloudflare/types/workers/beta/worker_list_params.py
index 27f46845688..569a378cd18 100644
--- a/src/cloudflare/types/workers/beta/worker_list_params.py
+++ b/src/cloudflare/types/workers/beta/worker_list_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Literal, Required, TypedDict
+from typing_extensions import Literal, TypedDict
__all__ = ["WorkerListParams"]
class WorkerListParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
order: Literal["asc", "desc"]
diff --git a/src/cloudflare/types/workers/beta/worker_update_params.py b/src/cloudflare/types/workers/beta/worker_update_params.py
index 79cb27cf00b..5c13f983c1f 100644
--- a/src/cloudflare/types/workers/beta/worker_update_params.py
+++ b/src/cloudflare/types/workers/beta/worker_update_params.py
@@ -18,7 +18,7 @@
class WorkerUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
name: Required[str]
diff --git a/src/cloudflare/types/workers/beta/workers/version_create_params.py b/src/cloudflare/types/workers/beta/workers/version_create_params.py
index 9f4b87ffba3..de4efe5f1ea 100644
--- a/src/cloudflare/types/workers/beta/workers/version_create_params.py
+++ b/src/cloudflare/types/workers/beta/workers/version_create_params.py
@@ -78,7 +78,7 @@
class VersionCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
deploy: bool
diff --git a/src/cloudflare/types/workers/beta/workers/version_get_params.py b/src/cloudflare/types/workers/beta/workers/version_get_params.py
index e2030664541..97be509e649 100644
--- a/src/cloudflare/types/workers/beta/workers/version_get_params.py
+++ b/src/cloudflare/types/workers/beta/workers/version_get_params.py
@@ -8,7 +8,7 @@
class VersionGetParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
worker_id: Required[str]
diff --git a/src/cloudflare/types/workers/beta/workers/version_list_params.py b/src/cloudflare/types/workers/beta/workers/version_list_params.py
index d891cd5e824..d6ac2173cbf 100644
--- a/src/cloudflare/types/workers/beta/workers/version_list_params.py
+++ b/src/cloudflare/types/workers/beta/workers/version_list_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["VersionListParams"]
class VersionListParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
page: int
diff --git a/src/cloudflare/types/workers/domain_list_params.py b/src/cloudflare/types/workers/domain_list_params.py
index f3b4793f17d..a267aa1a4a0 100644
--- a/src/cloudflare/types/workers/domain_list_params.py
+++ b/src/cloudflare/types/workers/domain_list_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["DomainListParams"]
class DomainListParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
environment: str
diff --git a/src/cloudflare/types/workers/domain_update_params.py b/src/cloudflare/types/workers/domain_update_params.py
index 1fe70ad4906..7dd2c46700e 100644
--- a/src/cloudflare/types/workers/domain_update_params.py
+++ b/src/cloudflare/types/workers/domain_update_params.py
@@ -8,7 +8,7 @@
class DomainUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
hostname: Required[str]
diff --git a/src/cloudflare/types/workers/observability/destination_create_params.py b/src/cloudflare/types/workers/observability/destination_create_params.py
index 9af45a3f4fc..474ea0cee8a 100644
--- a/src/cloudflare/types/workers/observability/destination_create_params.py
+++ b/src/cloudflare/types/workers/observability/destination_create_params.py
@@ -11,7 +11,7 @@
class DestinationCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
configuration: Required[Configuration]
diff --git a/src/cloudflare/types/workers/observability/destination_list_params.py b/src/cloudflare/types/workers/observability/destination_list_params.py
index 85d6519f33d..a7c0da46917 100644
--- a/src/cloudflare/types/workers/observability/destination_list_params.py
+++ b/src/cloudflare/types/workers/observability/destination_list_params.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing_extensions import Literal, Required, Annotated, TypedDict
+from typing_extensions import Literal, Annotated, TypedDict
from ...._utils import PropertyInfo
@@ -10,7 +10,7 @@
class DestinationListParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
order: Literal["asc", "desc"]
diff --git a/src/cloudflare/types/workers/observability/destination_update_params.py b/src/cloudflare/types/workers/observability/destination_update_params.py
index a6c2d729053..7b8754b4c43 100644
--- a/src/cloudflare/types/workers/observability/destination_update_params.py
+++ b/src/cloudflare/types/workers/observability/destination_update_params.py
@@ -9,7 +9,7 @@
class DestinationUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
configuration: Required[Configuration]
diff --git a/src/cloudflare/types/workers/observability/telemetry_keys_params.py b/src/cloudflare/types/workers/observability/telemetry_keys_params.py
index 275b94b0c97..15c446b608b 100644
--- a/src/cloudflare/types/workers/observability/telemetry_keys_params.py
+++ b/src/cloudflare/types/workers/observability/telemetry_keys_params.py
@@ -19,7 +19,7 @@
class TelemetryKeysParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
datasets: SequenceNotStr[str]
"""Leave this empty to use the default datasets"""
diff --git a/src/cloudflare/types/workers/observability/telemetry_query_params.py b/src/cloudflare/types/workers/observability/telemetry_query_params.py
index 6430ea3f9fb..e0a9dbdb6fa 100644
--- a/src/cloudflare/types/workers/observability/telemetry_query_params.py
+++ b/src/cloudflare/types/workers/observability/telemetry_query_params.py
@@ -24,7 +24,7 @@
class TelemetryQueryParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
query_id: Required[Annotated[str, PropertyInfo(alias="queryId")]]
"""Unique identifier for the query to execute"""
diff --git a/src/cloudflare/types/workers/observability/telemetry_values_params.py b/src/cloudflare/types/workers/observability/telemetry_values_params.py
index 9451743e295..9bd95acfbd3 100644
--- a/src/cloudflare/types/workers/observability/telemetry_values_params.py
+++ b/src/cloudflare/types/workers/observability/telemetry_values_params.py
@@ -19,7 +19,7 @@
class TelemetryValuesParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
datasets: Required[SequenceNotStr[str]]
"""Leave this empty to use the default datasets"""
diff --git a/src/cloudflare/types/workers/route_create_params.py b/src/cloudflare/types/workers/route_create_params.py
index d6972417d59..4b2916f5ae3 100644
--- a/src/cloudflare/types/workers/route_create_params.py
+++ b/src/cloudflare/types/workers/route_create_params.py
@@ -8,7 +8,7 @@
class RouteCreateParams(TypedDict, total=False):
- zone_id: Required[str]
+ zone_id: str
"""Identifier."""
pattern: Required[str]
diff --git a/src/cloudflare/types/workers/route_update_params.py b/src/cloudflare/types/workers/route_update_params.py
index 79a2b2a593f..5781866b531 100644
--- a/src/cloudflare/types/workers/route_update_params.py
+++ b/src/cloudflare/types/workers/route_update_params.py
@@ -8,7 +8,7 @@
class RouteUpdateParams(TypedDict, total=False):
- zone_id: Required[str]
+ zone_id: str
"""Identifier."""
pattern: Required[str]
diff --git a/src/cloudflare/types/workers/script_delete_params.py b/src/cloudflare/types/workers/script_delete_params.py
index adbccee67d4..931d9702e3a 100644
--- a/src/cloudflare/types/workers/script_delete_params.py
+++ b/src/cloudflare/types/workers/script_delete_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["ScriptDeleteParams"]
class ScriptDeleteParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
force: bool
diff --git a/src/cloudflare/types/workers/script_list_params.py b/src/cloudflare/types/workers/script_list_params.py
index 61341782f60..a91b39be0e3 100644
--- a/src/cloudflare/types/workers/script_list_params.py
+++ b/src/cloudflare/types/workers/script_list_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["ScriptListParams"]
class ScriptListParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
tags: str
diff --git a/src/cloudflare/types/workers/script_search_params.py b/src/cloudflare/types/workers/script_search_params.py
index 001d332e90e..18e63a0b54c 100644
--- a/src/cloudflare/types/workers/script_search_params.py
+++ b/src/cloudflare/types/workers/script_search_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Literal, Required, TypedDict
+from typing_extensions import Literal, TypedDict
__all__ = ["ScriptSearchParams"]
class ScriptSearchParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
id: str
diff --git a/src/cloudflare/types/workers/script_update_params.py b/src/cloudflare/types/workers/script_update_params.py
index fab83dc8675..a65c9f67530 100644
--- a/src/cloudflare/types/workers/script_update_params.py
+++ b/src/cloudflare/types/workers/script_update_params.py
@@ -80,7 +80,7 @@
class ScriptUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
metadata: Required[Metadata]
diff --git a/src/cloudflare/types/workers/scripts/assets/upload_create_params.py b/src/cloudflare/types/workers/scripts/assets/upload_create_params.py
index ee02d35a3ee..ce22605328f 100644
--- a/src/cloudflare/types/workers/scripts/assets/upload_create_params.py
+++ b/src/cloudflare/types/workers/scripts/assets/upload_create_params.py
@@ -9,7 +9,7 @@
class UploadCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
manifest: Required[Dict[str, Manifest]]
diff --git a/src/cloudflare/types/workers/scripts/content_update_params.py b/src/cloudflare/types/workers/scripts/content_update_params.py
index f24e76e9522..6de1579fb59 100644
--- a/src/cloudflare/types/workers/scripts/content_update_params.py
+++ b/src/cloudflare/types/workers/scripts/content_update_params.py
@@ -11,7 +11,7 @@
class ContentUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
metadata: Required[Metadata]
diff --git a/src/cloudflare/types/workers/scripts/deployment_create_params.py b/src/cloudflare/types/workers/scripts/deployment_create_params.py
index 1f8c35626b2..2227cfb1472 100644
--- a/src/cloudflare/types/workers/scripts/deployment_create_params.py
+++ b/src/cloudflare/types/workers/scripts/deployment_create_params.py
@@ -11,7 +11,7 @@
class DeploymentCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
strategy: Required[Literal["percentage"]]
diff --git a/src/cloudflare/types/workers/scripts/schedule_update_params.py b/src/cloudflare/types/workers/scripts/schedule_update_params.py
index 3f4e21c6d60..ba3997b29a1 100644
--- a/src/cloudflare/types/workers/scripts/schedule_update_params.py
+++ b/src/cloudflare/types/workers/scripts/schedule_update_params.py
@@ -9,7 +9,7 @@
class ScheduleUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
body: Required[Iterable[Body]]
diff --git a/src/cloudflare/types/workers/scripts/script_and_version_setting_edit_params.py b/src/cloudflare/types/workers/scripts/script_and_version_setting_edit_params.py
index 4307e6a11f3..f3c1dfbbfeb 100644
--- a/src/cloudflare/types/workers/scripts/script_and_version_setting_edit_params.py
+++ b/src/cloudflare/types/workers/scripts/script_and_version_setting_edit_params.py
@@ -78,7 +78,7 @@
class ScriptAndVersionSettingEditParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
settings: Settings
diff --git a/src/cloudflare/types/workers/scripts/secret_delete_params.py b/src/cloudflare/types/workers/scripts/secret_delete_params.py
index 072856d75f3..ae6656f059e 100644
--- a/src/cloudflare/types/workers/scripts/secret_delete_params.py
+++ b/src/cloudflare/types/workers/scripts/secret_delete_params.py
@@ -8,7 +8,7 @@
class SecretDeleteParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
script_name: Required[str]
diff --git a/src/cloudflare/types/workers/scripts/secret_get_params.py b/src/cloudflare/types/workers/scripts/secret_get_params.py
index ec1372cc8a0..baf73df92ba 100644
--- a/src/cloudflare/types/workers/scripts/secret_get_params.py
+++ b/src/cloudflare/types/workers/scripts/secret_get_params.py
@@ -8,7 +8,7 @@
class SecretGetParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
script_name: Required[str]
diff --git a/src/cloudflare/types/workers/scripts/secret_update_params.py b/src/cloudflare/types/workers/scripts/secret_update_params.py
index 50a322f91ee..4e5896aebc8 100644
--- a/src/cloudflare/types/workers/scripts/secret_update_params.py
+++ b/src/cloudflare/types/workers/scripts/secret_update_params.py
@@ -9,7 +9,7 @@
class WorkersBindingKindSecretText(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
name: Required[str]
@@ -23,7 +23,7 @@ class WorkersBindingKindSecretText(TypedDict, total=False):
class WorkersBindingKindSecretKey(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
algorithm: Required[object]
diff --git a/src/cloudflare/types/workers/scripts/setting_edit_params.py b/src/cloudflare/types/workers/scripts/setting_edit_params.py
index 79602173d79..f9d4bde187e 100644
--- a/src/cloudflare/types/workers/scripts/setting_edit_params.py
+++ b/src/cloudflare/types/workers/scripts/setting_edit_params.py
@@ -12,7 +12,7 @@
class SettingEditParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
logpush: bool
diff --git a/src/cloudflare/types/workers/scripts/subdomain_create_params.py b/src/cloudflare/types/workers/scripts/subdomain_create_params.py
index eaa360b970f..20f50b6b23b 100644
--- a/src/cloudflare/types/workers/scripts/subdomain_create_params.py
+++ b/src/cloudflare/types/workers/scripts/subdomain_create_params.py
@@ -8,7 +8,7 @@
class SubdomainCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
enabled: Required[bool]
diff --git a/src/cloudflare/types/workers/scripts/tail_create_params.py b/src/cloudflare/types/workers/scripts/tail_create_params.py
index b139916d2e4..3b521e8753d 100644
--- a/src/cloudflare/types/workers/scripts/tail_create_params.py
+++ b/src/cloudflare/types/workers/scripts/tail_create_params.py
@@ -8,7 +8,7 @@
class TailCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
body: Required[object]
diff --git a/src/cloudflare/types/workers/scripts/version_create_params.py b/src/cloudflare/types/workers/scripts/version_create_params.py
index 1d985b2f937..e72537650ab 100644
--- a/src/cloudflare/types/workers/scripts/version_create_params.py
+++ b/src/cloudflare/types/workers/scripts/version_create_params.py
@@ -56,7 +56,7 @@
class VersionCreateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
metadata: Required[Metadata]
diff --git a/src/cloudflare/types/workers/scripts/version_list_params.py b/src/cloudflare/types/workers/scripts/version_list_params.py
index 8ec395b7c57..b15c6f57451 100644
--- a/src/cloudflare/types/workers/scripts/version_list_params.py
+++ b/src/cloudflare/types/workers/scripts/version_list_params.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["VersionListParams"]
class VersionListParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
deployable: bool
diff --git a/src/cloudflare/types/workers/subdomain_update_params.py b/src/cloudflare/types/workers/subdomain_update_params.py
index e9c859e2742..5c084d8f162 100644
--- a/src/cloudflare/types/workers/subdomain_update_params.py
+++ b/src/cloudflare/types/workers/subdomain_update_params.py
@@ -8,7 +8,7 @@
class SubdomainUpdateParams(TypedDict, total=False):
- account_id: Required[str]
+ account_id: str
"""Identifier."""
subdomain: Required[str]
diff --git a/tests/api_resources/registrar/test_registrations.py b/tests/api_resources/registrar/test_registrations.py
index 3cac946518a..900a0056e63 100644
--- a/tests/api_resources/registrar/test_registrations.py
+++ b/tests/api_resources/registrar/test_registrations.py
@@ -9,6 +9,7 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncCursorPagination, AsyncCursorPagination
from cloudflare.types.registrar import (
Registration,
WorkflowStatus,
@@ -92,6 +93,55 @@ def test_path_params_create(self, client: Cloudflare) -> None:
domain_name="my-new-startup.com",
)
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ registration = client.registrar.registrations.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SyncCursorPagination[Registration], registration, path=["response"])
+
+ @parametrize
+ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
+ registration = client.registrar.registrations.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ cursor="cursor",
+ direction="asc",
+ per_page=1,
+ sort_by="registry_created_at",
+ )
+ assert_matches_type(SyncCursorPagination[Registration], registration, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.registrar.registrations.with_raw_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ registration = response.parse()
+ assert_matches_type(SyncCursorPagination[Registration], registration, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.registrar.registrations.with_streaming_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ registration = response.parse()
+ assert_matches_type(SyncCursorPagination[Registration], registration, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.registrar.registrations.with_raw_response.list(
+ account_id="",
+ )
+
@pytest.mark.skip(reason="test sends empty body but OpenAPI spec requires minProperties: 1")
@parametrize
def test_method_edit(self, client: Cloudflare) -> None:
@@ -279,6 +329,55 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
domain_name="my-new-startup.com",
)
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ registration = await async_client.registrar.registrations.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AsyncCursorPagination[Registration], registration, path=["response"])
+
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ registration = await async_client.registrar.registrations.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ cursor="cursor",
+ direction="asc",
+ per_page=1,
+ sort_by="registry_created_at",
+ )
+ assert_matches_type(AsyncCursorPagination[Registration], registration, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.registrar.registrations.with_raw_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ registration = await response.parse()
+ assert_matches_type(AsyncCursorPagination[Registration], registration, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.registrar.registrations.with_streaming_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ registration = await response.parse()
+ assert_matches_type(AsyncCursorPagination[Registration], registration, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.registrar.registrations.with_raw_response.list(
+ account_id="",
+ )
+
@pytest.mark.skip(reason="test sends empty body but OpenAPI spec requires minProperties: 1")
@parametrize
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
diff --git a/tests/api_resources/workers/beta/workers/test_versions.py b/tests/api_resources/workers/beta/workers/test_versions.py
index 3e34d30389e..e87d3a90fe2 100644
--- a/tests/api_resources/workers/beta/workers/test_versions.py
+++ b/tests/api_resources/workers/beta/workers/test_versions.py
@@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
"config": {
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page",
- "run_worker_first": ["string"],
+ "run_worker_first": True,
},
"jwt": "jwt",
},
@@ -350,7 +350,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
"config": {
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page",
- "run_worker_first": ["string"],
+ "run_worker_first": True,
},
"jwt": "jwt",
},
diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py
index 0b849e9c51a..6bd3db7e885 100644
--- a/tests/api_resources/workers/scripts/test_content.py
+++ b/tests/api_resources/workers/scripts/test_content.py
@@ -45,7 +45,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
"body_part": "worker.js",
"main_module": "worker.js",
},
- files=[b"raw file contents"],
+ files=[b"Example data"],
cf_worker_body_part="CF-WORKER-BODY-PART",
cf_worker_main_module_part="CF-WORKER-MAIN-MODULE-PART",
)
@@ -190,7 +190,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
"body_part": "worker.js",
"main_module": "worker.js",
},
- files=[b"raw file contents"],
+ files=[b"Example data"],
cf_worker_body_part="CF-WORKER-BODY-PART",
cf_worker_main_module_part="CF-WORKER-MAIN-MODULE-PART",
)
diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py
index b144e8b618c..f78c8a7d8a7 100644
--- a/tests/api_resources/workers/scripts/test_versions.py
+++ b/tests/api_resources/workers/scripts/test_versions.py
@@ -58,7 +58,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
"usage_model": "standard",
},
bindings_inherit="strict",
- files=[b"raw file contents"],
+ files=[b"Example data"],
)
assert_matches_type(VersionCreateResponse, version, path=["response"])
@@ -270,7 +270,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
"usage_model": "standard",
},
bindings_inherit="strict",
- files=[b"raw file contents"],
+ files=[b"Example data"],
)
assert_matches_type(VersionCreateResponse, version, path=["response"])
diff --git a/tests/api_resources/workers/test_scripts.py b/tests/api_resources/workers/test_scripts.py
index 4a8239e1717..6658a0b723e 100644
--- a/tests/api_resources/workers/test_scripts.py
+++ b/tests/api_resources/workers/test_scripts.py
@@ -49,7 +49,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
"_redirects": "/foo /bar 301\n/news/* /blog/:splat",
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page",
- "run_worker_first": ["string"],
+ "run_worker_first": True,
"serve_directly": True,
},
"jwt": "jwt",
@@ -121,7 +121,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
"usage_model": "standard",
},
bindings_inherit="strict",
- files=[b"raw file contents"],
+ files=[b"Example data"],
)
assert_matches_type(ScriptUpdateResponse, script, path=["response"])
@@ -410,7 +410,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
"_redirects": "/foo /bar 301\n/news/* /blog/:splat",
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page",
- "run_worker_first": ["string"],
+ "run_worker_first": True,
"serve_directly": True,
},
"jwt": "jwt",
@@ -482,7 +482,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
"usage_model": "standard",
},
bindings_inherit="strict",
- files=[b"raw file contents"],
+ files=[b"Example data"],
)
assert_matches_type(ScriptUpdateResponse, script, path=["response"])