Skip to content

Commit aef7eb7

Browse files
feat(api): api update
1 parent ac66cd1 commit aef7eb7

14 files changed

Lines changed: 187 additions & 127 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1777
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1d1dccefd8564fd1ea42d264d0f05bf008dd6340fba070f1eaae1c252bcfd3a3.yml
3-
openapi_spec_hash: d80c6947df2d9f0f23d3eec531bc6035
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3267b5a1548af02ecbcaaab9bd5ff5fdeb620f487802af9edbae8e3fc0797932.yml
3+
openapi_spec_hash: 3cef24d9a1589e92e192cb855de613b0
44
config_hash: bafeb7666d2b7868c9d4ab8f0cc686e1

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

Lines changed: 29 additions & 19 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, cast
5+
from typing import Any, cast
66

77
import httpx
88

@@ -78,16 +78,21 @@ def get(
7878
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
7979
if not operation_id:
8080
raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}")
81-
return self._get(
82-
f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}",
83-
options=make_request_options(
84-
extra_headers=extra_headers,
85-
extra_query=extra_query,
86-
extra_body=extra_body,
87-
timeout=timeout,
88-
post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper,
81+
return cast(
82+
BulkOperationGetResponse,
83+
self._get(
84+
f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}",
85+
options=make_request_options(
86+
extra_headers=extra_headers,
87+
extra_query=extra_query,
88+
extra_body=extra_body,
89+
timeout=timeout,
90+
post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper,
91+
),
92+
cast_to=cast(
93+
Any, ResultWrapper[BulkOperationGetResponse]
94+
), # Union types cannot be passed in as arguments in the type system
8995
),
90-
cast_to=cast(Type[BulkOperationGetResponse], ResultWrapper[BulkOperationGetResponse]),
9196
)
9297

9398

@@ -147,16 +152,21 @@ async def get(
147152
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
148153
if not operation_id:
149154
raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}")
150-
return await self._get(
151-
f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}",
152-
options=make_request_options(
153-
extra_headers=extra_headers,
154-
extra_query=extra_query,
155-
extra_body=extra_body,
156-
timeout=timeout,
157-
post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper,
155+
return cast(
156+
BulkOperationGetResponse,
157+
await self._get(
158+
f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}",
159+
options=make_request_options(
160+
extra_headers=extra_headers,
161+
extra_query=extra_query,
162+
extra_body=extra_body,
163+
timeout=timeout,
164+
post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper,
165+
),
166+
cast_to=cast(
167+
Any, ResultWrapper[BulkOperationGetResponse]
168+
), # Union types cannot be passed in as arguments in the type system
158169
),
159-
cast_to=cast(Type[BulkOperationGetResponse], ResultWrapper[BulkOperationGetResponse]),
160170
)
161171

162172

src/cloudflare/types/rules/list_create_response.py

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

1010

1111
class ListCreateResponse(BaseModel):
12-
id: Optional[str] = None
12+
id: str
1313
"""The unique ID of the list."""
1414

15-
created_on: Optional[str] = None
15+
created_on: str
1616
"""The RFC 3339 timestamp of when the list was created."""
1717

18-
description: Optional[str] = None
19-
"""An informative summary of the list."""
20-
21-
kind: Optional[Literal["ip", "redirect", "hostname", "asn"]] = None
18+
kind: Literal["ip", "redirect", "hostname", "asn"]
2219
"""The type of the list.
2320
2421
Each type supports specific list items (IP addresses, ASNs, hostnames or
2522
redirects).
2623
"""
2724

28-
modified_on: Optional[str] = None
25+
modified_on: str
2926
"""The RFC 3339 timestamp of when the list was last modified."""
3027

31-
name: Optional[str] = None
28+
name: str
3229
"""An informative name for the list. Use this name in filter and rule expressions."""
3330

34-
num_items: Optional[float] = None
31+
num_items: float
3532
"""The number of items in the list."""
3633

