Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent 51159f5 commit 6bf76e3
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 48 deletions.
10 changes: 7 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1535,13 +1535,17 @@ Methods:
Types:

```python
from cloudflare.types.certificate_authorities import TLSHostnameAssociation
from cloudflare.types.certificate_authorities import (
TLSHostnameAssociation,
HostnameAssociationUpdateResponse,
HostnameAssociationGetResponse,
)
```

Methods:

- <code title="put /zones/{zone_id}/certificate_authorities/hostname_associations">client.certificate_authorities.hostname_associations.<a href="./src/cloudflare/resources/certificate_authorities/hostname_associations.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/certificate_authorities/hostname_association_update_params.py">params</a>) -> <a href="./src/cloudflare/types/certificate_authorities/tls_hostname_association.py">TLSHostnameAssociation</a></code>
- <code title="get /zones/{zone_id}/certificate_authorities/hostname_associations">client.certificate_authorities.hostname_associations.<a href="./src/cloudflare/resources/certificate_authorities/hostname_associations.py">get</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/certificate_authorities/hostname_association_get_params.py">params</a>) -> <a href="./src/cloudflare/types/certificate_authorities/tls_hostname_association.py">TLSHostnameAssociation</a></code>
- <code title="put /zones/{zone_id}/certificate_authorities/hostname_associations">client.certificate_authorities.hostname_associations.<a href="./src/cloudflare/resources/certificate_authorities/hostname_associations.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/certificate_authorities/hostname_association_update_params.py">params</a>) -> <a href="./src/cloudflare/types/certificate_authorities/hostname_association_update_response.py">HostnameAssociationUpdateResponse</a></code>
- <code title="get /zones/{zone_id}/certificate_authorities/hostname_associations">client.certificate_authorities.hostname_associations.<a href="./src/cloudflare/resources/certificate_authorities/hostname_associations.py">get</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/certificate_authorities/hostname_association_get_params.py">params</a>) -> <a href="./src/cloudflare/types/certificate_authorities/hostname_association_get_response.py">HostnameAssociationGetResponse</a></code>

# ClientCertificates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
make_request_options,
)
from ...types.certificate_authorities import (
TLSHostnameAssociation,
HostnameAssociationGetResponse,
HostnameAssociationUpdateResponse,
hostname_association_get_params,
hostname_association_update_params,
)
Expand Down Expand Up @@ -53,7 +54,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TLSHostnameAssociation:
) -> HostnameAssociationUpdateResponse:
"""
Replace Hostname Associations
Expand Down Expand Up @@ -90,7 +91,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]),
)

def get(
Expand All @@ -104,7 +105,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TLSHostnameAssociation:
) -> HostnameAssociationGetResponse:
"""
List Hostname Associations
Expand Down Expand Up @@ -138,7 +139,7 @@ def get(
),
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]),
)


Expand All @@ -163,7 +164,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TLSHostnameAssociation:
) -> HostnameAssociationUpdateResponse:
"""
Replace Hostname Associations
Expand Down Expand Up @@ -200,7 +201,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]),
)

async def get(
Expand All @@ -214,7 +215,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TLSHostnameAssociation:
) -> HostnameAssociationGetResponse:
"""
List Hostname Associations
Expand Down Expand Up @@ -248,7 +249,7 @@ async def get(
),
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]),
)


Expand Down
3 changes: 2 additions & 1 deletion src/cloudflare/types/certificate_authorities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from .tls_hostname_association import TLSHostnameAssociation as TLSHostnameAssociation
from .hostname_association_get_params import HostnameAssociationGetParams as HostnameAssociationGetParams
from .hostname_association_get_response import HostnameAssociationGetResponse as HostnameAssociationGetResponse
from .hostname_association_update_params import HostnameAssociationUpdateParams as HostnameAssociationUpdateParams
from .hostname_association_update_response import HostnameAssociationUpdateResponse as HostnameAssociationUpdateResponse
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional

from ..._models import BaseModel

__all__ = ["HostnameAssociationGetResponse"]


class HostnameAssociationGetResponse(BaseModel):
hostnames: Optional[List[str]] = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional

from ..._models import BaseModel

__all__ = ["HostnameAssociationUpdateResponse"]


class HostnameAssociationUpdateResponse(BaseModel):
hostnames: Optional[List[str]] = None

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.types.certificate_authorities import (
TLSHostnameAssociation,
HostnameAssociationGetResponse,
HostnameAssociationUpdateResponse,
)

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
Expand All @@ -25,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None:
hostname_association = client.certificate_authorities.hostname_associations.update(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -35,7 +36,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
hostnames=["api.example.com", "api.example.com", "api.example.com"],
mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -47,7 +48,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"
hostname_association = response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -59,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

hostname_association = response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -77,7 +78,7 @@ def test_method_get(self, client: Cloudflare) -> None:
hostname_association = client.certificate_authorities.hostname_associations.get(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -86,7 +87,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
mtls_certificate_id="b2134436-2555-4acf-be5b-26c48136575e",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -98,7 +99,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"
hostname_association = response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -110,7 +111,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

hostname_association = response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -132,7 +133,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
hostname_association = await async_client.certificate_authorities.hostname_associations.update(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -142,7 +143,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
hostnames=["api.example.com", "api.example.com", "api.example.com"],
mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -154,7 +155,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"
hostname_association = await response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -166,7 +167,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

hostname_association = await response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -184,7 +185,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
hostname_association = await async_client.certificate_authorities.hostname_associations.get(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -193,7 +194,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
mtls_certificate_id="b2134436-2555-4acf-be5b-26c48136575e",
)
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -205,7 +206,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"
hostname_association = await response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -217,7 +218,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

hostname_association = await response.parse()
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down

0 comments on commit 6bf76e3

Please sign in to comment.