diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0bcf731..8648cd7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,7 +1,10 @@ -name: Publish Python Client to PyPI +name: Publish to PyPI on: workflow_dispatch: + push: + branches: + - main jobs: publish: @@ -40,7 +43,7 @@ jobs: run: | VERSION="${{ steps.current-version.outputs.current_version }}" PACKAGE_NAME="robosystems-client" - + # Check if version exists on PyPI if curl -s "https://pypi.org/pypi/${PACKAGE_NAME}/${VERSION}/json" | grep -q "\"version\""; then echo "❌ Version ${VERSION} already exists on PyPI" diff --git a/pyproject.toml b/pyproject.toml index ace185d..e244370 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "robosystems-client" -version = "0.1.11" +version = "0.1.12" description = "Python Client for RoboSystems financial graph database API" readme = "README.md" requires-python = ">=3.10" diff --git a/robosystems_client/api/agent/query_financial_agent.py b/robosystems_client/api/agent/query_financial_agent.py index 423bcaf..810a137 100644 --- a/robosystems_client/api/agent/query_financial_agent.py +++ b/robosystems_client/api/agent/query_financial_agent.py @@ -138,7 +138,7 @@ def sync_detailed( **Credit Consumption:** - AI operations consume credits based on actual token usage - - Claude 4 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens + - Claude 4/4.1 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens - Claude 4 Sonnet: ~3 credits per 1K input tokens, ~15 credits per 1K output tokens - Credits are consumed after operation completes based on actual usage @@ -225,7 +225,7 @@ def sync( **Credit Consumption:** - AI operations consume credits based on actual token usage - - Claude 4 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens + - Claude 4/4.1 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens - Claude 4 Sonnet: ~3 credits per 1K input tokens, ~15 credits per 1K output tokens - Credits are consumed after operation completes based on actual usage @@ -307,7 +307,7 @@ async def asyncio_detailed( **Credit Consumption:** - AI operations consume credits based on actual token usage - - Claude 4 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens + - Claude 4/4.1 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens - Claude 4 Sonnet: ~3 credits per 1K input tokens, ~15 credits per 1K output tokens - Credits are consumed after operation completes based on actual usage @@ -392,7 +392,7 @@ async def asyncio( **Credit Consumption:** - AI operations consume credits based on actual token usage - - Claude 4 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens + - Claude 4/4.1 Opus: ~15 credits per 1K input tokens, ~75 credits per 1K output tokens - Claude 4 Sonnet: ~3 credits per 1K input tokens, ~15 credits per 1K output tokens - Credits are consumed after operation completes based on actual usage diff --git a/robosystems_client/api/subgraphs/__init__.py b/robosystems_client/api/subgraphs/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/robosystems_client/api/subgraphs/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/robosystems_client/api/subgraphs/create_subgraph.py b/robosystems_client/api/subgraphs/create_subgraph.py new file mode 100644 index 0000000..b915835 --- /dev/null +++ b/robosystems_client/api/subgraphs/create_subgraph.py @@ -0,0 +1,372 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_subgraph_request import CreateSubgraphRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.subgraph_response import SubgraphResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + body: CreateSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(authorization, Unset): + headers["authorization"] = authorization + + cookies = {} + if auth_token is not UNSET: + cookies["auth-token"] = auth_token + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/v1/{graph_id}/subgraphs", + "cookies": cookies, + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, HTTPValidationError, SubgraphResponse]]: + if response.status_code == 200: + response_200 = SubgraphResponse.from_dict(response.json()) + + return response_200 + if response.status_code == 401: + response_401 = cast(Any, None) + return response_401 + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + if response.status_code == 409: + response_409 = cast(Any, None) + return response_409 + if response.status_code == 500: + response_500 = cast(Any, None) + return response_500 + 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: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, HTTPValidationError, SubgraphResponse]]: + 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, + *, + client: AuthenticatedClient, + body: CreateSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Create New Subgraph + + Create a new subgraph database under an Enterprise or Premium parent graph. + + **Requirements:** + - Parent graph must be Enterprise or Premium tier + - User must have admin access to parent graph + - Subgraph name must be unique within parent + - Subgraph name must be alphanumeric (1-20 chars) + + **Subgraph Benefits:** + - Shares parent's infrastructure (no additional cost) + - Inherits parent's credit pool + - Isolated database on same instance + - Full Kuzu database capabilities + + **Use Cases:** + - Separate environments (dev/staging/prod) + - Department-specific data isolation + - Multi-tenant applications + - Testing and experimentation + + **Schema Inheritance:** + - Subgraphs can use parent's schema or custom extensions + - Extensions are additive only + - Base schema always included + + **Limits:** + - Enterprise: Maximum 10 subgraphs + - Premium: Unlimited subgraphs + - Standard: Not supported + + **Response includes:** + - `graph_id`: Full subgraph identifier + - `parent_graph_id`: Parent graph ID + - `subgraph_name`: Short name within parent + - `status`: Creation status + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (CreateSubgraphRequest): Request model for creating a subgraph. + + 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[Union[Any, HTTPValidationError, SubgraphResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + authorization=authorization, + auth_token=auth_token, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Create New Subgraph + + Create a new subgraph database under an Enterprise or Premium parent graph. + + **Requirements:** + - Parent graph must be Enterprise or Premium tier + - User must have admin access to parent graph + - Subgraph name must be unique within parent + - Subgraph name must be alphanumeric (1-20 chars) + + **Subgraph Benefits:** + - Shares parent's infrastructure (no additional cost) + - Inherits parent's credit pool + - Isolated database on same instance + - Full Kuzu database capabilities + + **Use Cases:** + - Separate environments (dev/staging/prod) + - Department-specific data isolation + - Multi-tenant applications + - Testing and experimentation + + **Schema Inheritance:** + - Subgraphs can use parent's schema or custom extensions + - Extensions are additive only + - Base schema always included + + **Limits:** + - Enterprise: Maximum 10 subgraphs + - Premium: Unlimited subgraphs + - Standard: Not supported + + **Response includes:** + - `graph_id`: Full subgraph identifier + - `parent_graph_id`: Parent graph ID + - `subgraph_name`: Short name within parent + - `status`: Creation status + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (CreateSubgraphRequest): Request model for creating a subgraph. + + 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: + Union[Any, HTTPValidationError, SubgraphResponse] + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + authorization=authorization, + auth_token=auth_token, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Create New Subgraph + + Create a new subgraph database under an Enterprise or Premium parent graph. + + **Requirements:** + - Parent graph must be Enterprise or Premium tier + - User must have admin access to parent graph + - Subgraph name must be unique within parent + - Subgraph name must be alphanumeric (1-20 chars) + + **Subgraph Benefits:** + - Shares parent's infrastructure (no additional cost) + - Inherits parent's credit pool + - Isolated database on same instance + - Full Kuzu database capabilities + + **Use Cases:** + - Separate environments (dev/staging/prod) + - Department-specific data isolation + - Multi-tenant applications + - Testing and experimentation + + **Schema Inheritance:** + - Subgraphs can use parent's schema or custom extensions + - Extensions are additive only + - Base schema always included + + **Limits:** + - Enterprise: Maximum 10 subgraphs + - Premium: Unlimited subgraphs + - Standard: Not supported + + **Response includes:** + - `graph_id`: Full subgraph identifier + - `parent_graph_id`: Parent graph ID + - `subgraph_name`: Short name within parent + - `status`: Creation status + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (CreateSubgraphRequest): Request model for creating a subgraph. + + 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[Union[Any, HTTPValidationError, SubgraphResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + authorization=authorization, + auth_token=auth_token, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Create New Subgraph + + Create a new subgraph database under an Enterprise or Premium parent graph. + + **Requirements:** + - Parent graph must be Enterprise or Premium tier + - User must have admin access to parent graph + - Subgraph name must be unique within parent + - Subgraph name must be alphanumeric (1-20 chars) + + **Subgraph Benefits:** + - Shares parent's infrastructure (no additional cost) + - Inherits parent's credit pool + - Isolated database on same instance + - Full Kuzu database capabilities + + **Use Cases:** + - Separate environments (dev/staging/prod) + - Department-specific data isolation + - Multi-tenant applications + - Testing and experimentation + + **Schema Inheritance:** + - Subgraphs can use parent's schema or custom extensions + - Extensions are additive only + - Base schema always included + + **Limits:** + - Enterprise: Maximum 10 subgraphs + - Premium: Unlimited subgraphs + - Standard: Not supported + + **Response includes:** + - `graph_id`: Full subgraph identifier + - `parent_graph_id`: Parent graph ID + - `subgraph_name`: Short name within parent + - `status`: Creation status + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (CreateSubgraphRequest): Request model for creating a subgraph. + + 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: + Union[Any, HTTPValidationError, SubgraphResponse] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + authorization=authorization, + auth_token=auth_token, + ) + ).parsed diff --git a/robosystems_client/api/subgraphs/delete_subgraph.py b/robosystems_client/api/subgraphs/delete_subgraph.py new file mode 100644 index 0000000..3cdcb52 --- /dev/null +++ b/robosystems_client/api/subgraphs/delete_subgraph.py @@ -0,0 +1,317 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.delete_subgraph_request import DeleteSubgraphRequest +from ...models.delete_subgraph_response import DeleteSubgraphResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + subgraph_name: str, + *, + body: DeleteSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(authorization, Unset): + headers["authorization"] = authorization + + cookies = {} + if auth_token is not UNSET: + cookies["auth-token"] = auth_token + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/v1/{graph_id}/subgraphs/{subgraph_name}", + "cookies": cookies, + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, DeleteSubgraphResponse, HTTPValidationError]]: + if response.status_code == 200: + response_200 = DeleteSubgraphResponse.from_dict(response.json()) + + return response_200 + if response.status_code == 401: + response_401 = cast(Any, None) + return response_401 + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + if response.status_code == 409: + response_409 = cast(Any, None) + return response_409 + if response.status_code == 500: + response_500 = cast(Any, None) + return response_500 + 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: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, DeleteSubgraphResponse, 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, + subgraph_name: str, + *, + client: AuthenticatedClient, + body: DeleteSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, DeleteSubgraphResponse, HTTPValidationError]]: + """Delete Subgraph + + Delete a subgraph database. + + **Requirements:** + - Must be a valid subgraph (not parent graph) + - User must have admin access to parent graph + - Optional backup before deletion + + **Deletion Options:** + - `force`: Delete even if contains data + - `backup_first`: Create backup before deletion + + **Warning:** + Deletion is permanent unless backup is created. + All data in the subgraph will be lost. + + **Backup Location:** + If backup requested, stored in S3 at: + `s3://robosystems-backups/{instance_id}/{database_name}_{timestamp}.backup` + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name to delete + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (DeleteSubgraphRequest): Request model for deleting a subgraph. + + 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[Union[Any, DeleteSubgraphResponse, HTTPValidationError]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + subgraph_name=subgraph_name, + body=body, + authorization=authorization, + auth_token=auth_token, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + subgraph_name: str, + *, + client: AuthenticatedClient, + body: DeleteSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, DeleteSubgraphResponse, HTTPValidationError]]: + """Delete Subgraph + + Delete a subgraph database. + + **Requirements:** + - Must be a valid subgraph (not parent graph) + - User must have admin access to parent graph + - Optional backup before deletion + + **Deletion Options:** + - `force`: Delete even if contains data + - `backup_first`: Create backup before deletion + + **Warning:** + Deletion is permanent unless backup is created. + All data in the subgraph will be lost. + + **Backup Location:** + If backup requested, stored in S3 at: + `s3://robosystems-backups/{instance_id}/{database_name}_{timestamp}.backup` + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name to delete + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (DeleteSubgraphRequest): Request model for deleting a subgraph. + + 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: + Union[Any, DeleteSubgraphResponse, HTTPValidationError] + """ + + return sync_detailed( + graph_id=graph_id, + subgraph_name=subgraph_name, + client=client, + body=body, + authorization=authorization, + auth_token=auth_token, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + subgraph_name: str, + *, + client: AuthenticatedClient, + body: DeleteSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, DeleteSubgraphResponse, HTTPValidationError]]: + """Delete Subgraph + + Delete a subgraph database. + + **Requirements:** + - Must be a valid subgraph (not parent graph) + - User must have admin access to parent graph + - Optional backup before deletion + + **Deletion Options:** + - `force`: Delete even if contains data + - `backup_first`: Create backup before deletion + + **Warning:** + Deletion is permanent unless backup is created. + All data in the subgraph will be lost. + + **Backup Location:** + If backup requested, stored in S3 at: + `s3://robosystems-backups/{instance_id}/{database_name}_{timestamp}.backup` + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name to delete + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (DeleteSubgraphRequest): Request model for deleting a subgraph. + + 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[Union[Any, DeleteSubgraphResponse, HTTPValidationError]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + subgraph_name=subgraph_name, + body=body, + authorization=authorization, + auth_token=auth_token, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + subgraph_name: str, + *, + client: AuthenticatedClient, + body: DeleteSubgraphRequest, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, DeleteSubgraphResponse, HTTPValidationError]]: + """Delete Subgraph + + Delete a subgraph database. + + **Requirements:** + - Must be a valid subgraph (not parent graph) + - User must have admin access to parent graph + - Optional backup before deletion + + **Deletion Options:** + - `force`: Delete even if contains data + - `backup_first`: Create backup before deletion + + **Warning:** + Deletion is permanent unless backup is created. + All data in the subgraph will be lost. + + **Backup Location:** + If backup requested, stored in S3 at: + `s3://robosystems-backups/{instance_id}/{database_name}_{timestamp}.backup` + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name to delete + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, str]): + body (DeleteSubgraphRequest): Request model for deleting a subgraph. + + 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: + Union[Any, DeleteSubgraphResponse, HTTPValidationError] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + subgraph_name=subgraph_name, + client=client, + body=body, + authorization=authorization, + auth_token=auth_token, + ) + ).parsed diff --git a/robosystems_client/api/subgraphs/get_subgraph_info.py b/robosystems_client/api/subgraphs/get_subgraph_info.py new file mode 100644 index 0000000..d51539d --- /dev/null +++ b/robosystems_client/api/subgraphs/get_subgraph_info.py @@ -0,0 +1,300 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.subgraph_response import SubgraphResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + subgraph_name: str, + *, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(authorization, Unset): + headers["authorization"] = authorization + + cookies = {} + if auth_token is not UNSET: + cookies["auth-token"] = auth_token + + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/v1/{graph_id}/subgraphs/{subgraph_name}/info", + "cookies": cookies, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, HTTPValidationError, SubgraphResponse]]: + if response.status_code == 200: + response_200 = SubgraphResponse.from_dict(response.json()) + + return response_200 + if response.status_code == 401: + response_401 = cast(Any, None) + return response_401 + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + if response.status_code == 500: + response_500 = cast(Any, None) + return response_500 + 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: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, HTTPValidationError, SubgraphResponse]]: + 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, + subgraph_name: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Get Subgraph Details + + Get detailed information about a specific subgraph. + + **Requirements:** + - User must have read access to parent graph + + **Response includes:** + - Full subgraph metadata + - Database statistics (nodes, edges) + - Size information + - Schema configuration + - Creation/modification timestamps + - Last access time (when available) + + **Statistics:** + Real-time statistics queried from Kuzu: + - Node count + - Edge count + - Database size on disk + - Schema information + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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[Union[Any, HTTPValidationError, SubgraphResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + subgraph_name=subgraph_name, + authorization=authorization, + auth_token=auth_token, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + subgraph_name: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Get Subgraph Details + + Get detailed information about a specific subgraph. + + **Requirements:** + - User must have read access to parent graph + + **Response includes:** + - Full subgraph metadata + - Database statistics (nodes, edges) + - Size information + - Schema configuration + - Creation/modification timestamps + - Last access time (when available) + + **Statistics:** + Real-time statistics queried from Kuzu: + - Node count + - Edge count + - Database size on disk + - Schema information + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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: + Union[Any, HTTPValidationError, SubgraphResponse] + """ + + return sync_detailed( + graph_id=graph_id, + subgraph_name=subgraph_name, + client=client, + authorization=authorization, + auth_token=auth_token, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + subgraph_name: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Get Subgraph Details + + Get detailed information about a specific subgraph. + + **Requirements:** + - User must have read access to parent graph + + **Response includes:** + - Full subgraph metadata + - Database statistics (nodes, edges) + - Size information + - Schema configuration + - Creation/modification timestamps + - Last access time (when available) + + **Statistics:** + Real-time statistics queried from Kuzu: + - Node count + - Edge count + - Database size on disk + - Schema information + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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[Union[Any, HTTPValidationError, SubgraphResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + subgraph_name=subgraph_name, + authorization=authorization, + auth_token=auth_token, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + subgraph_name: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, SubgraphResponse]]: + """Get Subgraph Details + + Get detailed information about a specific subgraph. + + **Requirements:** + - User must have read access to parent graph + + **Response includes:** + - Full subgraph metadata + - Database statistics (nodes, edges) + - Size information + - Schema configuration + - Creation/modification timestamps + - Last access time (when available) + + **Statistics:** + Real-time statistics queried from Kuzu: + - Node count + - Edge count + - Database size on disk + - Schema information + + Args: + graph_id (str): Parent graph identifier + subgraph_name (str): Subgraph name + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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: + Union[Any, HTTPValidationError, SubgraphResponse] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + subgraph_name=subgraph_name, + client=client, + authorization=authorization, + auth_token=auth_token, + ) + ).parsed diff --git a/robosystems_client/api/subgraphs/get_subgraph_quota.py b/robosystems_client/api/subgraphs/get_subgraph_quota.py new file mode 100644 index 0000000..9b60806 --- /dev/null +++ b/robosystems_client/api/subgraphs/get_subgraph_quota.py @@ -0,0 +1,272 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.subgraph_quota_response import SubgraphQuotaResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(authorization, Unset): + headers["authorization"] = authorization + + cookies = {} + if auth_token is not UNSET: + cookies["auth-token"] = auth_token + + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/v1/{graph_id}/subgraphs/quota", + "cookies": cookies, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, HTTPValidationError, SubgraphQuotaResponse]]: + if response.status_code == 200: + response_200 = SubgraphQuotaResponse.from_dict(response.json()) + + return response_200 + if response.status_code == 401: + response_401 = cast(Any, None) + return response_401 + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if response.status_code == 500: + response_500 = cast(Any, None) + return response_500 + 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: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, HTTPValidationError, SubgraphQuotaResponse]]: + 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, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, SubgraphQuotaResponse]]: + """Get Subgraph Quota + + Get subgraph quota and usage information for a parent graph. + + **Shows:** + - Current subgraph count + - Maximum allowed subgraphs per tier + - Remaining capacity + - Total size usage across all subgraphs + + **Tier Limits:** + - Standard: 0 subgraphs (not supported) + - Enterprise: 10 subgraphs maximum + - Premium: Unlimited subgraphs + + **Size Tracking:** + Provides aggregate size metrics when available. + Individual subgraph sizes shown in list endpoint. + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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[Union[Any, HTTPValidationError, SubgraphQuotaResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + authorization=authorization, + auth_token=auth_token, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, SubgraphQuotaResponse]]: + """Get Subgraph Quota + + Get subgraph quota and usage information for a parent graph. + + **Shows:** + - Current subgraph count + - Maximum allowed subgraphs per tier + - Remaining capacity + - Total size usage across all subgraphs + + **Tier Limits:** + - Standard: 0 subgraphs (not supported) + - Enterprise: 10 subgraphs maximum + - Premium: Unlimited subgraphs + + **Size Tracking:** + Provides aggregate size metrics when available. + Individual subgraph sizes shown in list endpoint. + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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: + Union[Any, HTTPValidationError, SubgraphQuotaResponse] + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + authorization=authorization, + auth_token=auth_token, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, SubgraphQuotaResponse]]: + """Get Subgraph Quota + + Get subgraph quota and usage information for a parent graph. + + **Shows:** + - Current subgraph count + - Maximum allowed subgraphs per tier + - Remaining capacity + - Total size usage across all subgraphs + + **Tier Limits:** + - Standard: 0 subgraphs (not supported) + - Enterprise: 10 subgraphs maximum + - Premium: Unlimited subgraphs + + **Size Tracking:** + Provides aggregate size metrics when available. + Individual subgraph sizes shown in list endpoint. + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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[Union[Any, HTTPValidationError, SubgraphQuotaResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + authorization=authorization, + auth_token=auth_token, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, SubgraphQuotaResponse]]: + """Get Subgraph Quota + + Get subgraph quota and usage information for a parent graph. + + **Shows:** + - Current subgraph count + - Maximum allowed subgraphs per tier + - Remaining capacity + - Total size usage across all subgraphs + + **Tier Limits:** + - Standard: 0 subgraphs (not supported) + - Enterprise: 10 subgraphs maximum + - Premium: Unlimited subgraphs + + **Size Tracking:** + Provides aggregate size metrics when available. + Individual subgraph sizes shown in list endpoint. + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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: + Union[Any, HTTPValidationError, SubgraphQuotaResponse] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + authorization=authorization, + auth_token=auth_token, + ) + ).parsed diff --git a/robosystems_client/api/subgraphs/list_subgraphs.py b/robosystems_client/api/subgraphs/list_subgraphs.py new file mode 100644 index 0000000..0aaf632 --- /dev/null +++ b/robosystems_client/api/subgraphs/list_subgraphs.py @@ -0,0 +1,272 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.list_subgraphs_response import ListSubgraphsResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(authorization, Unset): + headers["authorization"] = authorization + + cookies = {} + if auth_token is not UNSET: + cookies["auth-token"] = auth_token + + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/v1/{graph_id}/subgraphs", + "cookies": cookies, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, HTTPValidationError, ListSubgraphsResponse]]: + if response.status_code == 200: + response_200 = ListSubgraphsResponse.from_dict(response.json()) + + return response_200 + if response.status_code == 401: + response_401 = cast(Any, None) + return response_401 + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if response.status_code == 500: + response_500 = cast(Any, None) + return response_500 + 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: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, HTTPValidationError, ListSubgraphsResponse]]: + 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, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, ListSubgraphsResponse]]: + """List Subgraphs + + List all subgraphs for a parent graph. + + **Requirements:** + - User must have at least read access to parent graph + + **Response includes:** + - List of all subgraphs with metadata + - Current usage vs limits + - Size and statistics per subgraph + - Creation timestamps + + **Filtering:** + Currently returns all subgraphs. Future versions will support: + - Filtering by status + - Filtering by creation date + - Pagination for large lists + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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[Union[Any, HTTPValidationError, ListSubgraphsResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + authorization=authorization, + auth_token=auth_token, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, ListSubgraphsResponse]]: + """List Subgraphs + + List all subgraphs for a parent graph. + + **Requirements:** + - User must have at least read access to parent graph + + **Response includes:** + - List of all subgraphs with metadata + - Current usage vs limits + - Size and statistics per subgraph + - Creation timestamps + + **Filtering:** + Currently returns all subgraphs. Future versions will support: + - Filtering by status + - Filtering by creation date + - Pagination for large lists + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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: + Union[Any, HTTPValidationError, ListSubgraphsResponse] + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + authorization=authorization, + auth_token=auth_token, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Response[Union[Any, HTTPValidationError, ListSubgraphsResponse]]: + """List Subgraphs + + List all subgraphs for a parent graph. + + **Requirements:** + - User must have at least read access to parent graph + + **Response includes:** + - List of all subgraphs with metadata + - Current usage vs limits + - Size and statistics per subgraph + - Creation timestamps + + **Filtering:** + Currently returns all subgraphs. Future versions will support: + - Filtering by status + - Filtering by creation date + - Pagination for large lists + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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[Union[Any, HTTPValidationError, ListSubgraphsResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + authorization=authorization, + auth_token=auth_token, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + authorization: Union[None, Unset, str] = UNSET, + auth_token: Union[None, Unset, str] = UNSET, +) -> Optional[Union[Any, HTTPValidationError, ListSubgraphsResponse]]: + """List Subgraphs + + List all subgraphs for a parent graph. + + **Requirements:** + - User must have at least read access to parent graph + + **Response includes:** + - List of all subgraphs with metadata + - Current usage vs limits + - Size and statistics per subgraph + - Creation timestamps + + **Filtering:** + Currently returns all subgraphs. Future versions will support: + - Filtering by status + - Filtering by creation date + - Pagination for large lists + + Args: + graph_id (str): Parent graph identifier + authorization (Union[None, Unset, str]): + auth_token (Union[None, Unset, 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: + Union[Any, HTTPValidationError, ListSubgraphsResponse] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + authorization=authorization, + auth_token=auth_token, + ) + ).parsed diff --git a/robosystems_client/extensions/README.md b/robosystems_client/extensions/README.md index 6da267a..2253ed3 100644 --- a/robosystems_client/extensions/README.md +++ b/robosystems_client/extensions/README.md @@ -599,13 +599,9 @@ MIT License - see [LICENSE](LICENSE) file for details. ## 📞 Support -- **Documentation**: [docs.robosystems.ai](https://docs.robosystems.ai) -- **API Reference**: [api.robosystems.ai/docs](https://api.robosystems.ai/docs) -- **Issues**: [GitHub Issues](https://github.com/robosystems/python-sdk/issues) -- **Email**: hello@robosystems.ai +- **API Reference**: [api.robosystems.ai](https://api.robosystems.ai) +- **Issues**: [GitHub Issues](https://github.com/RoboFinSystems/robosystems-python-client/issues) --- **RoboSystems Python Client Extensions** - Production-ready streaming, monitoring, and query capabilities for financial knowledge graphs. - -*Built with ❤️ by the RoboSystems team* \ No newline at end of file diff --git a/robosystems_client/models/__init__.py b/robosystems_client/models/__init__.py index 295416d..a4abca9 100644 --- a/robosystems_client/models/__init__.py +++ b/robosystems_client/models/__init__.py @@ -39,6 +39,8 @@ from .create_connection_request import CreateConnectionRequest from .create_connection_request_provider import CreateConnectionRequestProvider from .create_graph_request import CreateGraphRequest +from .create_subgraph_request import CreateSubgraphRequest +from .create_subgraph_request_metadata_type_0 import CreateSubgraphRequestMetadataType0 from .credit_check_request import CreditCheckRequest from .credit_summary import CreditSummary from .credit_summary_response import CreditSummaryResponse @@ -56,6 +58,8 @@ from .cypher_query_request_parameters_type_0 import CypherQueryRequestParametersType0 from .database_health_response import DatabaseHealthResponse from .database_info_response import DatabaseInfoResponse +from .delete_subgraph_request import DeleteSubgraphRequest +from .delete_subgraph_response import DeleteSubgraphResponse from .detailed_transactions_response import DetailedTransactionsResponse from .detailed_transactions_response_date_range import ( DetailedTransactionsResponseDateRange, @@ -131,6 +135,7 @@ from .list_schema_extensions_response_listschemaextensions import ( ListSchemaExtensionsResponseListschemaextensions, ) +from .list_subgraphs_response import ListSubgraphsResponse from .login_request import LoginRequest from .logout_user_response_logoutuser import LogoutUserResponseLogoutuser from .mcp_tool_call import MCPToolCall @@ -182,6 +187,11 @@ from .sso_login_request import SSOLoginRequest from .sso_token_response import SSOTokenResponse from .storage_limit_response import StorageLimitResponse +from .subgraph_quota_response import SubgraphQuotaResponse +from .subgraph_response import SubgraphResponse +from .subgraph_response_metadata_type_0 import SubgraphResponseMetadataType0 +from .subgraph_summary import SubgraphSummary +from .subgraph_type import SubgraphType from .subscription_info import SubscriptionInfo from .subscription_info_metadata import SubscriptionInfoMetadata from .subscription_request import SubscriptionRequest @@ -258,6 +268,8 @@ "CreateConnectionRequest", "CreateConnectionRequestProvider", "CreateGraphRequest", + "CreateSubgraphRequest", + "CreateSubgraphRequestMetadataType0", "CreditCheckRequest", "CreditsSummaryResponse", "CreditsSummaryResponseCreditsByAddonItem", @@ -271,6 +283,8 @@ "CypherQueryRequestParametersType0", "DatabaseHealthResponse", "DatabaseInfoResponse", + "DeleteSubgraphRequest", + "DeleteSubgraphResponse", "DetailedTransactionsResponse", "DetailedTransactionsResponseDateRange", "DetailedTransactionsResponseSummary", @@ -312,6 +326,7 @@ "LinkTokenRequestProviderType0", "ListConnectionsProviderType0", "ListSchemaExtensionsResponseListschemaextensions", + "ListSubgraphsResponse", "LoginRequest", "LogoutUserResponseLogoutuser", "MCPToolCall", @@ -351,6 +366,11 @@ "SSOLoginRequest", "SSOTokenResponse", "StorageLimitResponse", + "SubgraphQuotaResponse", + "SubgraphResponse", + "SubgraphResponseMetadataType0", + "SubgraphSummary", + "SubgraphType", "SubscriptionInfo", "SubscriptionInfoMetadata", "SubscriptionRequest", diff --git a/robosystems_client/models/create_subgraph_request.py b/robosystems_client/models/create_subgraph_request.py new file mode 100644 index 0000000..59eecc0 --- /dev/null +++ b/robosystems_client/models/create_subgraph_request.py @@ -0,0 +1,185 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.subgraph_type import SubgraphType +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.create_subgraph_request_metadata_type_0 import ( + CreateSubgraphRequestMetadataType0, + ) + + +T = TypeVar("T", bound="CreateSubgraphRequest") + + +@_attrs_define +class CreateSubgraphRequest: + """Request model for creating a subgraph. + + Attributes: + name (str): Alphanumeric name for the subgraph (e.g., dev, staging, prod1) + display_name (str): Human-readable display name for the subgraph + description (Union[None, Unset, str]): Optional description of the subgraph's purpose + schema_extensions (Union[None, Unset, list[str]]): Schema extensions to include (inherits from parent by + default) + subgraph_type (Union[Unset, SubgraphType]): Types of subgraphs. + metadata (Union['CreateSubgraphRequestMetadataType0', None, Unset]): Additional metadata for the subgraph + """ + + name: str + display_name: str + description: Union[None, Unset, str] = UNSET + schema_extensions: Union[None, Unset, list[str]] = UNSET + subgraph_type: Union[Unset, SubgraphType] = UNSET + metadata: Union["CreateSubgraphRequestMetadataType0", None, Unset] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.create_subgraph_request_metadata_type_0 import ( + CreateSubgraphRequestMetadataType0, + ) + + name = self.name + + display_name = self.display_name + + description: Union[None, Unset, str] + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + schema_extensions: Union[None, Unset, list[str]] + if isinstance(self.schema_extensions, Unset): + schema_extensions = UNSET + elif isinstance(self.schema_extensions, list): + schema_extensions = self.schema_extensions + + else: + schema_extensions = self.schema_extensions + + subgraph_type: Union[Unset, str] = UNSET + if not isinstance(self.subgraph_type, Unset): + subgraph_type = self.subgraph_type.value + + metadata: Union[None, Unset, dict[str, Any]] + if isinstance(self.metadata, Unset): + metadata = UNSET + elif isinstance(self.metadata, CreateSubgraphRequestMetadataType0): + metadata = self.metadata.to_dict() + else: + metadata = self.metadata + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "display_name": display_name, + } + ) + if description is not UNSET: + field_dict["description"] = description + if schema_extensions is not UNSET: + field_dict["schema_extensions"] = schema_extensions + if subgraph_type is not UNSET: + field_dict["subgraph_type"] = subgraph_type + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.create_subgraph_request_metadata_type_0 import ( + CreateSubgraphRequestMetadataType0, + ) + + d = dict(src_dict) + name = d.pop("name") + + display_name = d.pop("display_name") + + def _parse_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_schema_extensions(data: object) -> Union[None, Unset, list[str]]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + schema_extensions_type_0 = cast(list[str], data) + + return schema_extensions_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, list[str]], data) + + schema_extensions = _parse_schema_extensions(d.pop("schema_extensions", UNSET)) + + _subgraph_type = d.pop("subgraph_type", UNSET) + subgraph_type: Union[Unset, SubgraphType] + if isinstance(_subgraph_type, Unset): + subgraph_type = UNSET + else: + subgraph_type = SubgraphType(_subgraph_type) + + def _parse_metadata( + data: object, + ) -> Union["CreateSubgraphRequestMetadataType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_type_0 = CreateSubgraphRequestMetadataType0.from_dict(data) + + return metadata_type_0 + except: # noqa: E722 + pass + return cast(Union["CreateSubgraphRequestMetadataType0", None, Unset], data) + + metadata = _parse_metadata(d.pop("metadata", UNSET)) + + create_subgraph_request = cls( + name=name, + display_name=display_name, + description=description, + schema_extensions=schema_extensions, + subgraph_type=subgraph_type, + metadata=metadata, + ) + + create_subgraph_request.additional_properties = d + return create_subgraph_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/create_subgraph_request_metadata_type_0.py b/robosystems_client/models/create_subgraph_request_metadata_type_0.py new file mode 100644 index 0000000..849d392 --- /dev/null +++ b/robosystems_client/models/create_subgraph_request_metadata_type_0.py @@ -0,0 +1,44 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateSubgraphRequestMetadataType0") + + +@_attrs_define +class CreateSubgraphRequestMetadataType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_subgraph_request_metadata_type_0 = cls() + + create_subgraph_request_metadata_type_0.additional_properties = d + return create_subgraph_request_metadata_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/credit_summary_response.py b/robosystems_client/models/credit_summary_response.py index 5e60fcb..567b820 100644 --- a/robosystems_client/models/credit_summary_response.py +++ b/robosystems_client/models/credit_summary_response.py @@ -16,7 +16,6 @@ class CreditSummaryResponse: Attributes: graph_id (str): graph_tier (str): - credit_multiplier (float): current_balance (float): monthly_allocation (float): consumed_this_month (float): @@ -27,7 +26,6 @@ class CreditSummaryResponse: graph_id: str graph_tier: str - credit_multiplier: float current_balance: float monthly_allocation: float consumed_this_month: float @@ -41,8 +39,6 @@ def to_dict(self) -> dict[str, Any]: graph_tier = self.graph_tier - credit_multiplier = self.credit_multiplier - current_balance = self.current_balance monthly_allocation = self.monthly_allocation @@ -65,7 +61,6 @@ def to_dict(self) -> dict[str, Any]: { "graph_id": graph_id, "graph_tier": graph_tier, - "credit_multiplier": credit_multiplier, "current_balance": current_balance, "monthly_allocation": monthly_allocation, "consumed_this_month": consumed_this_month, @@ -85,8 +80,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: graph_tier = d.pop("graph_tier") - credit_multiplier = d.pop("credit_multiplier") - current_balance = d.pop("current_balance") monthly_allocation = d.pop("monthly_allocation") @@ -111,7 +104,6 @@ def _parse_last_allocation_date(data: object) -> Union[None, Unset, str]: credit_summary_response = cls( graph_id=graph_id, graph_tier=graph_tier, - credit_multiplier=credit_multiplier, current_balance=current_balance, monthly_allocation=monthly_allocation, consumed_this_month=consumed_this_month, diff --git a/robosystems_client/models/delete_subgraph_request.py b/robosystems_client/models/delete_subgraph_request.py new file mode 100644 index 0000000..9650854 --- /dev/null +++ b/robosystems_client/models/delete_subgraph_request.py @@ -0,0 +1,89 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="DeleteSubgraphRequest") + + +@_attrs_define +class DeleteSubgraphRequest: + """Request model for deleting a subgraph. + + Attributes: + force (Union[Unset, bool]): Force deletion even if subgraph contains data Default: False. + backup_first (Union[Unset, bool]): Create a backup before deletion Default: True. + backup_location (Union[None, Unset, str]): S3 location for backup (uses default if not specified) + """ + + force: Union[Unset, bool] = False + backup_first: Union[Unset, bool] = True + backup_location: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + force = self.force + + backup_first = self.backup_first + + backup_location: Union[None, Unset, str] + if isinstance(self.backup_location, Unset): + backup_location = UNSET + else: + backup_location = self.backup_location + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if force is not UNSET: + field_dict["force"] = force + if backup_first is not UNSET: + field_dict["backup_first"] = backup_first + if backup_location is not UNSET: + field_dict["backup_location"] = backup_location + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + force = d.pop("force", UNSET) + + backup_first = d.pop("backup_first", UNSET) + + def _parse_backup_location(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + backup_location = _parse_backup_location(d.pop("backup_location", UNSET)) + + delete_subgraph_request = cls( + force=force, + backup_first=backup_first, + backup_location=backup_location, + ) + + delete_subgraph_request.additional_properties = d + return delete_subgraph_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/delete_subgraph_response.py b/robosystems_client/models/delete_subgraph_response.py new file mode 100644 index 0000000..8f1d9d9 --- /dev/null +++ b/robosystems_client/models/delete_subgraph_response.py @@ -0,0 +1,120 @@ +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="DeleteSubgraphResponse") + + +@_attrs_define +class DeleteSubgraphResponse: + """Response model for subgraph deletion. + + Attributes: + graph_id (str): Deleted subgraph identifier + status (str): Deletion status + deleted_at (datetime.datetime): When deletion occurred + backup_location (Union[None, Unset, str]): Location of backup if created + message (Union[None, Unset, str]): Additional information about the deletion + """ + + graph_id: str + status: str + deleted_at: datetime.datetime + backup_location: Union[None, Unset, str] = UNSET + message: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + graph_id = self.graph_id + + status = self.status + + deleted_at = self.deleted_at.isoformat() + + backup_location: Union[None, Unset, str] + if isinstance(self.backup_location, Unset): + backup_location = UNSET + else: + backup_location = self.backup_location + + message: Union[None, Unset, str] + if isinstance(self.message, Unset): + message = UNSET + else: + message = self.message + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "graph_id": graph_id, + "status": status, + "deleted_at": deleted_at, + } + ) + if backup_location is not UNSET: + field_dict["backup_location"] = backup_location + if message is not UNSET: + field_dict["message"] = message + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + graph_id = d.pop("graph_id") + + status = d.pop("status") + + deleted_at = isoparse(d.pop("deleted_at")) + + def _parse_backup_location(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + backup_location = _parse_backup_location(d.pop("backup_location", UNSET)) + + def _parse_message(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + message = _parse_message(d.pop("message", UNSET)) + + delete_subgraph_response = cls( + graph_id=graph_id, + status=status, + deleted_at=deleted_at, + backup_location=backup_location, + message=message, + ) + + delete_subgraph_response.additional_properties = d + return delete_subgraph_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/list_subgraphs_response.py b/robosystems_client/models/list_subgraphs_response.py new file mode 100644 index 0000000..58bdbbb --- /dev/null +++ b/robosystems_client/models/list_subgraphs_response.py @@ -0,0 +1,148 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.subgraph_summary import SubgraphSummary + + +T = TypeVar("T", bound="ListSubgraphsResponse") + + +@_attrs_define +class ListSubgraphsResponse: + """Response model for listing subgraphs. + + Attributes: + parent_graph_id (str): Parent graph identifier + parent_graph_name (str): Parent graph name + parent_graph_tier (str): Parent graph tier + subgraph_count (int): Total number of subgraphs + subgraphs (list['SubgraphSummary']): List of subgraphs + max_subgraphs (Union[None, Unset, int]): Maximum allowed subgraphs for this tier (None = unlimited) + total_size_mb (Union[None, Unset, float]): Combined size of all subgraphs in megabytes + """ + + parent_graph_id: str + parent_graph_name: str + parent_graph_tier: str + subgraph_count: int + subgraphs: list["SubgraphSummary"] + max_subgraphs: Union[None, Unset, int] = UNSET + total_size_mb: Union[None, Unset, float] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + parent_graph_id = self.parent_graph_id + + parent_graph_name = self.parent_graph_name + + parent_graph_tier = self.parent_graph_tier + + subgraph_count = self.subgraph_count + + subgraphs = [] + for subgraphs_item_data in self.subgraphs: + subgraphs_item = subgraphs_item_data.to_dict() + subgraphs.append(subgraphs_item) + + max_subgraphs: Union[None, Unset, int] + if isinstance(self.max_subgraphs, Unset): + max_subgraphs = UNSET + else: + max_subgraphs = self.max_subgraphs + + total_size_mb: Union[None, Unset, float] + if isinstance(self.total_size_mb, Unset): + total_size_mb = UNSET + else: + total_size_mb = self.total_size_mb + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "parent_graph_id": parent_graph_id, + "parent_graph_name": parent_graph_name, + "parent_graph_tier": parent_graph_tier, + "subgraph_count": subgraph_count, + "subgraphs": subgraphs, + } + ) + if max_subgraphs is not UNSET: + field_dict["max_subgraphs"] = max_subgraphs + if total_size_mb is not UNSET: + field_dict["total_size_mb"] = total_size_mb + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.subgraph_summary import SubgraphSummary + + d = dict(src_dict) + parent_graph_id = d.pop("parent_graph_id") + + parent_graph_name = d.pop("parent_graph_name") + + parent_graph_tier = d.pop("parent_graph_tier") + + subgraph_count = d.pop("subgraph_count") + + subgraphs = [] + _subgraphs = d.pop("subgraphs") + for subgraphs_item_data in _subgraphs: + subgraphs_item = SubgraphSummary.from_dict(subgraphs_item_data) + + subgraphs.append(subgraphs_item) + + def _parse_max_subgraphs(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + max_subgraphs = _parse_max_subgraphs(d.pop("max_subgraphs", UNSET)) + + def _parse_total_size_mb(data: object) -> Union[None, Unset, float]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, float], data) + + total_size_mb = _parse_total_size_mb(d.pop("total_size_mb", UNSET)) + + list_subgraphs_response = cls( + parent_graph_id=parent_graph_id, + parent_graph_name=parent_graph_name, + parent_graph_tier=parent_graph_tier, + subgraph_count=subgraph_count, + subgraphs=subgraphs, + max_subgraphs=max_subgraphs, + total_size_mb=total_size_mb, + ) + + list_subgraphs_response.additional_properties = d + return list_subgraphs_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/subgraph_quota_response.py b/robosystems_client/models/subgraph_quota_response.py new file mode 100644 index 0000000..9a35baf --- /dev/null +++ b/robosystems_client/models/subgraph_quota_response.py @@ -0,0 +1,158 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="SubgraphQuotaResponse") + + +@_attrs_define +class SubgraphQuotaResponse: + """Response model for subgraph quota information. + + Attributes: + parent_graph_id (str): Parent graph identifier + tier (str): Graph tier + current_count (int): Current number of subgraphs + max_allowed (Union[None, Unset, int]): Maximum allowed subgraphs (None = unlimited) + remaining (Union[None, Unset, int]): Remaining subgraphs that can be created + total_size_mb (Union[None, Unset, float]): Total size of all subgraphs + max_size_mb (Union[None, Unset, float]): Maximum allowed total size + """ + + parent_graph_id: str + tier: str + current_count: int + max_allowed: Union[None, Unset, int] = UNSET + remaining: Union[None, Unset, int] = UNSET + total_size_mb: Union[None, Unset, float] = UNSET + max_size_mb: Union[None, Unset, float] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + parent_graph_id = self.parent_graph_id + + tier = self.tier + + current_count = self.current_count + + max_allowed: Union[None, Unset, int] + if isinstance(self.max_allowed, Unset): + max_allowed = UNSET + else: + max_allowed = self.max_allowed + + remaining: Union[None, Unset, int] + if isinstance(self.remaining, Unset): + remaining = UNSET + else: + remaining = self.remaining + + total_size_mb: Union[None, Unset, float] + if isinstance(self.total_size_mb, Unset): + total_size_mb = UNSET + else: + total_size_mb = self.total_size_mb + + max_size_mb: Union[None, Unset, float] + if isinstance(self.max_size_mb, Unset): + max_size_mb = UNSET + else: + max_size_mb = self.max_size_mb + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "parent_graph_id": parent_graph_id, + "tier": tier, + "current_count": current_count, + } + ) + if max_allowed is not UNSET: + field_dict["max_allowed"] = max_allowed + if remaining is not UNSET: + field_dict["remaining"] = remaining + if total_size_mb is not UNSET: + field_dict["total_size_mb"] = total_size_mb + if max_size_mb is not UNSET: + field_dict["max_size_mb"] = max_size_mb + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + parent_graph_id = d.pop("parent_graph_id") + + tier = d.pop("tier") + + current_count = d.pop("current_count") + + def _parse_max_allowed(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + max_allowed = _parse_max_allowed(d.pop("max_allowed", UNSET)) + + def _parse_remaining(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + remaining = _parse_remaining(d.pop("remaining", UNSET)) + + def _parse_total_size_mb(data: object) -> Union[None, Unset, float]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, float], data) + + total_size_mb = _parse_total_size_mb(d.pop("total_size_mb", UNSET)) + + def _parse_max_size_mb(data: object) -> Union[None, Unset, float]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, float], data) + + max_size_mb = _parse_max_size_mb(d.pop("max_size_mb", UNSET)) + + subgraph_quota_response = cls( + parent_graph_id=parent_graph_id, + tier=tier, + current_count=current_count, + max_allowed=max_allowed, + remaining=remaining, + total_size_mb=total_size_mb, + max_size_mb=max_size_mb, + ) + + subgraph_quota_response.additional_properties = d + return subgraph_quota_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/subgraph_response.py b/robosystems_client/models/subgraph_response.py new file mode 100644 index 0000000..04ab792 --- /dev/null +++ b/robosystems_client/models/subgraph_response.py @@ -0,0 +1,279 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.subgraph_type import SubgraphType +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.subgraph_response_metadata_type_0 import SubgraphResponseMetadataType0 + + +T = TypeVar("T", bound="SubgraphResponse") + + +@_attrs_define +class SubgraphResponse: + """Response model for a subgraph. + + Attributes: + graph_id (str): Full subgraph identifier (e.g., kg123_dev) + parent_graph_id (str): Parent graph identifier + subgraph_index (int): Numeric index of the subgraph + subgraph_name (str): Alphanumeric name of the subgraph + display_name (str): Human-readable display name + subgraph_type (SubgraphType): Types of subgraphs. + status (str): Current status of the subgraph + created_at (datetime.datetime): When the subgraph was created + updated_at (datetime.datetime): When the subgraph was last updated + description (Union[None, Unset, str]): Description of the subgraph's purpose + size_mb (Union[None, Unset, float]): Size of the subgraph database in megabytes + node_count (Union[None, Unset, int]): Number of nodes in the subgraph + edge_count (Union[None, Unset, int]): Number of edges in the subgraph + last_accessed (Union[None, Unset, datetime.datetime]): When the subgraph was last accessed + metadata (Union['SubgraphResponseMetadataType0', None, Unset]): Additional metadata for the subgraph + """ + + graph_id: str + parent_graph_id: str + subgraph_index: int + subgraph_name: str + display_name: str + subgraph_type: SubgraphType + status: str + created_at: datetime.datetime + updated_at: datetime.datetime + description: Union[None, Unset, str] = UNSET + size_mb: Union[None, Unset, float] = UNSET + node_count: Union[None, Unset, int] = UNSET + edge_count: Union[None, Unset, int] = UNSET + last_accessed: Union[None, Unset, datetime.datetime] = UNSET + metadata: Union["SubgraphResponseMetadataType0", None, Unset] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.subgraph_response_metadata_type_0 import SubgraphResponseMetadataType0 + + graph_id = self.graph_id + + parent_graph_id = self.parent_graph_id + + subgraph_index = self.subgraph_index + + subgraph_name = self.subgraph_name + + display_name = self.display_name + + subgraph_type = self.subgraph_type.value + + status = self.status + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + description: Union[None, Unset, str] + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + size_mb: Union[None, Unset, float] + if isinstance(self.size_mb, Unset): + size_mb = UNSET + else: + size_mb = self.size_mb + + node_count: Union[None, Unset, int] + if isinstance(self.node_count, Unset): + node_count = UNSET + else: + node_count = self.node_count + + edge_count: Union[None, Unset, int] + if isinstance(self.edge_count, Unset): + edge_count = UNSET + else: + edge_count = self.edge_count + + last_accessed: Union[None, Unset, str] + if isinstance(self.last_accessed, Unset): + last_accessed = UNSET + elif isinstance(self.last_accessed, datetime.datetime): + last_accessed = self.last_accessed.isoformat() + else: + last_accessed = self.last_accessed + + metadata: Union[None, Unset, dict[str, Any]] + if isinstance(self.metadata, Unset): + metadata = UNSET + elif isinstance(self.metadata, SubgraphResponseMetadataType0): + metadata = self.metadata.to_dict() + else: + metadata = self.metadata + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "graph_id": graph_id, + "parent_graph_id": parent_graph_id, + "subgraph_index": subgraph_index, + "subgraph_name": subgraph_name, + "display_name": display_name, + "subgraph_type": subgraph_type, + "status": status, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if description is not UNSET: + field_dict["description"] = description + if size_mb is not UNSET: + field_dict["size_mb"] = size_mb + if node_count is not UNSET: + field_dict["node_count"] = node_count + if edge_count is not UNSET: + field_dict["edge_count"] = edge_count + if last_accessed is not UNSET: + field_dict["last_accessed"] = last_accessed + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.subgraph_response_metadata_type_0 import SubgraphResponseMetadataType0 + + d = dict(src_dict) + graph_id = d.pop("graph_id") + + parent_graph_id = d.pop("parent_graph_id") + + subgraph_index = d.pop("subgraph_index") + + subgraph_name = d.pop("subgraph_name") + + display_name = d.pop("display_name") + + subgraph_type = SubgraphType(d.pop("subgraph_type")) + + status = d.pop("status") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_size_mb(data: object) -> Union[None, Unset, float]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, float], data) + + size_mb = _parse_size_mb(d.pop("size_mb", UNSET)) + + def _parse_node_count(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + node_count = _parse_node_count(d.pop("node_count", UNSET)) + + def _parse_edge_count(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + edge_count = _parse_edge_count(d.pop("edge_count", UNSET)) + + def _parse_last_accessed(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + last_accessed_type_0 = isoparse(data) + + return last_accessed_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, datetime.datetime], data) + + last_accessed = _parse_last_accessed(d.pop("last_accessed", UNSET)) + + def _parse_metadata( + data: object, + ) -> Union["SubgraphResponseMetadataType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_type_0 = SubgraphResponseMetadataType0.from_dict(data) + + return metadata_type_0 + except: # noqa: E722 + pass + return cast(Union["SubgraphResponseMetadataType0", None, Unset], data) + + metadata = _parse_metadata(d.pop("metadata", UNSET)) + + subgraph_response = cls( + graph_id=graph_id, + parent_graph_id=parent_graph_id, + subgraph_index=subgraph_index, + subgraph_name=subgraph_name, + display_name=display_name, + subgraph_type=subgraph_type, + status=status, + created_at=created_at, + updated_at=updated_at, + description=description, + size_mb=size_mb, + node_count=node_count, + edge_count=edge_count, + last_accessed=last_accessed, + metadata=metadata, + ) + + subgraph_response.additional_properties = d + return subgraph_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/subgraph_response_metadata_type_0.py b/robosystems_client/models/subgraph_response_metadata_type_0.py new file mode 100644 index 0000000..06cfc74 --- /dev/null +++ b/robosystems_client/models/subgraph_response_metadata_type_0.py @@ -0,0 +1,44 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SubgraphResponseMetadataType0") + + +@_attrs_define +class SubgraphResponseMetadataType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + subgraph_response_metadata_type_0 = cls() + + subgraph_response_metadata_type_0.additional_properties = d + return subgraph_response_metadata_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/subgraph_summary.py b/robosystems_client/models/subgraph_summary.py new file mode 100644 index 0000000..8f41395 --- /dev/null +++ b/robosystems_client/models/subgraph_summary.py @@ -0,0 +1,155 @@ +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.subgraph_type import SubgraphType +from ..types import UNSET, Unset + +T = TypeVar("T", bound="SubgraphSummary") + + +@_attrs_define +class SubgraphSummary: + """Summary model for listing subgraphs. + + Attributes: + graph_id (str): Full subgraph identifier + subgraph_name (str): Alphanumeric name + display_name (str): Human-readable name + subgraph_type (SubgraphType): Types of subgraphs. + status (str): Current status + created_at (datetime.datetime): Creation timestamp + size_mb (Union[None, Unset, float]): Size in megabytes + last_accessed (Union[None, Unset, datetime.datetime]): Last access timestamp + """ + + graph_id: str + subgraph_name: str + display_name: str + subgraph_type: SubgraphType + status: str + created_at: datetime.datetime + size_mb: Union[None, Unset, float] = UNSET + last_accessed: Union[None, Unset, datetime.datetime] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + graph_id = self.graph_id + + subgraph_name = self.subgraph_name + + display_name = self.display_name + + subgraph_type = self.subgraph_type.value + + status = self.status + + created_at = self.created_at.isoformat() + + size_mb: Union[None, Unset, float] + if isinstance(self.size_mb, Unset): + size_mb = UNSET + else: + size_mb = self.size_mb + + last_accessed: Union[None, Unset, str] + if isinstance(self.last_accessed, Unset): + last_accessed = UNSET + elif isinstance(self.last_accessed, datetime.datetime): + last_accessed = self.last_accessed.isoformat() + else: + last_accessed = self.last_accessed + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "graph_id": graph_id, + "subgraph_name": subgraph_name, + "display_name": display_name, + "subgraph_type": subgraph_type, + "status": status, + "created_at": created_at, + } + ) + if size_mb is not UNSET: + field_dict["size_mb"] = size_mb + if last_accessed is not UNSET: + field_dict["last_accessed"] = last_accessed + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + graph_id = d.pop("graph_id") + + subgraph_name = d.pop("subgraph_name") + + display_name = d.pop("display_name") + + subgraph_type = SubgraphType(d.pop("subgraph_type")) + + status = d.pop("status") + + created_at = isoparse(d.pop("created_at")) + + def _parse_size_mb(data: object) -> Union[None, Unset, float]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, float], data) + + size_mb = _parse_size_mb(d.pop("size_mb", UNSET)) + + def _parse_last_accessed(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + last_accessed_type_0 = isoparse(data) + + return last_accessed_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, datetime.datetime], data) + + last_accessed = _parse_last_accessed(d.pop("last_accessed", UNSET)) + + subgraph_summary = cls( + graph_id=graph_id, + subgraph_name=subgraph_name, + display_name=display_name, + subgraph_type=subgraph_type, + status=status, + created_at=created_at, + size_mb=size_mb, + last_accessed=last_accessed, + ) + + subgraph_summary.additional_properties = d + return subgraph_summary + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/subgraph_type.py b/robosystems_client/models/subgraph_type.py new file mode 100644 index 0000000..158bcb5 --- /dev/null +++ b/robosystems_client/models/subgraph_type.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class SubgraphType(str, Enum): + MEMORY = "memory" + STATIC = "static" + TEMPORAL = "temporal" + VERSIONED = "versioned" + + def __str__(self) -> str: + return str(self.value)