Skip to content

Commit f1eda00

Browse files
fix(api): add missing items param
`/accounts/{account_id}/rules/lists/{list_id}/items` takes a request body.
1 parent d3d7dd6 commit f1eda00

6 files changed

Lines changed: 46 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1769
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-22bd279cee32addc645f421ef52b9cc207ec998f883e77e580f7be79950833b4.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a2195f6a1ef92721db6c845b4d864ab688295623c8c88d71698087a17dca4fc7.yml
33
openapi_spec_hash: 3e0f59ac2722028954566a4c850e8849
4-
config_hash: e5cc3a68b9877422f1dc315213163f6e
4+
config_hash: 6a2779d0015054eac7082cca3c4e72bf

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4488,7 +4488,7 @@ Methods:
44884488
- <code title="post /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">create</a>(list_id, \*, account_id, \*\*<a href="src/cloudflare/types/rules/lists/item_create_params.py">params</a>) -> <a href="./src/cloudflare/types/rules/lists/item_create_response.py">ItemCreateResponse</a></code>
44894489
- <code title="put /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">update</a>(list_id, \*, account_id, \*\*<a href="src/cloudflare/types/rules/lists/item_update_params.py">params</a>) -> <a href="./src/cloudflare/types/rules/lists/item_update_response.py">ItemUpdateResponse</a></code>
44904490
- <code title="get /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">list</a>(list_id, \*, account_id, \*\*<a href="src/cloudflare/types/rules/lists/item_list_params.py">params</a>) -> <a href="./src/cloudflare/types/rules/lists/item_list_response.py">SyncCursorPagination[ItemListResponse]</a></code>
4491-
- <code title="delete /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">delete</a>(list_id, \*, account_id) -> <a href="./src/cloudflare/types/rules/lists/item_delete_response.py">ItemDeleteResponse</a></code>
4491+
- <code title="delete /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">delete</a>(list_id, \*, account_id, \*\*<a href="src/cloudflare/types/rules/lists/item_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/rules/lists/item_delete_response.py">ItemDeleteResponse</a></code>
44924492
- <code title="get /accounts/{account_id}/rules/lists/{list_id}/items/{item_id}">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">get</a>(item_id, \*, account_id, list_id) -> <a href="./src/cloudflare/types/rules/lists/item_get_response.py">ItemGetResponse</a></code>
44934493

44944494
# Stream

src/cloudflare/resources/rules/lists/items.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from ...._wrappers import ResultWrapper
2020
from ....pagination import SyncCursorPagination, AsyncCursorPagination
2121
from ...._base_client import AsyncPaginator, make_request_options
22-
from ....types.rules.lists import item_list_params, item_create_params, item_update_params
22+
from ....types.rules.lists import item_list_params, item_create_params, item_delete_params, item_update_params
2323
from ....types.rules.lists.item_get_response import ItemGetResponse
2424
from ....types.rules.lists.item_list_response import ItemListResponse
2525
from ....types.rules.lists.item_create_response import ItemCreateResponse
@@ -222,6 +222,7 @@ def delete(
222222
list_id: str,
223223
*,
224224
account_id: str,
225+
items: Iterable[item_delete_params.Item] | NotGiven = NOT_GIVEN,
225226
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
226227
# The extra values given here take precedence over values defined on the client or passed to this method.
227228
extra_headers: Headers | None = None,
@@ -255,6 +256,7 @@ def delete(
255256
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
256257
return self._delete(
257258
f"/accounts/{account_id}/rules/lists/{list_id}/items",
259+
body=maybe_transform({"items": items}, item_delete_params.ItemDeleteParams),
258260
options=make_request_options(
259261
extra_headers=extra_headers,
260262
extra_query=extra_query,
@@ -508,6 +510,7 @@ async def delete(
508510
list_id: str,
509511
*,
510512
account_id: str,
513+
items: Iterable[item_delete_params.Item] | NotGiven = NOT_GIVEN,
511514
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
512515
# The extra values given here take precedence over values defined on the client or passed to this method.
513516
extra_headers: Headers | None = None,
@@ -541,6 +544,7 @@ async def delete(
541544
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
542545
return await self._delete(
543546
f"/accounts/{account_id}/rules/lists/{list_id}/items",
547+
body=await async_maybe_transform({"items": items}, item_delete_params.ItemDeleteParams),
544548
options=make_request_options(
545549
extra_headers=extra_headers,
546550
extra_query=extra_query,

src/cloudflare/types/rules/lists/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .item_list_params import ItemListParams as ItemListParams
77
from .item_get_response import ItemGetResponse as ItemGetResponse
88
from .item_create_params import ItemCreateParams as ItemCreateParams
9+
from .item_delete_params import ItemDeleteParams as ItemDeleteParams
910
from .item_list_response import ItemListResponse as ItemListResponse
1011
from .item_update_params import ItemUpdateParams as ItemUpdateParams
1112
from .item_create_response import ItemCreateResponse as ItemCreateResponse
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Iterable
6+
from typing_extensions import Required, TypedDict
7+
8+
__all__ = ["ItemDeleteParams", "Item"]
9+
10+
11+
class ItemDeleteParams(TypedDict, total=False):
12+
account_id: Required[str]
13+
"""Defines an identifier."""
14+
15+
items: Iterable[Item]
16+
17+
18+
class Item(TypedDict, total=False):
19+
pass

tests/api_resources/rules/lists/test_items.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ def test_method_delete(self, client: Cloudflare) -> None:
197197
)
198198
assert_matches_type(ItemDeleteResponse, item, path=["response"])
199199

200+
@parametrize
201+
def test_method_delete_with_all_params(self, client: Cloudflare) -> None:
202+
item = client.rules.lists.items.delete(
203+
list_id="2c0fc9fa937b11eaa1b71c4d701ab86e",
204+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
205+
items=[{}],
206+
)
207+
assert_matches_type(ItemDeleteResponse, item, path=["response"])
208+
200209
@parametrize
201210
def test_raw_response_delete(self, client: Cloudflare) -> None:
202211
response = client.rules.lists.items.with_raw_response.delete(
@@ -476,6 +485,15 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
476485
)
477486
assert_matches_type(ItemDeleteResponse, item, path=["response"])
478487

488+
@parametrize
489+
async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None:
490+
item = await async_client.rules.lists.items.delete(
491+
list_id="2c0fc9fa937b11eaa1b71c4d701ab86e",
492+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
493+
items=[{}],
494+
)
495+
assert_matches_type(ItemDeleteResponse, item, path=["response"])
496+
479497
@parametrize
480498
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
481499
response = await async_client.rules.lists.items.with_raw_response.delete(

0 commit comments

Comments
 (0)