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
8 changes: 4 additions & 4 deletions robosystems_client/api/documents/delete_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def sync_detailed(
) -> Response[Any | HTTPValidationError]:
"""Delete Document

Delete a document and all its sections.
Delete a document from PostgreSQL and OpenSearch.

Args:
graph_id (str):
Expand Down Expand Up @@ -96,7 +96,7 @@ def sync(
) -> Any | HTTPValidationError | None:
"""Delete Document

Delete a document and all its sections.
Delete a document from PostgreSQL and OpenSearch.

Args:
graph_id (str):
Expand Down Expand Up @@ -125,7 +125,7 @@ async def asyncio_detailed(
) -> Response[Any | HTTPValidationError]:
"""Delete Document

Delete a document and all its sections.
Delete a document from PostgreSQL and OpenSearch.

Args:
graph_id (str):
Expand Down Expand Up @@ -157,7 +157,7 @@ async def asyncio(
) -> Any | HTTPValidationError | None:
"""Delete Document

Delete a document and all its sections.
Delete a document from PostgreSQL and OpenSearch.

Args:
graph_id (str):
Expand Down
182 changes: 182 additions & 0 deletions robosystems_client/api/documents/get_document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
from http import HTTPStatus
from typing import Any
from urllib.parse import quote

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.document_detail_response import DocumentDetailResponse
from ...models.http_validation_error import HTTPValidationError
from ...types import Response


def _get_kwargs(
graph_id: str,
document_id: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/v1/graphs/{graph_id}/documents/{document_id}".format(
graph_id=quote(str(graph_id), safe=""),
document_id=quote(str(document_id), safe=""),
),
}

return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> DocumentDetailResponse | HTTPValidationError | None:
if response.status_code == 200:
response_200 = DocumentDetailResponse.from_dict(response.json())

return response_200

if response.status_code == 422:
response_422 = HTTPValidationError.from_dict(response.json())

return response_422

if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[DocumentDetailResponse | HTTPValidationError]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
graph_id: str,
document_id: str,
*,
client: AuthenticatedClient,
) -> Response[DocumentDetailResponse | HTTPValidationError]:
"""Get Document

Get a document with full content from PostgreSQL.

Args:
graph_id (str):
document_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[DocumentDetailResponse | HTTPValidationError]
"""

kwargs = _get_kwargs(
graph_id=graph_id,
document_id=document_id,
)

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
graph_id: str,
document_id: str,
*,
client: AuthenticatedClient,
) -> DocumentDetailResponse | HTTPValidationError | None:
"""Get Document

Get a document with full content from PostgreSQL.

Args:
graph_id (str):
document_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
DocumentDetailResponse | HTTPValidationError
"""

return sync_detailed(
graph_id=graph_id,
document_id=document_id,
client=client,
).parsed


async def asyncio_detailed(
graph_id: str,
document_id: str,
*,
client: AuthenticatedClient,
) -> Response[DocumentDetailResponse | HTTPValidationError]:
"""Get Document

Get a document with full content from PostgreSQL.

Args:
graph_id (str):
document_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[DocumentDetailResponse | HTTPValidationError]
"""

kwargs = _get_kwargs(
graph_id=graph_id,
document_id=document_id,
)

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
graph_id: str,
document_id: str,
*,
client: AuthenticatedClient,
) -> DocumentDetailResponse | HTTPValidationError | None:
"""Get Document

Get a document with full content from PostgreSQL.

Args:
graph_id (str):
document_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
DocumentDetailResponse | HTTPValidationError
"""

return (
await asyncio_detailed(
graph_id=graph_id,
document_id=document_id,
client=client,
)
).parsed
8 changes: 4 additions & 4 deletions robosystems_client/api/documents/list_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def sync_detailed(
) -> Response[DocumentListResponse | HTTPValidationError]:
"""List Documents

List indexed documents for a graph.
List documents for a graph from PostgreSQL.

Args:
graph_id (str):
Expand Down Expand Up @@ -110,7 +110,7 @@ def sync(
) -> DocumentListResponse | HTTPValidationError | None:
"""List Documents

List indexed documents for a graph.
List documents for a graph from PostgreSQL.

Args:
graph_id (str):
Expand Down Expand Up @@ -139,7 +139,7 @@ async def asyncio_detailed(
) -> Response[DocumentListResponse | HTTPValidationError]:
"""List Documents

List indexed documents for a graph.
List documents for a graph from PostgreSQL.

Args:
graph_id (str):
Expand Down Expand Up @@ -171,7 +171,7 @@ async def asyncio(
) -> DocumentListResponse | HTTPValidationError | None:
"""List Documents

List indexed documents for a graph.
List documents for a graph from PostgreSQL.

Args:
graph_id (str):
Expand Down
Loading
Loading