Skip to content

Commit cf5a8d3

Browse files
feat(api): api update
1 parent cfc306c commit cf5a8d3

11 files changed

Lines changed: 123 additions & 63 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1808
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4f0000a33062c7661cd5941b539f46b009046ef06d6cab251a4d696799505c0f.yml
3-
openapi_spec_hash: 0023b49d510dfc54eede32b3e17ccadf
4-
config_hash: fb1054ab304fd59429dac3940d2ee05a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3ff88658548577389a348a8beea805d3d0acd6ca847c4b612b4bb3b1aee28044.yml
3+
openapi_spec_hash: 817d5f31e18225d119be2e6b46ce52a4
4+
config_hash: 03215e1e2607cd36fdac96c1ef923317

api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ from cloudflare.types.accounts.logs import AuditListResponse
131131

132132
Methods:
133133

134-
- <code title="get /accounts/{account_id}/logs/audit">client.accounts.logs.audit.<a href="./src/cloudflare/resources/accounts/logs/audit.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/accounts/logs/audit_list_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/logs/audit_list_response.py">SyncCursorLimitPagination[AuditListResponse]</a></code>
134+
- <code title="get /accounts/{account_id}/logs/audit">client.accounts.logs.audit.<a href="./src/cloudflare/resources/accounts/logs/audit.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/accounts/logs/audit_list_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/logs/audit_list_response.py">SyncCursorPaginationAfter[AuditListResponse]</a></code>
135135

136136
# OriginCACertificates
137137

