diff --git a/.stats.yml b/.stats.yml index 6f25ceda630..16a424f6b23 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1490 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6eed6659daa87db188a6095d59dbc3f6a84c1f63ca4e1b958283301d61cb16e5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-403275b7baabda647cf36b6e08211b6ea4aa63c6b547124bbc0eb377330f623a.yml diff --git a/src/cloudflare/resources/rules/lists/items.py b/src/cloudflare/resources/rules/lists/items.py index dbe7c34c9b9..6245c7c21ce 100644 --- a/src/cloudflare/resources/rules/lists/items.py +++ b/src/cloudflare/resources/rules/lists/items.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, cast +from typing import Type, Iterable, cast import httpx @@ -219,7 +219,7 @@ def list( item_list_params.ItemListParams, ), ), - model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system + model=ItemListResponse, ) def delete( @@ -308,21 +308,16 @@ def get( raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") if not item_id: raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return cast( - ItemGetResponse, - self._get( - f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ItemGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ItemGetResponse]._unwrapper, ), + cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), ) @@ -513,7 +508,7 @@ def list( item_list_params.ItemListParams, ), ), - model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system + model=ItemListResponse, ) async def delete( @@ -602,21 +597,16 @@ async def get( raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") if not item_id: raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return cast( - ItemGetResponse, - await self._get( - f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ItemGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ItemGetResponse]._unwrapper, ), + cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), ) diff --git a/src/cloudflare/types/rules/lists/item_get_response.py b/src/cloudflare/types/rules/lists/item_get_response.py index 7ed243ab3ae..7293cef70a3 100644 --- a/src/cloudflare/types/rules/lists/item_get_response.py +++ b/src/cloudflare/types/rules/lists/item_get_response.py @@ -1,19 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional from ..hostname import Hostname from ..redirect import Redirect +from ...._models import BaseModel -__all__ = ["ItemGetResponse", "UnionMember0", "RulesListsRedirect", "RulesListsHostname", "UnionMember3"] +__all__ = ["ItemGetResponse"] -class UnionMember0: - pass - - -class RulesListsRedirect(Redirect): +class ItemGetResponse(BaseModel): id: Optional[str] = None """The unique ID of the list.""" @@ -43,42 +39,3 @@ class RulesListsRedirect(Redirect): redirect: Optional[Redirect] = None """The definition of the redirect.""" - - -class RulesListsHostname(Hostname): - id: Optional[str] = None - """The unique ID of the list.""" - - asn: Optional[int] = None - """A non-negative 32 bit integer""" - - comment: Optional[str] = None - """An informative summary of the list item.""" - - created_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was created.""" - - hostname: Optional[Hostname] = None - """ - Valid characters for hostnames are ASCII(7) letters from a to z, the digits from - 0 to 9, wildcards (\\**), and the hyphen (-). - """ - - ip: Optional[str] = None - """An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. - - IPv6 CIDRs are limited to a maximum of /64. - """ - - modified_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was last modified.""" - - redirect: Optional[Redirect] = None - """The definition of the redirect.""" - - -class UnionMember3: - pass - - -ItemGetResponse: TypeAlias = Union[UnionMember0, RulesListsRedirect, RulesListsHostname, UnionMember3] diff --git a/src/cloudflare/types/rules/lists/item_list_response.py b/src/cloudflare/types/rules/lists/item_list_response.py index 21703540fd6..233b99f1da7 100644 --- a/src/cloudflare/types/rules/lists/item_list_response.py +++ b/src/cloudflare/types/rules/lists/item_list_response.py @@ -1,19 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional from ..hostname import Hostname from ..redirect import Redirect +from ...._models import BaseModel -__all__ = ["ItemListResponse", "UnionMember0", "RulesListsRedirect", "RulesListsHostname", "UnionMember3"] +__all__ = ["ItemListResponse"] -class UnionMember0: - pass - - -class RulesListsRedirect(Redirect): +class ItemListResponse(BaseModel): id: Optional[str] = None """The unique ID of the list.""" @@ -43,42 +39,3 @@ class RulesListsRedirect(Redirect): redirect: Optional[Redirect] = None """The definition of the redirect.""" - - -class RulesListsHostname(Hostname): - id: Optional[str] = None - """The unique ID of the list.""" - - asn: Optional[int] = None - """A non-negative 32 bit integer""" - - comment: Optional[str] = None - """An informative summary of the list item.""" - - created_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was created.""" - - hostname: Optional[Hostname] = None - """ - Valid characters for hostnames are ASCII(7) letters from a to z, the digits from - 0 to 9, wildcards (\\**), and the hyphen (-). - """ - - ip: Optional[str] = None - """An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. - - IPv6 CIDRs are limited to a maximum of /64. - """ - - modified_on: Optional[str] = None - """The RFC 3339 timestamp of when the item was last modified.""" - - redirect: Optional[Redirect] = None - """The definition of the redirect.""" - - -class UnionMember3: - pass - - -ItemListResponse: TypeAlias = Union[UnionMember0, RulesListsRedirect, RulesListsHostname, UnionMember3]