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, match_path_start: Option<bool>) -> 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_str) = match_path_start {
573 local_var_req_builder = local_var_req_builder.query(&[("match_path_start", &local_var_str.to_string())]);
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
582 let local_var_req = local_var_req_builder.build()?;
583 let local_var_resp = local_var_client.execute(local_var_req).await?;
584
585 let local_var_status = local_var_resp.status();
586 let local_var_content = local_var_resp.text().await?;
587
588 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
589 crate::from_str_patched(&local_var_content).map_err(Error::from)
590 } else {
591 let local_var_entity: Option<ListFlowPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
592 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
593 Err(Error::ResponseError(local_var_error))
594 }
595}
596
597pub 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>> {
598 let local_var_configuration = configuration;
599
600 let local_var_client = &local_var_configuration.client;
601
602 let local_var_uri_str = format!("{}/w/{workspace}/flows/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
603 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
604
605 if let Some(ref local_var_str) = page {
606 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
607 }
608 if let Some(ref local_var_str) = per_page {
609 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
610 }
611 if let Some(ref local_var_str) = order_desc {
612 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
613 }
614 if let Some(ref local_var_str) = created_by {
615 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
616 }
617 if let Some(ref local_var_str) = path_start {
618 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
619 }
620 if let Some(ref local_var_str) = path_exact {
621 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
622 }
623 if let Some(ref local_var_str) = show_archived {
624 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
625 }
626 if let Some(ref local_var_str) = starred_only {
627 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
628 }
629 if let Some(ref local_var_str) = include_draft_only {
630 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
631 }
632 if let Some(ref local_var_str) = with_deployment_msg {
633 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
634 }
635 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
636 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
637 }
638 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
639 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
640 };
641
642 let local_var_req = local_var_req_builder.build()?;
643 let local_var_resp = local_var_client.execute(local_var_req).await?;
644
645 let local_var_status = local_var_resp.status();
646 let local_var_content = local_var_resp.text().await?;
647
648 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
649 crate::from_str_patched(&local_var_content).map_err(Error::from)
650 } else {
651 let local_var_entity: Option<ListFlowsError> = crate::from_str_patched(&local_var_content).ok();
652 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
653 Err(Error::ResponseError(local_var_error))
654 }
655}
656
657pub async fn list_hub_flows(configuration: &configuration::Configuration, ) -> Result<models::ListHubFlows200Response, Error<ListHubFlowsError>> {
658 let local_var_configuration = configuration;
659
660 let local_var_client = &local_var_configuration.client;
661
662 let local_var_uri_str = format!("{}/flows/hub/list", local_var_configuration.base_path);
663 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
664
665 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
666 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
667 }
668 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
669 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
670 };
671
672 let local_var_req = local_var_req_builder.build()?;
673 let local_var_resp = local_var_client.execute(local_var_req).await?;
674
675 let local_var_status = local_var_resp.status();
676 let local_var_content = local_var_resp.text().await?;
677
678 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
679 crate::from_str_patched(&local_var_content).map_err(Error::from)
680 } else {
681 let local_var_entity: Option<ListHubFlowsError> = crate::from_str_patched(&local_var_content).ok();
682 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
683 Err(Error::ResponseError(local_var_error))
684 }
685}
686
687pub async fn list_search_flow(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchResource200ResponseInner>, Error<ListSearchFlowError>> {
688 let local_var_configuration = configuration;
689
690 let local_var_client = &local_var_configuration.client;
691
692 let local_var_uri_str = format!("{}/w/{workspace}/flows/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
693 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
694
695 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
696 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
697 }
698 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
699 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
700 };
701
702 let local_var_req = local_var_req_builder.build()?;
703 let local_var_resp = local_var_client.execute(local_var_req).await?;
704
705 let local_var_status = local_var_resp.status();
706 let local_var_content = local_var_resp.text().await?;
707
708 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
709 crate::from_str_patched(&local_var_content).map_err(Error::from)
710 } else {
711 let local_var_entity: Option<ListSearchFlowError> = crate::from_str_patched(&local_var_content).ok();
712 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
713 Err(Error::ResponseError(local_var_error))
714 }
715}
716
717pub async fn list_tokens_of_flow(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfFlowError>> {
718 let local_var_configuration = configuration;
719
720 let local_var_client = &local_var_configuration.client;
721
722 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));
723 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
724
725 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
726 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
727 }
728 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
729 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
730 };
731
732 let local_var_req = local_var_req_builder.build()?;
733 let local_var_resp = local_var_client.execute(local_var_req).await?;
734
735 let local_var_status = local_var_resp.status();
736 let local_var_content = local_var_resp.text().await?;
737
738 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
739 crate::from_str_patched(&local_var_content).map_err(Error::from)
740 } else {
741 let local_var_entity: Option<ListTokensOfFlowError> = crate::from_str_patched(&local_var_content).ok();
742 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
743 Err(Error::ResponseError(local_var_error))
744 }
745}
746
747pub 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>> {
748 let local_var_configuration = configuration;
749
750 let local_var_client = &local_var_configuration.client;
751
752 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));
753 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
754
755 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
756 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
757 }
758 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
759 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
760 };
761 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
762
763 let local_var_req = local_var_req_builder.build()?;
764 let local_var_resp = local_var_client.execute(local_var_req).await?;
765
766 let local_var_status = local_var_resp.status();
767 let local_var_content = local_var_resp.text().await?;
768
769 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
770 crate::from_str_patched(&local_var_content).map_err(Error::from)
771 } else {
772 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForFlowError> = crate::from_str_patched(&local_var_content).ok();
773 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
774 Err(Error::ResponseError(local_var_error))
775 }
776}
777
778pub async fn update_flow(configuration: &configuration::Configuration, workspace: &str, path: &str, update_flow_request: models::UpdateFlowRequest) -> Result<String, Error<UpdateFlowError>> {
779 let local_var_configuration = configuration;
780
781 let local_var_client = &local_var_configuration.client;
782
783 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));
784 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
785
786 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
787 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
788 }
789 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
790 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
791 };
792 local_var_req_builder = local_var_req_builder.json(&update_flow_request);
793
794 let local_var_req = local_var_req_builder.build()?;
795 let local_var_resp = local_var_client.execute(local_var_req).await?;
796
797 let local_var_status = local_var_resp.status();
798 let local_var_content = local_var_resp.text().await?;
799
800 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
801 crate::from_str_patched(&local_var_content).map_err(Error::from)
802 } else {
803 let local_var_entity: Option<UpdateFlowError> = crate::from_str_patched(&local_var_content).ok();
804 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
805 Err(Error::ResponseError(local_var_error))
806 }
807}
808
809pub async fn update_flow_history(configuration: &configuration::Configuration, workspace: &str, version: f64, path: &str, update_flow_history_request: models::UpdateFlowHistoryRequest) -> Result<String, Error<UpdateFlowHistoryError>> {
810 let local_var_configuration = configuration;
811
812 let local_var_client = &local_var_configuration.client;
813
814 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));
815 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
816
817 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
818 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
819 }
820 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
821 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
822 };
823 local_var_req_builder = local_var_req_builder.json(&update_flow_history_request);
824
825 let local_var_req = local_var_req_builder.build()?;
826 let local_var_resp = local_var_client.execute(local_var_req).await?;
827
828 let local_var_status = local_var_resp.status();
829 let local_var_content = local_var_resp.text().await?;
830
831 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
832 crate::from_str_patched(&local_var_content).map_err(Error::from)
833 } else {
834 let local_var_entity: Option<UpdateFlowHistoryError> = crate::from_str_patched(&local_var_content).ok();
835 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
836 Err(Error::ResponseError(local_var_error))
837 }
838}
839