diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 1eec10e9..8e76abb5 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.7.0"
+ ".": "5.0.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 559383cc..92764e07 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 93
+configured_endpoints: 96
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-02fbb644978089e8596def9999f5729633b652fba35bf04e374dbb71e7630355.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e8a3e96..b5f4057f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 5.0.0 (2025-03-15)
+
+Full Changelog: [v4.7.0...v5.0.0](https://github.com/DataMini/asktable-python/compare/v4.7.0...v5.0.0)
+
+### Features
+
+* **api:** manual updates ([#173](https://github.com/DataMini/asktable-python/issues/173)) ([dba48e1](https://github.com/DataMini/asktable-python/commit/dba48e1aebe2abab983f6fe802d8605abdab82ac))
+* **api:** manual updates ([#175](https://github.com/DataMini/asktable-python/issues/175)) ([64bd21f](https://github.com/DataMini/asktable-python/commit/64bd21ff24dbc8a8495a48c73207fbeab1ac5082))
+
+
+### Chores
+
+* remove custom code ([c1a8142](https://github.com/DataMini/asktable-python/commit/c1a81420aeb2a7eb8c6f0b32c8f84134a50e0a37))
+
## 4.7.0 (2025-03-15)
Full Changelog: [v4.6.0...v4.7.0](https://github.com/DataMini/asktable-python/compare/v4.6.0...v4.7.0)
diff --git a/api.md b/api.md
index 1f1f2ec8..dc8deb6e 100644
--- a/api.md
+++ b/api.md
@@ -140,6 +140,8 @@ from asktable.types import (
DatasourceDeleteResponse,
DatasourceAddFileResponse,
DatasourceDeleteFileResponse,
+ DatasourceRetrieveRuntimeMetaResponse,
+ DatasourceUpdateFieldResponse,
)
```
@@ -152,6 +154,8 @@ Methods:
- 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.retrieve_runtime_meta(datasource_id) -> DatasourceRetrieveRuntimeMetaResponse
+- client.datasources.update_field(datasource_id, \*\*params) -> object
## Meta
@@ -405,3 +409,15 @@ from asktable.types import DataframeRetrieveResponse
Methods:
- client.dataframes.retrieve(dataframe_id) -> DataframeRetrieveResponse
+
+# Polish
+
+Types:
+
+```python
+from asktable.types import PolishCreateResponse
+```
+
+Methods:
+
+- client.polish.create(\*\*params) -> PolishCreateResponse
diff --git a/pyproject.toml b/pyproject.toml
index d772cbb9..3d28da26 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "asktable"
-version = "4.7.0"
+version = "5.0.0"
description = "The official Python library for the Asktable API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/asktable/_client.py b/src/asktable/_client.py
index 0fa09487..bfd1d278 100644
--- a/src/asktable/_client.py
+++ b/src/asktable/_client.py
@@ -31,6 +31,7 @@
files,
roles,
caches,
+ polish,
scores,
answers,
project,
@@ -87,6 +88,7 @@ class Asktable(SyncAPIClient):
scores: scores.ScoresResource
files: files.FilesResource
dataframes: dataframes.DataframesResource
+ polish: polish.PolishResource
with_raw_response: AsktableWithRawResponse
with_streaming_response: AsktableWithStreamedResponse
@@ -131,7 +133,7 @@ def __init__(
if base_url is None:
base_url = os.environ.get("ASKTABLE_BASE_URL")
if base_url is None:
- base_url = f"https://api.asktable.com"
+ base_url = f"https://api.asktable.com/v1"
super().__init__(
version=__version__,
@@ -164,6 +166,7 @@ def __init__(
self.scores = scores.ScoresResource(self)
self.files = files.FilesResource(self)
self.dataframes = dataframes.DataframesResource(self)
+ self.polish = polish.PolishResource(self)
self.with_raw_response = AsktableWithRawResponse(self)
self.with_streaming_response = AsktableWithStreamedResponse(self)
@@ -293,6 +296,7 @@ class AsyncAsktable(AsyncAPIClient):
scores: scores.AsyncScoresResource
files: files.AsyncFilesResource
dataframes: dataframes.AsyncDataframesResource
+ polish: polish.AsyncPolishResource
with_raw_response: AsyncAsktableWithRawResponse
with_streaming_response: AsyncAsktableWithStreamedResponse
@@ -337,7 +341,7 @@ def __init__(
if base_url is None:
base_url = os.environ.get("ASKTABLE_BASE_URL")
if base_url is None:
- base_url = f"https://api.asktable.com"
+ base_url = f"https://api.asktable.com/v1"
super().__init__(
version=__version__,
@@ -370,6 +374,7 @@ def __init__(
self.scores = scores.AsyncScoresResource(self)
self.files = files.AsyncFilesResource(self)
self.dataframes = dataframes.AsyncDataframesResource(self)
+ self.polish = polish.AsyncPolishResource(self)
self.with_raw_response = AsyncAsktableWithRawResponse(self)
self.with_streaming_response = AsyncAsktableWithStreamedResponse(self)
@@ -500,6 +505,7 @@ def __init__(self, client: Asktable) -> None:
self.scores = scores.ScoresResourceWithRawResponse(client.scores)
self.files = files.FilesResourceWithRawResponse(client.files)
self.dataframes = dataframes.DataframesResourceWithRawResponse(client.dataframes)
+ self.polish = polish.PolishResourceWithRawResponse(client.polish)
class AsyncAsktableWithRawResponse:
@@ -526,6 +532,7 @@ def __init__(self, client: AsyncAsktable) -> None:
self.scores = scores.AsyncScoresResourceWithRawResponse(client.scores)
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.dataframes = dataframes.AsyncDataframesResourceWithRawResponse(client.dataframes)
+ self.polish = polish.AsyncPolishResourceWithRawResponse(client.polish)
class AsktableWithStreamedResponse:
@@ -552,6 +559,7 @@ def __init__(self, client: Asktable) -> None:
self.scores = scores.ScoresResourceWithStreamingResponse(client.scores)
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.dataframes = dataframes.DataframesResourceWithStreamingResponse(client.dataframes)
+ self.polish = polish.PolishResourceWithStreamingResponse(client.polish)
class AsyncAsktableWithStreamedResponse:
@@ -578,6 +586,7 @@ def __init__(self, client: AsyncAsktable) -> None:
self.scores = scores.AsyncScoresResourceWithStreamingResponse(client.scores)
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.dataframes = dataframes.AsyncDataframesResourceWithStreamingResponse(client.dataframes)
+ self.polish = polish.AsyncPolishResourceWithStreamingResponse(client.polish)
Client = Asktable
diff --git a/src/asktable/_version.py b/src/asktable/_version.py
index f987046f..cb3aca18 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.7.0" # x-release-please-version
+__version__ = "5.0.0" # x-release-please-version
diff --git a/src/asktable/resources/__init__.py b/src/asktable/resources/__init__.py
index 45e0bfb5..9f12d790 100644
--- a/src/asktable/resources/__init__.py
+++ b/src/asktable/resources/__init__.py
@@ -64,6 +64,14 @@
CachesResourceWithStreamingResponse,
AsyncCachesResourceWithStreamingResponse,
)
+from .polish import (
+ PolishResource,
+ AsyncPolishResource,
+ PolishResourceWithRawResponse,
+ AsyncPolishResourceWithRawResponse,
+ PolishResourceWithStreamingResponse,
+ AsyncPolishResourceWithStreamingResponse,
+)
from .scores import (
ScoresResource,
AsyncScoresResource,
@@ -282,4 +290,10 @@
"AsyncDataframesResourceWithRawResponse",
"DataframesResourceWithStreamingResponse",
"AsyncDataframesResourceWithStreamingResponse",
+ "PolishResource",
+ "AsyncPolishResource",
+ "PolishResourceWithRawResponse",
+ "AsyncPolishResourceWithRawResponse",
+ "PolishResourceWithStreamingResponse",
+ "AsyncPolishResourceWithStreamingResponse",
]
diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py
index a2b9d29d..099d2695 100644
--- a/src/asktable/resources/datasources/datasources.py
+++ b/src/asktable/resources/datasources/datasources.py
@@ -20,6 +20,7 @@
datasource_create_params,
datasource_update_params,
datasource_add_file_params,
+ datasource_update_field_params,
)
from .indexes import (
IndexesResource,
@@ -56,6 +57,7 @@
from ..._base_client import AsyncPaginator, make_request_options
from ...types.datasource import Datasource
from ...types.datasource_retrieve_response import DatasourceRetrieveResponse
+from ...types.datasource_retrieve_runtime_meta_response import DatasourceRetrieveRuntimeMetaResponse
__all__ = ["DatasourcesResource", "AsyncDatasourcesResource"]
@@ -441,75 +443,92 @@ def delete_file(
cast_to=object,
)
- def add_file_and_update_meta(
+ def retrieve_runtime_meta(
self,
datasource_id: str,
- file: FileTypes,
*,
- name: str = "auto_generated_meta",
- async_process_meta: bool | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> None:
- self.add_file(
- datasource_id,
- file=file,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- )
- self.meta.create(
- datasource_id=datasource_id,
- name=name,
- async_process_meta=async_process_meta,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
+ ) -> DatasourceRetrieveRuntimeMetaResponse:
+ """
+ 获取指定数据源的运行时元数据
+
+ 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 datasource_id:
+ raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
+ return self._get(
+ f"/v1/datasources/{datasource_id}/runtime-meta",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DatasourceRetrieveRuntimeMetaResponse,
)
- def create_from_file(
+ def update_field(
self,
- engine: Literal["excel", "csv"],
- file: FileTypes,
+ datasource_id: str,
*,
- name: str = "auto_generated",
- async_process_meta: bool | NotGiven = NOT_GIVEN,
+ field_name: str,
+ schema_name: str,
+ table_name: str,
+ visibility: Optional[bool] | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Datasource:
- datasource = self.create(
- engine=engine,
- name=name,
- async_process_meta=False,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- )
- self.add_file(
- datasource.id,
- file=file,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- )
- self.meta.create(
- datasource.id,
- name=name,
- async_process_meta=async_process_meta,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
+ ) -> object:
+ """
+ 更新数据源的某个字段的描述
+
+ Args:
+ visibility: field visibility
+
+ 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 datasource_id:
+ raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
+ return self._patch(
+ f"/v1/datasources/{datasource_id}/field",
+ body=maybe_transform(
+ {"visibility": visibility}, datasource_update_field_params.DatasourceUpdateFieldParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "field_name": field_name,
+ "schema_name": schema_name,
+ "table_name": table_name,
+ },
+ datasource_update_field_params.DatasourceUpdateFieldParams,
+ ),
+ ),
+ cast_to=object,
)
- return datasource
+
class AsyncDatasourcesResource(AsyncAPIResource):
@cached_property
@@ -892,6 +911,92 @@ async def delete_file(
cast_to=object,
)
+ async def retrieve_runtime_meta(
+ self,
+ datasource_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,
+ ) -> DatasourceRetrieveRuntimeMetaResponse:
+ """
+ 获取指定数据源的运行时元数据
+
+ 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 datasource_id:
+ raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
+ return await self._get(
+ f"/v1/datasources/{datasource_id}/runtime-meta",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DatasourceRetrieveRuntimeMetaResponse,
+ )
+
+ async def update_field(
+ self,
+ datasource_id: str,
+ *,
+ field_name: str,
+ schema_name: str,
+ table_name: str,
+ visibility: Optional[bool] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> object:
+ """
+ 更新数据源的某个字段的描述
+
+ Args:
+ visibility: field visibility
+
+ 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 datasource_id:
+ raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
+ return await self._patch(
+ f"/v1/datasources/{datasource_id}/field",
+ body=await async_maybe_transform(
+ {"visibility": visibility}, datasource_update_field_params.DatasourceUpdateFieldParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "field_name": field_name,
+ "schema_name": schema_name,
+ "table_name": table_name,
+ },
+ datasource_update_field_params.DatasourceUpdateFieldParams,
+ ),
+ ),
+ cast_to=object,
+ )
+
class DatasourcesResourceWithRawResponse:
def __init__(self, datasources: DatasourcesResource) -> None:
@@ -918,6 +1023,12 @@ def __init__(self, datasources: DatasourcesResource) -> None:
self.delete_file = to_raw_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = to_raw_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = to_raw_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> MetaResourceWithRawResponse:
@@ -957,6 +1068,12 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None:
self.delete_file = async_to_raw_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = async_to_raw_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = async_to_raw_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> AsyncMetaResourceWithRawResponse:
@@ -996,6 +1113,12 @@ def __init__(self, datasources: DatasourcesResource) -> None:
self.delete_file = to_streamed_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = to_streamed_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = to_streamed_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> MetaResourceWithStreamingResponse:
@@ -1035,6 +1158,12 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None:
self.delete_file = async_to_streamed_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = async_to_streamed_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = async_to_streamed_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> AsyncMetaResourceWithStreamingResponse:
diff --git a/src/asktable/resources/polish.py b/src/asktable/resources/polish.py
new file mode 100644
index 00000000..3343078e
--- /dev/null
+++ b/src/asktable/resources/polish.py
@@ -0,0 +1,198 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal
+
+import httpx
+
+from ..types import polish_create_params
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+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.polish_create_response import PolishCreateResponse
+
+__all__ = ["PolishResource", "AsyncPolishResource"]
+
+
+class PolishResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> PolishResourceWithRawResponse:
+ """
+ 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 PolishResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> PolishResourceWithStreamingResponse:
+ """
+ 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 PolishResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ max_word_count: int,
+ user_desc: str,
+ polish_mode: Literal[0] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> PolishCreateResponse:
+ """
+ Polish Table Desc
+
+ Args:
+ max_word_count: 润色后的最大字数,注意:该值不是绝对值,实际优化后的字数可能会超过该值
+
+ user_desc: 需要润色的用户输入
+
+ polish_mode: 润色模式,默认是简化模式
+
+ 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
+ """
+ return self._post(
+ "/v1/polish",
+ body=maybe_transform(
+ {
+ "max_word_count": max_word_count,
+ "user_desc": user_desc,
+ "polish_mode": polish_mode,
+ },
+ polish_create_params.PolishCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=PolishCreateResponse,
+ )
+
+
+class AsyncPolishResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncPolishResourceWithRawResponse:
+ """
+ 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 AsyncPolishResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncPolishResourceWithStreamingResponse:
+ """
+ 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 AsyncPolishResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ max_word_count: int,
+ user_desc: str,
+ polish_mode: Literal[0] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> PolishCreateResponse:
+ """
+ Polish Table Desc
+
+ Args:
+ max_word_count: 润色后的最大字数,注意:该值不是绝对值,实际优化后的字数可能会超过该值
+
+ user_desc: 需要润色的用户输入
+
+ polish_mode: 润色模式,默认是简化模式
+
+ 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
+ """
+ return await self._post(
+ "/v1/polish",
+ body=await async_maybe_transform(
+ {
+ "max_word_count": max_word_count,
+ "user_desc": user_desc,
+ "polish_mode": polish_mode,
+ },
+ polish_create_params.PolishCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=PolishCreateResponse,
+ )
+
+
+class PolishResourceWithRawResponse:
+ def __init__(self, polish: PolishResource) -> None:
+ self._polish = polish
+
+ self.create = to_raw_response_wrapper(
+ polish.create,
+ )
+
+
+class AsyncPolishResourceWithRawResponse:
+ def __init__(self, polish: AsyncPolishResource) -> None:
+ self._polish = polish
+
+ self.create = async_to_raw_response_wrapper(
+ polish.create,
+ )
+
+
+class PolishResourceWithStreamingResponse:
+ def __init__(self, polish: PolishResource) -> None:
+ self._polish = polish
+
+ self.create = to_streamed_response_wrapper(
+ polish.create,
+ )
+
+
+class AsyncPolishResourceWithStreamingResponse:
+ def __init__(self, polish: AsyncPolishResource) -> None:
+ self._polish = polish
+
+ self.create = async_to_streamed_response_wrapper(
+ polish.create,
+ )
diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py
index a132d23f..19d3b17f 100644
--- a/src/asktable/types/__init__.py
+++ b/src/asktable/types/__init__.py
@@ -39,12 +39,14 @@
from .extapi_update_params import ExtapiUpdateParams as ExtapiUpdateParams
from .policy_create_params import PolicyCreateParams as PolicyCreateParams
from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams
+from .polish_create_params import PolishCreateParams as PolishCreateParams
from .training_list_params import TrainingListParams as TrainingListParams
from .entry_with_definition import EntryWithDefinition as EntryWithDefinition
from .project_update_params import ProjectUpdateParams as ProjectUpdateParams
from .score_create_response import ScoreCreateResponse as ScoreCreateResponse
from .chat_retrieve_response import ChatRetrieveResponse as ChatRetrieveResponse
from .datasource_list_params import DatasourceListParams as DatasourceListParams
+from .polish_create_response import PolishCreateResponse as PolishCreateResponse
from .training_create_params import TrainingCreateParams as TrainingCreateParams
from .training_delete_params import TrainingDeleteParams as TrainingDeleteParams
from .training_list_response import TrainingListResponse as TrainingListResponse
@@ -66,6 +68,7 @@
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
+from .datasource_update_field_params import DatasourceUpdateFieldParams as DatasourceUpdateFieldParams
from .securetunnel_list_links_params import SecuretunnelListLinksParams as SecuretunnelListLinksParams
from .business_glossary_create_params import BusinessGlossaryCreateParams as BusinessGlossaryCreateParams
from .business_glossary_update_params import BusinessGlossaryUpdateParams as BusinessGlossaryUpdateParams
@@ -74,3 +77,6 @@
from .business_glossary_create_response import BusinessGlossaryCreateResponse as BusinessGlossaryCreateResponse
from .integration_create_excel_ds_params import IntegrationCreateExcelDsParams as IntegrationCreateExcelDsParams
from .project_list_model_groups_response import ProjectListModelGroupsResponse as ProjectListModelGroupsResponse
+from .datasource_retrieve_runtime_meta_response import (
+ DatasourceRetrieveRuntimeMetaResponse as DatasourceRetrieveRuntimeMetaResponse,
+)
diff --git a/src/asktable/types/datasource_retrieve_runtime_meta_response.py b/src/asktable/types/datasource_retrieve_runtime_meta_response.py
new file mode 100644
index 00000000..4465ecb6
--- /dev/null
+++ b/src/asktable/types/datasource_retrieve_runtime_meta_response.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List
+
+from .._models import BaseModel
+
+__all__ = ["DatasourceRetrieveRuntimeMetaResponse"]
+
+
+class DatasourceRetrieveRuntimeMetaResponse(BaseModel):
+ schemas: Dict[str, List[str]]
+ """元数据"""
diff --git a/src/asktable/types/datasource_update_field_params.py b/src/asktable/types/datasource_update_field_params.py
new file mode 100644
index 00000000..9236c80e
--- /dev/null
+++ b/src/asktable/types/datasource_update_field_params.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Required, TypedDict
+
+__all__ = ["DatasourceUpdateFieldParams"]
+
+
+class DatasourceUpdateFieldParams(TypedDict, total=False):
+ field_name: Required[str]
+
+ schema_name: Required[str]
+
+ table_name: Required[str]
+
+ visibility: Optional[bool]
+ """field visibility"""
diff --git a/src/asktable/types/polish_create_params.py b/src/asktable/types/polish_create_params.py
new file mode 100644
index 00000000..08474fe4
--- /dev/null
+++ b/src/asktable/types/polish_create_params.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["PolishCreateParams"]
+
+
+class PolishCreateParams(TypedDict, total=False):
+ max_word_count: Required[int]
+ """润色后的最大字数,注意:该值不是绝对值,实际优化后的字数可能会超过该值"""
+
+ user_desc: Required[str]
+ """需要润色的用户输入"""
+
+ polish_mode: Literal[0]
+ """润色模式,默认是简化模式"""
diff --git a/src/asktable/types/polish_create_response.py b/src/asktable/types/polish_create_response.py
new file mode 100644
index 00000000..b92795cc
--- /dev/null
+++ b/src/asktable/types/polish_create_response.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+
+from .._models import BaseModel
+
+__all__ = ["PolishCreateResponse"]
+
+
+class PolishCreateResponse(BaseModel):
+ polish_desc: str
+ """润色后的结果"""
diff --git a/tests/api_resources/test_datasources.py b/tests/api_resources/test_datasources.py
index 6cb041a0..a99d4858 100644
--- a/tests/api_resources/test_datasources.py
+++ b/tests/api_resources/test_datasources.py
@@ -12,6 +12,7 @@
from asktable.types import (
Datasource,
DatasourceRetrieveResponse,
+ DatasourceRetrieveRuntimeMetaResponse,
)
from asktable.pagination import SyncPage, AsyncPage
@@ -334,6 +335,105 @@ def test_path_params_delete_file(self, client: Asktable) -> None:
datasource_id="datasource_id",
)
+ @parametrize
+ def test_method_retrieve_runtime_meta(self, client: Asktable) -> None:
+ datasource = client.datasources.retrieve_runtime_meta(
+ "datasource_id",
+ )
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve_runtime_meta(self, client: Asktable) -> None:
+ response = client.datasources.with_raw_response.retrieve_runtime_meta(
+ "datasource_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve_runtime_meta(self, client: Asktable) -> None:
+ with client.datasources.with_streaming_response.retrieve_runtime_meta(
+ "datasource_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_retrieve_runtime_meta(self, client: Asktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
+ client.datasources.with_raw_response.retrieve_runtime_meta(
+ "",
+ )
+
+ @parametrize
+ def test_method_update_field(self, client: Asktable) -> None:
+ datasource = client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ def test_method_update_field_with_all_params(self, client: Asktable) -> None:
+ datasource = client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ visibility=True,
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ def test_raw_response_update_field(self, client: Asktable) -> None:
+ response = client.datasources.with_raw_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update_field(self, client: Asktable) -> None:
+ with client.datasources.with_streaming_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update_field(self, client: Asktable) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
+ client.datasources.with_raw_response.update_field(
+ datasource_id="",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+
class TestAsyncDatasources:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -650,3 +750,102 @@ async def test_path_params_delete_file(self, async_client: AsyncAsktable) -> Non
file_id="",
datasource_id="datasource_id",
)
+
+ @parametrize
+ async def test_method_retrieve_runtime_meta(self, async_client: AsyncAsktable) -> None:
+ datasource = await async_client.datasources.retrieve_runtime_meta(
+ "datasource_id",
+ )
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve_runtime_meta(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.datasources.with_raw_response.retrieve_runtime_meta(
+ "datasource_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = await response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve_runtime_meta(self, async_client: AsyncAsktable) -> None:
+ async with async_client.datasources.with_streaming_response.retrieve_runtime_meta(
+ "datasource_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = await response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_retrieve_runtime_meta(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.with_raw_response.retrieve_runtime_meta(
+ "",
+ )
+
+ @parametrize
+ async def test_method_update_field(self, async_client: AsyncAsktable) -> None:
+ datasource = await async_client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ async def test_method_update_field_with_all_params(self, async_client: AsyncAsktable) -> None:
+ datasource = await async_client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ visibility=True,
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update_field(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.datasources.with_raw_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = await response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update_field(self, async_client: AsyncAsktable) -> None:
+ async with async_client.datasources.with_streaming_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = await response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update_field(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.with_raw_response.update_field(
+ datasource_id="",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
diff --git a/tests/api_resources/test_polish.py b/tests/api_resources/test_polish.py
new file mode 100644
index 00000000..45ff3b66
--- /dev/null
+++ b/tests/api_resources/test_polish.py
@@ -0,0 +1,108 @@
+# 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 PolishCreateResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestPolish:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Asktable) -> None:
+ polish = client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Asktable) -> None:
+ polish = client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ polish_mode=0,
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Asktable) -> None:
+ response = client.polish.with_raw_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ polish = response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Asktable) -> None:
+ with client.polish.with_streaming_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ polish = response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncPolish:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncAsktable) -> None:
+ polish = await async_client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
+ polish = await async_client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ polish_mode=0,
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.polish.with_raw_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ polish = await response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
+ async with async_client.polish.with_streaming_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ polish = await response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ assert cast(Any, response.is_closed) is True