Skip to main content

orvanta_api/apis/
bpmn_instance_api.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.1.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`broadcast_bpmn_signal`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BroadcastBpmnSignalError {
22    Status402(String),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`bulk_migrate_bpmn_instances`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum BulkMigrateBpmnInstancesError {
30    Status400(models::BpmnMigrationRefusal),
31    Status402(String),
32    UnknownValue(serde_json::Value),
33}
34
35/// struct for typed errors of method [`cancel_bpmn_instance`]
36#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum CancelBpmnInstanceError {
39    Status402(String),
40    UnknownValue(serde_json::Value),
41}
42
43/// struct for typed errors of method [`check_bpmn_instance_migration`]
44#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum CheckBpmnInstanceMigrationError {
47    Status402(String),
48    UnknownValue(serde_json::Value),
49}
50
51/// struct for typed errors of method [`check_bpmn_version_pair`]
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum CheckBpmnVersionPairError {
55    Status402(String),
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`claim_bpmn_user_task`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum ClaimBpmnUserTaskError {
63    Status400(String),
64    Status401(String),
65    Status402(String),
66    UnknownValue(serde_json::Value),
67}
68
69/// struct for typed errors of method [`complete_bpmn_user_task`]
70#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum CompleteBpmnUserTaskError {
73    Status400(String),
74    Status401(String),
75    Status402(String),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`deliver_bpmn_signal`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum DeliverBpmnSignalError {
83    Status402(String),
84    Status404(String),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_bpmn_flow_version_rollup`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetBpmnFlowVersionRollupError {
92    Status402(String),
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`get_bpmn_instance`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum GetBpmnInstanceError {
100    Status402(String),
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`get_bpmn_instance_status`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum GetBpmnInstanceStatusError {
108    Status402(String),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`get_bpmn_version_rollup`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum GetBpmnVersionRollupError {
116    Status402(String),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`list_bpmn_incidents`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum ListBpmnIncidentsError {
124    Status402(String),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`list_bpmn_instances`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum ListBpmnInstancesError {
132    Status402(String),
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`list_pending_bpmn_user_tasks`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum ListPendingBpmnUserTasksError {
140    Status402(String),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`migrate_bpmn_instance`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum MigrateBpmnInstanceError {
148    Status400(models::BpmnMigrationRefusal),
149    Status402(String),
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`plan_bpmn_instance_migration`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum PlanBpmnInstanceMigrationError {
157    Status402(String),
158    UnknownValue(serde_json::Value),
159}
160
161/// struct for typed errors of method [`plan_bpmn_version_pair_migration`]
162#[derive(Debug, Clone, Serialize, Deserialize)]
163#[serde(untagged)]
164pub enum PlanBpmnVersionPairMigrationError {
165    Status402(String),
166    UnknownValue(serde_json::Value),
167}
168
169/// struct for typed errors of method [`preview_bpmn_instance`]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum PreviewBpmnInstanceError {
173    Status400(models::BpmnValidationProblem),
174    Status402(String),
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`release_bpmn_user_task`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum ReleaseBpmnUserTaskError {
182    Status401(String),
183    Status402(String),
184    Status404(String),
185    UnknownValue(serde_json::Value),
186}
187
188/// struct for typed errors of method [`request_bpmn_instance_migration`]
189#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum RequestBpmnInstanceMigrationError {
192    Status400(models::BpmnMappingRefusal),
193    Status404(String),
194    Status402(String),
195    UnknownValue(serde_json::Value),
196}
197
198/// struct for typed errors of method [`retry_bpmn_incident`]
199#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum RetryBpmnIncidentError {
202    Status402(String),
203    UnknownValue(serde_json::Value),
204}
205
206/// struct for typed errors of method [`start_bpmn_instance`]
207#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum StartBpmnInstanceError {
210    Status402(String),
211    UnknownValue(serde_json::Value),
212}
213
214
215/// Flowable's `runtimeService.signalEventReceived(signalName, variables)`.  **There is deliberately no instance id in this path.** A signal is a broadcast, not a delivery: every process instance in the workspace with a live token parked on this signal name is released by one call — through an `intermediateCatchEvent`, or through an interrupting `boundaryEvent` on a running activity, and across *different* process definitions. Subscribers are found through the engine's derived subscription index (`bpmn_process_status.awaited_signals`), which is rewritten from the token set on every step, so an instance that has moved on or completed is absent rather than filtered.  Contrast `/instances/{id}/messages/{message_name}`, which keeps its instance segment: a message is point-to-point, and correlating one across instances would deliver it to the wrong process.  The body is the signal's variables object. A signal name nobody is subscribed to is **inert and successful** — a broadcast with no listeners is a normal outcome — so this never 404s on an unknown name. 
216pub async fn broadcast_bpmn_signal(configuration: &configuration::Configuration, workspace: &str, signal_name: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<String, Error<BroadcastBpmnSignalError>> {
217    let local_var_configuration = configuration;
218
219    let local_var_client = &local_var_configuration.client;
220
221    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/signals/{signal_name}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), signal_name=crate::apis::urlencode(signal_name));
222    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
223
224    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
225        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
226    }
227    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
228        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
229    };
230    local_var_req_builder = local_var_req_builder.json(&request_body);
231
232    let local_var_req = local_var_req_builder.build()?;
233    let local_var_resp = local_var_client.execute(local_var_req).await?;
234
235    let local_var_status = local_var_resp.status();
236    let local_var_content = local_var_resp.text().await?;
237
238    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
239        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
240    } else {
241        let local_var_entity: Option<BroadcastBpmnSignalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
242        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
243        Err(Error::ResponseError(local_var_error))
244    }
245}
246
247/// Bulk identity migration (#922). One validation for the whole batch, because eligibility is a property of the version pair, not of an instance. `from_version` is the whole bulk key -- a `bpmn_flow_version` row belongs to exactly one flow -- and both versions are checked to belong to the same flow before anything moves. Matching no running instance is a 200 with an empty `migrated`, not an error.
248pub async fn bulk_migrate_bpmn_instances(configuration: &configuration::Configuration, workspace: &str, bulk_migrate_bpmn_instances_request: models::BulkMigrateBpmnInstancesRequest) -> Result<models::BpmnMigrationResult, Error<BulkMigrateBpmnInstancesError>> {
249    let local_var_configuration = configuration;
250
251    let local_var_client = &local_var_configuration.client;
252
253    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/migrate", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
254    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
255
256    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
257        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
258    }
259    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
260        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
261    };
262    local_var_req_builder = local_var_req_builder.json(&bulk_migrate_bpmn_instances_request);
263
264    let local_var_req = local_var_req_builder.build()?;
265    let local_var_resp = local_var_client.execute(local_var_req).await?;
266
267    let local_var_status = local_var_resp.status();
268    let local_var_content = local_var_resp.text().await?;
269
270    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
271        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
272    } else {
273        let local_var_entity: Option<BulkMigrateBpmnInstancesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
274        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
275        Err(Error::ResponseError(local_var_error))
276    }
277}
278
279pub async fn cancel_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, id: &str, cancel_bpmn_instance: models::CancelBpmnInstance) -> Result<String, Error<CancelBpmnInstanceError>> {
280    let local_var_configuration = configuration;
281
282    let local_var_client = &local_var_configuration.client;
283
284    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/cancel/{id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
285    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
286
287    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
288        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
289    }
290    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
291        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
292    };
293    local_var_req_builder = local_var_req_builder.json(&cancel_bpmn_instance);
294
295    let local_var_req = local_var_req_builder.build()?;
296    let local_var_resp = local_var_client.execute(local_var_req).await?;
297
298    let local_var_status = local_var_resp.status();
299    let local_var_content = local_var_resp.text().await?;
300
301    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
302        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
303    } else {
304        let local_var_entity: Option<CancelBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
305        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
306        Err(Error::ResponseError(local_var_error))
307    }
308}
309
310/// The same per-pair verdict as checkBpmnVersionPair, but resolving this instance's own current pin and its runtime preconditions (it must not be an inline preview run, and it must still be running).
311pub async fn check_bpmn_instance_migration(configuration: &configuration::Configuration, workspace: &str, id: &str, target_version: i64) -> Result<models::BpmnMigrationCheck, Error<CheckBpmnInstanceMigrationError>> {
312    let local_var_configuration = configuration;
313
314    let local_var_client = &local_var_configuration.client;
315
316    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/migration/check", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
317    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
318
319    local_var_req_builder = local_var_req_builder.query(&[("target_version", &target_version.to_string())]);
320    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
321        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
322    }
323    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
324        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
325    };
326
327    let local_var_req = local_var_req_builder.build()?;
328    let local_var_resp = local_var_client.execute(local_var_req).await?;
329
330    let local_var_status = local_var_resp.status();
331    let local_var_content = local_var_resp.text().await?;
332
333    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
334        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
335    } else {
336        let local_var_entity: Option<CheckBpmnInstanceMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
337        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
338        Err(Error::ResponseError(local_var_error))
339    }
340}
341
342/// Runs the identity-migration contract (#922) over two compiled definitions of the same flow and reports every blocker, grouped by rule. Reads no runtime state at all, so the verdict is a property of the (from_version, to_version) *pair* and applies to every instance pinned to from_version -- which is what makes it answerable with no instance and cacheable per version.
343pub async fn check_bpmn_version_pair(configuration: &configuration::Configuration, workspace: &str, path: &str, from_version: i64, to_version: i64) -> Result<models::BpmnMigrationCheck, Error<CheckBpmnVersionPairError>> {
344    let local_var_configuration = configuration;
345
346    let local_var_client = &local_var_configuration.client;
347
348    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/migration/check/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
349    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
350
351    local_var_req_builder = local_var_req_builder.query(&[("from_version", &from_version.to_string())]);
352    local_var_req_builder = local_var_req_builder.query(&[("to_version", &to_version.to_string())]);
353    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
354        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
355    }
356    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
357        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
358    };
359
360    let local_var_req = local_var_req_builder.build()?;
361    let local_var_resp = local_var_client.execute(local_var_req).await?;
362
363    let local_var_status = local_var_resp.status();
364    let local_var_content = local_var_resp.text().await?;
365
366    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
367        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
368    } else {
369        let local_var_entity: Option<CheckBpmnVersionPairError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
370        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
371        Err(Error::ResponseError(local_var_error))
372    }
373}
374
375/// Take responsibility for a parked user task, so the rest of its candidate set stops filling in the same form (#1123).  **Claiming is optional and changes nothing about execution.** The engine does not read the claim ledger: a claim decides who the *API* lets complete a task. An unclaimed task stays completable by anyone in its audience, exactly as it was before — which is a deliberate divergence from Flowable, where a candidate must claim before completing. Making it mandatory here would have broken every client written against the completion operation.  A claim is on a **token**, not on an element. When the element holds exactly one park the body may be omitted; when it holds several (a multi-instance or parallel-branch task) `token_id` is required, and the error names the candidates. `token_id` comes from `PendingUserTask`.  The caller must already be in the task's audience: claiming is acting on the task, so anyone who could not complete it cannot take it out of circulation either. Claiming a task you already hold succeeds and changes nothing -- a retry must not read as a conflict.  The claim ledger is `human_task_claim`, keyed by a language-agnostic task reference so CMMN's `<humanTask>` (#714) shares it rather than growing a second table. 
376pub async fn claim_bpmn_user_task(configuration: &configuration::Configuration, workspace: &str, id: &str, user_task_id: &str, human_task_claim_request: Option<models::HumanTaskClaimRequest>) -> Result<String, Error<ClaimBpmnUserTaskError>> {
377    let local_var_configuration = configuration;
378
379    let local_var_client = &local_var_configuration.client;
380
381    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/user-tasks/{user_task_id}/claim", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id), user_task_id=crate::apis::urlencode(user_task_id));
382    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
383
384    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
385        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
386    }
387    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
388        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
389    };
390    local_var_req_builder = local_var_req_builder.json(&human_task_claim_request);
391
392    let local_var_req = local_var_req_builder.build()?;
393    let local_var_resp = local_var_client.execute(local_var_req).await?;
394
395    let local_var_status = local_var_resp.status();
396    let local_var_content = local_var_resp.text().await?;
397
398    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
399        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
400    } else {
401        let local_var_entity: Option<ClaimBpmnUserTaskError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
402        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
403        Err(Error::ResponseError(local_var_error))
404    }
405}
406
407/// Deliver a user task's form data and unpark the instance. The body is the completion payload; when the task declares form fields it is validated against them server-side (required fields, declared defaults, enum values -- see #833), unless the model sets `flowable:formFieldValidation=\"false\"`.  Since #1104 the caller must be in the task's declared audience. This was previously unenforced: anyone who could see an instance could complete any of its user tasks, including one assigned to somebody else.  Since #1275 a completion names the **park** it settles, not only the element. A `<userTask>` under `multiInstanceLoopCharacteristics`, or on a parallel branch, holds several parked tokens at one element id, each with its own resolved assignee (#1158) and its own claim (#1123) -- so an element-addressed completion could be applied to the wrong participant's token and record one person's decision as another's.  The rule, and it costs a shipped client nothing:  * **one park at the element** (the overwhelming majority) -- omit   `token_id`; it is resolved server-side and the request is exactly the   one that already worked; * **several parks** -- `token_id` is required, and omitting it is a   `400` naming the candidates rather than a guess; * **no park at all** -- delivered against the element, as before, so a   completion sent ahead of the token still waits for it.  `token_id` is a **query** parameter and not a body field, unlike the claim and release operations: this body is the caller's form data verbatim and every top-level key of it becomes a process variable (#819), so reserving a name inside it would take that name away from every form. 
408pub async fn complete_bpmn_user_task(configuration: &configuration::Configuration, workspace: &str, id: &str, user_task_id: &str, request_body: std::collections::HashMap<String, serde_json::Value>, token_id: Option<&str>) -> Result<String, Error<CompleteBpmnUserTaskError>> {
409    let local_var_configuration = configuration;
410
411    let local_var_client = &local_var_configuration.client;
412
413    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/user-tasks/{user_task_id}/complete", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id), user_task_id=crate::apis::urlencode(user_task_id));
414    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
415
416    if let Some(ref local_var_str) = token_id {
417        local_var_req_builder = local_var_req_builder.query(&[("token_id", &local_var_str.to_string())]);
418    }
419    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
420        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
421    }
422    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
423        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
424    };
425    local_var_req_builder = local_var_req_builder.json(&request_body);
426
427    let local_var_req = local_var_req_builder.build()?;
428    let local_var_resp = local_var_client.execute(local_var_req).await?;
429
430    let local_var_status = local_var_resp.status();
431    let local_var_content = local_var_resp.text().await?;
432
433    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
434        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
435    } else {
436        let local_var_entity: Option<CompleteBpmnUserTaskError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
437        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
438        Err(Error::ResponseError(local_var_error))
439    }
440}
441
442/// Flowable's targeted overload, `runtimeService.signalEventReceived(signalName, executionId, variables)`.  Still a broadcast *within* the named instance — every token of it subscribed to the name is released — but no other instance is woken. Use this when the signal is meant for one running process; use `/bpmn/signals/{signal_name}` when it is an event the whole workspace should hear.  404 if the instance has no runtime state yet, i.e. the engine has not picked it up, so there is nothing subscribed to signal. 
443pub async fn deliver_bpmn_signal(configuration: &configuration::Configuration, workspace: &str, id: &str, signal_name: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<String, Error<DeliverBpmnSignalError>> {
444    let local_var_configuration = configuration;
445
446    let local_var_client = &local_var_configuration.client;
447
448    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/signals/{signal_name}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id), signal_name=crate::apis::urlencode(signal_name));
449    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
450
451    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
452        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
453    }
454    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
455        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
456    };
457    local_var_req_builder = local_var_req_builder.json(&request_body);
458
459    let local_var_req = local_var_req_builder.build()?;
460    let local_var_resp = local_var_client.execute(local_var_req).await?;
461
462    let local_var_status = local_var_resp.status();
463    let local_var_content = local_var_resp.text().await?;
464
465    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
466        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
467    } else {
468        let local_var_entity: Option<DeliverBpmnSignalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
469        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
470        Err(Error::ResponseError(local_var_error))
471    }
472}
473
474/// #919, narrowed to a single flow. Identical shape to the workspace rollup. A flow that exists but has nothing running answers with an empty `flows` list, not a 404.
475pub async fn get_bpmn_flow_version_rollup(configuration: &configuration::Configuration, workspace: &str, path: &str, check: Option<bool>) -> Result<models::BpmnVersionRollup, Error<GetBpmnFlowVersionRollupError>> {
476    let local_var_configuration = configuration;
477
478    let local_var_client = &local_var_configuration.client;
479
480    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/version_rollup/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
481    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
482
483    if let Some(ref local_var_str) = check {
484        local_var_req_builder = local_var_req_builder.query(&[("check", &local_var_str.to_string())]);
485    }
486    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
487        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
488    }
489    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
490        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
491    };
492
493    let local_var_req = local_var_req_builder.build()?;
494    let local_var_resp = local_var_client.execute(local_var_req).await?;
495
496    let local_var_status = local_var_resp.status();
497    let local_var_content = local_var_resp.text().await?;
498
499    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
500        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
501    } else {
502        let local_var_entity: Option<GetBpmnFlowVersionRollupError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
503        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
504        Err(Error::ResponseError(local_var_error))
505    }
506}
507
508pub async fn get_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<models::BpmnInstanceDetail, Error<GetBpmnInstanceError>> {
509    let local_var_configuration = configuration;
510
511    let local_var_client = &local_var_configuration.client;
512
513    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/get/{id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
514    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
515
516    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
517        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
518    }
519    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
520        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
521    };
522
523    let local_var_req = local_var_req_builder.build()?;
524    let local_var_resp = local_var_client.execute(local_var_req).await?;
525
526    let local_var_status = local_var_resp.status();
527    let local_var_content = local_var_resp.text().await?;
528
529    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
530        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
531    } else {
532        let local_var_entity: Option<GetBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
533        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
534        Err(Error::ResponseError(local_var_error))
535    }
536}
537
538/// Frontend-facing projection of the process instance's live runtime state (lifecycle, per-activity status, variables, history, incidents), consumed by the live process token overlay. 404 if the instance isn't in the workspace, or if the engine has not picked it up yet (no runtime state).
539pub async fn get_bpmn_instance_status(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<models::ProcessInstanceStatus, Error<GetBpmnInstanceStatusError>> {
540    let local_var_configuration = configuration;
541
542    let local_var_client = &local_var_configuration.client;
543
544    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/get/{id}/status", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
545    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
546
547    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
548        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
549    }
550    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
551        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
552    };
553
554    let local_var_req = local_var_req_builder.build()?;
555    let local_var_resp = local_var_client.execute(local_var_req).await?;
556
557    let local_var_status = local_var_resp.status();
558    let local_var_content = local_var_resp.text().await?;
559
560    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
561        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
562    } else {
563        let local_var_entity: Option<GetBpmnInstanceStatusError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
564        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
565        Err(Error::ResponseError(local_var_error))
566    }
567}
568
569/// #919. Answers \"which of my running instances are on an old definition?\" for the whole workspace, and per pinned version whether it is migratable to that flow's latest and if not why (#922's validator, computed once per version because eligibility is a property of the (version, latest) pair rather than of an instance). Read-only.  An instance is pinned at start to one `bpmn_flow_version` (`v2_job.runnable_id`) and resolves its model from that row on every step, so instances complete on the version they started on while new starts use the latest. `runnable_id` is the source here, never the denormalised `bpmn_process_status.bpmn_version`, which the engine writes on insert and never refreshes.  \"Running\" means a root instance still queued and uncancelled -- the same set a bulk migrate would move. Inline preview runs are excluded: they carry their model on the job row and are on no version.
570pub async fn get_bpmn_version_rollup(configuration: &configuration::Configuration, workspace: &str, check: Option<bool>) -> Result<models::BpmnVersionRollup, Error<GetBpmnVersionRollupError>> {
571    let local_var_configuration = configuration;
572
573    let local_var_client = &local_var_configuration.client;
574
575    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/version_rollup", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
576    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
577
578    if let Some(ref local_var_str) = check {
579        local_var_req_builder = local_var_req_builder.query(&[("check", &local_var_str.to_string())]);
580    }
581    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
582        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
583    }
584    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
585        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
586    };
587
588    let local_var_req = local_var_req_builder.build()?;
589    let local_var_resp = local_var_client.execute(local_var_req).await?;
590
591    let local_var_status = local_var_resp.status();
592    let local_var_content = local_var_resp.text().await?;
593
594    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
595        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
596    } else {
597        let local_var_entity: Option<GetBpmnVersionRollupError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
598        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
599        Err(Error::ResponseError(local_var_error))
600    }
601}
602
603pub async fn list_bpmn_incidents(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<Vec<models::BpmnIncident>, Error<ListBpmnIncidentsError>> {
604    let local_var_configuration = configuration;
605
606    let local_var_client = &local_var_configuration.client;
607
608    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/incidents", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
609    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
610
611    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
612        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
613    }
614    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
615        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
616    };
617
618    let local_var_req = local_var_req_builder.build()?;
619    let local_var_resp = local_var_client.execute(local_var_req).await?;
620
621    let local_var_status = local_var_resp.status();
622    let local_var_content = local_var_resp.text().await?;
623
624    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
625        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
626    } else {
627        let local_var_entity: Option<ListBpmnIncidentsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
628        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
629        Err(Error::ResponseError(local_var_error))
630    }
631}
632
633pub async fn list_bpmn_instances(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::BpmnInstanceSummary>, Error<ListBpmnInstancesError>> {
634    let local_var_configuration = configuration;
635
636    let local_var_client = &local_var_configuration.client;
637
638    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
639    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
640
641    if let Some(ref local_var_str) = page {
642        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
643    }
644    if let Some(ref local_var_str) = per_page {
645        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
646    }
647    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
648        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
649    }
650    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
651        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
652    };
653
654    let local_var_req = local_var_req_builder.build()?;
655    let local_var_resp = local_var_client.execute(local_var_req).await?;
656
657    let local_var_status = local_var_resp.status();
658    let local_var_content = local_var_resp.text().await?;
659
660    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
661        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
662    } else {
663        let local_var_entity: Option<ListBpmnInstancesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
664        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
665        Err(Error::ResponseError(local_var_error))
666    }
667}
668
669/// Every `<userTask>` in the workspace that is parked awaiting a human and that the caller may act on (#1104). This is the read side the completion operation below always presumed: that operation is addressed by `(instance id, element id)`, which a human has no way to discover otherwise.  Filtering is **server-side and is the same rule the completion operation enforces**. A task is returned when the caller is an admin, when the task declares no assignment it can resolve, or when the caller matches a declared literal `assignee`/`owner`/`candidateUsers` entry or one of the `candidateGroups`.  An assignment written as an **expression** (`${approver}`) is resolved by the engine against process variables at the moment the token parks, and the resolved names are what the identity fields below carry. Since #1123 that resolution is **enforced**, not merely reported: a task whose `${approver}` resolved to `alice` is returned to alice and to admins, and to nobody else.  An expression the engine could **not** read (interpolation, a call, an unset variable) still falls back to instance visibility, sets `assignment_unresolved`, and is itemised with its reason in `unresolved_assignments`. Hiding such a task would leave a human task no human can reach, which is the defect #1104 fixed.  A claimed task (#1123) carries `claimed_by`/`claimed_at` and is still listed for everyone in its audience — so they can see it is taken — but only its holder and admins may complete it.  Pagination applies to process *instances*, not to tasks: one instance can hold several parked tasks on parallel branches.  `instance_id` narrows to a single instance (#718), server-side. Filtering the paginated workspace-wide list on the client would drop the tasks of any instance that fell on a later page -- a task silently missing from the one screen dedicated to that instance. The filter never widens the result: the audience rule and the caller's RLS still decide. 
670pub async fn list_pending_bpmn_user_tasks(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, instance_id: Option<&str>) -> Result<Vec<models::PendingUserTask>, Error<ListPendingBpmnUserTasksError>> {
671    let local_var_configuration = configuration;
672
673    let local_var_client = &local_var_configuration.client;
674
675    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/user-tasks/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
676    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
677
678    if let Some(ref local_var_str) = page {
679        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
680    }
681    if let Some(ref local_var_str) = per_page {
682        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
683    }
684    if let Some(ref local_var_str) = instance_id {
685        local_var_req_builder = local_var_req_builder.query(&[("instance_id", &local_var_str.to_string())]);
686    }
687    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
688        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
689    }
690    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
691        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
692    };
693
694    let local_var_req = local_var_req_builder.build()?;
695    let local_var_resp = local_var_client.execute(local_var_req).await?;
696
697    let local_var_status = local_var_resp.status();
698    let local_var_content = local_var_resp.text().await?;
699
700    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
701        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
702    } else {
703        let local_var_entity: Option<ListPendingBpmnUserTasksError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
704        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
705        Err(Error::ResponseError(local_var_error))
706    }
707}
708
709/// Validated pointer swap (#922). Validates the (current, target) pair against the identity-migration contract and, only if it passes, moves `v2_job.runnable_id` to the target version, refreshes the denormalised `bpmn_process_status.bpmn_version` (which no engine writer ever refreshes) and appends a `bpmn_instance_migration` ledger row -- all in one transaction. `process_status` is never written and `suspend_until` is never nudged; the instance runs on the target version from its next step, because the engine re-resolves the pinned definition on every step. A pair that fails the contract is refused with a 400 naming every offending identifier -- it is never migrated and flagged.
710pub async fn migrate_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, id: &str, migrate_bpmn_instance_request: models::MigrateBpmnInstanceRequest) -> Result<models::BpmnMigrationResult, Error<MigrateBpmnInstanceError>> {
711    let local_var_configuration = configuration;
712
713    let local_var_client = &local_var_configuration.client;
714
715    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/migrate", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
716    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
717
718    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
719        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
720    }
721    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
722        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
723    };
724    local_var_req_builder = local_var_req_builder.json(&migrate_bpmn_instance_request);
725
726    let local_var_req = local_var_req_builder.build()?;
727    let local_var_resp = local_var_client.execute(local_var_req).await?;
728
729    let local_var_status = local_var_resp.status();
730    let local_var_content = local_var_resp.text().await?;
731
732    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
733        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
734    } else {
735        let local_var_entity: Option<MigrateBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
736        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
737        Err(Error::ResponseError(local_var_error))
738    }
739}
740
741/// The same resolution as planBpmnVersionPairMigration, but resolving this instance's own current pin and its runtime preconditions (it must not be an inline preview run, and it must still be running). Writes nothing.
742pub async fn plan_bpmn_instance_migration(configuration: &configuration::Configuration, workspace: &str, id: &str, plan_bpmn_instance_migration_request: models::PlanBpmnInstanceMigrationRequest) -> Result<models::BpmnMigrationPlanCheck, Error<PlanBpmnInstanceMigrationError>> {
743    let local_var_configuration = configuration;
744
745    let local_var_client = &local_var_configuration.client;
746
747    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/migration/plan", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
748    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
749
750    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
751        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
752    }
753    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
754        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
755    };
756    local_var_req_builder = local_var_req_builder.json(&plan_bpmn_instance_migration_request);
757
758    let local_var_req = local_var_req_builder.build()?;
759    let local_var_resp = local_var_client.execute(local_var_req).await?;
760
761    let local_var_status = local_var_resp.status();
762    let local_var_content = local_var_resp.text().await?;
763
764    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
765        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
766    } else {
767        let local_var_entity: Option<PlanBpmnInstanceMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
768        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
769        Err(Error::ResponseError(local_var_error))
770    }
771}
772
773/// Runs the *mapped* migration contract (#925, stage 4) over two compiled definitions of the same flow and, if the document holds, returns the resolved substitution as a plan. `POST` because the mapping is a document rather than a query parameter -- the call reads two definitions and **writes nothing**. Where the identity contract (checkBpmnVersionPair) asks \"may this instance run on the target unchanged\", this asks the strictly larger \"may it run on the target after renaming the identifiers this document names\". It admits renames -- of elements, of sequence flows (derived from their endpoints, never declared) and of the process id -- and refuses every topological change: a deleted activity with no replacement, an N:1 merge, a cross-scope move, a changed set of incoming flows, a re-attached boundary event. An element the document does not name is implicitly mapped to its own id, and is then subject to every rule an explicit mapping is. An element that is neither named nor present in the target is a hard refusal (`activity_deleted`), never a silently dropped token. Rule 9 additionally refuses a mapping that renames an identifier away while the target version still defines it (which includes every permutation): the engine derives job, token and scope ids from these identifiers, so a later dispatch at the reused id would re-derive ids the instance has already used and hang there with no incident. A plan this returns is submitted with requestBpmnInstanceMigration.
774pub async fn plan_bpmn_version_pair_migration(configuration: &configuration::Configuration, workspace: &str, path: &str, plan_bpmn_version_pair_migration_request: models::PlanBpmnVersionPairMigrationRequest) -> Result<models::BpmnMigrationPlanCheck, Error<PlanBpmnVersionPairMigrationError>> {
775    let local_var_configuration = configuration;
776
777    let local_var_client = &local_var_configuration.client;
778
779    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/migration/plan/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
780    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
781
782    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
783        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
784    }
785    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
786        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
787    };
788    local_var_req_builder = local_var_req_builder.json(&plan_bpmn_version_pair_migration_request);
789
790    let local_var_req = local_var_req_builder.build()?;
791    let local_var_resp = local_var_client.execute(local_var_req).await?;
792
793    let local_var_status = local_var_resp.status();
794    let local_var_content = local_var_resp.text().await?;
795
796    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
797        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
798    } else {
799        let local_var_entity: Option<PlanBpmnVersionPairMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
800        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
801        Err(Error::ResponseError(local_var_error))
802    }
803}
804
805/// Start a process instance from an undeployed diagram (#710 stage 3), the \"run without deploying\" counterpart to `POST /bpmn/run/p/{path}`. The submitted XML is parsed and validated exactly as a real deploy would -- nothing is written to `bpmn_flow`/`bpmn_flow_version`.
806pub async fn preview_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, preview_bpmn_instance: models::PreviewBpmnInstance) -> Result<String, Error<PreviewBpmnInstanceError>> {
807    let local_var_configuration = configuration;
808
809    let local_var_client = &local_var_configuration.client;
810
811    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/run/preview", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
812    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
813
814    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
815        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
816    }
817    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
818        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
819    };
820    local_var_req_builder = local_var_req_builder.json(&preview_bpmn_instance);
821
822    let local_var_req = local_var_req_builder.build()?;
823    let local_var_resp = local_var_client.execute(local_var_req).await?;
824
825    let local_var_status = local_var_resp.status();
826    let local_var_content = local_var_resp.text().await?;
827
828    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
829        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
830    } else {
831        let local_var_entity: Option<PreviewBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
832        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
833        Err(Error::ResponseError(local_var_error))
834    }
835}
836
837/// Give a claimed user task back to its audience (#1123).  The holder can always release. An **admin** can release anybody's, and that escape hatch is what makes a claim safe to add: a claim held by someone who has left, gone on leave, or simply closed the tab must never be able to park a process forever.  Addressed the same way as the claim operation -- `token_id` may be omitted when the element holds exactly one park. 
838pub async fn release_bpmn_user_task(configuration: &configuration::Configuration, workspace: &str, id: &str, user_task_id: &str, human_task_claim_request: Option<models::HumanTaskClaimRequest>) -> Result<String, Error<ReleaseBpmnUserTaskError>> {
839    let local_var_configuration = configuration;
840
841    let local_var_client = &local_var_configuration.client;
842
843    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/user-tasks/{user_task_id}/release", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id), user_task_id=crate::apis::urlencode(user_task_id));
844    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
845
846    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
847        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
848    }
849    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
850        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
851    };
852    local_var_req_builder = local_var_req_builder.json(&human_task_claim_request);
853
854    let local_var_req = local_var_req_builder.build()?;
855    let local_var_resp = local_var_client.execute(local_var_req).await?;
856
857    let local_var_status = local_var_resp.status();
858    let local_var_content = local_var_resp.text().await?;
859
860    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
861        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
862    } else {
863        let local_var_entity: Option<ReleaseBpmnUserTaskError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
864        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
865        Err(Error::ResponseError(local_var_error))
866    }
867}
868
869/// The write half of the mapped migration contract (#925, stage 4). Resolves the mapping against this instance's own pin exactly as planBpmnInstanceMigration does and, only if it resolves to a plan, writes a migration **request** into `process_status.control.migrate` and pulls an existing park forward so the engine re-pulls the instance promptly. Validate-then-write in one transaction: a mapping that does not hold leaves nothing behind. Unlike migrateBpmnInstance this does **not** perform the migration. A mapped migration rewrites `process_status`, which the engine owns, so the pin move, the blob rewrite and the `bpmn_instance_migration` ledger row all happen together in the engine's next step. A 200 here means the request was accepted and stored, not that the instance has moved -- poll the pin, or the instance's status, to observe it. The stored request carries the **mapping document**, never the resolved plan. A plan is a bare identifier substitution, so a control entry carrying one would let anything able to write the control channel substitute arbitrary identifiers into a running instance; the engine re-derives the plan from the document against the two definitions it actually resolved. The `plan` in this response is informational. The engine can still refuse what this accepts, for the one reason that is not a property of the version pair: an activity `Started` on a renamed element holds a live child job id derived from the source id. That is refused at apply time and the signal is that the pin did not move. Everything that *is* a model-vs-model property, including rule 9 (vacating an identifier the target still defines), is refused here with a 400.
870pub async fn request_bpmn_instance_migration(configuration: &configuration::Configuration, workspace: &str, id: &str, request_bpmn_instance_migration_request: models::RequestBpmnInstanceMigrationRequest) -> Result<models::BpmnMigrationRequested, Error<RequestBpmnInstanceMigrationError>> {
871    let local_var_configuration = configuration;
872
873    let local_var_client = &local_var_configuration.client;
874
875    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/migration/request", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
876    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
877
878    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
879        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
880    }
881    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
882        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
883    };
884    local_var_req_builder = local_var_req_builder.json(&request_bpmn_instance_migration_request);
885
886    let local_var_req = local_var_req_builder.build()?;
887    let local_var_resp = local_var_client.execute(local_var_req).await?;
888
889    let local_var_status = local_var_resp.status();
890    let local_var_content = local_var_resp.text().await?;
891
892    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
893        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
894    } else {
895        let local_var_entity: Option<RequestBpmnInstanceMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
896        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
897        Err(Error::ResponseError(local_var_error))
898    }
899}
900
901/// Validates the ActivityFailed incident, identified by the original failed child job's id, and records a retry intent on the process instance. The execution engine does not yet act on this intent: retrying an incident is not yet functional end-to-end. This endpoint only validates ownership of the incident and records the intent for a future engine version to consume.
902pub async fn retry_bpmn_incident(configuration: &configuration::Configuration, workspace: &str, id: &str, job_id: &str) -> Result<String, Error<RetryBpmnIncidentError>> {
903    let local_var_configuration = configuration;
904
905    let local_var_client = &local_var_configuration.client;
906
907    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/{id}/incidents/{job_id}/retry", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id), job_id=crate::apis::urlencode(job_id));
908    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
909
910    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
911        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
912    }
913    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
914        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
915    };
916
917    let local_var_req = local_var_req_builder.build()?;
918    let local_var_resp = local_var_client.execute(local_var_req).await?;
919
920    let local_var_status = local_var_resp.status();
921    let local_var_content = local_var_resp.text().await?;
922
923    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
924        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
925    } else {
926        let local_var_entity: Option<RetryBpmnIncidentError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
927        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
928        Err(Error::ResponseError(local_var_error))
929    }
930}
931
932pub async fn start_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, path: &str, start_bpmn_instance: models::StartBpmnInstance) -> Result<String, Error<StartBpmnInstanceError>> {
933    let local_var_configuration = configuration;
934
935    let local_var_client = &local_var_configuration.client;
936
937    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/run/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
938    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
939
940    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
941        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
942    }
943    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
944        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
945    };
946    local_var_req_builder = local_var_req_builder.json(&start_bpmn_instance);
947
948    let local_var_req = local_var_req_builder.build()?;
949    let local_var_resp = local_var_client.execute(local_var_req).await?;
950
951    let local_var_status = local_var_resp.status();
952    let local_var_content = local_var_resp.text().await?;
953
954    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
955        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
956    } else {
957        let local_var_entity: Option<StartBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
958        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
959        Err(Error::ResponseError(local_var_error))
960    }
961}
962