88from ...client import AuthenticatedClient , Client
99from ...models .backfill_plan_history_operation import BackfillPlanHistoryOperation
1010from ...models .error_response import ErrorResponse
11- from ...models .operation_envelope_backfill_plan_history_response import (
12- OperationEnvelopeBackfillPlanHistoryResponse ,
13- )
11+ from ...models .operation_envelope import OperationEnvelope
1412from ...types import UNSET , Response , Unset
1513
1614
@@ -41,13 +39,11 @@ def _get_kwargs(
4139
4240def _parse_response (
4341 * , client : AuthenticatedClient | Client , response : httpx .Response
44- ) -> ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse | None :
45- if response .status_code == 200 :
46- response_200 = OperationEnvelopeBackfillPlanHistoryResponse .from_dict (
47- response .json ()
48- )
42+ ) -> ErrorResponse | OperationEnvelope | None :
43+ if response .status_code == 202 :
44+ response_202 = OperationEnvelope .from_dict (response .json ())
4945
50- return response_200
46+ return response_202
5147
5248 if response .status_code == 400 :
5349 response_400 = ErrorResponse .from_dict (response .json ())
@@ -97,7 +93,7 @@ def _parse_response(
9793
9894def _build_response (
9995 * , client : AuthenticatedClient | Client , response : httpx .Response
100- ) -> Response [ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse ]:
96+ ) -> Response [ErrorResponse | OperationEnvelope ]:
10197 return Response (
10298 status_code = HTTPStatus (response .status_code ),
10399 content = response .content ,
@@ -112,7 +108,7 @@ def sync_detailed(
112108 client : AuthenticatedClient ,
113109 body : BackfillPlanHistoryOperation ,
114110 idempotency_key : None | str | Unset = UNSET ,
115- ) -> Response [ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse ]:
111+ ) -> Response [ErrorResponse | OperationEnvelope ]:
116112 """Backfill Plan History
117113
118114 Compile monthly statement history behind the close boundary — the plan's historical columns. Seeds
@@ -122,7 +118,9 @@ def sync_detailed(
122118 call, oldest first — loop until `remaining_periods` comes back empty. Idempotent: already-stamped
123119 months are never touched. Months holding draft entries are skipped, never posted. `start_period` is
124120 clamped to the earliest month with ledger data, so deep-history tenants only backfill what actually
125- exists.
121+ exists. Runs on the background worker, since a chunk recloses up to 24 months: returns a `pending`
122+ envelope at once, and the result — the outcome per month and `remaining_periods`, or a refusal under
123+ `error` — arrives on `/v1/operations/{operation_id}/stream`.
126124
127125 **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
128126 return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -138,7 +136,7 @@ def sync_detailed(
138136 httpx.TimeoutException: If the request takes longer than Client.timeout.
139137
140138 Returns:
141- Response[ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse ]
139+ Response[ErrorResponse | OperationEnvelope ]
142140 """
143141
144142 kwargs = _get_kwargs (
@@ -160,7 +158,7 @@ def sync(
160158 client : AuthenticatedClient ,
161159 body : BackfillPlanHistoryOperation ,
162160 idempotency_key : None | str | Unset = UNSET ,
163- ) -> ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse | None :
161+ ) -> ErrorResponse | OperationEnvelope | None :
164162 """Backfill Plan History
165163
166164 Compile monthly statement history behind the close boundary — the plan's historical columns. Seeds
@@ -170,7 +168,9 @@ def sync(
170168 call, oldest first — loop until `remaining_periods` comes back empty. Idempotent: already-stamped
171169 months are never touched. Months holding draft entries are skipped, never posted. `start_period` is
172170 clamped to the earliest month with ledger data, so deep-history tenants only backfill what actually
173- exists.
171+ exists. Runs on the background worker, since a chunk recloses up to 24 months: returns a `pending`
172+ envelope at once, and the result — the outcome per month and `remaining_periods`, or a refusal under
173+ `error` — arrives on `/v1/operations/{operation_id}/stream`.
174174
175175 **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
176176 return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -186,7 +186,7 @@ def sync(
186186 httpx.TimeoutException: If the request takes longer than Client.timeout.
187187
188188 Returns:
189- ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse
189+ ErrorResponse | OperationEnvelope
190190 """
191191
192192 return sync_detailed (
@@ -203,7 +203,7 @@ async def asyncio_detailed(
203203 client : AuthenticatedClient ,
204204 body : BackfillPlanHistoryOperation ,
205205 idempotency_key : None | str | Unset = UNSET ,
206- ) -> Response [ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse ]:
206+ ) -> Response [ErrorResponse | OperationEnvelope ]:
207207 """Backfill Plan History
208208
209209 Compile monthly statement history behind the close boundary — the plan's historical columns. Seeds
@@ -213,7 +213,9 @@ async def asyncio_detailed(
213213 call, oldest first — loop until `remaining_periods` comes back empty. Idempotent: already-stamped
214214 months are never touched. Months holding draft entries are skipped, never posted. `start_period` is
215215 clamped to the earliest month with ledger data, so deep-history tenants only backfill what actually
216- exists.
216+ exists. Runs on the background worker, since a chunk recloses up to 24 months: returns a `pending`
217+ envelope at once, and the result — the outcome per month and `remaining_periods`, or a refusal under
218+ `error` — arrives on `/v1/operations/{operation_id}/stream`.
217219
218220 **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
219221 return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -229,7 +231,7 @@ async def asyncio_detailed(
229231 httpx.TimeoutException: If the request takes longer than Client.timeout.
230232
231233 Returns:
232- Response[ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse ]
234+ Response[ErrorResponse | OperationEnvelope ]
233235 """
234236
235237 kwargs = _get_kwargs (
@@ -249,7 +251,7 @@ async def asyncio(
249251 client : AuthenticatedClient ,
250252 body : BackfillPlanHistoryOperation ,
251253 idempotency_key : None | str | Unset = UNSET ,
252- ) -> ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse | None :
254+ ) -> ErrorResponse | OperationEnvelope | None :
253255 """Backfill Plan History
254256
255257 Compile monthly statement history behind the close boundary — the plan's historical columns. Seeds
@@ -259,7 +261,9 @@ async def asyncio(
259261 call, oldest first — loop until `remaining_periods` comes back empty. Idempotent: already-stamped
260262 months are never touched. Months holding draft entries are skipped, never posted. `start_period` is
261263 clamped to the earliest month with ledger data, so deep-history tenants only backfill what actually
262- exists.
264+ exists. Runs on the background worker, since a chunk recloses up to 24 months: returns a `pending`
265+ envelope at once, and the result — the outcome per month and `remaining_periods`, or a refusal under
266+ `error` — arrives on `/v1/operations/{operation_id}/stream`.
263267
264268 **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
265269 return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -275,7 +279,7 @@ async def asyncio(
275279 httpx.TimeoutException: If the request takes longer than Client.timeout.
276280
277281 Returns:
278- ErrorResponse | OperationEnvelopeBackfillPlanHistoryResponse
282+ ErrorResponse | OperationEnvelope
279283 """
280284
281285 return (
0 commit comments