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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ from asktable.types import (
Meta,
DatasourceRetrieveResponse,
DatasourceDeleteResponse,
DatasourceAddFilesResponse,
DatasourceAddFileResponse,
DatasourceDeleteFileResponse,
)
```
Expand All @@ -162,7 +162,7 @@ Methods:
- <code title="patch /datasources/{datasource_id}">client.datasources.<a href="./src/asktable/resources/datasources/datasources.py">update</a>(datasource_id, \*\*<a href="src/asktable/types/datasource_update_params.py">params</a>) -> <a href="./src/asktable/types/datasource.py">Datasource</a></code>
- <code title="get /datasources">client.datasources.<a href="./src/asktable/resources/datasources/datasources.py">list</a>(\*\*<a href="src/asktable/types/datasource_list_params.py">params</a>) -> <a href="./src/asktable/types/datasource.py">SyncPage[Datasource]</a></code>
- <code title="delete /datasources/{datasource_id}">client.datasources.<a href="./src/asktable/resources/datasources/datasources.py">delete</a>(datasource_id) -> <a href="./src/asktable/types/datasource_delete_response.py">object</a></code>
- <code title="post /datasources/{datasource_id}/files">client.datasources.<a href="./src/asktable/resources/datasources/datasources.py">add_files</a>(datasource_id, \*\*<a href="src/asktable/types/datasource_add_files_params.py">params</a>) -> <a href="./src/asktable/types/datasource_add_files_response.py">object</a></code>
- <code title="post /datasources/{datasource_id}/files">client.datasources.<a href="./src/asktable/resources/datasources/datasources.py">add_file</a>(datasource_id, \*\*<a href="src/asktable/types/datasource_add_file_params.py">params</a>) -> <a href="./src/asktable/types/datasource_add_file_response.py">object</a></code>
- <code title="delete /datasources/{datasource_id}/files/{file_id}">client.datasources.<a href="./src/asktable/resources/datasources/datasources.py">delete_file</a>(file_id, \*, datasource_id) -> <a href="./src/asktable/types/datasource_delete_file_response.py">object</a></code>

## Meta
Expand Down
26 changes: 13 additions & 13 deletions src/asktable/resources/datasources/datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
datasource_list_params,
datasource_create_params,
datasource_update_params,
datasource_add_files_params,
datasource_add_file_params,
)
from .indexes import (
IndexesResource,
Expand Down Expand Up @@ -347,7 +347,7 @@ def delete(
cast_to=object,
)

def add_files(
def add_file(
self,
datasource_id: str,
*,
Expand Down Expand Up @@ -381,7 +381,7 @@ def add_files(
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return self._post(
f"/datasources/{datasource_id}/files",
body=maybe_transform(body, datasource_add_files_params.DatasourceAddFilesParams),
body=maybe_transform(body, datasource_add_file_params.DatasourceAddFileParams),
files=files,
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
Expand Down Expand Up @@ -713,7 +713,7 @@ async def delete(
cast_to=object,
)

async def add_files(
async def add_file(
self,
datasource_id: str,
*,
Expand Down Expand Up @@ -747,7 +747,7 @@ async def add_files(
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self._post(
f"/datasources/{datasource_id}/files",
body=await async_maybe_transform(body, datasource_add_files_params.DatasourceAddFilesParams),
body=await async_maybe_transform(body, datasource_add_file_params.DatasourceAddFileParams),
files=files,
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
Expand Down Expand Up @@ -811,8 +811,8 @@ def __init__(self, datasources: DatasourcesResource) -> None:
self.delete = to_raw_response_wrapper(
datasources.delete,
)
self.add_files = to_raw_response_wrapper(
datasources.add_files,
self.add_file = to_raw_response_wrapper(
datasources.add_file,
)
self.delete_file = to_raw_response_wrapper(
datasources.delete_file,
Expand Down Expand Up @@ -850,8 +850,8 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None:
self.delete = async_to_raw_response_wrapper(
datasources.delete,
)
self.add_files = async_to_raw_response_wrapper(
datasources.add_files,
self.add_file = async_to_raw_response_wrapper(
datasources.add_file,
)
self.delete_file = async_to_raw_response_wrapper(
datasources.delete_file,
Expand Down Expand Up @@ -889,8 +889,8 @@ def __init__(self, datasources: DatasourcesResource) -> None:
self.delete = to_streamed_response_wrapper(
datasources.delete,
)
self.add_files = to_streamed_response_wrapper(
datasources.add_files,
self.add_file = to_streamed_response_wrapper(
datasources.add_file,
)
self.delete_file = to_streamed_response_wrapper(
datasources.delete_file,
Expand Down Expand Up @@ -928,8 +928,8 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None:
self.delete = async_to_streamed_response_wrapper(
datasources.delete,
)
self.add_files = async_to_streamed_response_wrapper(
datasources.add_files,
self.add_file = async_to_streamed_response_wrapper(
datasources.add_file,
)
self.delete_file = async_to_streamed_response_wrapper(
datasources.delete_file,
Expand Down
2 changes: 1 addition & 1 deletion src/asktable/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
from .role_get_polices_response import RoleGetPolicesResponse as RoleGetPolicesResponse
from .role_get_variables_params import RoleGetVariablesParams as RoleGetVariablesParams
from .chat_send_message_response import ChatSendMessageResponse as ChatSendMessageResponse
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 .datasource_add_files_params import DatasourceAddFilesParams as DatasourceAddFilesParams
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from .._types import FileTypes

__all__ = ["DatasourceAddFilesParams"]
__all__ = ["DatasourceAddFileParams"]


class DatasourceAddFilesParams(TypedDict, total=False):
class DatasourceAddFileParams(TypedDict, total=False):
file: Required[FileTypes]
32 changes: 16 additions & 16 deletions tests/api_resources/test_datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,16 @@ def test_path_params_delete(self, client: Asktable) -> None:
)

@parametrize
def test_method_add_files(self, client: Asktable) -> None:
datasource = client.datasources.add_files(
def test_method_add_file(self, client: Asktable) -> None:
datasource = client.datasources.add_file(
datasource_id="datasource_id",
file=b"raw file contents",
)
assert_matches_type(object, datasource, path=["response"])

@parametrize
def test_raw_response_add_files(self, client: Asktable) -> None:
response = client.datasources.with_raw_response.add_files(
def test_raw_response_add_file(self, client: Asktable) -> None:
response = client.datasources.with_raw_response.add_file(
datasource_id="datasource_id",
file=b"raw file contents",
)
Expand All @@ -265,8 +265,8 @@ def test_raw_response_add_files(self, client: Asktable) -> None:
assert_matches_type(object, datasource, path=["response"])

@parametrize
def test_streaming_response_add_files(self, client: Asktable) -> None:
with client.datasources.with_streaming_response.add_files(
def test_streaming_response_add_file(self, client: Asktable) -> None:
with client.datasources.with_streaming_response.add_file(
datasource_id="datasource_id",
file=b"raw file contents",
) as response:
Expand All @@ -279,9 +279,9 @@ def test_streaming_response_add_files(self, client: Asktable) -> None:
assert cast(Any, response.is_closed) is True

@parametrize
def test_path_params_add_files(self, client: Asktable) -> None:
def test_path_params_add_file(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.add_files(
client.datasources.with_raw_response.add_file(
datasource_id="",
file=b"raw file contents",
)
Expand Down Expand Up @@ -562,16 +562,16 @@ async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
)

@parametrize
async def test_method_add_files(self, async_client: AsyncAsktable) -> None:
datasource = await async_client.datasources.add_files(
async def test_method_add_file(self, async_client: AsyncAsktable) -> None:
datasource = await async_client.datasources.add_file(
datasource_id="datasource_id",
file=b"raw file contents",
)
assert_matches_type(object, datasource, path=["response"])

@parametrize
async def test_raw_response_add_files(self, async_client: AsyncAsktable) -> None:
response = await async_client.datasources.with_raw_response.add_files(
async def test_raw_response_add_file(self, async_client: AsyncAsktable) -> None:
response = await async_client.datasources.with_raw_response.add_file(
datasource_id="datasource_id",
file=b"raw file contents",
)
Expand All @@ -582,8 +582,8 @@ async def test_raw_response_add_files(self, async_client: AsyncAsktable) -> None
assert_matches_type(object, datasource, path=["response"])

@parametrize
async def test_streaming_response_add_files(self, async_client: AsyncAsktable) -> None:
async with async_client.datasources.with_streaming_response.add_files(
async def test_streaming_response_add_file(self, async_client: AsyncAsktable) -> None:
async with async_client.datasources.with_streaming_response.add_file(
datasource_id="datasource_id",
file=b"raw file contents",
) as response:
Expand All @@ -596,9 +596,9 @@ async def test_streaming_response_add_files(self, async_client: AsyncAsktable) -
assert cast(Any, response.is_closed) is True

@parametrize
async def test_path_params_add_files(self, async_client: AsyncAsktable) -> None:
async def test_path_params_add_file(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.add_files(
await async_client.datasources.with_raw_response.add_file(
datasource_id="",
file=b"raw file contents",
)
Expand Down