diff --git a/api.md b/api.md index acbbc6bb14b..4a802219a7b 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ ```python from cloudflare.types import ( + ASN, AuditLog, CloudflareTunnel, ErrorData, @@ -3525,15 +3526,9 @@ Methods: ## ASN -Types: - -```python -from cloudflare.types.intel import IntelASN -``` - Methods: -- client.intel.asn.get(asn, \*, account_id) -> IntelASN +- client.intel.asn.get(asn, \*, account_id) -> ASN ### Subnets diff --git a/src/cloudflare/resources/intel/asn/asn.py b/src/cloudflare/resources/intel/asn/asn.py index c5adda23278..ec259436a4e 100644 --- a/src/cloudflare/resources/intel/asn/asn.py +++ b/src/cloudflare/resources/intel/asn/asn.py @@ -24,10 +24,10 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.intel import IntelASN from ...._base_client import ( make_request_options, ) +from ....types.shared import asn __all__ = ["ASN", "AsyncASN"] @@ -47,7 +47,7 @@ def with_streaming_response(self) -> ASNWithStreamingResponse: def get( self, - asn: IntelASN, + asn: asn.ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -56,7 +56,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelASN: + ) -> asn.ASN: """ Get ASN Overview @@ -80,9 +80,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IntelASN]._unwrapper, + post_parser=ResultWrapper[asn.ASN]._unwrapper, ), - cast_to=cast(Type[IntelASN], ResultWrapper[int]), + cast_to=cast(Type[asn.ASN], ResultWrapper[int]), ) @@ -101,7 +101,7 @@ def with_streaming_response(self) -> AsyncASNWithStreamingResponse: async def get( self, - asn: IntelASN, + asn: asn.ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -110,7 +110,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntelASN: + ) -> asn.ASN: """ Get ASN Overview @@ -134,9 +134,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IntelASN]._unwrapper, + post_parser=ResultWrapper[asn.ASN]._unwrapper, ), - cast_to=cast(Type[IntelASN], ResultWrapper[int]), + cast_to=cast(Type[asn.ASN], ResultWrapper[int]), ) diff --git a/src/cloudflare/resources/intel/asn/subnets.py b/src/cloudflare/resources/intel/asn/subnets.py index 6e47fc5da93..4a7df70b55d 100644 --- a/src/cloudflare/resources/intel/asn/subnets.py +++ b/src/cloudflare/resources/intel/asn/subnets.py @@ -13,10 +13,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....types.intel import IntelASN from ...._base_client import ( make_request_options, ) +from ....types.shared import ASN from ....types.intel.asn import SubnetGetResponse __all__ = ["Subnets", "AsyncSubnets"] @@ -33,7 +33,7 @@ def with_streaming_response(self) -> SubnetsWithStreamingResponse: def get( self, - asn: IntelASN, + asn: ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -79,7 +79,7 @@ def with_streaming_response(self) -> AsyncSubnetsWithStreamingResponse: async def get( self, - asn: IntelASN, + asn: ASN, *, account_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 7e25cc5541f..c61c5c1b5e3 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .shared import ( + ASN as ASN, Role as Role, Member as Member, Result as Result, diff --git a/src/cloudflare/types/intel/__init__.py b/src/cloudflare/types/intel/__init__.py index cf0facbc1d0..4ad7dbe24f6 100644 --- a/src/cloudflare/types/intel/__init__.py +++ b/src/cloudflare/types/intel/__init__.py @@ -9,7 +9,6 @@ from .ip_list import IPList as IPList from .sinkhole import Sinkhole as Sinkhole from .dns_param import DNSParam as DNSParam -from .intel_asn import IntelASN as IntelASN from .ip_get_params import IPGetParams as IPGetParams from .domain_history import DomainHistory as DomainHistory from .dns_list_params import DNSListParams as DNSListParams diff --git a/src/cloudflare/types/intel/asn/subnet_get_response.py b/src/cloudflare/types/intel/asn/subnet_get_response.py index cb54964edf4..5a74b47cb11 100644 --- a/src/cloudflare/types/intel/asn/subnet_get_response.py +++ b/src/cloudflare/types/intel/asn/subnet_get_response.py @@ -2,14 +2,14 @@ from typing import List, Optional +from ...shared import ASN from ...._models import BaseModel -from ..intel_asn import IntelASN __all__ = ["SubnetGetResponse"] class SubnetGetResponse(BaseModel): - asn: Optional[IntelASN] = None + asn: Optional[ASN] = None count: Optional[float] = None """Total results returned based on your search parameters.""" diff --git a/src/cloudflare/types/shared/__init__.py b/src/cloudflare/types/shared/__init__.py index 5af47daa5ea..d6d57611926 100644 --- a/src/cloudflare/types/shared/__init__.py +++ b/src/cloudflare/types/shared/__init__.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .asn import ASN as ASN from .role import Role as Role from .member import Member as Member from .result import Result as Result diff --git a/src/cloudflare/types/intel/intel_asn.py b/src/cloudflare/types/shared/asn.py similarity index 70% rename from src/cloudflare/types/intel/intel_asn.py rename to src/cloudflare/types/shared/asn.py index dece910c602..429e7bf4301 100644 --- a/src/cloudflare/types/intel/intel_asn.py +++ b/src/cloudflare/types/shared/asn.py @@ -1,6 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -__all__ = ["IntelASN"] -IntelASN = int + +__all__ = ["ASN"] + +ASN = int diff --git a/src/cloudflare/types/shared_params/__init__.py b/src/cloudflare/types/shared_params/__init__.py index 30c7b6a3a09..9d75a6e1543 100644 --- a/src/cloudflare/types/shared_params/__init__.py +++ b/src/cloudflare/types/shared_params/__init__.py @@ -1,3 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .asn import ASN as ASN from .permission_grant import PermissionGrant as PermissionGrant diff --git a/src/cloudflare/types/shared_params/asn.py b/src/cloudflare/types/shared_params/asn.py new file mode 100644 index 00000000000..ade2d504bf0 --- /dev/null +++ b/src/cloudflare/types/shared_params/asn.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +__all__ = ["ASN"] + +ASN = int diff --git a/tests/api_resources/intel/test_asn.py b/tests/api_resources/intel/test_asn.py index 75191ec2eb7..125ac1e76c0 100644 --- a/tests/api_resources/intel/test_asn.py +++ b/tests/api_resources/intel/test_asn.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import IntelASN +from cloudflare.types.shared import ASN base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: 0, account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: 0, account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = await response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" asn = await response.parse() - assert_matches_type(IntelASN, asn, path=["response"]) + assert_matches_type(ASN, asn, path=["response"]) assert cast(Any, response.is_closed) is True