37-
num_referencing_filters: Optional[float] = None
38-
"""The number of [filters](/operations/filters-list-filters) referencing the list."""
34+
num_referencing_filters: float
35+
"""The number of [filters](/api/resources/filters/) referencing the list."""
36+
37+
description: Optional[str] = None
38+
"""An informative summary of the list."""
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
4-
53
from ..._models import BaseModel
64

75
__all__ = ["ListDeleteResponse"]
86

97

108
class ListDeleteResponse(BaseModel):
11-
id: Optional[str] = None
9+
id: str
1210
"""The unique ID of the list."""

src/cloudflare/types/rules/list_get_response.py

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

1010

1111
class ListGetResponse(BaseModel):
12-
id: Optional[str] = None
12+
id: str
1313
"""The unique ID of the list."""
1414

15-
created_on: Optional[str] = None
15+
created_on: str
1616
"""The RFC 3339 timestamp of when the list was created."""
1717

18-
description: Optional[str] = None
19-
"""An informative summary of the list."""
20-
21-
kind: Optional[Literal["ip", "redirect", "hostname", "asn"]] = None
18+
kind: Literal["ip", "redirect", "hostname", "asn"]
2219
"""The type of the list.
2320
2421
Each type supports specific list items (IP addresses, ASNs, hostnames or
2522
redirects).
2623
"""
2724

28-
modified_on: Optional[str] = None
25+
modified_on: str
2926
"""The RFC 3339 timestamp of when the list was last modified."""
3027

31-
name: Optional[str] = None
28+
name: str
3229
"""An informative name for the list. Use this name in filter and rule expressions."""
3330

34-
num_items: Optional[float] = None
31+
num_items: float
3532
"""The number of items in the list."""
3633

37-
num_referencing_filters: Optional[float] = None
38-
"""The number of [filters](/operations/filters-list-filters) referencing the list."""
34+
num_referencing_filters: float
35+
"""The number of [filters](/api/resources/filters/) referencing the list."""
36+
37+
description: Optional[str] = None
38+
"""An informative summary of the list."""

src/cloudflare/types/rules/list_update_response.py

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

1010

1111
class ListUpdateResponse(BaseModel):
12-
id: Optional[str] = None
12+
id: str
1313
"""The unique ID of the list."""
1414

15-
created_on: Optional[str] = None
15+
created_on: str
1616
"""The RFC 3339 timestamp of when the list was created."""
1717

18-
description: Optional[str] = None
19-
"""An informative summary of the list."""
20-
21-
kind: Optional[Literal["ip", "redirect", "hostname", "asn"]] = None
18+
kind: Literal["ip", "redirect", "hostname", "asn"]
2219
"""The type of the list.
2320
2421
Each type supports specific list items (IP addresses, ASNs, hostnames or
2522
redirects).
2623
"""
2724

28-
modified_on: Optional[str] = None
25+
modified_on: str
2926
"""The RFC 3339 timestamp of when the list was last modified."""
3027

31-
name: Optional[str] = None
28+
name: str
3229
"""An informative name for the list. Use this name in filter and rule expressions."""
3330

34-
num_items: Optional[float] = None
31+
num_items: float
3532
"""The number of items in the list."""
3633

37-
num_referencing_filters: Optional[float] = None
38-
"""The number of [filters](/operations/filters-list-filters) referencing the list."""
34+
num_referencing_filters: float
35+
"""The number of [filters](/api/resources/filters/) referencing the list."""
36+
37+
description: Optional[str] = None
38+
"""An informative summary of the list."""
Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
4-
from typing_extensions import Literal
3+
from typing import Union
4+
from typing_extensions import Literal, TypeAlias
55

66
from ...._models import BaseModel
77

8-
__all__ = ["BulkOperationGetResponse"]
8+
__all__ = ["BulkOperationGetResponse", "UnionMember0", "UnionMember1", "UnionMember2"]
99

1010

11-
class BulkOperationGetResponse(BaseModel):
11+
class UnionMember0(BaseModel):
1212
id: str
1313
"""The unique operation ID of the asynchronous action."""
1414

