1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ArchiveBpmnFlowByPathError {
22 Status402(String),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CreateBpmnFlowError {
30 Status400(models::BpmnValidationProblem),
31 Status402(String),
32 Status409(String),
33 UnknownValue(serde_json::Value),
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum DeleteBpmnFlowByPathError {
40 Status400(),
41 Status402(String),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum ExistsBpmnFlowByPathError {
49 Status402(String),
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetBpmnAuthoringGuideError {
57 Status402(String),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum GetBpmnFlowByPathError {
65 Status402(String),
66 UnknownValue(serde_json::Value),
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum GetBpmnFlowByPathWithDraftError {
73 Status402(String),
74 UnknownValue(serde_json::Value),
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum GetBpmnFlowHistoryError {
81 Status402(String),
82 UnknownValue(serde_json::Value),
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum GetBpmnFlowVersionError {
89 Status402(String),
90 UnknownValue(serde_json::Value),
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum ListBpmnFlowsError {
97 Status402(String),
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum ListBpmnPathsError {
105 Status402(String),
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum ListSearchBpmnFlowError {
113 Status402(String),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum UpdateBpmnFlowError {
121 Status400(models::BpmnValidationProblem),
122 Status402(String),
123 Status409(String),
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum ValidateBpmnFlowError {
131 Status402(String),
132 UnknownValue(serde_json::Value),
133}
134
135
136pub async fn archive_bpmn_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, archive_flow_by_path_request: models::ArchiveFlowByPathRequest) -> Result<String, Error<ArchiveBpmnFlowByPathError>> {
137 let local_var_configuration = configuration;
138
139 let local_var_client = &local_var_configuration.client;
140
141 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/archive/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
142 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
143
144 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
145 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
146 }
147 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
148 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
149 };
150 local_var_req_builder = local_var_req_builder.json(&archive_flow_by_path_request);
151
152 let local_var_req = local_var_req_builder.build()?;
153 let local_var_resp = local_var_client.execute(local_var_req).await?;
154
155 let local_var_status = local_var_resp.status();
156 let local_var_content = local_var_resp.text().await?;
157
158 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
159 crate::from_str_patched(&local_var_content).map_err(Error::from)
160 } else {
161 let local_var_entity: Option<ArchiveBpmnFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
162 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
163 Err(Error::ResponseError(local_var_error))
164 }
165}
166
167pub async fn create_bpmn_flow(configuration: &configuration::Configuration, workspace: &str, new_bpmn_flow: models::NewBpmnFlow) -> Result<models::BpmnDeployResult, Error<CreateBpmnFlowError>> {
168 let local_var_configuration = configuration;
169
170 let local_var_client = &local_var_configuration.client;
171
172 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
173 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
174
175 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
176 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
177 }
178 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
179 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
180 };
181 local_var_req_builder = local_var_req_builder.json(&new_bpmn_flow);
182
183 let local_var_req = local_var_req_builder.build()?;
184 let local_var_resp = local_var_client.execute(local_var_req).await?;
185
186 let local_var_status = local_var_resp.status();
187 let local_var_content = local_var_resp.text().await?;
188
189 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
190 crate::from_str_patched(&local_var_content).map_err(Error::from)
191 } else {
192 let local_var_entity: Option<CreateBpmnFlowError> = crate::from_str_patched(&local_var_content).ok();
193 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
194 Err(Error::ResponseError(local_var_error))
195 }
196}
197
198pub async fn delete_bpmn_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteBpmnFlowByPathError>> {
199 let local_var_configuration = configuration;
200
201 let local_var_client = &local_var_configuration.client;
202
203 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
204 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
205
206 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
207 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
208 }
209 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
210 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
211 };
212
213 let local_var_req = local_var_req_builder.build()?;
214 let local_var_resp = local_var_client.execute(local_var_req).await?;
215
216 let local_var_status = local_var_resp.status();
217 let local_var_content = local_var_resp.text().await?;
218
219 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
220 crate::from_str_patched(&local_var_content).map_err(Error::from)
221 } else {
222 let local_var_entity: Option<DeleteBpmnFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
223 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
224 Err(Error::ResponseError(local_var_error))
225 }
226}
227
228pub async fn exists_bpmn_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsBpmnFlowByPathError>> {
229 let local_var_configuration = configuration;
230
231 let local_var_client = &local_var_configuration.client;
232
233 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
234 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
235
236 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
237 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
238 }
239 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
240 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
241 };
242
243 let local_var_req = local_var_req_builder.build()?;
244 let local_var_resp = local_var_client.execute(local_var_req).await?;
245
246 let local_var_status = local_var_resp.status();
247 let local_var_content = local_var_resp.text().await?;
248
249 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
250 crate::from_str_patched(&local_var_content).map_err(Error::from)
251 } else {
252 let local_var_entity: Option<ExistsBpmnFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
253 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
254 Err(Error::ResponseError(local_var_error))
255 }
256}
257
258pub async fn get_bpmn_authoring_guide(configuration: &configuration::Configuration, workspace: &str) -> Result<models::BpmnAuthoringGuide, Error<GetBpmnAuthoringGuideError>> {
260 let local_var_configuration = configuration;
261
262 let local_var_client = &local_var_configuration.client;
263
264 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/authoring_guide", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
265 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
266
267 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
268 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
269 }
270 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
271 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
272 };
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(&local_var_content).map_err(Error::from)
282 } else {
283 let local_var_entity: Option<GetBpmnAuthoringGuideError> = crate::from_str_patched(&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 get_bpmn_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::BpmnFlow, Error<GetBpmnFlowByPathError>> {
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_flows/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
295 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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
304 let local_var_req = local_var_req_builder.build()?;
305 let local_var_resp = local_var_client.execute(local_var_req).await?;
306
307 let local_var_status = local_var_resp.status();
308 let local_var_content = local_var_resp.text().await?;
309
310 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
311 crate::from_str_patched(&local_var_content).map_err(Error::from)
312 } else {
313 let local_var_entity: Option<GetBpmnFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
314 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
315 Err(Error::ResponseError(local_var_error))
316 }
317}
318
319pub async fn get_bpmn_flow_by_path_with_draft(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::BpmnFlowWithDraft, Error<GetBpmnFlowByPathWithDraftError>> {
320 let local_var_configuration = configuration;
321
322 let local_var_client = &local_var_configuration.client;
323
324 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/get/draft/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
325 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
326
327 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
328 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
329 }
330 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
331 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
332 };
333
334 let local_var_req = local_var_req_builder.build()?;
335 let local_var_resp = local_var_client.execute(local_var_req).await?;
336
337 let local_var_status = local_var_resp.status();
338 let local_var_content = local_var_resp.text().await?;
339
340 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
341 crate::from_str_patched(&local_var_content).map_err(Error::from)
342 } else {
343 let local_var_entity: Option<GetBpmnFlowByPathWithDraftError> = crate::from_str_patched(&local_var_content).ok();
344 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
345 Err(Error::ResponseError(local_var_error))
346 }
347}
348
349pub async fn get_bpmn_flow_history(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::BpmnFlowVersion>, Error<GetBpmnFlowHistoryError>> {
350 let local_var_configuration = configuration;
351
352 let local_var_client = &local_var_configuration.client;
353
354 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/history/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
355 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
356
357 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
358 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
359 }
360 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
361 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
362 };
363
364 let local_var_req = local_var_req_builder.build()?;
365 let local_var_resp = local_var_client.execute(local_var_req).await?;
366
367 let local_var_status = local_var_resp.status();
368 let local_var_content = local_var_resp.text().await?;
369
370 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
371 crate::from_str_patched(&local_var_content).map_err(Error::from)
372 } else {
373 let local_var_entity: Option<GetBpmnFlowHistoryError> = crate::from_str_patched(&local_var_content).ok();
374 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
375 Err(Error::ResponseError(local_var_error))
376 }
377}
378
379pub async fn get_bpmn_flow_version(configuration: &configuration::Configuration, workspace: &str, version: i32, path: &str) -> Result<models::BpmnFlow, Error<GetBpmnFlowVersionError>> {
380 let local_var_configuration = configuration;
381
382 let local_var_client = &local_var_configuration.client;
383
384 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/get/v/{version}/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version, path=crate::apis::urlencode(path));
385 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
386
387 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
388 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
389 }
390 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
391 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
392 };
393
394 let local_var_req = local_var_req_builder.build()?;
395 let local_var_resp = local_var_client.execute(local_var_req).await?;
396
397 let local_var_status = local_var_resp.status();
398 let local_var_content = local_var_resp.text().await?;
399
400 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
401 crate::from_str_patched(&local_var_content).map_err(Error::from)
402 } else {
403 let local_var_entity: Option<GetBpmnFlowVersionError> = crate::from_str_patched(&local_var_content).ok();
404 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
405 Err(Error::ResponseError(local_var_error))
406 }
407}
408
409pub async fn list_bpmn_flows(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, order_desc: Option<bool>, path_start: Option<&str>, path_exact: Option<&str>, show_archived: Option<bool>, starred_only: Option<bool>, include_draft_only: Option<bool>, label: Option<&str>, edited_by: Option<&str>, without_description: Option<bool>, with_bpmn_xml: Option<bool>) -> Result<Vec<models::ListableBpmnFlow>, Error<ListBpmnFlowsError>> {
410 let local_var_configuration = configuration;
411
412 let local_var_client = &local_var_configuration.client;
413
414 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
415 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
416
417 if let Some(ref local_var_str) = page {
418 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
419 }
420 if let Some(ref local_var_str) = per_page {
421 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
422 }
423 if let Some(ref local_var_str) = order_desc {
424 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
425 }
426 if let Some(ref local_var_str) = path_start {
427 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
428 }
429 if let Some(ref local_var_str) = path_exact {
430 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
431 }
432 if let Some(ref local_var_str) = show_archived {
433 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
434 }
435 if let Some(ref local_var_str) = starred_only {
436 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
437 }
438 if let Some(ref local_var_str) = include_draft_only {
439 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
440 }
441 if let Some(ref local_var_str) = label {
442 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
443 }
444 if let Some(ref local_var_str) = edited_by {
445 local_var_req_builder = local_var_req_builder.query(&[("edited_by", &local_var_str.to_string())]);
446 }
447 if let Some(ref local_var_str) = without_description {
448 local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
449 }
450 if let Some(ref local_var_str) = with_bpmn_xml {
451 local_var_req_builder = local_var_req_builder.query(&[("with_bpmn_xml", &local_var_str.to_string())]);
452 }
453 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
454 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
455 }
456 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
457 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
458 };
459
460 let local_var_req = local_var_req_builder.build()?;
461 let local_var_resp = local_var_client.execute(local_var_req).await?;
462
463 let local_var_status = local_var_resp.status();
464 let local_var_content = local_var_resp.text().await?;
465
466 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
467 crate::from_str_patched(&local_var_content).map_err(Error::from)
468 } else {
469 let local_var_entity: Option<ListBpmnFlowsError> = crate::from_str_patched(&local_var_content).ok();
470 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
471 Err(Error::ResponseError(local_var_error))
472 }
473}
474
475pub async fn list_bpmn_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListBpmnPathsError>> {
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_flows/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
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_user_agent) = local_var_configuration.user_agent {
484 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
485 }
486 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
487 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
488 };
489
490 let local_var_req = local_var_req_builder.build()?;
491 let local_var_resp = local_var_client.execute(local_var_req).await?;
492
493 let local_var_status = local_var_resp.status();
494 let local_var_content = local_var_resp.text().await?;
495
496 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
497 crate::from_str_patched(&local_var_content).map_err(Error::from)
498 } else {
499 let local_var_entity: Option<ListBpmnPathsError> = crate::from_str_patched(&local_var_content).ok();
500 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
501 Err(Error::ResponseError(local_var_error))
502 }
503}
504
505pub async fn list_search_bpmn_flow(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchBpmnFlow200ResponseInner>, Error<ListSearchBpmnFlowError>> {
506 let local_var_configuration = configuration;
507
508 let local_var_client = &local_var_configuration.client;
509
510 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
511 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
512
513 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
514 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
515 }
516 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
517 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
518 };
519
520 let local_var_req = local_var_req_builder.build()?;
521 let local_var_resp = local_var_client.execute(local_var_req).await?;
522
523 let local_var_status = local_var_resp.status();
524 let local_var_content = local_var_resp.text().await?;
525
526 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
527 crate::from_str_patched(&local_var_content).map_err(Error::from)
528 } else {
529 let local_var_entity: Option<ListSearchBpmnFlowError> = crate::from_str_patched(&local_var_content).ok();
530 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
531 Err(Error::ResponseError(local_var_error))
532 }
533}
534
535pub async fn update_bpmn_flow(configuration: &configuration::Configuration, workspace: &str, path: &str, new_bpmn_flow: models::NewBpmnFlow) -> Result<models::BpmnDeployResult, Error<UpdateBpmnFlowError>> {
536 let local_var_configuration = configuration;
537
538 let local_var_client = &local_var_configuration.client;
539
540 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
541 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
542
543 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
544 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
545 }
546 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
547 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
548 };
549 local_var_req_builder = local_var_req_builder.json(&new_bpmn_flow);
550
551 let local_var_req = local_var_req_builder.build()?;
552 let local_var_resp = local_var_client.execute(local_var_req).await?;
553
554 let local_var_status = local_var_resp.status();
555 let local_var_content = local_var_resp.text().await?;
556
557 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
558 crate::from_str_patched(&local_var_content).map_err(Error::from)
559 } else {
560 let local_var_entity: Option<UpdateBpmnFlowError> = crate::from_str_patched(&local_var_content).ok();
561 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
562 Err(Error::ResponseError(local_var_error))
563 }
564}
565
566pub async fn validate_bpmn_flow(configuration: &configuration::Configuration, workspace: &str, bpmn_validation_request: models::BpmnValidationRequest) -> Result<models::BpmnValidationReport, Error<ValidateBpmnFlowError>> {
568 let local_var_configuration = configuration;
569
570 let local_var_client = &local_var_configuration.client;
571
572 let local_var_uri_str = format!("{}/w/{workspace}/bpmn_flows/validate", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
573 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
574
575 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
576 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
577 }
578 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
579 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
580 };
581 local_var_req_builder = local_var_req_builder.json(&bpmn_validation_request);
582
583 let local_var_req = local_var_req_builder.build()?;
584 let local_var_resp = local_var_client.execute(local_var_req).await?;
585
586 let local_var_status = local_var_resp.status();
587 let local_var_content = local_var_resp.text().await?;
588
589 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
590 crate::from_str_patched(&local_var_content).map_err(Error::from)
591 } else {
592 let local_var_entity: Option<ValidateBpmnFlowError> = crate::from_str_patched(&local_var_content).ok();
593 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
594 Err(Error::ResponseError(local_var_error))
595 }
596}
597