diff --git a/robosystems_client/api/robo_ledger_ledger_events/record_ownership_change.py b/robosystems_client/api/robo_ledger_ledger_events/record_ownership_change.py index 923dfb6..862092b 100644 --- a/robosystems_client/api/robo_ledger_ledger_events/record_ownership_change.py +++ b/robosystems_client/api/robo_ledger_ledger_events/record_ownership_change.py @@ -113,16 +113,20 @@ def sync_detailed( ) -> Response[ErrorResponse | OperationEnvelopeOwnershipChangeResponse]: """Record Ownership Change - Record the parent buying more of a member consolidated in full from its outside owners: the share it - holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the - basis. It sets the member's share from that month and writes a draft in the consolidation entity, - dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the - price above the book value of the capital bought goes against the investment, the share bought of - the member's results since it joined comes out of the outside owners' interest, and the difference - is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as - part of the parent's investment and the new share from that month. Changes are recorded in order; - recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change - across consolidation methods, is not supported yet. + Record the parent buying more of a member consolidated in full from its outside owners, or selling + some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying + 50 or more) and the price in cents, with the basis. It sets the member's share from that month and + writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC + 810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of + the capital bought goes against the investment, the share bought of the member's results since it + joined comes out of the outside owners' interest, and the difference is the parent's equity. + Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold + and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on + those shares, credits the outside owners their larger share of the member's results, and takes the + difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of + what a sale released, as part of the parent's investment, and the new share from that month. Changes + are recorded in order; recording a month again replaces its draft, and a posted one is reversed + first. A change across consolidation methods is not supported yet. **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. @@ -131,9 +135,9 @@ def sync_detailed( graph_id (str): idempotency_key (None | str | Unset): body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside - owners, staying on the - same consolidation method: the share it holds from a month, and what it - paid. ASC 810 makes it an equity transaction, never a gain or loss. + owners, or sells some + of it to them while keeping control: the share it holds from a month, and + the price. ASC 810 makes it an equity transaction, never a gain or loss. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -165,16 +169,20 @@ def sync( ) -> ErrorResponse | OperationEnvelopeOwnershipChangeResponse | None: """Record Ownership Change - Record the parent buying more of a member consolidated in full from its outside owners: the share it - holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the - basis. It sets the member's share from that month and writes a draft in the consolidation entity, - dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the - price above the book value of the capital bought goes against the investment, the share bought of - the member's results since it joined comes out of the outside owners' interest, and the difference - is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as - part of the parent's investment and the new share from that month. Changes are recorded in order; - recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change - across consolidation methods, is not supported yet. + Record the parent buying more of a member consolidated in full from its outside owners, or selling + some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying + 50 or more) and the price in cents, with the basis. It sets the member's share from that month and + writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC + 810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of + the capital bought goes against the investment, the share bought of the member's results since it + joined comes out of the outside owners' interest, and the difference is the parent's equity. + Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold + and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on + those shares, credits the outside owners their larger share of the member's results, and takes the + difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of + what a sale released, as part of the parent's investment, and the new share from that month. Changes + are recorded in order; recording a month again replaces its draft, and a posted one is reversed + first. A change across consolidation methods is not supported yet. **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. @@ -183,9 +191,9 @@ def sync( graph_id (str): idempotency_key (None | str | Unset): body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside - owners, staying on the - same consolidation method: the share it holds from a month, and what it - paid. ASC 810 makes it an equity transaction, never a gain or loss. + owners, or sells some + of it to them while keeping control: the share it holds from a month, and + the price. ASC 810 makes it an equity transaction, never a gain or loss. Raises: 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( ) -> Response[ErrorResponse | OperationEnvelopeOwnershipChangeResponse]: """Record Ownership Change - Record the parent buying more of a member consolidated in full from its outside owners: the share it - holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the - basis. It sets the member's share from that month and writes a draft in the consolidation entity, - dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the - price above the book value of the capital bought goes against the investment, the share bought of - the member's results since it joined comes out of the outside owners' interest, and the difference - is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as - part of the parent's investment and the new share from that month. Changes are recorded in order; - recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change - across consolidation methods, is not supported yet. + Record the parent buying more of a member consolidated in full from its outside owners, or selling + some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying + 50 or more) and the price in cents, with the basis. It sets the member's share from that month and + writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC + 810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of + the capital bought goes against the investment, the share bought of the member's results since it + joined comes out of the outside owners' interest, and the difference is the parent's equity. + Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold + and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on + those shares, credits the outside owners their larger share of the member's results, and takes the + difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of + what a sale released, as part of the parent's investment, and the new share from that month. Changes + are recorded in order; recording a month again replaces its draft, and a posted one is reversed + first. A change across consolidation methods is not supported yet. **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. @@ -230,9 +242,9 @@ async def asyncio_detailed( graph_id (str): idempotency_key (None | str | Unset): body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside - owners, staying on the - same consolidation method: the share it holds from a month, and what it - paid. ASC 810 makes it an equity transaction, never a gain or loss. + owners, or sells some + of it to them while keeping control: the share it holds from a month, and + the price. ASC 810 makes it an equity transaction, never a gain or loss. Raises: 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( ) -> ErrorResponse | OperationEnvelopeOwnershipChangeResponse | None: """Record Ownership Change - Record the parent buying more of a member consolidated in full from its outside owners: the share it - holds from a month (`ownership_pct`, staying 50 or more) and what it paid them in cents, with the - basis. It sets the member's share from that month and writes a draft in the consolidation entity, - dated the month's first day, that its close posts: ASC 810 makes it an equity transaction, so the - price above the book value of the capital bought goes against the investment, the share bought of - the member's results since it joined comes out of the outside owners' interest, and the difference - is the parent's equity, with no gain or loss. preview-consolidation-entries then reads the price as - part of the parent's investment and the new share from that month. Changes are recorded in order; - recording a month again replaces its draft, and a posted one is reversed first. A sale, or a change - across consolidation methods, is not supported yet. + Record the parent buying more of a member consolidated in full from its outside owners, or selling + some of it to them while keeping control: the share it holds from a month (`ownership_pct`, staying + 50 or more) and the price in cents, with the basis. It sets the member's share from that month and + writes a draft in the consolidation entity, dated the month's first day, that its close posts: ASC + 810 makes it an equity transaction with no gain or loss. Buying, the price above the book value of + the capital bought goes against the investment, the share bought of the member's results since it + joined comes out of the outside owners' interest, and the difference is the parent's equity. + Selling, the parent's own entry takes the proceeds against the carrying amount of the shares sold + and books its gain or loss; the draft reverses that gain, releases the parent's cost above book on + those shares, credits the outside owners their larger share of the member's results, and takes the + difference to the parent's equity. preview-consolidation-entries then reads the price paid, net of + what a sale released, as part of the parent's investment, and the new share from that month. Changes + are recorded in order; recording a month again replaces its draft, and a posted one is reversed + first. A change across consolidation methods is not supported yet. **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict. @@ -280,9 +296,9 @@ async def asyncio( graph_id (str): idempotency_key (None | str | Unset): body (RecordOwnershipChangeRequest): The parent buys more of a member from its outside - owners, staying on the - same consolidation method: the share it holds from a month, and what it - paid. ASC 810 makes it an equity transaction, never a gain or loss. + owners, or sells some + of it to them while keeping control: the share it holds from a month, and + the price. ASC 810 makes it an equity transaction, never a gain or loss. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/robosystems_client/models/__init__.py b/robosystems_client/models/__init__.py index fbdb1d8..ce1914f 100644 --- a/robosystems_client/models/__init__.py +++ b/robosystems_client/models/__init__.py @@ -309,6 +309,7 @@ GetOperationStatusResponseGetoperationstatus, ) from .graph_capacity_response import GraphCapacityResponse +from .graph_freshness import GraphFreshness from .graph_info import GraphInfo from .graph_limits_response import GraphLimitsResponse from .graph_member_list_response import GraphMemberListResponse @@ -1503,6 +1504,7 @@ "GetFileInfoResponse", "GetOperationStatusResponseGetoperationstatus", "GraphCapacityResponse", + "GraphFreshness", "GraphInfo", "GraphLimitsResponse", "GraphMemberListResponse", diff --git a/robosystems_client/models/financial_statement_analysis_response.py b/robosystems_client/models/financial_statement_analysis_response.py index 998eb18..166654a 100644 --- a/robosystems_client/models/financial_statement_analysis_response.py +++ b/robosystems_client/models/financial_statement_analysis_response.py @@ -10,6 +10,7 @@ if TYPE_CHECKING: from ..models.analytical_statement_fact_row import AnalyticalStatementFactRow + from ..models.graph_freshness import GraphFreshness from ..models.resolved_report_info import ResolvedReportInfo @@ -28,6 +29,8 @@ class FinancialStatementAnalysisResponse: ticker (None | str | Unset): report_id (None | str | Unset): resolved_report (None | ResolvedReportInfo | Unset): + graph_freshness (GraphFreshness | None | Unset): On a ledger's graph, whether the graph is current with the + books; null on shared repositories, which are not rebuilt from a ledger. """ graph_id: str @@ -37,9 +40,11 @@ class FinancialStatementAnalysisResponse: ticker: None | str | Unset = UNSET report_id: None | str | Unset = UNSET resolved_report: None | ResolvedReportInfo | Unset = UNSET + graph_freshness: GraphFreshness | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + from ..models.graph_freshness import GraphFreshness from ..models.resolved_report_info import ResolvedReportInfo graph_id = self.graph_id @@ -73,6 +78,14 @@ def to_dict(self) -> dict[str, Any]: else: resolved_report = self.resolved_report + graph_freshness: dict[str, Any] | None | Unset + if isinstance(self.graph_freshness, Unset): + graph_freshness = UNSET + elif isinstance(self.graph_freshness, GraphFreshness): + graph_freshness = self.graph_freshness.to_dict() + else: + graph_freshness = self.graph_freshness + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -89,12 +102,15 @@ def to_dict(self) -> dict[str, Any]: field_dict["report_id"] = report_id if resolved_report is not UNSET: field_dict["resolved_report"] = resolved_report + if graph_freshness is not UNSET: + field_dict["graph_freshness"] = graph_freshness return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.analytical_statement_fact_row import AnalyticalStatementFactRow + from ..models.graph_freshness import GraphFreshness from ..models.resolved_report_info import ResolvedReportInfo d = dict(src_dict) @@ -146,6 +162,23 @@ def _parse_resolved_report(data: object) -> None | ResolvedReportInfo | Unset: resolved_report = _parse_resolved_report(d.pop("resolved_report", UNSET)) + def _parse_graph_freshness(data: object) -> GraphFreshness | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + graph_freshness_type_0 = GraphFreshness.from_dict(data) + + return graph_freshness_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(GraphFreshness | None | Unset, data) + + graph_freshness = _parse_graph_freshness(d.pop("graph_freshness", UNSET)) + financial_statement_analysis_response = cls( graph_id=graph_id, statement_type=statement_type, @@ -154,6 +187,7 @@ def _parse_resolved_report(data: object) -> None | ResolvedReportInfo | Unset: ticker=ticker, report_id=report_id, resolved_report=resolved_report, + graph_freshness=graph_freshness, ) financial_statement_analysis_response.additional_properties = d diff --git a/robosystems_client/models/graph_freshness.py b/robosystems_client/models/graph_freshness.py new file mode 100644 index 0000000..f01f74c --- /dev/null +++ b/robosystems_client/models/graph_freshness.py @@ -0,0 +1,130 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="GraphFreshness") + + +@_attrs_define +class GraphFreshness: + """Whether a ledger's graph is current with its books. + + A ledger's graph is a projection of its database, rebuilt after writes; + until a rebuild finishes, graph-backed reads answer from the previous one. + + Attributes: + stale (bool): True when the books have changed since the graph was last rebuilt, so this answer can be behind + them. A rebuild is queued automatically. + stale_since (None | str | Unset): When the graph first fell behind the books (ISO 8601); null when current. + stale_reason (None | str | Unset): The latest write that left the graph behind (e.g. 'period_closed'). + last_materialized_at (None | str | Unset): When the graph was last rebuilt (ISO 8601). + """ + + stale: bool + stale_since: None | str | Unset = UNSET + stale_reason: None | str | Unset = UNSET + last_materialized_at: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + stale = self.stale + + stale_since: None | str | Unset + if isinstance(self.stale_since, Unset): + stale_since = UNSET + else: + stale_since = self.stale_since + + stale_reason: None | str | Unset + if isinstance(self.stale_reason, Unset): + stale_reason = UNSET + else: + stale_reason = self.stale_reason + + last_materialized_at: None | str | Unset + if isinstance(self.last_materialized_at, Unset): + last_materialized_at = UNSET + else: + last_materialized_at = self.last_materialized_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "stale": stale, + } + ) + if stale_since is not UNSET: + field_dict["stale_since"] = stale_since + if stale_reason is not UNSET: + field_dict["stale_reason"] = stale_reason + if last_materialized_at is not UNSET: + field_dict["last_materialized_at"] = last_materialized_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + stale = d.pop("stale") + + def _parse_stale_since(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + stale_since = _parse_stale_since(d.pop("stale_since", UNSET)) + + def _parse_stale_reason(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + stale_reason = _parse_stale_reason(d.pop("stale_reason", UNSET)) + + def _parse_last_materialized_at(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + last_materialized_at = _parse_last_materialized_at( + d.pop("last_materialized_at", UNSET) + ) + + graph_freshness = cls( + stale=stale, + stale_since=stale_since, + stale_reason=stale_reason, + last_materialized_at=last_materialized_at, + ) + + graph_freshness.additional_properties = d + return graph_freshness + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/ownership_change_response.py b/robosystems_client/models/ownership_change_response.py index 58f88ae..8bd1332 100644 --- a/robosystems_client/models/ownership_change_response.py +++ b/robosystems_client/models/ownership_change_response.py @@ -26,16 +26,22 @@ class OwnershipChangeResponse: period (str): The first month the new share holds. from_pct (float): The parent's share the month before. to_pct (float): The parent's share from `period`. - consideration (int): Cents paid to the outside owners. + consideration (int): Cents paid to the outside owners, or received from them for shares sold. book_value (int): Cents: the share bought of the member's capital, which the investment elimination moves from - the outside owners to the parent. + the outside owners to the parent; negative for a share sold, moved the other way. earnings_transferred (int): Cents: the share bought of the member's results since it joined, moved from the - outside owners' interest to the parent. - equity_adjustment (int): Cents taken from the parent's equity: the price above the carrying amount of what was - bought (negative when it paid less). + outside owners' interest to the parent; negative for a share sold. + equity_adjustment (int): Cents taken from the parent's equity (negative: added to it): for a purchase, the price + above the carrying amount of what was bought; for a sale, the carrying amount given up above the price. entry (JournalEntryResponse): The common response shape for journal entry write operations. premium_transferred (int | Unset): Cents: the share bought of the outside owners' interest beyond their share of - book value (from the acquisition at fair value, or its step-ups), moved to the parent. Default: 0. + book value (from the acquisition at fair value, or its step-ups), moved to the parent; negative for a share + sold. Default: 0. + carrying_released (int | Unset): Cents, for a sale: the carrying amount of the shares sold on the parent's + books, its cost pro rata, which its sale entry credits against the investment. Zero for a purchase. Default: 0. + gain_reversed (int | Unset): Cents, for a sale: the gain (a loss negative) the parent's own books take, the + price less the carrying amount released, which the entry reverses — the group has none while control is kept. + Zero for a purchase. Default: 0. replaced (bool | Unset): True when it replaced an earlier draft for the month. Default: False. """ @@ -50,6 +56,8 @@ class OwnershipChangeResponse: equity_adjustment: int entry: JournalEntryResponse premium_transferred: int | Unset = 0 + carrying_released: int | Unset = 0 + gain_reversed: int | Unset = 0 replaced: bool | Unset = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -76,6 +84,10 @@ def to_dict(self) -> dict[str, Any]: premium_transferred = self.premium_transferred + carrying_released = self.carrying_released + + gain_reversed = self.gain_reversed + replaced = self.replaced field_dict: dict[str, Any] = {} @@ -96,6 +108,10 @@ def to_dict(self) -> dict[str, Any]: ) if premium_transferred is not UNSET: field_dict["premium_transferred"] = premium_transferred + if carrying_released is not UNSET: + field_dict["carrying_released"] = carrying_released + if gain_reversed is not UNSET: + field_dict["gain_reversed"] = gain_reversed if replaced is not UNSET: field_dict["replaced"] = replaced @@ -128,6 +144,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: premium_transferred = d.pop("premium_transferred", UNSET) + carrying_released = d.pop("carrying_released", UNSET) + + gain_reversed = d.pop("gain_reversed", UNSET) + replaced = d.pop("replaced", UNSET) ownership_change_response = cls( @@ -142,6 +162,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: equity_adjustment=equity_adjustment, entry=entry, premium_transferred=premium_transferred, + carrying_released=carrying_released, + gain_reversed=gain_reversed, replaced=replaced, ) diff --git a/robosystems_client/models/record_ownership_change_request.py b/robosystems_client/models/record_ownership_change_request.py index 6ea1031..2be5748 100644 --- a/robosystems_client/models/record_ownership_change_request.py +++ b/robosystems_client/models/record_ownership_change_request.py @@ -11,18 +11,18 @@ @_attrs_define class RecordOwnershipChangeRequest: - """The parent buys more of a member from its outside owners, staying on the - same consolidation method: the share it holds from a month, and what it - paid. ASC 810 makes it an equity transaction, never a gain or loss. + """The parent buys more of a member from its outside owners, or sells some + of it to them while keeping control: the share it holds from a month, and + the price. ASC 810 makes it an equity transaction, never a gain or loss. Attributes: entity_id (str): The member, consolidated in full. period (str): The month, as YYYY-MM. - ownership_pct (float): The parent's share from `period`, as a percentage: above its share the month before, and - 50 or more, so the member stays consolidated in full. - consideration (int): Cents the parent paid the outside owners for the shares. Its line names them, not the - member, which is why it is given here. - basis (str): The purchase agreement, or what sets the price. + ownership_pct (float): The parent's share from `period`, as a percentage: above its share the month before for a + purchase, below it for a sale, and 50 or more either way, so the member stays consolidated in full. + consideration (int): Cents the parent paid the outside owners for the shares, or received from them for shares + sold. Its line names them, not the member, which is why it is given here. + basis (str): The purchase or sale agreement, or what sets the price. """ entity_id: str diff --git a/robosystems_client/models/view_metadata.py b/robosystems_client/models/view_metadata.py index 066ad68..8fc7924 100644 --- a/robosystems_client/models/view_metadata.py +++ b/robosystems_client/models/view_metadata.py @@ -1,13 +1,17 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.graph_freshness import GraphFreshness + + T = TypeVar("T", bound="ViewMetadata") @@ -23,6 +27,8 @@ class ViewMetadata: period_end (None | str | Unset): Period end date truncated (bool | Unset): True when more facts matched than `limit` allowed. The returned facts are the most recent by period; narrow the filters or raise `limit` to see the rest. Default: False. + graph_freshness (GraphFreshness | None | Unset): On a ledger's graph, whether the graph is current with the + books; null on shared repositories, which are not rebuilt from a ledger. """ view_id: str @@ -32,9 +38,12 @@ class ViewMetadata: period_start: None | str | Unset = UNSET period_end: None | str | Unset = UNSET truncated: bool | Unset = False + graph_freshness: GraphFreshness | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + from ..models.graph_freshness import GraphFreshness + view_id = self.view_id facts_processed = self.facts_processed @@ -57,6 +66,14 @@ def to_dict(self) -> dict[str, Any]: truncated = self.truncated + graph_freshness: dict[str, Any] | None | Unset + if isinstance(self.graph_freshness, Unset): + graph_freshness = UNSET + elif isinstance(self.graph_freshness, GraphFreshness): + graph_freshness = self.graph_freshness.to_dict() + else: + graph_freshness = self.graph_freshness + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -73,11 +90,15 @@ def to_dict(self) -> dict[str, Any]: field_dict["period_end"] = period_end if truncated is not UNSET: field_dict["truncated"] = truncated + if graph_freshness is not UNSET: + field_dict["graph_freshness"] = graph_freshness return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.graph_freshness import GraphFreshness + d = dict(src_dict) view_id = d.pop("view_id") @@ -107,6 +128,23 @@ def _parse_period_end(data: object) -> None | str | Unset: truncated = d.pop("truncated", UNSET) + def _parse_graph_freshness(data: object) -> GraphFreshness | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + graph_freshness_type_0 = GraphFreshness.from_dict(data) + + return graph_freshness_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(GraphFreshness | None | Unset, data) + + graph_freshness = _parse_graph_freshness(d.pop("graph_freshness", UNSET)) + view_metadata = cls( view_id=view_id, facts_processed=facts_processed, @@ -115,6 +153,7 @@ def _parse_period_end(data: object) -> None | str | Unset: period_start=period_start, period_end=period_end, truncated=truncated, + graph_freshness=graph_freshness, ) view_metadata.additional_properties = d