Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Mar 22, 2024
1 parent 5b67169 commit 1088dac
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4026,7 +4026,7 @@ from cloudflare.types.pages.projects import DeploymentListResponse, DeploymentDe
Methods:

- <code title="post /accounts/{account_id}/pages/projects/{project_name}/deployments">client.pages.projects.deployments.<a href="./src/cloudflare/resources/pages/projects/deployments/deployments.py">create</a>(project_name, \*, account_id, \*\*<a href="src/cloudflare/types/pages/projects/deployment_create_params.py">params</a>) -> <a href="./src/cloudflare/types/pages/pages_deployments.py">PagesDeployments</a></code>
- <code title="get /accounts/{account_id}/pages/projects/{project_name}/deployments">client.pages.projects.deployments.<a href="./src/cloudflare/resources/pages/projects/deployments/deployments.py">list</a>(project_name, \*, account_id) -> <a href="./src/cloudflare/types/pages/projects/deployment_list_response.py">DeploymentListResponse</a></code>
- <code title="get /accounts/{account_id}/pages/projects/{project_name}/deployments">client.pages.projects.deployments.<a href="./src/cloudflare/resources/pages/projects/deployments/deployments.py">list</a>(project_name, \*, account_id, \*\*<a href="src/cloudflare/types/pages/projects/deployment_list_params.py">params</a>) -> <a href="./src/cloudflare/types/pages/projects/deployment_list_response.py">DeploymentListResponse</a></code>
- <code title="delete /accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}">client.pages.projects.deployments.<a href="./src/cloudflare/resources/pages/projects/deployments/deployments.py">delete</a>(deployment_id, \*, account_id, project_name) -> <a href="./src/cloudflare/types/pages/projects/deployment_delete_response.py">object</a></code>
- <code title="get /accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}">client.pages.projects.deployments.<a href="./src/cloudflare/resources/pages/projects/deployments/deployments.py">get</a>(deployment_id, \*, account_id, project_name) -> <a href="./src/cloudflare/types/pages/pages_deployments.py">PagesDeployments</a></code>
- <code title="post /accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/retry">client.pages.projects.deployments.<a href="./src/cloudflare/resources/pages/projects/deployments/deployments.py">retry</a>(deployment_id, \*, account_id, project_name) -> <a href="./src/cloudflare/types/pages/pages_deployments.py">PagesDeployments</a></code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from typing import Type, cast
from typing_extensions import Literal

import httpx

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

Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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]),
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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]),
Expand Down
6 changes: 6 additions & 0 deletions src/cloudflare/types/pages/pages_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

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

Expand Down
6 changes: 6 additions & 0 deletions src/cloudflare/types/pages/project_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

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

Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/pages/projects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions src/cloudflare/types/pages/projects/deployment_list_params.py
Original file line number Diff line number Diff line change
@@ -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."""
20 changes: 20 additions & 0 deletions tests/api_resources/pages/projects/test_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/pages/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down Expand Up @@ -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",
}
Expand Down Expand Up @@ -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",
}
Expand Down Expand Up @@ -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",
}
Expand Down

0 comments on commit 1088dac

Please sign in to comment.