Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ from asktable.types.extapis import ExtapiRoute, RouteListResponse

Methods:

- <code title="post /extapis/{extapi_id}/routes">client.extapis.routes.<a href="./src/asktable/resources/extapis/routes.py">create</a>(\*, path_extapi_id, \*\*<a href="src/asktable/types/extapis/route_create_params.py">params</a>) -> <a href="./src/asktable/types/extapis/extapi_route.py">ExtapiRoute</a></code>
- <code title="post /extapis/{extapi_id}/routes">client.extapis.routes.<a href="./src/asktable/resources/extapis/routes.py">create</a>(extapi_id_1, \*\*<a href="src/asktable/types/extapis/route_create_params.py">params</a>) -> <a href="./src/asktable/types/extapis/extapi_route.py">ExtapiRoute</a></code>
- <code title="get /extapis/{extapi_id}/routes/{route_id}">client.extapis.routes.<a href="./src/asktable/resources/extapis/routes.py">retrieve</a>(route_id, \*, extapi_id) -> <a href="./src/asktable/types/extapis/extapi_route.py">ExtapiRoute</a></code>
- <code title="post /extapis/{extapi_id}/routes/{route_id}">client.extapis.routes.<a href="./src/asktable/resources/extapis/routes.py">update</a>(route_id, \*, extapi_id, \*\*<a href="src/asktable/types/extapis/route_update_params.py">params</a>) -> <a href="./src/asktable/types/extapis/extapi_route.py">ExtapiRoute</a></code>
- <code title="get /extapis/{extapi_id}/routes">client.extapis.routes.<a href="./src/asktable/resources/extapis/routes.py">list</a>(extapi_id) -> <a href="./src/asktable/types/extapis/route_list_response.py">RouteListResponse</a></code>
Expand Down
24 changes: 12 additions & 12 deletions src/asktable/resources/extapis/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
body_extapi_id: str,
extapi_id_2: str,
method: Literal["GET", "POST", "PUT", "DELETE"],
name: str,
path: str,
Expand Down Expand Up @@ -95,15 +95,15 @@ def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not path_extapi_id:
raise ValueError(f"Expected a non-empty value for `path_extapi_id` but received {path_extapi_id!r}")
if not extapi_id_1:
raise ValueError(f"Expected a non-empty value for `extapi_id_1` but received {extapi_id_1!r}")
return self._post(
f"/extapis/{path_extapi_id}/routes",
f"/extapis/{extapi_id_1}/routes",
body=maybe_transform(
{
"id": id,
"created_at": created_at,
"body_extapi_id": body_extapi_id,
"extapi_id_2": extapi_id_2,
"method": method,
"name": name,
"path": path,
Expand Down Expand Up @@ -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],
body_extapi_id: str,
extapi_id_2: str,
method: Literal["GET", "POST", "PUT", "DELETE"],
name: str,
path: str,
Expand Down Expand Up @@ -359,15 +359,15 @@ async def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not path_extapi_id:
raise ValueError(f"Expected a non-empty value for `path_extapi_id` but received {path_extapi_id!r}")
if not extapi_id_1:
raise ValueError(f"Expected a non-empty value for `extapi_id_1` but received {extapi_id_1!r}")
return await self._post(
f"/extapis/{path_extapi_id}/routes",
f"/extapis/{extapi_id_1}/routes",
body=await async_maybe_transform(
{
"id": id,
"created_at": created_at,
"body_extapi_id": body_extapi_id,
"extapi_id_2": extapi_id_2,
"method": method,
"name": name,
"path": path,
Expand Down
4 changes: 1 addition & 3 deletions src/asktable/types/extapis/route_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@


class RouteCreateParams(TypedDict, total=False):
path_extapi_id: Required[Annotated[str, PropertyInfo(alias="extapi_id")]]

id: Required[str]

created_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]

body_extapi_id: Required[Annotated[str, PropertyInfo(alias="extapi_id")]]
extapi_id_2: Required[Annotated[str, PropertyInfo(alias="extapi_id")]]

method: Required[Literal["GET", "POST", "PUT", "DELETE"]]
"""HTTP 方法"""
Expand Down
44 changes: 22 additions & 22 deletions tests/api_resources/extapis/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class TestRoutes:
@parametrize
def test_method_create(self, client: Asktable) -> None:
route = client.extapis.routes.create(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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 `path_extapi_id` but received ''"):
with pytest.raises(ValueError, match=r"Expected a non-empty value for `extapi_id_1` but received ''"):
client.extapis.routes.with_raw_response.create(
path_extapi_id="",
extapi_id_1="",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="",
extapi_id_2="",
method="GET",
name="name",
path="/resource",
Expand Down Expand Up @@ -305,10 +305,10 @@ class TestAsyncRoutes:
@parametrize
async def test_method_create(self, async_client: AsyncAsktable) -> None:
route = await async_client.extapis.routes.create(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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(
path_extapi_id="extapi_id",
extapi_id_1="extapi_id",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="extapi_id",
extapi_id_2="extapi_id",
method="GET",
name="name",
path="/resource",
Expand All @@ -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 `path_extapi_id` but received ''"):
with pytest.raises(ValueError, match=r"Expected a non-empty value for `extapi_id_1` but received ''"):
await async_client.extapis.routes.with_raw_response.create(
path_extapi_id="",
extapi_id_1="",
id="id",
created_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_extapi_id="",
extapi_id_2="",
method="GET",
name="name",
path="/resource",
Expand Down