Skip to content

Commit ded8e05

Browse files
authored
feat: consolidation proposals (#261)
## Summary Regenerates the SDK for C2, the consolidation engine: robosystems RoboFinSystems/robosystems#1853, RoboFinSystems/robosystems#1854 and RoboFinSystems/robosystems#1855. It was generated against the local stack running `main` after those three merged. This is a client minor; the version moves at publish. The TypeScript twin is RoboFinSystems/robosystems-typescript-client#277. ## Changes - **Generated tier**: - New operations and their models: - `preview-consolidation-entries`: computes the entries a month needs and posts nothing. - `propose-consolidation-entries`: drafts them in the consolidation entity. - `set-allocation-override`: sets the outside owners' share of a member's month in place of the pro-rata share. - `JournalEntryResponse` gains `adjustment_kind` and `adjusts_entity_id`. - The description of `JournalEntryLineItemInput.flow_qname` changed. - The GraphQL schema is unchanged. - **Facades** on `LedgerClient`, each with a test: - `preview_consolidation_entries(graph_id, period)` - `propose_consolidation_entries(graph_id, period)` - `set_allocation_override(graph_id, entity_id=..., period=..., amount=... | percentage=..., basis=..., clear=...)` ## Breaking Changes None. Both tiers are additive. ## Testing 696 passed, 17 skipped; lint, format and typecheck are clean. The three operations exist on the server only from **the next robosystems release after v1.18.8**, the one carrying #1853–#1855 and migration 0055. Until that deploys, the new methods get a 404 from production. Nothing else changes, and the apps pin the client by lockfile. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01M6TRefZ8MTAxax6pMxer4q
2 parents 579e32a + 881c02f commit ded8e05

25 files changed

Lines changed: 2905 additions & 1 deletion
Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
from http import HTTPStatus
2+
from typing import Any
3+
from urllib.parse import quote
4+
5+
import httpx
6+
7+
from ... import errors
8+
from ...client import AuthenticatedClient, Client
9+
from ...models.error_response import ErrorResponse
10+
from ...models.operation_envelope_preview_consolidation_entries_response import (
11+
OperationEnvelopePreviewConsolidationEntriesResponse,
12+
)
13+
from ...models.preview_consolidation_entries_request import (
14+
PreviewConsolidationEntriesRequest,
15+
)
16+
from ...types import UNSET, Response, Unset
17+
18+
19+
def _get_kwargs(
20+
graph_id: str,
21+
*,
22+
body: PreviewConsolidationEntriesRequest,
23+
idempotency_key: None | str | Unset = UNSET,
24+
) -> dict[str, Any]:
25+
headers: dict[str, Any] = {}
26+
if not isinstance(idempotency_key, Unset):
27+
headers["Idempotency-Key"] = idempotency_key
28+
29+
_kwargs: dict[str, Any] = {
30+
"method": "post",
31+
"url": "/extensions/roboledger/{graph_id}/operations/preview-consolidation-entries".format(
32+
graph_id=quote(str(graph_id), safe=""),
33+
),
34+
}
35+
36+
_kwargs["json"] = body.to_dict()
37+
38+
headers["Content-Type"] = "application/json"
39+
40+
_kwargs["headers"] = headers
41+
return _kwargs
42+
43+
44+
def _parse_response(
45+
*, client: AuthenticatedClient | Client, response: httpx.Response
46+
) -> ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse | None:
47+
if response.status_code == 200:
48+
response_200 = OperationEnvelopePreviewConsolidationEntriesResponse.from_dict(
49+
response.json()
50+
)
51+
52+
return response_200
53+
54+
if response.status_code == 400:
55+
response_400 = ErrorResponse.from_dict(response.json())
56+
57+
return response_400
58+
59+
if response.status_code == 401:
60+
response_401 = ErrorResponse.from_dict(response.json())
61+
62+
return response_401
63+
64+
if response.status_code == 403:
65+
response_403 = ErrorResponse.from_dict(response.json())
66+
67+
return response_403
68+
69+
if response.status_code == 404:
70+
response_404 = ErrorResponse.from_dict(response.json())
71+
72+
return response_404
73+
74+
if response.status_code == 409:
75+
response_409 = ErrorResponse.from_dict(response.json())
76+
77+
return response_409
78+
79+
if response.status_code == 422:
80+
response_422 = ErrorResponse.from_dict(response.json())
81+
82+
return response_422
83+
84+
if response.status_code == 429:
85+
response_429 = ErrorResponse.from_dict(response.json())
86+
87+
return response_429
88+
89+
if response.status_code == 500:
90+
response_500 = ErrorResponse.from_dict(response.json())
91+
92+
return response_500
93+
94+
if client.raise_on_unexpected_status:
95+
raise errors.UnexpectedStatus(response.status_code, response.content)
96+
else:
97+
return None
98+
99+
100+
def _build_response(
101+
*, client: AuthenticatedClient | Client, response: httpx.Response
102+
) -> Response[ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse]:
103+
return Response(
104+
status_code=HTTPStatus(response.status_code),
105+
content=response.content,
106+
headers=response.headers,
107+
parsed=_parse_response(client=client, response=response),
108+
)
109+
110+
111+
def sync_detailed(
112+
graph_id: str,
113+
*,
114+
client: AuthenticatedClient,
115+
body: PreviewConsolidationEntriesRequest,
116+
idempotency_key: None | str | Unset = UNSET,
117+
) -> Response[ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse]:
118+
"""Preview Consolidation Entries
119+
120+
The consolidating entries a group's month needs, computed from the books and posting nothing. For
121+
each member consolidated in full: the parent's investment eliminated against the member's capital
122+
(its contributions net of distributions), the outside owners' share of that capital as
123+
noncontrolling interest, the intercompany balances, the month's intercompany income against the
124+
matching expense, and the outside owners' share of the month's result; for each member on the equity
125+
method, the parent's share of its result. Accounts are found by the rs-gaap concept they map to, and
126+
an intercompany line by the group entity its event names as counterparty. Each entry is the
127+
difference between the balance its kind should hold for the member at the month end and what the
128+
consolidation entity already holds, so the entries a person posted with the same kind count. A
129+
difference between the parent's investment and its share of a member's capital is returned as a
130+
residual and its entry withheld, never plugged; intercompany figures the two sides do not agree on
131+
are returned as reconciling items. Rejected on shared-repository graphs.
132+
133+
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
134+
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
135+
136+
Args:
137+
graph_id (str):
138+
idempotency_key (None | str | Unset):
139+
body (PreviewConsolidationEntriesRequest): The month to compute the consolidating entries
140+
for.
141+
142+
Raises:
143+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144+
httpx.TimeoutException: If the request takes longer than Client.timeout.
145+
146+
Returns:
147+
Response[ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse]
148+
"""
149+
150+
kwargs = _get_kwargs(
151+
graph_id=graph_id,
152+
body=body,
153+
idempotency_key=idempotency_key,
154+
)
155+
156+
response = client.get_httpx_client().request(
157+
**kwargs,
158+
)
159+
160+
return _build_response(client=client, response=response)
161+
162+
163+
def sync(
164+
graph_id: str,
165+
*,
166+
client: AuthenticatedClient,
167+
body: PreviewConsolidationEntriesRequest,
168+
idempotency_key: None | str | Unset = UNSET,
169+
) -> ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse | None:
170+
"""Preview Consolidation Entries
171+
172+
The consolidating entries a group's month needs, computed from the books and posting nothing. For
173+
each member consolidated in full: the parent's investment eliminated against the member's capital
174+
(its contributions net of distributions), the outside owners' share of that capital as
175+
noncontrolling interest, the intercompany balances, the month's intercompany income against the
176+
matching expense, and the outside owners' share of the month's result; for each member on the equity
177+
method, the parent's share of its result. Accounts are found by the rs-gaap concept they map to, and
178+
an intercompany line by the group entity its event names as counterparty. Each entry is the
179+
difference between the balance its kind should hold for the member at the month end and what the
180+
consolidation entity already holds, so the entries a person posted with the same kind count. A
181+
difference between the parent's investment and its share of a member's capital is returned as a
182+
residual and its entry withheld, never plugged; intercompany figures the two sides do not agree on
183+
are returned as reconciling items. Rejected on shared-repository graphs.
184+
185+
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
186+
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
187+
188+
Args:
189+
graph_id (str):
190+
idempotency_key (None | str | Unset):
191+
body (PreviewConsolidationEntriesRequest): The month to compute the consolidating entries
192+
for.
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+
ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse
200+
"""
201+
202+
return sync_detailed(
203+
graph_id=graph_id,
204+
client=client,
205+
body=body,
206+
idempotency_key=idempotency_key,
207+
).parsed
208+
209+
210+
async def asyncio_detailed(
211+
graph_id: str,
212+
*,
213+
client: AuthenticatedClient,
214+
body: PreviewConsolidationEntriesRequest,
215+
idempotency_key: None | str | Unset = UNSET,
216+
) -> Response[ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse]:
217+
"""Preview Consolidation Entries
218+
219+
The consolidating entries a group's month needs, computed from the books and posting nothing. For
220+
each member consolidated in full: the parent's investment eliminated against the member's capital
221+
(its contributions net of distributions), the outside owners' share of that capital as
222+
noncontrolling interest, the intercompany balances, the month's intercompany income against the
223+
matching expense, and the outside owners' share of the month's result; for each member on the equity
224+
method, the parent's share of its result. Accounts are found by the rs-gaap concept they map to, and
225+
an intercompany line by the group entity its event names as counterparty. Each entry is the
226+
difference between the balance its kind should hold for the member at the month end and what the
227+
consolidation entity already holds, so the entries a person posted with the same kind count. A
228+
difference between the parent's investment and its share of a member's capital is returned as a
229+
residual and its entry withheld, never plugged; intercompany figures the two sides do not agree on
230+
are returned as reconciling items. Rejected on shared-repository graphs.
231+
232+
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
233+
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
234+
235+
Args:
236+
graph_id (str):
237+
idempotency_key (None | str | Unset):
238+
body (PreviewConsolidationEntriesRequest): The month to compute the consolidating entries
239+
for.
240+
241+
Raises:
242+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
243+
httpx.TimeoutException: If the request takes longer than Client.timeout.
244+
245+
Returns:
246+
Response[ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse]
247+
"""
248+
249+
kwargs = _get_kwargs(
250+
graph_id=graph_id,
251+
body=body,
252+
idempotency_key=idempotency_key,
253+
)
254+
255+
response = await client.get_async_httpx_client().request(**kwargs)
256+
257+
return _build_response(client=client, response=response)
258+
259+
260+
async def asyncio(
261+
graph_id: str,
262+
*,
263+
client: AuthenticatedClient,
264+
body: PreviewConsolidationEntriesRequest,
265+
idempotency_key: None | str | Unset = UNSET,
266+
) -> ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse | None:
267+
"""Preview Consolidation Entries
268+
269+
The consolidating entries a group's month needs, computed from the books and posting nothing. For
270+
each member consolidated in full: the parent's investment eliminated against the member's capital
271+
(its contributions net of distributions), the outside owners' share of that capital as
272+
noncontrolling interest, the intercompany balances, the month's intercompany income against the
273+
matching expense, and the outside owners' share of the month's result; for each member on the equity
274+
method, the parent's share of its result. Accounts are found by the rs-gaap concept they map to, and
275+
an intercompany line by the group entity its event names as counterparty. Each entry is the
276+
difference between the balance its kind should hold for the member at the month end and what the
277+
consolidation entity already holds, so the entries a person posted with the same kind count. A
278+
difference between the parent's investment and its share of a member's capital is returned as a
279+
residual and its entry withheld, never plugged; intercompany figures the two sides do not agree on
280+
are returned as reconciling items. Rejected on shared-repository graphs.
281+
282+
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
283+
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
284+
285+
Args:
286+
graph_id (str):
287+
idempotency_key (None | str | Unset):
288+
body (PreviewConsolidationEntriesRequest): The month to compute the consolidating entries
289+
for.
290+
291+
Raises:
292+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
293+
httpx.TimeoutException: If the request takes longer than Client.timeout.
294+
295+
Returns:
296+
ErrorResponse | OperationEnvelopePreviewConsolidationEntriesResponse
297+
"""
298+
299+
return (
300+
await asyncio_detailed(
301+
graph_id=graph_id,
302+
client=client,
303+
body=body,
304+
idempotency_key=idempotency_key,
305+
)
306+
).parsed

0 commit comments

Comments
 (0)