Skip to content

Commit ba247a4

Browse files
authored
feat(sdk): record-ownership-change sales and graph freshness (rs #1931, #1928) (#281)
## Summary Regenerated from the API for two server changes the published 2.32.0 does not carry: - **[rs #1931](RoboFinSystems/robosystems#1931 (group-lifecycle Phase 2b): `record-ownership-change` records a sale within the method. `OwnershipChangeResponse` gains `carrying_released` and `gain_reversed`; the request and response descriptions cover a sale. - **[rs #1928](RoboFinSystems/robosystems#1928 (materialization integrity, merged after 2.32.0 was cut): `GraphFreshness` and the `graph_freshness` field on the financial-statement-analysis response and view metadata. Additive, generated tier: a client **minor**. Waits on the robosystems release after v1.20.0 that carries both; nothing here is live on the API until then. ## Testing `just test-all`: 731 passed, 17 skipped; ruff, format and basedpyright clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015PxYaVzrbraKFeRALM7rXp
2 parents 8b4ccbf + af4c862 commit ba247a4

7 files changed

Lines changed: 310 additions & 67 deletions

File tree

‎robosystems_client/api/robo_ledger_ledger_events/record_ownership_change.py‎

Lines changed: 68 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,20 @@ def sync_detailed(
113113
) -> Response[ErrorResponse | OperationEnvelopeOwnershipChangeResponse]:
114114
"""Record Ownership Change
115115
116-
Record the parent buying more of a member consolidated in full from its outside owners: the share it
117-
holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the
118-
basis. It sets the member's share from that month and writes a draft in the consolidation entity,
119-
dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the
120-
price above the book value of the capital bought goes against the investment, the share bought of
121-
the member's results since it joined comes out of the outside owners' interest, and the difference
122-
is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as
123-
part of the parent's investment and the new share from that month. Changes are recorded in order;
124-
recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change
125-
across consolidation methods, is not supported yet.
116+
Record the parent buying more of a member consolidated in full from its outside owners, or selling
117+
some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying
118+
50 or more) and the price in cents, with the basis. It sets the member's share from that month and
119+
writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC
120+
810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of
121+
the capital bought goes against the investment, the share bought of the member's results since it
122+
joined comes out of the outside owners' interest, and the difference is the parent's equity.
123+
Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold
124+
and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on
125+
those shares, credits the outside owners their larger share of the member's results, and takes the
126+
difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of
127+
what a sale released, as part of the parent's investment, and the new share from that month. Changes
128+
are recorded in order; recording a month again replaces its draft, and a posted one is reversed
129+
first. A change across consolidation methods is not supported yet.
126130
127131
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
128132
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -131,9 +135,9 @@ def sync_detailed(
131135
graph_id (str):
132136
idempotency_key (None | str | Unset):
133137
body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside
134-
owners, staying on the
135-
same consolidation method: the share it holds from a month, and what it
136-
paid. ASC 810 makes it an equity transaction, never a gain or loss.
138+
owners, or sells some
139+
of it to them while keeping control: the share it holds from a month, and
140+
the price. ASC 810 makes it an equity transaction, never a gain or loss.
137141
138142
Raises:
139143
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -165,16 +169,20 @@ def sync(
165169
) -> ErrorResponse | OperationEnvelopeOwnershipChangeResponse | None:
166170
"""Record Ownership Change
167171
168-
Record the parent buying more of a member consolidated in full from its outside owners: the share it
169-
holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the
170-
basis. It sets the member's share from that month and writes a draft in the consolidation entity,
171-
dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the
172-
price above the book value of the capital bought goes against the investment, the share bought of
173-
the member's results since it joined comes out of the outside owners' interest, and the difference
174-
is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as
175-
part of the parent's investment and the new share from that month. Changes are recorded in order;
176-
recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change
177-
across consolidation methods, is not supported yet.
172+
Record the parent buying more of a member consolidated in full from its outside owners, or selling
173+
some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying
174+
50 or more) and the price in cents, with the basis. It sets the member's share from that month and
175+
writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC
176+
810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of
177+
the capital bought goes against the investment, the share bought of the member's results since it
178+
joined comes out of the outside owners' interest, and the difference is the parent's equity.
179+
Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold
180+
and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on
181+
those shares, credits the outside owners their larger share of the member's results, and takes the
182+
difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of
183+
what a sale released, as part of the parent's investment, and the new share from that month. Changes
184+
are recorded in order; recording a month again replaces its draft, and a posted one is reversed
185+
first. A change across consolidation methods is not supported yet.
178186
179187
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
180188
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -183,9 +191,9 @@ def sync(
183191
graph_id (str):
184192
idempotency_key (None | str | Unset):
185193
body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside
186-
owners, staying on the
187-
same consolidation method: the share it holds from a month, and what it
188-
paid. ASC 810 makes it an equity transaction, never a gain or loss.
194+
owners, or sells some
195+
of it to them while keeping control: the share it holds from a month, and
196+
the price. ASC 810 makes it an equity transaction, never a gain or loss.
189197
190198
Raises:
191199
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -212,16 +220,20 @@ async def asyncio_detailed(
212220
) -> Response[ErrorResponse | OperationEnvelopeOwnershipChangeResponse]:
213221
"""Record Ownership Change
214222
215-
Record the parent buying more of a member consolidated in full from its outside owners: the share it
216-
holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the
217-
basis. It sets the member's share from that month and writes a draft in the consolidation entity,
218-
dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the
219-
price above the book value of the capital bought goes against the investment, the share bought of
220-
the member's results since it joined comes out of the outside owners' interest, and the difference
221-
is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as
222-
part of the parent's investment and the new share from that month. Changes are recorded in order;
223-
recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change
224-
across consolidation methods, is not supported yet.
223+
Record the parent buying more of a member consolidated in full from its outside owners, or selling
224+
some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying
225+
50 or more) and the price in cents, with the basis. It sets the member's share from that month and
226+
writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC
227+
810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of
228+
the capital bought goes against the investment, the share bought of the member's results since it
229+
joined comes out of the outside owners' interest, and the difference is the parent's equity.
230+
Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold
231+
and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on
232+
those shares, credits the outside owners their larger share of the member's results, and takes the
233+
difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of
234+
what a sale released, as part of the parent's investment, and the new share from that month. Changes
235+
are recorded in order; recording a month again replaces its draft, and a posted one is reversed
236+
first. A change across consolidation methods is not supported yet.
225237
226238
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
227239
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -230,9 +242,9 @@ async def asyncio_detailed(
230242
graph_id (str):
231243
idempotency_key (None | str | Unset):
232244
body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside
233-
owners, staying on the
234-
same consolidation method: the share it holds from a month, and what it
235-
paid. ASC 810 makes it an equity transaction, never a gain or loss.
245+
owners, or sells some
246+
of it to them while keeping control: the share it holds from a month, and
247+
the price. ASC 810 makes it an equity transaction, never a gain or loss.
236248
237249
Raises:
238250
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -262,16 +274,20 @@ async def asyncio(
262274
) -> ErrorResponse | OperationEnvelopeOwnershipChangeResponse | None:
263275
"""Record Ownership Change
264276
265-
Record the parent buying more of a member consolidated in full from its outside owners: the share it
266-
holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the
267-
basis. It sets the member's share from that month and writes a draft in the consolidation entity,
268-
dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the
269-
price above the book value of the capital bought goes against the investment, the share bought of
270-
the member's results since it joined comes out of the outside owners' interest, and the difference
271-
is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as
272-
part of the parent's investment and the new share from that month. Changes are recorded in order;
273-
recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change
274-
across consolidation methods, is not supported yet.
277+
Record the parent buying more of a member consolidated in full from its outside owners, or selling
278+
some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying
279+
50 or more) and the price in cents, with the basis. It sets the member's share from that month and
280+
writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC
281+
810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of
282+
the capital bought goes against the investment, the share bought of the member's results since it
283+
joined comes out of the outside owners' interest, and the difference is the parent's equity.
284+
Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold
285+
and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on
286+
those shares, credits the outside owners their larger share of the member's results, and takes the
287+
difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of
288+
what a sale released, as part of the parent's investment, and the new share from that month. Changes
289+
are recorded in order; recording a month again replaces its draft, and a posted one is reversed
290+
first. A change across consolidation methods is not supported yet.
275291
276292
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
277293
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -280,9 +296,9 @@ async def asyncio(
280296
graph_id (str):
281297
idempotency_key (None | str | Unset):
282298
body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside
283-
owners, staying on the
284-
same consolidation method: the share it holds from a month, and what it
285-
paid. ASC 810 makes it an equity transaction, never a gain or loss.
299+
owners, or sells some
300+
of it to them while keeping control: the share it holds from a month, and
301+
the price. ASC 810 makes it an equity transaction, never a gain or loss.
286302
287303
Raises:
288304
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

‎robosystems_client/models/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@
309309
GetOperationStatusResponseGetoperationstatus,
310310
)
311311
from .graph_capacity_response import GraphCapacityResponse
312+
from .graph_freshness import GraphFreshness
312313
from .graph_info import GraphInfo
313314
from .graph_limits_response import GraphLimitsResponse
314315
from .graph_member_list_response import GraphMemberListResponse
@@ -1503,6 +1504,7 @@
15031504
"GetFileInfoResponse",
15041505
"GetOperationStatusResponseGetoperationstatus",
15051506
"GraphCapacityResponse",
1507+
"GraphFreshness",
15061508
"GraphInfo",
15071509
"GraphLimitsResponse",
15081510
"GraphMemberListResponse",

