From e041cf1c3c728455c438ce5cd5e6a629ac8c9a22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 03:01:57 +0000 Subject: [PATCH] fix: improve names for conflicting params --- api.md | 2 +- src/asktable/resources/extapis/routes.py | 24 +++++----- .../types/extapis/route_create_params.py | 2 +- tests/api_resources/extapis/test_routes.py | 44 +++++++++---------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/api.md b/api.md index bd1402c7..40b6f666 100644 --- a/api.md +++ b/api.md @@ -237,7 +237,7 @@ from asktable.types.extapis import ExtapiRoute, RouteListResponse Methods: -- client.extapis.routes.create(extapi_id_1, \*\*params) -> ExtapiRoute +- client.extapis.routes.create(path_extapi_id, \*\*params) -> ExtapiRoute - client.extapis.routes.retrieve(route_id, \*, extapi_id) -> ExtapiRoute - client.extapis.routes.update(route_id, \*, extapi_id, \*\*params) -> ExtapiRoute - client.extapis.routes.list(extapi_id) -> RouteListResponse diff --git a/src/asktable/resources/extapis/routes.py b/src/asktable/resources/extapis/routes.py index d455577b..edc4574a 100644 --- a/src/asktable/resources/extapis/routes.py +++ b/src/asktable/resources/extapis/routes.py @@ -51,11 +51,11 @@ def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: def create( self, - extapi_id_1: str, + path_extapi_id: str, *, id: str, created_at: Union[str, datetime], - extapi_id_2: str, + body_extapi_id: str, method: Literal["GET", "POST", "PUT", "DELETE"], name: str, path: str, @@ -95,15 +95,15 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not extapi_id_1: - raise ValueError(f"Expected a non-empty value for `extapi_id_1` but received {extapi_id_1!r}") + if not path_extapi_id: + raise ValueError(f"Expected a non-empty value for `path_extapi_id` but received {path_extapi_id!r}") return self._post( - f"/extapis/{extapi_id_1}/routes", + f"/extapis/{path_extapi_id}/routes", body=maybe_transform( { "id": id, "created_at": created_at, - "extapi_id_2": extapi_id_2, + "body_extapi_id": body_extapi_id, "method": method, "name": name, "path": path, @@ -315,11 +315,11 @@ def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: async def create( self, - extapi_id_1: str, + path_extapi_id: str, *, id: str, created_at: Union[str, datetime], - extapi_id_2: str, + body_extapi_id: str, method: Literal["GET", "POST", "PUT", "DELETE"], name: str, path: str, @@ -359,15 +359,15 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not extapi_id_1: - raise ValueError(f"Expected a non-empty value for `extapi_id_1` but received {extapi_id_1!r}") + if not path_extapi_id: + raise ValueError(f"Expected a non-empty value for `path_extapi_id` but received {path_extapi_id!r}") return await self._post( - f"/extapis/{extapi_id_1}/routes", + f"/extapis/{path_extapi_id}/routes", body=await async_maybe_transform( { "id": id, "created_at": created_at, - "extapi_id_2": extapi_id_2, + "body_extapi_id": body_extapi_id, "method": method, "name": name, "path": path, diff --git a/src/asktable/types/extapis/route_create_params.py b/src/asktable/types/extapis/route_create_params.py index 7528ec33..8f0435fe 100644 --- a/src/asktable/types/extapis/route_create_params.py +++ b/src/asktable/types/extapis/route_create_params.py @@ -16,7 +16,7 @@ class RouteCreateParams(TypedDict, total=False): created_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - extapi_id_2: Required[Annotated[str, PropertyInfo(alias="extapi_id")]] + body_extapi_id: Required[Annotated[str, PropertyInfo(alias="extapi_id")]] method: Required[Literal["GET", "POST", "PUT", "DELETE"]] """HTTP 方法""" diff --git a/tests/api_resources/extapis/test_routes.py b/tests/api_resources/extapis/test_routes.py index 4e02e0d9..5fa13718 100644 --- a/tests/api_resources/extapis/test_routes.py +++ b/tests/api_resources/extapis/test_routes.py @@ -21,10 +21,10 @@ class TestRoutes: @parametrize def test_method_create(self, client: Asktable) -> None: route = client.extapis.routes.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -35,10 +35,10 @@ def test_method_create(self, client: Asktable) -> None: @parametrize def test_method_create_with_all_params(self, client: Asktable) -> None: route = client.extapis.routes.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -53,10 +53,10 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: @parametrize def test_raw_response_create(self, client: Asktable) -> None: response = client.extapis.routes.with_raw_response.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -71,10 +71,10 @@ def test_raw_response_create(self, client: Asktable) -> None: @parametrize def test_streaming_response_create(self, client: Asktable) -> None: with client.extapis.routes.with_streaming_response.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -90,12 +90,12 @@ def test_streaming_response_create(self, client: Asktable) -> None: @parametrize def test_path_params_create(self, client: Asktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `extapi_id_1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_extapi_id` but received ''"): client.extapis.routes.with_raw_response.create( - extapi_id_1="", + path_extapi_id="", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="", + body_extapi_id="", method="GET", name="name", path="/resource", @@ -305,10 +305,10 @@ class TestAsyncRoutes: @parametrize async def test_method_create(self, async_client: AsyncAsktable) -> None: route = await async_client.extapis.routes.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -319,10 +319,10 @@ async def test_method_create(self, async_client: AsyncAsktable) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None: route = await async_client.extapis.routes.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -337,10 +337,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) @parametrize async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: response = await async_client.extapis.routes.with_raw_response.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -355,10 +355,10 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None: async with async_client.extapis.routes.with_streaming_response.create( - extapi_id_1="extapi_id", + path_extapi_id="extapi_id", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="extapi_id", + body_extapi_id="extapi_id", method="GET", name="name", path="/resource", @@ -374,12 +374,12 @@ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> N @parametrize async def test_path_params_create(self, async_client: AsyncAsktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `extapi_id_1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_extapi_id` but received ''"): await async_client.extapis.routes.with_raw_response.create( - extapi_id_1="", + path_extapi_id="", id="id", created_at=parse_datetime("2019-12-27T18:11:19.117Z"), - extapi_id_2="", + body_extapi_id="", method="GET", name="name", path="/resource",