Skip to content

Commit 7477489

Browse files
chore(api): upload stainless config from cloudflare-config
1 parent cf3a21e commit 7477489

10 files changed

Lines changed: 291 additions & 45 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: 1793
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5b8e1dbaaf6d219cc93cf890a1c5eee22464d53994c0135af2bd575ec04f4633.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2f61590aa8911086b5c879a035656860c8ea7919bc350836130d9ed1d94cb7a8.yml
33
openapi_spec_hash: 7f912d56bd17a6197f37cad70250bef6
4-
config_hash: 04c3e87def66bed3001640fca84ff9c5
4+
config_hash: 79f17109e02e2ed32ead147f166f5879

api.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4548,17 +4548,19 @@ from cloudflare.types.rules.lists import (
45484548
ListItem,
45494549
ItemCreateResponse,
45504550
ItemUpdateResponse,
4551+
ItemListResponse,
45514552
ItemDeleteResponse,
4553+
ItemGetResponse,
45524554
)
45534555
```
45544556

45554557
Methods:
45564558

45574559
- <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>
45584560
- <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>
4559-
- <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>) -> SyncCursorPagination[object]</code>
4561+
- <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>
45604562
- <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>
4561-
- <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) -> object</code>
4563+
- <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>
45624564

45634565
# Stream
45644566

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

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Type, Iterable, cast
5+
from typing import Any, Type, Iterable, cast
66

77
import httpx
88

@@ -20,6 +20,8 @@
2020
from ....pagination import SyncCursorPagination, AsyncCursorPagination
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
23+
from ....types.rules.lists.item_get_response import ItemGetResponse
24+
from ....types.rules.lists.item_list_response import ItemListResponse
2325
from ....types.rules.lists.item_create_response import ItemCreateResponse
2426
from ....types.rules.lists.item_delete_response import ItemDeleteResponse
2527
from ....types.rules.lists.item_update_response import ItemUpdateResponse
@@ -161,7 +163,7 @@ def list(
161163
extra_query: Query | None = None,
162164
extra_body: Body | None = None,
163165
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
164-
) -> SyncCursorPagination[object]:
166+
) -> SyncCursorPagination[ItemListResponse]:
165167
"""
166168
Fetches all the items in the list.
167169
@@ -197,7 +199,7 @@ def list(
197199
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
198200
return self._get_api_list(
199201
f"/accounts/{account_id}/rules/lists/{list_id}/items",
200-
page=SyncCursorPagination[object],
202+
page=SyncCursorPagination[ItemListResponse],
201203
options=make_request_options(
202204
extra_headers=extra_headers,
203205
extra_query=extra_query,
@@ -212,7 +214,7 @@ def list(
212214
item_list_params.ItemListParams,
213215
),
214216
),
215-
model=object,
217+
model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system
216218
)
217219

218220
def delete(
@@ -277,7 +279,7 @@ def get(
277279
extra_query: Query | None = None,
278280
extra_body: Body | None = None,
279281
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
280-
) -> object:
282+
) -> ItemGetResponse:
281283
"""
282284
Fetches a list item in the list.
283285
@@ -302,16 +304,21 @@ def get(
302304
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
303305
if not item_id:
304306
raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
305-
return self._get(
306-
f"/accounts/{account_id}/rules/lists/{list_id}/items/{item_id}",
307-
options=make_request_options(
308-
extra_headers=extra_headers,
309-
extra_query=extra_query,
310-
extra_body=extra_body,
311-
timeout=timeout,
312-
post_parser=ResultWrapper[object]._unwrapper,
307+
return cast(
308+
ItemGetResponse,
309+
self._get(
310+
f"/accounts/{account_id}/rules/lists/{list_id}/items/{item_id}",
311+
options=make_request_options(
312+
extra_headers=extra_headers,
313+
extra_query=extra_query,
314+
extra_body=extra_body,
315+
timeout=timeout,
316+
post_parser=ResultWrapper[ItemGetResponse]._unwrapper,
317+
),
318+
cast_to=cast(
319+
Any, ResultWrapper[ItemGetResponse]
320+
), # Union types cannot be passed in as arguments in the type system
313321
),
314-
cast_to=cast(Type[object], ResultWrapper[object]),
315322
)
316323

317324

@@ -449,7 +456,7 @@ def list(
449456
extra_query: Query | None = None,
450457
extra_body: Body | None = None,
451458
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
452-
) -> AsyncPaginator[object, AsyncCursorPagination[object]]:
459+
) -> AsyncPaginator[ItemListResponse, AsyncCursorPagination[ItemListResponse]]:
453460
"""
454461
Fetches all the items in the list.
455462
@@ -485,7 +492,7 @@ def list(
485492
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
486493
return self._get_api_list(
487494
f"/accounts/{account_id}/rules/lists/{list_id}/items",
488-
page=AsyncCursorPagination[object],
495+
page=AsyncCursorPagination[ItemListResponse],
489496
options=make_request_options(
490497
extra_headers=extra_headers,
491498
extra_query=extra_query,
@@ -500,7 +507,7 @@ def list(
500507
item_list_params.ItemListParams,
501508
),
502509
),
503-
model=object,
510+
model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system
504511
)
505512

506513
async def delete(
@@ -565,7 +572,7 @@ async def get(
565572
extra_query: Query | None = None,
566573
extra_body: Body | None = None,
567574
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
568-
) -> object:
575+
) -> ItemGetResponse:
569576
"""
570577
Fetches a list item in the list.
571578
@@ -590,16 +597,21 @@ async def get(
590597
raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}")
591598
if not item_id:
592599
raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
593-
return await self._get(
594-
f"/accounts/{account_id}/rules/lists/{list_id}/items/{item_id}",
595-
options=make_request_options(
596-
extra_headers=extra_headers,
597-
extra_query=extra_query,
598-
extra_body=extra_body,
599-
timeout=timeout,
600-
post_parser=ResultWrapper[object]._unwrapper,
600+
return cast(
601+
ItemGetResponse,
602+
await self._get(
603+
f"/accounts/{account_id}/rules/lists/{list_id}/items/{item_id}",
604+
options=make_request_options(
605+
extra_headers=extra_headers,
606+
extra_query=extra_query,
607+
extra_body=extra_body,
608+
timeout=timeout,
609+
post_parser=ResultWrapper[ItemGetResponse]._unwrapper,
610+
),
611+
cast_to=cast(
612+
Any, ResultWrapper[ItemGetResponse]
613+
), # Union types cannot be passed in as arguments in the type system
601614
),
602-
cast_to=cast(Type[object], ResultWrapper[object]),
603615
)
604616

605617

src/cloudflare/types/rules/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from .hostname import Hostname as Hostname
6+
from .redirect import Redirect as Redirect
57
from .lists_list import ListsList as ListsList
68
from .hostname_param import HostnameParam as HostnameParam
79
from .redirect_param import RedirectParam as RedirectParam
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
5+
from ..._models import BaseModel
6+
7+
__all__ = ["Hostname"]
8+
9+
10+
class Hostname(BaseModel):
11+
url_hostname: str
12+
13+
exclude_exact_hostname: Optional[bool] = None
14+
"""Only applies to wildcard hostnames (e.g., \\**.example.com).
15+
16+
When true (default), only subdomains are blocked. When false, both the root
17+
domain and subdomains are blocked.
18+
"""

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
from .list_cursor import ListCursor as ListCursor
66
from .item_list_params import ItemListParams as ItemListParams
7+
from .item_get_response import ItemGetResponse as ItemGetResponse
78
from .item_create_params import ItemCreateParams as ItemCreateParams
89
from .item_delete_params import ItemDeleteParams as ItemDeleteParams
10+
from .item_list_response import ItemListResponse as ItemListResponse
911
from .item_update_params import ItemUpdateParams as ItemUpdateParams
1012
from .item_create_response import ItemCreateResponse as ItemCreateResponse
1113
from .item_delete_response import ItemDeleteResponse as ItemDeleteResponse
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Union, Optional
4+
from typing_extensions import TypeAlias
5+
6+
from ..hostname import Hostname
7+
from ..redirect import Redirect
8+
from ...._models import BaseModel
9+
10+
__all__ = [
11+
"ItemGetResponse",
12+
"ListsListItemIPFull",
13+
"ListsListItemHostnameFull",
14+
"ListsListItemRedirectFull",
15+
"ListsListItemASNFull",
16+
]
17+
18+
19+
class ListsListItemIPFull(BaseModel):
20+
id: str
21+
"""The unique ID of the list."""
22+
23+
created_on: str
24+
"""The RFC 3339 timestamp of when the list was created."""
25+
26+
ip: str
27+
"""An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR."""
28+
29+
modified_on: str
30+
"""The RFC 3339 timestamp of when the list was last modified."""
31+
32+
comment: Optional[str] = None
33+
"""Defines an informative summary of the list item."""
34+
35+
36+
class ListsListItemHostnameFull(BaseModel):
37+
id: str
38+
"""The unique ID of the list."""
39+
40+
created_on: str
41+
"""The RFC 3339 timestamp of when the list was created."""
42+
43+
hostname: Hostname
44+
"""
45+
Valid characters for hostnames are ASCII(7) letters from a to z, the digits from
46+
0 to 9, wildcards (\\**), and the hyphen (-).
47+
"""
48+
49+
modified_on: str
50+
"""The RFC 3339 timestamp of when the list was last modified."""
51+
52+
comment: Optional[str] = None
53+
"""Defines an informative summary of the list item."""
54+
55+
56+
class ListsListItemRedirectFull(BaseModel):
57+
id: str
58+
"""The unique ID of the list."""
59+
60+
created_on: str
61+
"""The RFC 3339 timestamp of when the list was created."""
62+
63+
modified_on: str
64+
"""The RFC 3339 timestamp of when the list was last modified."""
65+
66+
redirect: Redirect
67+
"""The definition of the redirect."""
68+
69+
comment: Optional[str] = None
70+
"""Defines an informative summary of the list item."""
71+
72+
73+
class ListsListItemASNFull(BaseModel):
74+
id: str
75+
"""The unique ID of the list."""
76+
77+
asn: int
78+
"""Defines a non-negative 32 bit integer."""
79+
80+
created_on: str
81+
"""The RFC 3339 timestamp of when the list was created."""
82+
83+
modified_on: str
84+
"""The RFC 3339 timestamp of when the list was last modified."""
85+
86+
comment: Optional[str] = None
87+
"""Defines an informative summary of the list item."""
88+
89+
90+
ItemGetResponse: TypeAlias = Union[
91+
ListsListItemIPFull, ListsListItemHostnameFull, ListsListItemRedirectFull, ListsListItemASNFull
92+
]

0 commit comments

Comments
 (0)