From c93a17c1495c70be5caf34835bcde084493dd538 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Wed, 20 Nov 2024 11:22:58 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- api.md | 2 +- .../resources/workflows/versions.py | 10 ++--- .../types/workflows/version_list_response.py | 40 +------------------ .../api_resources/workflows/test_versions.py | 18 ++++----- 5 files changed, 18 insertions(+), 54 deletions(-) diff --git a/.stats.yml b/.stats.yml index a5a069377cc..fe9cf8c05e1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1449 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-829ade7062fed63a30accc2a5e1a14c6c26fd4dc003d300d1b25a5416b8b8727.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-47eb882cbdc1acad6371a1827ff0a63b642a7b9a7a61049445cc4c2c4e7b9397.yml diff --git a/api.md b/api.md index 634519b98ce..c267bd58c10 100644 --- a/api.md +++ b/api.md @@ -8273,7 +8273,7 @@ from cloudflare.types.workflows import VersionListResponse, VersionGetResponse Methods: -- client.workflows.versions.list(workflow_name, \*, account_id, \*\*params) -> SyncV4PagePagination[VersionListResponse] +- client.workflows.versions.list(workflow_name, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[VersionListResponse] - client.workflows.versions.get(version_id, \*, account_id, workflow_name) -> VersionGetResponse # ResourceSharing diff --git a/src/cloudflare/resources/workflows/versions.py b/src/cloudflare/resources/workflows/versions.py index 6ece766749d..a4e4b518df5 100644 --- a/src/cloudflare/resources/workflows/versions.py +++ b/src/cloudflare/resources/workflows/versions.py @@ -17,7 +17,7 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...pagination import SyncV4PagePagination, AsyncV4PagePagination +from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ..._base_client import AsyncPaginator, make_request_options from ...types.workflows import version_list_params from ...types.workflows.version_get_response import VersionGetResponse @@ -59,7 +59,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePagination[VersionListResponse]: + ) -> SyncV4PagePaginationArray[VersionListResponse]: """ List deployed Workflow versions @@ -78,7 +78,7 @@ def list( raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}") return self._get_api_list( f"/accounts/{account_id}/workflows/{workflow_name}/versions", - page=SyncV4PagePagination[VersionListResponse], + page=SyncV4PagePaginationArray[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -172,7 +172,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[VersionListResponse, AsyncV4PagePagination[VersionListResponse]]: + ) -> AsyncPaginator[VersionListResponse, AsyncV4PagePaginationArray[VersionListResponse]]: """ List deployed Workflow versions @@ -191,7 +191,7 @@ def list( raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}") return self._get_api_list( f"/accounts/{account_id}/workflows/{workflow_name}/versions", - page=AsyncV4PagePagination[VersionListResponse], + page=AsyncV4PagePaginationArray[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/types/workflows/version_list_response.py b/src/cloudflare/types/workflows/version_list_response.py index 42e13bd672c..573299922a3 100644 --- a/src/cloudflare/types/workflows/version_list_response.py +++ b/src/cloudflare/types/workflows/version_list_response.py @@ -1,27 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["VersionListResponse", "Error", "Message", "Result", "ResultInfo"] +__all__ = ["VersionListResponse"] -class Error(BaseModel): - code: float - - message: str - - -class Message(BaseModel): - code: float - - message: str - - -class Result(BaseModel): +class VersionListResponse(BaseModel): id: str class_name: str @@ -31,25 +17,3 @@ class Result(BaseModel): modified_on: datetime workflow_id: str - - -class ResultInfo(BaseModel): - count: float - - page: float - - per_page: float - - total_count: float - - -class VersionListResponse(BaseModel): - errors: List[Error] - - messages: List[Message] - - result: Result - - success: Literal[True] - - result_info: Optional[ResultInfo] = None diff --git a/tests/api_resources/workflows/test_versions.py b/tests/api_resources/workflows/test_versions.py index b5342f776aa..46b2c9f5466 100644 --- a/tests/api_resources/workflows/test_versions.py +++ b/tests/api_resources/workflows/test_versions.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.workflows import VersionGetResponse, VersionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: workflow_name="x", account_id="account_id", ) - assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -34,7 +34,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: page=1, per_page=1, ) - assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -46,7 +46,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" version = response.parse() - assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -58,7 +58,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -146,7 +146,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: workflow_name="x", account_id="account_id", ) - assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -156,7 +156,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) page=1, per_page=1, ) - assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -168,7 +168,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" version = await response.parse() - assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -180,7 +180,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True