Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(list_item): remove duplicated anyOf properties from component #2342

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
52 changes: 21 additions & 31 deletions src/cloudflare/resources/rules/lists/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, Type, Iterable, cast
from typing import Type, Iterable, cast

import httpx

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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]),
)


Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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]),
)


Expand Down
51 changes: 4 additions & 47 deletions src/cloudflare/types/rules/lists/item_get_response.py
Original file line number Diff line number Diff line change
@@ -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."""

Expand Down Expand Up @@ -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]
51 changes: 4 additions & 47 deletions src/cloudflare/types/rules/lists/item_list_response.py
Original file line number Diff line number Diff line change
@@ -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."""

Expand Down Expand Up @@ -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]