From e2478c520118901aa7bba9c99c3a9f8b7ba963b7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:01:37 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#279) --- api.md | 4 ++-- .../cloudforce_one/requests/requests.py | 16 ++++++++-------- .../types/cloudforce_one/__init__.py | 2 +- .../cloudforce_one/{list.py => list_item.py} | 6 +++--- src/cloudflare/types/rules/lists/__init__.py | 1 + src/cloudflare/types/rules/lists/list_item.py | 12 ++++++++++++ .../cloudforce_one/test_requests.py | 18 +++++++++--------- 7 files changed, 36 insertions(+), 23 deletions(-) rename src/cloudflare/types/cloudforce_one/{list.py => list_item.py} (93%) create mode 100644 src/cloudflare/types/rules/lists/list_item.py diff --git a/api.md b/api.md index d32be78a0d9..e40255dcac4 100644 --- a/api.md +++ b/api.md @@ -7221,7 +7221,7 @@ Types: ```python from cloudflare.types.cloudforce_one import ( Item, - List, + ListItem, Quota, RequestConstants, RequestTypes, @@ -7233,7 +7233,7 @@ Methods: - client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Item - client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Item -- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[List] +- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[ListItem] - client.cloudforce_one.requests.delete(request_identifier, \*, account_identifier) -> RequestDeleteResponse - client.cloudforce_one.requests.constants(account_identifier) -> RequestConstants - client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Item diff --git a/src/cloudflare/resources/cloudforce_one/requests/requests.py b/src/cloudflare/resources/cloudforce_one/requests/requests.py index 57a6d479fcd..24c4d97b9d3 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/requests.py +++ b/src/cloudflare/resources/cloudforce_one/requests/requests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Union, cast +from typing import Any, Type, Union, cast from datetime import datetime from typing_extensions import Literal @@ -45,8 +45,8 @@ ) from ....types.cloudforce_one import ( Item, - List, Quota, + ListItem, RequestTypes, RequestConstants, RequestDeleteResponse, @@ -233,7 +233,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[List]: + ) -> SyncV4PagePaginationArray[ListItem]: """ List Requests @@ -272,7 +272,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/cloudforce-one/requests", - page=SyncV4PagePaginationArray[List], + page=SyncV4PagePaginationArray[ListItem], body=maybe_transform( { "page": page, @@ -291,7 +291,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=List, + model=ListItem, method="post", ) @@ -681,7 +681,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[List, AsyncV4PagePaginationArray[List]]: + ) -> AsyncPaginator[ListItem, AsyncV4PagePaginationArray[ListItem]]: """ List Requests @@ -720,7 +720,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") return self._get_api_list( f"/accounts/{account_identifier}/cloudforce-one/requests", - page=AsyncV4PagePaginationArray[List], + page=AsyncV4PagePaginationArray[ListItem], body=maybe_transform( { "page": page, @@ -739,7 +739,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=List, + model=ListItem, method="post", ) diff --git a/src/cloudflare/types/cloudforce_one/__init__.py b/src/cloudflare/types/cloudforce_one/__init__.py index e6480808e34..f069202d49b 100644 --- a/src/cloudflare/types/cloudforce_one/__init__.py +++ b/src/cloudflare/types/cloudforce_one/__init__.py @@ -3,8 +3,8 @@ from __future__ import annotations from .item import Item as Item -from .list import List as List from .quota import Quota as Quota +from .list_item import ListItem as ListItem from .request_types import RequestTypes as RequestTypes from .request_constants import RequestConstants as RequestConstants from .request_list_params import RequestListParams as RequestListParams diff --git a/src/cloudflare/types/cloudforce_one/list.py b/src/cloudflare/types/cloudforce_one/list_item.py similarity index 93% rename from src/cloudflare/types/cloudforce_one/list.py rename to src/cloudflare/types/cloudforce_one/list_item.py index b4ef3feaf7c..99703584af8 100644 --- a/src/cloudflare/types/cloudforce_one/list.py +++ b/src/cloudflare/types/cloudforce_one/list_item.py @@ -1,15 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["List"] +__all__ = ["ListItem"] -class List(BaseModel): +class ListItem(BaseModel): id: str """UUID""" diff --git a/src/cloudflare/types/rules/lists/__init__.py b/src/cloudflare/types/rules/lists/__init__.py index 0124438ea28..67f205f1c01 100644 --- a/src/cloudflare/types/rules/lists/__init__.py +++ b/src/cloudflare/types/rules/lists/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .list_item import ListItem as ListItem from .list_cursor import ListCursor as ListCursor from .item_list_params import ItemListParams as ItemListParams from .operation_status import OperationStatus as OperationStatus diff --git a/src/cloudflare/types/rules/lists/list_item.py b/src/cloudflare/types/rules/lists/list_item.py new file mode 100644 index 00000000000..3f97e10948a --- /dev/null +++ b/src/cloudflare/types/rules/lists/list_item.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["ListItem"] + + +class ListItem(BaseModel): + operation_id: Optional[str] = None + """The unique operation ID of the asynchronous action.""" diff --git a/tests/api_resources/cloudforce_one/test_requests.py b/tests/api_resources/cloudforce_one/test_requests.py index 0fc716ae7e9..ef62fc92095 100644 --- a/tests/api_resources/cloudforce_one/test_requests.py +++ b/tests/api_resources/cloudforce_one/test_requests.py @@ -13,8 +13,8 @@ from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.cloudforce_one import ( Item, - List, Quota, + ListItem, RequestTypes, RequestConstants, RequestDeleteResponse, @@ -155,7 +155,7 @@ def test_method_list(self, client: Cloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(SyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: sort_order="asc", status="open", ) - assert_matches_type(SyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +187,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" request = response.parse() - assert_matches_type(SyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +201,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(SyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[ListItem], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -578,7 +578,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(AsyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -596,7 +596,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) sort_order="asc", status="open", ) - assert_matches_type(AsyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -610,7 +610,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" request = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) @pytest.mark.skip() @parametrize @@ -624,7 +624,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[List], request, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[ListItem], request, path=["response"]) assert cast(Any, response.is_closed) is True