From a812399abeb9254c32ff9a36a6b10d07e63578dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 03:07:13 +0000 Subject: [PATCH] feat(cloud_connector): define body param name --- .../resources/cloud_connector/rules.py | 12 ++++++------ .../types/cloud_connector/rule_update_params.py | 10 +++++----- .../api_resources/cloud_connector/test_rules.py | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/cloudflare/resources/cloud_connector/rules.py b/src/cloudflare/resources/cloud_connector/rules.py index 2a80d122319..d067255d0ee 100644 --- a/src/cloudflare/resources/cloud_connector/rules.py +++ b/src/cloudflare/resources/cloud_connector/rules.py @@ -53,7 +53,7 @@ def update( self, *, zone_id: str, - body: Iterable[rule_update_params.Body], + rules: Iterable[rule_update_params.Rule], # 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, @@ -67,7 +67,7 @@ def update( Args: zone_id: Identifier - body: List of Cloud Connector rules + rules: List of Cloud Connector rules extra_headers: Send extra headers @@ -81,7 +81,7 @@ def update( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return self._put( f"/zones/{zone_id}/cloud_connector/rules", - body=maybe_transform(body, Iterable[rule_update_params.Body]), + body=maybe_transform(rules, Iterable[rule_update_params.Rule]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -153,7 +153,7 @@ async def update( self, *, zone_id: str, - body: Iterable[rule_update_params.Body], + rules: Iterable[rule_update_params.Rule], # 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, @@ -167,7 +167,7 @@ async def update( Args: zone_id: Identifier - body: List of Cloud Connector rules + rules: List of Cloud Connector rules extra_headers: Send extra headers @@ -181,7 +181,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return await self._put( f"/zones/{zone_id}/cloud_connector/rules", - body=await async_maybe_transform(body, Iterable[rule_update_params.Body]), + body=await async_maybe_transform(rules, Iterable[rule_update_params.Rule]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/types/cloud_connector/rule_update_params.py b/src/cloudflare/types/cloud_connector/rule_update_params.py index f8c25c9b2a7..41d4e4aaa74 100644 --- a/src/cloudflare/types/cloud_connector/rule_update_params.py +++ b/src/cloudflare/types/cloud_connector/rule_update_params.py @@ -5,23 +5,23 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["RuleUpdateParams", "Body", "BodyParameters"] +__all__ = ["RuleUpdateParams", "Rule", "RuleParameters"] class RuleUpdateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - body: Required[Iterable[Body]] + rules: Required[Iterable[Rule]] """List of Cloud Connector rules""" -class BodyParameters(TypedDict, total=False): +class RuleParameters(TypedDict, total=False): host: str """Host to perform Cloud Connection to""" -class Body(TypedDict, total=False): +class Rule(TypedDict, total=False): id: str description: str @@ -30,7 +30,7 @@ class Body(TypedDict, total=False): expression: str - parameters: BodyParameters + parameters: RuleParameters """Parameters of Cloud Connector Rule""" provider: Literal["aws_s3", "r2", "gcp_storage", "azure_storage"] diff --git a/tests/api_resources/cloud_connector/test_rules.py b/tests/api_resources/cloud_connector/test_rules.py index 3516a2e2848..4c8dbcafd19 100644 --- a/tests/api_resources/cloud_connector/test_rules.py +++ b/tests/api_resources/cloud_connector/test_rules.py @@ -22,7 +22,7 @@ class TestRules: def test_method_update(self, client: Cloudflare) -> None: rule = client.cloud_connector.rules.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) @@ -30,7 +30,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.cloud_connector.rules.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert response.is_closed is True @@ -42,7 +42,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.cloud_connector.rules.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -57,7 +57,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.cloud_connector.rules.with_raw_response.update( zone_id="", - body=[{}], + rules=[{}], ) @parametrize @@ -106,7 +106,7 @@ class TestAsyncRules: async def test_method_update(self, async_client: AsyncCloudflare) -> None: rule = await async_client.cloud_connector.rules.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) @@ -114,7 +114,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.cloud_connector.rules.with_raw_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) assert response.is_closed is True @@ -126,7 +126,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.cloud_connector.rules.with_streaming_response.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", - body=[{}], + rules=[{}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -141,7 +141,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.cloud_connector.rules.with_raw_response.update( zone_id="", - body=[{}], + rules=[{}], ) @parametrize