Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent 5b9a07e commit 5a4d204
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 31 deletions.
9 changes: 2 additions & 7 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

```python
from cloudflare.types import (
ASN,
AuditLog,
CloudflareTunnel,
ErrorData,
Expand Down Expand Up @@ -3525,15 +3526,9 @@ Methods:

## ASN

Types:

```python
from cloudflare.types.intel import IntelASN
```

Methods:

- <code title="get /accounts/{account_id}/intel/asn/{asn}">client.intel.asn.<a href="./src/cloudflare/resources/intel/asn/asn.py">get</a>(asn, \*, account_id) -> <a href="./src/cloudflare/types/intel/intel_asn.py">IntelASN</a></code>
- <code title="get /accounts/{account_id}/intel/asn/{asn}">client.intel.asn.<a href="./src/cloudflare/resources/intel/asn/asn.py">get</a>(asn, \*, account_id) -> <a href="./src/cloudflare/types/shared/asn.py">ASN</a></code>

### Subnets

Expand Down
18 changes: 9 additions & 9 deletions src/cloudflare/resources/intel/asn/asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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]),
)


Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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]),
)


Expand Down
6 changes: 3 additions & 3 deletions src/cloudflare/resources/intel/asn/subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from .shared import (
ASN as ASN,
Role as Role,
Member as Member,
Result as Result,
Expand Down
1 change: 0 additions & 1 deletion src/cloudflare/types/intel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cloudflare/types/intel/asn/subnet_get_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/shared/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/cloudflare/types/shared_params/__init__.py
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions src/cloudflare/types/shared_params/asn.py
Original file line number Diff line number Diff line change
@@ -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
14 changes: 7 additions & 7 deletions tests/api_resources/intel/test_asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 5a4d204

Please sign in to comment.