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