Skip to content

Commit 24910e9

Browse files
committed
Add new models and fields for closing entries and search hits
- Introduced `AccountRollupGroup`, `AccountRollupRow`, and `AccountRollupsResponse` to the models. - Enhanced `ClosingEntryResponse` with a new `reversal` field to track reversal entries. - Updated `EntryTemplateRequest` to include an `auto_reverse` option for automatic reversing entries. - Added `reversal_entry_id` and `reversal_status` fields to `PeriodCloseItemResponse` for better tracking of entry reversals. - Included `parent_document_id` in `SearchHit` to associate search results with their parent documents. These changes improve the data model's capability to handle financial entries and enhance search functionalities.
1 parent 29c057e commit 24910e9

13 files changed

Lines changed: 1199 additions & 1 deletion
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
import datetime
2+
from http import HTTPStatus
3+
from typing import Any
4+
from urllib.parse import quote
5+
6+
import httpx
7+
8+
from ... import errors
9+
from ...client import AuthenticatedClient, Client
10+
from ...models.account_rollups_response import AccountRollupsResponse
11+
from ...models.http_validation_error import HTTPValidationError
12+
from ...types import UNSET, Response, Unset
13+
14+
15+
def _get_kwargs(
16+
graph_id: str,
17+
*,
18+
mapping_id: None | str | Unset = UNSET,
19+
start_date: datetime.date | None | Unset = UNSET,
20+
end_date: datetime.date | None | Unset = UNSET,
21+
) -> dict[str, Any]:
22+
params: dict[str, Any] = {}
23+
24+
json_mapping_id: None | str | Unset
25+
if isinstance(mapping_id, Unset):
26+
json_mapping_id = UNSET
27+
else:
28+
json_mapping_id = mapping_id
29+
params["mapping_id"] = json_mapping_id
30+
31+
json_start_date: None | str | Unset
32+
if isinstance(start_date, Unset):
33+
json_start_date = UNSET
34+
elif isinstance(start_date, datetime.date):
35+
json_start_date = start_date.isoformat()
36+
else:
37+
json_start_date = start_date
38+
params["start_date"] = json_start_date
39+
40+
json_end_date: None | str | Unset
41+
if isinstance(end_date, Unset):
42+
json_end_date = UNSET
43+
elif isinstance(end_date, datetime.date):
44+
json_end_date = end_date.isoformat()
45+
else:
46+
json_end_date = end_date
47+
params["end_date"] = json_end_date
48+
49+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
50+
51+
_kwargs: dict[str, Any] = {
52+
"method": "get",
53+
"url": "/v1/ledger/{graph_id}/account-rollups".format(
54+
graph_id=quote(str(graph_id), safe=""),
55+
),
56+
"params": params,
57+
}
58+
59+
return _kwargs
60+
61+
62+
def _parse_response(
63+
*, client: AuthenticatedClient | Client, response: httpx.Response
64+
) -> AccountRollupsResponse | HTTPValidationError | None:
65+
if response.status_code == 200:
66+
response_200 = AccountRollupsResponse.from_dict(response.json())
67+
68+
return response_200
69+
70+
if response.status_code == 422:
71+
response_422 = HTTPValidationError.from_dict(response.json())
72+
73+
return response_422
74+
75+
if client.raise_on_unexpected_status:
76+
raise errors.UnexpectedStatus(response.status_code, response.content)
77+
else:
78+
return None
79+
80+
81+
def _build_response(
82+
*, client: AuthenticatedClient | Client, response: httpx.Response
83+
) -> Response[AccountRollupsResponse | HTTPValidationError]:
84+
return Response(
85+
status_code=HTTPStatus(response.status_code),
86+
content=response.content,
87+
headers=response.headers,
88+
parsed=_parse_response(client=client, response=response),
89+
)
90+
91+
92+
def sync_detailed(
93+
graph_id: str,
94+
*,
95+
client: AuthenticatedClient,
96+
mapping_id: None | str | Unset = UNSET,
97+
start_date: datetime.date | None | Unset = UNSET,
98+
end_date: datetime.date | None | Unset = UNSET,
99+
) -> Response[AccountRollupsResponse | HTTPValidationError]:
100+
"""Account Rollups
101+
102+
Account rollups — CoA accounts grouped by reporting element with balances.
103+
104+
Shows how company-specific accounts roll up to standardized reporting
105+
line items. Auto-discovers the mapping structure if mapping_id is not provided.
106+
107+
Args:
108+
graph_id (str):
109+
mapping_id (None | str | Unset): Mapping structure ID (auto-discovers if omitted)
110+
start_date (datetime.date | None | Unset): Start date (inclusive)
111+
end_date (datetime.date | None | Unset): End date (inclusive)
112+
113+
Raises:
114+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115+
httpx.TimeoutException: If the request takes longer than Client.timeout.
116+
117+
Returns:
118+
Response[AccountRollupsResponse | HTTPValidationError]
119+
"""
120+
121+
kwargs = _get_kwargs(
122+
graph_id=graph_id,
123+
mapping_id=mapping_id,
124+
start_date=start_date,
125+
end_date=end_date,
126+
)
127+
128+
response = client.get_httpx_client().request(
129+
**kwargs,
130+
)
131+
132+
return _build_response(client=client, response=response)
133+
134+
135+
def sync(
136+
graph_id: str,
137+
*,
138+
client: AuthenticatedClient,
139+
mapping_id: None | str | Unset = UNSET,
140+
start_date: datetime.date | None | Unset = UNSET,
141+
end_date: datetime.date | None | Unset = UNSET,
142+
) -> AccountRollupsResponse | HTTPValidationError | None:
143+
"""Account Rollups
144+
145+
Account rollups — CoA accounts grouped by reporting element with balances.
146+
147+
Shows how company-specific accounts roll up to standardized reporting
148+
line items. Auto-discovers the mapping structure if mapping_id is not provided.
149+
150+
Args:
151+
graph_id (str):
152+
mapping_id (None | str | Unset): Mapping structure ID (auto-discovers if omitted)
153+
start_date (datetime.date | None | Unset): Start date (inclusive)
154+
end_date (datetime.date | None | Unset): End date (inclusive)
155+
156+
Raises:
157+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
158+
httpx.TimeoutException: If the request takes longer than Client.timeout.
159+
160+
Returns:
161+
AccountRollupsResponse | HTTPValidationError
162+
"""
163+
164+
return sync_detailed(
165+
graph_id=graph_id,
166+
client=client,
167+
mapping_id=mapping_id,
168+
start_date=start_date,
169+
end_date=end_date,
170+
).parsed
171+
172+
173+
async def asyncio_detailed(
174+
graph_id: str,
175+
*,
176+
client: AuthenticatedClient,
177+
mapping_id: None | str | Unset = UNSET,
178+
start_date: datetime.date | None | Unset = UNSET,
179+
end_date: datetime.date | None | Unset = UNSET,
180+
) -> Response[AccountRollupsResponse | HTTPValidationError]:
181+
"""Account Rollups
182+
183+
Account rollups — CoA accounts grouped by reporting element with balances.
184+
185+
Shows how company-specific accounts roll up to standardized reporting
186+
line items. Auto-discovers the mapping structure if mapping_id is not provided.
187+
188+
Args:
189+
graph_id (str):
190+
mapping_id (None | str | Unset): Mapping structure ID (auto-discovers if omitted)
191+
start_date (datetime.date | None | Unset): Start date (inclusive)
192+
end_date (datetime.date | None | Unset): End date (inclusive)
193+
194+
Raises:
195+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
196+
httpx.TimeoutException: If the request takes longer than Client.timeout.
197+
198+
Returns:
199+
Response[AccountRollupsResponse | HTTPValidationError]
200+
"""
201+
202+
kwargs = _get_kwargs(
203+
graph_id=graph_id,
204+
mapping_id=mapping_id,
205+
start_date=start_date,
206+
end_date=end_date,
207+
)
208+
209+
response = await client.get_async_httpx_client().request(**kwargs)
210+
211+
return _build_response(client=client, response=response)
212+
213+
214+
async def asyncio(
215+
graph_id: str,
216+
*,
217+
client: AuthenticatedClient,
218+
mapping_id: None | str | Unset = UNSET,
219+
start_date: datetime.date | None | Unset = UNSET,
220+
end_date: datetime.date | None | Unset = UNSET,
221+
) -> AccountRollupsResponse | HTTPValidationError | None:
222+
"""Account Rollups
223+
224+
Account rollups — CoA accounts grouped by reporting element with balances.
225+
226+
Shows how company-specific accounts roll up to standardized reporting
227+
line items. Auto-discovers the mapping structure if mapping_id is not provided.
228+
229+
Args:
230+
graph_id (str):
231+
mapping_id (None | str | Unset): Mapping structure ID (auto-discovers if omitted)
232+
start_date (datetime.date | None | Unset): Start date (inclusive)
233+
end_date (datetime.date | None | Unset): End date (inclusive)
234+
235+
Raises:
236+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
237+
httpx.TimeoutException: If the request takes longer than Client.timeout.
238+
239+
Returns:
240+
AccountRollupsResponse | HTTPValidationError
241+
"""
242+
243+
return (
244+
await asyncio_detailed(
245+
graph_id=graph_id,
246+
client=client,
247+
mapping_id=mapping_id,
248+
start_date=start_date,
249+
end_date=end_date,
250+
)
251+
).parsed

0 commit comments

Comments
 (0)