15-
status: Literal["pending", "running", "completed", "failed"]
15+
completed: str
16+
"""The RFC 3339 timestamp of when the operation was completed."""
17+
18+
error: str
19+
"""A message describing the error when the status is `failed`."""
20+
21+
status: Literal["failed"]
22+
"""The current status of the asynchronous operation."""
23+
24+
25+
class UnionMember1(BaseModel):
26+
id: str
27+
"""The unique operation ID of the asynchronous action."""
28+
29+
status: Literal["pending", "running"]
1630
"""The current status of the asynchronous operation."""
1731

18-
completed: Optional[str] = None
32+
33+
class UnionMember2(BaseModel):
34+
id: str
35+
"""The unique operation ID of the asynchronous action."""
36+
37+
completed: str
1938
"""The RFC 3339 timestamp of when the operation was completed."""
2039

21-
error: Optional[str] = None
22-
"""A message describing the error when the status is `failed`."""
40+
status: Literal["completed"]
41+
"""The current status of the asynchronous operation."""
42+
43+
44+
BulkOperationGetResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2]

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

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
from __future__ import annotations
44

5-
from typing import Iterable
6-
from typing_extensions import Required, TypedDict
5+
from typing import Union, Iterable
6+
from typing_extensions import Required, TypeAlias, TypedDict
77

88
from ..hostname_param import HostnameParam
99
from ..redirect_param import RedirectParam
1010

11-
__all__ = ["ItemCreateParams", "Body"]
11+
__all__ = ["ItemCreateParams", "Body", "BodyUnionMember0", "BodyUnionMember1", "BodyUnionMember2", "BodyUnionMember3"]
1212

1313

1414
class ItemCreateParams(TypedDict, total=False):
@@ -18,21 +18,39 @@ class ItemCreateParams(TypedDict, total=False):
1818
body: Required[Iterable[Body]]
1919

2020

21-
class Body(TypedDict, total=False):
22-
asn: int
23-
"""Defines a non-negative 32 bit integer."""
21+
class BodyUnionMember0(TypedDict, total=False):
22+
ip: Required[str]
23+
"""An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR."""
24+
25+
comment: str
26+
"""Defines an informative summary of the list item."""
27+
28+
29+
class BodyUnionMember1(TypedDict, total=False):
30+
redirect: Required[RedirectParam]
31+
"""The definition of the redirect."""
2432

2533
comment: str
2634
"""Defines an informative summary of the list item."""
2735

28-
hostname: HostnameParam
36+
37+
class BodyUnionMember2(TypedDict, total=False):
38+
hostname: Required[HostnameParam]
2939
"""
3040
Valid characters for hostnames are ASCII(7) letters from a to z, the digits from
3141
0 to 9, wildcards (\\**), and the hyphen (-).
3242
"""
3343

34-
ip: str
35-
"""An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR."""
44+
comment: str
45+
"""Defines an informative summary of the list item."""
3646

37-
redirect: RedirectParam
38-
"""The definition of the redirect."""
47+
48+
class BodyUnionMember3(TypedDict, total=False):
49+
asn: Required[int]
50+
"""Defines a non-negative 32 bit integer."""
51+
52+
comment: str
53+
"""Defines an informative summary of the list item."""
54+
55+
56+
Body: TypeAlias = Union[BodyUnionMember0, BodyUnionMember1, BodyUnionMember2, BodyUnionMember3]
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
4-
53
from ...._models import BaseModel
64

75
__all__ = ["ItemCreateResponse"]
86

97

108
class ItemCreateResponse(BaseModel):
11-
operation_id: Optional[str] = None
9+
operation_id: str
1210
"""The unique operation ID of the asynchronous action."""
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
4-
53
from ...._models import BaseModel
64

75
__all__ = ["ItemDeleteResponse"]
86

97

108
class ItemDeleteResponse(BaseModel):
11-
operation_id: Optional[str] = None
9+
operation_id: str
1210
"""The unique operation ID of the asynchronous action."""

0 commit comments

Comments
 (0)