diff --git a/.stats.yml b/.stats.yml
index e848edf7872..cf094250593 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1650
+configured_endpoints: 1651
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ed9f898b31619623e50d660d04beca50e44987bfd3eb3a6ff98d3bca2a9c569.yml
diff --git a/api.md b/api.md
index 5201f1d4d78..93acad1eb53 100644
--- a/api.md
+++ b/api.md
@@ -9087,6 +9087,7 @@ Types:
from cloudflare.types.workflows import (
InstanceCreateResponse,
InstanceListResponse,
+ InstanceBulkResponse,
InstanceGetResponse,
)
```
@@ -9095,6 +9096,7 @@ Methods:
- client.workflows.instances.create(workflow_name, \*, account_id, \*\*params) -> InstanceCreateResponse
- client.workflows.instances.list(workflow_name, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[InstanceListResponse]
+- client.workflows.instances.bulk(workflow_name, \*, account_id, \*\*params) -> SyncSinglePage[InstanceBulkResponse]
- client.workflows.instances.get(instance_id, \*, account_id, workflow_name) -> InstanceGetResponse
### Status
diff --git a/src/cloudflare/resources/workflows/instances/instances.py b/src/cloudflare/resources/workflows/instances/instances.py
index 05d29386237..585736712d4 100644
--- a/src/cloudflare/resources/workflows/instances/instances.py
+++ b/src/cloudflare/resources/workflows/instances/instances.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Type, Union, cast
+from typing import Type, Union, Iterable, cast
from datetime import datetime
from typing_extensions import Literal
@@ -30,10 +30,11 @@
async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
-from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ....pagination import SyncSinglePage, AsyncSinglePage, SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ...._base_client import AsyncPaginator, make_request_options
-from ....types.workflows import instance_list_params, instance_create_params
+from ....types.workflows import instance_bulk_params, instance_list_params, instance_create_params
from ....types.workflows.instance_get_response import InstanceGetResponse
+from ....types.workflows.instance_bulk_response import InstanceBulkResponse
from ....types.workflows.instance_list_response import InstanceListResponse
from ....types.workflows.instance_create_response import InstanceCreateResponse
@@ -175,6 +176,46 @@ def list(
model=InstanceListResponse,
)
+ def bulk(
+ self,
+ workflow_name: str,
+ *,
+ account_id: str,
+ body: Iterable[instance_bulk_params.Body] | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SyncSinglePage[InstanceBulkResponse]:
+ """
+ Batch create new Workflow instances
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not workflow_name:
+ raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/workflows/{workflow_name}/instances/batch",
+ page=SyncSinglePage[InstanceBulkResponse],
+ body=maybe_transform(body, Iterable[instance_bulk_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=InstanceBulkResponse,
+ method="post",
+ )
+
def get(
self,
instance_id: str,
@@ -354,6 +395,46 @@ def list(
model=InstanceListResponse,
)
+ def bulk(
+ self,
+ workflow_name: str,
+ *,
+ account_id: str,
+ body: Iterable[instance_bulk_params.Body] | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> AsyncPaginator[InstanceBulkResponse, AsyncSinglePage[InstanceBulkResponse]]:
+ """
+ Batch create new Workflow instances
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not workflow_name:
+ raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/workflows/{workflow_name}/instances/batch",
+ page=AsyncSinglePage[InstanceBulkResponse],
+ body=maybe_transform(body, Iterable[instance_bulk_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=InstanceBulkResponse,
+ method="post",
+ )
+
async def get(
self,
instance_id: str,
@@ -408,6 +489,9 @@ def __init__(self, instances: InstancesResource) -> None:
self.list = to_raw_response_wrapper(
instances.list,
)
+ self.bulk = to_raw_response_wrapper(
+ instances.bulk,
+ )
self.get = to_raw_response_wrapper(
instances.get,
)
@@ -427,6 +511,9 @@ def __init__(self, instances: AsyncInstancesResource) -> None:
self.list = async_to_raw_response_wrapper(
instances.list,
)
+ self.bulk = async_to_raw_response_wrapper(
+ instances.bulk,
+ )
self.get = async_to_raw_response_wrapper(
instances.get,
)
@@ -446,6 +533,9 @@ def __init__(self, instances: InstancesResource) -> None:
self.list = to_streamed_response_wrapper(
instances.list,
)
+ self.bulk = to_streamed_response_wrapper(
+ instances.bulk,
+ )
self.get = to_streamed_response_wrapper(
instances.get,
)
@@ -465,6 +555,9 @@ def __init__(self, instances: AsyncInstancesResource) -> None:
self.list = async_to_streamed_response_wrapper(
instances.list,
)
+ self.bulk = async_to_streamed_response_wrapper(
+ instances.bulk,
+ )
self.get = async_to_streamed_response_wrapper(
instances.get,
)
diff --git a/src/cloudflare/types/workflows/__init__.py b/src/cloudflare/types/workflows/__init__.py
index 495bed4a099..920aee46d7a 100644
--- a/src/cloudflare/types/workflows/__init__.py
+++ b/src/cloudflare/types/workflows/__init__.py
@@ -3,12 +3,14 @@
from __future__ import annotations
from .version_list_params import VersionListParams as VersionListParams
+from .instance_bulk_params import InstanceBulkParams as InstanceBulkParams
from .instance_list_params import InstanceListParams as InstanceListParams
from .version_get_response import VersionGetResponse as VersionGetResponse
from .workflow_list_params import WorkflowListParams as WorkflowListParams
from .instance_get_response import InstanceGetResponse as InstanceGetResponse
from .version_list_response import VersionListResponse as VersionListResponse
from .workflow_get_response import WorkflowGetResponse as WorkflowGetResponse
+from .instance_bulk_response import InstanceBulkResponse as InstanceBulkResponse
from .instance_create_params import InstanceCreateParams as InstanceCreateParams
from .instance_list_response import InstanceListResponse as InstanceListResponse
from .workflow_list_response import WorkflowListResponse as WorkflowListResponse
diff --git a/src/cloudflare/types/workflows/instance_bulk_params.py b/src/cloudflare/types/workflows/instance_bulk_params.py
new file mode 100644
index 00000000000..5aeb318c935
--- /dev/null
+++ b/src/cloudflare/types/workflows/instance_bulk_params.py
@@ -0,0 +1,20 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Iterable
+from typing_extensions import Required, TypedDict
+
+__all__ = ["InstanceBulkParams", "Body"]
+
+
+class InstanceBulkParams(TypedDict, total=False):
+ account_id: Required[str]
+
+ body: Iterable[Body]
+
+
+class Body(TypedDict, total=False):
+ instance_id: str
+
+ params: object
diff --git a/src/cloudflare/types/workflows/instance_bulk_response.py b/src/cloudflare/types/workflows/instance_bulk_response.py
new file mode 100644
index 00000000000..66aad6fdc68
--- /dev/null
+++ b/src/cloudflare/types/workflows/instance_bulk_response.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["InstanceBulkResponse"]
+
+
+class InstanceBulkResponse(BaseModel):
+ id: str
+
+ status: Literal[
+ "queued", "running", "paused", "errored", "terminated", "complete", "waitingForPause", "waiting", "unknown"
+ ]
+
+ version_id: str
+
+ workflow_id: str
diff --git a/tests/api_resources/workflows/test_instances.py b/tests/api_resources/workflows/test_instances.py
index ab4e5e5a3f9..b13a0879f29 100644
--- a/tests/api_resources/workflows/test_instances.py
+++ b/tests/api_resources/workflows/test_instances.py
@@ -10,9 +10,10 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare._utils import parse_datetime
-from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from cloudflare.pagination import SyncSinglePage, AsyncSinglePage, SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from cloudflare.types.workflows import (
InstanceGetResponse,
+ InstanceBulkResponse,
InstanceListResponse,
InstanceCreateResponse,
)
@@ -142,6 +143,68 @@ def test_path_params_list(self, client: Cloudflare) -> None:
account_id="account_id",
)
+ @parametrize
+ def test_method_bulk(self, client: Cloudflare) -> None:
+ instance = client.workflows.instances.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ )
+ assert_matches_type(SyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ @parametrize
+ def test_method_bulk_with_all_params(self, client: Cloudflare) -> None:
+ instance = client.workflows.instances.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ body=[
+ {
+ "instance_id": "instance_id",
+ "params": {},
+ }
+ ],
+ )
+ assert_matches_type(SyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ @parametrize
+ def test_raw_response_bulk(self, client: Cloudflare) -> None:
+ response = client.workflows.instances.with_raw_response.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ instance = response.parse()
+ assert_matches_type(SyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ @parametrize
+ def test_streaming_response_bulk(self, client: Cloudflare) -> None:
+ with client.workflows.instances.with_streaming_response.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ instance = response.parse()
+ assert_matches_type(SyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_bulk(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workflows.instances.with_raw_response.bulk(
+ workflow_name="x",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `workflow_name` but received ''"):
+ client.workflows.instances.with_raw_response.bulk(
+ workflow_name="",
+ account_id="account_id",
+ )
+
@parametrize
def test_method_get(self, client: Cloudflare) -> None:
instance = client.workflows.instances.get(
@@ -325,6 +388,68 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
account_id="account_id",
)
+ @parametrize
+ async def test_method_bulk(self, async_client: AsyncCloudflare) -> None:
+ instance = await async_client.workflows.instances.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ )
+ assert_matches_type(AsyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ @parametrize
+ async def test_method_bulk_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ instance = await async_client.workflows.instances.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ body=[
+ {
+ "instance_id": "instance_id",
+ "params": {},
+ }
+ ],
+ )
+ assert_matches_type(AsyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ @parametrize
+ async def test_raw_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workflows.instances.with_raw_response.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ instance = await response.parse()
+ assert_matches_type(AsyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workflows.instances.with_streaming_response.bulk(
+ workflow_name="x",
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ instance = await response.parse()
+ assert_matches_type(AsyncSinglePage[InstanceBulkResponse], instance, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_bulk(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workflows.instances.with_raw_response.bulk(
+ workflow_name="x",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `workflow_name` but received ''"):
+ await async_client.workflows.instances.with_raw_response.bulk(
+ workflow_name="",
+ account_id="account_id",
+ )
+
@parametrize
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
instance = await async_client.workflows.instances.get(