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