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