diff --git a/robosystems_client/api/ledger/add_publish_list_members.py b/robosystems_client/api/ledger/add_publish_list_members.py new file mode 100644 index 0000000..4ab7a4a --- /dev/null +++ b/robosystems_client/api/ledger/add_publish_list_members.py @@ -0,0 +1,201 @@ +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.add_members_request import AddMembersRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.publish_list_member_response import PublishListMemberResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + list_id: str, + *, + body: AddMembersRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/ledger/{graph_id}/publish-lists/{list_id}/members".format( + graph_id=quote(str(graph_id), safe=""), + list_id=quote(str(list_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 +) -> HTTPValidationError | list[PublishListMemberResponse] | None: + if response.status_code == 201: + response_201 = [] + _response_201 = response.json() + for response_201_item_data in _response_201: + response_201_item = PublishListMemberResponse.from_dict(response_201_item_data) + + response_201.append(response_201_item) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | list[PublishListMemberResponse]]: + 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, + list_id: str, + *, + client: AuthenticatedClient, + body: AddMembersRequest, +) -> Response[HTTPValidationError | list[PublishListMemberResponse]]: + """Add Members to Publish List + + Args: + graph_id (str): + list_id (str): + body (AddMembersRequest): + + 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[HTTPValidationError | list[PublishListMemberResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, + body: AddMembersRequest, +) -> HTTPValidationError | list[PublishListMemberResponse] | None: + """Add Members to Publish List + + Args: + graph_id (str): + list_id (str): + body (AddMembersRequest): + + 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: + HTTPValidationError | list[PublishListMemberResponse] + """ + + return sync_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, + body: AddMembersRequest, +) -> Response[HTTPValidationError | list[PublishListMemberResponse]]: + """Add Members to Publish List + + Args: + graph_id (str): + list_id (str): + body (AddMembersRequest): + + 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[HTTPValidationError | list[PublishListMemberResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, + body: AddMembersRequest, +) -> HTTPValidationError | list[PublishListMemberResponse] | None: + """Add Members to Publish List + + Args: + graph_id (str): + list_id (str): + body (AddMembersRequest): + + 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: + HTTPValidationError | list[PublishListMemberResponse] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/ledger/create_publish_list.py b/robosystems_client/api/ledger/create_publish_list.py new file mode 100644 index 0000000..841812b --- /dev/null +++ b/robosystems_client/api/ledger/create_publish_list.py @@ -0,0 +1,182 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_publish_list_request import CreatePublishListRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.publish_list_response import PublishListResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + *, + body: CreatePublishListRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/ledger/{graph_id}/publish-lists".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 +) -> HTTPValidationError | PublishListResponse | None: + if response.status_code == 201: + response_201 = PublishListResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PublishListResponse]: + 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: CreatePublishListRequest, +) -> Response[HTTPValidationError | PublishListResponse]: + """Create Publish List + + Args: + graph_id (str): + body (CreatePublishListRequest): + + 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[HTTPValidationError | PublishListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePublishListRequest, +) -> HTTPValidationError | PublishListResponse | None: + """Create Publish List + + Args: + graph_id (str): + body (CreatePublishListRequest): + + 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: + HTTPValidationError | PublishListResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePublishListRequest, +) -> Response[HTTPValidationError | PublishListResponse]: + """Create Publish List + + Args: + graph_id (str): + body (CreatePublishListRequest): + + 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[HTTPValidationError | PublishListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + 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: CreatePublishListRequest, +) -> HTTPValidationError | PublishListResponse | None: + """Create Publish List + + Args: + graph_id (str): + body (CreatePublishListRequest): + + 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: + HTTPValidationError | PublishListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/ledger/delete_publish_list.py b/robosystems_client/api/ledger/delete_publish_list.py new file mode 100644 index 0000000..e95457b --- /dev/null +++ b/robosystems_client/api/ledger/delete_publish_list.py @@ -0,0 +1,172 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import Response + + +def _get_kwargs( + graph_id: str, + list_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/v1/ledger/{graph_id}/publish-lists/{list_id}".format( + graph_id=quote(str(graph_id), safe=""), + list_id=quote(str(list_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | 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, + list_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/ledger/get_publish_list.py b/robosystems_client/api/ledger/get_publish_list.py new file mode 100644 index 0000000..fb80371 --- /dev/null +++ b/robosystems_client/api/ledger/get_publish_list.py @@ -0,0 +1,174 @@ +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.http_validation_error import HTTPValidationError +from ...models.publish_list_detail_response import PublishListDetailResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + list_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/ledger/{graph_id}/publish-lists/{list_id}".format( + graph_id=quote(str(graph_id), safe=""), + list_id=quote(str(list_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PublishListDetailResponse | None: + if response.status_code == 200: + response_200 = PublishListDetailResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PublishListDetailResponse]: + 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, + list_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | PublishListDetailResponse]: + """Get Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PublishListDetailResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | PublishListDetailResponse | None: + """Get Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PublishListDetailResponse + """ + + return sync_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | PublishListDetailResponse]: + """Get Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PublishListDetailResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | PublishListDetailResponse | None: + """Get Publish List + + Args: + graph_id (str): + list_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PublishListDetailResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/ledger/list_ledger_entities.py b/robosystems_client/api/ledger/list_ledger_entities.py new file mode 100644 index 0000000..1fa53b7 --- /dev/null +++ b/robosystems_client/api/ledger/list_ledger_entities.py @@ -0,0 +1,199 @@ +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.http_validation_error import HTTPValidationError +from ...models.ledger_entity_response import LedgerEntityResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + source: None | str | Unset = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + json_source: None | str | Unset + if isinstance(source, Unset): + json_source = UNSET + else: + json_source = source + params["source"] = json_source + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/ledger/{graph_id}/entities".format( + graph_id=quote(str(graph_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | list[LedgerEntityResponse] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = LedgerEntityResponse.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | list[LedgerEntityResponse]]: + 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, + source: None | str | Unset = UNSET, +) -> Response[HTTPValidationError | list[LedgerEntityResponse]]: + """List Entities + + List entities for this graph, optionally filtered by source. + + Args: + graph_id (str): + source (None | str | Unset): Filter by source (e.g., 'linked') + + 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[HTTPValidationError | list[LedgerEntityResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + source=source, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + source: None | str | Unset = UNSET, +) -> HTTPValidationError | list[LedgerEntityResponse] | None: + """List Entities + + List entities for this graph, optionally filtered by source. + + Args: + graph_id (str): + source (None | str | Unset): Filter by source (e.g., 'linked') + + 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: + HTTPValidationError | list[LedgerEntityResponse] + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + source=source, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + source: None | str | Unset = UNSET, +) -> Response[HTTPValidationError | list[LedgerEntityResponse]]: + """List Entities + + List entities for this graph, optionally filtered by source. + + Args: + graph_id (str): + source (None | str | Unset): Filter by source (e.g., 'linked') + + 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[HTTPValidationError | list[LedgerEntityResponse]] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + source=source, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + source: None | str | Unset = UNSET, +) -> HTTPValidationError | list[LedgerEntityResponse] | None: + """List Entities + + List entities for this graph, optionally filtered by source. + + Args: + graph_id (str): + source (None | str | Unset): Filter by source (e.g., 'linked') + + 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: + HTTPValidationError | list[LedgerEntityResponse] + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + source=source, + ) + ).parsed diff --git a/robosystems_client/api/ledger/list_publish_lists.py b/robosystems_client/api/ledger/list_publish_lists.py new file mode 100644 index 0000000..2ceeef5 --- /dev/null +++ b/robosystems_client/api/ledger/list_publish_lists.py @@ -0,0 +1,196 @@ +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.http_validation_error import HTTPValidationError +from ...models.publish_list_list_response import PublishListListResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/ledger/{graph_id}/publish-lists".format( + graph_id=quote(str(graph_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PublishListListResponse | None: + if response.status_code == 200: + response_200 = PublishListListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PublishListListResponse]: + 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, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | PublishListListResponse]: + """List Publish Lists + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + 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[HTTPValidationError | PublishListListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | PublishListListResponse | None: + """List Publish Lists + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + 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: + HTTPValidationError | PublishListListResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | PublishListListResponse]: + """List Publish Lists + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + 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[HTTPValidationError | PublishListListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | PublishListListResponse | None: + """List Publish Lists + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + 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: + HTTPValidationError | PublishListListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/robosystems_client/api/ledger/remove_publish_list_member.py b/robosystems_client/api/ledger/remove_publish_list_member.py new file mode 100644 index 0000000..ef77576 --- /dev/null +++ b/robosystems_client/api/ledger/remove_publish_list_member.py @@ -0,0 +1,186 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import Response + + +def _get_kwargs( + graph_id: str, + list_id: str, + member_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/v1/ledger/{graph_id}/publish-lists/{list_id}/members/{member_id}".format( + graph_id=quote(str(graph_id), safe=""), + list_id=quote(str(list_id), safe=""), + member_id=quote(str(member_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | 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, + list_id: str, + member_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Remove Member from Publish List + + Args: + graph_id (str): + list_id (str): + member_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + member_id=member_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + list_id: str, + member_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Remove Member from Publish List + + Args: + graph_id (str): + list_id (str): + member_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + graph_id=graph_id, + list_id=list_id, + member_id=member_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + list_id: str, + member_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Remove Member from Publish List + + Args: + graph_id (str): + list_id (str): + member_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + member_id=member_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + list_id: str, + member_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Remove Member from Publish List + + Args: + graph_id (str): + list_id (str): + member_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + list_id=list_id, + member_id=member_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/ledger/update_publish_list.py b/robosystems_client/api/ledger/update_publish_list.py new file mode 100644 index 0000000..999bc0b --- /dev/null +++ b/robosystems_client/api/ledger/update_publish_list.py @@ -0,0 +1,196 @@ +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.http_validation_error import HTTPValidationError +from ...models.publish_list_response import PublishListResponse +from ...models.update_publish_list_request import UpdatePublishListRequest +from ...types import Response + + +def _get_kwargs( + graph_id: str, + list_id: str, + *, + body: UpdatePublishListRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/v1/ledger/{graph_id}/publish-lists/{list_id}".format( + graph_id=quote(str(graph_id), safe=""), + list_id=quote(str(list_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 +) -> HTTPValidationError | PublishListResponse | None: + if response.status_code == 200: + response_200 = PublishListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PublishListResponse]: + 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, + list_id: str, + *, + client: AuthenticatedClient, + body: UpdatePublishListRequest, +) -> Response[HTTPValidationError | PublishListResponse]: + """Update Publish List + + Args: + graph_id (str): + list_id (str): + body (UpdatePublishListRequest): + + 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[HTTPValidationError | PublishListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, + body: UpdatePublishListRequest, +) -> HTTPValidationError | PublishListResponse | None: + """Update Publish List + + Args: + graph_id (str): + list_id (str): + body (UpdatePublishListRequest): + + 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: + HTTPValidationError | PublishListResponse + """ + + return sync_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, + body: UpdatePublishListRequest, +) -> Response[HTTPValidationError | PublishListResponse]: + """Update Publish List + + Args: + graph_id (str): + list_id (str): + body (UpdatePublishListRequest): + + 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[HTTPValidationError | PublishListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + list_id=list_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + list_id: str, + *, + client: AuthenticatedClient, + body: UpdatePublishListRequest, +) -> HTTPValidationError | PublishListResponse | None: + """Update Publish List + + Args: + graph_id (str): + list_id (str): + body (UpdatePublishListRequest): + + 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: + HTTPValidationError | PublishListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + list_id=list_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/extensions/report_client.py b/robosystems_client/extensions/report_client.py index 995a3e3..f5239fe 100644 --- a/robosystems_client/extensions/report_client.py +++ b/robosystems_client/extensions/report_client.py @@ -118,11 +118,11 @@ def delete(self, graph_id: str, report_id: str) -> None: if response.status_code != HTTPStatus.NO_CONTENT: raise RuntimeError(f"Delete report failed: {response.status_code}") - def share(self, graph_id: str, report_id: str, target_graph_ids: list[str]) -> Any: - """Share a published report to other graphs (snapshot copy).""" + def share(self, graph_id: str, report_id: str, publish_list_id: str) -> Any: + """Share a published report to all members of a publish list (snapshot copy).""" from ..models.share_report_request import ShareReportRequest - body = ShareReportRequest(target_graph_ids=target_graph_ids) + body = ShareReportRequest(publish_list_id=publish_list_id) response = share_report( graph_id=graph_id, report_id=report_id, body=body, client=self._get_client() ) diff --git a/robosystems_client/models/__init__.py b/robosystems_client/models/__init__.py index 89c4c79..5a5e645 100644 --- a/robosystems_client/models/__init__.py +++ b/robosystems_client/models/__init__.py @@ -5,6 +5,7 @@ from .account_response import AccountResponse from .account_tree_node import AccountTreeNode from .account_tree_response import AccountTreeResponse +from .add_members_request import AddMembersRequest from .agent_list_response import AgentListResponse from .agent_list_response_agents import AgentListResponseAgents from .agent_list_response_agents_additional_property import ( @@ -78,6 +79,7 @@ from .create_graph_request import CreateGraphRequest from .create_portfolio_request import CreatePortfolioRequest from .create_position_request import CreatePositionRequest +from .create_publish_list_request import CreatePublishListRequest from .create_report_request import CreateReportRequest from .create_repository_subscription_request import CreateRepositorySubscriptionRequest from .create_security_request import CreateSecurityRequest @@ -250,6 +252,10 @@ from .portfolio_response import PortfolioResponse from .position_list_response import PositionListResponse from .position_response import PositionResponse +from .publish_list_detail_response import PublishListDetailResponse +from .publish_list_list_response import PublishListListResponse +from .publish_list_member_response import PublishListMemberResponse +from .publish_list_response import PublishListResponse from .query_limits import QueryLimits from .quick_books_connection_config import QuickBooksConnectionConfig from .rate_limits import RateLimits @@ -341,6 +347,7 @@ from .update_password_request import UpdatePasswordRequest from .update_portfolio_request import UpdatePortfolioRequest from .update_position_request import UpdatePositionRequest +from .update_publish_list_request import UpdatePublishListRequest from .update_security_request import UpdateSecurityRequest from .update_security_request_terms_type_0 import UpdateSecurityRequestTermsType0 from .update_user_request import UpdateUserRequest @@ -361,6 +368,7 @@ "AccountResponse", "AccountTreeNode", "AccountTreeResponse", + "AddMembersRequest", "AgentListResponse", "AgentListResponseAgents", "AgentListResponseAgentsAdditionalProperty", @@ -422,6 +430,7 @@ "CreateGraphRequest", "CreatePortfolioRequest", "CreatePositionRequest", + "CreatePublishListRequest", "CreateReportRequest", "CreateRepositorySubscriptionRequest", "CreateSecurityRequest", @@ -572,6 +581,10 @@ "PortfolioResponse", "PositionListResponse", "PositionResponse", + "PublishListDetailResponse", + "PublishListListResponse", + "PublishListMemberResponse", + "PublishListResponse", "QueryLimits", "QuickBooksConnectionConfig", "RateLimits", @@ -651,6 +664,7 @@ "UpdatePasswordRequest", "UpdatePortfolioRequest", "UpdatePositionRequest", + "UpdatePublishListRequest", "UpdateSecurityRequest", "UpdateSecurityRequestTermsType0", "UpdateUserRequest", diff --git a/robosystems_client/models/add_members_request.py b/robosystems_client/models/add_members_request.py new file mode 100644 index 0000000..1cc7000 --- /dev/null +++ b/robosystems_client/models/add_members_request.py @@ -0,0 +1,61 @@ +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 + +T = TypeVar("T", bound="AddMembersRequest") + + +@_attrs_define +class AddMembersRequest: + """ + Attributes: + target_graph_ids (list[str]): Graph IDs to add to this list + """ + + target_graph_ids: list[str] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + target_graph_ids = self.target_graph_ids + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "target_graph_ids": target_graph_ids, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + target_graph_ids = cast(list[str], d.pop("target_graph_ids")) + + add_members_request = cls( + target_graph_ids=target_graph_ids, + ) + + add_members_request.additional_properties = d + return add_members_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_publish_list_request.py b/robosystems_client/models/create_publish_list_request.py new file mode 100644 index 0000000..4f1c949 --- /dev/null +++ b/robosystems_client/models/create_publish_list_request.py @@ -0,0 +1,83 @@ +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 ..types import UNSET, Unset + +T = TypeVar("T", bound="CreatePublishListRequest") + + +@_attrs_define +class CreatePublishListRequest: + """ + Attributes: + name (str): List name + description (None | str | Unset): Optional description + """ + + name: str + description: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if description is not UNSET: + field_dict["description"] = description + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + create_publish_list_request = cls( + name=name, + description=description, + ) + + create_publish_list_request.additional_properties = d + return create_publish_list_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/ledger_entity_response.py b/robosystems_client/models/ledger_entity_response.py index 2c2d4aa..280463a 100644 --- a/robosystems_client/models/ledger_entity_response.py +++ b/robosystems_client/models/ledger_entity_response.py @@ -39,6 +39,7 @@ class LedgerEntityResponse: parent_entity_id (None | str | Unset): source (str | Unset): Default: 'native'. source_id (None | str | Unset): + source_graph_id (None | str | Unset): connection_id (None | str | Unset): address_line1 (None | str | Unset): address_city (None | str | Unset): @@ -72,6 +73,7 @@ class LedgerEntityResponse: parent_entity_id: None | str | Unset = UNSET source: str | Unset = "native" source_id: None | str | Unset = UNSET + source_graph_id: None | str | Unset = UNSET connection_id: None | str | Unset = UNSET address_line1: None | str | Unset = UNSET address_city: None | str | Unset = UNSET @@ -201,6 +203,12 @@ def to_dict(self) -> dict[str, Any]: else: source_id = self.source_id + source_graph_id: None | str | Unset + if isinstance(self.source_graph_id, Unset): + source_graph_id = UNSET + else: + source_graph_id = self.source_graph_id + connection_id: None | str | Unset if isinstance(self.connection_id, Unset): connection_id = UNSET @@ -299,6 +307,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["source"] = source if source_id is not UNSET: field_dict["source_id"] = source_id + if source_graph_id is not UNSET: + field_dict["source_graph_id"] = source_graph_id if connection_id is not UNSET: field_dict["connection_id"] = connection_id if address_line1 is not UNSET: @@ -495,6 +505,15 @@ def _parse_source_id(data: object) -> None | str | Unset: source_id = _parse_source_id(d.pop("source_id", UNSET)) + def _parse_source_graph_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_graph_id = _parse_source_graph_id(d.pop("source_graph_id", UNSET)) + def _parse_connection_id(data: object) -> None | str | Unset: if data is None: return data @@ -593,6 +612,7 @@ def _parse_updated_at(data: object) -> None | str | Unset: parent_entity_id=parent_entity_id, source=source, source_id=source_id, + source_graph_id=source_graph_id, connection_id=connection_id, address_line1=address_line1, address_city=address_city, diff --git a/robosystems_client/models/publish_list_detail_response.py b/robosystems_client/models/publish_list_detail_response.py new file mode 100644 index 0000000..66bd6ba --- /dev/null +++ b/robosystems_client/models/publish_list_detail_response.py @@ -0,0 +1,154 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, 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 + +if TYPE_CHECKING: + from ..models.publish_list_member_response import PublishListMemberResponse + + +T = TypeVar("T", bound="PublishListDetailResponse") + + +@_attrs_define +class PublishListDetailResponse: + """Full detail including members. + + Attributes: + id (str): + name (str): + created_by (str): + created_at (datetime.datetime): + updated_at (datetime.datetime): + description (None | str | Unset): + member_count (int | Unset): Default: 0. + members (list[PublishListMemberResponse] | Unset): + """ + + id: str + name: str + created_by: str + created_at: datetime.datetime + updated_at: datetime.datetime + description: None | str | Unset = UNSET + member_count: int | Unset = 0 + members: list[PublishListMemberResponse] | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + name = self.name + + created_by = self.created_by + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + member_count = self.member_count + + members: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.members, Unset): + members = [] + for members_item_data in self.members: + members_item = members_item_data.to_dict() + members.append(members_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "created_by": created_by, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if description is not UNSET: + field_dict["description"] = description + if member_count is not UNSET: + field_dict["member_count"] = member_count + if members is not UNSET: + field_dict["members"] = members + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.publish_list_member_response import PublishListMemberResponse + + d = dict(src_dict) + id = d.pop("id") + + name = d.pop("name") + + created_by = d.pop("created_by") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + member_count = d.pop("member_count", UNSET) + + _members = d.pop("members", UNSET) + members: list[PublishListMemberResponse] | Unset = UNSET + if _members is not UNSET: + members = [] + for members_item_data in _members: + members_item = PublishListMemberResponse.from_dict(members_item_data) + + members.append(members_item) + + publish_list_detail_response = cls( + id=id, + name=name, + created_by=created_by, + created_at=created_at, + updated_at=updated_at, + description=description, + member_count=member_count, + members=members, + ) + + publish_list_detail_response.additional_properties = d + return publish_list_detail_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/publish_list_list_response.py b/robosystems_client/models/publish_list_list_response.py new file mode 100644 index 0000000..7ca9a2a --- /dev/null +++ b/robosystems_client/models/publish_list_list_response.py @@ -0,0 +1,86 @@ +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.pagination_info import PaginationInfo + from ..models.publish_list_response import PublishListResponse + + +T = TypeVar("T", bound="PublishListListResponse") + + +@_attrs_define +class PublishListListResponse: + """ + Attributes: + publish_lists (list[PublishListResponse]): + pagination (PaginationInfo): Pagination information for list responses. Example: {'has_more': True, 'limit': 20, + 'offset': 0, 'total': 100}. + """ + + publish_lists: list[PublishListResponse] + pagination: PaginationInfo + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + publish_lists = [] + for publish_lists_item_data in self.publish_lists: + publish_lists_item = publish_lists_item_data.to_dict() + publish_lists.append(publish_lists_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "publish_lists": publish_lists, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination_info import PaginationInfo + from ..models.publish_list_response import PublishListResponse + + d = dict(src_dict) + publish_lists = [] + _publish_lists = d.pop("publish_lists") + for publish_lists_item_data in _publish_lists: + publish_lists_item = PublishListResponse.from_dict(publish_lists_item_data) + + publish_lists.append(publish_lists_item) + + pagination = PaginationInfo.from_dict(d.pop("pagination")) + + publish_list_list_response = cls( + publish_lists=publish_lists, + pagination=pagination, + ) + + publish_list_list_response.additional_properties = d + return publish_list_list_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/publish_list_member_response.py b/robosystems_client/models/publish_list_member_response.py new file mode 100644 index 0000000..1ce8174 --- /dev/null +++ b/robosystems_client/models/publish_list_member_response.py @@ -0,0 +1,129 @@ +from __future__ import annotations + +import datetime +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 dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PublishListMemberResponse") + + +@_attrs_define +class PublishListMemberResponse: + """ + Attributes: + id (str): + target_graph_id (str): + added_by (str): + added_at (datetime.datetime): + target_graph_name (None | str | Unset): + target_org_name (None | str | Unset): + """ + + id: str + target_graph_id: str + added_by: str + added_at: datetime.datetime + target_graph_name: None | str | Unset = UNSET + target_org_name: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + target_graph_id = self.target_graph_id + + added_by = self.added_by + + added_at = self.added_at.isoformat() + + target_graph_name: None | str | Unset + if isinstance(self.target_graph_name, Unset): + target_graph_name = UNSET + else: + target_graph_name = self.target_graph_name + + target_org_name: None | str | Unset + if isinstance(self.target_org_name, Unset): + target_org_name = UNSET + else: + target_org_name = self.target_org_name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "target_graph_id": target_graph_id, + "added_by": added_by, + "added_at": added_at, + } + ) + if target_graph_name is not UNSET: + field_dict["target_graph_name"] = target_graph_name + if target_org_name is not UNSET: + field_dict["target_org_name"] = target_org_name + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = d.pop("id") + + target_graph_id = d.pop("target_graph_id") + + added_by = d.pop("added_by") + + added_at = isoparse(d.pop("added_at")) + + def _parse_target_graph_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + target_graph_name = _parse_target_graph_name(d.pop("target_graph_name", UNSET)) + + def _parse_target_org_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + target_org_name = _parse_target_org_name(d.pop("target_org_name", UNSET)) + + publish_list_member_response = cls( + id=id, + target_graph_id=target_graph_id, + added_by=added_by, + added_at=added_at, + target_graph_name=target_graph_name, + target_org_name=target_org_name, + ) + + publish_list_member_response.additional_properties = d + return publish_list_member_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/publish_list_response.py b/robosystems_client/models/publish_list_response.py new file mode 100644 index 0000000..c8d9cf8 --- /dev/null +++ b/robosystems_client/models/publish_list_response.py @@ -0,0 +1,126 @@ +from __future__ import annotations + +import datetime +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 dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PublishListResponse") + + +@_attrs_define +class PublishListResponse: + """ + Attributes: + id (str): + name (str): + created_by (str): + created_at (datetime.datetime): + updated_at (datetime.datetime): + description (None | str | Unset): + member_count (int | Unset): Default: 0. + """ + + id: str + name: str + created_by: str + created_at: datetime.datetime + updated_at: datetime.datetime + description: None | str | Unset = UNSET + member_count: int | Unset = 0 + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + name = self.name + + created_by = self.created_by + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + member_count = self.member_count + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "created_by": created_by, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if description is not UNSET: + field_dict["description"] = description + if member_count is not UNSET: + field_dict["member_count"] = member_count + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = d.pop("id") + + name = d.pop("name") + + created_by = d.pop("created_by") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + member_count = d.pop("member_count", UNSET) + + publish_list_response = cls( + id=id, + name=name, + created_by=created_by, + created_at=created_at, + updated_at=updated_at, + description=description, + member_count=member_count, + ) + + publish_list_response.additional_properties = d + return publish_list_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/report_response.py b/robosystems_client/models/report_response.py index 85c7eb9..bf91897 100644 --- a/robosystems_client/models/report_response.py +++ b/robosystems_client/models/report_response.py @@ -35,6 +35,7 @@ class ReportResponse: ai_generated (bool | Unset): Default: False. last_generated (datetime.datetime | None | Unset): structures (list[StructureSummary] | Unset): + entity_name (None | str | Unset): source_graph_id (None | str | Unset): source_report_id (None | str | Unset): shared_at (datetime.datetime | None | Unset): @@ -53,6 +54,7 @@ class ReportResponse: ai_generated: bool | Unset = False last_generated: datetime.datetime | None | Unset = UNSET structures: list[StructureSummary] | Unset = UNSET + entity_name: None | str | Unset = UNSET source_graph_id: None | str | Unset = UNSET source_report_id: None | str | Unset = UNSET shared_at: datetime.datetime | None | Unset = UNSET @@ -112,6 +114,12 @@ def to_dict(self) -> dict[str, Any]: structures_item = structures_item_data.to_dict() structures.append(structures_item) + entity_name: None | str | Unset + if isinstance(self.entity_name, Unset): + entity_name = UNSET + else: + entity_name = self.entity_name + source_graph_id: None | str | Unset if isinstance(self.source_graph_id, Unset): source_graph_id = UNSET @@ -157,6 +165,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["last_generated"] = last_generated if structures is not UNSET: field_dict["structures"] = structures + if entity_name is not UNSET: + field_dict["entity_name"] = entity_name if source_graph_id is not UNSET: field_dict["source_graph_id"] = source_graph_id if source_report_id is not UNSET: @@ -256,6 +266,15 @@ def _parse_last_generated(data: object) -> datetime.datetime | None | Unset: structures.append(structures_item) + def _parse_entity_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + entity_name = _parse_entity_name(d.pop("entity_name", UNSET)) + def _parse_source_graph_id(data: object) -> None | str | Unset: if data is None: return data @@ -305,6 +324,7 @@ def _parse_shared_at(data: object) -> datetime.datetime | None | Unset: ai_generated=ai_generated, last_generated=last_generated, structures=structures, + entity_name=entity_name, source_graph_id=source_graph_id, source_report_id=source_report_id, shared_at=shared_at, diff --git a/robosystems_client/models/security_response.py b/robosystems_client/models/security_response.py index 5a6c1fc..78be367 100644 --- a/robosystems_client/models/security_response.py +++ b/robosystems_client/models/security_response.py @@ -30,6 +30,7 @@ class SecurityResponse: updated_at (datetime.datetime): entity_id (None | str | Unset): entity_name (None | str | Unset): + source_graph_id (None | str | Unset): security_subtype (None | str | Unset): authorized_shares (int | None | Unset): outstanding_shares (int | None | Unset): @@ -44,6 +45,7 @@ class SecurityResponse: updated_at: datetime.datetime entity_id: None | str | Unset = UNSET entity_name: None | str | Unset = UNSET + source_graph_id: None | str | Unset = UNSET security_subtype: None | str | Unset = UNSET authorized_shares: int | None | Unset = UNSET outstanding_shares: int | None | Unset = UNSET @@ -76,6 +78,12 @@ def to_dict(self) -> dict[str, Any]: else: entity_name = self.entity_name + source_graph_id: None | str | Unset + if isinstance(self.source_graph_id, Unset): + source_graph_id = UNSET + else: + source_graph_id = self.source_graph_id + security_subtype: None | str | Unset if isinstance(self.security_subtype, Unset): security_subtype = UNSET @@ -111,6 +119,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["entity_id"] = entity_id if entity_name is not UNSET: field_dict["entity_name"] = entity_name + if source_graph_id is not UNSET: + field_dict["source_graph_id"] = source_graph_id if security_subtype is not UNSET: field_dict["security_subtype"] = security_subtype if authorized_shares is not UNSET: @@ -157,6 +167,15 @@ def _parse_entity_name(data: object) -> None | str | Unset: entity_name = _parse_entity_name(d.pop("entity_name", UNSET)) + def _parse_source_graph_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_graph_id = _parse_source_graph_id(d.pop("source_graph_id", UNSET)) + def _parse_security_subtype(data: object) -> None | str | Unset: if data is None: return data @@ -194,6 +213,7 @@ def _parse_outstanding_shares(data: object) -> int | None | Unset: updated_at=updated_at, entity_id=entity_id, entity_name=entity_name, + source_graph_id=source_graph_id, security_subtype=security_subtype, authorized_shares=authorized_shares, outstanding_shares=outstanding_shares, diff --git a/robosystems_client/models/share_report_request.py b/robosystems_client/models/share_report_request.py index 09daa39..910d99d 100644 --- a/robosystems_client/models/share_report_request.py +++ b/robosystems_client/models/share_report_request.py @@ -1,7 +1,7 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,20 +13,20 @@ class ShareReportRequest: """ Attributes: - target_graph_ids (list[str]): Graph IDs to share the report to + publish_list_id (str): Publish list to share the report to """ - target_graph_ids: list[str] + publish_list_id: str additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - target_graph_ids = self.target_graph_ids + publish_list_id = self.publish_list_id field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { - "target_graph_ids": target_graph_ids, + "publish_list_id": publish_list_id, } ) @@ -35,10 +35,10 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - target_graph_ids = cast(list[str], d.pop("target_graph_ids")) + publish_list_id = d.pop("publish_list_id") share_report_request = cls( - target_graph_ids=target_graph_ids, + publish_list_id=publish_list_id, ) share_report_request.additional_properties = d diff --git a/robosystems_client/models/update_publish_list_request.py b/robosystems_client/models/update_publish_list_request.py new file mode 100644 index 0000000..4ba6d1f --- /dev/null +++ b/robosystems_client/models/update_publish_list_request.py @@ -0,0 +1,93 @@ +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 ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdatePublishListRequest") + + +@_attrs_define +class UpdatePublishListRequest: + """ + Attributes: + name (None | str | Unset): + description (None | str | Unset): + """ + + name: None | str | Unset = UNSET + description: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if name is not UNSET: + field_dict["name"] = name + if description is not UNSET: + field_dict["description"] = description + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + update_publish_list_request = cls( + name=name, + description=description, + ) + + update_publish_list_request.additional_properties = d + return update_publish_list_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/update_security_request.py b/robosystems_client/models/update_security_request.py index 52369dd..4c49309 100644 --- a/robosystems_client/models/update_security_request.py +++ b/robosystems_client/models/update_security_request.py @@ -21,6 +21,8 @@ class UpdateSecurityRequest: """ Attributes: + entity_id (None | str | Unset): + source_graph_id (None | str | Unset): name (None | str | Unset): security_type (None | str | Unset): security_subtype (None | str | Unset): @@ -30,6 +32,8 @@ class UpdateSecurityRequest: outstanding_shares (int | None | Unset): """ + entity_id: None | str | Unset = UNSET + source_graph_id: None | str | Unset = UNSET name: None | str | Unset = UNSET security_type: None | str | Unset = UNSET security_subtype: None | str | Unset = UNSET @@ -44,6 +48,18 @@ def to_dict(self) -> dict[str, Any]: UpdateSecurityRequestTermsType0, ) + entity_id: None | str | Unset + if isinstance(self.entity_id, Unset): + entity_id = UNSET + else: + entity_id = self.entity_id + + source_graph_id: None | str | Unset + if isinstance(self.source_graph_id, Unset): + source_graph_id = UNSET + else: + source_graph_id = self.source_graph_id + name: None | str | Unset if isinstance(self.name, Unset): name = UNSET @@ -91,6 +107,10 @@ def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) + if entity_id is not UNSET: + field_dict["entity_id"] = entity_id + if source_graph_id is not UNSET: + field_dict["source_graph_id"] = source_graph_id if name is not UNSET: field_dict["name"] = name if security_type is not UNSET: @@ -116,6 +136,24 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) + def _parse_entity_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + entity_id = _parse_entity_id(d.pop("entity_id", UNSET)) + + def _parse_source_graph_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_graph_id = _parse_source_graph_id(d.pop("source_graph_id", UNSET)) + def _parse_name(data: object) -> None | str | Unset: if data is None: return data @@ -188,6 +226,8 @@ def _parse_outstanding_shares(data: object) -> int | None | Unset: outstanding_shares = _parse_outstanding_shares(d.pop("outstanding_shares", UNSET)) update_security_request = cls( + entity_id=entity_id, + source_graph_id=source_graph_id, name=name, security_type=security_type, security_subtype=security_subtype,