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 ArchiveFlowByPathError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CreateFlowError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteFlowByPathError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ExistsFlowByPathError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetFlowByPathError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetFlowByPathWithDraftError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetFlowDeploymentStatusError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetFlowHistoryError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetFlowLatestVersionError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetFlowVersionError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetHubFlowByIdError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetTriggersCountOfFlowError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ListFlowPathsError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum ListFlowPathsFromWorkspaceRunnableError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ListFlowsError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum ListHubFlowsError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ListSearchFlowError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum ListTokensOfFlowError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ToggleWorkspaceErrorHandlerForFlowError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum UpdateFlowError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum UpdateFlowHistoryError {
162 UnknownValue(serde_json::Value),
163}
164
165
166pub async fn archive_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, archive_flow_by_path_request: models::ArchiveFlowByPathRequest) -> Result<String, Error<ArchiveFlowByPathError>> {
167 let local_var_configuration = configuration;
168
169 let local_var_client = &local_var_configuration.client;
170
171 let local_var_uri_str = format!("{}/w/{workspace}/flows/archive/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
172 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
173
174 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
175 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
176 }
177 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
178 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
179 };
180 local_var_req_builder = local_var_req_builder.json(&archive_flow_by_path_request);
181
182 let local_var_req = local_var_req_builder.build()?;
183 let local_var_resp = local_var_client.execute(local_var_req).await?;
184
185 let local_var_status = local_var_resp.status();
186 let local_var_content = local_var_resp.text().await?;
187
188 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
189 crate::from_str_patched(&local_var_content).map_err(Error::from)
190 } else {
191 let local_var_entity: Option<ArchiveFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
192 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
193 Err(Error::ResponseError(local_var_error))
194 }
195}
196
197pub async fn create_flow(configuration: &configuration::Configuration, workspace: &str, create_flow_request: models::CreateFlowRequest) -> Result<String, Error<CreateFlowError>> {
198 let local_var_configuration = configuration;
199
200 let local_var_client = &local_var_configuration.client;
201
202 let local_var_uri_str = format!("{}/w/{workspace}/flows/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
203 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
204
205 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
206 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
207 }
208 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
209 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
210 };
211 local_var_req_builder = local_var_req_builder.json(&create_flow_request);
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<CreateFlowError> = 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 delete_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, keep_captures: Option<bool>) -> Result<String, Error<DeleteFlowByPathError>> {
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}/flows/delete/{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::DELETE, local_var_uri_str.as_str());
235
236 if let Some(ref local_var_str) = keep_captures {
237 local_var_req_builder = local_var_req_builder.query(&[("keep_captures", &local_var_str.to_string())]);
238 }
239 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
240 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
241 }
242 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
243 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
244 };
245
246 let local_var_req = local_var_req_builder.build()?;
247 let local_var_resp = local_var_client.execute(local_var_req).await?;
248
249 let local_var_status = local_var_resp.status();
250 let local_var_content = local_var_resp.text().await?;
251
252 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
253 crate::from_str_patched(&local_var_content).map_err(Error::from)
254 } else {
255 let local_var_entity: Option<DeleteFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
256 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
257 Err(Error::ResponseError(local_var_error))
258 }
259}
260
261pub async fn exists_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsFlowByPathError>> {
262 let local_var_configuration = configuration;
263
264 let local_var_client = &local_var_configuration.client;
265
266 let local_var_uri_str = format!("{}/w/{workspace}/flows/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
267 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
268
269 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
270 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
271 }
272 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
273 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
274 };
275
276 let local_var_req = local_var_req_builder.build()?;
277 let local_var_resp = local_var_client.execute(local_var_req).await?;
278
279 let local_var_status = local_var_resp.status();
280 let local_var_content = local_var_resp.text().await?;
281
282 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
283 crate::from_str_patched(&local_var_content).map_err(Error::from)
284 } else {
285 let local_var_entity: Option<ExistsFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
286 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
287 Err(Error::ResponseError(local_var_error))
288 }
289}
290
291pub async fn get_flow_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, with_starred_info: Option<bool>) -> Result<models::Flow, Error<GetFlowByPathError>> {
292 let local_var_configuration = configuration;
293
294 let local_var_client = &local_var_configuration.client;
295
296 let local_var_uri_str = format!("{}/w/{workspace}/flows/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
297 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
298
299 if let Some(ref local_var_str) = with_starred_info {
300 local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
301 }
302 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
303 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
304 }
305 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
306 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
307 };
308
309 let local_var_req = local_var_req_builder.build()?;
310 let local_var_resp = local_var_client.execute(local_var_req).await?;
311
312 let local_var_status = local_var_resp.status();
313 let local_var_content = local_var_resp.text().await?;
314
315 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
316 crate::from_str_patched(&local_var_content).map_err(Error::from)
317 } else {
318 let local_var_entity: Option<GetFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
319 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
320 Err(Error::ResponseError(local_var_error))
321 }
322}
323
324pub async fn get_flow_by_path_with_draft(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::GetFlowByPathWithDraft200Response, Error<GetFlowByPathWithDraftError>> {
325 let local_var_configuration = configuration;
326
327 let local_var_client = &local_var_configuration.client;
328
329 let local_var_uri_str = format!("{}/w/{workspace}/flows/get/draft/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
330 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
331
332 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
333 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
334 }
335 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
336 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
337 };
338
339 let local_var_req = local_var_req_builder.build()?;
340 let local_var_resp = local_var_client.execute(local_var_req).await?;
341
342 let local_var_status = local_var_resp.status();
343 let local_var_content = local_var_resp.text().await?;
344
345 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
346 crate::from_str_patched(&local_var_content).map_err(Error::from)
347 } else {
348 let local_var_entity: Option<GetFlowByPathWithDraftError> = crate::from_str_patched(&local_var_content).ok();
349 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
350 Err(Error::ResponseError(local_var_error))
351 }
352}
353
354pub async fn get_flow_deployment_status(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::GetFlowDeploymentStatus200Response, Error<GetFlowDeploymentStatusError>> {
355 let local_var_configuration = configuration;
356
357 let local_var_client = &local_var_configuration.client;
358
359 let local_var_uri_str = format!("{}/w/{workspace}/flows/deployment_status/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
360 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
361
362 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
363 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
364 }
365 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
366 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
367 };
368
369 let local_var_req = local_var_req_builder.build()?;
370 let local_var_resp = local_var_client.execute(local_var_req).await?;
371
372 let local_var_status = local_var_resp.status();
373 let local_var_content = local_var_resp.text().await?;
374
375 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
376 crate::from_str_patched(&local_var_content).map_err(Error::from)
377 } else {
378 let local_var_entity: Option<GetFlowDeploymentStatusError> = crate::from_str_patched(&local_var_content).ok();
379 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
380 Err(Error::ResponseError(local_var_error))
381 }
382}
383
384pub async fn get_flow_history(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::FlowVersion>, Error<GetFlowHistoryError>> {
385 let local_var_configuration = configuration;
386
387 let local_var_client = &local_var_configuration.client;
388
389 let local_var_uri_str = format!("{}/w/{workspace}/flows/history/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
390 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
391
392 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
393 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
394 }
395 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
396 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
397 };
398
399 let local_var_req = local_var_req_builder.build()?;
400 let local_var_resp = local_var_client.execute(local_var_req).await?;
401
402 let local_var_status = local_var_resp.status();
403 let local_var_content = local_var_resp.text().await?;
404
405 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
406 crate::from_str_patched(&local_var_content).map_err(Error::from)
407 } else {
408 let local_var_entity: Option<GetFlowHistoryError> = crate::from_str_patched(&local_var_content).ok();
409 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
410 Err(Error::ResponseError(local_var_error))
411 }
412}
413
414pub async fn get_flow_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::FlowVersion, Error<GetFlowLatestVersionError>> {
415 let local_var_configuration = configuration;
416
417 let local_var_client = &local_var_configuration.client;
418
419 let local_var_uri_str = format!("{}/w/{workspace}/flows/get_latest_version/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
420 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
421
422 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
423 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
424 }
425 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
426 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
427 };
428
429 let local_var_req = local_var_req_builder.build()?;
430 let local_var_resp = local_var_client.execute(local_var_req).await?;
431
432 let local_var_status = local_var_resp.status();
433 let local_var_content = local_var_resp.text().await?;
434
435 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
436 crate::from_str_patched(&local_var_content).map_err(Error::from)
437 } else {
438 let local_var_entity: Option<GetFlowLatestVersionError> = crate::from_str_patched(&local_var_content).ok();
439 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
440 Err(Error::ResponseError(local_var_error))
441 }
442}
443
444pub async fn get_flow_version(configuration: &configuration::Configuration, workspace: &str, version: f64, path: &str) -> Result<models::Flow, Error<GetFlowVersionError>> {
445 let local_var_configuration = configuration;
446
447 let local_var_client = &local_var_configuration.client;
448
449 let local_var_uri_str = format!("{}/w/{workspace}/flows/get/v/{version}/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version, path=crate::apis::urlencode(path));
450 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
451
452 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
453 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
454 }
455 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
456 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
457 };
458
459 let local_var_req = local_var_req_builder.build()?;
460 let local_var_resp = local_var_client.execute(local_var_req).await?;
461
462 let local_var_status = local_var_resp.status();
463 let local_var_content = local_var_resp.text().await?;
464
465 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
466 crate::from_str_patched(&local_var_content).map_err(Error::from)
467 } else {
468 let local_var_entity: Option<GetFlowVersionError> = crate::from_str_patched(&local_var_content).ok();
469 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
470 Err(Error::ResponseError(local_var_error))
471 }
472}
473
474pub async fn get_hub_flow_by_id(configuration: &configuration::Configuration, id: i32) -> Result<models::GetHubFlowById200Response, Error<GetHubFlowByIdError>> {
475 let local_var_configuration = configuration;
476
477 let local_var_client = &local_var_configuration.client;
478
479 let local_var_uri_str = format!("{}/flows/hub/get/{id}", local_var_configuration.base_path, id=id);
480 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
481
482 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
483 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
484 }
485 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
486 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
487 };
488
489 let local_var_req = local_var_req_builder.build()?;
490 let local_var_resp = local_var_client.execute(local_var_req).await?;
491
492 let local_var_status = local_var_resp.status();
493 let local_var_content = local_var_resp.text().await?;
494
495 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
496 crate::from_str_patched(&local_var_content).map_err(Error::from)
497 } else {
498 let local_var_entity: Option<GetHubFlowByIdError> = crate::from_str_patched(&local_var_content).ok();
499 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
500 Err(Error::ResponseError(local_var_error))
501 }
502}
503
504pub async fn get_triggers_count_of_flow(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfFlowError>> {
505 let local_var_configuration = configuration;
506
507 let local_var_client = &local_var_configuration.client;
508
509 let local_var_uri_str = format!("{}/w/{workspace}/flows/get_triggers_count/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
510 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
511
512 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
513 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
514 }
515 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
516 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
517 };
518
519 let local_var_req = local_var_req_builder.build()?;
520 let local_var_resp = local_var_client.execute(local_var_req).await?;
521
522 let local_var_status = local_var_resp.status();
523 let local_var_content = local_var_resp.text().await?;
524
525 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
526 crate::from_str_patched(&local_var_content).map_err(Error::from)
527 } else {
528 let local_var_entity: Option<GetTriggersCountOfFlowError> = crate::from_str_patched(&local_var_content).ok();
529 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
530 Err(Error::ResponseError(local_var_error))
531 }
532}
533
534pub async fn list_flow_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListFlowPathsError>> {
535 let local_var_configuration = configuration;
536
537 let local_var_client = &local_var_configuration.client;
538
539 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
540 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
541
542 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
543 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
544 }
545 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
546 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
547 };
548
549 let local_var_req = local_var_req_builder.build()?;
550 let local_var_resp = local_var_client.execute(local_var_req).await?;
551
552 let local_var_status = local_var_resp.status();
553 let local_var_content = local_var_resp.text().await?;
554
555 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
556 crate::from_str_patched(&local_var_content).map_err(Error::from)
557 } else {
558 let local_var_entity: Option<ListFlowPathsError> = crate::from_str_patched(&local_var_content).ok();
559 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
560 Err(Error::ResponseError(local_var_error))
561 }
562}
563
564pub async fn list_flow_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, runnable_kind: &str, path: &str) -> Result<Vec<String>, Error<ListFlowPathsFromWorkspaceRunnableError>> {
565 let local_var_configuration = configuration;
566
567 let local_var_client = &local_var_configuration.client;
568
569 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_paths_from_workspace_runnable/{runnable_kind}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), runnable_kind=crate::apis::urlencode(runnable_kind), path=crate::apis::urlencode(path));
570 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
571
572 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
573 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
574 }
575 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
576 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
577 };
578
579 let local_var_req = local_var_req_builder.build()?;
580 let local_var_resp = local_var_client.execute(local_var_req).await?;
581
582 let local_var_status = local_var_resp.status();
583 let local_var_content = local_var_resp.text().await?;
584
585 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
586 crate::from_str_patched(&local_var_content).map_err(Error::from)
587 } else {
588 let local_var_entity: Option<ListFlowPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
589 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
590 Err(Error::ResponseError(local_var_error))
591 }
592}
593
594pub async fn list_flows(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, order_desc: Option<bool>, created_by: Option<&str>, path_start: Option<&str>, path_exact: Option<&str>, show_archived: Option<bool>, starred_only: Option<bool>, include_draft_only: Option<bool>, with_deployment_msg: Option<bool>) -> Result<Vec<models::ListFlows200ResponseInner>, Error<ListFlowsError>> {
595 let local_var_configuration = configuration;
596
597 let local_var_client = &local_var_configuration.client;
598
599 let local_var_uri_str = format!("{}/w/{workspace}/flows/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
600 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
601
602 if let Some(ref local_var_str) = page {
603 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
604 }
605 if let Some(ref local_var_str) = per_page {
606 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
607 }
608 if let Some(ref local_var_str) = order_desc {
609 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
610 }
611 if let Some(ref local_var_str) = created_by {
612 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
613 }
614 if let Some(ref local_var_str) = path_start {
615 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
616 }
617 if let Some(ref local_var_str) = path_exact {
618 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
619 }
620 if let Some(ref local_var_str) = show_archived {
621 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
622 }
623 if let Some(ref local_var_str) = starred_only {
624 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
625 }
626 if let Some(ref local_var_str) = include_draft_only {
627 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
628 }
629 if let Some(ref local_var_str) = with_deployment_msg {
630 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
631 }
632 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
633 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
634 }
635 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
636 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
637 };
638
639 let local_var_req = local_var_req_builder.build()?;
640 let local_var_resp = local_var_client.execute(local_var_req).await?;
641
642 let local_var_status = local_var_resp.status();
643 let local_var_content = local_var_resp.text().await?;
644
645 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
646 crate::from_str_patched(&local_var_content).map_err(Error::from)
647 } else {
648 let local_var_entity: Option<ListFlowsError> = crate::from_str_patched(&local_var_content).ok();
649 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
650 Err(Error::ResponseError(local_var_error))
651 }
652}
653
654pub async fn list_hub_flows(configuration: &configuration::Configuration, ) -> Result<models::ListHubFlows200Response, Error<ListHubFlowsError>> {
655 let local_var_configuration = configuration;
656
657 let local_var_client = &local_var_configuration.client;
658
659 let local_var_uri_str = format!("{}/flows/hub/list", local_var_configuration.base_path);
660 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
661
662 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
663 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
664 }
665 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
666 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
667 };
668
669 let local_var_req = local_var_req_builder.build()?;
670 let local_var_resp = local_var_client.execute(local_var_req).await?;
671
672 let local_var_status = local_var_resp.status();
673 let local_var_content = local_var_resp.text().await?;
674
675 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
676 crate::from_str_patched(&local_var_content).map_err(Error::from)
677 } else {
678 let local_var_entity: Option<ListHubFlowsError> = crate::from_str_patched(&local_var_content).ok();
679 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
680 Err(Error::ResponseError(local_var_error))
681 }
682}
683
684pub async fn list_search_flow(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchResource200ResponseInner>, Error<ListSearchFlowError>> {
685 let local_var_configuration = configuration;
686
687 let local_var_client = &local_var_configuration.client;
688
689 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
690 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
691
692 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
693 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
694 }
695 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
696 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
697 };
698
699 let local_var_req = local_var_req_builder.build()?;
700 let local_var_resp = local_var_client.execute(local_var_req).await?;
701
702 let local_var_status = local_var_resp.status();
703 let local_var_content = local_var_resp.text().await?;
704
705 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
706 crate::from_str_patched(&local_var_content).map_err(Error::from)
707 } else {
708 let local_var_entity: Option<ListSearchFlowError> = crate::from_str_patched(&local_var_content).ok();
709 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
710 Err(Error::ResponseError(local_var_error))
711 }
712}
713
714pub async fn list_tokens_of_flow(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfFlowError>> {
715 let local_var_configuration = configuration;
716
717 let local_var_client = &local_var_configuration.client;
718
719 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_tokens/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
720 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
721
722 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
723 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
724 }
725 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
726 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
727 };
728
729 let local_var_req = local_var_req_builder.build()?;
730 let local_var_resp = local_var_client.execute(local_var_req).await?;
731
732 let local_var_status = local_var_resp.status();
733 let local_var_content = local_var_resp.text().await?;
734
735 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
736 crate::from_str_patched(&local_var_content).map_err(Error::from)
737 } else {
738 let local_var_entity: Option<ListTokensOfFlowError> = crate::from_str_patched(&local_var_content).ok();
739 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
740 Err(Error::ResponseError(local_var_error))
741 }
742}
743
744pub async fn toggle_workspace_error_handler_for_flow(configuration: &configuration::Configuration, workspace: &str, path: &str, toggle_workspace_error_handler_for_script_request: models::ToggleWorkspaceErrorHandlerForScriptRequest) -> Result<String, Error<ToggleWorkspaceErrorHandlerForFlowError>> {
745 let local_var_configuration = configuration;
746
747 let local_var_client = &local_var_configuration.client;
748
749 let local_var_uri_str = format!("{}/w/{workspace}/flows/toggle_workspace_error_handler/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
750 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
751
752 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
753 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
754 }
755 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
756 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
757 };
758 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
759
760 let local_var_req = local_var_req_builder.build()?;
761 let local_var_resp = local_var_client.execute(local_var_req).await?;
762
763 let local_var_status = local_var_resp.status();
764 let local_var_content = local_var_resp.text().await?;
765
766 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
767 crate::from_str_patched(&local_var_content).map_err(Error::from)
768 } else {
769 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForFlowError> = crate::from_str_patched(&local_var_content).ok();
770 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
771 Err(Error::ResponseError(local_var_error))
772 }
773}
774
775pub async fn update_flow(configuration: &configuration::Configuration, workspace: &str, path: &str, update_flow_request: models::UpdateFlowRequest) -> Result<String, Error<UpdateFlowError>> {
776 let local_var_configuration = configuration;
777
778 let local_var_client = &local_var_configuration.client;
779
780 let local_var_uri_str = format!("{}/w/{workspace}/flows/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
781 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
782
783 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
784 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
785 }
786 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
787 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
788 };
789 local_var_req_builder = local_var_req_builder.json(&update_flow_request);
790
791 let local_var_req = local_var_req_builder.build()?;
792 let local_var_resp = local_var_client.execute(local_var_req).await?;
793
794 let local_var_status = local_var_resp.status();
795 let local_var_content = local_var_resp.text().await?;
796
797 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
798 crate::from_str_patched(&local_var_content).map_err(Error::from)
799 } else {
800 let local_var_entity: Option<UpdateFlowError> = crate::from_str_patched(&local_var_content).ok();
801 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
802 Err(Error::ResponseError(local_var_error))
803 }
804}
805
806pub async fn update_flow_history(configuration: &configuration::Configuration, workspace: &str, version: f64, path: &str, update_flow_history_request: models::UpdateFlowHistoryRequest) -> Result<String, Error<UpdateFlowHistoryError>> {
807 let local_var_configuration = configuration;
808
809 let local_var_client = &local_var_configuration.client;
810
811 let local_var_uri_str = format!("{}/w/{workspace}/flows/history_update/v/{version}/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version, path=crate::apis::urlencode(path));
812 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
813
814 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
815 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
816 }
817 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
818 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
819 };
820 local_var_req_builder = local_var_req_builder.json(&update_flow_history_request);
821
822 let local_var_req = local_var_req_builder.build()?;
823 let local_var_resp = local_var_client.execute(local_var_req).await?;
824
825 let local_var_status = local_var_resp.status();
826 let local_var_content = local_var_resp.text().await?;
827
828 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
829 crate::from_str_patched(&local_var_content).map_err(Error::from)
830 } else {
831 let local_var_entity: Option<UpdateFlowHistoryError> = crate::from_str_patched(&local_var_content).ok();
832 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
833 Err(Error::ResponseError(local_var_error))
834 }
835}
836