4242from ..api .robo_ledger_fiscal_close .close_period import (
4343 sync_detailed as op_close_period ,
4444)
45+ from ..api .robo_ledger_fiscal_close .promote_obligations import (
46+ sync_detailed as op_promote_obligations ,
47+ )
48+ from ..api .robo_ledger_ledger_events .preview_reconciling_item import (
49+ sync_detailed as op_preview_reconciling_item ,
50+ )
51+ from ..api .robo_ledger_ledger_events .resolve_reconciling_item import (
52+ sync_detailed as op_resolve_reconciling_item ,
53+ )
4554from ..api .robo_ledger_ledger_events .preview_reconciliations import (
4655 sync_detailed as op_preview_reconciliations ,
4756)
504513from ..models .reconciliation_summary import ReconciliationSummary
505514from ..models .record_statement_balance_request import RecordStatementBalanceRequest
506515from ..models .refresh_reconciliations_request import RefreshReconciliationsRequest
516+ from ..models .preview_reconciling_item_request import PreviewReconcilingItemRequest
517+ from ..models .promote_obligations_request import PromoteObligationsRequest
518+ from ..models .promote_obligations_response import PromoteObligationsResponse
519+ from ..models .reconciling_item_plan import ReconcilingItemPlan
520+ from ..models .resolve_reconciling_item_request import ResolveReconcilingItemRequest
521+ from ..models .resolve_reconciling_item_request_disposition_type_0 import (
522+ ResolveReconcilingItemRequestDispositionType0 ,
523+ )
524+ from ..models .resolve_reconciling_item_request_status import (
525+ ResolveReconcilingItemRequestStatus ,
526+ )
527+ from ..models .resolve_reconciling_item_response import ResolveReconcilingItemResponse
507528from ..models .set_reconciliation_policy_request import SetReconciliationPolicyRequest
508529from ..models .sign_off_reconciliation_request import SignOffReconciliationRequest
509530from ..models .compute_metrics_request import ComputeMetricsRequest
579600from ..models .revoke_report_share_response import RevokeReportShareResponse
580601from ..models .taxonomy_block_envelope import TaxonomyBlockEnvelope
581602
582- from ..types import UNSET
603+ from ..types import UNSET , Unset
583604
584605
585606# Captures the ``filename`` value from a Content-Disposition header, with
@@ -988,8 +1009,13 @@ def list_event_blocks(
9881009 source : str | None = None ,
9891010 limit : int = 50 ,
9901011 offset : int = 0 ,
1012+ is_reconciling_item : bool | None = None ,
9911013 ) -> list [ListLedgerEventBlocksEventBlocks ]:
992- """List captured event blocks (inbox surface)."""
1014+ """List captured event blocks (inbox surface).
1015+
1016+ ``is_reconciling_item=True`` narrows to posted events whose source
1017+ payload changed afterwards and that await a decision.
1018+ """
9931019 data = self ._query (
9941020 graph_id ,
9951021 LIST_LEDGER_EVENT_BLOCKS_GQL ,
@@ -999,6 +1025,7 @@ def list_event_blocks(
9991025 "status" : status ,
10001026 "agentId" : agent_id ,
10011027 "source" : source ,
1028+ "isReconcilingItem" : is_reconciling_item ,
10021029 "limit" : limit ,
10031030 "offset" : offset ,
10041031 },
@@ -2173,23 +2200,36 @@ def close_period(
21732200 note : str | None = None ,
21742201 allow_stale_sync : bool | None = None ,
21752202 allow_unreconciled_accounts : bool | None = None ,
2203+ allow_stranded_obligations : bool | None = None ,
2204+ allow_reconciling_items : bool | None = None ,
2205+ allow_unposted_source_events : bool | None = None ,
21762206 ) -> ClosePeriodResponse :
21772207 """Close a fiscal period — the final commit action.
21782208
2179- ``allow_unreconciled_accounts`` closes despite a reconciliation the
2180- close waits on that is not reconciled for the period. Prefer
2181- `refresh_reconciliations` and clearing what it reports; the override is
2182- recorded in the close audit note.
2209+ Each ``allow_*`` flag closes despite one blocker and is recorded in the
2210+ close audit note; prefer clearing the blocker.
2211+
2212+ - ``allow_unreconciled_accounts``: a reconciliation the close waits on
2213+ is not reconciled for the period (`refresh_reconciliations`).
2214+ - ``allow_stranded_obligations``: matured obligations that were never
2215+ drafted (`promote_obligations`).
2216+ - ``allow_reconciling_items``: posted events whose source payload
2217+ changed afterwards (`resolve_reconciling_item`).
2218+ - ``allow_unposted_source_events``: source events dated in the period
2219+ that were never committed, and cannot post into it once it closes.
21832220 """
2221+
2222+ def flag (value : bool | None ) -> bool | Unset :
2223+ return value if value is not None else UNSET
2224+
21842225 body = ClosePeriodOperation (
21852226 period = period ,
21862227 note = note if note is not None else UNSET ,
2187- allow_stale_sync = (allow_stale_sync if allow_stale_sync is not None else UNSET ),
2188- allow_unreconciled_accounts = (
2189- allow_unreconciled_accounts
2190- if allow_unreconciled_accounts is not None
2191- else UNSET
2192- ),
2228+ allow_stale_sync = flag (allow_stale_sync ),
2229+ allow_unreconciled_accounts = flag (allow_unreconciled_accounts ),
2230+ allow_stranded_obligations = flag (allow_stranded_obligations ),
2231+ allow_reconciling_items = flag (allow_reconciling_items ),
2232+ allow_unposted_source_events = flag (allow_unposted_source_events ),
21932233 )
21942234 response = op_close_period (graph_id = graph_id , body = body , client = self ._get_client ())
21952235 envelope = self ._call_op ("Close period" , response )
@@ -2212,6 +2252,89 @@ def reopen_period(
22122252 envelope = self ._call_op ("Reopen period" , response )
22132253 return self ._typed_result ("Reopen period" , envelope , FiscalCalendarResponse )
22142254
2255+ def promote_obligations (
2256+ self , graph_id : str , * , dispatch_handlers : bool | None = None
2257+ ) -> PromoteObligationsResponse :
2258+ """Draft the closing entry of every matured schedule obligation,
2259+ including ones promoted earlier and never drafted. The drafts post when
2260+ the period closes. Safe to repeat.
2261+
2262+ ``dispatch_handlers=False`` only flips the status and drafts nothing,
2263+ which leaves the obligations stranded; the server default drafts.
2264+ """
2265+ body = PromoteObligationsRequest (
2266+ dispatch_handlers = (dispatch_handlers if dispatch_handlers is not None else UNSET )
2267+ )
2268+ response = op_promote_obligations (
2269+ graph_id = graph_id , body = body , client = self ._get_client ()
2270+ )
2271+ envelope = self ._call_op ("Promote obligations" , response )
2272+ return self ._typed_result (
2273+ "Promote obligations" , envelope , PromoteObligationsResponse
2274+ )
2275+
2276+ # ── Reconciling items ───────────────────────────────────────────────
2277+
2278+ def preview_reconciling_item (
2279+ self , graph_id : str , event_id : str
2280+ ) -> ReconcilingItemPlan :
2281+ """What changed on a reconciling item (a posted event whose source
2282+ payload changed afterwards) and what each treatment would do. Writes
2283+ nothing. List the items with ``list_event_blocks(is_reconciling_item=True)``.
2284+ """
2285+ body = PreviewReconcilingItemRequest (event_id = event_id )
2286+ response = op_preview_reconciling_item (
2287+ graph_id = graph_id , body = body , client = self ._get_client ()
2288+ )
2289+ envelope = self ._call_op ("Preview reconciling item" , response )
2290+ return self ._typed_result ("Preview reconciling item" , envelope , ReconcilingItemPlan )
2291+
2292+ def resolve_reconciling_item (
2293+ self ,
2294+ graph_id : str ,
2295+ event_id : str ,
2296+ * ,
2297+ disposition : str | None = None ,
2298+ posting_date : str | datetime .date | None = None ,
2299+ status : str | None = None ,
2300+ note : str | None = None ,
2301+ reference_event_id : str | None = None ,
2302+ ) -> ResolveReconcilingItemResponse :
2303+ """Decide one reconciling item.
2304+
2305+ ``disposition`` is ``restate`` (rebuild the affected months),
2306+ ``catch_up`` (an entry in the open period) or ``acknowledge`` (handled
2307+ elsewhere; ``note`` is required). Omit it to take the default the
2308+ preview reports. ``posting_date`` and ``status`` (``draft`` or
2309+ ``posted``) apply to ``catch_up`` only; ``reference_event_id`` to
2310+ ``acknowledge`` only.
2311+ """
2312+ if isinstance (posting_date , str ):
2313+ posting_date = datetime .date .fromisoformat (posting_date )
2314+ body = ResolveReconcilingItemRequest (
2315+ event_id = event_id ,
2316+ disposition = (
2317+ ResolveReconcilingItemRequestDispositionType0 (disposition )
2318+ if disposition is not None
2319+ else UNSET
2320+ ),
2321+ posting_date = posting_date if posting_date is not None else UNSET ,
2322+ status = (
2323+ ResolveReconcilingItemRequestStatus (status ) if status is not None else UNSET
2324+ ),
2325+ note = note if note is not None else UNSET ,
2326+ reference_event_id = (
2327+ reference_event_id if reference_event_id is not None else UNSET
2328+ ),
2329+ )
2330+ response = op_resolve_reconciling_item (
2331+ graph_id = graph_id , body = body , client = self ._get_client ()
2332+ )
2333+ envelope = self ._call_op ("Resolve reconciling item" , response )
2334+ return self ._typed_result (
2335+ "Resolve reconciling item" , envelope , ResolveReconcilingItemResponse
2336+ )
2337+
22152338 # ── Reconciliations ─────────────────────────────────────────────────
22162339
22172340 def list_reconciliations (
0 commit comments