Skip to content

Commit 6bf76e3

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#215)
1 parent 51159f5 commit 6bf76e3

File tree

7 files changed

+59
-48
lines changed

7 files changed

+59
-48
lines changed

api.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1535,13 +1535,17 @@ Methods:
15351535
Types:
15361536

15371537
```python
1538-
from cloudflare.types.certificate_authorities import TLSHostnameAssociation
1538+
from cloudflare.types.certificate_authorities import (
1539+
TLSHostnameAssociation,
1540+
HostnameAssociationUpdateResponse,
1541+
HostnameAssociationGetResponse,
1542+
)
15391543
```
15401544

15411545
Methods:
15421546

1543-
- <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>
1544-
- <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>
1547+
- <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>
1548+
- <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>
15451549

15461550
# ClientCertificates
15471551

src/cloudflare/resources/certificate_authorities/hostname_associations.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
make_request_options,
2525
)
2626
from ...types.certificate_authorities import (
27-
TLSHostnameAssociation,
27+
HostnameAssociationGetResponse,
28+
HostnameAssociationUpdateResponse,
2829
hostname_association_get_params,
2930
hostname_association_update_params,
3031
)
@@ -53,7 +54,7 @@ def update(
5354
extra_query: Query | None = None,
5455
extra_body: Body | None = None,
5556
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
56-
) -> TLSHostnameAssociation:
57+
) -> HostnameAssociationUpdateResponse:
5758
"""
5859
Replace Hostname Associations
5960
@@ -90,7 +91,7 @@ def update(
9091
timeout=timeout,
9192
post_parser=ResultWrapper._unwrapper,
9293
),
93-
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
94+
cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]),
9495
)
9596

9697
def get(
@@ -104,7 +105,7 @@ def get(
104105
extra_query: Query | None = None,
105106
extra_body: Body | None = None,
106107
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
107-
) -> TLSHostnameAssociation:
108+
) -> HostnameAssociationGetResponse:
108109
"""
109110
List Hostname Associations
110111
@@ -138,7 +139,7 @@ def get(
138139
),
139140
post_parser=ResultWrapper._unwrapper,
140141
),
141-
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
142+
cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]),
142143
)
143144

144145

@@ -163,7 +164,7 @@ async def update(
163164
extra_query: Query | None = None,
164165
extra_body: Body | None = None,
165166
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
166-
) -> TLSHostnameAssociation:
167+
) -> HostnameAssociationUpdateResponse:
167168
"""
168169
Replace Hostname Associations
169170
@@ -200,7 +201,7 @@ async def update(
200201
timeout=timeout,
201202
post_parser=ResultWrapper._unwrapper,
202203
),
203-
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
204+
cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]),
204205
)
205206

206207
async def get(
@@ -214,7 +215,7 @@ async def get(
214215
extra_query: Query | None = None,
215216
extra_body: Body | None = None,
216217
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
217-
) -> TLSHostnameAssociation:
218+
) -> HostnameAssociationGetResponse:
218219
"""
219220
List Hostname Associations
220221
@@ -248,7 +249,7 @@ async def get(
248249
),
249250
post_parser=ResultWrapper._unwrapper,
250251
),
251-
cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]),
252+
cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]),
252253
)
253254

254255

src/cloudflare/types/certificate_authorities/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5-
from .tls_hostname_association import TLSHostnameAssociation as TLSHostnameAssociation
65
from .hostname_association_get_params import HostnameAssociationGetParams as HostnameAssociationGetParams
6+
from .hostname_association_get_response import HostnameAssociationGetResponse as HostnameAssociationGetResponse
77
from .hostname_association_update_params import HostnameAssociationUpdateParams as HostnameAssociationUpdateParams
8+
from .hostname_association_update_response import HostnameAssociationUpdateResponse as HostnameAssociationUpdateResponse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from ..._models import BaseModel
6+
7+
__all__ = ["HostnameAssociationGetResponse"]
8+
9+
10+
class HostnameAssociationGetResponse(BaseModel):
11+
hostnames: Optional[List[str]] = None
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from ..._models import BaseModel
6+
7+
__all__ = ["HostnameAssociationUpdateResponse"]
8+
9+
10+
class HostnameAssociationUpdateResponse(BaseModel):
11+
hostnames: Optional[List[str]] = None

src/cloudflare/types/certificate_authorities/tls_hostname_association.py

-18
This file was deleted.

tests/api_resources/certificate_authorities/test_hostname_associations.py

+18-17
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from cloudflare import Cloudflare, AsyncCloudflare
1111
from tests.utils import assert_matches_type
1212
from cloudflare.types.certificate_authorities import (
13-
TLSHostnameAssociation,
13+
HostnameAssociationGetResponse,
14+
HostnameAssociationUpdateResponse,
1415
)
1516

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

3031
@pytest.mark.skip()
3132
@parametrize
@@ -35,7 +36,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
3536
hostnames=["api.example.com", "api.example.com", "api.example.com"],
3637
mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
3738
)
38-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
39+
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])
3940

4041
@pytest.mark.skip()
4142
@parametrize
@@ -47,7 +48,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
4748
assert response.is_closed is True
4849
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4950
hostname_association = response.parse()
50-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
51+
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])
5152

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

6162
hostname_association = response.parse()
62-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
63+
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])
6364

6465
assert cast(Any, response.is_closed) is True
6566

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

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

9192
@pytest.mark.skip()
9293
@parametrize
@@ -98,7 +99,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
9899
assert response.is_closed is True
99100
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
100101
hostname_association = response.parse()
101-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
102+
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])
102103

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

112113
hostname_association = response.parse()
113-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
114+
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])
114115

115116
assert cast(Any, response.is_closed) is True
116117

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

137138
@pytest.mark.skip()
138139
@parametrize
@@ -142,7 +143,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
142143
hostnames=["api.example.com", "api.example.com", "api.example.com"],
143144
mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
144145
)
145-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
146+
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])
146147

147148
@pytest.mark.skip()
148149
@parametrize
@@ -154,7 +155,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
154155
assert response.is_closed is True
155156
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
156157
hostname_association = await response.parse()
157-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
158+
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])
158159

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

168169
hostname_association = await response.parse()
169-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
170+
assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"])
170171

171172
assert cast(Any, response.is_closed) is True
172173

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

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

198199
@pytest.mark.skip()
199200
@parametrize
@@ -205,7 +206,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
205206
assert response.is_closed is True
206207
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
207208
hostname_association = await response.parse()
208-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
209+
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])
209210

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

219220
hostname_association = await response.parse()
220-
assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"])
221+
assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"])
221222

222223
assert cast(Any, response.is_closed) is True
223224

0 commit comments

Comments
 (0)