@@ -2592,7 +2592,7 @@ from cloudflare.types.kv.namespaces import (
25922592

25932593
Methods:
25942594

2595-
- <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>
2595+
- <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>
25962596
- <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>
25972597
- <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>
25982598
- <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>
@@ -2641,7 +2641,7 @@ from cloudflare.types.durable_objects.namespaces import DurableObject
26412641

26422642
Methods:
26432643

2644-
- <code title="get /accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects">client.durable_objects.namespaces.objects.<a href="./src/cloudflare/resources/durable_objects/namespaces/objects.py">list</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/durable_objects/namespaces/object_list_params.py">params</a>) -> <a href="./src/cloudflare/types/durable_objects/namespaces/durable_object.py">SyncCursorLimitPagination[DurableObject]</a></code>
2644+
- <code title="get /accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects">client.durable_objects.namespaces.objects.<a href="./src/cloudflare/resources/durable_objects/namespaces/objects.py">list</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/durable_objects/namespaces/object_list_params.py">params</a>) -> <a href="./src/cloudflare/types/durable_objects/namespaces/durable_object.py">SyncCursorPaginationAfter[DurableObject]</a></code>
26452645

26462646
# Queues
26472647

@@ -4605,7 +4605,7 @@ Methods:
46054605

46064606
- <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>
46074607
- <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>
4608-
- <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>
4608+
- <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">SyncCursorPaginationAfter[ItemListResponse]</a></code>
46094609
- <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>
46104610
- <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>
46114611

src/cloudflare/pagination.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"CursorPaginationResultInfo",
1818
"SyncCursorPagination",
1919
"AsyncCursorPagination",
20+
"CursorPaginationAfterResultInfo",
21+
"CursorPaginationAfterCursors",
22+
"SyncCursorPaginationAfter",
23+
"AsyncCursorPaginationAfter",
2024
"CursorLimitPaginationResultInfo",
2125
"SyncCursorLimitPagination",
2226
"AsyncCursorLimitPagination",
@@ -175,6 +179,62 @@ def next_page_info(self) -> Optional[PageInfo]:
175179
return PageInfo(params={"cursor": cursor})
176180

177181

182+
class CursorPaginationAfterCursors(BaseModel):
183+
after: Optional[str] = None
184+
185+
186+
class CursorPaginationAfterResultInfo(BaseModel):
187+
cursors: Optional[CursorPaginationAfterCursors] = None
188+
189+
190+
class SyncCursorPaginationAfter(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
191+
result: List[_T]
192+
result_info: Optional[CursorPaginationAfterResultInfo] = None
193+
194+
@override
195+
def _get_page_items(self) -> List[_T]:
196+
result = self.result
197+
if not result:
198+
return []
199+
return result
200+
201+
@override
202+
def next_page_info(self) -> Optional[PageInfo]:
203+
after = None
204+
if self.result_info is not None:
205+
if self.result_info.cursors is not None:
206+
if self.result_info.cursors.after is not None:
207+
after = self.result_info.cursors.after
208+
if not after:
209+
return None
210+
211+
return PageInfo(params={"cursor": after})
212+
213+
214+
class AsyncCursorPaginationAfter(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
215+
result: List[_T]
216+
result_info: Optional[CursorPaginationAfterResultInfo] = None
217+
218+
@override
219+
def _get_page_items(self) -> List[_T]:
220+
result = self.result
221+
if not result:
222+
return []
223+
return result
224+
225+
@override
226+
def next_page_info(self) -> Optional[PageInfo]:
227+
after = None
228+
if self.result_info is not None:
229+
if self.result_info.cursors is not None:
230+
if self.result_info.cursors.after is not None:
231+
after = self.result_info.cursors.after
232+
if not after:
233+
return None
234+
235+
return PageInfo(params={"cursor": after})
236+
237+
178238
class CursorLimitPaginationResultInfo(BaseModel):
179239
count: Optional[int] = None
180240

src/cloudflare/resources/accounts/logs/audit.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
async_to_raw_response_wrapper,
1919
async_to_streamed_response_wrapper,
2020
)
21-
from ....pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination
21+
from ....pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
2222
from ...._base_client import AsyncPaginator, make_request_options
2323
from ....types.accounts.logs import audit_list_params
2424
from ....types.accounts.logs.audit_list_response import AuditListResponse
@@ -82,7 +82,7 @@ def list(
8282
extra_query: Query | None = None,
8383
extra_body: Body | None = None,
8484
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
85-
) -> SyncCursorLimitPagination[AuditListResponse]:
85+
) -> SyncCursorPaginationAfter[AuditListResponse]:
8686
"""Gets a list of audit logs for an account.
8787
8888
<br /> <br /> This is the beta release
@@ -124,7 +124,7 @@ def list(
124124
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
125125
return self._get_api_list(
126126
f"/accounts/{account_id}/logs/audit",
127-
page=SyncCursorLimitPagination[AuditListResponse],
127+
page=SyncCursorPaginationAfter[AuditListResponse],
128128
options=make_request_options(
129129
extra_headers=extra_headers,
130130
extra_query=extra_query,
@@ -222,7 +222,7 @@ def list(
222222
extra_query: Query | None = None,
223223
extra_body: Body | None = None,
224224
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
225-
) -> AsyncPaginator[AuditListResponse, AsyncCursorLimitPagination[AuditListResponse]]:
225+
) -> AsyncPaginator[AuditListResponse, AsyncCursorPaginationAfter[AuditListResponse]]:
226226
"""Gets a list of audit logs for an account.
227227
228228
<br /> <br /> This is the beta release
@@ -264,7 +264,7 @@ def list(
264264
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
265265
return self._get_api_list(
266266
f"/accounts/{account_id}/logs/audit",
267-
page=AsyncCursorLimitPagination[AuditListResponse],
267+
page=AsyncCursorPaginationAfter[AuditListResponse],
268268
options=make_request_options(
269269
extra_headers=extra_headers,
270270
extra_query=extra_query,

src/cloudflare/resources/durable_objects/namespaces/objects.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
async_to_raw_response_wrapper,
1515
async_to_streamed_response_wrapper,
1616
)
17-
from ....pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination
17+
from ....pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
1818
from ...._base_client import AsyncPaginator, make_request_options
1919
from ....types.durable_objects.namespaces import object_list_params
2020
from ....types.durable_objects.namespaces.durable_object import DurableObject
@@ -55,7 +55,7 @@ def list(
5555
extra_query: Query | None = None,
5656
extra_body: Body | None = None,
5757
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
58-
) -> SyncCursorLimitPagination[DurableObject]:
58+
) -> SyncCursorPaginationAfter[DurableObject]:
5959
"""
6060
Returns the Durable Objects in a given namespace.
6161
@@ -85,7 +85,7 @@ def list(
8585
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
8686
return self._get_api_list(
8787
f"/accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects",
88-
page=SyncCursorLimitPagination[DurableObject],
88+
page=SyncCursorPaginationAfter[DurableObject],
8989
options=make_request_options(
9090
extra_headers=extra_headers,
9191
extra_query=extra_query,
@@ -136,7 +136,7 @@ def list(
136136
extra_query: Query | None = None,
137137
extra_body: Body | None = None,
138138
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
139-
) -> AsyncPaginator[DurableObject, AsyncCursorLimitPagination[DurableObject]]:
139+
) -> AsyncPaginator[DurableObject, AsyncCursorPaginationAfter[DurableObject]]:
140140
"""
141141
Returns the Durable Objects in a given namespace.
142142
@@ -166,7 +166,7 @@ def list(
166166
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
167167
return self._get_api_list(
168168
f"/accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects",
169-
page=AsyncCursorLimitPagination[DurableObject],
169+
page=AsyncCursorPaginationAfter[DurableObject],
170170
options=make_request_options(
171171
extra_headers=extra_headers,
172172
extra_query=extra_query,

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 SyncCursorLimitPagination, AsyncCursorLimitPagination
22+
from ....pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
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-
) -> SyncCursorLimitPagination[Key]:
67+
) -> SyncCursorPaginationAfter[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=SyncCursorLimitPagination[Key],
101+
page=SyncCursorPaginationAfter[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, AsyncCursorLimitPagination[Key]]:
326+
) -> AsyncPaginator[Key, AsyncCursorPaginationAfter[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=AsyncCursorLimitPagination[Key],
360+
page=AsyncCursorPaginationAfter[Key],
361361
options=make_request_options(
362362
extra_headers=extra_headers,
363363
extra_query=extra_query,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
async_to_streamed_response_wrapper,
1818
)
1919
from ...._wrappers import ResultWrapper
20-
from ....pagination import SyncCursorPagination, AsyncCursorPagination
20+
from ....pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
2121
from ...._base_client import AsyncPaginator, make_request_options
2222
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
@@ -163,7 +163,7 @@ def list(
163163
extra_query: Query | None = None,
164164
extra_body: Body | None = None,
165165
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
166-
) -> SyncCursorPagination[ItemListResponse]:
166+
) -> SyncCursorPaginationAfter[ItemListResponse]:
167167
"""
168168
Fetches all the items in the list.
169169
@@ -199,7 +199,7 @@ def list(
199199
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
200200
return self._get_api_list(
201201
f"/accounts/{account_id}/rules/lists/{list_id}/items",
202-
page=SyncCursorPagination[ItemListResponse],
202+
page=SyncCursorPaginationAfter[ItemListResponse],
203203
options=make_request_options(
204204
extra_headers=extra_headers,
205205
extra_query=extra_query,
@@ -456,7 +456,7 @@ def list(
456456
extra_query: Query | None = None,
457457
extra_body: Body | None = None,
458458
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
459-
) -> AsyncPaginator[ItemListResponse, AsyncCursorPagination[ItemListResponse]]:
459+
) -> AsyncPaginator[ItemListResponse, AsyncCursorPaginationAfter[ItemListResponse]]:
460460
"""
461461
Fetches all the items in the list.
462462
@@ -492,7 +492,7 @@ def list(
492492
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
493493
return self._get_api_list(
494494
f"/accounts/{account_id}/rules/lists/{list_id}/items",
495-
page=AsyncCursorPagination[ItemListResponse],
495+
page=AsyncCursorPaginationAfter[ItemListResponse],
496496
options=make_request_options(
497497
extra_headers=extra_headers,
498498
extra_query=extra_query,

0 commit comments

Comments
 (0)