From 9872fdfdedd7890d829755070a4b8617c275974a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:38:29 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#165) --- api.md | 2 +- .../pages/projects/deployments/deployments.py | 11 +++++++++- src/cloudflare/types/pages/pages_projects.py | 6 ++++++ .../types/pages/project_create_params.py | 6 ++++++ .../types/pages/projects/__init__.py | 1 + .../pages/projects/deployment_list_params.py | 15 ++++++++++++++ .../pages/projects/test_deployments.py | 20 +++++++++++++++++++ tests/api_resources/pages/test_projects.py | 4 ++++ 8 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 src/cloudflare/types/pages/projects/deployment_list_params.py diff --git a/api.md b/api.md index f33d822790b..162b12360f8 100644 --- a/api.md +++ b/api.md @@ -4026,7 +4026,7 @@ from cloudflare.types.pages.projects import DeploymentListResponse, DeploymentDe Methods: - client.pages.projects.deployments.create(project_name, \*, account_id, \*\*params) -> PagesDeployments -- client.pages.projects.deployments.list(project_name, \*, account_id) -> DeploymentListResponse +- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> DeploymentListResponse - client.pages.projects.deployments.delete(deployment_id, \*, account_id, project_name) -> object - client.pages.projects.deployments.get(deployment_id, \*, account_id, project_name) -> PagesDeployments - client.pages.projects.deployments.retry(deployment_id, \*, account_id, project_name) -> PagesDeployments diff --git a/src/cloudflare/resources/pages/projects/deployments/deployments.py b/src/cloudflare/resources/pages/projects/deployments/deployments.py index 578f1664d86..83cd0a1c3c4 100644 --- a/src/cloudflare/resources/pages/projects/deployments/deployments.py +++ b/src/cloudflare/resources/pages/projects/deployments/deployments.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Type, cast +from typing_extensions import Literal import httpx @@ -33,7 +34,7 @@ from ....._base_client import ( make_request_options, ) -from .....types.pages.projects import DeploymentListResponse, deployment_create_params +from .....types.pages.projects import DeploymentListResponse, deployment_list_params, deployment_create_params __all__ = ["Deployments", "AsyncDeployments"] @@ -107,6 +108,7 @@ def list( project_name: str, *, account_id: str, + env: Literal["production", "preview"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -122,6 +124,8 @@ def list( project_name: Name of the project. + env: What type of deployments to fetch. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -141,6 +145,7 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, + query=maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), post_parser=ResultWrapper._unwrapper, ), cast_to=cast(Type[DeploymentListResponse], ResultWrapper[DeploymentListResponse]), @@ -410,6 +415,7 @@ async def list( project_name: str, *, account_id: str, + env: Literal["production", "preview"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -425,6 +431,8 @@ async def list( project_name: Name of the project. + env: What type of deployments to fetch. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -444,6 +452,7 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, + query=await async_maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), post_parser=ResultWrapper._unwrapper, ), cast_to=cast(Type[DeploymentListResponse], ResultWrapper[DeploymentListResponse]), diff --git a/src/cloudflare/types/pages/pages_projects.py b/src/cloudflare/types/pages/pages_projects.py index 7242cd80935..bbdeb24b7e7 100644 --- a/src/cloudflare/types/pages/pages_projects.py +++ b/src/cloudflare/types/pages/pages_projects.py @@ -211,6 +211,9 @@ class DeploymentConfigsPreviewR2Buckets(BaseModel): class DeploymentConfigsPreviewServicesServiceBinding(BaseModel): + entrypoint: Optional[str] = None + """The entrypoint to bind to.""" + environment: Optional[str] = None """The Service environment.""" @@ -405,6 +408,9 @@ class DeploymentConfigsProductionR2Buckets(BaseModel): class DeploymentConfigsProductionServicesServiceBinding(BaseModel): + entrypoint: Optional[str] = None + """The entrypoint to bind to.""" + environment: Optional[str] = None """The Service environment.""" diff --git a/src/cloudflare/types/pages/project_create_params.py b/src/cloudflare/types/pages/project_create_params.py index bf5a0f825ca..2963483f662 100644 --- a/src/cloudflare/types/pages/project_create_params.py +++ b/src/cloudflare/types/pages/project_create_params.py @@ -228,6 +228,9 @@ class DeploymentConfigsPreviewR2Buckets(TypedDict, total=False): class DeploymentConfigsPreviewServicesServiceBinding(TypedDict, total=False): + entrypoint: Optional[str] + """The entrypoint to bind to.""" + environment: str """The Service environment.""" @@ -417,6 +420,9 @@ class DeploymentConfigsProductionR2Buckets(TypedDict, total=False): class DeploymentConfigsProductionServicesServiceBinding(TypedDict, total=False): + entrypoint: Optional[str] + """The entrypoint to bind to.""" + environment: str """The Service environment.""" diff --git a/src/cloudflare/types/pages/projects/__init__.py b/src/cloudflare/types/pages/projects/__init__.py index 08f92483ba0..92edb94f56f 100644 --- a/src/cloudflare/types/pages/projects/__init__.py +++ b/src/cloudflare/types/pages/projects/__init__.py @@ -6,6 +6,7 @@ from .domain_create_params import DomainCreateParams as DomainCreateParams from .domain_edit_response import DomainEditResponse as DomainEditResponse from .domain_list_response import DomainListResponse as DomainListResponse +from .deployment_list_params import DeploymentListParams as DeploymentListParams from .domain_create_response import DomainCreateResponse as DomainCreateResponse from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams from .deployment_list_response import DeploymentListResponse as DeploymentListResponse diff --git a/src/cloudflare/types/pages/projects/deployment_list_params.py b/src/cloudflare/types/pages/projects/deployment_list_params.py new file mode 100644 index 00000000000..5eec7e2468d --- /dev/null +++ b/src/cloudflare/types/pages/projects/deployment_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["DeploymentListParams"] + + +class DeploymentListParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + env: Literal["production", "preview"] + """What type of deployments to fetch.""" diff --git a/tests/api_resources/pages/projects/test_deployments.py b/tests/api_resources/pages/projects/test_deployments.py index d55b9e1feab..e883433ddd1 100644 --- a/tests/api_resources/pages/projects/test_deployments.py +++ b/tests/api_resources/pages/projects/test_deployments.py @@ -89,6 +89,16 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + deployment = client.pages.projects.deployments.list( + "this-is-my-project-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + env="preview", + ) + assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -463,6 +473,16 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + deployment = await async_client.pages.projects.deployments.list( + "this-is-my-project-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + env="preview", + ) + assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: diff --git a/tests/api_resources/pages/test_projects.py b/tests/api_resources/pages/test_projects.py index 742683668f9..1a4093fbd97 100644 --- a/tests/api_resources/pages/test_projects.py +++ b/tests/api_resources/pages/test_projects.py @@ -67,6 +67,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, "services": { "service_binding": { + "entrypoint": "MyHandler", "environment": "production", "service": "example-worker", } @@ -95,6 +96,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, "services": { "service_binding": { + "entrypoint": "MyHandler", "environment": "production", "service": "example-worker", } @@ -521,6 +523,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, "services": { "service_binding": { + "entrypoint": "MyHandler", "environment": "production", "service": "example-worker", } @@ -549,6 +552,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, "services": { "service_binding": { + "entrypoint": "MyHandler", "environment": "production", "service": "example-worker", }