Skip to content

Commit 1156419

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): codegen related update (#2230)
1 parent 076177e commit 1156419

File tree

19 files changed

+105
-260
lines changed

19 files changed

+105
-260
lines changed

api.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3078,7 +3078,7 @@ Methods:
30783078

30793079
- <code title="post /zones/{zone_id}/spectrum/apps">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_create_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_create_response.py">Optional[AppCreateResponse]</a></code>
30803080
- <code title="put /zones/{zone_id}/spectrum/apps/{app_id}">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">update</a>(app_id, \*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_update_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_update_response.py">Optional[AppUpdateResponse]</a></code>
3081-
- <code title="get /zones/{zone_id}/spectrum/apps">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_list_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_list_response.py">SyncV4PagePaginationArray[AppListResponse]</a></code>
3081+
- <code title="get /zones/{zone_id}/spectrum/apps">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_list_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_list_response.py">SyncV4PagePaginationArray[Optional[AppListResponse]]</a></code>
30823082
- <code title="delete /zones/{zone_id}/spectrum/apps/{app_id}">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">delete</a>(app_id, \*, zone_id) -> <a href="./src/cloudflare/types/spectrum/app_delete_response.py">Optional[AppDeleteResponse]</a></code>
30833083
- <code title="get /zones/{zone_id}/spectrum/apps/{app_id}">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">get</a>(app_id, \*, zone_id) -> <a href="./src/cloudflare/types/spectrum/app_get_response.py">Optional[AppGetResponse]</a></code>
30843084

@@ -3457,12 +3457,12 @@ Methods:
34573457
Types:
34583458

34593459
```python
3460-
from cloudflare.types.intel import DNS, DNSListResponse
3460+
from cloudflare.types.intel import DNS
34613461
```
34623462

34633463
Methods:
34643464

3465-
- <code title="get /accounts/{account_id}/intel/dns">client.intel.dns.<a href="./src/cloudflare/resources/intel/dns.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/dns_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/dns_list_response.py">SyncV4PagePagination[DNSListResponse]</a></code>
3465+
- <code title="get /accounts/{account_id}/intel/dns">client.intel.dns.<a href="./src/cloudflare/resources/intel/dns.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/dns_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/dns.py">SyncV4PagePagination[Optional[DNS]]</a></code>
34663466

34673467
## Domains
34683468

@@ -3656,7 +3656,7 @@ from cloudflare.types.intel.attack_surface_report import (
36563656

36573657
Methods:
36583658

3659-
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_list_response.py">SyncV4PagePagination[IssueListResponse]</a></code>
3659+
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_list_response.py">SyncV4PagePagination[Optional[IssueListResponse]]</a></code>
36603660
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/class">client.intel.attack*surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">class*</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_class_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_class_response.py">Optional[IssueClassResponse]</a></code>
36613661
- <code title="put /accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">dismiss</a>(issue_id, \*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_dismiss_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_dismiss_response.py">IssueDismissResponse</a></code>
36623662
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/severity">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">severity</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_severity_response.py">Optional[IssueSeverityResponse]</a></code>
@@ -5662,12 +5662,12 @@ Methods:
56625662
Types:
56635663

56645664
```python
5665-
from cloudflare.types.zero_trust.dex import AggregateTimePeriod, Tests, TestListResponse
5665+
from cloudflare.types.zero_trust.dex import AggregateTimePeriod, Tests
56665666
```
56675667

56685668
Methods:
56695669

5670-
- <code title="get /accounts/{account_id}/dex/tests/overview">client.zero_trust.dex.tests.<a href="./src/cloudflare/resources/zero_trust/dex/tests/tests.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dex/test_list_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dex/test_list_response.py">SyncV4PagePagination[TestListResponse]</a></code>
5670+
- <code title="get /accounts/{account_id}/dex/tests/overview">client.zero_trust.dex.tests.<a href="./src/cloudflare/resources/zero_trust/dex/tests/tests.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dex/test_list_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dex/tests/tests.py">SyncV4PagePagination[Optional[Tests]]</a></code>
56715671

56725672
#### UniqueDevices
56735673

src/cloudflare/pagination.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class SyncV4PagePagination(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
4545
def _get_page_items(self) -> List[_T]:
4646
items = None
4747
if self.result is not None:
48-
items = self.result.items
48+
if self.result.items is not None:
49+
items = self.result.items
4950
if not items:
5051
return []
5152
return items
@@ -65,7 +66,8 @@ class AsyncV4PagePagination(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
6566
def _get_page_items(self) -> List[_T]:
6667
items = None
6768
if self.result is not None:
68-
items = self.result.items
69+
if self.result.items is not None:
70+
items = self.result.items
6971
if not items:
7072
return []
7173
return items
@@ -142,7 +144,8 @@ def _get_page_items(self) -> List[_T]:
142144
def next_page_info(self) -> Optional[PageInfo]:
143145
cursor = None
144146
if self.result_info is not None:
145-
cursor = self.result_info.cursor
147+
if self.result_info.cursor is not None:
148+
cursor = self.result_info.cursor
146149
if not cursor:
147150
return None
148151

@@ -164,7 +167,8 @@ def _get_page_items(self) -> List[_T]:
164167
def next_page_info(self) -> Optional[PageInfo]:
165168
cursor = None
166169
if self.result_info is not None:
167-
cursor = self.result_info.cursor
170+
if self.result_info.cursor is not None:
171+
cursor = self.result_info.cursor
168172
if not cursor:
169173
return None
170174

@@ -194,7 +198,8 @@ def _get_page_items(self) -> List[_T]:
194198
def next_page_info(self) -> Optional[PageInfo]:
195199
cursor = None
196200
if self.result_info is not None:
197-
cursor = self.result_info.cursor
201+
if self.result_info.cursor is not None:
202+
cursor = self.result_info.cursor
198203
if not cursor:
199204
return None
200205

@@ -216,7 +221,8 @@ def _get_page_items(self) -> List[_T]:
216221
def next_page_info(self) -> Optional[PageInfo]:
217222
cursor = None
218223
if self.result_info is not None:
219-
cursor = self.result_info.cursor
224+
if self.result_info.cursor is not None:
225+
cursor = self.result_info.cursor
220226
if not cursor:
221227
return None
222228

src/cloudflare/resources/intel/attack_surface_report/issues.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def list(
8383
extra_query: Query | None = None,
8484
extra_body: Body | None = None,
8585
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
86-
) -> SyncV4PagePagination[IssueListResponse]:
86+
) -> SyncV4PagePagination[Optional[IssueListResponse]]:
8787
"""
8888
Get Security Center Issues
8989
@@ -106,7 +106,7 @@ def list(
106106
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
107107
return self._get_api_list(
108108
f"/accounts/{account_id}/intel/attack-surface-report/issues",
109-
page=SyncV4PagePagination[IssueListResponse],
109+
page=SyncV4PagePagination[Optional[IssueListResponse]],
110110
options=make_request_options(
111111
extra_headers=extra_headers,
112112
extra_query=extra_query,
@@ -416,7 +416,7 @@ def list(
416416
extra_query: Query | None = None,
417417
extra_body: Body | None = None,
418418
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
419-
) -> AsyncPaginator[IssueListResponse, AsyncV4PagePagination[IssueListResponse]]:
419+
) -> AsyncPaginator[Optional[IssueListResponse], AsyncV4PagePagination[Optional[IssueListResponse]]]:
420420
"""
421421
Get Security Center Issues
422422
@@ -439,7 +439,7 @@ def list(
439439
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
440440
return self._get_api_list(
441441
f"/accounts/{account_id}/intel/attack-surface-report/issues",
442-
page=AsyncV4PagePagination[IssueListResponse],
442+
page=AsyncV4PagePagination[Optional[IssueListResponse]],
443443
options=make_request_options(
444444
extra_headers=extra_headers,
445445
extra_query=extra_query,

src/cloudflare/resources/intel/dns.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from typing import Optional
6+
57
import httpx
68

79
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
@@ -17,7 +19,7 @@
1719
from ...pagination import SyncV4PagePagination, AsyncV4PagePagination
1820
from ...types.intel import dns_list_params
1921
from ..._base_client import AsyncPaginator, make_request_options
20-
from ...types.intel.dns_list_response import DNSListResponse
22+
from ...types.intel.dns import DNS
2123

2224
__all__ = ["DNSResource", "AsyncDNSResource"]
2325

@@ -56,7 +58,7 @@ def list(
5658
extra_query: Query | None = None,
5759
extra_body: Body | None = None,
5860
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
59-
) -> SyncV4PagePagination[DNSListResponse]:
61+
) -> SyncV4PagePagination[Optional[DNS]]:
6062
"""
6163
Gets a list of all the domains that have resolved to a specific IP address.
6264
@@ -79,7 +81,7 @@ def list(
7981
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
8082
return self._get_api_list(
8183
f"/accounts/{account_id}/intel/dns",
82-
page=SyncV4PagePagination[DNSListResponse],
84+
page=SyncV4PagePagination[Optional[DNS]],
8385
options=make_request_options(
8486
extra_headers=extra_headers,
8587
extra_query=extra_query,
@@ -95,7 +97,7 @@ def list(
9597
dns_list_params.DNSListParams,
9698
),
9799
),
98-
model=DNSListResponse,
100+
model=DNS,
99101
)
100102

101103

@@ -133,7 +135,7 @@ def list(
133135
extra_query: Query | None = None,
134136
extra_body: Body | None = None,
135137
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
136-
) -> AsyncPaginator[DNSListResponse, AsyncV4PagePagination[DNSListResponse]]:
138+
) -> AsyncPaginator[Optional[DNS], AsyncV4PagePagination[Optional[DNS]]]:
137139
"""
138140
Gets a list of all the domains that have resolved to a specific IP address.
139141
@@ -156,7 +158,7 @@ def list(
156158
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
157159
return self._get_api_list(
158160
f"/accounts/{account_id}/intel/dns",
159-
page=AsyncV4PagePagination[DNSListResponse],
161+
page=AsyncV4PagePagination[Optional[DNS]],
160162
options=make_request_options(
161163
extra_headers=extra_headers,
162164
extra_query=extra_query,
@@ -172,7 +174,7 @@ def list(
172174
dns_list_params.DNSListParams,
173175
),
174176
),
175-
model=DNSListResponse,
177+
model=DNS,
176178
)
177179

178180

src/cloudflare/resources/spectrum/apps.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def list(
437437
extra_query: Query | None = None,
438438
extra_body: Body | None = None,
439439
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
440-
) -> SyncV4PagePaginationArray[AppListResponse]:
440+
) -> SyncV4PagePaginationArray[Optional[AppListResponse]]:
441441
"""
442442
Retrieves a list of currently existing Spectrum applications inside a zone.
443443
@@ -466,7 +466,7 @@ def list(
466466
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
467467
return self._get_api_list(
468468
f"/zones/{zone_id}/spectrum/apps",
469-
page=SyncV4PagePaginationArray[AppListResponse],
469+
page=SyncV4PagePaginationArray[Optional[AppListResponse]],
470470
options=make_request_options(
471471
extra_headers=extra_headers,
472472
extra_query=extra_query,
@@ -482,7 +482,7 @@ def list(
482482
app_list_params.AppListParams,
483483
),
484484
),
485-
model=AppListResponse,
485+
model=cast(Any, AppListResponse), # Union types cannot be passed in as arguments in the type system
486486
)
487487

488488
def delete(
@@ -978,7 +978,7 @@ def list(
978978
extra_query: Query | None = None,
979979
extra_body: Body | None = None,
980980
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
981-
) -> AsyncPaginator[AppListResponse, AsyncV4PagePaginationArray[AppListResponse]]:
981+
) -> AsyncPaginator[Optional[AppListResponse], AsyncV4PagePaginationArray[Optional[AppListResponse]]]:
982982
"""
983983
Retrieves a list of currently existing Spectrum applications inside a zone.
984984
@@ -1007,7 +1007,7 @@ def list(
10071007
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
10081008
return self._get_api_list(
10091009
f"/zones/{zone_id}/spectrum/apps",
1010-
page=AsyncV4PagePaginationArray[AppListResponse],
1010+
page=AsyncV4PagePaginationArray[Optional[AppListResponse]],
10111011
options=make_request_options(
10121012
extra_headers=extra_headers,
10131013
extra_query=extra_query,
@@ -1023,7 +1023,7 @@ def list(
10231023
app_list_params.AppListParams,
10241024
),
10251025
),
1026-
model=AppListResponse,
1026+
model=cast(Any, AppListResponse), # Union types cannot be passed in as arguments in the type system
10271027
)
10281028

10291029
async def delete(

src/cloudflare/resources/zero_trust/dex/tests/tests.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List
5+
from typing import List, Optional
66

77
import httpx
88

@@ -27,7 +27,7 @@
2727
)
2828
from ....._base_client import AsyncPaginator, make_request_options
2929
from .....types.zero_trust.dex import test_list_params
30-
from .....types.zero_trust.dex.test_list_response import TestListResponse
30+
from .....types.zero_trust.dex.tests.tests import Tests
3131

3232
__all__ = ["TestsResource", "AsyncTestsResource"]
3333

@@ -73,7 +73,7 @@ def list(
7373
extra_query: Query | None = None,
7474
extra_body: Body | None = None,
7575
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
76-
) -> SyncV4PagePagination[TestListResponse]:
76+
) -> SyncV4PagePagination[Optional[Tests]]:
7777
"""
7878
List DEX tests with overview metrics
7979
@@ -102,7 +102,7 @@ def list(
102102
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
103103
return self._get_api_list(
104104
f"/accounts/{account_id}/dex/tests/overview",
105-
page=SyncV4PagePagination[TestListResponse],
105+
page=SyncV4PagePagination[Optional[Tests]],
106106
options=make_request_options(
107107
extra_headers=extra_headers,
108108
extra_query=extra_query,
@@ -119,7 +119,7 @@ def list(
119119
test_list_params.TestListParams,
120120
),
121121
),
122-
model=TestListResponse,
122+
model=Tests,
123123
)
124124

125125

@@ -162,7 +162,7 @@ def list(
162162
extra_query: Query | None = None,
163163
extra_body: Body | None = None,
164164
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
165-
) -> AsyncPaginator[TestListResponse, AsyncV4PagePagination[TestListResponse]]:
165+
) -> AsyncPaginator[Optional[Tests], AsyncV4PagePagination[Optional[Tests]]]:
166166
"""
167167
List DEX tests with overview metrics
168168
@@ -191,7 +191,7 @@ def list(
191191
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
192192
return self._get_api_list(
193193
f"/accounts/{account_id}/dex/tests/overview",
194-
page=AsyncV4PagePagination[TestListResponse],
194+
page=AsyncV4PagePagination[Optional[Tests]],
195195
options=make_request_options(
196196
extra_headers=extra_headers,
197197
extra_query=extra_query,
@@ -208,7 +208,7 @@ def list(
208208
test_list_params.TestListParams,
209209
),
210210
),
211-
model=TestListResponse,
211+
model=Tests,
212212
)
213213

214214

Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import List, Optional
4-
from typing_extensions import Literal
54

65
from .image import Image
76
from ..._models import BaseModel
8-
from ..shared.response_info import ResponseInfo
97

10-
__all__ = ["V1ListResponse", "Result"]
11-
12-
13-
class Result(BaseModel):
14-
images: Optional[List[Image]] = None
8+
__all__ = ["V1ListResponse"]
159

1610

1711
class V1ListResponse(BaseModel):
18-
errors: List[ResponseInfo]
19-
20-
messages: List[ResponseInfo]
21-
22-
result: Result
23-
24-
success: Literal[True]
25-
"""Whether the API call was successful"""
12+
images: Optional[List[Image]] = None

src/cloudflare/types/intel/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from .dns_list_params import DNSListParams as DNSListParams
1313
from .ip_get_response import IPGetResponse as IPGetResponse
1414
from .whois_get_params import WhoisGetParams as WhoisGetParams
15-
from .dns_list_response import DNSListResponse as DNSListResponse
1615
from .domain_get_params import DomainGetParams as DomainGetParams
1716
from .whois_get_response import WhoisGetResponse as WhoisGetResponse
1817
from .ip_list_get_response import IPListGetResponse as IPListGetResponse

0 commit comments

Comments
 (0)