Skip to content

Commit 9e1e430

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#241)
1 parent dd33a93 commit 9e1e430

File tree

83 files changed

+1264
-858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1264
-858
lines changed

api.md

+49-39
Large diffs are not rendered by default.

src/cloudflare/resources/intel/dns.py

+27-31
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing import Type, cast
6-
75
import httpx
86

97
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10-
from ..._utils import (
11-
maybe_transform,
12-
async_maybe_transform,
13-
)
8+
from ..._utils import maybe_transform
149
from ..._compat import cached_property
1510
from ..._resource import SyncAPIResource, AsyncAPIResource
1611
from ..._response import (
@@ -19,9 +14,10 @@
1914
async_to_raw_response_wrapper,
2015
async_to_streamed_response_wrapper,
2116
)
22-
from ..._wrappers import ResultWrapper
23-
from ...types.intel import dns, dns_get_params
17+
from ...pagination import SyncV4PagePagination, AsyncV4PagePagination
18+
from ...types.intel import DNSListResponse, dns_list_params
2419
from ..._base_client import (
20+
AsyncPaginator,
2521
make_request_options,
2622
)
2723

@@ -37,21 +33,21 @@ def with_raw_response(self) -> DNSWithRawResponse:
3733
def with_streaming_response(self) -> DNSWithStreamingResponse:
3834
return DNSWithStreamingResponse(self)
3935

40-
def get(
36+
def list(
4137
self,
4238
*,
4339
account_id: str,
4440
ipv4: str | NotGiven = NOT_GIVEN,
4541
page: float | NotGiven = NOT_GIVEN,
4642
per_page: float | NotGiven = NOT_GIVEN,
47-
start_end_params: dns_get_params.StartEndParams | NotGiven = NOT_GIVEN,
43+
start_end_params: dns_list_params.StartEndParams | NotGiven = NOT_GIVEN,
4844
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
4945
# The extra values given here take precedence over values defined on the client or passed to this method.
5046
extra_headers: Headers | None = None,
5147
extra_query: Query | None = None,
5248
extra_body: Body | None = None,
5349
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
54-
) -> dns.DNS:
50+
) -> SyncV4PagePagination[DNSListResponse]:
5551
"""
5652
Get Passive DNS by IP
5753
@@ -72,8 +68,9 @@ def get(
7268
"""
7369
if not account_id:
7470
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
75-
return self._get(
71+
return self._get_api_list(
7672
f"/accounts/{account_id}/intel/dns",
73+
page=SyncV4PagePagination[DNSListResponse],
7774
options=make_request_options(
7875
extra_headers=extra_headers,
7976
extra_query=extra_query,
@@ -86,11 +83,10 @@ def get(
8683
"per_page": per_page,
8784
"start_end_params": start_end_params,
8885
},
89-
dns_get_params.DNSGetParams,
86+
dns_list_params.DNSListParams,
9087
),
91-
post_parser=ResultWrapper._unwrapper,
9288
),
93-
cast_to=cast(Type[dns.DNS], ResultWrapper[dns.DNS]),
89+
model=DNSListResponse,
9490
)
9591

9692

@@ -103,21 +99,21 @@ def with_raw_response(self) -> AsyncDNSWithRawResponse:
10399
def with_streaming_response(self) -> AsyncDNSWithStreamingResponse:
104100
return AsyncDNSWithStreamingResponse(self)
105101

