diff --git a/api.md b/api.md index 8e67d9176c6d..f7c74ba11520 100644 --- a/api.md +++ b/api.md @@ -4178,16 +4178,16 @@ Methods: Types: ```python -from cloudflare.types.rules import Hostname, Redirect, RuleList, ListDeleteResponse +from cloudflare.types.rules import Hostname, ListsList, Redirect, ListDeleteResponse ``` Methods: -- client.rules.lists.create(\*, account_id, \*\*params) -> Optional -- client.rules.lists.update(list_id, \*, account_id, \*\*params) -> Optional -- client.rules.lists.list(\*, account_id) -> SyncSinglePage[RuleList] +- client.rules.lists.create(\*, account_id, \*\*params) -> Optional +- client.rules.lists.update(list_id, \*, account_id, \*\*params) -> Optional +- client.rules.lists.list(\*, account_id) -> SyncSinglePage[ListsList] - client.rules.lists.delete(list_id, \*, account_id, \*\*params) -> Optional -- client.rules.lists.get(list_id, \*, account_id) -> Optional +- client.rules.lists.get(list_id, \*, account_id) -> Optional ### BulkOperations diff --git a/src/cloudflare/resources/rules/lists/lists.py b/src/cloudflare/resources/rules/lists/lists.py index 66838e9460ea..01f7d92962f2 100644 --- a/src/cloudflare/resources/rules/lists/lists.py +++ b/src/cloudflare/resources/rules/lists/lists.py @@ -30,7 +30,7 @@ ) from ...._wrappers import ResultWrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ....types.rules import RuleList, ListDeleteResponse, list_create_params, list_delete_params, list_update_params +from ....types.rules import ListsList, ListDeleteResponse, list_create_params, list_delete_params, list_update_params from ...._base_client import ( AsyncPaginator, make_request_options, @@ -77,7 +77,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleList]: + ) -> Optional[ListsList]: """ Creates a new list of the specified type. @@ -118,7 +118,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[RuleList]], ResultWrapper[RuleList]), + cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) def update( @@ -133,7 +133,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleList]: + ) -> Optional[ListsList]: """ Updates the description of a list. @@ -166,7 +166,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[RuleList]], ResultWrapper[RuleList]), + cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) def list( @@ -179,7 +179,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[RuleList]: + ) -> SyncSinglePage[ListsList]: """ Fetches all lists in the account. @@ -198,11 +198,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/rules/lists", - page=SyncSinglePage[RuleList], + page=SyncSinglePage[ListsList], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RuleList, + model=ListsList, ) def delete( @@ -262,7 +262,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleList]: + ) -> Optional[ListsList]: """ Fetches the details of a list. @@ -292,7 +292,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[RuleList]], ResultWrapper[RuleList]), + cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) @@ -326,7 +326,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleList]: + ) -> Optional[ListsList]: """ Creates a new list of the specified type. @@ -367,7 +367,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[RuleList]], ResultWrapper[RuleList]), + cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) async def update( @@ -382,7 +382,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleList]: + ) -> Optional[ListsList]: """ Updates the description of a list. @@ -415,7 +415,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[RuleList]], ResultWrapper[RuleList]), + cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) def list( @@ -428,7 +428,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RuleList, AsyncSinglePage[RuleList]]: + ) -> AsyncPaginator[ListsList, AsyncSinglePage[ListsList]]: """ Fetches all lists in the account. @@ -447,11 +447,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/rules/lists", - page=AsyncSinglePage[RuleList], + page=AsyncSinglePage[ListsList], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=RuleList, + model=ListsList, ) async def delete( @@ -511,7 +511,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleList]: + ) -> Optional[ListsList]: """ Fetches the details of a list. @@ -541,7 +541,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[RuleList]], ResultWrapper[RuleList]), + cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) diff --git a/src/cloudflare/types/rules/__init__.py b/src/cloudflare/types/rules/__init__.py index 00341b404f2a..24f42f87715b 100644 --- a/src/cloudflare/types/rules/__init__.py +++ b/src/cloudflare/types/rules/__init__.py @@ -4,7 +4,7 @@ from .hostname import Hostname as Hostname from .redirect import Redirect as Redirect -from .rule_list import RuleList as RuleList +from .lists_list import ListsList as ListsList from .hostname_param import HostnameParam as HostnameParam from .redirect_param import RedirectParam as RedirectParam from .list_create_params import ListCreateParams as ListCreateParams diff --git a/src/cloudflare/types/rules/rule_list.py b/src/cloudflare/types/rules/lists_list.py similarity index 95% rename from src/cloudflare/types/rules/rule_list.py rename to src/cloudflare/types/rules/lists_list.py index 8c2b3e5e13c8..17255b5fa7d0 100644 --- a/src/cloudflare/types/rules/rule_list.py +++ b/src/cloudflare/types/rules/lists_list.py @@ -5,10 +5,10 @@ from ..._models import BaseModel -__all__ = ["RuleList"] +__all__ = ["ListsList"] -class RuleList(BaseModel): +class ListsList(BaseModel): id: Optional[str] = None """The unique ID of the list.""" diff --git a/tests/api_resources/rules/test_lists.py b/tests/api_resources/rules/test_lists.py index 6d24dbac2668..c63a54d2fa18 100644 --- a/tests/api_resources/rules/test_lists.py +++ b/tests/api_resources/rules/test_lists.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.rules import ( - RuleList, + ListsList, ListDeleteResponse, ) @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: kind="ip", name="list1", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +40,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="list1", description="This is a note", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -89,7 +89,7 @@ def test_method_update(self, client: Cloudflare) -> None: "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is a note", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -125,7 +125,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -150,7 +150,7 @@ def test_method_list(self, client: Cloudflare) -> None: list = client.rules.lists.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[RuleList], list, path=["response"]) + assert_matches_type(SyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +162,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(SyncSinglePage[RuleList], list, path=["response"]) + assert_matches_type(SyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(SyncSinglePage[RuleList], list, path=["response"]) + assert_matches_type(SyncSinglePage[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -250,7 +250,7 @@ def test_method_get(self, client: Cloudflare) -> None: "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +263,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" list = response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +276,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -307,7 +307,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: kind="ip", name="list1", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -318,7 +318,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="list1", description="This is a note", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -332,7 +332,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -346,7 +346,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -367,7 +367,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -377,7 +377,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", description="This is a note", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -390,7 +390,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -403,7 +403,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -428,7 +428,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: list = await async_client.rules.lists.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[RuleList], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -440,7 +440,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(AsyncSinglePage[RuleList], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -452,7 +452,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(AsyncSinglePage[RuleList], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -528,7 +528,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -541,7 +541,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" list = await response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -554,7 +554,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[RuleList], list, path=["response"]) + assert_matches_type(Optional[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True