Skip to content

Commit 6d5bba0

Browse files
feat(api): update via SDK Studio (#183)
1 parent 4557d76 commit 6d5bba0

16 files changed

Lines changed: 146 additions & 198 deletions

File tree

api.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5842,17 +5842,17 @@ Methods:
58425842
Types:
58435843

58445844
```python
5845-
from cloudflare.types.challenges import NcChallengesAdminWidgetDetail, NcChallengesAdminWidgetList
5845+
from cloudflare.types.challenges import ChallengesWidget, ChallengesWidgetList
58465846
```
58475847

58485848
Methods:
58495849

5850-
- <code title="post /accounts/{account_id}/challenges/widgets">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_create_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/nc_challenges_admin_widget_detail.py">Optional</a></code>
5851-
- <code title="put /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">update</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_update_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/nc_challenges_admin_widget_detail.py">Optional</a></code>
5852-
- <code title="get /accounts/{account_id}/challenges/widgets">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_list_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/nc_challenges_admin_widget_list.py">SyncV4PagePaginationArray[NcChallengesAdminWidgetList]</a></code>
5853-
- <code title="delete /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">delete</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/challenges/nc_challenges_admin_widget_detail.py">Optional</a></code>
5854-
- <code title="get /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">get</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/challenges/nc_challenges_admin_widget_detail.py">Optional</a></code>
5855-
- <code title="post /accounts/{account_id}/challenges/widgets/{sitekey}/rotate_secret">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">rotate_secret</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_rotate_secret_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/nc_challenges_admin_widget_detail.py">Optional</a></code>
5850+
- <code title="post /accounts/{account_id}/challenges/widgets">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_create_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/challenges_widget.py">Optional</a></code>
5851+
- <code title="put /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">update</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_update_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/challenges_widget.py">Optional</a></code>
5852+
- <code title="get /accounts/{account_id}/challenges/widgets">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_list_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/challenges_widget_list.py">SyncV4PagePaginationArray[ChallengesWidgetList]</a></code>
5853+
- <code title="delete /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">delete</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/challenges/challenges_widget.py">Optional</a></code>
5854+
- <code title="get /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">get</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/challenges/challenges_widget.py">Optional</a></code>
5855+
- <code title="post /accounts/{account_id}/challenges/widgets/{sitekey}/rotate_secret">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">rotate_secret</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_rotate_secret_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/challenges_widget.py">Optional</a></code>
58565856

58575857
# Hyperdrive
58585858

@@ -5862,7 +5862,7 @@ Types:
58625862

58635863
```python
58645864
from cloudflare.types.hyperdrive import (
5865-
HyperdriveHyperdriveWithIdentifier,
5865+
Hyperdrive,
58665866
ConfigCreateResponse,
58675867
ConfigUpdateResponse,
58685868
ConfigListResponse,
@@ -7115,12 +7115,12 @@ Methods:
71157115
Types:
71167116

71177117
```python
7118-
from cloudflare.types.dcv_delegation import TLSCertificatesAndHostnamesUUIDObject
7118+
from cloudflare.types.dcv_delegation import DCVDelegationUUID
71197119
```
71207120

71217121
Methods:
71227122

7123-
- <code title="get /zones/{zone_id}/dcv_delegation/uuid">client.dcv_delegation.uuid.<a href="./src/cloudflare/resources/dcv_delegation/uuid.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dcv_delegation/tls_certificates_and_hostnames_uuid_object.py">TLSCertificatesAndHostnamesUUIDObject</a></code>
7123+
- <code title="get /zones/{zone_id}/dcv_delegation/uuid">client.dcv_delegation.uuid.<a href="./src/cloudflare/resources/dcv_delegation/uuid.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dcv_delegation/dcv_delegation_uuid.py">DCVDelegationUUID</a></code>
71247124

71257125
# Hostnames
71267126

@@ -7132,16 +7132,16 @@ Types:
71327132

71337133
```python
71347134
from cloudflare.types.hostnames.settings import (
7135-
TLSCertificatesAndHostnamesSettingObject,
7136-
TLSCertificatesAndHostnamesSettingObjectDelete,
7135+
HostnameSettingDelete,
7136+
HostnameStting,
71377137
TLSGetResponse,
71387138
)
71397139
```
71407140

71417141
Methods:
71427142

7143-
- <code title="put /zones/{zone_id}/hostnames/settings/{setting_id}/{hostname}">client.hostnames.settings.tls.<a href="./src/cloudflare/resources/hostnames/settings/tls.py">update</a>(hostname, \*, zone_id, setting_id, \*\*<a href="src/cloudflare/types/hostnames/settings/tls_update_params.py">params</a>) -> <a href="./src/cloudflare/types/hostnames/settings/tls_certificates_and_hostnames_setting_object.py">TLSCertificatesAndHostnamesSettingObject</a></code>
7144-
- <code title="delete /zones/{zone_id}/hostnames/settings/{setting_id}/{hostname}">client.hostnames.settings.tls.<a href="./src/cloudflare/resources/hostnames/settings/tls.py">delete</a>(hostname, \*, zone_id, setting_id) -> <a href="./src/cloudflare/types/hostnames/settings/tls_certificates_and_hostnames_setting_object_delete.py">TLSCertificatesAndHostnamesSettingObjectDelete</a></code>
7143+
- <code title="put /zones/{zone_id}/hostnames/settings/{setting_id}/{hostname}">client.hostnames.settings.tls.<a href="./src/cloudflare/resources/hostnames/settings/tls.py">update</a>(hostname, \*, zone_id, setting_id, \*\*<a href="src/cloudflare/types/hostnames/settings/tls_update_params.py">params</a>) -> <a href="./src/cloudflare/types/hostnames/settings/hostname_stting.py">HostnameStting</a></code>
7144+
- <code title="delete /zones/{zone_id}/hostnames/settings/{setting_id}/{hostname}">client.hostnames.settings.tls.<a href="./src/cloudflare/resources/hostnames/settings/tls.py">delete</a>(hostname, \*, zone_id, setting_id) -> <a href="./src/cloudflare/types/hostnames/settings/hostname_setting_delete.py">HostnameSettingDelete</a></code>
71457145
- <code title="get /zones/{zone_id}/hostnames/settings/{setting_id}">client.hostnames.settings.tls.<a href="./src/cloudflare/resources/hostnames/settings/tls.py">get</a>(setting_id, \*, zone_id) -> <a href="./src/cloudflare/types/hostnames/settings/tls_get_response.py">Optional</a></code>
71467146

71477147
# Snippets

src/cloudflare/pagination.py

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Any, List, Type, Generic, Mapping, TypeVar, Optional, cast
3+
from typing import List, Generic, TypeVar, Optional, cast
44
from typing_extensions import override
55

6-
from httpx import Response
7-
8-
from ._utils import is_mapping
96
from ._models import BaseModel, GenericModel
107
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
118

@@ -27,8 +24,6 @@
2724
"AsyncSinglePage",
2825
]
2926

30-
_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)
31-
3227
_T = TypeVar("_T")
3328

3429

@@ -257,14 +252,14 @@ def next_page_info(self) -> Optional[PageInfo]:
257252

258253

259254
class SyncSinglePage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
260-
result: List[_T]
255+
items: List[_T]
261256

262257
@override
263258
def _get_page_items(self) -> List[_T]:
264-
result = self.result
265-
if not result:
259+
items = self.items
260+
if not items:
266261
return []
267-
return result
262+
return items
268263

269264
@override
270265
def next_page_info(self) -> None:
@@ -274,25 +269,16 @@ def next_page_info(self) -> None:
274269
"""
275270
return None
276271

277-
@classmethod
278-
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
279-
return cls.construct(
280-
None,
281-
**{
282-
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"result": data}),
283-
},
284-
)
285-
286272

287273
class AsyncSinglePage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
288-
result: List[_T]
274+
items: List[_T]
289275

290276
@override
291277
def _get_page_items(self) -> List[_T]:
292-
result = self.result
293-
if not result:
278+
items = self.items
279+
if not items:
294280
return []
295-
return result
281+
return items
296282

297283
@override
298284
def next_page_info(self) -> None:
@@ -301,12 +287,3 @@ def next_page_info(self) -> None:
301287
so there will never be a next page.
302288
"""
303289
return None
304-
305-
@classmethod
306-
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
307-
return cls.construct(
308-
None,
309-
**{
310-
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"result": data}),
311-
},
312-
)

src/cloudflare/resources/challenges/widgets.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
make_request_options,
2828
)
2929
from ...types.challenges import (
30-
NcChallengesAdminWidgetList,
31-
NcChallengesAdminWidgetDetail,
30+
ChallengesWidget,
31+
ChallengesWidgetList,
3232
widget_list_params,
3333
widget_create_params,
3434
widget_update_params,
@@ -68,7 +68,7 @@ def create(
6868
extra_query: Query | None = None,
6969
extra_body: Body | None = None,
7070
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
71-
) -> Optional[NcChallengesAdminWidgetDetail]:
71+
) -> Optional[ChallengesWidget]:
7272
"""
7373
Lists challenge widgets.
7474
@@ -139,7 +139,7 @@ def create(
139139
),
140140
post_parser=ResultWrapper._unwrapper,
141141
),
142-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
142+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
143143
)
144144

145145
def update(
@@ -159,7 +159,7 @@ def update(
159159
extra_query: Query | None = None,
160160
extra_body: Body | None = None,
161161
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
162-
) -> Optional[NcChallengesAdminWidgetDetail]:
162+
) -> Optional[ChallengesWidget]:
163163
"""
164164
Update the configuration of a widget.
165165
@@ -214,7 +214,7 @@ def update(
214214
timeout=timeout,
215215
post_parser=ResultWrapper._unwrapper,
216216
),
217-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
217+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
218218
)
219219

220220
def list(
@@ -231,7 +231,7 @@ def list(
231231
extra_query: Query | None = None,
232232
extra_body: Body | None = None,
233233
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
234-
) -> SyncV4PagePaginationArray[NcChallengesAdminWidgetList]:
234+
) -> SyncV4PagePaginationArray[ChallengesWidgetList]:
235235
"""
236236
Lists all turnstile widgets of an account.
237237
@@ -258,7 +258,7 @@ def list(
258258
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
259259
return self._get_api_list(
260260
f"/accounts/{account_id}/challenges/widgets",
261-
page=SyncV4PagePaginationArray[NcChallengesAdminWidgetList],
261+
page=SyncV4PagePaginationArray[ChallengesWidgetList],
262262
options=make_request_options(
263263
extra_headers=extra_headers,
264264
extra_query=extra_query,
@@ -274,7 +274,7 @@ def list(
274274
widget_list_params.WidgetListParams,
275275
),
276276
),
277-
model=NcChallengesAdminWidgetList,
277+
model=ChallengesWidgetList,
278278
)
279279

280280
def delete(
@@ -288,7 +288,7 @@ def delete(
288288
extra_query: Query | None = None,
289289
extra_body: Body | None = None,
290290
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
291-
) -> Optional[NcChallengesAdminWidgetDetail]:
291+
) -> Optional[ChallengesWidget]:
292292
"""
293293
Destroy a Turnstile Widget.
294294
@@ -318,7 +318,7 @@ def delete(
318318
timeout=timeout,
319319
post_parser=ResultWrapper._unwrapper,
320320
),
321-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
321+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
322322
)
323323

324324
def get(
@@ -332,7 +332,7 @@ def get(
332332
extra_query: Query | None = None,
333333
extra_body: Body | None = None,
334334
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
335-
) -> Optional[NcChallengesAdminWidgetDetail]:
335+
) -> Optional[ChallengesWidget]:
336336
"""
337337
Show a single challenge widget configuration.
338338
@@ -362,7 +362,7 @@ def get(
362362
timeout=timeout,
363363
post_parser=ResultWrapper._unwrapper,
364364
),
365-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
365+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
366366
)
367367

368368
def rotate_secret(
@@ -377,7 +377,7 @@ def rotate_secret(
377377
extra_query: Query | None = None,
378378
extra_body: Body | None = None,
379379
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
380-
) -> Optional[NcChallengesAdminWidgetDetail]:
380+
) -> Optional[ChallengesWidget]:
381381
"""Generate a new secret key for this widget.
382382
383383
If `invalidate_immediately` is set to
@@ -418,7 +418,7 @@ def rotate_secret(
418418
timeout=timeout,
419419
post_parser=ResultWrapper._unwrapper,
420420
),
421-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
421+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
422422
)
423423

424424

@@ -452,7 +452,7 @@ async def create(
452452
extra_query: Query | None = None,
453453
extra_body: Body | None = None,
454454
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
455-
) -> Optional[NcChallengesAdminWidgetDetail]:
455+
) -> Optional[ChallengesWidget]:
456456
"""
457457
Lists challenge widgets.
458458
@@ -523,7 +523,7 @@ async def create(
523523
),
524524
post_parser=ResultWrapper._unwrapper,
525525
),
526-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
526+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
527527
)
528528

529529
async def update(
@@ -543,7 +543,7 @@ async def update(
543543
extra_query: Query | None = None,
544544
extra_body: Body | None = None,
545545
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
546-
) -> Optional[NcChallengesAdminWidgetDetail]:
546+
) -> Optional[ChallengesWidget]:
547547
"""
548548
Update the configuration of a widget.
549549
@@ -598,7 +598,7 @@ async def update(
598598
timeout=timeout,
599599
post_parser=ResultWrapper._unwrapper,
600600
),
601-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
601+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
602602
)
603603

604604
def list(
@@ -615,7 +615,7 @@ def list(
615615
extra_query: Query | None = None,
616616
extra_body: Body | None = None,
617617
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
618-
) -> AsyncPaginator[NcChallengesAdminWidgetList, AsyncV4PagePaginationArray[NcChallengesAdminWidgetList]]:
618+
) -> AsyncPaginator[ChallengesWidgetList, AsyncV4PagePaginationArray[ChallengesWidgetList]]:
619619
"""
620620
Lists all turnstile widgets of an account.
621621
@@ -642,7 +642,7 @@ def list(
642642
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
643643
return self._get_api_list(
644644
f"/accounts/{account_id}/challenges/widgets",
645-
page=AsyncV4PagePaginationArray[NcChallengesAdminWidgetList],
645+
page=AsyncV4PagePaginationArray[ChallengesWidgetList],
646646
options=make_request_options(
647647
extra_headers=extra_headers,
648648
extra_query=extra_query,
@@ -658,7 +658,7 @@ def list(
658658
widget_list_params.WidgetListParams,
659659
),
660660
),
661-
model=NcChallengesAdminWidgetList,
661+
model=ChallengesWidgetList,
662662
)
663663

664664
async def delete(
@@ -672,7 +672,7 @@ async def delete(
672672
extra_query: Query | None = None,
673673
extra_body: Body | None = None,
674674
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
675-
) -> Optional[NcChallengesAdminWidgetDetail]:
675+
) -> Optional[ChallengesWidget]:
676676
"""
677677
Destroy a Turnstile Widget.
678678
@@ -702,7 +702,7 @@ async def delete(
702702
timeout=timeout,
703703
post_parser=ResultWrapper._unwrapper,
704704
),
705-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
705+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
706706
)
707707

708708
async def get(
@@ -716,7 +716,7 @@ async def get(
716716
extra_query: Query | None = None,
717717
extra_body: Body | None = None,
718718
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
719-
) -> Optional[NcChallengesAdminWidgetDetail]:
719+
) -> Optional[ChallengesWidget]:
720720
"""
721721
Show a single challenge widget configuration.
722722
@@ -746,7 +746,7 @@ async def get(
746746
timeout=timeout,
747747
post_parser=ResultWrapper._unwrapper,
748748
),
749-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
749+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
750750
)
751751

752752
async def rotate_secret(
@@ -761,7 +761,7 @@ async def rotate_secret(
761761
extra_query: Query | None = None,
762762
extra_body: Body | None = None,
763763
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
764-
) -> Optional[NcChallengesAdminWidgetDetail]:
764+
) -> Optional[ChallengesWidget]:
765765
"""Generate a new secret key for this widget.
766766
767767
If `invalidate_immediately` is set to
@@ -802,7 +802,7 @@ async def rotate_secret(
802802
timeout=timeout,
803803
post_parser=ResultWrapper._unwrapper,
804804
),
805-
cast_to=cast(Type[Optional[NcChallengesAdminWidgetDetail]], ResultWrapper[NcChallengesAdminWidgetDetail]),
805+
cast_to=cast(Type[Optional[ChallengesWidget]], ResultWrapper[ChallengesWidget]),
806806
)
807807

808808

0 commit comments

Comments
 (0)