‎robosystems_client/models/financial_statement_analysis_response.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
if TYPE_CHECKING:
1212
from ..models.analytical_statement_fact_row import AnalyticalStatementFactRow
13+
from ..models.graph_freshness import GraphFreshness
1314
from ..models.resolved_report_info import ResolvedReportInfo
1415

1516

@@ -28,6 +29,8 @@ class FinancialStatementAnalysisResponse:
2829
ticker (None | str | Unset):
2930
report_id (None | str | Unset):
3031
resolved_report (None | ResolvedReportInfo | Unset):
32+
graph_freshness (GraphFreshness | None | Unset): On a ledger's graph, whether the graph is current with the
33+
books; null on shared repositories, which are not rebuilt from a ledger.
3134
"""
3235

3336
graph_id: str
@@ -37,9 +40,11 @@ class FinancialStatementAnalysisResponse:
3740
ticker: None | str | Unset = UNSET
3841
report_id: None | str | Unset = UNSET
3942
resolved_report: None | ResolvedReportInfo | Unset = UNSET
43+
graph_freshness: GraphFreshness | None | Unset = UNSET
4044
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
4145

4246
def to_dict(self) -> dict[str, Any]:
47+
from ..models.graph_freshness import GraphFreshness
4348
from ..models.resolved_report_info import ResolvedReportInfo
4449

4550
graph_id = self.graph_id
@@ -73,6 +78,14 @@ def to_dict(self) -> dict[str, Any]:
7378
else:
7479
resolved_report = self.resolved_report
7580

81+
graph_freshness: dict[str, Any] | None | Unset
82+
if isinstance(self.graph_freshness, Unset):
83+
graph_freshness = UNSET
84+
elif isinstance(self.graph_freshness, GraphFreshness):
85+
graph_freshness = self.graph_freshness.to_dict()
86+
else:
87+
graph_freshness = self.graph_freshness
88+
7689
field_dict: dict[str, Any] = {}
7790
field_dict.update(self.additional_properties)
7891
field_dict.update(
@@ -89,12 +102,15 @@ def to_dict(self) -> dict[str, Any]:
89102
field_dict["report_id"] = report_id
90103
if resolved_report is not UNSET:
91104
field_dict["resolved_report"] = resolved_report
105+
if graph_freshness is not UNSET:
106+
field_dict["graph_freshness"] = graph_freshness
92107

93108
return field_dict
94109

95110
@classmethod
96111
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
97112
from ..models.analytical_statement_fact_row import AnalyticalStatementFactRow
113+
from ..models.graph_freshness import GraphFreshness
98114
from ..models.resolved_report_info import ResolvedReportInfo
99115

100116
d = dict(src_dict)
@@ -146,6 +162,23 @@ def _parse_resolved_report(data: object) -> None | ResolvedReportInfo | Unset:
146162

147163
resolved_report = _parse_resolved_report(d.pop("resolved_report", UNSET))
148164

165+
def _parse_graph_freshness(data: object) -> GraphFreshness | None | Unset:
166+
if data is None:
167+
return data
168+
if isinstance(data, Unset):
169+
return data
170+
try:
171+
if not isinstance(data, dict):
172+
raise TypeError()
173+
graph_freshness_type_0 = GraphFreshness.from_dict(data)
174+
175+
return graph_freshness_type_0
176+
except (TypeError, ValueError, AttributeError, KeyError):
177+
pass
178+
return cast(GraphFreshness | None | Unset, data)
179+
180+
graph_freshness = _parse_graph_freshness(d.pop("graph_freshness", UNSET))
181+
149182
financial_statement_analysis_response = cls(
150183
graph_id=graph_id,
151184
statement_type=statement_type,
@@ -154,6 +187,7 @@ def _parse_resolved_report(data: object) -> None | ResolvedReportInfo | Unset:
154187
ticker=ticker,
155188
report_id=report_id,
156189
resolved_report=resolved_report,
190+
graph_freshness=graph_freshness,
157191
)
158192

159193
financial_statement_analysis_response.additional_properties = d

0 commit comments

Comments
 (0)