106-
async def get(
102+
def list(
107103
self,
108104
*,
109105
account_id: str,
110106
ipv4: str | NotGiven = NOT_GIVEN,
111107
page: float | NotGiven = NOT_GIVEN,
112108
per_page: float | NotGiven = NOT_GIVEN,
113-
start_end_params: dns_get_params.StartEndParams | NotGiven = NOT_GIVEN,
109+
start_end_params: dns_list_params.StartEndParams | NotGiven = NOT_GIVEN,
114110
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
115111
# The extra values given here take precedence over values defined on the client or passed to this method.
116112
extra_headers: Headers | None = None,
117113
extra_query: Query | None = None,
118114
extra_body: Body | None = None,
119115
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
120-
) -> dns.DNS:
116+
) -> AsyncPaginator[DNSListResponse, AsyncV4PagePagination[DNSListResponse]]:
121117
"""
122118
Get Passive DNS by IP
123119
@@ -138,59 +134,59 @@ async def get(
138134
"""
139135
if not account_id:
140136
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
141-
return await self._get(
137+
return self._get_api_list(
142138
f"/accounts/{account_id}/intel/dns",
139+
page=AsyncV4PagePagination[DNSListResponse],
143140
options=make_request_options(
144141
extra_headers=extra_headers,
145142
extra_query=extra_query,
146143
extra_body=extra_body,
147144
timeout=timeout,
148-
query=await async_maybe_transform(
145+
query=maybe_transform(
149146
{
150147
"ipv4": ipv4,
151148
"page": page,
152149
"per_page": per_page,
153150
"start_end_params": start_end_params,
154151
},
155-
dns_get_params.DNSGetParams,
152+
dns_list_params.DNSListParams,
156153
),
157-
post_parser=ResultWrapper._unwrapper,
158154
),
159-
cast_to=cast(Type[dns.DNS], ResultWrapper[dns.DNS]),
155+
model=DNSListResponse,
160156
)
161157

162158

163159
class DNSWithRawResponse:
164160
def __init__(self, dns: DNS) -> None:
165161
self._dns = dns
166162

167-
self.get = to_raw_response_wrapper(
168-
dns.get,
163+
self.list = to_raw_response_wrapper(
164+
dns.list,
169165
)
170166

171167

172168
class AsyncDNSWithRawResponse:
173169
def __init__(self, dns: AsyncDNS) -> None:
174170
self._dns = dns
175171

176-
self.get = async_to_raw_response_wrapper(
177-
dns.get,
172+
self.list = async_to_raw_response_wrapper(
173+
dns.list,
178174
)
179175

180176

181177
class DNSWithStreamingResponse:
182178
def __init__(self, dns: DNS) -> None:
183179
self._dns = dns
184180

185-
self.get = to_streamed_response_wrapper(
186-
dns.get,
181+
self.list = to_streamed_response_wrapper(
182+
dns.list,
187183
)
188184

189185

190186
class AsyncDNSWithStreamingResponse:
191187
def __init__(self, dns: AsyncDNS) -> None:
192188
self._dns = dns
193189

194-
self.get = async_to_streamed_response_wrapper(
195-
dns.get,
190+
self.list = async_to_streamed_response_wrapper(
191+
dns.list,
196192
)

src/cloudflare/resources/load_balancers/previews.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from ..._base_client import (
2020
make_request_options,
2121
)
22-
from ...types.user.load_balancers import Preview
22+
from ...types.load_balancers import PreviewGetResponse
2323

2424
__all__ = ["Previews", "AsyncPreviews"]
2525

@@ -44,7 +44,7 @@ def get(
4444
extra_query: Query | None = None,
4545
extra_body: Body | None = None,
4646
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
47-
) -> Preview:
47+
) -> PreviewGetResponse:
4848
"""
4949
Get the result of a previous preview operation using the provided preview_id.
5050
@@ -72,7 +72,7 @@ def get(
7272
timeout=timeout,
7373
post_parser=ResultWrapper._unwrapper,
7474
),
75-
cast_to=cast(Type[Preview], ResultWrapper[Preview]),
75+
cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]),
7676
)
7777

7878

@@ -96,7 +96,7 @@ async def get(
9696
extra_query: Query | None = None,
9797
extra_body: Body | None = None,
9898
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
99-
) -> Preview:
99+
) -> PreviewGetResponse:
100100
"""
101101
Get the result of a previous preview operation using the provided preview_id.
102102
@@ -124,7 +124,7 @@ async def get(
124124
timeout=timeout,
125125
post_parser=ResultWrapper._unwrapper,
126126
),
127-
cast_to=cast(Type[Preview], ResultWrapper[Preview]),
127+
cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]),
128128
)
129129

130130

src/cloudflare/resources/radar/bgp/bgp.py

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
async_maybe_transform,
4848
)
4949
from ...._compat import cached_property
50+
from .leaks.leaks import Leaks, AsyncLeaks
5051
from ...._resource import SyncAPIResource, AsyncAPIResource
5152
from ...._response import (
5253
to_raw_response_wrapper,
@@ -59,6 +60,7 @@
5960
from ...._base_client import (
6061
make_request_options,
6162
)
63+
from .hijacks.hijacks import Hijacks, AsyncHijacks
6264

6365
__all__ = ["BGP", "AsyncBGP"]
6466

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .events import (
4+
Events,
5+
AsyncEvents,
6+
EventsWithRawResponse,
7+
AsyncEventsWithRawResponse,
8+
EventsWithStreamingResponse,
9+
AsyncEventsWithStreamingResponse,
10+
)
11+
from .hijacks import (
12+
Hijacks,
13+
AsyncHijacks,
14+
HijacksWithRawResponse,
15+
AsyncHijacksWithRawResponse,
16+
HijacksWithStreamingResponse,
17+
AsyncHijacksWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"Events",
22+
"AsyncEvents",
23+
"EventsWithRawResponse",
24+
"AsyncEventsWithRawResponse",
25+
"EventsWithStreamingResponse",
26+
"AsyncEventsWithStreamingResponse",
27+
"Hijacks",
28+
"AsyncHijacks",
29+
"HijacksWithRawResponse",
30+
"AsyncHijacksWithRawResponse",
31+
"HijacksWithStreamingResponse",
32+
"AsyncHijacksWithStreamingResponse",
33+
]

0 commit comments

Comments
 (0)