Skip to content

Commit fc39041

Browse files
feat: fix(kv): use cursor_limit_pagination for KV list keys endpoint
* fix(kv): use cursor_limit_pagination for KV list keys endpoint * fix(kv): use cursor_limit_pagination for list keys endpoint Use the existing cursor_limit_pagination scheme instead of creating a custom pagination configuration. This ensures Stainless correctly generates SDK pagination helpers for the KV namespace keys list endpoint.
1 parent 44ae23e commit fc39041

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 2010
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e698017772b79ecded767e9d0c858d903bb6c0bdcb8d7f2d4e54d5a0a6da5490.yml
33
openapi_spec_hash: 062323f5fc00ff86b482e98509a36b65
4-
config_hash: 82cfe5a4a27ca8b4eb41cee4987d6c77
4+
config_hash: 6624e8a2894aa351046b96fc95fa60f5

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,7 @@ from cloudflare.types.kv.namespaces import (
26792679

26802680
Methods:
26812681

2682-
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys">client.kv.namespaces.keys.<a href="./src/cloudflare/resources/kv/namespaces/keys.py">list</a>(namespace_id, \*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/key_list_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/key.py">SyncCursorPaginationAfter[Key]</a></code>
2682+
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys">client.kv.namespaces.keys.<a href="./src/cloudflare/resources/kv/namespaces/keys.py">list</a>(namespace_id, \*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/key_list_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/key.py">SyncCursorLimitPagination[Key]</a></code>
26832683
- <code title="post /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete">client.kv.namespaces.keys.<a href="./src/cloudflare/resources/kv/namespaces/keys.py">bulk_delete</a>(namespace_id, \*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/key_bulk_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/key_bulk_delete_response.py">Optional[KeyBulkDeleteResponse]</a></code>
26842684
- <code title="post /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get">client.kv.namespaces.keys.<a href="./src/cloudflare/resources/kv/namespaces/keys.py">bulk_get</a>(namespace_id, \*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/key_bulk_get_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/key_bulk_get_response.py">Optional[KeyBulkGetResponse]</a></code>
26852685
- <code title="put /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk">client.kv.namespaces.keys.<a href="./src/cloudflare/resources/kv/namespaces/keys.py">bulk_update</a>(namespace_id, \*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/key_bulk_update_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/key_bulk_update_response.py">Optional[KeyBulkUpdateResponse]</a></code>

src/cloudflare/resources/kv/namespaces/keys.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
async_to_streamed_response_wrapper,
2020
)
2121
from ...._wrappers import ResultWrapper
22-
from ....pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
22+
from ....pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination
2323
from ...._base_client import AsyncPaginator, make_request_options
2424
from ....types.kv.namespaces import key_list_params, key_bulk_get_params, key_bulk_update_params
2525
from ....types.kv.namespaces.key import Key
@@ -64,7 +64,7 @@ def list(
6464
extra_query: Query | None = None,
6565
extra_body: Body | None = None,
6666
timeout: float | httpx.Timeout | None | NotGiven = not_given,
67-
) -> SyncCursorPaginationAfter[Key]:
67+
) -> SyncCursorLimitPagination[Key]:
6868
"""
6969
Lists a namespace's keys.
7070
@@ -98,7 +98,7 @@ def list(
9898
raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}")
9999
return self._get_api_list(
100100
f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys",
101-
page=SyncCursorPaginationAfter[Key],
101+
page=SyncCursorLimitPagination[Key],
102102
options=make_request_options(
103103
extra_headers=extra_headers,
104104
extra_query=extra_query,
@@ -323,7 +323,7 @@ def list(
323323
extra_query: Query | None = None,
324324
extra_body: Body | None = None,
325325
timeout: float | httpx.Timeout | None | NotGiven = not_given,
326-
) -> AsyncPaginator[Key, AsyncCursorPaginationAfter[Key]]:
326+
) -> AsyncPaginator[Key, AsyncCursorLimitPagination[Key]]:
327327
"""
328328
Lists a namespace's keys.
329329
@@ -357,7 +357,7 @@ def list(
357357
raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}")
358358
return self._get_api_list(
359359
f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys",
360-
page=AsyncCursorPaginationAfter[Key],
360+
page=AsyncCursorLimitPagination[Key],
361361
options=make_request_options(
362362
extra_headers=extra_headers,
363363
extra_query=extra_query,

tests/api_resources/kv/namespaces/test_keys.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from cloudflare import Cloudflare, AsyncCloudflare
1111
from tests.utils import assert_matches_type
12-
from cloudflare.pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
12+
from cloudflare.pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination
1313
from cloudflare.types.kv.namespaces import (
1414
Key,
1515
KeyBulkGetResponse,
@@ -31,7 +31,7 @@ def test_method_list(self, client: Cloudflare) -> None:
3131
namespace_id="0f2ac74b498b48028cb68387c421e279",
3232
account_id="023e105f4ecef8ad9ca31a8372d0c353",
3333
)
34-
assert_matches_type(SyncCursorPaginationAfter[Key], key, path=["response"])
34+
assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"])
3535

3636
@parametrize
3737
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
@@ -42,7 +42,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
4242
limit=10,
4343
prefix="My-Prefix",
4444
)
45-
assert_matches_type(SyncCursorPaginationAfter[Key], key, path=["response"])
45+
assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"])
4646

4747
@parametrize
4848
def test_raw_response_list(self, client: Cloudflare) -> None:
@@ -54,7 +54,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
5454
assert response.is_closed is True
5555
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5656
key = response.parse()
57-
assert_matches_type(SyncCursorPaginationAfter[Key], key, path=["response"])
57+
assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"])
5858

5959
@parametrize
6060
def test_streaming_response_list(self, client: Cloudflare) -> None:
@@ -66,7 +66,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
6666
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6767

6868
key = response.parse()
69-
assert_matches_type(SyncCursorPaginationAfter[Key], key, path=["response"])
69+
assert_matches_type(SyncCursorLimitPagination[Key], key, path=["response"])
7070

7171
assert cast(Any, response.is_closed) is True
7272

@@ -308,7 +308,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
308308
namespace_id="0f2ac74b498b48028cb68387c421e279",
309309
account_id="023e105f4ecef8ad9ca31a8372d0c353",
310310
)
311-
assert_matches_type(AsyncCursorPaginationAfter[Key], key, path=["response"])
311+
assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"])
312312

313313
@parametrize
314314
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
@@ -319,7 +319,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
319319
limit=10,
320320
prefix="My-Prefix",
321321
)
322-
assert_matches_type(AsyncCursorPaginationAfter[Key], key, path=["response"])
322+
assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"])
323323

324324
@parametrize
325325
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -331,7 +331,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
331331
assert response.is_closed is True
332332
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
333333
key = await response.parse()
334-
assert_matches_type(AsyncCursorPaginationAfter[Key], key, path=["response"])
334+
assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"])
335335

336336
@parametrize
337337
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -343,7 +343,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
343343
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
344344

345345
key = await response.parse()
346-
assert_matches_type(AsyncCursorPaginationAfter[Key], key, path=["response"])
346+
assert_matches_type(AsyncCursorLimitPagination[Key], key, path=["response"])
347347

348348
assert cast(Any, response.is_closed) is True
349349

0 commit comments

Comments
 (0)