Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
__pycache__/
dist/
poetry.toml
venv/
16 changes: 12 additions & 4 deletions src/airweave/source_connections/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get(
return _response.data

def delete(
self, source_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
self, source_connection_id: str, *, delete_data: typing.Optional[bool] = False, request_options: typing.Optional[RequestOptions] = None
) -> SourceConnection:
"""
Delete a source connection and all related data.
Expand All @@ -201,6 +201,9 @@ def delete(
----------
source_connection_id : str

delete_data : typing.Optional[bool]
Whether to delete the source connection data

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -218,9 +221,10 @@ def delete(
)
client.source_connections.delete(
source_connection_id="source_connection_id",
delete_data=True,
)
"""
_response = self._raw_client.delete(source_connection_id, request_options=request_options)
_response = self._raw_client.delete(source_connection_id, delete_data=delete_data, request_options=request_options)
return _response.data

def run(
Expand Down Expand Up @@ -537,7 +541,7 @@ async def main() -> None:
return _response.data

async def delete(
self, source_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
self, source_connection_id: str, *, delete_data: typing.Optional[bool] = False, request_options: typing.Optional[RequestOptions] = None
) -> SourceConnection:
"""
Delete a source connection and all related data.
Expand All @@ -546,6 +550,9 @@ async def delete(
----------
source_connection_id : str

delete_data : typing.Optional[bool]
Whether to delete the source connection data

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -568,12 +575,13 @@ async def delete(
async def main() -> None:
await client.source_connections.delete(
source_connection_id="source_connection_id",
delete_data=True,
)


asyncio.run(main())
"""
_response = await self._raw_client.delete(source_connection_id, request_options=request_options)
_response = await self._raw_client.delete(source_connection_id, delete_data=delete_data, request_options=request_options)
return _response.data

async def run(
Expand Down
16 changes: 14 additions & 2 deletions src/airweave/source_connections/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def get(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

def delete(
self, source_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
self, source_connection_id: str, *, delete_data: typing.Optional[bool] = False, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[SourceConnection]:
"""
Delete a source connection and all related data.
Expand All @@ -256,6 +256,9 @@ def delete(
----------
source_connection_id : str

delete_data : typing.Optional[bool]
Whether to delete the source connection data

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -267,6 +270,9 @@ def delete(
_response = self._client_wrapper.httpx_client.request(
f"source-connections/{jsonable_encoder(source_connection_id)}",
method="DELETE",
params={
"delete_data": delete_data,
},
request_options=request_options,
)
try:
Expand Down Expand Up @@ -684,7 +690,7 @@ async def get(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

async def delete(
self, source_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
self, source_connection_id: str, *, delete_data: typing.Optional[bool] = False, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[SourceConnection]:
"""
Delete a source connection and all related data.
Expand All @@ -693,6 +699,9 @@ async def delete(
----------
source_connection_id : str

delete_data : typing.Optional[bool]
Whether to delete the source connection data

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -704,6 +713,9 @@ async def delete(
_response = await self._client_wrapper.httpx_client.request(
f"source-connections/{jsonable_encoder(source_connection_id)}",
method="DELETE",
params={
"delete_data": delete_data,
},
request_options=request_options,
)
try:
Expand Down