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 GetFlowDeploymentStatusError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetFlowHistoryError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetFlowLatestVersionError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetFlowVersionError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetHubFlowByIdError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetTriggersCountOfFlowError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum ListFlowPathsError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ListFlowPathsFromWorkspaceRunnableError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum ListFlowPathsLinkingAgentError {
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>, get_draft: Option<bool>) -> Result<models::GetFlowByPath200Response, 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_str) = get_draft {
303 local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
304 }
305 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
306 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
307 }
308 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
309 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
310 };
311
312 let local_var_req = local_var_req_builder.build()?;
313 let local_var_resp = local_var_client.execute(local_var_req).await?;
314
315 let local_var_status = local_var_resp.status();
316 let local_var_content = local_var_resp.text().await?;
317
318 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
319 crate::from_str_patched(&local_var_content).map_err(Error::from)
320 } else {
321 let local_var_entity: Option<GetFlowByPathError> = crate::from_str_patched(&local_var_content).ok();
322 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
323 Err(Error::ResponseError(local_var_error))
324 }
325}
326
327pub async fn get_flow_deployment_status(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::GetFlowDeploymentStatus200Response, Error<GetFlowDeploymentStatusError>> {
328 let local_var_configuration = configuration;
329
330 let local_var_client = &local_var_configuration.client;
331
332 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));
333 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
334
335 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
336 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
337 }
338 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
339 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
340 };
341
342 let local_var_req = local_var_req_builder.build()?;
343 let local_var_resp = local_var_client.execute(local_var_req).await?;
344
345 let local_var_status = local_var_resp.status();
346 let local_var_content = local_var_resp.text().await?;
347
348 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
349 crate::from_str_patched(&local_var_content).map_err(Error::from)
350 } else {
351 let local_var_entity: Option<GetFlowDeploymentStatusError> = crate::from_str_patched(&local_var_content).ok();
352 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
353 Err(Error::ResponseError(local_var_error))
354 }
355}
356
357pub async fn get_flow_history(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::FlowVersion>, Error<GetFlowHistoryError>> {
358 let local_var_configuration = configuration;
359
360 let local_var_client = &local_var_configuration.client;
361
362 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));
363 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
364
365 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
366 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
367 }
368 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
369 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
370 };
371
372 let local_var_req = local_var_req_builder.build()?;
373 let local_var_resp = local_var_client.execute(local_var_req).await?;
374
375 let local_var_status = local_var_resp.status();
376 let local_var_content = local_var_resp.text().await?;
377
378 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
379 crate::from_str_patched(&local_var_content).map_err(Error::from)
380 } else {
381 let local_var_entity: Option<GetFlowHistoryError> = crate::from_str_patched(&local_var_content).ok();
382 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
383 Err(Error::ResponseError(local_var_error))
384 }
385}
386
387pub async fn get_flow_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::FlowVersion, Error<GetFlowLatestVersionError>> {
388 let local_var_configuration = configuration;
389
390 let local_var_client = &local_var_configuration.client;
391
392 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));
393 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
394
395 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
396 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
397 }
398 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
399 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
400 };
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(&local_var_content).map_err(Error::from)
410 } else {
411 let local_var_entity: Option<GetFlowLatestVersionError> = crate::from_str_patched(&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
417pub async fn get_flow_version(configuration: &configuration::Configuration, workspace: &str, version: f64) -> Result<models::Flow, Error<GetFlowVersionError>> {
418 let local_var_configuration = configuration;
419
420 let local_var_client = &local_var_configuration.client;
421
422 let local_var_uri_str = format!("{}/w/{workspace}/flows/get/v/{version}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version);
423 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
424
425 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
426 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
427 }
428 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
429 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
430 };
431
432 let local_var_req = local_var_req_builder.build()?;
433 let local_var_resp = local_var_client.execute(local_var_req).await?;
434
435 let local_var_status = local_var_resp.status();
436 let local_var_content = local_var_resp.text().await?;
437
438 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
439 crate::from_str_patched(&local_var_content).map_err(Error::from)
440 } else {
441 let local_var_entity: Option<GetFlowVersionError> = crate::from_str_patched(&local_var_content).ok();
442 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
443 Err(Error::ResponseError(local_var_error))
444 }
445}
446
447pub async fn get_hub_flow_by_id(configuration: &configuration::Configuration, id: i32) -> Result<models::GetHubFlowById200Response, Error<GetHubFlowByIdError>> {
448 let local_var_configuration = configuration;
449
450 let local_var_client = &local_var_configuration.client;
451
452 let local_var_uri_str = format!("{}/flows/hub/get/{id}", local_var_configuration.base_path, id=id);
453 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
454
455 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
456 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
457 }
458 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
459 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
460 };
461
462 let local_var_req = local_var_req_builder.build()?;
463 let local_var_resp = local_var_client.execute(local_var_req).await?;
464
465 let local_var_status = local_var_resp.status();
466 let local_var_content = local_var_resp.text().await?;
467
468 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
469 crate::from_str_patched(&local_var_content).map_err(Error::from)
470 } else {
471 let local_var_entity: Option<GetHubFlowByIdError> = crate::from_str_patched(&local_var_content).ok();
472 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
473 Err(Error::ResponseError(local_var_error))
474 }
475}
476
477pub async fn get_triggers_count_of_flow(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfFlowError>> {
478 let local_var_configuration = configuration;
479
480 let local_var_client = &local_var_configuration.client;
481
482 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));
483 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
484
485 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
486 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
487 }
488 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
489 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
490 };
491
492 let local_var_req = local_var_req_builder.build()?;
493 let local_var_resp = local_var_client.execute(local_var_req).await?;
494
495 let local_var_status = local_var_resp.status();
496 let local_var_content = local_var_resp.text().await?;
497
498 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
499 crate::from_str_patched(&local_var_content).map_err(Error::from)
500 } else {
501 let local_var_entity: Option<GetTriggersCountOfFlowError> = crate::from_str_patched(&local_var_content).ok();
502 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
503 Err(Error::ResponseError(local_var_error))
504 }
505}
506
507pub async fn list_flow_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListFlowPathsError>> {
508 let local_var_configuration = configuration;
509
510 let local_var_client = &local_var_configuration.client;
511
512 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
513 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
514
515 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
516 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
517 }
518 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
519 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
520 };
521
522 let local_var_req = local_var_req_builder.build()?;
523 let local_var_resp = local_var_client.execute(local_var_req).await?;
524
525 let local_var_status = local_var_resp.status();
526 let local_var_content = local_var_resp.text().await?;
527
528 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
529 crate::from_str_patched(&local_var_content).map_err(Error::from)
530 } else {
531 let local_var_entity: Option<ListFlowPathsError> = crate::from_str_patched(&local_var_content).ok();
532 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
533 Err(Error::ResponseError(local_var_error))
534 }
535}
536
537pub async fn list_flow_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, runnable_kind: &str, path: &str, match_path_start: Option<bool>) -> Result<Vec<String>, Error<ListFlowPathsFromWorkspaceRunnableError>> {
538 let local_var_configuration = configuration;
539
540 let local_var_client = &local_var_configuration.client;
541
542 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));
543 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
544
545 if let Some(ref local_var_str) = match_path_start {
546 local_var_req_builder = local_var_req_builder.query(&[("match_path_start", &local_var_str.to_string())]);
547 }
548 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
549 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
550 }
551 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
552 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
553 };
554
555 let local_var_req = local_var_req_builder.build()?;
556 let local_var_resp = local_var_client.execute(local_var_req).await?;
557
558 let local_var_status = local_var_resp.status();
559 let local_var_content = local_var_resp.text().await?;
560
561 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
562 crate::from_str_patched(&local_var_content).map_err(Error::from)
563 } else {
564 let local_var_entity: Option<ListFlowPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
565 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
566 Err(Error::ResponseError(local_var_error))
567 }
568}
569
570pub async fn list_flow_paths_linking_agent(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListFlowPathsLinkingAgentError>> {
571 let local_var_configuration = configuration;
572
573 let local_var_client = &local_var_configuration.client;
574
575 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_paths_linking_agent/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
576 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
577
578 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
579 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
580 }
581 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
582 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
583 };
584
585 let local_var_req = local_var_req_builder.build()?;
586 let local_var_resp = local_var_client.execute(local_var_req).await?;
587
588 let local_var_status = local_var_resp.status();
589 let local_var_content = local_var_resp.text().await?;
590
591 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
592 crate::from_str_patched(&local_var_content).map_err(Error::from)
593 } else {
594 let local_var_entity: Option<ListFlowPathsLinkingAgentError> = crate::from_str_patched(&local_var_content).ok();
595 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
596 Err(Error::ResponseError(local_var_error))
597 }
598}
599
600pub 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>, without_description: Option<bool>, dedicated_worker: Option<bool>, label: Option<&str>) -> Result<Vec<models::ListFlows200ResponseInner>, Error<ListFlowsError>> {
601 let local_var_configuration = configuration;
602
603 let local_var_client = &local_var_configuration.client;
604
605 let local_var_uri_str = format!("{}/w/{workspace}/flows/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
606 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
607
608 if let Some(ref local_var_str) = page {
609 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
610 }
611 if let Some(ref local_var_str) = per_page {
612 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
613 }
614 if let Some(ref local_var_str) = order_desc {
615 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
616 }
617 if let Some(ref local_var_str) = created_by {
618 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
619 }
620 if let Some(ref local_var_str) = path_start {
621 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
622 }
623 if let Some(ref local_var_str) = path_exact {
624 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
625 }
626 if let Some(ref local_var_str) = show_archived {
627 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
628 }
629 if let Some(ref local_var_str) = starred_only {
630 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
631 }
632 if let Some(ref local_var_str) = include_draft_only {
633 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
634 }
635 if let Some(ref local_var_str) = with_deployment_msg {
636 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
637 }
638 if let Some(ref local_var_str) = without_description {
639 local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
640 }
641 if let Some(ref local_var_str) = dedicated_worker {
642 local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
643 }
644 if let Some(ref local_var_str) = label {
645 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
646 }
647 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
648 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
649 }
650 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
651 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
652 };
653
654 let local_var_req = local_var_req_builder.build()?;
655 let local_var_resp = local_var_client.execute(local_var_req).await?;
656
657 let local_var_status = local_var_resp.status();
658 let local_var_content = local_var_resp.text().await?;
659
660 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
661 crate::from_str_patched(&local_var_content).map_err(Error::from)
662 } else {
663 let local_var_entity: Option<ListFlowsError> = crate::from_str_patched(&local_var_content).ok();
664 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
665 Err(Error::ResponseError(local_var_error))
666 }
667}
668
669pub async fn list_hub_flows(configuration: &configuration::Configuration, ) -> Result<models::ListHubFlows200Response, Error<ListHubFlowsError>> {
670 let local_var_configuration = configuration;
671
672 let local_var_client = &local_var_configuration.client;
673
674 let local_var_uri_str = format!("{}/flows/hub/list", local_var_configuration.base_path);
675 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
676
677 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
678 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
679 }
680 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
681 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
682 };
683
684 let local_var_req = local_var_req_builder.build()?;
685 let local_var_resp = local_var_client.execute(local_var_req).await?;
686
687 let local_var_status = local_var_resp.status();
688 let local_var_content = local_var_resp.text().await?;
689
690 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
691 crate::from_str_patched(&local_var_content).map_err(Error::from)
692 } else {
693 let local_var_entity: Option<ListHubFlowsError> = crate::from_str_patched(&local_var_content).ok();
694 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
695 Err(Error::ResponseError(local_var_error))
696 }
697}
698
699pub async fn list_search_flow(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchFlow200ResponseInner>, Error<ListSearchFlowError>> {
700 let local_var_configuration = configuration;
701
702 let local_var_client = &local_var_configuration.client;
703
704 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
705 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
706
707 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
708 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
709 }
710 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
711 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
712 };
713
714 let local_var_req = local_var_req_builder.build()?;
715 let local_var_resp = local_var_client.execute(local_var_req).await?;
716
717 let local_var_status = local_var_resp.status();
718 let local_var_content = local_var_resp.text().await?;
719
720 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
721 crate::from_str_patched(&local_var_content).map_err(Error::from)
722 } else {
723 let local_var_entity: Option<ListSearchFlowError> = crate::from_str_patched(&local_var_content).ok();
724 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
725 Err(Error::ResponseError(local_var_error))
726 }
727}
728
729pub async fn list_tokens_of_flow(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfFlowError>> {
730 let local_var_configuration = configuration;
731
732 let local_var_client = &local_var_configuration.client;
733
734 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));
735 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
736
737 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
738 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
739 }
740 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
741 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
742 };
743
744 let local_var_req = local_var_req_builder.build()?;
745 let local_var_resp = local_var_client.execute(local_var_req).await?;
746
747 let local_var_status = local_var_resp.status();
748 let local_var_content = local_var_resp.text().await?;
749
750 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
751 crate::from_str_patched(&local_var_content).map_err(Error::from)
752 } else {
753 let local_var_entity: Option<ListTokensOfFlowError> = crate::from_str_patched(&local_var_content).ok();
754 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
755 Err(Error::ResponseError(local_var_error))
756 }
757}
758
759pub 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>> {
760 let local_var_configuration = configuration;
761
762 let local_var_client = &local_var_configuration.client;
763
764 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));
765 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
766
767 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
768 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
769 }
770 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
771 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
772 };
773 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
774
775 let local_var_req = local_var_req_builder.build()?;
776 let local_var_resp = local_var_client.execute(local_var_req).await?;
777
778 let local_var_status = local_var_resp.status();
779 let local_var_content = local_var_resp.text().await?;
780
781 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
782 crate::from_str_patched(&local_var_content).map_err(Error::from)
783 } else {
784 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForFlowError> = crate::from_str_patched(&local_var_content).ok();
785 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
786 Err(Error::ResponseError(local_var_error))
787 }
788}
789
790pub async fn update_flow(configuration: &configuration::Configuration, workspace: &str, path: &str, update_flow_request: models::UpdateFlowRequest) -> Result<String, Error<UpdateFlowError>> {
791 let local_var_configuration = configuration;
792
793 let local_var_client = &local_var_configuration.client;
794
795 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));
796 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
797
798 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
799 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
800 }
801 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
802 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
803 };
804 local_var_req_builder = local_var_req_builder.json(&update_flow_request);
805
806 let local_var_req = local_var_req_builder.build()?;
807 let local_var_resp = local_var_client.execute(local_var_req).await?;
808
809 let local_var_status = local_var_resp.status();
810 let local_var_content = local_var_resp.text().await?;
811
812 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
813 crate::from_str_patched(&local_var_content).map_err(Error::from)
814 } else {
815 let local_var_entity: Option<UpdateFlowError> = crate::from_str_patched(&local_var_content).ok();
816 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
817 Err(Error::ResponseError(local_var_error))
818 }
819}
820
821pub async fn update_flow_history(configuration: &configuration::Configuration, workspace: &str, version: f64, update_flow_history_request: models::UpdateFlowHistoryRequest) -> Result<String, Error<UpdateFlowHistoryError>> {
822 let local_var_configuration = configuration;
823
824 let local_var_client = &local_var_configuration.client;
825
826 let local_var_uri_str = format!("{}/w/{workspace}/flows/history_update/v/{version}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version);
827 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
828
829 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
830 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
831 }
832 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
833 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
834 };
835 local_var_req_builder = local_var_req_builder.json(&update_flow_history_request);
836
837 let local_var_req = local_var_req_builder.build()?;
838 let local_var_resp = local_var_client.execute(local_var_req).await?;
839
840 let local_var_status = local_var_resp.status();
841 let local_var_content = local_var_resp.text().await?;
842
843 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
844 crate::from_str_patched(&local_var_content).map_err(Error::from)
845 } else {
846 let local_var_entity: Option<UpdateFlowHistoryError> = crate::from_str_patched(&local_var_content).ok();
847 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
848 Err(Error::ResponseError(local_var_error))
849 }
850}
851