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: 6.5.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/// struct for typed errors of method [`start_bpmn_instance_by_message`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum StartBpmnInstanceByMessageError {
218    Status400(String),
219    Status403(String),
220    Status404(String),
221    UnknownValue(serde_json::Value),
222}
223
224
225/// 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. 
226pub 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>> {
227    let local_var_configuration = configuration;
228
229    let local_var_client = &local_var_configuration.client;
230
231    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));
232    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
233
234    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
235        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
236    }
237    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
238        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
239    };
240    local_var_req_builder = local_var_req_builder.json(&request_body);
241
242    let local_var_req = local_var_req_builder.build()?;
243    let local_var_resp = local_var_client.execute(local_var_req).await?;
244
245    let local_var_status = local_var_resp.status();
246    let local_var_content = local_var_resp.text().await?;
247
248    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
249        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
250    } else {
251        let local_var_entity: Option<BroadcastBpmnSignalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
252        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
253        Err(Error::ResponseError(local_var_error))
254    }
255}
256
257/// 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.
258pub async fn bulk_migrate_bpmn_instances(configuration: &configuration::Configuration, workspace: &str, bulk_migrate_bpmn_instances_request: models::BulkMigrateBpmnInstancesRequest) -> Result<models::BpmnMigrationResult, Error<BulkMigrateBpmnInstancesError>> {
259    let local_var_configuration = configuration;
260
261    let local_var_client = &local_var_configuration.client;
262
263    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/migrate", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
264    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
265
266    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
267        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
268    }
269    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
270        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
271    };
272    local_var_req_builder = local_var_req_builder.json(&bulk_migrate_bpmn_instances_request);
273
274    let local_var_req = local_var_req_builder.build()?;
275    let local_var_resp = local_var_client.execute(local_var_req).await?;
276
277    let local_var_status = local_var_resp.status();
278    let local_var_content = local_var_resp.text().await?;
279
280    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
281        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
282    } else {
283        let local_var_entity: Option<BulkMigrateBpmnInstancesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
284        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
285        Err(Error::ResponseError(local_var_error))
286    }
287}
288
289pub async fn cancel_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, id: &str, cancel_bpmn_instance: models::CancelBpmnInstance) -> Result<String, Error<CancelBpmnInstanceError>> {
290    let local_var_configuration = configuration;
291
292    let local_var_client = &local_var_configuration.client;
293
294    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));
295    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
296
297    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
298        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
299    }
300    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
301        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
302    };
303    local_var_req_builder = local_var_req_builder.json(&cancel_bpmn_instance);
304
305    let local_var_req = local_var_req_builder.build()?;
306    let local_var_resp = local_var_client.execute(local_var_req).await?;
307
308    let local_var_status = local_var_resp.status();
309    let local_var_content = local_var_resp.text().await?;
310
311    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
312        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
313    } else {
314        let local_var_entity: Option<CancelBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
315        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
316        Err(Error::ResponseError(local_var_error))
317    }
318}
319
320/// 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).
321pub async fn check_bpmn_instance_migration(configuration: &configuration::Configuration, workspace: &str, id: &str, target_version: i64) -> Result<models::BpmnMigrationCheck, Error<CheckBpmnInstanceMigrationError>> {
322    let local_var_configuration = configuration;
323
324    let local_var_client = &local_var_configuration.client;
325
326    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));
327    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
328
329    local_var_req_builder = local_var_req_builder.query(&[("target_version", &target_version.to_string())]);
330    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
331        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
332    }
333    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
334        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
335    };
336
337    let local_var_req = local_var_req_builder.build()?;
338    let local_var_resp = local_var_client.execute(local_var_req).await?;
339
340    let local_var_status = local_var_resp.status();
341    let local_var_content = local_var_resp.text().await?;
342
343    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
344        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
345    } else {
346        let local_var_entity: Option<CheckBpmnInstanceMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
347        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
348        Err(Error::ResponseError(local_var_error))
349    }
350}
351
352/// 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.
353pub async fn check_bpmn_version_pair(configuration: &configuration::Configuration, workspace: &str, path: &str, from_version: i64, to_version: i64) -> Result<models::BpmnMigrationCheck, Error<CheckBpmnVersionPairError>> {
354    let local_var_configuration = configuration;
355
356    let local_var_client = &local_var_configuration.client;
357
358    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));
359    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
360
361    local_var_req_builder = local_var_req_builder.query(&[("from_version", &from_version.to_string())]);
362    local_var_req_builder = local_var_req_builder.query(&[("to_version", &to_version.to_string())]);
363    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
364        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
365    }
366    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
367        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
368    };
369
370    let local_var_req = local_var_req_builder.build()?;
371    let local_var_resp = local_var_client.execute(local_var_req).await?;
372
373    let local_var_status = local_var_resp.status();
374    let local_var_content = local_var_resp.text().await?;
375
376    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
377        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
378    } else {
379        let local_var_entity: Option<CheckBpmnVersionPairError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
380        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
381        Err(Error::ResponseError(local_var_error))
382    }
383}
384
385/// 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. 
386pub 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>> {
387    let local_var_configuration = configuration;
388
389    let local_var_client = &local_var_configuration.client;
390
391    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));
392    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
393
394    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
395        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
396    }
397    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
398        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
399    };
400    local_var_req_builder = local_var_req_builder.json(&human_task_claim_request);
401
402    let local_var_req = local_var_req_builder.build()?;
403    let local_var_resp = local_var_client.execute(local_var_req).await?;
404
405    let local_var_status = local_var_resp.status();
406    let local_var_content = local_var_resp.text().await?;
407
408    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
409        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
410    } else {
411        let local_var_entity: Option<ClaimBpmnUserTaskError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
412        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
413        Err(Error::ResponseError(local_var_error))
414    }
415}
416
417/// 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. 
418pub 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>> {
419    let local_var_configuration = configuration;
420
421    let local_var_client = &local_var_configuration.client;
422
423    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));
424    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
425
426    if let Some(ref local_var_str) = token_id {
427        local_var_req_builder = local_var_req_builder.query(&[("token_id", &local_var_str.to_string())]);
428    }
429    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
430        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
431    }
432    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
433        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
434    };
435    local_var_req_builder = local_var_req_builder.json(&request_body);
436
437    let local_var_req = local_var_req_builder.build()?;
438    let local_var_resp = local_var_client.execute(local_var_req).await?;
439
440    let local_var_status = local_var_resp.status();
441    let local_var_content = local_var_resp.text().await?;
442
443    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
444        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
445    } else {
446        let local_var_entity: Option<CompleteBpmnUserTaskError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
447        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
448        Err(Error::ResponseError(local_var_error))
449    }
450}
451
452/// 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. 
453pub 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>> {
454    let local_var_configuration = configuration;
455
456    let local_var_client = &local_var_configuration.client;
457
458    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));
459    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
460
461    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
462        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
463    }
464    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
465        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
466    };
467    local_var_req_builder = local_var_req_builder.json(&request_body);
468
469    let local_var_req = local_var_req_builder.build()?;
470    let local_var_resp = local_var_client.execute(local_var_req).await?;
471
472    let local_var_status = local_var_resp.status();
473    let local_var_content = local_var_resp.text().await?;
474
475    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
476        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
477    } else {
478        let local_var_entity: Option<DeliverBpmnSignalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
479        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
480        Err(Error::ResponseError(local_var_error))
481    }
482}
483
484/// #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.
485pub async fn get_bpmn_flow_version_rollup(configuration: &configuration::Configuration, workspace: &str, path: &str, check: Option<bool>) -> Result<models::BpmnVersionRollup, Error<GetBpmnFlowVersionRollupError>> {
486    let local_var_configuration = configuration;
487
488    let local_var_client = &local_var_configuration.client;
489
490    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));
491    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
492
493    if let Some(ref local_var_str) = check {
494        local_var_req_builder = local_var_req_builder.query(&[("check", &local_var_str.to_string())]);
495    }
496    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
497        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
498    }
499    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
500        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
501    };
502
503    let local_var_req = local_var_req_builder.build()?;
504    let local_var_resp = local_var_client.execute(local_var_req).await?;
505
506    let local_var_status = local_var_resp.status();
507    let local_var_content = local_var_resp.text().await?;
508
509    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
510        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
511    } else {
512        let local_var_entity: Option<GetBpmnFlowVersionRollupError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
513        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
514        Err(Error::ResponseError(local_var_error))
515    }
516}
517
518pub async fn get_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<models::BpmnInstanceDetail, Error<GetBpmnInstanceError>> {
519    let local_var_configuration = configuration;
520
521    let local_var_client = &local_var_configuration.client;
522
523    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));
524    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
525
526    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
527        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
528    }
529    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
530        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
531    };
532
533    let local_var_req = local_var_req_builder.build()?;
534    let local_var_resp = local_var_client.execute(local_var_req).await?;
535
536    let local_var_status = local_var_resp.status();
537    let local_var_content = local_var_resp.text().await?;
538
539    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
540        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
541    } else {
542        let local_var_entity: Option<GetBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
543        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
544        Err(Error::ResponseError(local_var_error))
545    }
546}
547
548/// 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).
549pub async fn get_bpmn_instance_status(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<models::ProcessInstanceStatus, Error<GetBpmnInstanceStatusError>> {
550    let local_var_configuration = configuration;
551
552    let local_var_client = &local_var_configuration.client;
553
554    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));
555    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
556
557    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
558        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
559    }
560    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
561        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
562    };
563
564    let local_var_req = local_var_req_builder.build()?;
565    let local_var_resp = local_var_client.execute(local_var_req).await?;
566
567    let local_var_status = local_var_resp.status();
568    let local_var_content = local_var_resp.text().await?;
569
570    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
571        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
572    } else {
573        let local_var_entity: Option<GetBpmnInstanceStatusError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
574        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
575        Err(Error::ResponseError(local_var_error))
576    }
577}
578
579/// #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.
580pub async fn get_bpmn_version_rollup(configuration: &configuration::Configuration, workspace: &str, check: Option<bool>) -> Result<models::BpmnVersionRollup, Error<GetBpmnVersionRollupError>> {
581    let local_var_configuration = configuration;
582
583    let local_var_client = &local_var_configuration.client;
584
585    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/version_rollup", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
586    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
587
588    if let Some(ref local_var_str) = check {
589        local_var_req_builder = local_var_req_builder.query(&[("check", &local_var_str.to_string())]);
590    }
591    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
592        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
593    }
594    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
595        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
596    };
597
598    let local_var_req = local_var_req_builder.build()?;
599    let local_var_resp = local_var_client.execute(local_var_req).await?;
600
601    let local_var_status = local_var_resp.status();
602    let local_var_content = local_var_resp.text().await?;
603
604    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
605        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
606    } else {
607        let local_var_entity: Option<GetBpmnVersionRollupError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
608        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
609        Err(Error::ResponseError(local_var_error))
610    }
611}
612
613pub async fn list_bpmn_incidents(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<Vec<models::BpmnIncident>, Error<ListBpmnIncidentsError>> {
614    let local_var_configuration = configuration;
615
616    let local_var_client = &local_var_configuration.client;
617
618    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));
619    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
620
621    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
622        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
623    }
624    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
625        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
626    };
627
628    let local_var_req = local_var_req_builder.build()?;
629    let local_var_resp = local_var_client.execute(local_var_req).await?;
630
631    let local_var_status = local_var_resp.status();
632    let local_var_content = local_var_resp.text().await?;
633
634    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
635        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
636    } else {
637        let local_var_entity: Option<ListBpmnIncidentsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
638        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
639        Err(Error::ResponseError(local_var_error))
640    }
641}
642
643pub async fn list_bpmn_instances(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::BpmnInstanceSummary>, Error<ListBpmnInstancesError>> {
644    let local_var_configuration = configuration;
645
646    let local_var_client = &local_var_configuration.client;
647
648    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/instances/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
649    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
650
651    if let Some(ref local_var_str) = page {
652        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
653    }
654    if let Some(ref local_var_str) = per_page {
655        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
656    }
657    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
658        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
659    }
660    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
661        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
662    };
663
664    let local_var_req = local_var_req_builder.build()?;
665    let local_var_resp = local_var_client.execute(local_var_req).await?;
666
667    let local_var_status = local_var_resp.status();
668    let local_var_content = local_var_resp.text().await?;
669
670    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
671        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
672    } else {
673        let local_var_entity: Option<ListBpmnInstancesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
674        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
675        Err(Error::ResponseError(local_var_error))
676    }
677}
678
679/// 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. 
680pub 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>> {
681    let local_var_configuration = configuration;
682
683    let local_var_client = &local_var_configuration.client;
684
685    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/user-tasks/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
686    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
687
688    if let Some(ref local_var_str) = page {
689        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
690    }
691    if let Some(ref local_var_str) = per_page {
692        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
693    }
694    if let Some(ref local_var_str) = instance_id {
695        local_var_req_builder = local_var_req_builder.query(&[("instance_id", &local_var_str.to_string())]);
696    }
697    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
698        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
699    }
700    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
701        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
702    };
703
704    let local_var_req = local_var_req_builder.build()?;
705    let local_var_resp = local_var_client.execute(local_var_req).await?;
706
707    let local_var_status = local_var_resp.status();
708    let local_var_content = local_var_resp.text().await?;
709
710    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
711        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
712    } else {
713        let local_var_entity: Option<ListPendingBpmnUserTasksError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
714        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
715        Err(Error::ResponseError(local_var_error))
716    }
717}
718
719/// 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.
720pub async fn migrate_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, id: &str, migrate_bpmn_instance_request: models::MigrateBpmnInstanceRequest) -> Result<models::BpmnMigrationResult, Error<MigrateBpmnInstanceError>> {
721    let local_var_configuration = configuration;
722
723    let local_var_client = &local_var_configuration.client;
724
725    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));
726    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
727
728    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
729        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
730    }
731    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
732        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
733    };
734    local_var_req_builder = local_var_req_builder.json(&migrate_bpmn_instance_request);
735
736    let local_var_req = local_var_req_builder.build()?;
737    let local_var_resp = local_var_client.execute(local_var_req).await?;
738
739    let local_var_status = local_var_resp.status();
740    let local_var_content = local_var_resp.text().await?;
741
742    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
743        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
744    } else {
745        let local_var_entity: Option<MigrateBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
746        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
747        Err(Error::ResponseError(local_var_error))
748    }
749}
750
751/// 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.
752pub 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>> {
753    let local_var_configuration = configuration;
754
755    let local_var_client = &local_var_configuration.client;
756
757    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));
758    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
759
760    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
761        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
762    }
763    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
764        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
765    };
766    local_var_req_builder = local_var_req_builder.json(&plan_bpmn_instance_migration_request);
767
768    let local_var_req = local_var_req_builder.build()?;
769    let local_var_resp = local_var_client.execute(local_var_req).await?;
770
771    let local_var_status = local_var_resp.status();
772    let local_var_content = local_var_resp.text().await?;
773
774    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
775        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
776    } else {
777        let local_var_entity: Option<PlanBpmnInstanceMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
778        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
779        Err(Error::ResponseError(local_var_error))
780    }
781}
782
783/// 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.
784pub 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>> {
785    let local_var_configuration = configuration;
786
787    let local_var_client = &local_var_configuration.client;
788
789    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));
790    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
791
792    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
793        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
794    }
795    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
796        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
797    };
798    local_var_req_builder = local_var_req_builder.json(&plan_bpmn_version_pair_migration_request);
799
800    let local_var_req = local_var_req_builder.build()?;
801    let local_var_resp = local_var_client.execute(local_var_req).await?;
802
803    let local_var_status = local_var_resp.status();
804    let local_var_content = local_var_resp.text().await?;
805
806    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
807        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
808    } else {
809        let local_var_entity: Option<PlanBpmnVersionPairMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
810        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
811        Err(Error::ResponseError(local_var_error))
812    }
813}
814
815/// 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`.
816pub async fn preview_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, preview_bpmn_instance: models::PreviewBpmnInstance) -> Result<String, Error<PreviewBpmnInstanceError>> {
817    let local_var_configuration = configuration;
818
819    let local_var_client = &local_var_configuration.client;
820
821    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/run/preview", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
822    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
823
824    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
825        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
826    }
827    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
828        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
829    };
830    local_var_req_builder = local_var_req_builder.json(&preview_bpmn_instance);
831
832    let local_var_req = local_var_req_builder.build()?;
833    let local_var_resp = local_var_client.execute(local_var_req).await?;
834
835    let local_var_status = local_var_resp.status();
836    let local_var_content = local_var_resp.text().await?;
837
838    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
839        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
840    } else {
841        let local_var_entity: Option<PreviewBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
842        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
843        Err(Error::ResponseError(local_var_error))
844    }
845}
846
847/// 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. 
848pub 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>> {
849    let local_var_configuration = configuration;
850
851    let local_var_client = &local_var_configuration.client;
852
853    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));
854    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
855
856    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
857        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
858    }
859    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
860        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
861    };
862    local_var_req_builder = local_var_req_builder.json(&human_task_claim_request);
863
864    let local_var_req = local_var_req_builder.build()?;
865    let local_var_resp = local_var_client.execute(local_var_req).await?;
866
867    let local_var_status = local_var_resp.status();
868    let local_var_content = local_var_resp.text().await?;
869
870    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
871        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
872    } else {
873        let local_var_entity: Option<ReleaseBpmnUserTaskError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
874        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
875        Err(Error::ResponseError(local_var_error))
876    }
877}
878
879/// 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.
880pub 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>> {
881    let local_var_configuration = configuration;
882
883    let local_var_client = &local_var_configuration.client;
884
885    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));
886    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
887
888    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
889        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
890    }
891    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
892        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
893    };
894    local_var_req_builder = local_var_req_builder.json(&request_bpmn_instance_migration_request);
895
896    let local_var_req = local_var_req_builder.build()?;
897    let local_var_resp = local_var_client.execute(local_var_req).await?;
898
899    let local_var_status = local_var_resp.status();
900    let local_var_content = local_var_resp.text().await?;
901
902    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
903        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
904    } else {
905        let local_var_entity: Option<RequestBpmnInstanceMigrationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
906        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
907        Err(Error::ResponseError(local_var_error))
908    }
909}
910
911/// 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.
912pub async fn retry_bpmn_incident(configuration: &configuration::Configuration, workspace: &str, id: &str, job_id: &str) -> Result<String, Error<RetryBpmnIncidentError>> {
913    let local_var_configuration = configuration;
914
915    let local_var_client = &local_var_configuration.client;
916
917    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));
918    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
919
920    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
921        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
922    }
923    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
924        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
925    };
926
927    let local_var_req = local_var_req_builder.build()?;
928    let local_var_resp = local_var_client.execute(local_var_req).await?;
929
930    let local_var_status = local_var_resp.status();
931    let local_var_content = local_var_resp.text().await?;
932
933    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
934        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
935    } else {
936        let local_var_entity: Option<RetryBpmnIncidentError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
937        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
938        Err(Error::ResponseError(local_var_error))
939    }
940}
941
942pub async fn start_bpmn_instance(configuration: &configuration::Configuration, workspace: &str, path: &str, start_bpmn_instance: models::StartBpmnInstance) -> Result<String, Error<StartBpmnInstanceError>> {
943    let local_var_configuration = configuration;
944
945    let local_var_client = &local_var_configuration.client;
946
947    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));
948    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
949
950    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
951        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
952    }
953    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
954        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
955    };
956    local_var_req_builder = local_var_req_builder.json(&start_bpmn_instance);
957
958    let local_var_req = local_var_req_builder.build()?;
959    let local_var_resp = local_var_client.execute(local_var_req).await?;
960
961    let local_var_status = local_var_resp.status();
962    let local_var_content = local_var_resp.text().await?;
963
964    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
965        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
966    } else {
967        let local_var_entity: Option<StartBpmnInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
968        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
969        Err(Error::ResponseError(local_var_error))
970    }
971}
972
973/// Start a new instance of the deployed flow whose top-level message start event subscribes to `message_name` (#2040): the `name` of the `<message>` its `messageEventDefinition` references.  **This never correlates to a running instance.** It only creates one. To deliver a message to an instance that is already waiting, use `/instances/{id}/messages/{message_name}`.  A message name starts exactly one definition per workspace (a deploy claiming a name another live flow holds is refused), and the latest deployed version of it. Only a workspace admin may deploy a flow that claims a message name (`MessageStartRequiresAdmin`). The body's `flow_input` becomes the instance's start variables. The caller needs the same right as starting that flow by path (`bpmn_flows:run:<path>`) and the instance runs as the caller.  The response body is the bare instance id, as for `/run/p/{path}`; the `X-Orvanta-Process-Path` response header names the flow that was started, so a sender can see which process its message ran. 
974pub async fn start_bpmn_instance_by_message(configuration: &configuration::Configuration, workspace: &str, message_name: &str, start_bpmn_instance_by_message: models::StartBpmnInstanceByMessage) -> Result<String, Error<StartBpmnInstanceByMessageError>> {
975    let local_var_configuration = configuration;
976
977    let local_var_client = &local_var_configuration.client;
978
979    let local_var_uri_str = format!("{}/w/{workspace}/bpmn/run/message/{message_name}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), message_name=crate::apis::urlencode(message_name));
980    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
981
982    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
983        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
984    }
985    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
986        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
987    };
988    local_var_req_builder = local_var_req_builder.json(&start_bpmn_instance_by_message);
989
990    let local_var_req = local_var_req_builder.build()?;
991    let local_var_resp = local_var_client.execute(local_var_req).await?;
992
993    let local_var_status = local_var_resp.status();
994    let local_var_content = local_var_resp.text().await?;
995
996    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
997        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
998    } else {
999        let local_var_entity: Option<StartBpmnInstanceByMessageError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1000        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1001        Err(Error::ResponseError(local_var_error))
1002    }
1003}
1004