Skip to content

Commit 801efdd

Browse files
committed
Add GraphQL API endpoints for extensions in RoboInvestor
- Introduced new modules for handling HTTP GET and POST requests to the GraphQL API for extensions, allowing users to interact with the API for specific graph IDs. - Implemented functions for synchronous and asynchronous operations, including detailed response handling and error management. - Added operations for creating, updating, and deleting portfolios, positions, and securities, enhancing the RoboInvestor's capabilities for managing investment data. - Created initial files for GraphQL endpoint functions, ensuring a structured approach to API interactions. These changes expand the functionality of the RoboInvestor API, providing comprehensive support for investment operations.
1 parent ce3d07e commit 801efdd

192 files changed

Lines changed: 7378 additions & 22340 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

robosystems_client/api/ledger/delete_publish_list.py renamed to robosystems_client/api/extensions_graph_ql/handle_http_get_extensions_graph_id_graphql_get.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212

1313
def _get_kwargs(
1414
graph_id: str,
15-
list_id: str,
1615
) -> dict[str, Any]:
1716
_kwargs: dict[str, Any] = {
18-
"method": "delete",
19-
"url": "/v1/ledger/{graph_id}/publish-lists/{list_id}".format(
17+
"method": "get",
18+
"url": "/extensions/{graph_id}/graphql".format(
2019
graph_id=quote(str(graph_id), safe=""),
21-
list_id=quote(str(list_id), safe=""),
2220
),
2321
}
2422

@@ -28,9 +26,13 @@ def _get_kwargs(
2826
def _parse_response(
2927
*, client: AuthenticatedClient | Client, response: httpx.Response
3028
) -> Any | HTTPValidationError | None:
31-
if response.status_code == 204:
32-
response_204 = cast(Any, None)
33-
return response_204
29+
if response.status_code == 200:
30+
response_200 = response.json()
31+
return response_200
32+
33+
if response.status_code == 404:
34+
response_404 = cast(Any, None)
35+
return response_404
3436

3537
if response.status_code == 422:
3638
response_422 = HTTPValidationError.from_dict(response.json())
@@ -56,15 +58,13 @@ def _build_response(
5658

5759
def sync_detailed(
5860
graph_id: str,
59-
list_id: str,
6061
*,
6162
client: AuthenticatedClient,
6263
) -> Response[Any | HTTPValidationError]:
63-
"""Delete Publish List
64+
"""Handle Http Get
6465
6566
Args:
6667
graph_id (str):
67-
list_id (str):
6868
6969
Raises:
7070
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -76,7 +76,6 @@ def sync_detailed(
7676

7777
kwargs = _get_kwargs(
7878
graph_id=graph_id,
79-
list_id=list_id,
8079
)
8180

8281
response = client.get_httpx_client().request(
@@ -88,15 +87,13 @@ def sync_detailed(
8887

8988
def sync(
9089
graph_id: str,
91-
list_id: str,
9290
*,
9391
client: AuthenticatedClient,
9492
) -> Any | HTTPValidationError | None:
95-
"""Delete Publish List
93+
"""Handle Http Get
9694
9795
Args:
9896
graph_id (str):
99-
list_id (str):
10097
10198
Raises:
10299
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -108,22 +105,19 @@ def sync(
108105

109106
return sync_detailed(
110107
graph_id=graph_id,
111-
list_id=list_id,
112108
client=client,
113109
).parsed
114110

115111

116112
async def asyncio_detailed(
117113
graph_id: str,
118-
list_id: str,
119114
*,
120115
client: AuthenticatedClient,
121116
) -> Response[Any | HTTPValidationError]:
122-
"""Delete Publish List
117+
"""Handle Http Get
123118
124119
Args:
125120
graph_id (str):
126-
list_id (str):
127121
128122
Raises:
129123
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -135,7 +129,6 @@ async def asyncio_detailed(
135129

136130
kwargs = _get_kwargs(
137131
graph_id=graph_id,
138-
list_id=list_id,
139132
)
140133

141134
response = await client.get_async_httpx_client().request(**kwargs)
@@ -145,15 +138,13 @@ async def asyncio_detailed(
145138

146139
async def asyncio(
147140
graph_id: str,
148-
list_id: str,
149141
*,
150142
client: AuthenticatedClient,
151143
) -> Any | HTTPValidationError | None:
152-
"""Delete Publish List
144+
"""Handle Http Get
153145
154146
Args:
155147
graph_id (str):
156-
list_id (str):
157148
158149
Raises:
159150
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -166,7 +157,6 @@ async def asyncio(
166157
return (
167158
await asyncio_detailed(
168159
graph_id=graph_id,
169-
list_id=list_id,
170160
client=client,
171161
)
172162
).parsed

robosystems_client/api/investor/delete_position.py renamed to robosystems_client/api/extensions_graph_ql/handle_http_post_extensions_graph_id_graphql_post.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, cast
2+
from typing import Any
33
from urllib.parse import quote
44

55
import httpx
@@ -12,13 +12,11 @@
1212

1313
def _get_kwargs(
1414
graph_id: str,
15-
position_id: str,
1615
) -> dict[str, Any]:
1716
_kwargs: dict[str, Any] = {
18-
"method": "delete",
19-
"url": "/v1/investor/{graph_id}/positions/{position_id}".format(
17+
"method": "post",
18+
"url": "/extensions/{graph_id}/graphql".format(
2019
graph_id=quote(str(graph_id), safe=""),
21-
position_id=quote(str(position_id), safe=""),
2220
),
2321
}
2422

@@ -28,9 +26,9 @@ def _get_kwargs(
2826
def _parse_response(
2927
*, client: AuthenticatedClient | Client, response: httpx.Response
3028
) -> Any | HTTPValidationError | None:
31-
if response.status_code == 204:
32-
response_204 = cast(Any, None)
33-
return response_204
29+
if response.status_code == 200:
30+
response_200 = response.json()
31+
return response_200
3432

3533
if response.status_code == 422:
3634
response_422 = HTTPValidationError.from_dict(response.json())
@@ -56,15 +54,13 @@ def _build_response(
5654

5755
def sync_detailed(
5856
graph_id: str,
59-
position_id: str,
6057
*,
6158
client: AuthenticatedClient,
6259
) -> Response[Any | HTTPValidationError]:
63-
"""Delete Position
60+
"""Handle Http Post
6461
6562
Args:
6663
graph_id (str):
67-
position_id (str):
6864
6965
Raises:
7066
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -76,7 +72,6 @@ def sync_detailed(
7672

7773
kwargs = _get_kwargs(
7874
graph_id=graph_id,
79-
position_id=position_id,
8075
)
8176

8277
response = client.get_httpx_client().request(
@@ -88,15 +83,13 @@ def sync_detailed(
8883

8984
def sync(
9085
graph_id: str,
91-
position_id: str,
9286
*,
9387
client: AuthenticatedClient,
9488
) -> Any | HTTPValidationError | None:
95-
"""Delete Position
89+
"""Handle Http Post
9690
9791
Args:
9892
graph_id (str):
99-
position_id (str):
10093
10194
Raises:
10295
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -108,22 +101,19 @@ def sync(
108101

109102
return sync_detailed(
110103
graph_id=graph_id,
111-
position_id=position_id,
112104
client=client,
113105
).parsed
114106

115107

116108
async def asyncio_detailed(
117109
graph_id: str,
118-
position_id: str,
119110
*,
120111
client: AuthenticatedClient,
121112
) -> Response[Any | HTTPValidationError]:
122-
"""Delete Position
113+
"""Handle Http Post
123114
124115
Args:
125116
graph_id (str):
126-
position_id (str):
127117
128118
Raises:
129119
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -135,7 +125,6 @@ async def asyncio_detailed(
135125

136126
kwargs = _get_kwargs(
137127
graph_id=graph_id,
138-
position_id=position_id,
139128
)
140129

141130
response = await client.get_async_httpx_client().request(**kwargs)
@@ -145,15 +134,13 @@ async def asyncio_detailed(
145134

146135
async def asyncio(
147136
graph_id: str,
148-
position_id: str,
149137
*,
150138
client: AuthenticatedClient,
151139
) -> Any | HTTPValidationError | None:
152-
"""Delete Position
140+
"""Handle Http Post
153141
154142
Args:
155143
graph_id (str):
156-
position_id (str):
157144
158145
Raises:
159146
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -166,7 +153,6 @@ async def asyncio(
166153
return (
167154
await asyncio_detailed(
168155
graph_id=graph_id,
169-
position_id=position_id,
170156
client=client,
171157
)
172158
).parsed
File renamed without changes.

0 commit comments

Comments
 (0)