From 6655e2b852593bf8e9f9e92f51db3a2f308fe295 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 30 Apr 2024 19:22:29 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- .stats.yml | 4 +- api.md | 4 - src/cloudflare/resources/intel/__init__.py | 14 -- src/cloudflare/resources/intel/intel.py | 32 ---- src/cloudflare/resources/intel/whois.py | 167 ------------------ src/cloudflare/types/intel/__init__.py | 2 - .../types/intel/whois_get_params.py | 14 -- tests/api_resources/intel/test_whois.py | 114 ------------ 8 files changed, 2 insertions(+), 349 deletions(-) delete mode 100644 src/cloudflare/resources/intel/whois.py delete mode 100644 src/cloudflare/types/intel/whois_get_params.py delete mode 100644 tests/api_resources/intel/test_whois.py diff --git a/.stats.yml b/.stats.yml index 1765a1fb19f..b38eee9f7bf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1259 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-66dffe82f1ae82ccb13bf0b382257be6906f416a22d1ca4ea74464cfff324775.yml +configured_endpoints: 1258 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-eb69a13d7b51cee2ffd5e3a4a70f4312e20c9830d80be2ecbc7006c8a524d912.yml diff --git a/api.md b/api.md index e484b059f53..008d75599a8 100644 --- a/api.md +++ b/api.md @@ -3634,10 +3634,6 @@ Types: from cloudflare.types.intel import Whois ``` -Methods: - -- client.intel.whois.get(\*, account_id, \*\*params) -> Optional - ## IndicatorFeeds Types: diff --git a/src/cloudflare/resources/intel/__init__.py b/src/cloudflare/resources/intel/__init__.py index 126ee686dad..90883d102cb 100644 --- a/src/cloudflare/resources/intel/__init__.py +++ b/src/cloudflare/resources/intel/__init__.py @@ -32,14 +32,6 @@ IntelResourceWithStreamingResponse, AsyncIntelResourceWithStreamingResponse, ) -from .whois import ( - WhoisResource, - AsyncWhoisResource, - WhoisResourceWithRawResponse, - AsyncWhoisResourceWithRawResponse, - WhoisResourceWithStreamingResponse, - AsyncWhoisResourceWithStreamingResponse, -) from .domains import ( DomainsResource, AsyncDomainsResource, @@ -140,12 +132,6 @@ "AsyncMiscategorizationsResourceWithRawResponse", "MiscategorizationsResourceWithStreamingResponse", "AsyncMiscategorizationsResourceWithStreamingResponse", - "WhoisResource", - "AsyncWhoisResource", - "WhoisResourceWithRawResponse", - "AsyncWhoisResourceWithRawResponse", - "WhoisResourceWithStreamingResponse", - "AsyncWhoisResourceWithStreamingResponse", "IndicatorFeedsResource", "AsyncIndicatorFeedsResource", "IndicatorFeedsResourceWithRawResponse", diff --git a/src/cloudflare/resources/intel/intel.py b/src/cloudflare/resources/intel/intel.py index 5dc3092ce45..f0fd166bd7d 100644 --- a/src/cloudflare/resources/intel/intel.py +++ b/src/cloudflare/resources/intel/intel.py @@ -26,14 +26,6 @@ IPsResourceWithStreamingResponse, AsyncIPsResourceWithStreamingResponse, ) -from .whois import ( - WhoisResource, - AsyncWhoisResource, - WhoisResourceWithRawResponse, - AsyncWhoisResourceWithRawResponse, - WhoisResourceWithStreamingResponse, - AsyncWhoisResourceWithStreamingResponse, -) from .asn.asn import ASNResource, AsyncASNResource from .domains import ( DomainsResource, @@ -129,10 +121,6 @@ def ip_lists(self) -> IPListsResource: def miscategorizations(self) -> MiscategorizationsResource: return MiscategorizationsResource(self._client) - @cached_property - def whois(self) -> WhoisResource: - return WhoisResource(self._client) - @cached_property def indicator_feeds(self) -> IndicatorFeedsResource: return IndicatorFeedsResource(self._client) @@ -183,10 +171,6 @@ def ip_lists(self) -> AsyncIPListsResource: def miscategorizations(self) -> AsyncMiscategorizationsResource: return AsyncMiscategorizationsResource(self._client) - @cached_property - def whois(self) -> AsyncWhoisResource: - return AsyncWhoisResource(self._client) - @cached_property def indicator_feeds(self) -> AsyncIndicatorFeedsResource: return AsyncIndicatorFeedsResource(self._client) @@ -240,10 +224,6 @@ def ip_lists(self) -> IPListsResourceWithRawResponse: def miscategorizations(self) -> MiscategorizationsResourceWithRawResponse: return MiscategorizationsResourceWithRawResponse(self._intel.miscategorizations) - @cached_property - def whois(self) -> WhoisResourceWithRawResponse: - return WhoisResourceWithRawResponse(self._intel.whois) - @cached_property def indicator_feeds(self) -> IndicatorFeedsResourceWithRawResponse: return IndicatorFeedsResourceWithRawResponse(self._intel.indicator_feeds) @@ -289,10 +269,6 @@ def ip_lists(self) -> AsyncIPListsResourceWithRawResponse: def miscategorizations(self) -> AsyncMiscategorizationsResourceWithRawResponse: return AsyncMiscategorizationsResourceWithRawResponse(self._intel.miscategorizations) - @cached_property - def whois(self) -> AsyncWhoisResourceWithRawResponse: - return AsyncWhoisResourceWithRawResponse(self._intel.whois) - @cached_property def indicator_feeds(self) -> AsyncIndicatorFeedsResourceWithRawResponse: return AsyncIndicatorFeedsResourceWithRawResponse(self._intel.indicator_feeds) @@ -338,10 +314,6 @@ def ip_lists(self) -> IPListsResourceWithStreamingResponse: def miscategorizations(self) -> MiscategorizationsResourceWithStreamingResponse: return MiscategorizationsResourceWithStreamingResponse(self._intel.miscategorizations) - @cached_property - def whois(self) -> WhoisResourceWithStreamingResponse: - return WhoisResourceWithStreamingResponse(self._intel.whois) - @cached_property def indicator_feeds(self) -> IndicatorFeedsResourceWithStreamingResponse: return IndicatorFeedsResourceWithStreamingResponse(self._intel.indicator_feeds) @@ -387,10 +359,6 @@ def ip_lists(self) -> AsyncIPListsResourceWithStreamingResponse: def miscategorizations(self) -> AsyncMiscategorizationsResourceWithStreamingResponse: return AsyncMiscategorizationsResourceWithStreamingResponse(self._intel.miscategorizations) - @cached_property - def whois(self) -> AsyncWhoisResourceWithStreamingResponse: - return AsyncWhoisResourceWithStreamingResponse(self._intel.whois) - @cached_property def indicator_feeds(self) -> AsyncIndicatorFeedsResourceWithStreamingResponse: return AsyncIndicatorFeedsResourceWithStreamingResponse(self._intel.indicator_feeds) diff --git a/src/cloudflare/resources/intel/whois.py b/src/cloudflare/resources/intel/whois.py deleted file mode 100644 index c6c0ce7a13b..00000000000 --- a/src/cloudflare/resources/intel/whois.py +++ /dev/null @@ -1,167 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ...types.intel import whois_get_params -from ..._base_client import ( - make_request_options, -) -from ...types.intel.whois import Whois - -__all__ = ["WhoisResource", "AsyncWhoisResource"] - - -class WhoisResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> WhoisResourceWithRawResponse: - return WhoisResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WhoisResourceWithStreamingResponse: - return WhoisResourceWithStreamingResponse(self) - - def get( - self, - *, - account_id: str, - domain: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Whois]: - """ - Get WHOIS Record - - Args: - account_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( - f"/accounts/{account_id}/intel/whois", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[Optional[Whois]]._unwrapper, - ), - cast_to=cast(Type[Optional[Whois]], ResultWrapper[Whois]), - ) - - -class AsyncWhoisResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncWhoisResourceWithRawResponse: - return AsyncWhoisResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWhoisResourceWithStreamingResponse: - return AsyncWhoisResourceWithStreamingResponse(self) - - async def get( - self, - *, - account_id: str, - domain: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Whois]: - """ - Get WHOIS Record - - Args: - account_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( - f"/accounts/{account_id}/intel/whois", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[Optional[Whois]]._unwrapper, - ), - cast_to=cast(Type[Optional[Whois]], ResultWrapper[Whois]), - ) - - -class WhoisResourceWithRawResponse: - def __init__(self, whois: WhoisResource) -> None: - self._whois = whois - - self.get = to_raw_response_wrapper( - whois.get, - ) - - -class AsyncWhoisResourceWithRawResponse: - def __init__(self, whois: AsyncWhoisResource) -> None: - self._whois = whois - - self.get = async_to_raw_response_wrapper( - whois.get, - ) - - -class WhoisResourceWithStreamingResponse: - def __init__(self, whois: WhoisResource) -> None: - self._whois = whois - - self.get = to_streamed_response_wrapper( - whois.get, - ) - - -class AsyncWhoisResourceWithStreamingResponse: - def __init__(self, whois: AsyncWhoisResource) -> None: - self._whois = whois - - self.get = async_to_streamed_response_wrapper( - whois.get, - ) diff --git a/src/cloudflare/types/intel/__init__.py b/src/cloudflare/types/intel/__init__.py index 9456bee9743..5143786f35e 100644 --- a/src/cloudflare/types/intel/__init__.py +++ b/src/cloudflare/types/intel/__init__.py @@ -4,7 +4,6 @@ from .ip import IP as IP from .dns import DNS as DNS -from .whois import Whois as Whois from .domain import Domain as Domain from .ip_list import IPList as IPList from .sinkhole import Sinkhole as Sinkhole @@ -12,7 +11,6 @@ from .domain_history import DomainHistory as DomainHistory from .dns_list_params import DNSListParams as DNSListParams from .ip_get_response import IPGetResponse as IPGetResponse -from .whois_get_params import WhoisGetParams as WhoisGetParams from .dns_list_response import DNSListResponse as DNSListResponse from .domain_get_params import DomainGetParams as DomainGetParams from .ip_list_get_response import IPListGetResponse as IPListGetResponse diff --git a/src/cloudflare/types/intel/whois_get_params.py b/src/cloudflare/types/intel/whois_get_params.py deleted file mode 100644 index d4069d2a7a0..00000000000 --- a/src/cloudflare/types/intel/whois_get_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WhoisGetParams"] - - -class WhoisGetParams(TypedDict, total=False): - account_id: Required[str] - """Identifier""" - - domain: str diff --git a/tests/api_resources/intel/test_whois.py b/tests/api_resources/intel/test_whois.py deleted file mode 100644 index 1428403d21e..00000000000 --- a/tests/api_resources/intel/test_whois.py +++ /dev/null @@ -1,114 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.intel import Whois - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestWhois: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - whois = client.intel.whois.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Whois], whois, path=["response"]) - - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - whois = client.intel.whois.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - domain="string", - ) - assert_matches_type(Optional[Whois], whois, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.intel.whois.with_raw_response.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - whois = response.parse() - assert_matches_type(Optional[Whois], whois, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.intel.whois.with_streaming_response.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - whois = response.parse() - assert_matches_type(Optional[Whois], whois, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.intel.whois.with_raw_response.get( - account_id="", - ) - - -class TestAsyncWhois: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - whois = await async_client.intel.whois.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Whois], whois, path=["response"]) - - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - whois = await async_client.intel.whois.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - domain="string", - ) - assert_matches_type(Optional[Whois], whois, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.intel.whois.with_raw_response.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - whois = await response.parse() - assert_matches_type(Optional[Whois], whois, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.intel.whois.with_streaming_response.get( - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - whois = await response.parse() - assert_matches_type(Optional[Whois], whois, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.intel.whois.with_raw_response.get( - account_id="", - )