Skip to content

Commit cf69365

Browse files
authored
Regenerate code from OpenAPI spec (#145)
The main changes are - Health endpoint - Progress info from task status endpoint
1 parent f7ec9ab commit cf69365

14 files changed

Lines changed: 423 additions & 20 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
from http import HTTPStatus
2+
from typing import Any
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.health_response import HealthResponse
9+
from ...types import Response
10+
11+
12+
def _get_kwargs() -> dict[str, Any]:
13+
_kwargs: dict[str, Any] = {
14+
"method": "get",
15+
"url": "/health",
16+
}
17+
18+
return _kwargs
19+
20+
21+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> HealthResponse | None:
22+
if response.status_code == 200:
23+
response_200 = HealthResponse.from_dict(response.json())
24+
25+
return response_200
26+
27+
if client.raise_on_unexpected_status:
28+
raise errors.UnexpectedStatus(response.status_code, response.content)
29+
else:
30+
return None
31+
32+
33+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[HealthResponse]:
34+
return Response(
35+
status_code=HTTPStatus(response.status_code),
36+
content=response.content,
37+
headers=response.headers,
38+
parsed=_parse_response(client=client, response=response),
39+
)
40+
41+
42+
def sync_detailed(
43+
*,
44+
client: AuthenticatedClient | Client,
45+
) -> Response[HealthResponse]:
46+
"""Health
47+
48+
Raises:
49+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
50+
httpx.TimeoutException: If the request takes longer than Client.timeout.
51+
52+
Returns:
53+
Response[HealthResponse]
54+
"""
55+
56+
kwargs = _get_kwargs()
57+
58+
response = client.get_httpx_client().request(
59+
**kwargs,
60+
)
61+
62+
return _build_response(client=client, response=response)
63+
64+
65+
def sync(
66+
*,
67+
client: AuthenticatedClient | Client,
68+
) -> HealthResponse | None:
69+
"""Health
70+
71+
Raises:
72+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
73+
httpx.TimeoutException: If the request takes longer than Client.timeout.
74+
75+
Returns:
76+
HealthResponse
77+
"""
78+
79+
return sync_detailed(
80+
client=client,
81+
).parsed
82+
83+
84+
async def asyncio_detailed(
85+
*,
86+
client: AuthenticatedClient | Client,
87+
) -> Response[HealthResponse]:
88+
"""Health
89+
90+
Raises:
91+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92+
httpx.TimeoutException: If the request takes longer than Client.timeout.
93+
94+
Returns:
95+
Response[HealthResponse]
96+
"""
97+
98+
kwargs = _get_kwargs()
99+
100+
response = await client.get_async_httpx_client().request(**kwargs)
101+
102+
return _build_response(client=client, response=response)
103+
104+
105+
async def asyncio(
106+
*,
107+
client: AuthenticatedClient | Client,
108+
) -> HealthResponse | None:
109+
"""Health
110+
111+
Raises:
112+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113+
httpx.TimeoutException: If the request takes longer than Client.timeout.
114+
115+
Returns:
116+
HealthResponse
117+
"""
118+
119+
return (
120+
await asyncio_detailed(
121+
client=client,
122+
)
123+
).parsed

src/everyrow/generated/api/operations/agent_map_operations_agent_map_post.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
from ...models.error_response import ErrorResponse
1010
from ...models.insufficient_balance_error import InsufficientBalanceError
1111
from ...models.operation_response import OperationResponse
12-
from ...types import Response
12+
from ...types import UNSET, Response, Unset
1313

1414

1515
def _get_kwargs(
1616
*,
1717
body: AgentMapOperation,
18+
x_cohort_source: None | str | Unset = UNSET,
1819
) -> dict[str, Any]:
1920
headers: dict[str, Any] = {}
21+
if not isinstance(x_cohort_source, Unset):
22+
headers["X-Cohort-Source"] = x_cohort_source
2023

2124
_kwargs: dict[str, Any] = {
2225
"method": "post",
@@ -70,6 +73,7 @@ def sync_detailed(
7073
*,
7174
client: AuthenticatedClient,
7275
body: AgentMapOperation,
76+
x_cohort_source: None | str | Unset = UNSET,
7377
) -> Response[ErrorResponse | InsufficientBalanceError | OperationResponse]:
7478
"""Parallel AI research agents
7579
@@ -82,6 +86,7 @@ def sync_detailed(
8286
`include_research`
8387
8488
Args:
89+
x_cohort_source (None | str | Unset):
8590
body (AgentMapOperation):
8691
8792
Raises:
@@ -94,6 +99,7 @@ def sync_detailed(
9499

95100
kwargs = _get_kwargs(
96101
body=body,
102+
x_cohort_source=x_cohort_source,
97103
)
98104

99105
response = client.get_httpx_client().request(
@@ -107,6 +113,7 @@ def sync(
107113
*,
108114
client: AuthenticatedClient,
109115
body: AgentMapOperation,
116+
x_cohort_source: None | str | Unset = UNSET,
110117
) -> ErrorResponse | InsufficientBalanceError | OperationResponse | None:
111118
"""Parallel AI research agents
112119
@@ -119,6 +126,7 @@ def sync(
119126
`include_research`
120127
121128
Args:
129+
x_cohort_source (None | str | Unset):
122130
body (AgentMapOperation):
123131
124132
Raises:
@@ -132,13 +140,15 @@ def sync(
132140
return sync_detailed(
133141
client=client,
134142
body=body,
143+
x_cohort_source=x_cohort_source,
135144
).parsed
136145

137146

138147
async def asyncio_detailed(
139148
*,
140149
client: AuthenticatedClient,
141150
body: AgentMapOperation,
151+
x_cohort_source: None | str | Unset = UNSET,
142152
) -> Response[ErrorResponse | InsufficientBalanceError | OperationResponse]:
143153
"""Parallel AI research agents
144154
@@ -151,6 +161,7 @@ async def asyncio_detailed(
151161
`include_research`
152162
153163
Args:
164+
x_cohort_source (None | str | Unset):
154165
body (AgentMapOperation):
155166
156167
Raises:
@@ -163,6 +174,7 @@ async def asyncio_detailed(
163174

164175
kwargs = _get_kwargs(
165176
body=body,
177+
x_cohort_source=x_cohort_source,
166178
)
167179

168180
response = await client.get_async_httpx_client().request(**kwargs)
@@ -174,6 +186,7 @@ async def asyncio(
174186
*,
175187
client: AuthenticatedClient,
176188
body: AgentMapOperation,
189+
x_cohort_source: None | str | Unset = UNSET,
177190
) -> ErrorResponse | InsufficientBalanceError | OperationResponse | None:
178191
"""Parallel AI research agents
179192
@@ -186,6 +199,7 @@ async def asyncio(
186199
`include_research`
187200
188201
Args:
202+
x_cohort_source (None | str | Unset):
189203
body (AgentMapOperation):
190204
191205
Raises:
@@ -200,5 +214,6 @@ async def asyncio(
200214
await asyncio_detailed(
201215
client=client,
202216
body=body,
217+
x_cohort_source=x_cohort_source,
203218
)
204219
).parsed

src/everyrow/generated/api/operations/dedupe_operations_dedupe_post.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
from ...models.error_response import ErrorResponse
1010
from ...models.insufficient_balance_error import InsufficientBalanceError
1111
from ...models.operation_response import OperationResponse
12-
from ...types import Response
12+
from ...types import UNSET, Response, Unset
1313

1414

1515
def _get_kwargs(
1616
*,
1717
body: DedupeOperation,
18+
x_cohort_source: None | str | Unset = UNSET,
1819
) -> dict[str, Any]:
1920
headers: dict[str, Any] = {}
21+
if not isinstance(x_cohort_source, Unset):
22+
headers["X-Cohort-Source"] = x_cohort_source
2023

2124
_kwargs: dict[str, Any] = {
2225
"method": "post",
@@ -70,12 +73,14 @@ def sync_detailed(
7073
*,
7174
client: AuthenticatedClient,
7275
body: DedupeOperation,
76+
x_cohort_source: None | str | Unset = UNSET,
7377
) -> Response[ErrorResponse | InsufficientBalanceError | OperationResponse]:
7478
"""AI-powered deduplication
7579
7680
Use AI to identify and remove duplicate rows based on the equivalence relation.
7781
7882
Args:
83+
x_cohort_source (None | str | Unset):
7984
body (DedupeOperation):
8085
8186
Raises:
@@ -88,6 +93,7 @@ def sync_detailed(
8893

8994
kwargs = _get_kwargs(
9095
body=body,
96+
x_cohort_source=x_cohort_source,
9197
)
9298

9399
response = client.get_httpx_client().request(
@@ -101,12 +107,14 @@ def sync(
101107
*,
102108
client: AuthenticatedClient,
103109
body: DedupeOperation,
110+
x_cohort_source: None | str | Unset = UNSET,
104111
) -> ErrorResponse | InsufficientBalanceError | OperationResponse | None:
105112
"""AI-powered deduplication
106113
107114
Use AI to identify and remove duplicate rows based on the equivalence relation.
108115
109116
Args:
117+
x_cohort_source (None | str | Unset):
110118
body (DedupeOperation):
111119
112120
Raises:
@@ -120,19 +128,22 @@ def sync(
120128
return sync_detailed(
121129
client=client,
122130
body=body,
131+
x_cohort_source=x_cohort_source,
123132
).parsed
124133

125134

126135
async def asyncio_detailed(
127136
*,
128137
client: AuthenticatedClient,
129138
body: DedupeOperation,
139+
x_cohort_source: None | str | Unset = UNSET,
130140
) -> Response[ErrorResponse | InsufficientBalanceError | OperationResponse]:
131141
"""AI-powered deduplication
132142
133143
Use AI to identify and remove duplicate rows based on the equivalence relation.
134144
135145
Args:
146+
x_cohort_source (None | str | Unset):
136147
body (DedupeOperation):
137148
138149
Raises:
@@ -145,6 +156,7 @@ async def asyncio_detailed(
145156

146157
kwargs = _get_kwargs(
147158
body=body,
159+
x_cohort_source=x_cohort_source,
148160
)
149161

150162
response = await client.get_async_httpx_client().request(**kwargs)
@@ -156,12 +168,14 @@ async def asyncio(
156168
*,
157169
client: AuthenticatedClient,
158170
body: DedupeOperation,
171+
x_cohort_source: None | str | Unset = UNSET,
159172
) -> ErrorResponse | InsufficientBalanceError | OperationResponse | None:
160173
"""AI-powered deduplication
161174
162175
Use AI to identify and remove duplicate rows based on the equivalence relation.
163176
164177
Args:
178+
x_cohort_source (None | str | Unset):
165179
body (DedupeOperation):
166180
167181
Raises:
@@ -176,5 +190,6 @@ async def asyncio(
176190
await asyncio_detailed(
177191
client=client,
178192
body=body,
193+
x_cohort_source=x_cohort_source,
179194
)
180195
).parsed

0 commit comments

Comments
 (0)