From a8c5c32011632a2ace2d4242497526029c139785 Mon Sep 17 00:00:00 2001 From: "Joseph T. French" Date: Wed, 2 Dec 2026 01:34:46 -0600 Subject: [PATCH] feat(sdk): add the subgraph table operations Claude-Session: https://claude.ai/code/session_01AGZDQeP3jY7t5fbjJzcTSD --- .../alter_subgraph_table.py | 268 ++++++++++++++++++ .../create_subgraph_node_table.py | 264 +++++++++++++++++ .../create_subgraph_relationship_table.py | 266 +++++++++++++++++ .../content_operations/drop_subgraph_table.py | 264 +++++++++++++++++ robosystems_client/models/__init__.py | 22 ++ .../models/alter_subgraph_table_op.py | 137 +++++++++ .../models/alter_subgraph_table_op_action.py | 10 + ..._subgraph_table_op_property_type_type_0.py | 12 + .../models/create_subgraph_node_table_op.py | 84 ++++++ .../create_subgraph_relationship_table_op.py | 107 +++++++ .../models/drop_subgraph_table_op.py | 62 ++++ .../models/subgraph_node_property.py | 82 ++++++ .../models/subgraph_node_property_type.py | 12 + .../models/subgraph_relationship_property.py | 74 +++++ .../subgraph_relationship_property_type.py | 12 + 15 files changed, 1676 insertions(+) create mode 100644 robosystems_client/api/content_operations/alter_subgraph_table.py create mode 100644 robosystems_client/api/content_operations/create_subgraph_node_table.py create mode 100644 robosystems_client/api/content_operations/create_subgraph_relationship_table.py create mode 100644 robosystems_client/api/content_operations/drop_subgraph_table.py create mode 100644 robosystems_client/models/alter_subgraph_table_op.py create mode 100644 robosystems_client/models/alter_subgraph_table_op_action.py create mode 100644 robosystems_client/models/alter_subgraph_table_op_property_type_type_0.py create mode 100644 robosystems_client/models/create_subgraph_node_table_op.py create mode 100644 robosystems_client/models/create_subgraph_relationship_table_op.py create mode 100644 robosystems_client/models/drop_subgraph_table_op.py create mode 100644 robosystems_client/models/subgraph_node_property.py create mode 100644 robosystems_client/models/subgraph_node_property_type.py create mode 100644 robosystems_client/models/subgraph_relationship_property.py create mode 100644 robosystems_client/models/subgraph_relationship_property_type.py diff --git a/robosystems_client/api/content_operations/alter_subgraph_table.py b/robosystems_client/api/content_operations/alter_subgraph_table.py new file mode 100644 index 0000000..b698c27 --- /dev/null +++ b/robosystems_client/api/content_operations/alter_subgraph_table.py @@ -0,0 +1,268 @@ +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.alter_subgraph_table_op import AlterSubgraphTableOp +from ...models.error_response import ErrorResponse +from ...models.operation_envelope import OperationEnvelope +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + body: AlterSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(idempotency_key, Unset): + headers["Idempotency-Key"] = idempotency_key + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/graphs/{graph_id}/operations/alter-subgraph-table".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ErrorResponse | OperationEnvelope | None: + if response.status_code == 200: + response_200 = OperationEnvelope.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = ErrorResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = ErrorResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = ErrorResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = ErrorResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 409: + response_409 = ErrorResponse.from_dict(response.json()) + + return response_409 + + if response.status_code == 422: + response_422 = ErrorResponse.from_dict(response.json()) + + return response_422 + + if response.status_code == 429: + response_429 = ErrorResponse.from_dict(response.json()) + + return response_429 + + if response.status_code == 500: + response_500 = ErrorResponse.from_dict(response.json()) + + return response_500 + + 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[ErrorResponse | OperationEnvelope]: + 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: AlterSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Alter a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Adds, drops or renames one property of a subgraph + table. An added property is empty on existing rows; a dropped one takes its values with it. A node + table's primary key cannot be dropped or renamed (409). Returns 409 with `Retry-After` while an + import into the subgraph is running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (AlterSubgraphTableOp): Body for alter-subgraph-table: one property added, dropped or + renamed. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: AlterSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Alter a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Adds, drops or renames one property of a subgraph + table. An added property is empty on existing rows; a dropped one takes its values with it. A node + table's primary key cannot be dropped or renamed (409). Returns 409 with `Retry-After` while an + import into the subgraph is running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (AlterSubgraphTableOp): Body for alter-subgraph-table: one property added, dropped or + renamed. + + 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: + ErrorResponse | OperationEnvelope + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: AlterSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Alter a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Adds, drops or renames one property of a subgraph + table. An added property is empty on existing rows; a dropped one takes its values with it. A node + table's primary key cannot be dropped or renamed (409). Returns 409 with `Retry-After` while an + import into the subgraph is running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (AlterSubgraphTableOp): Body for alter-subgraph-table: one property added, dropped or + renamed. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + 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: AlterSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Alter a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Adds, drops or renames one property of a subgraph + table. An added property is empty on existing rows; a dropped one takes its values with it. A node + table's primary key cannot be dropped or renamed (409). Returns 409 with `Retry-After` while an + import into the subgraph is running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (AlterSubgraphTableOp): Body for alter-subgraph-table: one property added, dropped or + renamed. + + 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: + ErrorResponse | OperationEnvelope + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ) + ).parsed diff --git a/robosystems_client/api/content_operations/create_subgraph_node_table.py b/robosystems_client/api/content_operations/create_subgraph_node_table.py new file mode 100644 index 0000000..2845c67 --- /dev/null +++ b/robosystems_client/api/content_operations/create_subgraph_node_table.py @@ -0,0 +1,264 @@ +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.create_subgraph_node_table_op import CreateSubgraphNodeTableOp +from ...models.error_response import ErrorResponse +from ...models.operation_envelope import OperationEnvelope +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + body: CreateSubgraphNodeTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(idempotency_key, Unset): + headers["Idempotency-Key"] = idempotency_key + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/graphs/{graph_id}/operations/create-subgraph-node-table".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ErrorResponse | OperationEnvelope | None: + if response.status_code == 200: + response_200 = OperationEnvelope.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = ErrorResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = ErrorResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = ErrorResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = ErrorResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 409: + response_409 = ErrorResponse.from_dict(response.json()) + + return response_409 + + if response.status_code == 422: + response_422 = ErrorResponse.from_dict(response.json()) + + return response_422 + + if response.status_code == 429: + response_429 = ErrorResponse.from_dict(response.json()) + + return response_429 + + if response.status_code == 500: + response_500 = ErrorResponse.from_dict(response.json()) + + return response_500 + + 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[ErrorResponse | OperationEnvelope]: + 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: CreateSubgraphNodeTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Create a Subgraph Node Table + + Subgraphs only: refused with 403 on a main graph. Creates a node table in the subgraph's schema; + mark one property `is_primary_key`. A table that already exists with every requested property + answers `created: false`; one missing any is refused with 409 (add them with `alter-subgraph- + table`). DOUBLE is binary floating point, so keep money as INT64 in minor units. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphNodeTableOp): Body for create-subgraph-node-table. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphNodeTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Create a Subgraph Node Table + + Subgraphs only: refused with 403 on a main graph. Creates a node table in the subgraph's schema; + mark one property `is_primary_key`. A table that already exists with every requested property + answers `created: false`; one missing any is refused with 409 (add them with `alter-subgraph- + table`). DOUBLE is binary floating point, so keep money as INT64 in minor units. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphNodeTableOp): Body for create-subgraph-node-table. + + 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: + ErrorResponse | OperationEnvelope + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphNodeTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Create a Subgraph Node Table + + Subgraphs only: refused with 403 on a main graph. Creates a node table in the subgraph's schema; + mark one property `is_primary_key`. A table that already exists with every requested property + answers `created: false`; one missing any is refused with 409 (add them with `alter-subgraph- + table`). DOUBLE is binary floating point, so keep money as INT64 in minor units. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphNodeTableOp): Body for create-subgraph-node-table. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + 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: CreateSubgraphNodeTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Create a Subgraph Node Table + + Subgraphs only: refused with 403 on a main graph. Creates a node table in the subgraph's schema; + mark one property `is_primary_key`. A table that already exists with every requested property + answers `created: false`; one missing any is refused with 409 (add them with `alter-subgraph- + table`). DOUBLE is binary floating point, so keep money as INT64 in minor units. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphNodeTableOp): Body for create-subgraph-node-table. + + 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: + ErrorResponse | OperationEnvelope + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ) + ).parsed diff --git a/robosystems_client/api/content_operations/create_subgraph_relationship_table.py b/robosystems_client/api/content_operations/create_subgraph_relationship_table.py new file mode 100644 index 0000000..d8ca8ce --- /dev/null +++ b/robosystems_client/api/content_operations/create_subgraph_relationship_table.py @@ -0,0 +1,266 @@ +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.create_subgraph_relationship_table_op import ( + CreateSubgraphRelationshipTableOp, +) +from ...models.error_response import ErrorResponse +from ...models.operation_envelope import OperationEnvelope +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + body: CreateSubgraphRelationshipTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(idempotency_key, Unset): + headers["Idempotency-Key"] = idempotency_key + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/graphs/{graph_id}/operations/create-subgraph-relationship-table".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ErrorResponse | OperationEnvelope | None: + if response.status_code == 200: + response_200 = OperationEnvelope.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = ErrorResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = ErrorResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = ErrorResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = ErrorResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 409: + response_409 = ErrorResponse.from_dict(response.json()) + + return response_409 + + if response.status_code == 422: + response_422 = ErrorResponse.from_dict(response.json()) + + return response_422 + + if response.status_code == 429: + response_429 = ErrorResponse.from_dict(response.json()) + + return response_429 + + if response.status_code == 500: + response_500 = ErrorResponse.from_dict(response.json()) + + return response_500 + + 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[ErrorResponse | OperationEnvelope]: + 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: CreateSubgraphRelationshipTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Create a Subgraph Relationship Table + + Subgraphs only: refused with 403 on a main graph. Creates a relationship table joining `from_node` + to `to_node`, in that direction; both node tables must exist. A table that already exists with the + same endpoints and properties answers `created: false`; other endpoints or new properties are + refused with 409. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphRelationshipTableOp): Body for create-subgraph-relationship-table. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphRelationshipTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Create a Subgraph Relationship Table + + Subgraphs only: refused with 403 on a main graph. Creates a relationship table joining `from_node` + to `to_node`, in that direction; both node tables must exist. A table that already exists with the + same endpoints and properties answers `created: false`; other endpoints or new properties are + refused with 409. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphRelationshipTableOp): Body for create-subgraph-relationship-table. + + 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: + ErrorResponse | OperationEnvelope + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSubgraphRelationshipTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Create a Subgraph Relationship Table + + Subgraphs only: refused with 403 on a main graph. Creates a relationship table joining `from_node` + to `to_node`, in that direction; both node tables must exist. A table that already exists with the + same endpoints and properties answers `created: false`; other endpoints or new properties are + refused with 409. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphRelationshipTableOp): Body for create-subgraph-relationship-table. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + 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: CreateSubgraphRelationshipTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Create a Subgraph Relationship Table + + Subgraphs only: refused with 403 on a main graph. Creates a relationship table joining `from_node` + to `to_node`, in that direction; both node tables must exist. A table that already exists with the + same endpoints and properties answers `created: false`; other endpoints or new properties are + refused with 409. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (CreateSubgraphRelationshipTableOp): Body for create-subgraph-relationship-table. + + 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: + ErrorResponse | OperationEnvelope + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ) + ).parsed diff --git a/robosystems_client/api/content_operations/drop_subgraph_table.py b/robosystems_client/api/content_operations/drop_subgraph_table.py new file mode 100644 index 0000000..84d0114 --- /dev/null +++ b/robosystems_client/api/content_operations/drop_subgraph_table.py @@ -0,0 +1,264 @@ +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.drop_subgraph_table_op import DropSubgraphTableOp +from ...models.error_response import ErrorResponse +from ...models.operation_envelope import OperationEnvelope +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + body: DropSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(idempotency_key, Unset): + headers["Idempotency-Key"] = idempotency_key + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/graphs/{graph_id}/operations/drop-subgraph-table".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ErrorResponse | OperationEnvelope | None: + if response.status_code == 200: + response_200 = OperationEnvelope.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = ErrorResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = ErrorResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = ErrorResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = ErrorResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 409: + response_409 = ErrorResponse.from_dict(response.json()) + + return response_409 + + if response.status_code == 422: + response_422 = ErrorResponse.from_dict(response.json()) + + return response_422 + + if response.status_code == 429: + response_429 = ErrorResponse.from_dict(response.json()) + + return response_429 + + if response.status_code == 500: + response_500 = ErrorResponse.from_dict(response.json()) + + return response_500 + + 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[ErrorResponse | OperationEnvelope]: + 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: DropSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Drop a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Drops a table from the subgraph with every row in + it; this cannot be undone. A node table that a relationship table still joins is refused (drop the + relationship table first). Returns 409 with `Retry-After` while an import into the subgraph is + running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (DropSubgraphTableOp): Body for drop-subgraph-table. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: DropSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Drop a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Drops a table from the subgraph with every row in + it; this cannot be undone. A node table that a relationship table still joins is refused (drop the + relationship table first). Returns 409 with `Retry-After` while an import into the subgraph is + running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (DropSubgraphTableOp): Body for drop-subgraph-table. + + 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: + ErrorResponse | OperationEnvelope + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: DropSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> Response[ErrorResponse | OperationEnvelope]: + """Drop a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Drops a table from the subgraph with every row in + it; this cannot be undone. A node table that a relationship table still joins is refused (drop the + relationship table first). Returns 409 with `Retry-After` while an import into the subgraph is + running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (DropSubgraphTableOp): Body for drop-subgraph-table. + + 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[ErrorResponse | OperationEnvelope] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + idempotency_key=idempotency_key, + ) + + 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: DropSubgraphTableOp, + idempotency_key: None | str | Unset = UNSET, +) -> ErrorResponse | OperationEnvelope | None: + """Drop a Subgraph Table + + Subgraphs only: refused with 403 on a main graph. Drops a table from the subgraph with every row in + it; this cannot be undone. A node table that a relationship table still joins is refused (drop the + relationship table first). Returns 409 with `Retry-After` while an import into the subgraph is + running. + + **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours + return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. + + Args: + graph_id (str): + idempotency_key (None | str | Unset): + body (DropSubgraphTableOp): Body for drop-subgraph-table. + + 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: + ErrorResponse | OperationEnvelope + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + idempotency_key=idempotency_key, + ) + ).parsed diff --git a/robosystems_client/models/__init__.py b/robosystems_client/models/__init__.py index e46c222..6f3c05d 100644 --- a/robosystems_client/models/__init__.py +++ b/robosystems_client/models/__init__.py @@ -11,6 +11,11 @@ from .add_publish_list_members_operation import AddPublishListMembersOperation from .agent_classification import AgentClassification from .allocation_override_response import AllocationOverrideResponse +from .alter_subgraph_table_op import AlterSubgraphTableOp +from .alter_subgraph_table_op_action import AlterSubgraphTableOpAction +from .alter_subgraph_table_op_property_type_type_0 import ( + AlterSubgraphTableOpPropertyTypeType0, +) from .analytical_statement_fact_row import AnalyticalStatementFactRow from .api_key_info import APIKeyInfo from .api_keys_response import APIKeysResponse @@ -158,6 +163,8 @@ from .create_security_request import CreateSecurityRequest from .create_security_request_terms import CreateSecurityRequestTerms from .create_subgraph_import_op import CreateSubgraphImportOp +from .create_subgraph_node_table_op import CreateSubgraphNodeTableOp +from .create_subgraph_relationship_table_op import CreateSubgraphRelationshipTableOp from .create_subgraph_request import CreateSubgraphRequest from .create_subgraph_request_metadata_type_0 import CreateSubgraphRequestMetadataType0 from .create_taxonomy_block_request import CreateTaxonomyBlockRequest @@ -244,6 +251,7 @@ from .document_list_response import DocumentListResponse from .document_section import DocumentSection from .download_quota import DownloadQuota +from .drop_subgraph_table_op import DropSubgraphTableOp from .element_lite import ElementLite from .element_summary import ElementSummary from .element_update_patch import ElementUpdatePatch @@ -1146,6 +1154,10 @@ ) from .structure_update_patch_metadata_type_0 import StructureUpdatePatchMetadataType0 from .subgraph_limits import SubgraphLimits +from .subgraph_node_property import SubgraphNodeProperty +from .subgraph_node_property_type import SubgraphNodePropertyType +from .subgraph_relationship_property import SubgraphRelationshipProperty +from .subgraph_relationship_property_type import SubgraphRelationshipPropertyType from .subgraph_response import SubgraphResponse from .subgraph_response_metadata_type_0 import SubgraphResponseMetadataType0 from .subgraph_summary import SubgraphSummary @@ -1303,6 +1315,9 @@ "AddPublishListMembersOperation", "AgentClassification", "AllocationOverrideResponse", + "AlterSubgraphTableOp", + "AlterSubgraphTableOpAction", + "AlterSubgraphTableOpPropertyTypeType0", "AnalyticalStatementFactRow", "APIKeyInfo", "APIKeysResponse", @@ -1428,6 +1443,8 @@ "CreateSecurityRequest", "CreateSecurityRequestTerms", "CreateSubgraphImportOp", + "CreateSubgraphNodeTableOp", + "CreateSubgraphRelationshipTableOp", "CreateSubgraphRequest", "CreateSubgraphRequestMetadataType0", "CreateTaxonomyBlockRequest", @@ -1500,6 +1517,7 @@ "DocumentListResponse", "DocumentSection", "DownloadQuota", + "DropSubgraphTableOp", "ElementLite", "ElementSummary", "ElementUpdatePatch", @@ -2062,6 +2080,10 @@ "StructureUpdatePatchConceptArrangementType0", "StructureUpdatePatchMetadataType0", "SubgraphLimits", + "SubgraphNodeProperty", + "SubgraphNodePropertyType", + "SubgraphRelationshipProperty", + "SubgraphRelationshipPropertyType", "SubgraphResponse", "SubgraphResponseMetadataType0", "SubgraphSummary", diff --git a/robosystems_client/models/alter_subgraph_table_op.py b/robosystems_client/models/alter_subgraph_table_op.py new file mode 100644 index 0000000..a03a6ca --- /dev/null +++ b/robosystems_client/models/alter_subgraph_table_op.py @@ -0,0 +1,137 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.alter_subgraph_table_op_action import AlterSubgraphTableOpAction +from ..models.alter_subgraph_table_op_property_type_type_0 import ( + AlterSubgraphTableOpPropertyTypeType0, +) +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AlterSubgraphTableOp") + + +@_attrs_define +class AlterSubgraphTableOp: + """Body for alter-subgraph-table: one property added, dropped or renamed. + + Attributes: + table_name (str): The table to change + action (AlterSubgraphTableOpAction): + property_name (str): The property to add, drop or rename + property_type (AlterSubgraphTableOpPropertyTypeType0 | None | Unset): Type of the property to add (add_property + only) + new_property_name (None | str | Unset): The new name (rename_property only) + """ + + table_name: str + action: AlterSubgraphTableOpAction + property_name: str + property_type: AlterSubgraphTableOpPropertyTypeType0 | None | Unset = UNSET + new_property_name: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + table_name = self.table_name + + action = self.action.value + + property_name = self.property_name + + property_type: None | str | Unset + if isinstance(self.property_type, Unset): + property_type = UNSET + elif isinstance(self.property_type, AlterSubgraphTableOpPropertyTypeType0): + property_type = self.property_type.value + else: + property_type = self.property_type + + new_property_name: None | str | Unset + if isinstance(self.new_property_name, Unset): + new_property_name = UNSET + else: + new_property_name = self.new_property_name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "table_name": table_name, + "action": action, + "property_name": property_name, + } + ) + if property_type is not UNSET: + field_dict["property_type"] = property_type + if new_property_name is not UNSET: + field_dict["new_property_name"] = new_property_name + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + table_name = d.pop("table_name") + + action = AlterSubgraphTableOpAction(d.pop("action")) + + property_name = d.pop("property_name") + + def _parse_property_type( + data: object, + ) -> AlterSubgraphTableOpPropertyTypeType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + property_type_type_0 = AlterSubgraphTableOpPropertyTypeType0(data) + + return property_type_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AlterSubgraphTableOpPropertyTypeType0 | None | Unset, data) + + property_type = _parse_property_type(d.pop("property_type", UNSET)) + + def _parse_new_property_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + new_property_name = _parse_new_property_name(d.pop("new_property_name", UNSET)) + + alter_subgraph_table_op = cls( + table_name=table_name, + action=action, + property_name=property_name, + property_type=property_type, + new_property_name=new_property_name, + ) + + alter_subgraph_table_op.additional_properties = d + return alter_subgraph_table_op + + @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/alter_subgraph_table_op_action.py b/robosystems_client/models/alter_subgraph_table_op_action.py new file mode 100644 index 0000000..576f714 --- /dev/null +++ b/robosystems_client/models/alter_subgraph_table_op_action.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class AlterSubgraphTableOpAction(str, Enum): + ADD_PROPERTY = "add_property" + DROP_PROPERTY = "drop_property" + RENAME_PROPERTY = "rename_property" + + def __str__(self) -> str: + return str(self.value) diff --git a/robosystems_client/models/alter_subgraph_table_op_property_type_type_0.py b/robosystems_client/models/alter_subgraph_table_op_property_type_type_0.py new file mode 100644 index 0000000..8dbc526 --- /dev/null +++ b/robosystems_client/models/alter_subgraph_table_op_property_type_type_0.py @@ -0,0 +1,12 @@ +from enum import Enum + + +class AlterSubgraphTableOpPropertyTypeType0(str, Enum): + BOOLEAN = "BOOLEAN" + DOUBLE = "DOUBLE" + INT32 = "INT32" + INT64 = "INT64" + STRING = "STRING" + + def __str__(self) -> str: + return str(self.value) diff --git a/robosystems_client/models/create_subgraph_node_table_op.py b/robosystems_client/models/create_subgraph_node_table_op.py new file mode 100644 index 0000000..dd3af88 --- /dev/null +++ b/robosystems_client/models/create_subgraph_node_table_op.py @@ -0,0 +1,84 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.subgraph_node_property import SubgraphNodeProperty + + +T = TypeVar("T", bound="CreateSubgraphNodeTableOp") + + +@_attrs_define +class CreateSubgraphNodeTableOp: + """Body for create-subgraph-node-table. + + Attributes: + table_name (str): The node table + properties (list[SubgraphNodeProperty]): Its properties, one marked is_primary_key + """ + + table_name: str + properties: list[SubgraphNodeProperty] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + table_name = self.table_name + + properties = [] + for properties_item_data in self.properties: + properties_item = properties_item_data.to_dict() + properties.append(properties_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "table_name": table_name, + "properties": properties, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.subgraph_node_property import SubgraphNodeProperty + + d = dict(src_dict) + table_name = d.pop("table_name") + + properties = [] + _properties = d.pop("properties") + for properties_item_data in _properties: + properties_item = SubgraphNodeProperty.from_dict(properties_item_data) + + properties.append(properties_item) + + create_subgraph_node_table_op = cls( + table_name=table_name, + properties=properties, + ) + + create_subgraph_node_table_op.additional_properties = d + return create_subgraph_node_table_op + + @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_relationship_table_op.py b/robosystems_client/models/create_subgraph_relationship_table_op.py new file mode 100644 index 0000000..2abfa0c --- /dev/null +++ b/robosystems_client/models/create_subgraph_relationship_table_op.py @@ -0,0 +1,107 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +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_relationship_property import SubgraphRelationshipProperty + + +T = TypeVar("T", bound="CreateSubgraphRelationshipTableOp") + + +@_attrs_define +class CreateSubgraphRelationshipTableOp: + """Body for create-subgraph-relationship-table. + + Attributes: + table_name (str): The relationship table + from_node (str): Source node table + to_node (str): Target node table + properties (list[SubgraphRelationshipProperty] | Unset): Optional properties + """ + + table_name: str + from_node: str + to_node: str + properties: list[SubgraphRelationshipProperty] | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + table_name = self.table_name + + from_node = self.from_node + + to_node = self.to_node + + properties: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.properties, Unset): + properties = [] + for properties_item_data in self.properties: + properties_item = properties_item_data.to_dict() + properties.append(properties_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "table_name": table_name, + "from_node": from_node, + "to_node": to_node, + } + ) + if properties is not UNSET: + field_dict["properties"] = properties + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.subgraph_relationship_property import SubgraphRelationshipProperty + + d = dict(src_dict) + table_name = d.pop("table_name") + + from_node = d.pop("from_node") + + to_node = d.pop("to_node") + + _properties = d.pop("properties", UNSET) + properties: list[SubgraphRelationshipProperty] | Unset = UNSET + if _properties is not UNSET: + properties = [] + for properties_item_data in _properties: + properties_item = SubgraphRelationshipProperty.from_dict(properties_item_data) + + properties.append(properties_item) + + create_subgraph_relationship_table_op = cls( + table_name=table_name, + from_node=from_node, + to_node=to_node, + properties=properties, + ) + + create_subgraph_relationship_table_op.additional_properties = d + return create_subgraph_relationship_table_op + + @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/drop_subgraph_table_op.py b/robosystems_client/models/drop_subgraph_table_op.py new file mode 100644 index 0000000..f168e92 --- /dev/null +++ b/robosystems_client/models/drop_subgraph_table_op.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +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="DropSubgraphTableOp") + + +@_attrs_define +class DropSubgraphTableOp: + """Body for drop-subgraph-table. + + Attributes: + table_name (str): The table to drop + """ + + table_name: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + table_name = self.table_name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "table_name": table_name, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + table_name = d.pop("table_name") + + drop_subgraph_table_op = cls( + table_name=table_name, + ) + + drop_subgraph_table_op.additional_properties = d + return drop_subgraph_table_op + + @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_node_property.py b/robosystems_client/models/subgraph_node_property.py new file mode 100644 index 0000000..b21377f --- /dev/null +++ b/robosystems_client/models/subgraph_node_property.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.subgraph_node_property_type import SubgraphNodePropertyType +from ..types import UNSET, Unset + +T = TypeVar("T", bound="SubgraphNodeProperty") + + +@_attrs_define +class SubgraphNodeProperty: + """One property of a subgraph node table. + + Attributes: + name (str): Lowercase letters, numbers and underscores; starts with a letter + type_ (SubgraphNodePropertyType): The property's type + is_primary_key (bool | Unset): Mark exactly the property that keys the node Default: False. + """ + + name: str + type_: SubgraphNodePropertyType + is_primary_key: bool | Unset = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + type_ = self.type_.value + + is_primary_key = self.is_primary_key + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "type": type_, + } + ) + if is_primary_key is not UNSET: + field_dict["is_primary_key"] = is_primary_key + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + type_ = SubgraphNodePropertyType(d.pop("type")) + + is_primary_key = d.pop("is_primary_key", UNSET) + + subgraph_node_property = cls( + name=name, + type_=type_, + is_primary_key=is_primary_key, + ) + + subgraph_node_property.additional_properties = d + return subgraph_node_property + + @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_node_property_type.py b/robosystems_client/models/subgraph_node_property_type.py new file mode 100644 index 0000000..b91f1a5 --- /dev/null +++ b/robosystems_client/models/subgraph_node_property_type.py @@ -0,0 +1,12 @@ +from enum import Enum + + +class SubgraphNodePropertyType(str, Enum): + BOOLEAN = "BOOLEAN" + DOUBLE = "DOUBLE" + INT32 = "INT32" + INT64 = "INT64" + STRING = "STRING" + + def __str__(self) -> str: + return str(self.value) diff --git a/robosystems_client/models/subgraph_relationship_property.py b/robosystems_client/models/subgraph_relationship_property.py new file mode 100644 index 0000000..073cef0 --- /dev/null +++ b/robosystems_client/models/subgraph_relationship_property.py @@ -0,0 +1,74 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.subgraph_relationship_property_type import ( + SubgraphRelationshipPropertyType, +) + +T = TypeVar("T", bound="SubgraphRelationshipProperty") + + +@_attrs_define +class SubgraphRelationshipProperty: + """One property of a subgraph relationship table. + + Attributes: + name (str): Lowercase letters, numbers and underscores; starts with a letter + type_ (SubgraphRelationshipPropertyType): The property's type + """ + + name: str + type_: SubgraphRelationshipPropertyType + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + type_ = self.type_.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "type": type_, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + type_ = SubgraphRelationshipPropertyType(d.pop("type")) + + subgraph_relationship_property = cls( + name=name, + type_=type_, + ) + + subgraph_relationship_property.additional_properties = d + return subgraph_relationship_property + + @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_relationship_property_type.py b/robosystems_client/models/subgraph_relationship_property_type.py new file mode 100644 index 0000000..0d3baad --- /dev/null +++ b/robosystems_client/models/subgraph_relationship_property_type.py @@ -0,0 +1,12 @@ +from enum import Enum + + +class SubgraphRelationshipPropertyType(str, Enum): + BOOLEAN = "BOOLEAN" + DOUBLE = "DOUBLE" + INT32 = "INT32" + INT64 = "INT64" + STRING = "STRING" + + def __str__(self) -> str: + return str(self.value)