From e70fbf41048ca082ffd9f4888ccfa7bd9f97c57f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 21 Jan 2025 04:02:49 +0000
Subject: [PATCH 01/32] chore(internal): codegen related update (#138)
---
api.md | 2 +-
src/asktable/resources/extapis/routes.py | 24 +++++-----
.../types/extapis/route_create_params.py | 4 +-
tests/api_resources/extapis/test_routes.py | 44 +++++++++----------
4 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/api.md b/api.md
index bfeed1ba..bd1402c7 100644
--- a/api.md
+++ b/api.md
@@ -237,7 +237,7 @@ from asktable.types.extapis import ExtapiRoute, RouteListResponse
Methods:
-- client.extapis.routes.create(\*, path_extapi_id, \*\*params) -> ExtapiRoute
+- client.extapis.routes.create(extapi_id_1, \*\*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 994f1cb4..243a26f6 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],
- body_extapi_id: str,
+ extapi_id_2: 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 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,
@@ -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,
@@ -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,
diff --git a/src/asktable/types/extapis/route_create_params.py b/src/asktable/types/extapis/route_create_params.py
index cfaafef7..7528ec33 100644
--- a/src/asktable/types/extapis/route_create_params.py
+++ b/src/asktable/types/extapis/route_create_params.py
@@ -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 方法"""
diff --git a/tests/api_resources/extapis/test_routes.py b/tests/api_resources/extapis/test_routes.py
index 5fa13718..4e02e0d9 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(
- 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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
From 55809895dc745aa046c93493ad7f658ed652c869 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 21 Jan 2025 04:12:37 +0000
Subject: [PATCH 02/32] docs(raw responses): fix duplicate `the` (#140)
---
src/asktable/resources/answers.py | 4 ++--
src/asktable/resources/auth.py | 4 ++--
src/asktable/resources/bots.py | 4 ++--
src/asktable/resources/business_glossary.py | 4 ++--
src/asktable/resources/caches.py | 4 ++--
src/asktable/resources/chats/chats.py | 4 ++--
src/asktable/resources/chats/messages.py | 4 ++--
src/asktable/resources/datasources/datasources.py | 4 ++--
src/asktable/resources/datasources/indexes.py | 4 ++--
src/asktable/resources/datasources/meta.py | 4 ++--
src/asktable/resources/datasources/upload_params.py | 4 ++--
src/asktable/resources/extapis/extapis.py | 4 ++--
src/asktable/resources/extapis/routes.py | 4 ++--
src/asktable/resources/integration.py | 4 ++--
src/asktable/resources/policies.py | 4 ++--
src/asktable/resources/preferences.py | 4 ++--
src/asktable/resources/project.py | 4 ++--
src/asktable/resources/roles.py | 4 ++--
src/asktable/resources/scores.py | 4 ++--
src/asktable/resources/securetunnels.py | 4 ++--
src/asktable/resources/sqls.py | 4 ++--
src/asktable/resources/sys/projects/api_keys.py | 4 ++--
src/asktable/resources/sys/projects/projects.py | 4 ++--
src/asktable/resources/sys/sys.py | 4 ++--
src/asktable/resources/trainings.py | 4 ++--
25 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/src/asktable/resources/answers.py b/src/asktable/resources/answers.py
index 07c92971..ff6e0aa3 100644
--- a/src/asktable/resources/answers.py
+++ b/src/asktable/resources/answers.py
@@ -31,7 +31,7 @@ class AnswersResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> AnswersResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -163,7 +163,7 @@ class AsyncAnswersResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAnswersResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/auth.py b/src/asktable/resources/auth.py
index 7fdb442c..ca6fbe12 100644
--- a/src/asktable/resources/auth.py
+++ b/src/asktable/resources/auth.py
@@ -30,7 +30,7 @@ class AuthResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> AuthResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -121,7 +121,7 @@ class AsyncAuthResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAuthResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py
index 3195172f..2227fb59 100644
--- a/src/asktable/resources/bots.py
+++ b/src/asktable/resources/bots.py
@@ -31,7 +31,7 @@ class BotsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> BotsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -364,7 +364,7 @@ class AsyncBotsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncBotsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py
index 3f62097a..3fabfdd5 100644
--- a/src/asktable/resources/business_glossary.py
+++ b/src/asktable/resources/business_glossary.py
@@ -37,7 +37,7 @@ class BusinessGlossaryResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> BusinessGlossaryResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -261,7 +261,7 @@ class AsyncBusinessGlossaryResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncBusinessGlossaryResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/caches.py b/src/asktable/resources/caches.py
index 9dde4a13..bc1c73bf 100644
--- a/src/asktable/resources/caches.py
+++ b/src/asktable/resources/caches.py
@@ -22,7 +22,7 @@ class CachesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> CachesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -77,7 +77,7 @@ class AsyncCachesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncCachesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py
index 3c6606ed..a20f13ad 100644
--- a/src/asktable/resources/chats/chats.py
+++ b/src/asktable/resources/chats/chats.py
@@ -44,7 +44,7 @@ def messages(self) -> MessagesResource:
@cached_property
def with_raw_response(self) -> ChatsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -240,7 +240,7 @@ def messages(self) -> AsyncMessagesResource:
@cached_property
def with_raw_response(self) -> AsyncChatsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/chats/messages.py b/src/asktable/resources/chats/messages.py
index fe26fef5..6d5a2c01 100644
--- a/src/asktable/resources/chats/messages.py
+++ b/src/asktable/resources/chats/messages.py
@@ -33,7 +33,7 @@ class MessagesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> MessagesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -188,7 +188,7 @@ class AsyncMessagesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncMessagesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py
index 96752375..1553cd7e 100644
--- a/src/asktable/resources/datasources/datasources.py
+++ b/src/asktable/resources/datasources/datasources.py
@@ -76,7 +76,7 @@ def indexes(self) -> IndexesResource:
@cached_property
def with_raw_response(self) -> DatasourcesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -537,7 +537,7 @@ def indexes(self) -> AsyncIndexesResource:
@cached_property
def with_raw_response(self) -> AsyncDatasourcesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/datasources/indexes.py b/src/asktable/resources/datasources/indexes.py
index 8c5e4638..943dab53 100644
--- a/src/asktable/resources/datasources/indexes.py
+++ b/src/asktable/resources/datasources/indexes.py
@@ -29,7 +29,7 @@ class IndexesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> IndexesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -193,7 +193,7 @@ class AsyncIndexesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncIndexesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py
index e52b23c1..ce2bf23d 100644
--- a/src/asktable/resources/datasources/meta.py
+++ b/src/asktable/resources/datasources/meta.py
@@ -30,7 +30,7 @@ class MetaResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> MetaResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -223,7 +223,7 @@ class AsyncMetaResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncMetaResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/datasources/upload_params.py b/src/asktable/resources/datasources/upload_params.py
index 8ce7e2cb..aab0b9cb 100644
--- a/src/asktable/resources/datasources/upload_params.py
+++ b/src/asktable/resources/datasources/upload_params.py
@@ -29,7 +29,7 @@ class UploadParamsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> UploadParamsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -93,7 +93,7 @@ class AsyncUploadParamsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncUploadParamsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/extapis/extapis.py b/src/asktable/resources/extapis/extapis.py
index 65fd75dd..e1c7312a 100644
--- a/src/asktable/resources/extapis/extapis.py
+++ b/src/asktable/resources/extapis/extapis.py
@@ -43,7 +43,7 @@ def routes(self) -> RoutesResource:
@cached_property
def with_raw_response(self) -> ExtapisResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -282,7 +282,7 @@ def routes(self) -> AsyncRoutesResource:
@cached_property
def with_raw_response(self) -> AsyncExtapisResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/extapis/routes.py b/src/asktable/resources/extapis/routes.py
index 243a26f6..d455577b 100644
--- a/src/asktable/resources/extapis/routes.py
+++ b/src/asktable/resources/extapis/routes.py
@@ -33,7 +33,7 @@ class RoutesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> RoutesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -297,7 +297,7 @@ class AsyncRoutesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/integration.py b/src/asktable/resources/integration.py
index 1b9a2934..f944649c 100644
--- a/src/asktable/resources/integration.py
+++ b/src/asktable/resources/integration.py
@@ -31,7 +31,7 @@ class IntegrationResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> IntegrationResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -141,7 +141,7 @@ class AsyncIntegrationResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncIntegrationResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/policies.py b/src/asktable/resources/policies.py
index 638787a2..b3891c73 100644
--- a/src/asktable/resources/policies.py
+++ b/src/asktable/resources/policies.py
@@ -32,7 +32,7 @@ class PoliciesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> PoliciesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -272,7 +272,7 @@ class AsyncPoliciesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/preferences.py b/src/asktable/resources/preferences.py
index 2bba1daa..423f2682 100644
--- a/src/asktable/resources/preferences.py
+++ b/src/asktable/resources/preferences.py
@@ -32,7 +32,7 @@ class PreferencesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> PreferencesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -177,7 +177,7 @@ class AsyncPreferencesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncPreferencesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/project.py b/src/asktable/resources/project.py
index 270aa2a5..726b33af 100644
--- a/src/asktable/resources/project.py
+++ b/src/asktable/resources/project.py
@@ -31,7 +31,7 @@ class ProjectResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> ProjectResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -133,7 +133,7 @@ class AsyncProjectResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncProjectResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py
index eea360f5..57f2954a 100644
--- a/src/asktable/resources/roles.py
+++ b/src/asktable/resources/roles.py
@@ -32,7 +32,7 @@ class RolesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> RolesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -345,7 +345,7 @@ class AsyncRolesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncRolesResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/scores.py b/src/asktable/resources/scores.py
index 6c178a07..45977016 100644
--- a/src/asktable/resources/scores.py
+++ b/src/asktable/resources/scores.py
@@ -28,7 +28,7 @@ class ScoresResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> ScoresResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -99,7 +99,7 @@ class AsyncScoresResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncScoresResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/securetunnels.py b/src/asktable/resources/securetunnels.py
index 839ee70a..e20f329d 100644
--- a/src/asktable/resources/securetunnels.py
+++ b/src/asktable/resources/securetunnels.py
@@ -37,7 +37,7 @@ class SecuretunnelsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> SecuretunnelsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -306,7 +306,7 @@ class AsyncSecuretunnelsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncSecuretunnelsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/sqls.py b/src/asktable/resources/sqls.py
index 987bf2b3..65e98c2a 100644
--- a/src/asktable/resources/sqls.py
+++ b/src/asktable/resources/sqls.py
@@ -31,7 +31,7 @@ class SqlsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> SqlsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -155,7 +155,7 @@ class AsyncSqlsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncSqlsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/sys/projects/api_keys.py b/src/asktable/resources/sys/projects/api_keys.py
index fe34b0eb..7a16d66c 100644
--- a/src/asktable/resources/sys/projects/api_keys.py
+++ b/src/asktable/resources/sys/projects/api_keys.py
@@ -32,7 +32,7 @@ class APIKeysResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> APIKeysResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -214,7 +214,7 @@ class AsyncAPIKeysResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py
index 5d4f0dcf..29c51670 100644
--- a/src/asktable/resources/sys/projects/projects.py
+++ b/src/asktable/resources/sys/projects/projects.py
@@ -44,7 +44,7 @@ def api_keys(self) -> APIKeysResource:
@cached_property
def with_raw_response(self) -> ProjectsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -289,7 +289,7 @@ def api_keys(self) -> AsyncAPIKeysResource:
@cached_property
def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/sys/sys.py b/src/asktable/resources/sys/sys.py
index c2fb5786..27f630db 100644
--- a/src/asktable/resources/sys/sys.py
+++ b/src/asktable/resources/sys/sys.py
@@ -24,7 +24,7 @@ def projects(self) -> ProjectsResource:
@cached_property
def with_raw_response(self) -> SysResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -49,7 +49,7 @@ def projects(self) -> AsyncProjectsResource:
@cached_property
def with_raw_response(self) -> AsyncSysResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
diff --git a/src/asktable/resources/trainings.py b/src/asktable/resources/trainings.py
index 2ba657bb..faa25255 100644
--- a/src/asktable/resources/trainings.py
+++ b/src/asktable/resources/trainings.py
@@ -32,7 +32,7 @@ class TrainingsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> TrainingsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
@@ -183,7 +183,7 @@ class AsyncTrainingsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncTrainingsResourceWithRawResponse:
"""
- This property can be used as a prefix for any HTTP method call to return the
+ This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
From 56d0462efef6c92a6727fd91c638a19750195d4e Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jan 2025 04:16:29 +0000
Subject: [PATCH 03/32] chore(internal): codegen related update (#141)
---
pyproject.toml | 1 +
tests/test_client.py | 25 ++++++++++++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index ee8b68bd..4b7c4852 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -129,6 +129,7 @@ testpaths = ["tests"]
addopts = "--tb=short"
xfail_strict = true
asyncio_mode = "auto"
+asyncio_default_fixture_loop_scope = "session"
filterwarnings = [
"error"
]
diff --git a/tests/test_client.py b/tests/test_client.py
index 2f645e8f..9031a120 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -6,6 +6,7 @@
import os
import sys
import json
+import time
import asyncio
import inspect
import subprocess
@@ -1609,10 +1610,20 @@ async def test_main() -> None:
[sys.executable, "-c", test_code],
text=True,
) as process:
- try:
- process.wait(2)
- if process.returncode:
- raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")
- except subprocess.TimeoutExpired as e:
- process.kill()
- raise AssertionError("calling get_platform using asyncify resulted in a hung process") from e
+ timeout = 10 # seconds
+
+ start_time = time.monotonic()
+ while True:
+ return_code = process.poll()
+ if return_code is not None:
+ if return_code != 0:
+ raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")
+
+ # success
+ break
+
+ if time.monotonic() - start_time > timeout:
+ process.kill()
+ raise AssertionError("calling get_platform using asyncify resulted in a hung process")
+
+ time.sleep(0.1)
From cb5834c4e4819f6c9a99dcd9a9d8296b413d0317 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jan 2025 04:39:54 +0000
Subject: [PATCH 04/32] chore(internal): minor style changes (#142)
---
src/asktable/_response.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/asktable/_response.py b/src/asktable/_response.py
index 15416ac8..e7528b55 100644
--- a/src/asktable/_response.py
+++ b/src/asktable/_response.py
@@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to and is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0)
+ origin = get_origin(cast_to) or cast_to
+
if self._is_sse_stream:
if to:
if not is_stream_class_type(to):
@@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to == bool:
return cast(R, response.text.lower() == "true")
- origin = get_origin(cast_to) or cast_to
-
if origin == APIResponse:
raise RuntimeError("Unexpected state - cast_to is `APIResponse`")
From a4ac34fcf7a8350bdd03b5c51917ca5896183c63 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 24 Jan 2025 03:18:09 +0000
Subject: [PATCH 05/32] chore(internal): minor formatting changes (#143)
---
.github/workflows/ci.yml | 3 +--
scripts/bootstrap | 2 +-
scripts/lint | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 40293964..c8a8a4f7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,7 +12,6 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
-
steps:
- uses: actions/checkout@v4
@@ -30,6 +29,7 @@ jobs:
- name: Run lints
run: ./scripts/lint
+
test:
name: test
runs-on: ubuntu-latest
@@ -50,4 +50,3 @@ jobs:
- name: Run tests
run: ./scripts/test
-
diff --git a/scripts/bootstrap b/scripts/bootstrap
index 8c5c60eb..e84fe62c 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")/.."
-if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
+if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
diff --git a/scripts/lint b/scripts/lint
index beabb640..c49721d9 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -9,4 +9,3 @@ rye run lint
echo "==> Making sure it imports"
rye run python -c 'import asktable'
-
From 668a25dd349090c2f095d068a0ada72587aac38f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 24 Jan 2025 16:15:01 +0000
Subject: [PATCH 06/32] feat(api): api update (#144)
---
.stats.yml | 2 +-
src/asktable/resources/datasources/meta.py | 44 ++-----------------
.../types/datasources/meta_create_params.py | 3 --
.../types/datasources/meta_update_params.py | 3 --
src/asktable/types/meta.py | 3 --
tests/api_resources/datasources/test_meta.py | 20 ---------
6 files changed, 5 insertions(+), 70 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 42ece98b..f117a12f 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 91
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-69140680dde56332aa42ebbfbe12c0c3db2adf3904e4a821cee6465e491f4c57.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-7619ea08bed7b776b03ff5e8d23e656968e76e7cf0093888bac1c94deb7153a3.yml
diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py
index ce2bf23d..d694e024 100644
--- a/src/asktable/resources/datasources/meta.py
+++ b/src/asktable/resources/datasources/meta.py
@@ -50,7 +50,6 @@ def create(
self,
datasource_id: str,
*,
- name: str,
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
schemas: Dict[str, meta_create_params.Schemas] | NotGiven = NOT_GIVEN,
@@ -69,8 +68,6 @@ def create(
否则从数据源中自动获取。
Args:
- name: metadata_name
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -83,13 +80,7 @@ def create(
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._post(
f"/datasources/{datasource_id}/meta",
- body=maybe_transform(
- {
- "name": name,
- "schemas": schemas,
- },
- meta_create_params.MetaCreateParams,
- ),
+ body=maybe_transform({"schemas": schemas}, meta_create_params.MetaCreateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -143,7 +134,6 @@ def update(
self,
datasource_id: str,
*,
- name: str,
schemas: Dict[str, meta_update_params.Schemas] | NotGiven = NOT_GIVEN,
# 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.
@@ -156,8 +146,6 @@ def update(
用于更新 DB 类型的数据源的 Meta(增加新表或者删除老表)
Args:
- name: metadata_name
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -170,13 +158,7 @@ def update(
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._put(
f"/datasources/{datasource_id}/meta",
- body=maybe_transform(
- {
- "name": name,
- "schemas": schemas,
- },
- meta_update_params.MetaUpdateParams,
- ),
+ body=maybe_transform({"schemas": schemas}, meta_update_params.MetaUpdateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -243,7 +225,6 @@ async def create(
self,
datasource_id: str,
*,
- name: str,
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
schemas: Dict[str, meta_create_params.Schemas] | NotGiven = NOT_GIVEN,
@@ -262,8 +243,6 @@ async def create(
否则从数据源中自动获取。
Args:
- name: metadata_name
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -276,13 +255,7 @@ async def create(
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._post(
f"/datasources/{datasource_id}/meta",
- body=await async_maybe_transform(
- {
- "name": name,
- "schemas": schemas,
- },
- meta_create_params.MetaCreateParams,
- ),
+ body=await async_maybe_transform({"schemas": schemas}, meta_create_params.MetaCreateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -336,7 +309,6 @@ async def update(
self,
datasource_id: str,
*,
- name: str,
schemas: Dict[str, meta_update_params.Schemas] | NotGiven = NOT_GIVEN,
# 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.
@@ -349,8 +321,6 @@ async def update(
用于更新 DB 类型的数据源的 Meta(增加新表或者删除老表)
Args:
- name: metadata_name
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -363,13 +333,7 @@ async def update(
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._put(
f"/datasources/{datasource_id}/meta",
- body=await async_maybe_transform(
- {
- "name": name,
- "schemas": schemas,
- },
- meta_update_params.MetaUpdateParams,
- ),
+ body=await async_maybe_transform({"schemas": schemas}, meta_update_params.MetaUpdateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/types/datasources/meta_create_params.py b/src/asktable/types/datasources/meta_create_params.py
index 1dc3abfb..2df479ec 100644
--- a/src/asktable/types/datasources/meta_create_params.py
+++ b/src/asktable/types/datasources/meta_create_params.py
@@ -9,9 +9,6 @@
class MetaCreateParams(TypedDict, total=False):
- name: Required[str]
- """metadata_name"""
-
async_process_meta: bool
value_index: bool
diff --git a/src/asktable/types/datasources/meta_update_params.py b/src/asktable/types/datasources/meta_update_params.py
index d7afc781..e859a334 100644
--- a/src/asktable/types/datasources/meta_update_params.py
+++ b/src/asktable/types/datasources/meta_update_params.py
@@ -9,9 +9,6 @@
class MetaUpdateParams(TypedDict, total=False):
- name: Required[str]
- """metadata_name"""
-
schemas: Dict[str, Schemas]
diff --git a/src/asktable/types/meta.py b/src/asktable/types/meta.py
index 1395bdf5..a2cfa262 100644
--- a/src/asktable/types/meta.py
+++ b/src/asktable/types/meta.py
@@ -79,7 +79,4 @@ class Meta(BaseModel):
datasource_id: str
"""datasource_id"""
- name: str
- """metadata_name"""
-
schemas: Optional[Dict[str, Schemas]] = None
diff --git a/tests/api_resources/datasources/test_meta.py b/tests/api_resources/datasources/test_meta.py
index 50d6f088..2b7c993d 100644
--- a/tests/api_resources/datasources/test_meta.py
+++ b/tests/api_resources/datasources/test_meta.py
@@ -21,7 +21,6 @@ class TestMeta:
def test_method_create(self, client: Asktable) -> None:
meta = client.datasources.meta.create(
datasource_id="datasource_id",
- name="name",
)
assert_matches_type(object, meta, path=["response"])
@@ -29,7 +28,6 @@ def test_method_create(self, client: Asktable) -> None:
def test_method_create_with_all_params(self, client: Asktable) -> None:
meta = client.datasources.meta.create(
datasource_id="datasource_id",
- name="name",
async_process_meta=True,
value_index=True,
schemas={
@@ -60,7 +58,6 @@ def test_method_create_with_all_params(self, client: Asktable) -> None:
def test_raw_response_create(self, client: Asktable) -> None:
response = client.datasources.meta.with_raw_response.create(
datasource_id="datasource_id",
- name="name",
)
assert response.is_closed is True
@@ -72,7 +69,6 @@ def test_raw_response_create(self, client: Asktable) -> None:
def test_streaming_response_create(self, client: Asktable) -> None:
with client.datasources.meta.with_streaming_response.create(
datasource_id="datasource_id",
- name="name",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -87,7 +83,6 @@ def test_path_params_create(self, client: Asktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
client.datasources.meta.with_raw_response.create(
datasource_id="",
- name="name",
)
@parametrize
@@ -132,7 +127,6 @@ def test_path_params_retrieve(self, client: Asktable) -> None:
def test_method_update(self, client: Asktable) -> None:
meta = client.datasources.meta.update(
datasource_id="datasource_id",
- name="name",
)
assert_matches_type(object, meta, path=["response"])
@@ -140,7 +134,6 @@ def test_method_update(self, client: Asktable) -> None:
def test_method_update_with_all_params(self, client: Asktable) -> None:
meta = client.datasources.meta.update(
datasource_id="datasource_id",
- name="name",
schemas={
"foo": {
"name": "name",
@@ -169,7 +162,6 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
def test_raw_response_update(self, client: Asktable) -> None:
response = client.datasources.meta.with_raw_response.update(
datasource_id="datasource_id",
- name="name",
)
assert response.is_closed is True
@@ -181,7 +173,6 @@ def test_raw_response_update(self, client: Asktable) -> None:
def test_streaming_response_update(self, client: Asktable) -> None:
with client.datasources.meta.with_streaming_response.update(
datasource_id="datasource_id",
- name="name",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -196,7 +187,6 @@ def test_path_params_update(self, client: Asktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
client.datasources.meta.with_raw_response.update(
datasource_id="",
- name="name",
)
@parametrize
@@ -249,7 +239,6 @@ class TestAsyncMeta:
async def test_method_create(self, async_client: AsyncAsktable) -> None:
meta = await async_client.datasources.meta.create(
datasource_id="datasource_id",
- name="name",
)
assert_matches_type(object, meta, path=["response"])
@@ -257,7 +246,6 @@ async def test_method_create(self, async_client: AsyncAsktable) -> None:
async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
meta = await async_client.datasources.meta.create(
datasource_id="datasource_id",
- name="name",
async_process_meta=True,
value_index=True,
schemas={
@@ -288,7 +276,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable)
async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
response = await async_client.datasources.meta.with_raw_response.create(
datasource_id="datasource_id",
- name="name",
)
assert response.is_closed is True
@@ -300,7 +287,6 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
async with async_client.datasources.meta.with_streaming_response.create(
datasource_id="datasource_id",
- name="name",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -315,7 +301,6 @@ async def test_path_params_create(self, async_client: AsyncAsktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
await async_client.datasources.meta.with_raw_response.create(
datasource_id="",
- name="name",
)
@parametrize
@@ -360,7 +345,6 @@ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
async def test_method_update(self, async_client: AsyncAsktable) -> None:
meta = await async_client.datasources.meta.update(
datasource_id="datasource_id",
- name="name",
)
assert_matches_type(object, meta, path=["response"])
@@ -368,7 +352,6 @@ async def test_method_update(self, async_client: AsyncAsktable) -> None:
async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None:
meta = await async_client.datasources.meta.update(
datasource_id="datasource_id",
- name="name",
schemas={
"foo": {
"name": "name",
@@ -397,7 +380,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
response = await async_client.datasources.meta.with_raw_response.update(
datasource_id="datasource_id",
- name="name",
)
assert response.is_closed is True
@@ -409,7 +391,6 @@ async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
async def test_streaming_response_update(self, async_client: AsyncAsktable) -> None:
async with async_client.datasources.meta.with_streaming_response.update(
datasource_id="datasource_id",
- name="name",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -424,7 +405,6 @@ async def test_path_params_update(self, async_client: AsyncAsktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
await async_client.datasources.meta.with_raw_response.update(
datasource_id="",
- name="name",
)
@parametrize
From 7dcce3ab20b22be9403009e3bb4faf5b4b5f7227 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 30 Jan 2025 03:14:46 +0000
Subject: [PATCH 07/32] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index f117a12f..ce6172aa 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 91
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-7619ea08bed7b776b03ff5e8d23e656968e76e7cf0093888bac1c94deb7153a3.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2d9923ffe6d2d59041bac841db518829933a84e3251a372c9ad2306473fd7488.yml
From f41860576a0d6e8ce78352de1e997c3e8149a52f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 4 Feb 2025 03:02:19 +0000
Subject: [PATCH 08/32] chore(internal): change default timeout to an int
(#146)
---
src/asktable/_constants.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/asktable/_constants.py b/src/asktable/_constants.py
index c3f2250a..7f806dde 100644
--- a/src/asktable/_constants.py
+++ b/src/asktable/_constants.py
@@ -6,7 +6,7 @@
OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
# default timeout is 5 minutes
-DEFAULT_TIMEOUT = httpx.Timeout(timeout=300.0, connect=5.0)
+DEFAULT_TIMEOUT = httpx.Timeout(timeout=300, connect=5.0)
DEFAULT_MAX_RETRIES = 2
DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
From 9638e50e2a5325ba4cb66e8cd987d96da80f37d5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 4 Feb 2025 03:04:10 +0000
Subject: [PATCH 09/32] chore(internal): bummp ruff dependency (#147)
---
pyproject.toml | 2 +-
requirements-dev.lock | 2 +-
scripts/utils/ruffen-docs.py | 4 ++--
src/asktable/_models.py | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 4b7c4852..0df568bc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -177,7 +177,7 @@ select = [
"T201",
"T203",
# misuse of typing.TYPE_CHECKING
- "TCH004",
+ "TC004",
# import rules
"TID251",
]
diff --git a/requirements-dev.lock b/requirements-dev.lock
index f9651665..ee4ad5a8 100644
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@ -78,7 +78,7 @@ pytz==2023.3.post1
# via dirty-equals
respx==0.22.0
rich==13.7.1
-ruff==0.6.9
+ruff==0.9.4
setuptools==68.2.2
# via nodeenv
six==1.16.0
diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py
index 37b3d94f..0cf2bd2f 100644
--- a/scripts/utils/ruffen-docs.py
+++ b/scripts/utils/ruffen-docs.py
@@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str:
with _collect_error(match):
code = format_code_block(code)
code = textwrap.indent(code, match["indent"])
- return f'{match["before"]}{code}{match["after"]}'
+ return f"{match['before']}{code}{match['after']}"
def _pycon_match(match: Match[str]) -> str:
code = ""
@@ -97,7 +97,7 @@ def finish_fragment() -> None:
def _md_pycon_match(match: Match[str]) -> str:
code = _pycon_match(match)
code = textwrap.indent(code, match["indent"])
- return f'{match["before"]}{code}{match["after"]}'
+ return f"{match['before']}{code}{match['after']}"
src = MD_RE.sub(_md_match, src)
src = MD_PYCON_RE.sub(_md_pycon_match, src)
diff --git a/src/asktable/_models.py b/src/asktable/_models.py
index 9a918aab..12c34b7d 100644
--- a/src/asktable/_models.py
+++ b/src/asktable/_models.py
@@ -172,7 +172,7 @@ def to_json(
@override
def __str__(self) -> str:
# mypy complains about an invalid self arg
- return f'{self.__repr_name__()}({self.__repr_str__(", ")})' # type: ignore[misc]
+ return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc]
# Override the 'construct' method in a way that supports recursive parsing without validation.
# Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836.
From 3f9650f5519444a1517dcf85bf313780e5dd6cce 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:02:02 +0000
Subject: [PATCH 10/32] fix: improve names for conflicting params (#148)
---
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",
From 2bbef8d335a87602e14fbea387f3b7fe136424f0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 6 Feb 2025 03:05:30 +0000
Subject: [PATCH 11/32] feat(client): send `X-Stainless-Read-Timeout` header
(#149)
---
src/asktable/_base_client.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py
index 29ab94e6..170d22fa 100644
--- a/src/asktable/_base_client.py
+++ b/src/asktable/_base_client.py
@@ -418,10 +418,17 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0
if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
- # Don't set the retry count header if it was already set or removed by the caller. We check
+ # Don't set these headers if they were already set or removed by the caller. We check
# `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
- if "x-stainless-retry-count" not in (header.lower() for header in custom_headers):
+ lower_custom_headers = [header.lower() for header in custom_headers]
+ if "x-stainless-retry-count" not in lower_custom_headers:
headers["x-stainless-retry-count"] = str(retries_taken)
+ if "x-stainless-read-timeout" not in lower_custom_headers:
+ timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout
+ if isinstance(timeout, Timeout):
+ timeout = timeout.read
+ if timeout is not None:
+ headers["x-stainless-read-timeout"] = str(timeout)
return headers
From 0caeb28b8647a9753b16bbc8a2963f900e4dd9d2 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 7 Feb 2025 03:03:11 +0000
Subject: [PATCH 12/32] chore(internal): fix type traversing dictionary params
(#150)
---
src/asktable/_utils/_transform.py | 12 +++++++++++-
tests/test_transform.py | 11 ++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/asktable/_utils/_transform.py b/src/asktable/_utils/_transform.py
index a6b62cad..18afd9d8 100644
--- a/src/asktable/_utils/_transform.py
+++ b/src/asktable/_utils/_transform.py
@@ -25,7 +25,7 @@
is_annotated_type,
strip_annotated_type,
)
-from .._compat import model_dump, is_typeddict
+from .._compat import get_origin, model_dump, is_typeddict
_T = TypeVar("_T")
@@ -164,9 +164,14 @@ def _transform_recursive(
inner_type = annotation
stripped_type = strip_annotated_type(inner_type)
+ origin = get_origin(stripped_type) or stripped_type
if is_typeddict(stripped_type) and is_mapping(data):
return _transform_typeddict(data, stripped_type)
+ if origin == dict and is_mapping(data):
+ items_type = get_args(stripped_type)[1]
+ return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()}
+
if (
# List[T]
(is_list_type(stripped_type) and is_list(data))
@@ -307,9 +312,14 @@ async def _async_transform_recursive(
inner_type = annotation
stripped_type = strip_annotated_type(inner_type)
+ origin = get_origin(stripped_type) or stripped_type
if is_typeddict(stripped_type) and is_mapping(data):
return await _async_transform_typeddict(data, stripped_type)
+ if origin == dict and is_mapping(data):
+ items_type = get_args(stripped_type)[1]
+ return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()}
+
if (
# List[T]
(is_list_type(stripped_type) and is_list(data))
diff --git a/tests/test_transform.py b/tests/test_transform.py
index 33e681b0..581d749f 100644
--- a/tests/test_transform.py
+++ b/tests/test_transform.py
@@ -2,7 +2,7 @@
import io
import pathlib
-from typing import Any, List, Union, TypeVar, Iterable, Optional, cast
+from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
from datetime import date, datetime
from typing_extensions import Required, Annotated, TypedDict
@@ -388,6 +388,15 @@ def my_iter() -> Iterable[Baz8]:
}
+@parametrize
+@pytest.mark.asyncio
+async def test_dictionary_items(use_async: bool) -> None:
+ class DictItems(TypedDict):
+ foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")]
+
+ assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}}
+
+
class TypedDictIterableUnionStr(TypedDict):
foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")]
From 67e6469d84d6fc761ae2e7fc55d47ffb07c49309 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 7 Feb 2025 03:06:32 +0000
Subject: [PATCH 13/32] chore(internal): minor type handling changes (#151)
---
src/asktable/_models.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/asktable/_models.py b/src/asktable/_models.py
index 12c34b7d..c4401ff8 100644
--- a/src/asktable/_models.py
+++ b/src/asktable/_models.py
@@ -426,10 +426,16 @@ def construct_type(*, value: object, type_: object) -> object:
If the given value does not match the expected type then it is returned as-is.
"""
+
+ # store a reference to the original type we were given before we extract any inner
+ # types so that we can properly resolve forward references in `TypeAliasType` annotations
+ original_type = None
+
# we allow `object` as the input type because otherwise, passing things like
# `Literal['value']` will be reported as a type error by type checkers
type_ = cast("type[object]", type_)
if is_type_alias_type(type_):
+ original_type = type_ # type: ignore[unreachable]
type_ = type_.__value__ # type: ignore[unreachable]
# unwrap `Annotated[T, ...]` -> `T`
@@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object:
if is_union(origin):
try:
- return validate_type(type_=cast("type[object]", type_), value=value)
+ return validate_type(type_=cast("type[object]", original_type or type_), value=value)
except Exception:
pass
From 02af016ec2d3f945765bbc76a24a0a102757b966 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 13 Feb 2025 03:06:54 +0000
Subject: [PATCH 14/32] chore(internal): update client tests (#152)
---
tests/test_client.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/test_client.py b/tests/test_client.py
index 9031a120..686afa13 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -23,6 +23,7 @@
from asktable import Asktable, AsyncAsktable, APIResponseValidationError
from asktable._types import Omit
+from asktable._utils import maybe_transform
from asktable._models import BaseModel, FinalRequestOptions
from asktable._constants import RAW_RESPONSE_HEADER
from asktable._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError
@@ -32,6 +33,7 @@
BaseClient,
make_request_options,
)
+from asktable.types.datasource_create_params import DatasourceCreateParams
from .utils import update_env
@@ -707,7 +709,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
with pytest.raises(APITimeoutError):
self.client.post(
"/datasources",
- body=cast(object, dict(engine="mysql")),
+ body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
@@ -722,7 +724,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
with pytest.raises(APIStatusError):
self.client.post(
"/datasources",
- body=cast(object, dict(engine="mysql")),
+ body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
@@ -1477,7 +1479,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
with pytest.raises(APITimeoutError):
await self.client.post(
"/datasources",
- body=cast(object, dict(engine="mysql")),
+ body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
@@ -1492,7 +1494,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
with pytest.raises(APIStatusError):
await self.client.post(
"/datasources",
- body=cast(object, dict(engine="mysql")),
+ body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
From 92577a2765975e59273e218ba20c93cbed7a05c1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 14 Feb 2025 03:02:03 +0000
Subject: [PATCH 15/32] fix: asyncify on non-asyncio runtimes (#153)
---
src/asktable/_utils/_sync.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/asktable/_utils/_sync.py b/src/asktable/_utils/_sync.py
index 8b3aaf2b..ad7ec71b 100644
--- a/src/asktable/_utils/_sync.py
+++ b/src/asktable/_utils/_sync.py
@@ -7,16 +7,20 @@
from typing import Any, TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec
+import anyio
+import sniffio
+import anyio.to_thread
+
T_Retval = TypeVar("T_Retval")
T_ParamSpec = ParamSpec("T_ParamSpec")
if sys.version_info >= (3, 9):
- to_thread = asyncio.to_thread
+ _asyncio_to_thread = asyncio.to_thread
else:
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
# for Python 3.8 support
- async def to_thread(
+ async def _asyncio_to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> Any:
"""Asynchronously run function *func* in a separate thread.
@@ -34,6 +38,17 @@ async def to_thread(
return await loop.run_in_executor(None, func_call)
+async def to_thread(
+ func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
+) -> T_Retval:
+ if sniffio.current_async_library() == "asyncio":
+ return await _asyncio_to_thread(func, *args, **kwargs)
+
+ return await anyio.to_thread.run_sync(
+ functools.partial(func, *args, **kwargs),
+ )
+
+
# inspired by `asyncer`, https://github.com/tiangolo/asyncer
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
From 2242fad33cc31d4bf434bc6161ca444c7cf3bf36 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 19 Feb 2025 03:07:37 +0000
Subject: [PATCH 16/32] chore(internal): codegen related update (#154)
---
README.md | 18 ++++++++++++++++++
src/asktable/_files.py | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 1bd49bbb..bf0709d3 100644
--- a/README.md
+++ b/README.md
@@ -134,6 +134,24 @@ for datasource in first_page.items:
# Remove `await` for non-async usage.
```
+## File uploads
+
+Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
+
+```python
+from pathlib import Path
+from asktable import Asktable
+
+client = Asktable()
+
+client.datasources.add_file(
+ datasource_id="datasource_id",
+ file=Path("/path/to/file"),
+)
+```
+
+The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
+
## Handling errors
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `asktable.APIConnectionError` is raised.
diff --git a/src/asktable/_files.py b/src/asktable/_files.py
index 715cc207..25ff804f 100644
--- a/src/asktable/_files.py
+++ b/src/asktable/_files.py
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
if not is_file_content(obj):
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
raise RuntimeError(
- f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
+ f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/DataMini/asktable-python/tree/main#file-uploads"
) from None
From 153f86b5c5c0099edc9b0622ebe36553b653e8ca Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 21 Feb 2025 03:30:03 +0000
Subject: [PATCH 17/32] feat(client): allow passing `NotGiven` for body (#155)
fix(client): mark some request bodies as optional
---
src/asktable/_base_client.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py
index 170d22fa..b3e31d57 100644
--- a/src/asktable/_base_client.py
+++ b/src/asktable/_base_client.py
@@ -518,7 +518,7 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
- json=json_data,
+ json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)
From 944423e7d0c69dcf0a54141ce69127db2369b247 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 22 Feb 2025 03:08:47 +0000
Subject: [PATCH 18/32] chore(internal): fix devcontainers setup (#156)
---
.devcontainer/Dockerfile | 2 +-
.devcontainer/devcontainer.json | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index ac9a2e75..55d20255 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -6,4 +6,4 @@ USER vscode
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH
-RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc
+RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index bbeb30b1..c17fdc16 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -24,6 +24,9 @@
}
}
}
+ },
+ "features": {
+ "ghcr.io/devcontainers/features/node:1": {}
}
// Features to add to the dev container. More info: https://containers.dev/features.
From 30a260f78f2b32e82467afe05703e2f8aa88fc68 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 26 Feb 2025 03:01:44 +0000
Subject: [PATCH 19/32] chore(internal): properly set __pydantic_private__
(#157)
---
src/asktable/_base_client.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py
index b3e31d57..a7b0b6ea 100644
--- a/src/asktable/_base_client.py
+++ b/src/asktable/_base_client.py
@@ -63,7 +63,7 @@
ModelBuilderProtocol,
)
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
-from ._compat import model_copy, model_dump
+from ._compat import PYDANTIC_V2, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
@@ -207,6 +207,9 @@ def _set_private_attributes(
model: Type[_T],
options: FinalRequestOptions,
) -> None:
+ if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
+ self.__pydantic_private__ = {}
+
self._model = model
self._client = client
self._options = options
@@ -292,6 +295,9 @@ def _set_private_attributes(
client: AsyncAPIClient,
options: FinalRequestOptions,
) -> None:
+ if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
+ self.__pydantic_private__ = {}
+
self._model = model
self._client = client
self._options = options
From a8ee0e203076b01180be2c164174a469c2f444ef Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 28 Feb 2025 03:02:08 +0000
Subject: [PATCH 20/32] docs: update URLs from stainlessapi.com to
stainless.com (#158)
More details at https://www.stainless.com/changelog/stainless-com
---
README.md | 2 +-
SECURITY.md | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index bf0709d3..55c15c5a 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ The Asktable Python library provides convenient access to the Asktable REST API
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
-It is generated with [Stainless](https://www.stainlessapi.com/).
+It is generated with [Stainless](https://www.stainless.com/).
## Documentation
diff --git a/SECURITY.md b/SECURITY.md
index d5013e3a..6cf7553c 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -2,9 +2,9 @@
## Reporting Security Issues
-This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
+This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
-To report a security issue, please contact the Stainless team at security@stainlessapi.com.
+To report a security issue, please contact the Stainless team at security@stainless.com.
## Responsible Disclosure
From 5a0da4dd6288d7d55b7b2d4585b12e876d384423 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 28 Feb 2025 03:02:58 +0000
Subject: [PATCH 21/32] chore(docs): update client docstring (#159)
---
src/asktable/_client.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/asktable/_client.py b/src/asktable/_client.py
index 6f5676d5..51d4026a 100644
--- a/src/asktable/_client.py
+++ b/src/asktable/_client.py
@@ -314,7 +314,7 @@ def __init__(
# part of our public interface in the future.
_strict_response_validation: bool = False,
) -> None:
- """Construct a new async Asktable client instance.
+ """Construct a new async AsyncAsktable client instance.
This automatically infers the `api_key` argument from the `ASKTABLE_API_KEY` environment variable if it is not provided.
"""
From 298eb9ca830efd80ca27e868a0081ff4822dc2db Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 4 Mar 2025 03:12:58 +0000
Subject: [PATCH 22/32] chore(internal): remove unused http client options
forwarding (#160)
---
src/asktable/_base_client.py | 97 +-----------------------------------
1 file changed, 1 insertion(+), 96 deletions(-)
diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py
index a7b0b6ea..b43d29e9 100644
--- a/src/asktable/_base_client.py
+++ b/src/asktable/_base_client.py
@@ -9,7 +9,6 @@
import inspect
import logging
import platform
-import warnings
import email.utils
from types import TracebackType
from random import random
@@ -36,7 +35,7 @@
import httpx
import distro
import pydantic
-from httpx import URL, Limits
+from httpx import URL
from pydantic import PrivateAttr
from . import _exceptions
@@ -51,13 +50,10 @@
Timeout,
NotGiven,
ResponseT,
- Transport,
AnyMapping,
PostParser,
- ProxiesTypes,
RequestFiles,
HttpxSendArgs,
- AsyncTransport,
RequestOptions,
HttpxRequestFiles,
ModelBuilderProtocol,
@@ -337,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
_base_url: URL
max_retries: int
timeout: Union[float, Timeout, None]
- _limits: httpx.Limits
- _proxies: ProxiesTypes | None
- _transport: Transport | AsyncTransport | None
_strict_response_validation: bool
_idempotency_header: str | None
_default_stream_cls: type[_DefaultStreamT] | None = None
@@ -352,9 +345,6 @@ def __init__(
_strict_response_validation: bool,
max_retries: int = DEFAULT_MAX_RETRIES,
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
- limits: httpx.Limits,
- transport: Transport | AsyncTransport | None,
- proxies: ProxiesTypes | None,
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
) -> None:
@@ -362,9 +352,6 @@ def __init__(
self._base_url = self._enforce_trailing_slash(URL(base_url))
self.max_retries = max_retries
self.timeout = timeout
- self._limits = limits
- self._proxies = proxies
- self._transport = transport
self._custom_headers = custom_headers or {}
self._custom_query = custom_query or {}
self._strict_response_validation = _strict_response_validation
@@ -800,46 +787,11 @@ def __init__(
base_url: str | URL,
max_retries: int = DEFAULT_MAX_RETRIES,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
- transport: Transport | None = None,
- proxies: ProxiesTypes | None = None,
- limits: Limits | None = None,
http_client: httpx.Client | None = None,
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
_strict_response_validation: bool,
) -> None:
- kwargs: dict[str, Any] = {}
- if limits is not None:
- warnings.warn(
- "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
- category=DeprecationWarning,
- stacklevel=3,
- )
- if http_client is not None:
- raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
- else:
- limits = DEFAULT_CONNECTION_LIMITS
-
- if transport is not None:
- kwargs["transport"] = transport
- warnings.warn(
- "The `transport` argument is deprecated. The `http_client` argument should be passed instead",
- category=DeprecationWarning,
- stacklevel=3,
- )
- if http_client is not None:
- raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
-
- if proxies is not None:
- kwargs["proxies"] = proxies
- warnings.warn(
- "The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
- category=DeprecationWarning,
- stacklevel=3,
- )
- if http_client is not None:
- raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
-
if not is_given(timeout):
# if the user passed in a custom http client with a non-default
# timeout set then we use that timeout.
@@ -860,12 +812,9 @@ def __init__(
super().__init__(
version=version,
- limits=limits,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
- proxies=proxies,
base_url=base_url,
- transport=transport,
max_retries=max_retries,
custom_query=custom_query,
custom_headers=custom_headers,
@@ -875,9 +824,6 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
- limits=limits,
- follow_redirects=True,
- **kwargs, # type: ignore
)
def is_closed(self) -> bool:
@@ -1372,45 +1318,10 @@ def __init__(
_strict_response_validation: bool,
max_retries: int = DEFAULT_MAX_RETRIES,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
- transport: AsyncTransport | None = None,
- proxies: ProxiesTypes | None = None,
- limits: Limits | None = None,
http_client: httpx.AsyncClient | None = None,
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
) -> None:
- kwargs: dict[str, Any] = {}
- if limits is not None:
- warnings.warn(
- "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
- category=DeprecationWarning,
- stacklevel=3,
- )
- if http_client is not None:
- raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
- else:
- limits = DEFAULT_CONNECTION_LIMITS
-
- if transport is not None:
- kwargs["transport"] = transport
- warnings.warn(
- "The `transport` argument is deprecated. The `http_client` argument should be passed instead",
- category=DeprecationWarning,
- stacklevel=3,
- )
- if http_client is not None:
- raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
-
- if proxies is not None:
- kwargs["proxies"] = proxies
- warnings.warn(
- "The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
- category=DeprecationWarning,
- stacklevel=3,
- )
- if http_client is not None:
- raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
-
if not is_given(timeout):
# if the user passed in a custom http client with a non-default
# timeout set then we use that timeout.
@@ -1432,11 +1343,8 @@ def __init__(
super().__init__(
version=version,
base_url=base_url,
- limits=limits,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
- proxies=proxies,
- transport=transport,
max_retries=max_retries,
custom_query=custom_query,
custom_headers=custom_headers,
@@ -1446,9 +1354,6 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
- limits=limits,
- follow_redirects=True,
- **kwargs, # type: ignore
)
def is_closed(self) -> bool:
From c4a4e34b3ddc3a19aac34cd4f167af53e2665933 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 11 Mar 2025 05:02:35 +0000
Subject: [PATCH 23/32] docs: revise readme docs about nested params (#161)
---
README.md | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/README.md b/README.md
index 55c15c5a..84a1c27b 100644
--- a/README.md
+++ b/README.md
@@ -134,6 +134,25 @@ for datasource in first_page.items:
# Remove `await` for non-async usage.
```
+## Nested params
+
+Nested parameters are dictionaries, typed using `TypedDict`, for example:
+
+```python
+from asktable import Asktable
+
+client = Asktable()
+
+response = client.sys.projects.api_keys.create_token(
+ project_id="project_id",
+ chat_role={
+ "role_id": "1",
+ "role_variables": {"id": "42"},
+ },
+)
+print(response.chat_role)
+```
+
## File uploads
Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
From ab64143d11d1b231905bd3c4a547e21bac558706 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 11 Mar 2025 05:31:45 +0000
Subject: [PATCH 24/32] test: add DEFER_PYDANTIC_BUILD=false flag to tests
(#162)
---
scripts/test | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/test b/scripts/test
index 4fa5698b..2b878456 100755
--- a/scripts/test
+++ b/scripts/test
@@ -52,6 +52,8 @@ else
echo
fi
+export DEFER_PYDANTIC_BUILD=false
+
echo "==> Running tests"
rye run pytest "$@"
From d8b30cec54b715e20a90de84a4a3393a0b556c33 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 14 Mar 2025 03:56:48 +0000
Subject: [PATCH 25/32] chore(internal): remove extra empty newlines (#163)
---
pyproject.toml | 2 --
1 file changed, 2 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 0df568bc..55087c0a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -38,7 +38,6 @@ Homepage = "https://github.com/DataMini/asktable-python"
Repository = "https://github.com/DataMini/asktable-python"
-
[tool.rye]
managed = true
# version pins are in requirements-dev.lock
@@ -152,7 +151,6 @@ reportImplicitOverride = true
reportImportCycles = false
reportPrivateUsage = false
-
[tool.ruff]
line-length = 120
output-format = "grouped"
From 1cb390324e6894374519e8062b446873d138cde0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 03:17:48 +0000
Subject: [PATCH 26/32] chore(internal): codegen related update (#164)
---
requirements-dev.lock | 1 +
requirements.lock | 1 +
2 files changed, 2 insertions(+)
diff --git a/requirements-dev.lock b/requirements-dev.lock
index ee4ad5a8..a151188f 100644
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@ -7,6 +7,7 @@
# all-features: true
# with-sources: false
# generate-hashes: false
+# universal: false
-e file:.
annotated-types==0.6.0
diff --git a/requirements.lock b/requirements.lock
index 2cd112f9..fe5769b4 100644
--- a/requirements.lock
+++ b/requirements.lock
@@ -7,6 +7,7 @@
# all-features: true
# with-sources: false
# generate-hashes: false
+# universal: false
-e file:.
annotated-types==0.6.0
From 5ead610c43bcde3e61ec6e2e6e4fd892be1f4e59 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 03:23:09 +0000
Subject: [PATCH 27/32] chore(internal): bump rye to 0.44.0 (#165)
---
.devcontainer/Dockerfile | 2 +-
.github/workflows/ci.yml | 4 ++--
.github/workflows/publish-pypi.yml | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 55d20255..ff261bad 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
USER vscode
-RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
+RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c8a8a4f7..3b286e5a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
- RYE_VERSION: '0.35.0'
+ RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install dependencies
@@ -42,7 +42,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
- RYE_VERSION: '0.35.0'
+ RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Bootstrap
diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml
index f501f43e..188841d6 100644
--- a/.github/workflows/publish-pypi.yml
+++ b/.github/workflows/publish-pypi.yml
@@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
- RYE_VERSION: '0.35.0'
+ RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Publish to PyPI
From 850d425cf365d48cc9f7a41d09d295e8547befdf Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 03:30:16 +0000
Subject: [PATCH 28/32] fix(types): handle more discriminated union shapes
(#166)
---
src/asktable/_models.py | 7 +++++--
tests/test_models.py | 32 ++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/asktable/_models.py b/src/asktable/_models.py
index c4401ff8..b51a1bf5 100644
--- a/src/asktable/_models.py
+++ b/src/asktable/_models.py
@@ -65,7 +65,7 @@
from ._constants import RAW_RESPONSE_HEADER
if TYPE_CHECKING:
- from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
+ from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
__all__ = ["BaseModel", "GenericModel"]
@@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
schema = model.__pydantic_core_schema__
+ if schema["type"] == "definitions":
+ schema = schema["schema"]
+
if schema["type"] != "model":
return None
+ schema = cast("ModelSchema", schema)
fields_schema = schema["schema"]
if fields_schema["type"] != "model-fields":
return None
fields_schema = cast("ModelFieldsSchema", fields_schema)
-
field = fields_schema["fields"].get(field_name)
if not field:
return None
diff --git a/tests/test_models.py b/tests/test_models.py
index 0a584a88..89906cad 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -854,3 +854,35 @@ class Model(BaseModel):
m = construct_type(value={"cls": "foo"}, type_=Model)
assert isinstance(m, Model)
assert isinstance(m.cls, str)
+
+
+def test_discriminated_union_case() -> None:
+ class A(BaseModel):
+ type: Literal["a"]
+
+ data: bool
+
+ class B(BaseModel):
+ type: Literal["b"]
+
+ data: List[Union[A, object]]
+
+ class ModelA(BaseModel):
+ type: Literal["modelA"]
+
+ data: int
+
+ class ModelB(BaseModel):
+ type: Literal["modelB"]
+
+ required: str
+
+ data: Union[A, B]
+
+ # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required`
+ m = construct_type(
+ value={"type": "modelB", "data": {"type": "a", "data": True}},
+ type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]),
+ )
+
+ assert isinstance(m, ModelB)
From 06c63d292a5278295e93c4d7a65cf25b02234e2b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:02:52 +0000
Subject: [PATCH 29/32] feat(api): manual updates (#167)
---
.stats.yml | 2 +-
api.md | 34 +++-
src/asktable/_client.py | 18 ++
src/asktable/resources/__init__.py | 28 +++
src/asktable/resources/chats/chats.py | 105 ++++++++++-
src/asktable/resources/dataframes.py | 163 ++++++++++++++++++
src/asktable/resources/files.py | 162 +++++++++++++++++
src/asktable/types/__init__.py | 3 +
.../types/chat_post_message_params.py | 11 ++
.../types/chat_post_message_response.py | 12 ++
.../types/dataframe_retrieve_response.py | 43 +++++
tests/api_resources/test_chats.py | 90 +++++++++-
tests/api_resources/test_dataframes.py | 98 +++++++++++
tests/api_resources/test_files.py | 97 +++++++++++
14 files changed, 861 insertions(+), 5 deletions(-)
create mode 100644 src/asktable/resources/dataframes.py
create mode 100644 src/asktable/resources/files.py
create mode 100644 src/asktable/types/chat_post_message_params.py
create mode 100644 src/asktable/types/chat_post_message_response.py
create mode 100644 src/asktable/types/dataframe_retrieve_response.py
create mode 100644 tests/api_resources/test_dataframes.py
create mode 100644 tests/api_resources/test_files.py
diff --git a/.stats.yml b/.stats.yml
index ce6172aa..751b9da1 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 91
+configured_endpoints: 94
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2d9923ffe6d2d59041bac841db518829933a84e3251a372c9ad2306473fd7488.yml
diff --git a/api.md b/api.md
index 40b6f666..3c766c34 100644
--- a/api.md
+++ b/api.md
@@ -103,7 +103,14 @@ Methods:
Types:
```python
-from asktable.types import AIMessage, Chat, ToolMessage, UserMessage, ChatRetrieveResponse
+from asktable.types import (
+ AIMessage,
+ Chat,
+ ToolMessage,
+ UserMessage,
+ ChatRetrieveResponse,
+ ChatPostMessageResponse,
+)
```
Methods:
@@ -112,6 +119,7 @@ Methods:
- client.chats.retrieve(chat_id) -> ChatRetrieveResponse
- client.chats.list(\*\*params) -> SyncPage[Chat]
- client.chats.delete(chat_id) -> None
+- client.chats.post_message(chat_id, \*\*params) -> ChatPostMessageResponse
## Messages
@@ -381,3 +389,27 @@ from asktable.types import ScoreCreateResponse
Methods:
- client.scores.create(\*\*params) -> ScoreCreateResponse
+
+# Files
+
+Types:
+
+```python
+from asktable.types import FileRetrieveResponse
+```
+
+Methods:
+
+- client.files.retrieve(file_id) -> object
+
+# Dataframes
+
+Types:
+
+```python
+from asktable.types import DataframeRetrieveResponse
+```
+
+Methods:
+
+- client.dataframes.retrieve(dataframe_id) -> DataframeRetrieveResponse
diff --git a/src/asktable/_client.py b/src/asktable/_client.py
index 51d4026a..1569ca30 100644
--- a/src/asktable/_client.py
+++ b/src/asktable/_client.py
@@ -28,6 +28,7 @@
auth,
bots,
sqls,
+ files,
roles,
caches,
scores,
@@ -35,6 +36,7 @@
project,
policies,
trainings,
+ dataframes,
integration,
preferences,
securetunnels,
@@ -83,6 +85,8 @@ class Asktable(SyncAPIClient):
trainings: trainings.TrainingsResource
project: project.ProjectResource
scores: scores.ScoresResource
+ files: files.FilesResource
+ dataframes: dataframes.DataframesResource
with_raw_response: AsktableWithRawResponse
with_streaming_response: AsktableWithStreamedResponse
@@ -158,6 +162,8 @@ def __init__(
self.trainings = trainings.TrainingsResource(self)
self.project = project.ProjectResource(self)
self.scores = scores.ScoresResource(self)
+ self.files = files.FilesResource(self)
+ self.dataframes = dataframes.DataframesResource(self)
self.with_raw_response = AsktableWithRawResponse(self)
self.with_streaming_response = AsktableWithStreamedResponse(self)
@@ -285,6 +291,8 @@ class AsyncAsktable(AsyncAPIClient):
trainings: trainings.AsyncTrainingsResource
project: project.AsyncProjectResource
scores: scores.AsyncScoresResource
+ files: files.AsyncFilesResource
+ dataframes: dataframes.AsyncDataframesResource
with_raw_response: AsyncAsktableWithRawResponse
with_streaming_response: AsyncAsktableWithStreamedResponse
@@ -360,6 +368,8 @@ def __init__(
self.trainings = trainings.AsyncTrainingsResource(self)
self.project = project.AsyncProjectResource(self)
self.scores = scores.AsyncScoresResource(self)
+ self.files = files.AsyncFilesResource(self)
+ self.dataframes = dataframes.AsyncDataframesResource(self)
self.with_raw_response = AsyncAsktableWithRawResponse(self)
self.with_streaming_response = AsyncAsktableWithStreamedResponse(self)
@@ -488,6 +498,8 @@ def __init__(self, client: Asktable) -> None:
self.trainings = trainings.TrainingsResourceWithRawResponse(client.trainings)
self.project = project.ProjectResourceWithRawResponse(client.project)
self.scores = scores.ScoresResourceWithRawResponse(client.scores)
+ self.files = files.FilesResourceWithRawResponse(client.files)
+ self.dataframes = dataframes.DataframesResourceWithRawResponse(client.dataframes)
class AsyncAsktableWithRawResponse:
@@ -512,6 +524,8 @@ def __init__(self, client: AsyncAsktable) -> None:
self.trainings = trainings.AsyncTrainingsResourceWithRawResponse(client.trainings)
self.project = project.AsyncProjectResourceWithRawResponse(client.project)
self.scores = scores.AsyncScoresResourceWithRawResponse(client.scores)
+ self.files = files.AsyncFilesResourceWithRawResponse(client.files)
+ self.dataframes = dataframes.AsyncDataframesResourceWithRawResponse(client.dataframes)
class AsktableWithStreamedResponse:
@@ -536,6 +550,8 @@ def __init__(self, client: Asktable) -> None:
self.trainings = trainings.TrainingsResourceWithStreamingResponse(client.trainings)
self.project = project.ProjectResourceWithStreamingResponse(client.project)
self.scores = scores.ScoresResourceWithStreamingResponse(client.scores)
+ self.files = files.FilesResourceWithStreamingResponse(client.files)
+ self.dataframes = dataframes.DataframesResourceWithStreamingResponse(client.dataframes)
class AsyncAsktableWithStreamedResponse:
@@ -560,6 +576,8 @@ def __init__(self, client: AsyncAsktable) -> None:
self.trainings = trainings.AsyncTrainingsResourceWithStreamingResponse(client.trainings)
self.project = project.AsyncProjectResourceWithStreamingResponse(client.project)
self.scores = scores.AsyncScoresResourceWithStreamingResponse(client.scores)
+ self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
+ self.dataframes = dataframes.AsyncDataframesResourceWithStreamingResponse(client.dataframes)
Client = Asktable
diff --git a/src/asktable/resources/__init__.py b/src/asktable/resources/__init__.py
index 44456326..45e0bfb5 100644
--- a/src/asktable/resources/__init__.py
+++ b/src/asktable/resources/__init__.py
@@ -40,6 +40,14 @@
ChatsResourceWithStreamingResponse,
AsyncChatsResourceWithStreamingResponse,
)
+from .files import (
+ FilesResource,
+ AsyncFilesResource,
+ FilesResourceWithRawResponse,
+ AsyncFilesResourceWithRawResponse,
+ FilesResourceWithStreamingResponse,
+ AsyncFilesResourceWithStreamingResponse,
+)
from .roles import (
RolesResource,
AsyncRolesResource,
@@ -104,6 +112,14 @@
TrainingsResourceWithStreamingResponse,
AsyncTrainingsResourceWithStreamingResponse,
)
+from .dataframes import (
+ DataframesResource,
+ AsyncDataframesResource,
+ DataframesResourceWithRawResponse,
+ AsyncDataframesResourceWithRawResponse,
+ DataframesResourceWithStreamingResponse,
+ AsyncDataframesResourceWithStreamingResponse,
+)
from .datasources import (
DatasourcesResource,
AsyncDatasourcesResource,
@@ -254,4 +270,16 @@
"AsyncScoresResourceWithRawResponse",
"ScoresResourceWithStreamingResponse",
"AsyncScoresResourceWithStreamingResponse",
+ "FilesResource",
+ "AsyncFilesResource",
+ "FilesResourceWithRawResponse",
+ "AsyncFilesResourceWithRawResponse",
+ "FilesResourceWithStreamingResponse",
+ "AsyncFilesResourceWithStreamingResponse",
+ "DataframesResource",
+ "AsyncDataframesResource",
+ "DataframesResourceWithRawResponse",
+ "AsyncDataframesResourceWithRawResponse",
+ "DataframesResourceWithStreamingResponse",
+ "AsyncDataframesResourceWithStreamingResponse",
]
diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py
index a20f13ad..d974eeb4 100644
--- a/src/asktable/resources/chats/chats.py
+++ b/src/asktable/resources/chats/chats.py
@@ -2,11 +2,11 @@
from __future__ import annotations
-from typing import Dict, Union, Optional
+from typing import Any, Dict, Union, Optional, cast
import httpx
-from ...types import chat_list_params, chat_create_params
+from ...types import chat_list_params, chat_create_params, chat_post_message_params
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ..._utils import (
maybe_transform,
@@ -32,6 +32,7 @@
from ...types.chat import Chat
from ..._base_client import AsyncPaginator, make_request_options
from ...types.chat_retrieve_response import ChatRetrieveResponse
+from ...types.chat_post_message_response import ChatPostMessageResponse
__all__ = ["ChatsResource", "AsyncChatsResource"]
@@ -231,6 +232,49 @@ def delete(
cast_to=NoneType,
)
+ def post_message(
+ self,
+ chat_id: str,
+ *,
+ question: str,
+ # 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> ChatPostMessageResponse:
+ """
+ 发消息
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not chat_id:
+ raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
+ return cast(
+ ChatPostMessageResponse,
+ self._post(
+ f"/chats/{chat_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform({"question": question}, chat_post_message_params.ChatPostMessageParams),
+ ),
+ cast_to=cast(
+ Any, ChatPostMessageResponse
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
class AsyncChatsResource(AsyncAPIResource):
@cached_property
@@ -427,6 +471,51 @@ async def delete(
cast_to=NoneType,
)
+ async def post_message(
+ self,
+ chat_id: str,
+ *,
+ question: str,
+ # 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> ChatPostMessageResponse:
+ """
+ 发消息
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not chat_id:
+ raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
+ return cast(
+ ChatPostMessageResponse,
+ await self._post(
+ f"/chats/{chat_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {"question": question}, chat_post_message_params.ChatPostMessageParams
+ ),
+ ),
+ cast_to=cast(
+ Any, ChatPostMessageResponse
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
class ChatsResourceWithRawResponse:
def __init__(self, chats: ChatsResource) -> None:
@@ -444,6 +533,9 @@ def __init__(self, chats: ChatsResource) -> None:
self.delete = to_raw_response_wrapper(
chats.delete,
)
+ self.post_message = to_raw_response_wrapper(
+ chats.post_message,
+ )
@cached_property
def messages(self) -> MessagesResourceWithRawResponse:
@@ -466,6 +558,9 @@ def __init__(self, chats: AsyncChatsResource) -> None:
self.delete = async_to_raw_response_wrapper(
chats.delete,
)
+ self.post_message = async_to_raw_response_wrapper(
+ chats.post_message,
+ )
@cached_property
def messages(self) -> AsyncMessagesResourceWithRawResponse:
@@ -488,6 +583,9 @@ def __init__(self, chats: ChatsResource) -> None:
self.delete = to_streamed_response_wrapper(
chats.delete,
)
+ self.post_message = to_streamed_response_wrapper(
+ chats.post_message,
+ )
@cached_property
def messages(self) -> MessagesResourceWithStreamingResponse:
@@ -510,6 +608,9 @@ def __init__(self, chats: AsyncChatsResource) -> None:
self.delete = async_to_streamed_response_wrapper(
chats.delete,
)
+ self.post_message = async_to_streamed_response_wrapper(
+ chats.post_message,
+ )
@cached_property
def messages(self) -> AsyncMessagesResourceWithStreamingResponse:
diff --git a/src/asktable/resources/dataframes.py b/src/asktable/resources/dataframes.py
new file mode 100644
index 00000000..8f0953c3
--- /dev/null
+++ b/src/asktable/resources/dataframes.py
@@ -0,0 +1,163 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.dataframe_retrieve_response import DataframeRetrieveResponse
+
+__all__ = ["DataframesResource", "AsyncDataframesResource"]
+
+
+class DataframesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> DataframesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
+ """
+ return DataframesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> DataframesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response
+ """
+ return DataframesResourceWithStreamingResponse(self)
+
+ def retrieve(
+ self,
+ dataframe_id: str,
+ *,
+ # 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> DataframeRetrieveResponse:
+ """
+ Get Dataframe
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not dataframe_id:
+ raise ValueError(f"Expected a non-empty value for `dataframe_id` but received {dataframe_id!r}")
+ return self._get(
+ f"/dataframes/{dataframe_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataframeRetrieveResponse,
+ )
+
+
+class AsyncDataframesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncDataframesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncDataframesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncDataframesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response
+ """
+ return AsyncDataframesResourceWithStreamingResponse(self)
+
+ async def retrieve(
+ self,
+ dataframe_id: str,
+ *,
+ # 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> DataframeRetrieveResponse:
+ """
+ Get Dataframe
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not dataframe_id:
+ raise ValueError(f"Expected a non-empty value for `dataframe_id` but received {dataframe_id!r}")
+ return await self._get(
+ f"/dataframes/{dataframe_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataframeRetrieveResponse,
+ )
+
+
+class DataframesResourceWithRawResponse:
+ def __init__(self, dataframes: DataframesResource) -> None:
+ self._dataframes = dataframes
+
+ self.retrieve = to_raw_response_wrapper(
+ dataframes.retrieve,
+ )
+
+
+class AsyncDataframesResourceWithRawResponse:
+ def __init__(self, dataframes: AsyncDataframesResource) -> None:
+ self._dataframes = dataframes
+
+ self.retrieve = async_to_raw_response_wrapper(
+ dataframes.retrieve,
+ )
+
+
+class DataframesResourceWithStreamingResponse:
+ def __init__(self, dataframes: DataframesResource) -> None:
+ self._dataframes = dataframes
+
+ self.retrieve = to_streamed_response_wrapper(
+ dataframes.retrieve,
+ )
+
+
+class AsyncDataframesResourceWithStreamingResponse:
+ def __init__(self, dataframes: AsyncDataframesResource) -> None:
+ self._dataframes = dataframes
+
+ self.retrieve = async_to_streamed_response_wrapper(
+ dataframes.retrieve,
+ )
diff --git a/src/asktable/resources/files.py b/src/asktable/resources/files.py
new file mode 100644
index 00000000..b3a6261c
--- /dev/null
+++ b/src/asktable/resources/files.py
@@ -0,0 +1,162 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+
+__all__ = ["FilesResource", "AsyncFilesResource"]
+
+
+class FilesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> FilesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
+ """
+ return FilesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> FilesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response
+ """
+ return FilesResourceWithStreamingResponse(self)
+
+ def retrieve(
+ self,
+ file_id: str,
+ *,
+ # 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> object:
+ """
+ 获取文件
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not file_id:
+ raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
+ return self._get(
+ f"/files/{file_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=object,
+ )
+
+
+class AsyncFilesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncFilesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncFilesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response
+ """
+ return AsyncFilesResourceWithStreamingResponse(self)
+
+ async def retrieve(
+ self,
+ file_id: str,
+ *,
+ # 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> object:
+ """
+ 获取文件
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not file_id:
+ raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
+ return await self._get(
+ f"/files/{file_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=object,
+ )
+
+
+class FilesResourceWithRawResponse:
+ def __init__(self, files: FilesResource) -> None:
+ self._files = files
+
+ self.retrieve = to_raw_response_wrapper(
+ files.retrieve,
+ )
+
+
+class AsyncFilesResourceWithRawResponse:
+ def __init__(self, files: AsyncFilesResource) -> None:
+ self._files = files
+
+ self.retrieve = async_to_raw_response_wrapper(
+ files.retrieve,
+ )
+
+
+class FilesResourceWithStreamingResponse:
+ def __init__(self, files: FilesResource) -> None:
+ self._files = files
+
+ self.retrieve = to_streamed_response_wrapper(
+ files.retrieve,
+ )
+
+
+class AsyncFilesResourceWithStreamingResponse:
+ def __init__(self, files: AsyncFilesResource) -> None:
+ self._files = files
+
+ self.retrieve = async_to_streamed_response_wrapper(
+ files.retrieve,
+ )
diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py
index 8cd2bd96..6b15da69 100644
--- a/src/asktable/types/__init__.py
+++ b/src/asktable/types/__init__.py
@@ -48,6 +48,7 @@
from .training_delete_params import TrainingDeleteParams as TrainingDeleteParams
from .training_list_response import TrainingListResponse as TrainingListResponse
from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams
+from .chat_post_message_params import ChatPostMessageParams as ChatPostMessageParams
from .datasource_create_params import DatasourceCreateParams as DatasourceCreateParams
from .datasource_update_params import DatasourceUpdateParams as DatasourceUpdateParams
from .preference_create_params import PreferenceCreateParams as PreferenceCreateParams
@@ -56,11 +57,13 @@
from .training_create_response import TrainingCreateResponse as TrainingCreateResponse
from .role_get_polices_response import RoleGetPolicesResponse as RoleGetPolicesResponse
from .role_get_variables_params import RoleGetVariablesParams as RoleGetVariablesParams
+from .chat_post_message_response import ChatPostMessageResponse as ChatPostMessageResponse
from .datasource_add_file_params import DatasourceAddFileParams as DatasourceAddFileParams
from .preference_create_response import PreferenceCreateResponse as PreferenceCreateResponse
from .preference_update_response import PreferenceUpdateResponse as PreferenceUpdateResponse
from .securetunnel_create_params import SecuretunnelCreateParams as SecuretunnelCreateParams
from .securetunnel_update_params import SecuretunnelUpdateParams as SecuretunnelUpdateParams
+from .dataframe_retrieve_response import DataframeRetrieveResponse as DataframeRetrieveResponse
from .datasource_retrieve_response import DatasourceRetrieveResponse as DatasourceRetrieveResponse
from .preference_retrieve_response import PreferenceRetrieveResponse as PreferenceRetrieveResponse
from .business_glossary_list_params import BusinessGlossaryListParams as BusinessGlossaryListParams
diff --git a/src/asktable/types/chat_post_message_params.py b/src/asktable/types/chat_post_message_params.py
new file mode 100644
index 00000000..31a7464d
--- /dev/null
+++ b/src/asktable/types/chat_post_message_params.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["ChatPostMessageParams"]
+
+
+class ChatPostMessageParams(TypedDict, total=False):
+ question: Required[str]
diff --git a/src/asktable/types/chat_post_message_response.py b/src/asktable/types/chat_post_message_response.py
new file mode 100644
index 00000000..fb2c48a6
--- /dev/null
+++ b/src/asktable/types/chat_post_message_response.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union
+from typing_extensions import TypeAlias
+
+from .ai_message import AIMessage
+from .tool_message import ToolMessage
+from .user_message import UserMessage
+
+__all__ = ["ChatPostMessageResponse"]
+
+ChatPostMessageResponse: TypeAlias = Union[UserMessage, AIMessage, ToolMessage]
diff --git a/src/asktable/types/dataframe_retrieve_response.py b/src/asktable/types/dataframe_retrieve_response.py
new file mode 100644
index 00000000..75cdbde6
--- /dev/null
+++ b/src/asktable/types/dataframe_retrieve_response.py
@@ -0,0 +1,43 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+from datetime import datetime
+
+from .._models import BaseModel
+
+__all__ = ["DataframeRetrieveResponse"]
+
+
+class DataframeRetrieveResponse(BaseModel):
+ id: str
+ """ID"""
+
+ chart_options: object
+ """图表选项"""
+
+ content: List[object]
+ """内容"""
+
+ created_at: datetime
+ """创建时间"""
+
+ header: List[object]
+ """表头"""
+
+ modified_at: datetime
+ """更新时间"""
+
+ msg_id: str
+ """消息 ID"""
+
+ project_id: str
+ """项目 ID"""
+
+ row_count: int
+ """行数"""
+
+ sql: str
+ """SQL"""
+
+ title: str
+ """标题"""
diff --git a/tests/api_resources/test_chats.py b/tests/api_resources/test_chats.py
index 5a84e9da..662e2035 100644
--- a/tests/api_resources/test_chats.py
+++ b/tests/api_resources/test_chats.py
@@ -9,7 +9,11 @@
from asktable import Asktable, AsyncAsktable
from tests.utils import assert_matches_type
-from asktable.types import Chat, ChatRetrieveResponse
+from asktable.types import (
+ Chat,
+ ChatRetrieveResponse,
+ ChatPostMessageResponse,
+)
from asktable.pagination import SyncPage, AsyncPage
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -167,6 +171,48 @@ def test_path_params_delete(self, client: Asktable) -> None:
"",
)
+ @parametrize
+ def test_method_post_message(self, client: Asktable) -> None:
+ chat = client.chats.post_message(
+ chat_id="chat_id",
+ question="question",
+ )
+ assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
+
+ @parametrize
+ def test_raw_response_post_message(self, client: Asktable) -> None:
+ response = client.chats.with_raw_response.post_message(
+ chat_id="chat_id",
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ chat = response.parse()
+ assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
+
+ @parametrize
+ def test_streaming_response_post_message(self, client: Asktable) -> None:
+ with client.chats.with_streaming_response.post_message(
+ chat_id="chat_id",
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ chat = response.parse()
+ assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_post_message(self, client: Asktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"):
+ client.chats.with_raw_response.post_message(
+ chat_id="",
+ question="question",
+ )
+
class TestAsyncChats:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -319,3 +365,45 @@ async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
await async_client.chats.with_raw_response.delete(
"",
)
+
+ @parametrize
+ async def test_method_post_message(self, async_client: AsyncAsktable) -> None:
+ chat = await async_client.chats.post_message(
+ chat_id="chat_id",
+ question="question",
+ )
+ assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
+
+ @parametrize
+ async def test_raw_response_post_message(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.chats.with_raw_response.post_message(
+ chat_id="chat_id",
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ chat = await response.parse()
+ assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_post_message(self, async_client: AsyncAsktable) -> None:
+ async with async_client.chats.with_streaming_response.post_message(
+ chat_id="chat_id",
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ chat = await response.parse()
+ assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_post_message(self, async_client: AsyncAsktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"):
+ await async_client.chats.with_raw_response.post_message(
+ chat_id="",
+ question="question",
+ )
diff --git a/tests/api_resources/test_dataframes.py b/tests/api_resources/test_dataframes.py
new file mode 100644
index 00000000..8e71063a
--- /dev/null
+++ b/tests/api_resources/test_dataframes.py
@@ -0,0 +1,98 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from asktable import Asktable, AsyncAsktable
+from tests.utils import assert_matches_type
+from asktable.types import DataframeRetrieveResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestDataframes:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_retrieve(self, client: Asktable) -> None:
+ dataframe = client.dataframes.retrieve(
+ "dataframe_id",
+ )
+ assert_matches_type(DataframeRetrieveResponse, dataframe, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve(self, client: Asktable) -> None:
+ response = client.dataframes.with_raw_response.retrieve(
+ "dataframe_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ dataframe = response.parse()
+ assert_matches_type(DataframeRetrieveResponse, dataframe, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve(self, client: Asktable) -> None:
+ with client.dataframes.with_streaming_response.retrieve(
+ "dataframe_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ dataframe = response.parse()
+ assert_matches_type(DataframeRetrieveResponse, dataframe, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_retrieve(self, client: Asktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataframe_id` but received ''"):
+ client.dataframes.with_raw_response.retrieve(
+ "",
+ )
+
+
+class TestAsyncDataframes:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncAsktable) -> None:
+ dataframe = await async_client.dataframes.retrieve(
+ "dataframe_id",
+ )
+ assert_matches_type(DataframeRetrieveResponse, dataframe, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.dataframes.with_raw_response.retrieve(
+ "dataframe_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ dataframe = await response.parse()
+ assert_matches_type(DataframeRetrieveResponse, dataframe, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncAsktable) -> None:
+ async with async_client.dataframes.with_streaming_response.retrieve(
+ "dataframe_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ dataframe = await response.parse()
+ assert_matches_type(DataframeRetrieveResponse, dataframe, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataframe_id` but received ''"):
+ await async_client.dataframes.with_raw_response.retrieve(
+ "",
+ )
diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py
new file mode 100644
index 00000000..6b979645
--- /dev/null
+++ b/tests/api_resources/test_files.py
@@ -0,0 +1,97 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from asktable import Asktable, AsyncAsktable
+from tests.utils import assert_matches_type
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestFiles:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_retrieve(self, client: Asktable) -> None:
+ file = client.files.retrieve(
+ "file_id",
+ )
+ assert_matches_type(object, file, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve(self, client: Asktable) -> None:
+ response = client.files.with_raw_response.retrieve(
+ "file_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ file = response.parse()
+ assert_matches_type(object, file, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve(self, client: Asktable) -> None:
+ with client.files.with_streaming_response.retrieve(
+ "file_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ file = response.parse()
+ assert_matches_type(object, file, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_retrieve(self, client: Asktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
+ client.files.with_raw_response.retrieve(
+ "",
+ )
+
+
+class TestAsyncFiles:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncAsktable) -> None:
+ file = await async_client.files.retrieve(
+ "file_id",
+ )
+ assert_matches_type(object, file, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.files.with_raw_response.retrieve(
+ "file_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ file = await response.parse()
+ assert_matches_type(object, file, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncAsktable) -> None:
+ async with async_client.files.with_streaming_response.retrieve(
+ "file_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ file = await response.parse()
+ assert_matches_type(object, file, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
+ await async_client.files.with_raw_response.retrieve(
+ "",
+ )
From 8990ba9c162f2224e23e8db58646f2c485f77e1c Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:14:52 +0000
Subject: [PATCH 30/32] feat(api): manual updates (#168)
---
.stats.yml | 4 +-
api.md | 196 +++++++++---------
src/asktable/resources/answers.py | 8 +-
src/asktable/resources/auth.py | 17 +-
src/asktable/resources/bots.py | 24 +--
src/asktable/resources/business_glossary.py | 20 +-
src/asktable/resources/caches.py | 4 +-
src/asktable/resources/chats/chats.py | 121 +----------
src/asktable/resources/chats/messages.py | 16 +-
src/asktable/resources/dataframes.py | 4 +-
.../resources/datasources/datasources.py | 60 ++----
src/asktable/resources/datasources/indexes.py | 12 +-
src/asktable/resources/datasources/meta.py | 78 +++++--
.../resources/datasources/upload_params.py | 4 +-
src/asktable/resources/extapis/extapis.py | 20 +-
src/asktable/resources/extapis/routes.py | 28 +--
src/asktable/resources/files.py | 4 +-
src/asktable/resources/integration.py | 8 +-
src/asktable/resources/policies.py | 20 +-
src/asktable/resources/preferences.py | 16 +-
src/asktable/resources/project.py | 12 +-
src/asktable/resources/roles.py | 28 +--
src/asktable/resources/scores.py | 4 +-
src/asktable/resources/securetunnels.py | 40 ++--
src/asktable/resources/sqls.py | 8 +-
.../resources/sys/projects/api_keys.py | 16 +-
.../resources/sys/projects/projects.py | 24 +--
src/asktable/resources/trainings.py | 12 +-
src/asktable/types/__init__.py | 3 +-
src/asktable/types/auth_me_response.py | 24 +++
src/asktable/types/chat.py | 5 +
.../types/chat_post_message_params.py | 11 -
.../types/chat_post_message_response.py | 12 --
src/asktable/types/chat_retrieve_response.py | 11 +-
src/asktable/types/datasource.py | 1 +
.../types/datasource_create_params.py | 5 +-
.../types/datasource_retrieve_response.py | 1 +
.../types/datasource_update_params.py | 1 +
.../types/datasources/meta_create_params.py | 39 ++--
.../types/datasources/meta_update_params.py | 41 ++--
src/asktable/types/extapi.py | 4 +-
src/asktable/types/extapis/extapi_route.py | 4 +-
.../types/extapis/route_create_params.py | 4 +-
src/asktable/types/meta.py | 41 ++--
.../types/securetunnel_update_params.py | 8 +-
src/asktable/types/sys/model_group.py | 17 +-
tests/api_resources/datasources/test_meta.py | 170 ++++++++-------
tests/api_resources/extapis/test_routes.py | 12 +-
tests/api_resources/test_auth.py | 13 +-
tests/api_resources/test_chats.py | 90 +-------
tests/api_resources/test_datasources.py | 4 -
tests/api_resources/test_securetunnels.py | 12 +-
tests/test_client.py | 28 +--
53 files changed, 624 insertions(+), 745 deletions(-)
create mode 100644 src/asktable/types/auth_me_response.py
delete mode 100644 src/asktable/types/chat_post_message_params.py
delete mode 100644 src/asktable/types/chat_post_message_response.py
diff --git a/.stats.yml b/.stats.yml
index 751b9da1..c952c498 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 94
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2d9923ffe6d2d59041bac841db518829933a84e3251a372c9ad2306473fd7488.yml
+configured_endpoints: 93
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-63796b5061f281e8709c0a13d5b4747be88738df5f77406b683604890083d41e.yml
diff --git a/api.md b/api.md
index 3c766c34..1f1f2ec8 100644
--- a/api.md
+++ b/api.md
@@ -22,12 +22,12 @@ from asktable.types.sys import (
Methods:
-- client.sys.projects.create(\*\*params) -> Project
-- client.sys.projects.retrieve(project_id) -> Project
-- client.sys.projects.update(project_id, \*\*params) -> Project
-- client.sys.projects.list(\*\*params) -> SyncPage[Project]
-- client.sys.projects.delete(project_id) -> object
-- client.sys.projects.model_groups() -> ProjectModelGroupsResponse
+- client.sys.projects.create(\*\*params) -> Project
+- client.sys.projects.retrieve(project_id) -> Project
+- client.sys.projects.update(project_id, \*\*params) -> Project
+- client.sys.projects.list(\*\*params) -> SyncPage[Project]
+- client.sys.projects.delete(project_id) -> object
+- client.sys.projects.model_groups() -> ProjectModelGroupsResponse
### APIKeys
@@ -43,10 +43,10 @@ from asktable.types.sys.projects import (
Methods:
-- client.sys.projects.api_keys.create(project_id, \*\*params) -> APIKeyCreateResponse
-- client.sys.projects.api_keys.list(project_id) -> APIKeyListResponse
-- client.sys.projects.api_keys.delete(key_id, \*, project_id) -> None
-- client.sys.projects.api_keys.create_token(project_id, \*\*params) -> object
+- client.sys.projects.api_keys.create(project_id, \*\*params) -> APIKeyCreateResponse
+- client.sys.projects.api_keys.list(project_id) -> APIKeyListResponse
+- client.sys.projects.api_keys.delete(key_id, \*, project_id) -> None
+- client.sys.projects.api_keys.create_token(project_id, \*\*params) -> object
# Securetunnels
@@ -58,12 +58,12 @@ from asktable.types import SecureTunnel, SecuretunnelListLinksResponse
Methods:
-- client.securetunnels.create(\*\*params) -> SecureTunnel
-- client.securetunnels.retrieve(securetunnel_id) -> SecureTunnel
-- client.securetunnels.update(securetunnel_id, \*\*params) -> SecureTunnel
-- client.securetunnels.list(\*\*params) -> SyncPage[SecureTunnel]
-- client.securetunnels.delete(securetunnel_id) -> None
-- client.securetunnels.list_links(securetunnel_id, \*\*params) -> SyncPage[SecuretunnelListLinksResponse]
+- client.securetunnels.create(\*\*params) -> SecureTunnel
+- client.securetunnels.retrieve(securetunnel_id) -> SecureTunnel
+- client.securetunnels.update(securetunnel_id, \*\*params) -> SecureTunnel
+- client.securetunnels.list(\*\*params) -> SyncPage[SecureTunnel]
+- client.securetunnels.delete(securetunnel_id) -> None
+- client.securetunnels.list_links(securetunnel_id, \*\*params) -> SyncPage[SecuretunnelListLinksResponse]
# Roles
@@ -80,46 +80,38 @@ from asktable.types import (
Methods:
-- client.roles.create(\*\*params) -> Role
-- client.roles.retrieve(role_id) -> Role
-- client.roles.update(role_id, \*\*params) -> Role
-- client.roles.list(\*\*params) -> SyncPage[Role]
-- client.roles.delete(role_id) -> object
-- client.roles.get_polices(role_id) -> RoleGetPolicesResponse
-- client.roles.get_variables(role_id, \*\*params) -> object
+- client.roles.create(\*\*params) -> Role
+- client.roles.retrieve(role_id) -> Role
+- client.roles.update(role_id, \*\*params) -> Role
+- client.roles.list(\*\*params) -> SyncPage[Role]
+- client.roles.delete(role_id) -> object
+- client.roles.get_polices(role_id) -> RoleGetPolicesResponse
+- client.roles.get_variables(role_id, \*\*params) -> object
# Policies
Methods:
-- client.policies.create(\*\*params) -> Policy
-- client.policies.retrieve(policy_id) -> Policy
-- client.policies.update(policy_id, \*\*params) -> Policy
-- client.policies.list(\*\*params) -> SyncPage[Policy]
-- client.policies.delete(policy_id) -> None
+- client.policies.create(\*\*params) -> Policy
+- client.policies.retrieve(policy_id) -> Policy
+- client.policies.update(policy_id, \*\*params) -> Policy
+- client.policies.list(\*\*params) -> SyncPage[Policy]
+- client.policies.delete(policy_id) -> None
# Chats
Types:
```python
-from asktable.types import (
- AIMessage,
- Chat,
- ToolMessage,
- UserMessage,
- ChatRetrieveResponse,
- ChatPostMessageResponse,
-)
+from asktable.types import AIMessage, Chat, ToolMessage, UserMessage, ChatRetrieveResponse
```
Methods:
-- client.chats.create(\*\*params) -> Chat
-- client.chats.retrieve(chat_id) -> ChatRetrieveResponse
-- client.chats.list(\*\*params) -> SyncPage[Chat]
-- client.chats.delete(chat_id) -> None
-- client.chats.post_message(chat_id, \*\*params) -> ChatPostMessageResponse
+- client.chats.create(\*\*params) -> Chat
+- client.chats.retrieve(chat_id) -> ChatRetrieveResponse
+- client.chats.list(\*\*params) -> SyncPage[Chat]
+- client.chats.delete(chat_id) -> None
## Messages
@@ -131,9 +123,9 @@ from asktable.types.chats import MessageCreateResponse, MessageRetrieveResponse,
Methods:
-- client.chats.messages.create(chat_id, \*\*params) -> MessageCreateResponse
-- client.chats.messages.retrieve(message_id, \*, chat_id) -> MessageRetrieveResponse
-- client.chats.messages.list(chat_id, \*\*params) -> SyncPage[MessageListResponse]
+- client.chats.messages.create(chat_id, \*\*params) -> MessageCreateResponse
+- client.chats.messages.retrieve(message_id, \*, chat_id) -> MessageRetrieveResponse
+- client.chats.messages.list(chat_id, \*\*params) -> SyncPage[MessageListResponse]
# Datasources
@@ -153,13 +145,13 @@ from asktable.types import (
Methods:
-- client.datasources.create(\*\*params) -> Datasource
-- client.datasources.retrieve(datasource_id) -> DatasourceRetrieveResponse
-- client.datasources.update(datasource_id, \*\*params) -> Datasource
-- client.datasources.list(\*\*params) -> SyncPage[Datasource]
-- client.datasources.delete(datasource_id) -> object
-- client.datasources.add_file(datasource_id, \*\*params) -> object
-- client.datasources.delete_file(file_id, \*, datasource_id) -> object
+- client.datasources.create(\*\*params) -> Datasource
+- client.datasources.retrieve(datasource_id) -> DatasourceRetrieveResponse
+- client.datasources.update(datasource_id, \*\*params) -> Datasource
+- client.datasources.list(\*\*params) -> SyncPage[Datasource]
+- client.datasources.delete(datasource_id) -> object
+- client.datasources.add_file(datasource_id, \*\*params) -> object
+- client.datasources.delete_file(file_id, \*, datasource_id) -> object
## Meta
@@ -171,10 +163,10 @@ from asktable.types.datasources import MetaCreateResponse, MetaUpdateResponse, M
Methods:
-- client.datasources.meta.create(datasource_id, \*\*params) -> object
-- client.datasources.meta.retrieve(datasource_id) -> Meta
-- client.datasources.meta.update(datasource_id, \*\*params) -> object
-- client.datasources.meta.annotate(datasource_id, \*\*params) -> object
+- client.datasources.meta.create(datasource_id, \*\*params) -> object
+- client.datasources.meta.retrieve(datasource_id) -> Meta
+- client.datasources.meta.update(datasource_id, \*\*params) -> object
+- client.datasources.meta.annotate(datasource_id, \*\*params) -> object
## UploadParams
@@ -186,7 +178,7 @@ from asktable.types.datasources import UploadParamCreateResponse
Methods:
-- client.datasources.upload_params.create(\*\*params) -> object
+- client.datasources.upload_params.create(\*\*params) -> object
## Indexes
@@ -198,9 +190,9 @@ from asktable.types.datasources import IndexCreateResponse, IndexDeleteResponse
Methods:
-- client.datasources.indexes.create(ds_id, \*\*params) -> object
-- client.datasources.indexes.list(ds_id, \*\*params) -> SyncPage[Index]
-- client.datasources.indexes.delete(index_id, \*, ds_id) -> object
+- client.datasources.indexes.create(ds_id, \*\*params) -> object
+- client.datasources.indexes.list(ds_id, \*\*params) -> SyncPage[Index]
+- client.datasources.indexes.delete(index_id, \*, ds_id) -> object
# Bots
@@ -212,12 +204,12 @@ from asktable.types import Chatbot, BotDeleteResponse, BotInviteResponse
Methods:
-- client.bots.create(\*\*params) -> Chatbot
-- client.bots.retrieve(bot_id) -> Chatbot
-- client.bots.update(bot_id, \*\*params) -> Chatbot
-- client.bots.list(\*\*params) -> SyncPage[Chatbot]
-- client.bots.delete(bot_id) -> object
-- client.bots.invite(bot_id, \*\*params) -> object
+- client.bots.create(\*\*params) -> Chatbot
+- client.bots.retrieve(bot_id) -> Chatbot
+- client.bots.update(bot_id, \*\*params) -> Chatbot
+- client.bots.list(\*\*params) -> SyncPage[Chatbot]
+- client.bots.delete(bot_id) -> object
+- client.bots.invite(bot_id, \*\*params) -> object
# Extapis
@@ -229,11 +221,11 @@ from asktable.types import Extapi, ExtapiDeleteResponse
Methods:
-- client.extapis.create(\*\*params) -> Extapi
-- client.extapis.retrieve(extapi_id) -> Extapi
-- client.extapis.update(extapi_id, \*\*params) -> Extapi
-- client.extapis.list(\*\*params) -> SyncPage[Extapi]
-- client.extapis.delete(extapi_id) -> object
+- client.extapis.create(\*\*params) -> Extapi
+- client.extapis.retrieve(extapi_id) -> Extapi
+- client.extapis.update(extapi_id, \*\*params) -> Extapi
+- client.extapis.list(\*\*params) -> SyncPage[Extapi]
+- client.extapis.delete(extapi_id) -> object
## Routes
@@ -245,11 +237,11 @@ from asktable.types.extapis import ExtapiRoute, RouteListResponse
Methods:
-- 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
-- client.extapis.routes.delete(route_id, \*, extapi_id) -> None
+- 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
+- client.extapis.routes.delete(route_id, \*, extapi_id) -> None
# Auth
@@ -261,8 +253,8 @@ from asktable.types import AuthCreateTokenResponse, AuthMeResponse
Methods:
-- client.auth.create_token(\*\*params) -> object
-- client.auth.me() -> object
+- client.auth.create_token(\*\*params) -> object
+- client.auth.me() -> AuthMeResponse
# Answers
@@ -274,8 +266,8 @@ from asktable.types import AnswerResponse
Methods:
-- client.answers.create(\*\*params) -> AnswerResponse
-- client.answers.list(\*\*params) -> SyncPage[AnswerResponse]
+- client.answers.create(\*\*params) -> AnswerResponse
+- client.answers.list(\*\*params) -> SyncPage[AnswerResponse]
# Sqls
@@ -287,14 +279,14 @@ from asktable.types import QueryResponse
Methods:
-- client.sqls.create(\*\*params) -> QueryResponse
-- client.sqls.list(\*\*params) -> SyncPage[QueryResponse]
+- client.sqls.create(\*\*params) -> QueryResponse
+- client.sqls.list(\*\*params) -> SyncPage[QueryResponse]
# Caches
Methods:
-- client.caches.delete(cache_id) -> None
+- client.caches.delete(cache_id) -> None
# Integration
@@ -306,8 +298,8 @@ from asktable.types import FileAskResponse
Methods:
-- client.integration.create_excel_ds(\*\*params) -> Datasource
-- client.integration.excel_csv_ask(\*\*params) -> FileAskResponse
+- client.integration.create_excel_ds(\*\*params) -> Datasource
+- client.integration.excel_csv_ask(\*\*params) -> FileAskResponse
# BusinessGlossary
@@ -324,11 +316,11 @@ from asktable.types import (
Methods:
-- client.business_glossary.create(\*\*params) -> BusinessGlossaryCreateResponse
-- client.business_glossary.retrieve(entry_id) -> EntryWithDefinition
-- client.business_glossary.update(entry_id, \*\*params) -> Entry
-- client.business_glossary.list(\*\*params) -> SyncPage[EntryWithDefinition]
-- client.business_glossary.delete(entry_id) -> object
+- client.business_glossary.create(\*\*params) -> BusinessGlossaryCreateResponse
+- client.business_glossary.retrieve(entry_id) -> EntryWithDefinition
+- client.business_glossary.update(entry_id, \*\*params) -> Entry
+- client.business_glossary.list(\*\*params) -> SyncPage[EntryWithDefinition]
+- client.business_glossary.delete(entry_id) -> object
# Preferences
@@ -345,10 +337,10 @@ from asktable.types import (
Methods:
-- client.preferences.create(\*\*params) -> PreferenceCreateResponse
-- client.preferences.retrieve() -> PreferenceRetrieveResponse
-- client.preferences.update(\*\*params) -> PreferenceUpdateResponse
-- client.preferences.delete() -> object
+- client.preferences.create(\*\*params) -> PreferenceCreateResponse
+- client.preferences.retrieve() -> PreferenceRetrieveResponse
+- client.preferences.update(\*\*params) -> PreferenceUpdateResponse
+- client.preferences.delete() -> object
# Trainings
@@ -360,9 +352,9 @@ from asktable.types import TrainingCreateResponse, TrainingListResponse, Trainin
Methods:
-- client.trainings.create(\*\*params) -> TrainingCreateResponse
-- client.trainings.list(\*\*params) -> SyncPage[TrainingListResponse]
-- client.trainings.delete(id, \*\*params) -> object
+- client.trainings.create(\*\*params) -> TrainingCreateResponse
+- client.trainings.list(\*\*params) -> SyncPage[TrainingListResponse]
+- client.trainings.delete(id, \*\*params) -> object
# Project
@@ -374,9 +366,9 @@ from asktable.types import ProjectListModelGroupsResponse
Methods:
-- client.project.retrieve() -> Project
-- client.project.update(\*\*params) -> Project
-- client.project.list_model_groups() -> ProjectListModelGroupsResponse
+- client.project.retrieve() -> Project
+- client.project.update(\*\*params) -> Project
+- client.project.list_model_groups() -> ProjectListModelGroupsResponse
# Scores
@@ -388,7 +380,7 @@ from asktable.types import ScoreCreateResponse
Methods:
-- client.scores.create(\*\*params) -> ScoreCreateResponse
+- client.scores.create(\*\*params) -> ScoreCreateResponse
# Files
@@ -400,7 +392,7 @@ from asktable.types import FileRetrieveResponse
Methods:
-- client.files.retrieve(file_id) -> object
+- client.files.retrieve(file_id) -> object
# Dataframes
@@ -412,4 +404,4 @@ from asktable.types import DataframeRetrieveResponse
Methods:
-- client.dataframes.retrieve(dataframe_id) -> DataframeRetrieveResponse
+- client.dataframes.retrieve(dataframe_id) -> DataframeRetrieveResponse
diff --git a/src/asktable/resources/answers.py b/src/asktable/resources/answers.py
index ff6e0aa3..155a89bd 100644
--- a/src/asktable/resources/answers.py
+++ b/src/asktable/resources/answers.py
@@ -89,7 +89,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/single-turn/q2a",
+ "/v1/single-turn/q2a",
body=maybe_transform(
{
"datasource_id": datasource_id,
@@ -139,7 +139,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/single-turn/q2a",
+ "/v1/single-turn/q2a",
page=SyncPage[AnswerResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -221,7 +221,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/single-turn/q2a",
+ "/v1/single-turn/q2a",
body=await async_maybe_transform(
{
"datasource_id": datasource_id,
@@ -271,7 +271,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/single-turn/q2a",
+ "/v1/single-turn/q2a",
page=AsyncPage[AnswerResponse],
options=make_request_options(
extra_headers=extra_headers,
diff --git a/src/asktable/resources/auth.py b/src/asktable/resources/auth.py
index ca6fbe12..b8ed671d 100644
--- a/src/asktable/resources/auth.py
+++ b/src/asktable/resources/auth.py
@@ -22,6 +22,7 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
+from ..types.auth_me_response import AuthMeResponse
__all__ = ["AuthResource", "AsyncAuthResource"]
@@ -81,7 +82,7 @@ def create_token(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/auth/tokens",
+ "/v1/auth/tokens",
body=maybe_transform(
{
"ak_role": ak_role,
@@ -106,14 +107,14 @@ def me(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> object:
+ ) -> AuthMeResponse:
"""获取当前登录的 TokenID"""
return self._get(
- "/auth/me",
+ "/v1/auth/me",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=object,
+ cast_to=AuthMeResponse,
)
@@ -172,7 +173,7 @@ async def create_token(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/auth/tokens",
+ "/v1/auth/tokens",
body=await async_maybe_transform(
{
"ak_role": ak_role,
@@ -197,14 +198,14 @@ async def me(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> object:
+ ) -> AuthMeResponse:
"""获取当前登录的 TokenID"""
return await self._get(
- "/auth/me",
+ "/v1/auth/me",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=object,
+ cast_to=AuthMeResponse,
)
diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py
index 2227fb59..6ce7781e 100644
--- a/src/asktable/resources/bots.py
+++ b/src/asktable/resources/bots.py
@@ -100,7 +100,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/bots",
+ "/v1/bots",
body=maybe_transform(
{
"datasource_ids": datasource_ids,
@@ -148,7 +148,7 @@ def retrieve(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return self._get(
- f"/bots/{bot_id}",
+ f"/v1/bots/{bot_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -214,7 +214,7 @@ def update(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return self._patch(
- f"/bots/{bot_id}",
+ f"/v1/bots/{bot_id}",
body=maybe_transform(
{
"avatar_url": avatar_url,
@@ -269,7 +269,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/bots",
+ "/v1/bots",
page=SyncPage[Chatbot],
options=make_request_options(
extra_headers=extra_headers,
@@ -314,7 +314,7 @@ def delete(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return self._delete(
- f"/bots/{bot_id}",
+ f"/v1/bots/{bot_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -348,7 +348,7 @@ def invite(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return self._post(
- f"/bots/{bot_id}/invite",
+ f"/v1/bots/{bot_id}/invite",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -433,7 +433,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/bots",
+ "/v1/bots",
body=await async_maybe_transform(
{
"datasource_ids": datasource_ids,
@@ -481,7 +481,7 @@ async def retrieve(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return await self._get(
- f"/bots/{bot_id}",
+ f"/v1/bots/{bot_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -547,7 +547,7 @@ async def update(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return await self._patch(
- f"/bots/{bot_id}",
+ f"/v1/bots/{bot_id}",
body=await async_maybe_transform(
{
"avatar_url": avatar_url,
@@ -602,7 +602,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/bots",
+ "/v1/bots",
page=AsyncPage[Chatbot],
options=make_request_options(
extra_headers=extra_headers,
@@ -647,7 +647,7 @@ async def delete(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return await self._delete(
- f"/bots/{bot_id}",
+ f"/v1/bots/{bot_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -681,7 +681,7 @@ async def invite(
if not bot_id:
raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}")
return await self._post(
- f"/bots/{bot_id}/invite",
+ f"/v1/bots/{bot_id}/invite",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py
index 3fabfdd5..18700d43 100644
--- a/src/asktable/resources/business_glossary.py
+++ b/src/asktable/resources/business_glossary.py
@@ -77,7 +77,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/business-glossary",
+ "/v1/business-glossary",
body=maybe_transform(body, Iterable[business_glossary_create_params.Body]),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -111,7 +111,7 @@ def retrieve(
if not entry_id:
raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
return self._get(
- f"/business-glossary/{entry_id}",
+ f"/v1/business-glossary/{entry_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -156,7 +156,7 @@ def update(
if not entry_id:
raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
return self._patch(
- f"/business-glossary/{entry_id}",
+ f"/v1/business-glossary/{entry_id}",
body=maybe_transform(
{
"aliases": aliases,
@@ -204,7 +204,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/business-glossary",
+ "/v1/business-glossary",
page=SyncPage[EntryWithDefinition],
options=make_request_options(
extra_headers=extra_headers,
@@ -249,7 +249,7 @@ def delete(
if not entry_id:
raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
return self._delete(
- f"/business-glossary/{entry_id}",
+ f"/v1/business-glossary/{entry_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -301,7 +301,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/business-glossary",
+ "/v1/business-glossary",
body=await async_maybe_transform(body, Iterable[business_glossary_create_params.Body]),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -335,7 +335,7 @@ async def retrieve(
if not entry_id:
raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
return await self._get(
- f"/business-glossary/{entry_id}",
+ f"/v1/business-glossary/{entry_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -380,7 +380,7 @@ async def update(
if not entry_id:
raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
return await self._patch(
- f"/business-glossary/{entry_id}",
+ f"/v1/business-glossary/{entry_id}",
body=await async_maybe_transform(
{
"aliases": aliases,
@@ -428,7 +428,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/business-glossary",
+ "/v1/business-glossary",
page=AsyncPage[EntryWithDefinition],
options=make_request_options(
extra_headers=extra_headers,
@@ -473,7 +473,7 @@ async def delete(
if not entry_id:
raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
return await self._delete(
- f"/business-glossary/{entry_id}",
+ f"/v1/business-glossary/{entry_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/caches.py b/src/asktable/resources/caches.py
index bc1c73bf..b89b7d6b 100644
--- a/src/asktable/resources/caches.py
+++ b/src/asktable/resources/caches.py
@@ -65,7 +65,7 @@ def delete(
raise ValueError(f"Expected a non-empty value for `cache_id` but received {cache_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/caches/{cache_id}",
+ f"/v1/caches/{cache_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -120,7 +120,7 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `cache_id` but received {cache_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/caches/{cache_id}",
+ f"/v1/caches/{cache_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py
index d974eeb4..661ca731 100644
--- a/src/asktable/resources/chats/chats.py
+++ b/src/asktable/resources/chats/chats.py
@@ -2,11 +2,11 @@
from __future__ import annotations
-from typing import Any, Dict, Union, Optional, cast
+from typing import Dict, Union, Optional
import httpx
-from ...types import chat_list_params, chat_create_params, chat_post_message_params
+from ...types import chat_list_params, chat_create_params
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ..._utils import (
maybe_transform,
@@ -32,7 +32,6 @@
from ...types.chat import Chat
from ..._base_client import AsyncPaginator, make_request_options
from ...types.chat_retrieve_response import ChatRetrieveResponse
-from ...types.chat_post_message_response import ChatPostMessageResponse
__all__ = ["ChatsResource", "AsyncChatsResource"]
@@ -101,7 +100,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/chats",
+ "/v1/chats",
body=maybe_transform(
{
"bot_id": bot_id,
@@ -144,7 +143,7 @@ def retrieve(
if not chat_id:
raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
return self._get(
- f"/chats/{chat_id}",
+ f"/v1/chats/{chat_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -180,7 +179,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/chats",
+ "/v1/chats",
page=SyncPage[Chat],
options=make_request_options(
extra_headers=extra_headers,
@@ -225,56 +224,13 @@ def delete(
raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/chats/{chat_id}",
+ f"/v1/chats/{chat_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)
- def post_message(
- self,
- chat_id: str,
- *,
- question: str,
- # 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,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ChatPostMessageResponse:
- """
- 发消息
-
- Args:
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not chat_id:
- raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
- return cast(
- ChatPostMessageResponse,
- self._post(
- f"/chats/{chat_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=maybe_transform({"question": question}, chat_post_message_params.ChatPostMessageParams),
- ),
- cast_to=cast(
- Any, ChatPostMessageResponse
- ), # Union types cannot be passed in as arguments in the type system
- ),
- )
-
class AsyncChatsResource(AsyncAPIResource):
@cached_property
@@ -340,7 +296,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/chats",
+ "/v1/chats",
body=await async_maybe_transform(
{
"bot_id": bot_id,
@@ -383,7 +339,7 @@ async def retrieve(
if not chat_id:
raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
return await self._get(
- f"/chats/{chat_id}",
+ f"/v1/chats/{chat_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -419,7 +375,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/chats",
+ "/v1/chats",
page=AsyncPage[Chat],
options=make_request_options(
extra_headers=extra_headers,
@@ -464,58 +420,13 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/chats/{chat_id}",
+ f"/v1/chats/{chat_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)
- async def post_message(
- self,
- chat_id: str,
- *,
- question: str,
- # 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,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ChatPostMessageResponse:
- """
- 发消息
-
- Args:
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not chat_id:
- raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
- return cast(
- ChatPostMessageResponse,
- await self._post(
- f"/chats/{chat_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=await async_maybe_transform(
- {"question": question}, chat_post_message_params.ChatPostMessageParams
- ),
- ),
- cast_to=cast(
- Any, ChatPostMessageResponse
- ), # Union types cannot be passed in as arguments in the type system
- ),
- )
-
class ChatsResourceWithRawResponse:
def __init__(self, chats: ChatsResource) -> None:
@@ -533,9 +444,6 @@ def __init__(self, chats: ChatsResource) -> None:
self.delete = to_raw_response_wrapper(
chats.delete,
)
- self.post_message = to_raw_response_wrapper(
- chats.post_message,
- )
@cached_property
def messages(self) -> MessagesResourceWithRawResponse:
@@ -558,9 +466,6 @@ def __init__(self, chats: AsyncChatsResource) -> None:
self.delete = async_to_raw_response_wrapper(
chats.delete,
)
- self.post_message = async_to_raw_response_wrapper(
- chats.post_message,
- )
@cached_property
def messages(self) -> AsyncMessagesResourceWithRawResponse:
@@ -583,9 +488,6 @@ def __init__(self, chats: ChatsResource) -> None:
self.delete = to_streamed_response_wrapper(
chats.delete,
)
- self.post_message = to_streamed_response_wrapper(
- chats.post_message,
- )
@cached_property
def messages(self) -> MessagesResourceWithStreamingResponse:
@@ -608,9 +510,6 @@ def __init__(self, chats: AsyncChatsResource) -> None:
self.delete = async_to_streamed_response_wrapper(
chats.delete,
)
- self.post_message = async_to_streamed_response_wrapper(
- chats.post_message,
- )
@cached_property
def messages(self) -> AsyncMessagesResourceWithStreamingResponse:
diff --git a/src/asktable/resources/chats/messages.py b/src/asktable/resources/chats/messages.py
index 6d5a2c01..8ad81c31 100644
--- a/src/asktable/resources/chats/messages.py
+++ b/src/asktable/resources/chats/messages.py
@@ -62,7 +62,7 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> MessageCreateResponse:
"""
- 发消息
+ Send a message to the chat
Args:
extra_headers: Send extra headers
@@ -78,7 +78,7 @@ def create(
return cast(
MessageCreateResponse,
self._post(
- f"/chats/{chat_id}/messages",
+ f"/v1/chats/{chat_id}/messages",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -123,7 +123,7 @@ def retrieve(
return cast(
MessageRetrieveResponse,
self._get(
- f"/chats/{chat_id}/messages/{message_id}",
+ f"/v1/chats/{chat_id}/messages/{message_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -165,7 +165,7 @@ def list(
if not chat_id:
raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
return self._get_api_list(
- f"/chats/{chat_id}/messages",
+ f"/v1/chats/{chat_id}/messages",
page=SyncPage[MessageListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -217,7 +217,7 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> MessageCreateResponse:
"""
- 发消息
+ Send a message to the chat
Args:
extra_headers: Send extra headers
@@ -233,7 +233,7 @@ async def create(
return cast(
MessageCreateResponse,
await self._post(
- f"/chats/{chat_id}/messages",
+ f"/v1/chats/{chat_id}/messages",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -280,7 +280,7 @@ async def retrieve(
return cast(
MessageRetrieveResponse,
await self._get(
- f"/chats/{chat_id}/messages/{message_id}",
+ f"/v1/chats/{chat_id}/messages/{message_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -322,7 +322,7 @@ def list(
if not chat_id:
raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}")
return self._get_api_list(
- f"/chats/{chat_id}/messages",
+ f"/v1/chats/{chat_id}/messages",
page=AsyncPage[MessageListResponse],
options=make_request_options(
extra_headers=extra_headers,
diff --git a/src/asktable/resources/dataframes.py b/src/asktable/resources/dataframes.py
index 8f0953c3..4320689d 100644
--- a/src/asktable/resources/dataframes.py
+++ b/src/asktable/resources/dataframes.py
@@ -65,7 +65,7 @@ def retrieve(
if not dataframe_id:
raise ValueError(f"Expected a non-empty value for `dataframe_id` but received {dataframe_id!r}")
return self._get(
- f"/dataframes/{dataframe_id}",
+ f"/v1/dataframes/{dataframe_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -119,7 +119,7 @@ async def retrieve(
if not dataframe_id:
raise ValueError(f"Expected a non-empty value for `dataframe_id` but received {dataframe_id!r}")
return await self._get(
- f"/dataframes/{dataframe_id}",
+ f"/v1/dataframes/{dataframe_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py
index 1553cd7e..a2b9d29d 100644
--- a/src/asktable/resources/datasources/datasources.py
+++ b/src/asktable/resources/datasources/datasources.py
@@ -108,9 +108,8 @@ def create(
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
],
- async_process_meta: bool | NotGiven = NOT_GIVEN,
- value_index: bool | NotGiven = NOT_GIVEN,
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -139,7 +138,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/datasources",
+ "/v1/datasources",
body=maybe_transform(
{
"engine": engine,
@@ -149,17 +148,7 @@ def create(
datasource_create_params.DatasourceCreateParams,
),
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=maybe_transform(
- {
- "async_process_meta": async_process_meta,
- "value_index": value_index,
- },
- datasource_create_params.DatasourceCreateParams,
- ),
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Datasource,
)
@@ -190,7 +179,7 @@ def retrieve(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._get(
- f"/datasources/{datasource_id}",
+ f"/v1/datasources/{datasource_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -217,6 +206,7 @@ def update(
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
]
]
| NotGiven = NOT_GIVEN,
@@ -269,7 +259,7 @@ def update(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._patch(
- f"/datasources/{datasource_id}",
+ f"/v1/datasources/{datasource_id}",
body=maybe_transform(
{
"access_config": access_config,
@@ -321,7 +311,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/datasources",
+ "/v1/datasources",
page=SyncPage[Datasource],
options=make_request_options(
extra_headers=extra_headers,
@@ -366,7 +356,7 @@ def delete(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._delete(
- f"/datasources/{datasource_id}",
+ f"/v1/datasources/{datasource_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -406,7 +396,7 @@ def add_file(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._post(
- f"/datasources/{datasource_id}/files",
+ f"/v1/datasources/{datasource_id}/files",
body=maybe_transform(body, datasource_add_file_params.DatasourceAddFileParams),
files=files,
options=make_request_options(
@@ -444,7 +434,7 @@ def delete_file(
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
return self._delete(
- f"/datasources/{datasource_id}/files/{file_id}",
+ f"/v1/datasources/{datasource_id}/files/{file_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -569,9 +559,8 @@ async def create(
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
],
- async_process_meta: bool | NotGiven = NOT_GIVEN,
- value_index: bool | NotGiven = NOT_GIVEN,
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -600,7 +589,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/datasources",
+ "/v1/datasources",
body=await async_maybe_transform(
{
"engine": engine,
@@ -610,17 +599,7 @@ async def create(
datasource_create_params.DatasourceCreateParams,
),
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=await async_maybe_transform(
- {
- "async_process_meta": async_process_meta,
- "value_index": value_index,
- },
- datasource_create_params.DatasourceCreateParams,
- ),
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Datasource,
)
@@ -651,7 +630,7 @@ async def retrieve(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._get(
- f"/datasources/{datasource_id}",
+ f"/v1/datasources/{datasource_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -678,6 +657,7 @@ async def update(
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
]
]
| NotGiven = NOT_GIVEN,
@@ -730,7 +710,7 @@ async def update(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._patch(
- f"/datasources/{datasource_id}",
+ f"/v1/datasources/{datasource_id}",
body=await async_maybe_transform(
{
"access_config": access_config,
@@ -782,7 +762,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/datasources",
+ "/v1/datasources",
page=AsyncPage[Datasource],
options=make_request_options(
extra_headers=extra_headers,
@@ -827,7 +807,7 @@ async def delete(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._delete(
- f"/datasources/{datasource_id}",
+ f"/v1/datasources/{datasource_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -867,7 +847,7 @@ async def add_file(
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._post(
- f"/datasources/{datasource_id}/files",
+ f"/v1/datasources/{datasource_id}/files",
body=await async_maybe_transform(body, datasource_add_file_params.DatasourceAddFileParams),
files=files,
options=make_request_options(
@@ -905,7 +885,7 @@ async def delete_file(
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
return await self._delete(
- f"/datasources/{datasource_id}/files/{file_id}",
+ f"/v1/datasources/{datasource_id}/files/{file_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/datasources/indexes.py b/src/asktable/resources/datasources/indexes.py
index 943dab53..a4df4476 100644
--- a/src/asktable/resources/datasources/indexes.py
+++ b/src/asktable/resources/datasources/indexes.py
@@ -82,7 +82,7 @@ def create(
if not ds_id:
raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}")
return self._post(
- f"/datasources/{ds_id}/indexes",
+ f"/v1/datasources/{ds_id}/indexes",
body=maybe_transform(
{
"field_name": field_name,
@@ -134,7 +134,7 @@ def list(
if not ds_id:
raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}")
return self._get_api_list(
- f"/datasources/{ds_id}/indexes",
+ f"/v1/datasources/{ds_id}/indexes",
page=SyncPage[Index],
options=make_request_options(
extra_headers=extra_headers,
@@ -181,7 +181,7 @@ def delete(
if not index_id:
raise ValueError(f"Expected a non-empty value for `index_id` but received {index_id!r}")
return self._delete(
- f"/datasources/{ds_id}/indexes/{index_id}",
+ f"/v1/datasources/{ds_id}/indexes/{index_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -246,7 +246,7 @@ async def create(
if not ds_id:
raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}")
return await self._post(
- f"/datasources/{ds_id}/indexes",
+ f"/v1/datasources/{ds_id}/indexes",
body=await async_maybe_transform(
{
"field_name": field_name,
@@ -300,7 +300,7 @@ def list(
if not ds_id:
raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}")
return self._get_api_list(
- f"/datasources/{ds_id}/indexes",
+ f"/v1/datasources/{ds_id}/indexes",
page=AsyncPage[Index],
options=make_request_options(
extra_headers=extra_headers,
@@ -347,7 +347,7 @@ async def delete(
if not index_id:
raise ValueError(f"Expected a non-empty value for `index_id` but received {index_id!r}")
return await self._delete(
- f"/datasources/{ds_id}/indexes/{index_id}",
+ f"/v1/datasources/{ds_id}/indexes/{index_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py
index d694e024..ab219d17 100644
--- a/src/asktable/resources/datasources/meta.py
+++ b/src/asktable/resources/datasources/meta.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Dict
+from typing import Dict, List, Optional
import httpx
@@ -52,7 +52,8 @@ def create(
*,
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
- schemas: Dict[str, meta_create_params.Schemas] | NotGiven = NOT_GIVEN,
+ meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN,
+ selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
# 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,
@@ -79,8 +80,14 @@ def create(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._post(
- f"/datasources/{datasource_id}/meta",
- body=maybe_transform({"schemas": schemas}, meta_create_params.MetaCreateParams),
+ f"/v1/datasources/{datasource_id}/meta",
+ body=maybe_transform(
+ {
+ "meta": meta,
+ "selected_tables": selected_tables,
+ },
+ meta_create_params.MetaCreateParams,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -123,7 +130,7 @@ def retrieve(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._get(
- f"/datasources/{datasource_id}/meta",
+ f"/v1/datasources/{datasource_id}/meta",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -134,7 +141,9 @@ def update(
self,
datasource_id: str,
*,
- schemas: Dict[str, meta_update_params.Schemas] | NotGiven = NOT_GIVEN,
+ async_process_meta: bool | NotGiven = NOT_GIVEN,
+ meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN,
+ selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
# 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,
@@ -157,10 +166,20 @@ def update(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._put(
- f"/datasources/{datasource_id}/meta",
- body=maybe_transform({"schemas": schemas}, meta_update_params.MetaUpdateParams),
+ f"/v1/datasources/{datasource_id}/meta",
+ body=maybe_transform(
+ {
+ "meta": meta,
+ "selected_tables": selected_tables,
+ },
+ meta_update_params.MetaUpdateParams,
+ ),
options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform({"async_process_meta": async_process_meta}, meta_update_params.MetaUpdateParams),
),
cast_to=object,
)
@@ -192,7 +211,7 @@ def annotate(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._patch(
- f"/datasources/{datasource_id}/meta",
+ f"/v1/datasources/{datasource_id}/meta",
body=maybe_transform({"schemas": schemas}, meta_annotate_params.MetaAnnotateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -227,7 +246,8 @@ async def create(
*,
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
- schemas: Dict[str, meta_create_params.Schemas] | NotGiven = NOT_GIVEN,
+ meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN,
+ selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
# 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,
@@ -254,8 +274,14 @@ async def create(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._post(
- f"/datasources/{datasource_id}/meta",
- body=await async_maybe_transform({"schemas": schemas}, meta_create_params.MetaCreateParams),
+ f"/v1/datasources/{datasource_id}/meta",
+ body=await async_maybe_transform(
+ {
+ "meta": meta,
+ "selected_tables": selected_tables,
+ },
+ meta_create_params.MetaCreateParams,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -298,7 +324,7 @@ async def retrieve(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._get(
- f"/datasources/{datasource_id}/meta",
+ f"/v1/datasources/{datasource_id}/meta",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -309,7 +335,9 @@ async def update(
self,
datasource_id: str,
*,
- schemas: Dict[str, meta_update_params.Schemas] | NotGiven = NOT_GIVEN,
+ async_process_meta: bool | NotGiven = NOT_GIVEN,
+ meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN,
+ selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
# 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,
@@ -332,10 +360,22 @@ async def update(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._put(
- f"/datasources/{datasource_id}/meta",
- body=await async_maybe_transform({"schemas": schemas}, meta_update_params.MetaUpdateParams),
+ f"/v1/datasources/{datasource_id}/meta",
+ body=await async_maybe_transform(
+ {
+ "meta": meta,
+ "selected_tables": selected_tables,
+ },
+ meta_update_params.MetaUpdateParams,
+ ),
options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {"async_process_meta": async_process_meta}, meta_update_params.MetaUpdateParams
+ ),
),
cast_to=object,
)
@@ -367,7 +407,7 @@ async def annotate(
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._patch(
- f"/datasources/{datasource_id}/meta",
+ f"/v1/datasources/{datasource_id}/meta",
body=await async_maybe_transform({"schemas": schemas}, meta_annotate_params.MetaAnnotateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
diff --git a/src/asktable/resources/datasources/upload_params.py b/src/asktable/resources/datasources/upload_params.py
index aab0b9cb..54fd1d93 100644
--- a/src/asktable/resources/datasources/upload_params.py
+++ b/src/asktable/resources/datasources/upload_params.py
@@ -74,7 +74,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/datasources/upload_params",
+ "/v1/datasources/upload_params",
body=maybe_transform(
{
"expiration": expiration,
@@ -138,7 +138,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/datasources/upload_params",
+ "/v1/datasources/upload_params",
body=await async_maybe_transform(
{
"expiration": expiration,
diff --git a/src/asktable/resources/extapis/extapis.py b/src/asktable/resources/extapis/extapis.py
index e1c7312a..9c392981 100644
--- a/src/asktable/resources/extapis/extapis.py
+++ b/src/asktable/resources/extapis/extapis.py
@@ -91,7 +91,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/extapis",
+ "/v1/extapis",
body=maybe_transform(
{
"base_url": base_url,
@@ -132,7 +132,7 @@ def retrieve(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return self._get(
- f"/extapis/{extapi_id}",
+ f"/v1/extapis/{extapi_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -174,7 +174,7 @@ def update(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return self._post(
- f"/extapis/{extapi_id}",
+ f"/v1/extapis/{extapi_id}",
body=maybe_transform(
{
"base_url": base_url,
@@ -221,7 +221,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/extapis",
+ "/v1/extapis",
page=SyncPage[Extapi],
options=make_request_options(
extra_headers=extra_headers,
@@ -266,7 +266,7 @@ def delete(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return self._delete(
- f"/extapis/{extapi_id}",
+ f"/v1/extapis/{extapi_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -330,7 +330,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/extapis",
+ "/v1/extapis",
body=await async_maybe_transform(
{
"base_url": base_url,
@@ -371,7 +371,7 @@ async def retrieve(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return await self._get(
- f"/extapis/{extapi_id}",
+ f"/v1/extapis/{extapi_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -413,7 +413,7 @@ async def update(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return await self._post(
- f"/extapis/{extapi_id}",
+ f"/v1/extapis/{extapi_id}",
body=await async_maybe_transform(
{
"base_url": base_url,
@@ -460,7 +460,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/extapis",
+ "/v1/extapis",
page=AsyncPage[Extapi],
options=make_request_options(
extra_headers=extra_headers,
@@ -505,7 +505,7 @@ async def delete(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return await self._delete(
- f"/extapis/{extapi_id}",
+ f"/v1/extapis/{extapi_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/extapis/routes.py b/src/asktable/resources/extapis/routes.py
index edc4574a..2551affa 100644
--- a/src/asktable/resources/extapis/routes.py
+++ b/src/asktable/resources/extapis/routes.py
@@ -60,10 +60,10 @@ def create(
name: str,
path: str,
project_id: str,
+ updated_at: Union[str, datetime],
body_params_desc: Optional[str] | NotGiven = NOT_GIVEN,
path_params_desc: Optional[str] | NotGiven = NOT_GIVEN,
query_params_desc: Optional[str] | NotGiven = NOT_GIVEN,
- updated_at: Union[str, datetime] | NotGiven = NOT_GIVEN,
# 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,
@@ -98,7 +98,7 @@ def create(
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/{path_extapi_id}/routes",
+ f"/v1/extapis/{path_extapi_id}/routes",
body=maybe_transform(
{
"id": id,
@@ -108,10 +108,10 @@ def create(
"name": name,
"path": path,
"project_id": project_id,
+ "updated_at": updated_at,
"body_params_desc": body_params_desc,
"path_params_desc": path_params_desc,
"query_params_desc": query_params_desc,
- "updated_at": updated_at,
},
route_create_params.RouteCreateParams,
),
@@ -150,7 +150,7 @@ def retrieve(
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return self._get(
- f"/extapis/{extapi_id}/routes/{route_id}",
+ f"/v1/extapis/{extapi_id}/routes/{route_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -204,7 +204,7 @@ def update(
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return self._post(
- f"/extapis/{extapi_id}/routes/{route_id}",
+ f"/v1/extapis/{extapi_id}/routes/{route_id}",
body=maybe_transform(
{
"body_params_desc": body_params_desc,
@@ -248,7 +248,7 @@ def list(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return self._get(
- f"/extapis/{extapi_id}/routes",
+ f"/v1/extapis/{extapi_id}/routes",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -285,7 +285,7 @@ def delete(
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/extapis/{extapi_id}/routes/{route_id}",
+ f"/v1/extapis/{extapi_id}/routes/{route_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -324,10 +324,10 @@ async def create(
name: str,
path: str,
project_id: str,
+ updated_at: Union[str, datetime],
body_params_desc: Optional[str] | NotGiven = NOT_GIVEN,
path_params_desc: Optional[str] | NotGiven = NOT_GIVEN,
query_params_desc: Optional[str] | NotGiven = NOT_GIVEN,
- updated_at: Union[str, datetime] | NotGiven = NOT_GIVEN,
# 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,
@@ -362,7 +362,7 @@ async def create(
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/{path_extapi_id}/routes",
+ f"/v1/extapis/{path_extapi_id}/routes",
body=await async_maybe_transform(
{
"id": id,
@@ -372,10 +372,10 @@ async def create(
"name": name,
"path": path,
"project_id": project_id,
+ "updated_at": updated_at,
"body_params_desc": body_params_desc,
"path_params_desc": path_params_desc,
"query_params_desc": query_params_desc,
- "updated_at": updated_at,
},
route_create_params.RouteCreateParams,
),
@@ -414,7 +414,7 @@ async def retrieve(
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return await self._get(
- f"/extapis/{extapi_id}/routes/{route_id}",
+ f"/v1/extapis/{extapi_id}/routes/{route_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -468,7 +468,7 @@ async def update(
if not route_id:
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
return await self._post(
- f"/extapis/{extapi_id}/routes/{route_id}",
+ f"/v1/extapis/{extapi_id}/routes/{route_id}",
body=await async_maybe_transform(
{
"body_params_desc": body_params_desc,
@@ -512,7 +512,7 @@ async def list(
if not extapi_id:
raise ValueError(f"Expected a non-empty value for `extapi_id` but received {extapi_id!r}")
return await self._get(
- f"/extapis/{extapi_id}/routes",
+ f"/v1/extapis/{extapi_id}/routes",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -549,7 +549,7 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/extapis/{extapi_id}/routes/{route_id}",
+ f"/v1/extapis/{extapi_id}/routes/{route_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/files.py b/src/asktable/resources/files.py
index b3a6261c..6673a7bf 100644
--- a/src/asktable/resources/files.py
+++ b/src/asktable/resources/files.py
@@ -64,7 +64,7 @@ def retrieve(
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
return self._get(
- f"/files/{file_id}",
+ f"/v1/files/{file_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -118,7 +118,7 @@ async def retrieve(
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
return await self._get(
- f"/files/{file_id}",
+ f"/v1/files/{file_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/integration.py b/src/asktable/resources/integration.py
index f944649c..f4384669 100644
--- a/src/asktable/resources/integration.py
+++ b/src/asktable/resources/integration.py
@@ -72,7 +72,7 @@ def create_excel_ds(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/integration/create_excel_ds",
+ "/v1/integration/create_excel_ds",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -121,7 +121,7 @@ def excel_csv_ask(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/integration/excel_csv_ask",
+ "/v1/integration/excel_csv_ask",
body=maybe_transform(
{
"file_url": file_url,
@@ -182,7 +182,7 @@ async def create_excel_ds(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/integration/create_excel_ds",
+ "/v1/integration/create_excel_ds",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -231,7 +231,7 @@ async def excel_csv_ask(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/integration/excel_csv_ask",
+ "/v1/integration/excel_csv_ask",
body=await async_maybe_transform(
{
"file_url": file_url,
diff --git a/src/asktable/resources/policies.py b/src/asktable/resources/policies.py
index b3891c73..7452080f 100644
--- a/src/asktable/resources/policies.py
+++ b/src/asktable/resources/policies.py
@@ -80,7 +80,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/policies",
+ "/v1/policies",
body=maybe_transform(
{
"dataset_config": dataset_config,
@@ -121,7 +121,7 @@ def retrieve(
if not policy_id:
raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}")
return self._get(
- f"/policies/{policy_id}",
+ f"/v1/policies/{policy_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -163,7 +163,7 @@ def update(
if not policy_id:
raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}")
return self._patch(
- f"/policies/{policy_id}",
+ f"/v1/policies/{policy_id}",
body=maybe_transform(
{
"dataset_config": dataset_config,
@@ -213,7 +213,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/policies",
+ "/v1/policies",
page=SyncPage[Policy],
options=make_request_options(
extra_headers=extra_headers,
@@ -260,7 +260,7 @@ def delete(
raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/policies/{policy_id}",
+ f"/v1/policies/{policy_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -320,7 +320,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/policies",
+ "/v1/policies",
body=await async_maybe_transform(
{
"dataset_config": dataset_config,
@@ -361,7 +361,7 @@ async def retrieve(
if not policy_id:
raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}")
return await self._get(
- f"/policies/{policy_id}",
+ f"/v1/policies/{policy_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -403,7 +403,7 @@ async def update(
if not policy_id:
raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}")
return await self._patch(
- f"/policies/{policy_id}",
+ f"/v1/policies/{policy_id}",
body=await async_maybe_transform(
{
"dataset_config": dataset_config,
@@ -453,7 +453,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/policies",
+ "/v1/policies",
page=AsyncPage[Policy],
options=make_request_options(
extra_headers=extra_headers,
@@ -500,7 +500,7 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/policies/{policy_id}",
+ f"/v1/policies/{policy_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/preferences.py b/src/asktable/resources/preferences.py
index 423f2682..886db40e 100644
--- a/src/asktable/resources/preferences.py
+++ b/src/asktable/resources/preferences.py
@@ -77,7 +77,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/preference",
+ "/v1/preference",
body=maybe_transform(
{
"general_preference": general_preference,
@@ -103,7 +103,7 @@ def retrieve(
) -> PreferenceRetrieveResponse:
"""获取偏好设置"""
return self._get(
- "/preference",
+ "/v1/preference",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -139,7 +139,7 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._patch(
- "/preference",
+ "/v1/preference",
body=maybe_transform(
{
"general_preference": general_preference,
@@ -165,7 +165,7 @@ def delete(
) -> object:
"""删除偏好设置"""
return self._delete(
- "/preference",
+ "/v1/preference",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -222,7 +222,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/preference",
+ "/v1/preference",
body=await async_maybe_transform(
{
"general_preference": general_preference,
@@ -248,7 +248,7 @@ async def retrieve(
) -> PreferenceRetrieveResponse:
"""获取偏好设置"""
return await self._get(
- "/preference",
+ "/v1/preference",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -284,7 +284,7 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._patch(
- "/preference",
+ "/v1/preference",
body=await async_maybe_transform(
{
"general_preference": general_preference,
@@ -310,7 +310,7 @@ async def delete(
) -> object:
"""删除偏好设置"""
return await self._delete(
- "/preference",
+ "/v1/preference",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/project.py b/src/asktable/resources/project.py
index 726b33af..3208457e 100644
--- a/src/asktable/resources/project.py
+++ b/src/asktable/resources/project.py
@@ -59,7 +59,7 @@ def retrieve(
) -> Project:
"""Get My Project"""
return self._get(
- "/project",
+ "/v1/project",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -95,7 +95,7 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._patch(
- "/project",
+ "/v1/project",
body=maybe_transform(
{
"llm_model_group": llm_model_group,
@@ -121,7 +121,7 @@ def list_model_groups(
) -> ProjectListModelGroupsResponse:
"""Get Llm Model Groups"""
return self._get(
- "/project/model-groups",
+ "/v1/project/model-groups",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -161,7 +161,7 @@ async def retrieve(
) -> Project:
"""Get My Project"""
return await self._get(
- "/project",
+ "/v1/project",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -197,7 +197,7 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._patch(
- "/project",
+ "/v1/project",
body=await async_maybe_transform(
{
"llm_model_group": llm_model_group,
@@ -223,7 +223,7 @@ async def list_model_groups(
) -> ProjectListModelGroupsResponse:
"""Get Llm Model Groups"""
return await self._get(
- "/project/model-groups",
+ "/v1/project/model-groups",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py
index 57f2954a..6d64fcde 100644
--- a/src/asktable/resources/roles.py
+++ b/src/asktable/resources/roles.py
@@ -77,7 +77,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/roles",
+ "/v1/roles",
body=maybe_transform(
{
"name": name,
@@ -117,7 +117,7 @@ def retrieve(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return self._get(
- f"/roles/{role_id}",
+ f"/v1/roles/{role_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -156,7 +156,7 @@ def update(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return self._patch(
- f"/roles/{role_id}",
+ f"/v1/roles/{role_id}",
body=maybe_transform(
{
"name": name,
@@ -205,7 +205,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/roles",
+ "/v1/roles",
page=SyncPage[Role],
options=make_request_options(
extra_headers=extra_headers,
@@ -251,7 +251,7 @@ def delete(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return self._delete(
- f"/roles/{role_id}",
+ f"/v1/roles/{role_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -284,7 +284,7 @@ def get_polices(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return self._get(
- f"/roles/{role_id}/policies",
+ f"/v1/roles/{role_id}/policies",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -323,7 +323,7 @@ def get_variables(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return self._get(
- f"/roles/{role_id}/variables",
+ f"/v1/roles/{role_id}/variables",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -390,7 +390,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/roles",
+ "/v1/roles",
body=await async_maybe_transform(
{
"name": name,
@@ -430,7 +430,7 @@ async def retrieve(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return await self._get(
- f"/roles/{role_id}",
+ f"/v1/roles/{role_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -469,7 +469,7 @@ async def update(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return await self._patch(
- f"/roles/{role_id}",
+ f"/v1/roles/{role_id}",
body=await async_maybe_transform(
{
"name": name,
@@ -518,7 +518,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/roles",
+ "/v1/roles",
page=AsyncPage[Role],
options=make_request_options(
extra_headers=extra_headers,
@@ -564,7 +564,7 @@ async def delete(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return await self._delete(
- f"/roles/{role_id}",
+ f"/v1/roles/{role_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -597,7 +597,7 @@ async def get_polices(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return await self._get(
- f"/roles/{role_id}/policies",
+ f"/v1/roles/{role_id}/policies",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -636,7 +636,7 @@ async def get_variables(
if not role_id:
raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}")
return await self._get(
- f"/roles/{role_id}/variables",
+ f"/v1/roles/{role_id}/variables",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/asktable/resources/scores.py b/src/asktable/resources/scores.py
index 45977016..cf0b5112 100644
--- a/src/asktable/resources/scores.py
+++ b/src/asktable/resources/scores.py
@@ -76,7 +76,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/score",
+ "/v1/score",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -147,7 +147,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/score",
+ "/v1/score",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/asktable/resources/securetunnels.py b/src/asktable/resources/securetunnels.py
index e20f329d..2614f8e1 100644
--- a/src/asktable/resources/securetunnels.py
+++ b/src/asktable/resources/securetunnels.py
@@ -79,7 +79,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/securetunnels",
+ "/v1/securetunnels",
body=maybe_transform({"name": name}, securetunnel_create_params.SecuretunnelCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -113,7 +113,7 @@ def retrieve(
if not securetunnel_id:
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
return self._get(
- f"/securetunnels/{securetunnel_id}",
+ f"/v1/securetunnels/{securetunnel_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -124,8 +124,8 @@ def update(
self,
securetunnel_id: str,
*,
- name: str,
client_info: Optional[object] | NotGiven = NOT_GIVEN,
+ name: Optional[str] | NotGiven = NOT_GIVEN,
unique_key: Optional[str] | NotGiven = NOT_GIVEN,
# 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.
@@ -138,10 +138,10 @@ def update(
更新某个 ATST
Args:
- name: SecureTunnel 名称,不超过 20 个字符
-
client_info: 客户端信息
+ name: SecureTunnel 名称,不超过 20 个字符
+
unique_key: 唯一标识,用于更新客户端信息(容器 ID)
extra_headers: Send extra headers
@@ -155,11 +155,11 @@ def update(
if not securetunnel_id:
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
return self._patch(
- f"/securetunnels/{securetunnel_id}",
+ f"/v1/securetunnels/{securetunnel_id}",
body=maybe_transform(
{
- "name": name,
"client_info": client_info,
+ "name": name,
"unique_key": unique_key,
},
securetunnel_update_params.SecuretunnelUpdateParams,
@@ -199,7 +199,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/securetunnels",
+ "/v1/securetunnels",
page=SyncPage[SecureTunnel],
options=make_request_options(
extra_headers=extra_headers,
@@ -244,7 +244,7 @@ def delete(
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/securetunnels/{securetunnel_id}",
+ f"/v1/securetunnels/{securetunnel_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -283,7 +283,7 @@ def list_links(
if not securetunnel_id:
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
return self._get_api_list(
- f"/securetunnels/{securetunnel_id}/links",
+ f"/v1/securetunnels/{securetunnel_id}/links",
page=SyncPage[SecuretunnelListLinksResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -348,7 +348,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/securetunnels",
+ "/v1/securetunnels",
body=await async_maybe_transform({"name": name}, securetunnel_create_params.SecuretunnelCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -382,7 +382,7 @@ async def retrieve(
if not securetunnel_id:
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
return await self._get(
- f"/securetunnels/{securetunnel_id}",
+ f"/v1/securetunnels/{securetunnel_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -393,8 +393,8 @@ async def update(
self,
securetunnel_id: str,
*,
- name: str,
client_info: Optional[object] | NotGiven = NOT_GIVEN,
+ name: Optional[str] | NotGiven = NOT_GIVEN,
unique_key: Optional[str] | NotGiven = NOT_GIVEN,
# 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.
@@ -407,10 +407,10 @@ async def update(
更新某个 ATST
Args:
- name: SecureTunnel 名称,不超过 20 个字符
-
client_info: 客户端信息
+ name: SecureTunnel 名称,不超过 20 个字符
+
unique_key: 唯一标识,用于更新客户端信息(容器 ID)
extra_headers: Send extra headers
@@ -424,11 +424,11 @@ async def update(
if not securetunnel_id:
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
return await self._patch(
- f"/securetunnels/{securetunnel_id}",
+ f"/v1/securetunnels/{securetunnel_id}",
body=await async_maybe_transform(
{
- "name": name,
"client_info": client_info,
+ "name": name,
"unique_key": unique_key,
},
securetunnel_update_params.SecuretunnelUpdateParams,
@@ -468,7 +468,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/securetunnels",
+ "/v1/securetunnels",
page=AsyncPage[SecureTunnel],
options=make_request_options(
extra_headers=extra_headers,
@@ -513,7 +513,7 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/securetunnels/{securetunnel_id}",
+ f"/v1/securetunnels/{securetunnel_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -552,7 +552,7 @@ def list_links(
if not securetunnel_id:
raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}")
return self._get_api_list(
- f"/securetunnels/{securetunnel_id}/links",
+ f"/v1/securetunnels/{securetunnel_id}/links",
page=AsyncPage[SecuretunnelListLinksResponse],
options=make_request_options(
extra_headers=extra_headers,
diff --git a/src/asktable/resources/sqls.py b/src/asktable/resources/sqls.py
index 65e98c2a..367f98b0 100644
--- a/src/asktable/resources/sqls.py
+++ b/src/asktable/resources/sqls.py
@@ -83,7 +83,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/single-turn/q2s",
+ "/v1/single-turn/q2s",
body=maybe_transform(
{
"datasource_id": datasource_id,
@@ -131,7 +131,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/single-turn/q2s",
+ "/v1/single-turn/q2s",
page=SyncPage[QueryResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -207,7 +207,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/single-turn/q2s",
+ "/v1/single-turn/q2s",
body=await async_maybe_transform(
{
"datasource_id": datasource_id,
@@ -255,7 +255,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/single-turn/q2s",
+ "/v1/single-turn/q2s",
page=AsyncPage[QueryResponse],
options=make_request_options(
extra_headers=extra_headers,
diff --git a/src/asktable/resources/sys/projects/api_keys.py b/src/asktable/resources/sys/projects/api_keys.py
index 7a16d66c..11d84397 100644
--- a/src/asktable/resources/sys/projects/api_keys.py
+++ b/src/asktable/resources/sys/projects/api_keys.py
@@ -77,7 +77,7 @@ def create(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._post(
- f"/sys/projects/{project_id}/api-keys",
+ f"/v1/sys/projects/{project_id}/api-keys",
body=maybe_transform({"ak_role": ak_role}, api_key_create_params.APIKeyCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -111,7 +111,7 @@ def list(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._get(
- f"/sys/projects/{project_id}/api-keys",
+ f"/v1/sys/projects/{project_id}/api-keys",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -148,7 +148,7 @@ def delete(
raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
- f"/sys/projects/{project_id}/api-keys/{key_id}",
+ f"/v1/sys/projects/{project_id}/api-keys/{key_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -193,7 +193,7 @@ def create_token(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._post(
- f"/sys/projects/{project_id}/tokens",
+ f"/v1/sys/projects/{project_id}/tokens",
body=maybe_transform(
{
"ak_role": ak_role,
@@ -259,7 +259,7 @@ async def create(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._post(
- f"/sys/projects/{project_id}/api-keys",
+ f"/v1/sys/projects/{project_id}/api-keys",
body=await async_maybe_transform({"ak_role": ak_role}, api_key_create_params.APIKeyCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -293,7 +293,7 @@ async def list(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._get(
- f"/sys/projects/{project_id}/api-keys",
+ f"/v1/sys/projects/{project_id}/api-keys",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -330,7 +330,7 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
- f"/sys/projects/{project_id}/api-keys/{key_id}",
+ f"/v1/sys/projects/{project_id}/api-keys/{key_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -375,7 +375,7 @@ async def create_token(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._post(
- f"/sys/projects/{project_id}/tokens",
+ f"/v1/sys/projects/{project_id}/tokens",
body=await async_maybe_transform(
{
"ak_role": ak_role,
diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py
index 29c51670..5d91c1ed 100644
--- a/src/asktable/resources/sys/projects/projects.py
+++ b/src/asktable/resources/sys/projects/projects.py
@@ -86,7 +86,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/sys/projects",
+ "/v1/sys/projects",
body=maybe_transform({"name": name}, project_create_params.ProjectCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -120,7 +120,7 @@ def retrieve(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._get(
- f"/sys/projects/{project_id}",
+ f"/v1/sys/projects/{project_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -162,7 +162,7 @@ def update(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._patch(
- f"/sys/projects/{project_id}",
+ f"/v1/sys/projects/{project_id}",
body=maybe_transform(
{
"llm_model_group": llm_model_group,
@@ -209,7 +209,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/sys/projects",
+ "/v1/sys/projects",
page=SyncPage[Project],
options=make_request_options(
extra_headers=extra_headers,
@@ -254,7 +254,7 @@ def delete(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._delete(
- f"/sys/projects/{project_id}",
+ f"/v1/sys/projects/{project_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -273,7 +273,7 @@ def model_groups(
) -> ProjectModelGroupsResponse:
"""Get Llm Model Groups"""
return self._get(
- "/sys/projects/model-groups",
+ "/v1/sys/projects/model-groups",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -331,7 +331,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/sys/projects",
+ "/v1/sys/projects",
body=await async_maybe_transform({"name": name}, project_create_params.ProjectCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -365,7 +365,7 @@ async def retrieve(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._get(
- f"/sys/projects/{project_id}",
+ f"/v1/sys/projects/{project_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -407,7 +407,7 @@ async def update(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._patch(
- f"/sys/projects/{project_id}",
+ f"/v1/sys/projects/{project_id}",
body=await async_maybe_transform(
{
"llm_model_group": llm_model_group,
@@ -454,7 +454,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/sys/projects",
+ "/v1/sys/projects",
page=AsyncPage[Project],
options=make_request_options(
extra_headers=extra_headers,
@@ -499,7 +499,7 @@ async def delete(
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._delete(
- f"/sys/projects/{project_id}",
+ f"/v1/sys/projects/{project_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -518,7 +518,7 @@ async def model_groups(
) -> ProjectModelGroupsResponse:
"""Get Llm Model Groups"""
return await self._get(
- "/sys/projects/model-groups",
+ "/v1/sys/projects/model-groups",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/asktable/resources/trainings.py b/src/asktable/resources/trainings.py
index faa25255..0a7f0922 100644
--- a/src/asktable/resources/trainings.py
+++ b/src/asktable/resources/trainings.py
@@ -75,7 +75,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
- "/training",
+ "/v1/training",
body=maybe_transform(body, Iterable[training_create_params.Body]),
options=make_request_options(
extra_headers=extra_headers,
@@ -119,7 +119,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/training",
+ "/v1/training",
page=SyncPage[TrainingListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -167,7 +167,7 @@ def delete(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._delete(
- f"/training/{id}",
+ f"/v1/training/{id}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -226,7 +226,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
- "/training",
+ "/v1/training",
body=await async_maybe_transform(body, Iterable[training_create_params.Body]),
options=make_request_options(
extra_headers=extra_headers,
@@ -272,7 +272,7 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
- "/training",
+ "/v1/training",
page=AsyncPage[TrainingListResponse],
options=make_request_options(
extra_headers=extra_headers,
@@ -320,7 +320,7 @@ async def delete(
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._delete(
- f"/training/{id}",
+ f"/v1/training/{id}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py
index 6b15da69..a132d23f 100644
--- a/src/asktable/types/__init__.py
+++ b/src/asktable/types/__init__.py
@@ -19,6 +19,7 @@
from .answer_response import AnswerResponse as AnswerResponse
from .bot_list_params import BotListParams as BotListParams
from .sql_list_params import SqlListParams as SqlListParams
+from .auth_me_response import AuthMeResponse as AuthMeResponse
from .chat_list_params import ChatListParams as ChatListParams
from .role_list_params import RoleListParams as RoleListParams
from .bot_create_params import BotCreateParams as BotCreateParams
@@ -48,7 +49,6 @@
from .training_delete_params import TrainingDeleteParams as TrainingDeleteParams
from .training_list_response import TrainingListResponse as TrainingListResponse
from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams
-from .chat_post_message_params import ChatPostMessageParams as ChatPostMessageParams
from .datasource_create_params import DatasourceCreateParams as DatasourceCreateParams
from .datasource_update_params import DatasourceUpdateParams as DatasourceUpdateParams
from .preference_create_params import PreferenceCreateParams as PreferenceCreateParams
@@ -57,7 +57,6 @@
from .training_create_response import TrainingCreateResponse as TrainingCreateResponse
from .role_get_polices_response import RoleGetPolicesResponse as RoleGetPolicesResponse
from .role_get_variables_params import RoleGetVariablesParams as RoleGetVariablesParams
-from .chat_post_message_response import ChatPostMessageResponse as ChatPostMessageResponse
from .datasource_add_file_params import DatasourceAddFileParams as DatasourceAddFileParams
from .preference_create_response import PreferenceCreateResponse as PreferenceCreateResponse
from .preference_update_response import PreferenceUpdateResponse as PreferenceUpdateResponse
diff --git a/src/asktable/types/auth_me_response.py b/src/asktable/types/auth_me_response.py
new file mode 100644
index 00000000..0db427fa
--- /dev/null
+++ b/src/asktable/types/auth_me_response.py
@@ -0,0 +1,24 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["AuthMeResponse"]
+
+
+class AuthMeResponse(BaseModel):
+ ak_role: Literal["sys", "admin", "asker", "visitor"]
+
+ project_id: str
+
+ ak_id: Optional[str] = None
+
+ chat_role: Optional[object] = None
+
+ exp: Optional[int] = None
+
+ locked: Optional[bool] = None
+
+ user_profile: Optional[object] = None
diff --git a/src/asktable/types/chat.py b/src/asktable/types/chat.py
index 5aacbcc2..5d26c3e8 100644
--- a/src/asktable/types/chat.py
+++ b/src/asktable/types/chat.py
@@ -2,6 +2,7 @@
from typing import Dict, Union, Optional
from datetime import datetime
+from typing_extensions import Literal
from .._models import BaseModel
@@ -20,6 +21,10 @@ class Chat(BaseModel):
project_id: str
+ status: Literal["active", "pending", "error", "fatal"]
+
+ status_message: Optional[str] = None
+
bot_id: Optional[str] = None
"""
机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义
diff --git a/src/asktable/types/chat_post_message_params.py b/src/asktable/types/chat_post_message_params.py
deleted file mode 100644
index 31a7464d..00000000
--- a/src/asktable/types/chat_post_message_params.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Required, TypedDict
-
-__all__ = ["ChatPostMessageParams"]
-
-
-class ChatPostMessageParams(TypedDict, total=False):
- question: Required[str]
diff --git a/src/asktable/types/chat_post_message_response.py b/src/asktable/types/chat_post_message_response.py
deleted file mode 100644
index fb2c48a6..00000000
--- a/src/asktable/types/chat_post_message_response.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union
-from typing_extensions import TypeAlias
-
-from .ai_message import AIMessage
-from .tool_message import ToolMessage
-from .user_message import UserMessage
-
-__all__ = ["ChatPostMessageResponse"]
-
-ChatPostMessageResponse: TypeAlias = Union[UserMessage, AIMessage, ToolMessage]
diff --git a/src/asktable/types/chat_retrieve_response.py b/src/asktable/types/chat_retrieve_response.py
index 2a39fb44..2999466c 100644
--- a/src/asktable/types/chat_retrieve_response.py
+++ b/src/asktable/types/chat_retrieve_response.py
@@ -2,6 +2,7 @@
from typing import Dict, List, Union, Optional
from datetime import datetime
+from typing_extensions import Literal
from .._models import BaseModel
@@ -15,19 +16,23 @@ class ChatRetrieveResponse(BaseModel):
created_at: datetime
"""创建时间"""
- datasource_ids: List[str]
-
modified_at: datetime
"""修改时间"""
project_id: str
+ status: Literal["active", "pending", "error", "fatal"]
+
+ status_message: Optional[str] = None
+
bot_id: Optional[str] = None
"""
机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义
可以访问的数据、可以执行的任务以及是否开启调试模式等设置。
"""
+ datasource_ids: Optional[List[str]] = None
+
name: Optional[str] = None
"""New name for the chat"""
@@ -42,3 +47,5 @@ class ChatRetrieveResponse(BaseModel):
user_profile: Optional[Dict[str, str]] = None
"""用户信息,用于在对话中传递用户的信息,用 Key-Value 形式传递"""
+
+ welcome_message: Optional[str] = None
diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py
index 3969f435..678c320f 100644
--- a/src/asktable/types/datasource.py
+++ b/src/asktable/types/datasource.py
@@ -29,6 +29,7 @@ class Datasource(BaseModel):
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
]
"""数据源引擎"""
diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py
index a3f96f4d..1079a4c5 100644
--- a/src/asktable/types/datasource_create_params.py
+++ b/src/asktable/types/datasource_create_params.py
@@ -28,14 +28,11 @@ class DatasourceCreateParams(TypedDict, total=False):
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
]
]
"""数据源引擎"""
- async_process_meta: bool
-
- value_index: bool
-
access_config: Optional[AccessConfig]
"""不同引擎有不同的配置"""
diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py
index 95dd70ad..18301f2a 100644
--- a/src/asktable/types/datasource_retrieve_response.py
+++ b/src/asktable/types/datasource_retrieve_response.py
@@ -74,6 +74,7 @@ class DatasourceRetrieveResponse(BaseModel):
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
]
"""数据源引擎"""
diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py
index 41bef537..6f268d1d 100644
--- a/src/asktable/types/datasource_update_params.py
+++ b/src/asktable/types/datasource_update_params.py
@@ -34,6 +34,7 @@ class DatasourceUpdateParams(TypedDict, total=False):
"oracle",
"polardbmysql",
"polardbpg",
+ "dameng",
]
]
"""数据源引擎"""
diff --git a/src/asktable/types/datasources/meta_create_params.py b/src/asktable/types/datasources/meta_create_params.py
index 2df479ec..5684c17b 100644
--- a/src/asktable/types/datasources/meta_create_params.py
+++ b/src/asktable/types/datasources/meta_create_params.py
@@ -2,10 +2,10 @@
from __future__ import annotations
-from typing import Dict, Optional
+from typing import Dict, List, Optional
from typing_extensions import Required, TypedDict
-__all__ = ["MetaCreateParams", "Schemas", "SchemasTables", "SchemasTablesFields"]
+__all__ = ["MetaCreateParams", "Meta", "MetaSchemas", "MetaSchemasTables", "MetaSchemasTablesFields"]
class MetaCreateParams(TypedDict, total=False):
@@ -13,41 +13,50 @@ class MetaCreateParams(TypedDict, total=False):
value_index: bool
- schemas: Dict[str, Schemas]
+ meta: Optional[Meta]
+ selected_tables: Optional[Dict[str, List[str]]]
-class SchemasTablesFields(TypedDict, total=False):
+
+class MetaSchemasTablesFields(TypedDict, total=False):
name: Required[str]
"""field_name"""
+ origin_desc: Required[str]
+ """field description from database"""
+
data_type: Optional[str]
"""field data type"""
- origin_desc: Optional[str]
- """field description from database"""
-
sample_data: Optional[str]
"""field sample data"""
+ visibility: bool
+ """field visibility"""
+
-class SchemasTables(TypedDict, total=False):
+class MetaSchemasTables(TypedDict, total=False):
name: Required[str]
"""table_name"""
- fields: Dict[str, SchemasTablesFields]
-
- origin_desc: Optional[str]
+ origin_desc: Required[str]
"""table description from database"""
+ fields: Dict[str, MetaSchemasTablesFields]
+
-class Schemas(TypedDict, total=False):
+class MetaSchemas(TypedDict, total=False):
name: Required[str]
"""schema_name"""
+ origin_desc: Required[str]
+ """schema description from database"""
+
custom_configs: Optional[object]
"""custom configs"""
- origin_desc: Optional[str]
- """schema description from database"""
+ tables: Dict[str, MetaSchemasTables]
+
- tables: Dict[str, SchemasTables]
+class Meta(TypedDict, total=False):
+ schemas: Required[Dict[str, MetaSchemas]]
diff --git a/src/asktable/types/datasources/meta_update_params.py b/src/asktable/types/datasources/meta_update_params.py
index e859a334..997a0110 100644
--- a/src/asktable/types/datasources/meta_update_params.py
+++ b/src/asktable/types/datasources/meta_update_params.py
@@ -2,48 +2,59 @@
from __future__ import annotations
-from typing import Dict, Optional
+from typing import Dict, List, Optional
from typing_extensions import Required, TypedDict
-__all__ = ["MetaUpdateParams", "Schemas", "SchemasTables", "SchemasTablesFields"]
+__all__ = ["MetaUpdateParams", "Meta", "MetaSchemas", "MetaSchemasTables", "MetaSchemasTablesFields"]
class MetaUpdateParams(TypedDict, total=False):
- schemas: Dict[str, Schemas]
+ async_process_meta: bool
+ meta: Optional[Meta]
-class SchemasTablesFields(TypedDict, total=False):
+ selected_tables: Optional[Dict[str, List[str]]]
+
+
+class MetaSchemasTablesFields(TypedDict, total=False):
name: Required[str]
"""field_name"""
+ origin_desc: Required[str]
+ """field description from database"""
+
data_type: Optional[str]
"""field data type"""
- origin_desc: Optional[str]
- """field description from database"""
-
sample_data: Optional[str]
"""field sample data"""
+ visibility: bool
+ """field visibility"""
+
-class SchemasTables(TypedDict, total=False):
+class MetaSchemasTables(TypedDict, total=False):
name: Required[str]
"""table_name"""
- fields: Dict[str, SchemasTablesFields]
-
- origin_desc: Optional[str]
+ origin_desc: Required[str]
"""table description from database"""
+ fields: Dict[str, MetaSchemasTablesFields]
+
-class Schemas(TypedDict, total=False):
+class MetaSchemas(TypedDict, total=False):
name: Required[str]
"""schema_name"""
+ origin_desc: Required[str]
+ """schema description from database"""
+
custom_configs: Optional[object]
"""custom configs"""
- origin_desc: Optional[str]
- """schema description from database"""
+ tables: Dict[str, MetaSchemasTables]
+
- tables: Dict[str, SchemasTables]
+class Meta(TypedDict, total=False):
+ schemas: Required[Dict[str, MetaSchemas]]
diff --git a/src/asktable/types/extapi.py b/src/asktable/types/extapi.py
index 0d90cc1b..902ffbf0 100644
--- a/src/asktable/types/extapi.py
+++ b/src/asktable/types/extapi.py
@@ -21,7 +21,7 @@ class Extapi(BaseModel):
project_id: str
+ updated_at: datetime
+
headers: Optional[Dict[str, str]] = None
"""HTTP Headers,JSON 格式"""
-
- updated_at: Optional[datetime] = None
diff --git a/src/asktable/types/extapis/extapi_route.py b/src/asktable/types/extapis/extapi_route.py
index 3525c711..299a7c94 100644
--- a/src/asktable/types/extapis/extapi_route.py
+++ b/src/asktable/types/extapis/extapi_route.py
@@ -27,6 +27,8 @@ class ExtapiRoute(BaseModel):
project_id: str
+ updated_at: datetime
+
body_params_desc: Optional[str] = None
"""请求体参数描述"""
@@ -35,5 +37,3 @@ class ExtapiRoute(BaseModel):
query_params_desc: Optional[str] = None
"""查询参数描述"""
-
- updated_at: Optional[datetime] = None
diff --git a/src/asktable/types/extapis/route_create_params.py b/src/asktable/types/extapis/route_create_params.py
index 8f0435fe..e58f6e3e 100644
--- a/src/asktable/types/extapis/route_create_params.py
+++ b/src/asktable/types/extapis/route_create_params.py
@@ -29,6 +29,8 @@ class RouteCreateParams(TypedDict, total=False):
project_id: Required[str]
+ updated_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
+
body_params_desc: Optional[str]
"""请求体参数描述"""
@@ -37,5 +39,3 @@ class RouteCreateParams(TypedDict, total=False):
query_params_desc: Optional[str]
"""查询参数描述"""
-
- updated_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
diff --git a/src/asktable/types/meta.py b/src/asktable/types/meta.py
index a2cfa262..c7c1877a 100644
--- a/src/asktable/types/meta.py
+++ b/src/asktable/types/meta.py
@@ -12,6 +12,9 @@ class SchemasTablesFields(BaseModel):
created_at: datetime
"""created time"""
+ curr_desc: str
+ """current field description"""
+
curr_desc_stat: str
"""current field description status"""
@@ -24,59 +27,59 @@ class SchemasTablesFields(BaseModel):
name: str
"""field_name"""
- curr_desc: Optional[str] = None
- """current field description"""
+ origin_desc: str
+ """field description from database"""
data_type: Optional[str] = None
"""field data type"""
- origin_desc: Optional[str] = None
- """field description from database"""
-
sample_data: Optional[str] = None
"""field sample data"""
+ visibility: Optional[bool] = None
+ """field visibility"""
+
class SchemasTables(BaseModel):
+ curr_desc: str
+ """current table description"""
+
curr_desc_stat: str
"""current table description status"""
+ fields: Dict[str, SchemasTablesFields]
+
full_name: str
"""field full name"""
name: str
"""table_name"""
- curr_desc: Optional[str] = None
- """current table description"""
-
- fields: Optional[Dict[str, SchemasTablesFields]] = None
-
- origin_desc: Optional[str] = None
+ origin_desc: str
"""table description from database"""
class Schemas(BaseModel):
+ curr_desc: str
+ """current schema description"""
+
curr_desc_stat: str
"""current schema description status"""
name: str
"""schema_name"""
- curr_desc: Optional[str] = None
- """current schema description"""
+ origin_desc: str
+ """schema description from database"""
+
+ tables: Dict[str, SchemasTables]
custom_configs: Optional[object] = None
"""custom configs"""
- origin_desc: Optional[str] = None
- """schema description from database"""
-
- tables: Optional[Dict[str, SchemasTables]] = None
-
class Meta(BaseModel):
datasource_id: str
"""datasource_id"""
- schemas: Optional[Dict[str, Schemas]] = None
+ schemas: Dict[str, Schemas]
diff --git a/src/asktable/types/securetunnel_update_params.py b/src/asktable/types/securetunnel_update_params.py
index e42566a6..6322936a 100644
--- a/src/asktable/types/securetunnel_update_params.py
+++ b/src/asktable/types/securetunnel_update_params.py
@@ -3,17 +3,17 @@
from __future__ import annotations
from typing import Optional
-from typing_extensions import Required, TypedDict
+from typing_extensions import TypedDict
__all__ = ["SecuretunnelUpdateParams"]
class SecuretunnelUpdateParams(TypedDict, total=False):
- name: Required[str]
- """SecureTunnel 名称,不超过 20 个字符"""
-
client_info: Optional[object]
"""客户端信息"""
+ name: Optional[str]
+ """SecureTunnel 名称,不超过 20 个字符"""
+
unique_key: Optional[str]
"""唯一标识,用于更新客户端信息(容器 ID)"""
diff --git a/src/asktable/types/sys/model_group.py b/src/asktable/types/sys/model_group.py
index fe4854ba..8d700122 100644
--- a/src/asktable/types/sys/model_group.py
+++ b/src/asktable/types/sys/model_group.py
@@ -1,6 +1,5 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List
from ..._models import BaseModel
@@ -11,14 +10,20 @@ class ModelGroup(BaseModel):
id: str
"""模型组 ID"""
- agent_model: str
+ agent: str
"""Agent 模型"""
- image_models: List[str]
- """图像模型列表"""
+ fast: str
+ """快速模型"""
+
+ image: str
+ """图片模型"""
name: str
"""模型组名称"""
- text_models: List[str]
- """文本模型列表"""
+ omni: str
+ """通用模型"""
+
+ sql: str
+ """SQL 模型"""
diff --git a/tests/api_resources/datasources/test_meta.py b/tests/api_resources/datasources/test_meta.py
index 2b7c993d..4b5c86a0 100644
--- a/tests/api_resources/datasources/test_meta.py
+++ b/tests/api_resources/datasources/test_meta.py
@@ -30,27 +30,31 @@ def test_method_create_with_all_params(self, client: Asktable) -> None:
datasource_id="datasource_id",
async_process_meta=True,
value_index=True,
- schemas={
- "foo": {
- "name": "name",
- "custom_configs": {},
- "origin_desc": "origin_desc",
- "tables": {
- "foo": {
- "name": "name",
- "fields": {
- "foo": {
- "name": "name",
- "data_type": "data_type",
- "origin_desc": "origin_desc",
- "sample_data": "sample_data",
- }
- },
- "origin_desc": "origin_desc",
- }
- },
+ meta={
+ "schemas": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "custom_configs": {},
+ "tables": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "fields": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "data_type": "data_type",
+ "sample_data": "sample_data",
+ "visibility": True,
+ }
+ },
+ }
+ },
+ }
}
},
+ selected_tables={"foo": ["string"]},
)
assert_matches_type(object, meta, path=["response"])
@@ -134,27 +138,32 @@ def test_method_update(self, client: Asktable) -> None:
def test_method_update_with_all_params(self, client: Asktable) -> None:
meta = client.datasources.meta.update(
datasource_id="datasource_id",
- schemas={
- "foo": {
- "name": "name",
- "custom_configs": {},
- "origin_desc": "origin_desc",
- "tables": {
- "foo": {
- "name": "name",
- "fields": {
- "foo": {
- "name": "name",
- "data_type": "data_type",
- "origin_desc": "origin_desc",
- "sample_data": "sample_data",
- }
- },
- "origin_desc": "origin_desc",
- }
- },
+ async_process_meta=True,
+ meta={
+ "schemas": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "custom_configs": {},
+ "tables": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "fields": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "data_type": "data_type",
+ "sample_data": "sample_data",
+ "visibility": True,
+ }
+ },
+ }
+ },
+ }
}
},
+ selected_tables={"foo": ["string"]},
)
assert_matches_type(object, meta, path=["response"])
@@ -248,27 +257,31 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable)
datasource_id="datasource_id",
async_process_meta=True,
value_index=True,
- schemas={
- "foo": {
- "name": "name",
- "custom_configs": {},
- "origin_desc": "origin_desc",
- "tables": {
- "foo": {
- "name": "name",
- "fields": {
- "foo": {
- "name": "name",
- "data_type": "data_type",
- "origin_desc": "origin_desc",
- "sample_data": "sample_data",
- }
- },
- "origin_desc": "origin_desc",
- }
- },
+ meta={
+ "schemas": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "custom_configs": {},
+ "tables": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "fields": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "data_type": "data_type",
+ "sample_data": "sample_data",
+ "visibility": True,
+ }
+ },
+ }
+ },
+ }
}
},
+ selected_tables={"foo": ["string"]},
)
assert_matches_type(object, meta, path=["response"])
@@ -352,27 +365,32 @@ async def test_method_update(self, async_client: AsyncAsktable) -> None:
async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None:
meta = await async_client.datasources.meta.update(
datasource_id="datasource_id",
- schemas={
- "foo": {
- "name": "name",
- "custom_configs": {},
- "origin_desc": "origin_desc",
- "tables": {
- "foo": {
- "name": "name",
- "fields": {
- "foo": {
- "name": "name",
- "data_type": "data_type",
- "origin_desc": "origin_desc",
- "sample_data": "sample_data",
- }
- },
- "origin_desc": "origin_desc",
- }
- },
+ async_process_meta=True,
+ meta={
+ "schemas": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "custom_configs": {},
+ "tables": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "fields": {
+ "foo": {
+ "name": "name",
+ "origin_desc": "origin_desc",
+ "data_type": "data_type",
+ "sample_data": "sample_data",
+ "visibility": True,
+ }
+ },
+ }
+ },
+ }
}
},
+ selected_tables={"foo": ["string"]},
)
assert_matches_type(object, meta, path=["response"])
diff --git a/tests/api_resources/extapis/test_routes.py b/tests/api_resources/extapis/test_routes.py
index 5fa13718..1076391e 100644
--- a/tests/api_resources/extapis/test_routes.py
+++ b/tests/api_resources/extapis/test_routes.py
@@ -29,6 +29,7 @@ def test_method_create(self, client: Asktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert_matches_type(ExtapiRoute, route, path=["response"])
@@ -43,10 +44,10 @@ def test_method_create_with_all_params(self, client: Asktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_params_desc="body_params_desc",
path_params_desc="path_params_desc",
query_params_desc="query_params_desc",
- updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert_matches_type(ExtapiRoute, route, path=["response"])
@@ -61,6 +62,7 @@ def test_raw_response_create(self, client: Asktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert response.is_closed is True
@@ -79,6 +81,7 @@ def test_streaming_response_create(self, client: Asktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -100,6 +103,7 @@ def test_path_params_create(self, client: Asktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
@parametrize
@@ -313,6 +317,7 @@ async def test_method_create(self, async_client: AsyncAsktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert_matches_type(ExtapiRoute, route, path=["response"])
@@ -327,10 +332,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable)
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
body_params_desc="body_params_desc",
path_params_desc="path_params_desc",
query_params_desc="query_params_desc",
- updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert_matches_type(ExtapiRoute, route, path=["response"])
@@ -345,6 +350,7 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert response.is_closed is True
@@ -363,6 +369,7 @@ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> N
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -384,6 +391,7 @@ async def test_path_params_create(self, async_client: AsyncAsktable) -> None:
name="name",
path="/resource",
project_id="project_id",
+ updated_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
@parametrize
diff --git a/tests/api_resources/test_auth.py b/tests/api_resources/test_auth.py
index 280554a4..a834d2c3 100644
--- a/tests/api_resources/test_auth.py
+++ b/tests/api_resources/test_auth.py
@@ -9,6 +9,7 @@
from asktable import Asktable, AsyncAsktable
from tests.utils import assert_matches_type
+from asktable.types import AuthMeResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -57,7 +58,7 @@ def test_streaming_response_create_token(self, client: Asktable) -> None:
@parametrize
def test_method_me(self, client: Asktable) -> None:
auth = client.auth.me()
- assert_matches_type(object, auth, path=["response"])
+ assert_matches_type(AuthMeResponse, auth, path=["response"])
@parametrize
def test_raw_response_me(self, client: Asktable) -> None:
@@ -66,7 +67,7 @@ def test_raw_response_me(self, client: Asktable) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
auth = response.parse()
- assert_matches_type(object, auth, path=["response"])
+ assert_matches_type(AuthMeResponse, auth, path=["response"])
@parametrize
def test_streaming_response_me(self, client: Asktable) -> None:
@@ -75,7 +76,7 @@ def test_streaming_response_me(self, client: Asktable) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
auth = response.parse()
- assert_matches_type(object, auth, path=["response"])
+ assert_matches_type(AuthMeResponse, auth, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -124,7 +125,7 @@ async def test_streaming_response_create_token(self, async_client: AsyncAsktable
@parametrize
async def test_method_me(self, async_client: AsyncAsktable) -> None:
auth = await async_client.auth.me()
- assert_matches_type(object, auth, path=["response"])
+ assert_matches_type(AuthMeResponse, auth, path=["response"])
@parametrize
async def test_raw_response_me(self, async_client: AsyncAsktable) -> None:
@@ -133,7 +134,7 @@ async def test_raw_response_me(self, async_client: AsyncAsktable) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
auth = await response.parse()
- assert_matches_type(object, auth, path=["response"])
+ assert_matches_type(AuthMeResponse, auth, path=["response"])
@parametrize
async def test_streaming_response_me(self, async_client: AsyncAsktable) -> None:
@@ -142,6 +143,6 @@ async def test_streaming_response_me(self, async_client: AsyncAsktable) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
auth = await response.parse()
- assert_matches_type(object, auth, path=["response"])
+ assert_matches_type(AuthMeResponse, auth, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_chats.py b/tests/api_resources/test_chats.py
index 662e2035..5a84e9da 100644
--- a/tests/api_resources/test_chats.py
+++ b/tests/api_resources/test_chats.py
@@ -9,11 +9,7 @@
from asktable import Asktable, AsyncAsktable
from tests.utils import assert_matches_type
-from asktable.types import (
- Chat,
- ChatRetrieveResponse,
- ChatPostMessageResponse,
-)
+from asktable.types import Chat, ChatRetrieveResponse
from asktable.pagination import SyncPage, AsyncPage
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -171,48 +167,6 @@ def test_path_params_delete(self, client: Asktable) -> None:
"",
)
- @parametrize
- def test_method_post_message(self, client: Asktable) -> None:
- chat = client.chats.post_message(
- chat_id="chat_id",
- question="question",
- )
- assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
-
- @parametrize
- def test_raw_response_post_message(self, client: Asktable) -> None:
- response = client.chats.with_raw_response.post_message(
- chat_id="chat_id",
- question="question",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- chat = response.parse()
- assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
-
- @parametrize
- def test_streaming_response_post_message(self, client: Asktable) -> None:
- with client.chats.with_streaming_response.post_message(
- chat_id="chat_id",
- question="question",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- chat = response.parse()
- assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_post_message(self, client: Asktable) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"):
- client.chats.with_raw_response.post_message(
- chat_id="",
- question="question",
- )
-
class TestAsyncChats:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -365,45 +319,3 @@ async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
await async_client.chats.with_raw_response.delete(
"",
)
-
- @parametrize
- async def test_method_post_message(self, async_client: AsyncAsktable) -> None:
- chat = await async_client.chats.post_message(
- chat_id="chat_id",
- question="question",
- )
- assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
-
- @parametrize
- async def test_raw_response_post_message(self, async_client: AsyncAsktable) -> None:
- response = await async_client.chats.with_raw_response.post_message(
- chat_id="chat_id",
- question="question",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- chat = await response.parse()
- assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
-
- @parametrize
- async def test_streaming_response_post_message(self, async_client: AsyncAsktable) -> None:
- async with async_client.chats.with_streaming_response.post_message(
- chat_id="chat_id",
- question="question",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- chat = await response.parse()
- assert_matches_type(ChatPostMessageResponse, chat, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_post_message(self, async_client: AsyncAsktable) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"):
- await async_client.chats.with_raw_response.post_message(
- chat_id="",
- question="question",
- )
diff --git a/tests/api_resources/test_datasources.py b/tests/api_resources/test_datasources.py
index 5dc99ec4..6cb041a0 100644
--- a/tests/api_resources/test_datasources.py
+++ b/tests/api_resources/test_datasources.py
@@ -32,8 +32,6 @@ def test_method_create(self, client: Asktable) -> None:
def test_method_create_with_all_params(self, client: Asktable) -> None:
datasource = client.datasources.create(
engine="mysql",
- async_process_meta=True,
- value_index=True,
access_config={
"host": "192.168.0.10",
"db": "at_test",
@@ -351,8 +349,6 @@ async def test_method_create(self, async_client: AsyncAsktable) -> None:
async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
datasource = await async_client.datasources.create(
engine="mysql",
- async_process_meta=True,
- value_index=True,
access_config={
"host": "192.168.0.10",
"db": "at_test",
diff --git a/tests/api_resources/test_securetunnels.py b/tests/api_resources/test_securetunnels.py
index 1c9f0a84..6b2602a7 100644
--- a/tests/api_resources/test_securetunnels.py
+++ b/tests/api_resources/test_securetunnels.py
@@ -94,7 +94,6 @@ def test_path_params_retrieve(self, client: Asktable) -> None:
def test_method_update(self, client: Asktable) -> None:
securetunnel = client.securetunnels.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
@@ -102,8 +101,8 @@ def test_method_update(self, client: Asktable) -> None:
def test_method_update_with_all_params(self, client: Asktable) -> None:
securetunnel = client.securetunnels.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
client_info={},
+ name="我的测试机",
unique_key="unique_key",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
@@ -112,7 +111,6 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
def test_raw_response_update(self, client: Asktable) -> None:
response = client.securetunnels.with_raw_response.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
)
assert response.is_closed is True
@@ -124,7 +122,6 @@ def test_raw_response_update(self, client: Asktable) -> None:
def test_streaming_response_update(self, client: Asktable) -> None:
with client.securetunnels.with_streaming_response.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -139,7 +136,6 @@ def test_path_params_update(self, client: Asktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `securetunnel_id` but received ''"):
client.securetunnels.with_raw_response.update(
securetunnel_id="",
- name="我的测试机",
)
@parametrize
@@ -337,7 +333,6 @@ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
async def test_method_update(self, async_client: AsyncAsktable) -> None:
securetunnel = await async_client.securetunnels.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
@@ -345,8 +340,8 @@ async def test_method_update(self, async_client: AsyncAsktable) -> None:
async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None:
securetunnel = await async_client.securetunnels.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
client_info={},
+ name="我的测试机",
unique_key="unique_key",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
@@ -355,7 +350,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
response = await async_client.securetunnels.with_raw_response.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
)
assert response.is_closed is True
@@ -367,7 +361,6 @@ async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
async def test_streaming_response_update(self, async_client: AsyncAsktable) -> None:
async with async_client.securetunnels.with_streaming_response.update(
securetunnel_id="securetunnel_id",
- name="我的测试机",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -382,7 +375,6 @@ async def test_path_params_update(self, async_client: AsyncAsktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `securetunnel_id` but received ''"):
await async_client.securetunnels.with_raw_response.update(
securetunnel_id="",
- name="我的测试机",
)
@parametrize
diff --git a/tests/test_client.py b/tests/test_client.py
index 686afa13..1efc0ea1 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -704,11 +704,11 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str
@mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/datasources").mock(side_effect=httpx.TimeoutException("Test timeout error"))
+ respx_mock.post("/v1/datasources").mock(side_effect=httpx.TimeoutException("Test timeout error"))
with pytest.raises(APITimeoutError):
self.client.post(
- "/datasources",
+ "/v1/datasources",
body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -719,11 +719,11 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
@mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/datasources").mock(return_value=httpx.Response(500))
+ respx_mock.post("/v1/datasources").mock(return_value=httpx.Response(500))
with pytest.raises(APIStatusError):
self.client.post(
- "/datasources",
+ "/v1/datasources",
body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -755,7 +755,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/datasources").mock(side_effect=retry_handler)
+ respx_mock.post("/v1/datasources").mock(side_effect=retry_handler)
response = client.datasources.with_raw_response.create(engine="mysql")
@@ -779,7 +779,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/datasources").mock(side_effect=retry_handler)
+ respx_mock.post("/v1/datasources").mock(side_effect=retry_handler)
response = client.datasources.with_raw_response.create(
engine="mysql", extra_headers={"x-stainless-retry-count": Omit()}
@@ -804,7 +804,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/datasources").mock(side_effect=retry_handler)
+ respx_mock.post("/v1/datasources").mock(side_effect=retry_handler)
response = client.datasources.with_raw_response.create(
engine="mysql", extra_headers={"x-stainless-retry-count": "42"}
@@ -1474,11 +1474,11 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte
@mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/datasources").mock(side_effect=httpx.TimeoutException("Test timeout error"))
+ respx_mock.post("/v1/datasources").mock(side_effect=httpx.TimeoutException("Test timeout error"))
with pytest.raises(APITimeoutError):
await self.client.post(
- "/datasources",
+ "/v1/datasources",
body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -1489,11 +1489,11 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
@mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/datasources").mock(return_value=httpx.Response(500))
+ respx_mock.post("/v1/datasources").mock(return_value=httpx.Response(500))
with pytest.raises(APIStatusError):
await self.client.post(
- "/datasources",
+ "/v1/datasources",
body=cast(object, maybe_transform(dict(engine="mysql"), DatasourceCreateParams)),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -1526,7 +1526,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/datasources").mock(side_effect=retry_handler)
+ respx_mock.post("/v1/datasources").mock(side_effect=retry_handler)
response = await client.datasources.with_raw_response.create(engine="mysql")
@@ -1551,7 +1551,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/datasources").mock(side_effect=retry_handler)
+ respx_mock.post("/v1/datasources").mock(side_effect=retry_handler)
response = await client.datasources.with_raw_response.create(
engine="mysql", extra_headers={"x-stainless-retry-count": Omit()}
@@ -1577,7 +1577,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/datasources").mock(side_effect=retry_handler)
+ respx_mock.post("/v1/datasources").mock(side_effect=retry_handler)
response = await client.datasources.with_raw_response.create(
engine="mysql", extra_headers={"x-stainless-retry-count": "42"}
From 202e0658ba17073019c1124d9cb726f79e5f0a48 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:16:57 +0000
Subject: [PATCH 31/32] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index c952c498..559383cc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 93
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-63796b5061f281e8709c0a13d5b4747be88738df5f77406b683604890083d41e.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-02fbb644978089e8596def9999f5729633b652fba35bf04e374dbb71e7630355.yml
From dfbe97ebaf04039c37686aaf8eb550acccd9a83c Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:17:23 +0000
Subject: [PATCH 32/32] release: 4.6.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 48 +++++++++++++++++++++++++++++++++++
pyproject.toml | 2 +-
src/asktable/_version.py | 2 +-
4 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 3d5f4e35..1269f909 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.5.0"
+ ".": "4.6.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ed73450..26d3824b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,53 @@
# Changelog
+## 4.6.0 (2025-03-15)
+
+Full Changelog: [v4.5.0...v4.6.0](https://github.com/DataMini/asktable-python/compare/v4.5.0...v4.6.0)
+
+### Features
+
+* **api:** api update ([#144](https://github.com/DataMini/asktable-python/issues/144)) ([668a25d](https://github.com/DataMini/asktable-python/commit/668a25dd349090c2f095d068a0ada72587aac38f))
+* **api:** manual updates ([#167](https://github.com/DataMini/asktable-python/issues/167)) ([06c63d2](https://github.com/DataMini/asktable-python/commit/06c63d292a5278295e93c4d7a65cf25b02234e2b))
+* **api:** manual updates ([#168](https://github.com/DataMini/asktable-python/issues/168)) ([8990ba9](https://github.com/DataMini/asktable-python/commit/8990ba9c162f2224e23e8db58646f2c485f77e1c))
+* **client:** allow passing `NotGiven` for body ([#155](https://github.com/DataMini/asktable-python/issues/155)) ([153f86b](https://github.com/DataMini/asktable-python/commit/153f86b5c5c0099edc9b0622ebe36553b653e8ca))
+* **client:** send `X-Stainless-Read-Timeout` header ([#149](https://github.com/DataMini/asktable-python/issues/149)) ([2bbef8d](https://github.com/DataMini/asktable-python/commit/2bbef8d335a87602e14fbea387f3b7fe136424f0))
+
+
+### Bug Fixes
+
+* asyncify on non-asyncio runtimes ([#153](https://github.com/DataMini/asktable-python/issues/153)) ([92577a2](https://github.com/DataMini/asktable-python/commit/92577a2765975e59273e218ba20c93cbed7a05c1))
+* **client:** mark some request bodies as optional ([153f86b](https://github.com/DataMini/asktable-python/commit/153f86b5c5c0099edc9b0622ebe36553b653e8ca))
+* improve names for conflicting params ([#148](https://github.com/DataMini/asktable-python/issues/148)) ([3f9650f](https://github.com/DataMini/asktable-python/commit/3f9650f5519444a1517dcf85bf313780e5dd6cce))
+* **types:** handle more discriminated union shapes ([#166](https://github.com/DataMini/asktable-python/issues/166)) ([850d425](https://github.com/DataMini/asktable-python/commit/850d425cf365d48cc9f7a41d09d295e8547befdf))
+
+
+### Chores
+
+* **docs:** update client docstring ([#159](https://github.com/DataMini/asktable-python/issues/159)) ([5a0da4d](https://github.com/DataMini/asktable-python/commit/5a0da4dd6288d7d55b7b2d4585b12e876d384423))
+* **internal:** bummp ruff dependency ([#147](https://github.com/DataMini/asktable-python/issues/147)) ([9638e50](https://github.com/DataMini/asktable-python/commit/9638e50e2a5325ba4cb66e8cd987d96da80f37d5))
+* **internal:** bump rye to 0.44.0 ([#165](https://github.com/DataMini/asktable-python/issues/165)) ([5ead610](https://github.com/DataMini/asktable-python/commit/5ead610c43bcde3e61ec6e2e6e4fd892be1f4e59))
+* **internal:** change default timeout to an int ([#146](https://github.com/DataMini/asktable-python/issues/146)) ([f418605](https://github.com/DataMini/asktable-python/commit/f41860576a0d6e8ce78352de1e997c3e8149a52f))
+* **internal:** codegen related update ([#138](https://github.com/DataMini/asktable-python/issues/138)) ([e70fbf4](https://github.com/DataMini/asktable-python/commit/e70fbf41048ca082ffd9f4888ccfa7bd9f97c57f))
+* **internal:** codegen related update ([#141](https://github.com/DataMini/asktable-python/issues/141)) ([56d0462](https://github.com/DataMini/asktable-python/commit/56d0462efef6c92a6727fd91c638a19750195d4e))
+* **internal:** codegen related update ([#154](https://github.com/DataMini/asktable-python/issues/154)) ([2242fad](https://github.com/DataMini/asktable-python/commit/2242fad33cc31d4bf434bc6161ca444c7cf3bf36))
+* **internal:** codegen related update ([#164](https://github.com/DataMini/asktable-python/issues/164)) ([1cb3903](https://github.com/DataMini/asktable-python/commit/1cb390324e6894374519e8062b446873d138cde0))
+* **internal:** fix devcontainers setup ([#156](https://github.com/DataMini/asktable-python/issues/156)) ([944423e](https://github.com/DataMini/asktable-python/commit/944423e7d0c69dcf0a54141ce69127db2369b247))
+* **internal:** fix type traversing dictionary params ([#150](https://github.com/DataMini/asktable-python/issues/150)) ([0caeb28](https://github.com/DataMini/asktable-python/commit/0caeb28b8647a9753b16bbc8a2963f900e4dd9d2))
+* **internal:** minor formatting changes ([#143](https://github.com/DataMini/asktable-python/issues/143)) ([a4ac34f](https://github.com/DataMini/asktable-python/commit/a4ac34fcf7a8350bdd03b5c51917ca5896183c63))
+* **internal:** minor style changes ([#142](https://github.com/DataMini/asktable-python/issues/142)) ([cb5834c](https://github.com/DataMini/asktable-python/commit/cb5834c4e4819f6c9a99dcd9a9d8296b413d0317))
+* **internal:** minor type handling changes ([#151](https://github.com/DataMini/asktable-python/issues/151)) ([67e6469](https://github.com/DataMini/asktable-python/commit/67e6469d84d6fc761ae2e7fc55d47ffb07c49309))
+* **internal:** properly set __pydantic_private__ ([#157](https://github.com/DataMini/asktable-python/issues/157)) ([30a260f](https://github.com/DataMini/asktable-python/commit/30a260f78f2b32e82467afe05703e2f8aa88fc68))
+* **internal:** remove extra empty newlines ([#163](https://github.com/DataMini/asktable-python/issues/163)) ([d8b30ce](https://github.com/DataMini/asktable-python/commit/d8b30cec54b715e20a90de84a4a3393a0b556c33))
+* **internal:** remove unused http client options forwarding ([#160](https://github.com/DataMini/asktable-python/issues/160)) ([298eb9c](https://github.com/DataMini/asktable-python/commit/298eb9ca830efd80ca27e868a0081ff4822dc2db))
+* **internal:** update client tests ([#152](https://github.com/DataMini/asktable-python/issues/152)) ([02af016](https://github.com/DataMini/asktable-python/commit/02af016ec2d3f945765bbc76a24a0a102757b966))
+
+
+### Documentation
+
+* **raw responses:** fix duplicate `the` ([#140](https://github.com/DataMini/asktable-python/issues/140)) ([5580989](https://github.com/DataMini/asktable-python/commit/55809895dc745aa046c93493ad7f658ed652c869))
+* revise readme docs about nested params ([#161](https://github.com/DataMini/asktable-python/issues/161)) ([c4a4e34](https://github.com/DataMini/asktable-python/commit/c4a4e34b3ddc3a19aac34cd4f167af53e2665933))
+* update URLs from stainlessapi.com to stainless.com ([#158](https://github.com/DataMini/asktable-python/issues/158)) ([a8ee0e2](https://github.com/DataMini/asktable-python/commit/a8ee0e203076b01180be2c164174a469c2f444ef))
+
## 4.5.0 (2025-01-19)
Full Changelog: [v4.4.0...v4.5.0](https://github.com/DataMini/asktable-python/compare/v4.4.0...v4.5.0)
diff --git a/pyproject.toml b/pyproject.toml
index 55087c0a..1deb1146 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "asktable"
-version = "4.5.0"
+version = "4.6.0"
description = "The official Python library for the Asktable API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/asktable/_version.py b/src/asktable/_version.py
index ba79aa28..a25e89c3 100644
--- a/src/asktable/_version.py
+++ b/src/asktable/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "asktable"
-__version__ = "4.5.0" # x-release-please-version
+__version__ = "4.6.0" # x-release-please-version