Skip to content

Commit 960003f

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#443)
1 parent 9bc4051 commit 960003f

File tree

9 files changed

+536
-3
lines changed

9 files changed

+536
-3
lines changed

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1267
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6229bf7c4bed6b9026088be8817d3c8111576b2d12ff5220d193f479f230e449.yml
1+
configured_endpoints: 1268
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-7a581c61bc42c6e3e48c58c941255dca8f4b7b2e5aafd402a61c6438c2830071.yml

api.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -3631,9 +3631,13 @@ Methods:
36313631
Types:
36323632

36333633
```python
3634-
from cloudflare.types.intel import Whois
3634+
from cloudflare.types.intel import Whois, WhoisGetResponse
36353635
```
36363636

3637+
Methods:
3638+
3639+
- <code title="get /accounts/{account_id}/intel/whois">client.intel.whois.<a href="./src/cloudflare/resources/intel/whois.py">get</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/whois_get_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/whois_get_response.py">WhoisGetResponse</a></code>
3640+
36373641
## IndicatorFeeds
36383642

36393643
Types:

src/cloudflare/resources/intel/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
IntelResourceWithStreamingResponse,
3333
AsyncIntelResourceWithStreamingResponse,
3434
)
35+
from .whois import (
36+
WhoisResource,
37+
AsyncWhoisResource,
38+
WhoisResourceWithRawResponse,
39+
AsyncWhoisResourceWithRawResponse,
40+
WhoisResourceWithStreamingResponse,
41+
AsyncWhoisResourceWithStreamingResponse,
42+
)
3543
from .domains import (
3644
DomainsResource,
3745
AsyncDomainsResource,
@@ -132,6 +140,12 @@
132140
"AsyncMiscategorizationsResourceWithRawResponse",
133141
"MiscategorizationsResourceWithStreamingResponse",
134142
"AsyncMiscategorizationsResourceWithStreamingResponse",
143+
"WhoisResource",
144+
"AsyncWhoisResource",
145+
"WhoisResourceWithRawResponse",
146+
"AsyncWhoisResourceWithRawResponse",
147+
"WhoisResourceWithStreamingResponse",
148+
"AsyncWhoisResourceWithStreamingResponse",
135149
"IndicatorFeedsResource",
136150
"AsyncIndicatorFeedsResource",
137151
"IndicatorFeedsResourceWithRawResponse",

src/cloudflare/resources/intel/intel.py

+32
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
IPsResourceWithStreamingResponse,
2727
AsyncIPsResourceWithStreamingResponse,
2828
)
29+
from .whois import (
30+
WhoisResource,
31+
AsyncWhoisResource,
32+
WhoisResourceWithRawResponse,
33+
AsyncWhoisResourceWithRawResponse,
34+
WhoisResourceWithStreamingResponse,
35+
AsyncWhoisResourceWithStreamingResponse,
36+
)
2937
from .asn.asn import ASNResource, AsyncASNResource
3038
from .domains import (
3139
DomainsResource,
@@ -121,6 +129,10 @@ def ip_lists(self) -> IPListsResource:
121129
def miscategorizations(self) -> MiscategorizationsResource:
122130
return MiscategorizationsResource(self._client)
123131

132+
@cached_property
133+
def whois(self) -> WhoisResource:
134+
return WhoisResource(self._client)
135+
124136
@cached_property
125137
def indicator_feeds(self) -> IndicatorFeedsResource:
126138
return IndicatorFeedsResource(self._client)
@@ -171,6 +183,10 @@ def ip_lists(self) -> AsyncIPListsResource:
171183
def miscategorizations(self) -> AsyncMiscategorizationsResource:
172184
return AsyncMiscategorizationsResource(self._client)
173185

186+
@cached_property
187+
def whois(self) -> AsyncWhoisResource:
188+
return AsyncWhoisResource(self._client)
189+
174190
@cached_property
175191
def indicator_feeds(self) -> AsyncIndicatorFeedsResource:
176192
return AsyncIndicatorFeedsResource(self._client)
@@ -224,6 +240,10 @@ def ip_lists(self) -> IPListsResourceWithRawResponse:
224240
def miscategorizations(self) -> MiscategorizationsResourceWithRawResponse:
225241
return MiscategorizationsResourceWithRawResponse(self._intel.miscategorizations)
226242

243+
@cached_property
244+
def whois(self) -> WhoisResourceWithRawResponse:
245+
return WhoisResourceWithRawResponse(self._intel.whois)
246+
227247
@cached_property
228248
def indicator_feeds(self) -> IndicatorFeedsResourceWithRawResponse:
229249
return IndicatorFeedsResourceWithRawResponse(self._intel.indicator_feeds)
@@ -269,6 +289,10 @@ def ip_lists(self) -> AsyncIPListsResourceWithRawResponse:
269289
def miscategorizations(self) -> AsyncMiscategorizationsResourceWithRawResponse:
270290
return AsyncMiscategorizationsResourceWithRawResponse(self._intel.miscategorizations)
271291

292+
@cached_property
293+
def whois(self) -> AsyncWhoisResourceWithRawResponse:
294+
return AsyncWhoisResourceWithRawResponse(self._intel.whois)
295+
272296
@cached_property
273297
def indicator_feeds(self) -> AsyncIndicatorFeedsResourceWithRawResponse:
274298
return AsyncIndicatorFeedsResourceWithRawResponse(self._intel.indicator_feeds)
@@ -314,6 +338,10 @@ def ip_lists(self) -> IPListsResourceWithStreamingResponse:
314338
def miscategorizations(self) -> MiscategorizationsResourceWithStreamingResponse:
315339
return MiscategorizationsResourceWithStreamingResponse(self._intel.miscategorizations)
316340

341+
@cached_property
342+
def whois(self) -> WhoisResourceWithStreamingResponse:
343+
return WhoisResourceWithStreamingResponse(self._intel.whois)
344+
317345
@cached_property
318346
def indicator_feeds(self) -> IndicatorFeedsResourceWithStreamingResponse:
319347
return IndicatorFeedsResourceWithStreamingResponse(self._intel.indicator_feeds)
@@ -359,6 +387,10 @@ def ip_lists(self) -> AsyncIPListsResourceWithStreamingResponse:
359387
def miscategorizations(self) -> AsyncMiscategorizationsResourceWithStreamingResponse:
360388
return AsyncMiscategorizationsResourceWithStreamingResponse(self._intel.miscategorizations)
361389

390+
@cached_property
391+
def whois(self) -> AsyncWhoisResourceWithStreamingResponse:
392+
return AsyncWhoisResourceWithStreamingResponse(self._intel.whois)
393+
362394
@cached_property
363395
def indicator_feeds(self) -> AsyncIndicatorFeedsResourceWithStreamingResponse:
364396
return AsyncIndicatorFeedsResourceWithStreamingResponse(self._intel.indicator_feeds)
+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Type, cast
6+
7+
import httpx
8+
9+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ..._utils import (
11+
maybe_transform,
12+
async_maybe_transform,
13+
)
14+
from ..._compat import cached_property
15+
from ..._resource import SyncAPIResource, AsyncAPIResource
16+
from ..._response import (
17+
to_raw_response_wrapper,
18+
to_streamed_response_wrapper,
19+
async_to_raw_response_wrapper,
20+
async_to_streamed_response_wrapper,
21+
)
22+
from ..._wrappers import ResultWrapper
23+
from ...types.intel import whois_get_params
24+
from ..._base_client import (
25+
make_request_options,
26+
)
27+
from ...types.intel.whois_get_response import WhoisGetResponse
28+
29+
__all__ = ["WhoisResource", "AsyncWhoisResource"]
30+
31+
32+
class WhoisResource(SyncAPIResource):
33+
@cached_property
34+
def with_raw_response(self) -> WhoisResourceWithRawResponse:
35+
return WhoisResourceWithRawResponse(self)
36+
37+
@cached_property
38+
def with_streaming_response(self) -> WhoisResourceWithStreamingResponse:
39+
return WhoisResourceWithStreamingResponse(self)
40+
41+
def get(
42+
self,
43+
*,
44+
account_id: str,
45+
domain: str | NotGiven = NOT_GIVEN,
46+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
47+
# The extra values given here take precedence over values defined on the client or passed to this method.
48+
extra_headers: Headers | None = None,
49+
extra_query: Query | None = None,
50+
extra_body: Body | None = None,
51+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
52+
) -> WhoisGetResponse:
53+
"""
54+
Get WHOIS Record
55+
56+
Args:
57+
account_id: Identifier
58+
59+
extra_headers: Send extra headers
60+
61+
extra_query: Add additional query parameters to the request
62+
63+
extra_body: Add additional JSON properties to the request
64+
65+
timeout: Override the client-level default timeout for this request, in seconds
66+
"""
67+
if not account_id:
68+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
69+
return self._get(
70+
f"/accounts/{account_id}/intel/whois",
71+
options=make_request_options(
72+
extra_headers=extra_headers,
73+
extra_query=extra_query,
74+
extra_body=extra_body,
75+
timeout=timeout,
76+
query=maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams),
77+
post_parser=ResultWrapper[WhoisGetResponse]._unwrapper,
78+
),
79+
cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]),
80+
)
81+
82+
83+
class AsyncWhoisResource(AsyncAPIResource):
84+
@cached_property
85+
def with_raw_response(self) -> AsyncWhoisResourceWithRawResponse:
86+
return AsyncWhoisResourceWithRawResponse(self)
87+
88+
@cached_property
89+
def with_streaming_response(self) -> AsyncWhoisResourceWithStreamingResponse:
90+
return AsyncWhoisResourceWithStreamingResponse(self)
91+
92+
async def get(
93+
self,
94+
*,
95+
account_id: str,
96+
domain: str | NotGiven = NOT_GIVEN,
97+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
98+
# The extra values given here take precedence over values defined on the client or passed to this method.
99+
extra_headers: Headers | None = None,
100+
extra_query: Query | None = None,
101+
extra_body: Body | None = None,
102+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
103+
) -> WhoisGetResponse:
104+
"""
105+
Get WHOIS Record
106+
107+
Args:
108+
account_id: Identifier
109+
110+
extra_headers: Send extra headers
111+
112+
extra_query: Add additional query parameters to the request
113+
114+
extra_body: Add additional JSON properties to the request
115+
116+
timeout: Override the client-level default timeout for this request, in seconds
117+
"""
118+
if not account_id:
119+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
120+
return await self._get(
121+
f"/accounts/{account_id}/intel/whois",
122+
options=make_request_options(
123+
extra_headers=extra_headers,
124+
extra_query=extra_query,
125+
extra_body=extra_body,
126+
timeout=timeout,
127+
query=await async_maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams),
128+
post_parser=ResultWrapper[WhoisGetResponse]._unwrapper,
129+
),
130+
cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]),
131+
)
132+
133+
134+
class WhoisResourceWithRawResponse:
135+
def __init__(self, whois: WhoisResource) -> None:
136+
self._whois = whois
137+
138+
self.get = to_raw_response_wrapper(
139+
whois.get,
140+
)
141+
142+
143+
class AsyncWhoisResourceWithRawResponse:
144+
def __init__(self, whois: AsyncWhoisResource) -> None:
145+
self._whois = whois
146+
147+
self.get = async_to_raw_response_wrapper(
148+
whois.get,
149+
)
150+
151+
152+
class WhoisResourceWithStreamingResponse:
153+
def __init__(self, whois: WhoisResource) -> None:
154+
self._whois = whois
155+
156+
self.get = to_streamed_response_wrapper(
157+
whois.get,
158+
)
159+
160+
161+
class AsyncWhoisResourceWithStreamingResponse:
162+
def __init__(self, whois: AsyncWhoisResource) -> None:
163+
self._whois = whois
164+
165+
self.get = async_to_streamed_response_wrapper(
166+
whois.get,
167+
)

src/cloudflare/types/intel/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
from .domain_history import DomainHistory as DomainHistory
1212
from .dns_list_params import DNSListParams as DNSListParams
1313
from .ip_get_response import IPGetResponse as IPGetResponse
14+
from .whois_get_params import WhoisGetParams as WhoisGetParams
1415
from .dns_list_response import DNSListResponse as DNSListResponse
1516
from .domain_get_params import DomainGetParams as DomainGetParams
17+
from .whois_get_response import WhoisGetResponse as WhoisGetResponse
1618
from .ip_list_get_response import IPListGetResponse as IPListGetResponse
1719
from .domain_history_get_params import DomainHistoryGetParams as DomainHistoryGetParams
1820
from .domain_history_get_response import DomainHistoryGetResponse as DomainHistoryGetResponse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, TypedDict
6+
7+
__all__ = ["WhoisGetParams"]
8+
9+
10+
class WhoisGetParams(TypedDict, total=False):
11+
account_id: Required[str]
12+
"""Identifier"""
13+
14+
domain: str

0 commit comments

Comments
 (0)