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 ArchiveScriptByHashError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ArchiveScriptByPathError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CheckSchemaContractsError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CountRunnablesByOwnerError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateScriptError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeleteScriptByHashError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeleteScriptByPathError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteScriptsBulkError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum DiffRawScriptsWithDeployedError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ExistsScriptByPathError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetCiTestResultsError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetCiTestResultsBatchError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetHubScriptByPathError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetHubScriptContentByPathError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetScriptByHashError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetScriptByPathError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetScriptDeploymentStatusError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetScriptHistoryByPathError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetScriptLatestVersionError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetTopHubScriptsError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetTriggersCountOfScriptError {
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum ListDedicatedWithDepsError {
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ListRunnablesError {
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum ListScriptPathsError {
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ListScriptPathsFromWorkspaceRunnableError {
190 UnknownValue(serde_json::Value),
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum ListScriptsError {
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ListSearchScriptError {
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum ListTokensOfScriptError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PickHubScriptByPathError {
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum QueryHubScriptsError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum RawScriptByHashError {
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum RawScriptByPathError {
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum RawScriptByPathTokenedError {
246 UnknownValue(serde_json::Value),
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum StoreRawScriptTempError {
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ToggleWorkspaceErrorHandlerForScriptError {
260 UnknownValue(serde_json::Value),
261}
262
263#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum UpdateScriptHistoryError {
267 UnknownValue(serde_json::Value),
268}
269
270
271pub async fn archive_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<ArchiveScriptByHashError>> {
272 let local_var_configuration = configuration;
273
274 let local_var_client = &local_var_configuration.client;
275
276 let local_var_uri_str = format!("{}/w/{workspace}/scripts/archive/h/{hash}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), hash=crate::apis::urlencode(hash));
277 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
278
279 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
280 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
281 }
282 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
283 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
284 };
285
286 let local_var_req = local_var_req_builder.build()?;
287 let local_var_resp = local_var_client.execute(local_var_req).await?;
288
289 let local_var_status = local_var_resp.status();
290 let local_var_content = local_var_resp.text().await?;
291
292 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
293 crate::from_str_patched(&local_var_content).map_err(Error::from)
294 } else {
295 let local_var_entity: Option<ArchiveScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
296 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
297 Err(Error::ResponseError(local_var_error))
298 }
299}
300
301pub async fn archive_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<ArchiveScriptByPathError>> {
302 let local_var_configuration = configuration;
303
304 let local_var_client = &local_var_configuration.client;
305
306 let local_var_uri_str = format!("{}/w/{workspace}/scripts/archive/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
307 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
308
309 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
310 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
311 }
312 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
313 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
314 };
315
316 let local_var_req = local_var_req_builder.build()?;
317 let local_var_resp = local_var_client.execute(local_var_req).await?;
318
319 let local_var_status = local_var_resp.status();
320 let local_var_content = local_var_resp.text().await?;
321
322 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
323 crate::from_str_patched(&local_var_content).map_err(Error::from)
324 } else {
325 let local_var_entity: Option<ArchiveScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
326 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
327 Err(Error::ResponseError(local_var_error))
328 }
329}
330
331pub async fn check_schema_contracts(configuration: &configuration::Configuration, workspace: &str, check_schema_contracts_request: models::CheckSchemaContractsRequest) -> Result<models::CheckSchemaContracts200Response, Error<CheckSchemaContractsError>> {
333 let local_var_configuration = configuration;
334
335 let local_var_client = &local_var_configuration.client;
336
337 let local_var_uri_str = format!("{}/w/{workspace}/scripts/check_schema_contracts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
338 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
339
340 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
341 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
342 }
343 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
344 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
345 };
346 local_var_req_builder = local_var_req_builder.json(&check_schema_contracts_request);
347
348 let local_var_req = local_var_req_builder.build()?;
349 let local_var_resp = local_var_client.execute(local_var_req).await?;
350
351 let local_var_status = local_var_resp.status();
352 let local_var_content = local_var_resp.text().await?;
353
354 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
355 crate::from_str_patched(&local_var_content).map_err(Error::from)
356 } else {
357 let local_var_entity: Option<CheckSchemaContractsError> = crate::from_str_patched(&local_var_content).ok();
358 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
359 Err(Error::ResponseError(local_var_error))
360 }
361}
362
363pub async fn count_runnables_by_owner(configuration: &configuration::Configuration, workspace: &str, kinds: Option<&str>, include_without_main: Option<bool>) -> Result<models::CountRunnablesByOwner200Response, Error<CountRunnablesByOwnerError>> {
364 let local_var_configuration = configuration;
365
366 let local_var_client = &local_var_configuration.client;
367
368 let local_var_uri_str = format!("{}/w/{workspace}/runnables/counts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
369 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
370
371 if let Some(ref local_var_str) = kinds {
372 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
373 }
374 if let Some(ref local_var_str) = include_without_main {
375 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
376 }
377 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
378 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
379 }
380 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
381 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
382 };
383
384 let local_var_req = local_var_req_builder.build()?;
385 let local_var_resp = local_var_client.execute(local_var_req).await?;
386
387 let local_var_status = local_var_resp.status();
388 let local_var_content = local_var_resp.text().await?;
389
390 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
391 crate::from_str_patched(&local_var_content).map_err(Error::from)
392 } else {
393 let local_var_entity: Option<CountRunnablesByOwnerError> = crate::from_str_patched(&local_var_content).ok();
394 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
395 Err(Error::ResponseError(local_var_error))
396 }
397}
398
399pub async fn create_script(configuration: &configuration::Configuration, workspace: &str, new_script: models::NewScript) -> Result<String, Error<CreateScriptError>> {
401 let local_var_configuration = configuration;
402
403 let local_var_client = &local_var_configuration.client;
404
405 let local_var_uri_str = format!("{}/w/{workspace}/scripts/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
406 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
407
408 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
409 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
410 }
411 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
412 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
413 };
414 local_var_req_builder = local_var_req_builder.json(&new_script);
415
416 let local_var_req = local_var_req_builder.build()?;
417 let local_var_resp = local_var_client.execute(local_var_req).await?;
418
419 let local_var_status = local_var_resp.status();
420 let local_var_content = local_var_resp.text().await?;
421
422 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
423 crate::from_str_patched(&local_var_content).map_err(Error::from)
424 } else {
425 let local_var_entity: Option<CreateScriptError> = crate::from_str_patched(&local_var_content).ok();
426 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
427 Err(Error::ResponseError(local_var_error))
428 }
429}
430
431pub async fn delete_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<DeleteScriptByHashError>> {
432 let local_var_configuration = configuration;
433
434 let local_var_client = &local_var_configuration.client;
435
436 let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete/h/{hash}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), hash=crate::apis::urlencode(hash));
437 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
438
439 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
440 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
441 }
442 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
443 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
444 };
445
446 let local_var_req = local_var_req_builder.build()?;
447 let local_var_resp = local_var_client.execute(local_var_req).await?;
448
449 let local_var_status = local_var_resp.status();
450 let local_var_content = local_var_resp.text().await?;
451
452 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
453 crate::from_str_patched(&local_var_content).map_err(Error::from)
454 } else {
455 let local_var_entity: Option<DeleteScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
456 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
457 Err(Error::ResponseError(local_var_error))
458 }
459}
460
461pub async fn delete_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, keep_captures: Option<bool>) -> Result<String, Error<DeleteScriptByPathError>> {
462 let local_var_configuration = configuration;
463
464 let local_var_client = &local_var_configuration.client;
465
466 let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
467 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
468
469 if let Some(ref local_var_str) = keep_captures {
470 local_var_req_builder = local_var_req_builder.query(&[("keep_captures", &local_var_str.to_string())]);
471 }
472 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
473 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
474 }
475 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
476 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
477 };
478
479 let local_var_req = local_var_req_builder.build()?;
480 let local_var_resp = local_var_client.execute(local_var_req).await?;
481
482 let local_var_status = local_var_resp.status();
483 let local_var_content = local_var_resp.text().await?;
484
485 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
486 crate::from_str_patched(&local_var_content).map_err(Error::from)
487 } else {
488 let local_var_entity: Option<DeleteScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
489 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
490 Err(Error::ResponseError(local_var_error))
491 }
492}
493
494pub async fn delete_scripts_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteScriptsBulkError>> {
495 let local_var_configuration = configuration;
496
497 let local_var_client = &local_var_configuration.client;
498
499 let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
500 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
501
502 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
503 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
504 }
505 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
506 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
507 };
508 local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
509
510 let local_var_req = local_var_req_builder.build()?;
511 let local_var_resp = local_var_client.execute(local_var_req).await?;
512
513 let local_var_status = local_var_resp.status();
514 let local_var_content = local_var_resp.text().await?;
515
516 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
517 crate::from_str_patched(&local_var_content).map_err(Error::from)
518 } else {
519 let local_var_entity: Option<DeleteScriptsBulkError> = crate::from_str_patched(&local_var_content).ok();
520 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
521 Err(Error::ResponseError(local_var_error))
522 }
523}
524
525pub async fn diff_raw_scripts_with_deployed(configuration: &configuration::Configuration, workspace: &str, diff_raw_scripts_with_deployed_request: models::DiffRawScriptsWithDeployedRequest) -> Result<Vec<String>, Error<DiffRawScriptsWithDeployedError>> {
526 let local_var_configuration = configuration;
527
528 let local_var_client = &local_var_configuration.client;
529
530 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/diff", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
531 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
532
533 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
534 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
535 }
536 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
537 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
538 };
539 local_var_req_builder = local_var_req_builder.json(&diff_raw_scripts_with_deployed_request);
540
541 let local_var_req = local_var_req_builder.build()?;
542 let local_var_resp = local_var_client.execute(local_var_req).await?;
543
544 let local_var_status = local_var_resp.status();
545 let local_var_content = local_var_resp.text().await?;
546
547 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
548 crate::from_str_patched(&local_var_content).map_err(Error::from)
549 } else {
550 let local_var_entity: Option<DiffRawScriptsWithDeployedError> = crate::from_str_patched(&local_var_content).ok();
551 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
552 Err(Error::ResponseError(local_var_error))
553 }
554}
555
556pub async fn exists_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsScriptByPathError>> {
557 let local_var_configuration = configuration;
558
559 let local_var_client = &local_var_configuration.client;
560
561 let local_var_uri_str = format!("{}/w/{workspace}/scripts/exists/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
562 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
563
564 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
565 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
566 }
567 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
568 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
569 };
570
571 let local_var_req = local_var_req_builder.build()?;
572 let local_var_resp = local_var_client.execute(local_var_req).await?;
573
574 let local_var_status = local_var_resp.status();
575 let local_var_content = local_var_resp.text().await?;
576
577 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
578 crate::from_str_patched(&local_var_content).map_err(Error::from)
579 } else {
580 let local_var_entity: Option<ExistsScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
581 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
582 Err(Error::ResponseError(local_var_error))
583 }
584}
585
586pub async fn get_ci_test_results(configuration: &configuration::Configuration, workspace: &str, kind: &str, path: &str) -> Result<Vec<models::CiTestResult>, Error<GetCiTestResultsError>> {
587 let local_var_configuration = configuration;
588
589 let local_var_client = &local_var_configuration.client;
590
591 let local_var_uri_str = format!("{}/w/{workspace}/scripts/ci_test_results/{kind}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), kind=crate::apis::urlencode(kind), path=crate::apis::urlencode(path));
592 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
593
594 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
595 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
596 }
597 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
598 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
599 };
600
601 let local_var_req = local_var_req_builder.build()?;
602 let local_var_resp = local_var_client.execute(local_var_req).await?;
603
604 let local_var_status = local_var_resp.status();
605 let local_var_content = local_var_resp.text().await?;
606
607 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
608 crate::from_str_patched(&local_var_content).map_err(Error::from)
609 } else {
610 let local_var_entity: Option<GetCiTestResultsError> = crate::from_str_patched(&local_var_content).ok();
611 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
612 Err(Error::ResponseError(local_var_error))
613 }
614}
615
616pub async fn get_ci_test_results_batch(configuration: &configuration::Configuration, workspace: &str, get_ci_test_results_batch_request: models::GetCiTestResultsBatchRequest) -> Result<std::collections::HashMap<String, Vec<models::CiTestResult>>, Error<GetCiTestResultsBatchError>> {
617 let local_var_configuration = configuration;
618
619 let local_var_client = &local_var_configuration.client;
620
621 let local_var_uri_str = format!("{}/w/{workspace}/scripts/ci_test_results_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
622 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
623
624 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
625 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
626 }
627 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
628 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
629 };
630 local_var_req_builder = local_var_req_builder.json(&get_ci_test_results_batch_request);
631
632 let local_var_req = local_var_req_builder.build()?;
633 let local_var_resp = local_var_client.execute(local_var_req).await?;
634
635 let local_var_status = local_var_resp.status();
636 let local_var_content = local_var_resp.text().await?;
637
638 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
639 crate::from_str_patched(&local_var_content).map_err(Error::from)
640 } else {
641 let local_var_entity: Option<GetCiTestResultsBatchError> = crate::from_str_patched(&local_var_content).ok();
642 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
643 Err(Error::ResponseError(local_var_error))
644 }
645}
646
647pub async fn get_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::GetHubScriptByPath200Response, Error<GetHubScriptByPathError>> {
648 let local_var_configuration = configuration;
649
650 let local_var_client = &local_var_configuration.client;
651
652 let local_var_uri_str = format!("{}/scripts/hub/get_full/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
653 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
654
655 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
656 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
657 }
658 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
659 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
660 };
661
662 let local_var_req = local_var_req_builder.build()?;
663 let local_var_resp = local_var_client.execute(local_var_req).await?;
664
665 let local_var_status = local_var_resp.status();
666 let local_var_content = local_var_resp.text().await?;
667
668 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
669 crate::from_str_patched(&local_var_content).map_err(Error::from)
670 } else {
671 let local_var_entity: Option<GetHubScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
672 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
673 Err(Error::ResponseError(local_var_error))
674 }
675}
676
677pub async fn get_hub_script_content_by_path(configuration: &configuration::Configuration, path: &str) -> Result<String, Error<GetHubScriptContentByPathError>> {
678 let local_var_configuration = configuration;
679
680 let local_var_client = &local_var_configuration.client;
681
682 let local_var_uri_str = format!("{}/scripts/hub/get/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
683 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
684
685 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
686 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
687 }
688 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
689 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
690 };
691
692 let local_var_req = local_var_req_builder.build()?;
693 let local_var_resp = local_var_client.execute(local_var_req).await?;
694
695 let local_var_status = local_var_resp.status();
696 let local_var_content = local_var_resp.text().await?;
697
698 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
699 crate::from_str_patched(&local_var_content).map_err(Error::from)
700 } else {
701 let local_var_entity: Option<GetHubScriptContentByPathError> = crate::from_str_patched(&local_var_content).ok();
702 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
703 Err(Error::ResponseError(local_var_error))
704 }
705}
706
707pub async fn get_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str, with_starred_info: Option<bool>, authed: Option<bool>) -> Result<models::Script, Error<GetScriptByHashError>> {
708 let local_var_configuration = configuration;
709
710 let local_var_client = &local_var_configuration.client;
711
712 let local_var_uri_str = format!("{}/w/{workspace}/scripts/get/h/{hash}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), hash=crate::apis::urlencode(hash));
713 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
714
715 if let Some(ref local_var_str) = with_starred_info {
716 local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
717 }
718 if let Some(ref local_var_str) = authed {
719 local_var_req_builder = local_var_req_builder.query(&[("authed", &local_var_str.to_string())]);
720 }
721 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
722 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
723 }
724 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
725 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
726 };
727
728 let local_var_req = local_var_req_builder.build()?;
729 let local_var_resp = local_var_client.execute(local_var_req).await?;
730
731 let local_var_status = local_var_resp.status();
732 let local_var_content = local_var_resp.text().await?;
733
734 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
735 crate::from_str_patched(&local_var_content).map_err(Error::from)
736 } else {
737 let local_var_entity: Option<GetScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
738 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
739 Err(Error::ResponseError(local_var_error))
740 }
741}
742
743pub async fn get_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, with_starred_info: Option<bool>, get_draft: Option<bool>) -> Result<models::GetScriptByPath200Response, Error<GetScriptByPathError>> {
744 let local_var_configuration = configuration;
745
746 let local_var_client = &local_var_configuration.client;
747
748 let local_var_uri_str = format!("{}/w/{workspace}/scripts/get/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
749 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
750
751 if let Some(ref local_var_str) = with_starred_info {
752 local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
753 }
754 if let Some(ref local_var_str) = get_draft {
755 local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
756 }
757 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
758 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
759 }
760 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
761 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
762 };
763
764 let local_var_req = local_var_req_builder.build()?;
765 let local_var_resp = local_var_client.execute(local_var_req).await?;
766
767 let local_var_status = local_var_resp.status();
768 let local_var_content = local_var_resp.text().await?;
769
770 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
771 crate::from_str_patched(&local_var_content).map_err(Error::from)
772 } else {
773 let local_var_entity: Option<GetScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
774 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
775 Err(Error::ResponseError(local_var_error))
776 }
777}
778
779pub async fn get_script_deployment_status(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::GetScriptDeploymentStatus200Response, Error<GetScriptDeploymentStatusError>> {
780 let local_var_configuration = configuration;
781
782 let local_var_client = &local_var_configuration.client;
783
784 let local_var_uri_str = format!("{}/w/{workspace}/scripts/deployment_status/h/{hash}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), hash=crate::apis::urlencode(hash));
785 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
786
787 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
788 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
789 }
790 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
791 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
792 };
793
794 let local_var_req = local_var_req_builder.build()?;
795 let local_var_resp = local_var_client.execute(local_var_req).await?;
796
797 let local_var_status = local_var_resp.status();
798 let local_var_content = local_var_resp.text().await?;
799
800 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
801 crate::from_str_patched(&local_var_content).map_err(Error::from)
802 } else {
803 let local_var_entity: Option<GetScriptDeploymentStatusError> = crate::from_str_patched(&local_var_content).ok();
804 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
805 Err(Error::ResponseError(local_var_error))
806 }
807}
808
809pub async fn get_script_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::ScriptHistory>, Error<GetScriptHistoryByPathError>> {
810 let local_var_configuration = configuration;
811
812 let local_var_client = &local_var_configuration.client;
813
814 let local_var_uri_str = format!("{}/w/{workspace}/scripts/history/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
815 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
816
817 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
818 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
819 }
820 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
821 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
822 };
823
824 let local_var_req = local_var_req_builder.build()?;
825 let local_var_resp = local_var_client.execute(local_var_req).await?;
826
827 let local_var_status = local_var_resp.status();
828 let local_var_content = local_var_resp.text().await?;
829
830 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
831 crate::from_str_patched(&local_var_content).map_err(Error::from)
832 } else {
833 let local_var_entity: Option<GetScriptHistoryByPathError> = crate::from_str_patched(&local_var_content).ok();
834 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
835 Err(Error::ResponseError(local_var_error))
836 }
837}
838
839pub async fn get_script_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ScriptHistory, Error<GetScriptLatestVersionError>> {
840 let local_var_configuration = configuration;
841
842 let local_var_client = &local_var_configuration.client;
843
844 let local_var_uri_str = format!("{}/w/{workspace}/scripts/get_latest_version/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
845 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
846
847 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
848 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
849 }
850 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
851 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
852 };
853
854 let local_var_req = local_var_req_builder.build()?;
855 let local_var_resp = local_var_client.execute(local_var_req).await?;
856
857 let local_var_status = local_var_resp.status();
858 let local_var_content = local_var_resp.text().await?;
859
860 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
861 crate::from_str_patched(&local_var_content).map_err(Error::from)
862 } else {
863 let local_var_entity: Option<GetScriptLatestVersionError> = crate::from_str_patched(&local_var_content).ok();
864 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
865 Err(Error::ResponseError(local_var_error))
866 }
867}
868
869pub async fn get_top_hub_scripts(configuration: &configuration::Configuration, limit: Option<f64>, app: Option<&str>, kind: Option<&str>) -> Result<models::GetTopHubScripts200Response, Error<GetTopHubScriptsError>> {
870 let local_var_configuration = configuration;
871
872 let local_var_client = &local_var_configuration.client;
873
874 let local_var_uri_str = format!("{}/scripts/hub/top", local_var_configuration.base_path);
875 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
876
877 if let Some(ref local_var_str) = limit {
878 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
879 }
880 if let Some(ref local_var_str) = app {
881 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
882 }
883 if let Some(ref local_var_str) = kind {
884 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
885 }
886 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
887 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
888 }
889 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
890 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
891 };
892
893 let local_var_req = local_var_req_builder.build()?;
894 let local_var_resp = local_var_client.execute(local_var_req).await?;
895
896 let local_var_status = local_var_resp.status();
897 let local_var_content = local_var_resp.text().await?;
898
899 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
900 crate::from_str_patched(&local_var_content).map_err(Error::from)
901 } else {
902 let local_var_entity: Option<GetTopHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
903 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
904 Err(Error::ResponseError(local_var_error))
905 }
906}
907
908pub async fn get_triggers_count_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfScriptError>> {
909 let local_var_configuration = configuration;
910
911 let local_var_client = &local_var_configuration.client;
912
913 let local_var_uri_str = format!("{}/w/{workspace}/scripts/get_triggers_count/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
914 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
915
916 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
917 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
918 }
919 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
920 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
921 };
922
923 let local_var_req = local_var_req_builder.build()?;
924 let local_var_resp = local_var_client.execute(local_var_req).await?;
925
926 let local_var_status = local_var_resp.status();
927 let local_var_content = local_var_resp.text().await?;
928
929 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
930 crate::from_str_patched(&local_var_content).map_err(Error::from)
931 } else {
932 let local_var_entity: Option<GetTriggersCountOfScriptError> = crate::from_str_patched(&local_var_content).ok();
933 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
934 Err(Error::ResponseError(local_var_error))
935 }
936}
937
938pub async fn list_dedicated_with_deps(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListDedicatedWithDeps200ResponseInner>, Error<ListDedicatedWithDepsError>> {
939 let local_var_configuration = configuration;
940
941 let local_var_client = &local_var_configuration.client;
942
943 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_dedicated_with_deps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
944 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
945
946 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
947 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
948 }
949 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
950 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
951 };
952
953 let local_var_req = local_var_req_builder.build()?;
954 let local_var_resp = local_var_client.execute(local_var_req).await?;
955
956 let local_var_status = local_var_resp.status();
957 let local_var_content = local_var_resp.text().await?;
958
959 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
960 crate::from_str_patched(&local_var_content).map_err(Error::from)
961 } else {
962 let local_var_entity: Option<ListDedicatedWithDepsError> = crate::from_str_patched(&local_var_content).ok();
963 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
964 Err(Error::ResponseError(local_var_error))
965 }
966}
967
968pub async fn list_runnables(configuration: &configuration::Configuration, workspace: &str, order_by: Option<&str>, order_desc: Option<bool>, kinds: Option<&str>, show_archived: Option<bool>, include_without_main: Option<bool>, path_start: Option<&str>, label: Option<&str>, search: Option<&str>, per_page: Option<i32>, cursor: Option<&str>) -> Result<models::ListRunnables200Response, Error<ListRunnablesError>> {
969 let local_var_configuration = configuration;
970
971 let local_var_client = &local_var_configuration.client;
972
973 let local_var_uri_str = format!("{}/w/{workspace}/runnables/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
974 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
975
976 if let Some(ref local_var_str) = order_by {
977 local_var_req_builder = local_var_req_builder.query(&[("order_by", &local_var_str.to_string())]);
978 }
979 if let Some(ref local_var_str) = order_desc {
980 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
981 }
982 if let Some(ref local_var_str) = kinds {
983 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
984 }
985 if let Some(ref local_var_str) = show_archived {
986 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
987 }
988 if let Some(ref local_var_str) = include_without_main {
989 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
990 }
991 if let Some(ref local_var_str) = path_start {
992 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
993 }
994 if let Some(ref local_var_str) = label {
995 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
996 }
997 if let Some(ref local_var_str) = search {
998 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
999 }
1000 if let Some(ref local_var_str) = per_page {
1001 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1002 }
1003 if let Some(ref local_var_str) = cursor {
1004 local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1005 }
1006 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1007 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1008 }
1009 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1010 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1011 };
1012
1013 let local_var_req = local_var_req_builder.build()?;
1014 let local_var_resp = local_var_client.execute(local_var_req).await?;
1015
1016 let local_var_status = local_var_resp.status();
1017 let local_var_content = local_var_resp.text().await?;
1018
1019 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1020 crate::from_str_patched(&local_var_content).map_err(Error::from)
1021 } else {
1022 let local_var_entity: Option<ListRunnablesError> = crate::from_str_patched(&local_var_content).ok();
1023 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1024 Err(Error::ResponseError(local_var_error))
1025 }
1026}
1027
1028pub async fn list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
1029 let local_var_configuration = configuration;
1030
1031 let local_var_client = &local_var_configuration.client;
1032
1033 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1034 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1035
1036 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1037 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1038 }
1039 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1040 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1041 };
1042
1043 let local_var_req = local_var_req_builder.build()?;
1044 let local_var_resp = local_var_client.execute(local_var_req).await?;
1045
1046 let local_var_status = local_var_resp.status();
1047 let local_var_content = local_var_resp.text().await?;
1048
1049 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1050 crate::from_str_patched(&local_var_content).map_err(Error::from)
1051 } else {
1052 let local_var_entity: Option<ListScriptPathsError> = crate::from_str_patched(&local_var_content).ok();
1053 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1054 Err(Error::ResponseError(local_var_error))
1055 }
1056}
1057
1058pub async fn list_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
1059 let local_var_configuration = configuration;
1060
1061 let local_var_client = &local_var_configuration.client;
1062
1063 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths_from_workspace_runnable/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1064 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1065
1066 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1067 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1068 }
1069 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1070 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1071 };
1072
1073 let local_var_req = local_var_req_builder.build()?;
1074 let local_var_resp = local_var_client.execute(local_var_req).await?;
1075
1076 let local_var_status = local_var_resp.status();
1077 let local_var_content = local_var_resp.text().await?;
1078
1079 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1080 crate::from_str_patched(&local_var_content).map_err(Error::from)
1081 } else {
1082 let local_var_entity: Option<ListScriptPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
1083 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1084 Err(Error::ResponseError(local_var_error))
1085 }
1086}
1087
1088pub async fn list_scripts(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>, first_parent_hash: Option<&str>, last_parent_hash: Option<&str>, parent_hash: Option<&str>, show_archived: Option<bool>, include_without_main: Option<bool>, include_draft_only: Option<bool>, is_template: Option<bool>, kinds: Option<&str>, starred_only: Option<bool>, with_deployment_msg: Option<bool>, languages: Option<&str>, without_description: Option<bool>, dedicated_worker: Option<bool>, label: Option<&str>) -> Result<Vec<models::ListScripts200ResponseInner>, Error<ListScriptsError>> {
1089 let local_var_configuration = configuration;
1090
1091 let local_var_client = &local_var_configuration.client;
1092
1093 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1094 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1095
1096 if let Some(ref local_var_str) = page {
1097 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1098 }
1099 if let Some(ref local_var_str) = per_page {
1100 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1101 }
1102 if let Some(ref local_var_str) = order_desc {
1103 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
1104 }
1105 if let Some(ref local_var_str) = created_by {
1106 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
1107 }
1108 if let Some(ref local_var_str) = path_start {
1109 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1110 }
1111 if let Some(ref local_var_str) = path_exact {
1112 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
1113 }
1114 if let Some(ref local_var_str) = first_parent_hash {
1115 local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
1116 }
1117 if let Some(ref local_var_str) = last_parent_hash {
1118 local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
1119 }
1120 if let Some(ref local_var_str) = parent_hash {
1121 local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
1122 }
1123 if let Some(ref local_var_str) = show_archived {
1124 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1125 }
1126 if let Some(ref local_var_str) = include_without_main {
1127 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1128 }
1129 if let Some(ref local_var_str) = include_draft_only {
1130 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1131 }
1132 if let Some(ref local_var_str) = is_template {
1133 local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
1134 }
1135 if let Some(ref local_var_str) = kinds {
1136 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1137 }
1138 if let Some(ref local_var_str) = starred_only {
1139 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
1140 }
1141 if let Some(ref local_var_str) = with_deployment_msg {
1142 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
1143 }
1144 if let Some(ref local_var_str) = languages {
1145 local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
1146 }
1147 if let Some(ref local_var_str) = without_description {
1148 local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
1149 }
1150 if let Some(ref local_var_str) = dedicated_worker {
1151 local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
1152 }
1153 if let Some(ref local_var_str) = label {
1154 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1155 }
1156 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1157 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1158 }
1159 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1160 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1161 };
1162
1163 let local_var_req = local_var_req_builder.build()?;
1164 let local_var_resp = local_var_client.execute(local_var_req).await?;
1165
1166 let local_var_status = local_var_resp.status();
1167 let local_var_content = local_var_resp.text().await?;
1168
1169 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1170 crate::from_str_patched(&local_var_content).map_err(Error::from)
1171 } else {
1172 let local_var_entity: Option<ListScriptsError> = crate::from_str_patched(&local_var_content).ok();
1173 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1174 Err(Error::ResponseError(local_var_error))
1175 }
1176}
1177
1178pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
1179 let local_var_configuration = configuration;
1180
1181 let local_var_client = &local_var_configuration.client;
1182
1183 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1184 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1185
1186 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1187 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1188 }
1189 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1190 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1191 };
1192
1193 let local_var_req = local_var_req_builder.build()?;
1194 let local_var_resp = local_var_client.execute(local_var_req).await?;
1195
1196 let local_var_status = local_var_resp.status();
1197 let local_var_content = local_var_resp.text().await?;
1198
1199 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1200 crate::from_str_patched(&local_var_content).map_err(Error::from)
1201 } else {
1202 let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched(&local_var_content).ok();
1203 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1204 Err(Error::ResponseError(local_var_error))
1205 }
1206}
1207
1208pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
1209 let local_var_configuration = configuration;
1210
1211 let local_var_client = &local_var_configuration.client;
1212
1213 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_tokens/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1214 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1215
1216 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1217 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1218 }
1219 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1220 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1221 };
1222
1223 let local_var_req = local_var_req_builder.build()?;
1224 let local_var_resp = local_var_client.execute(local_var_req).await?;
1225
1226 let local_var_status = local_var_resp.status();
1227 let local_var_content = local_var_resp.text().await?;
1228
1229 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1230 crate::from_str_patched(&local_var_content).map_err(Error::from)
1231 } else {
1232 let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched(&local_var_content).ok();
1233 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1234 Err(Error::ResponseError(local_var_error))
1235 }
1236}
1237
1238pub async fn pick_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::PickHubScriptByPath200Response, Error<PickHubScriptByPathError>> {
1239 let local_var_configuration = configuration;
1240
1241 let local_var_client = &local_var_configuration.client;
1242
1243 let local_var_uri_str = format!("{}/scripts/hub/pick/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
1244 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1245
1246 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1247 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1248 }
1249 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1250 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1251 };
1252
1253 let local_var_req = local_var_req_builder.build()?;
1254 let local_var_resp = local_var_client.execute(local_var_req).await?;
1255
1256 let local_var_status = local_var_resp.status();
1257 let local_var_content = local_var_resp.text().await?;
1258
1259 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1260 crate::from_str_patched(&local_var_content).map_err(Error::from)
1261 } else {
1262 let local_var_entity: Option<PickHubScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1263 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1264 Err(Error::ResponseError(local_var_error))
1265 }
1266}
1267
1268pub async fn query_hub_scripts(configuration: &configuration::Configuration, text: &str, kind: Option<&str>, limit: Option<f64>, app: Option<&str>) -> Result<Vec<models::QueryHubScripts200ResponseInner>, Error<QueryHubScriptsError>> {
1269 let local_var_configuration = configuration;
1270
1271 let local_var_client = &local_var_configuration.client;
1272
1273 let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
1274 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1275
1276 local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
1277 if let Some(ref local_var_str) = kind {
1278 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
1279 }
1280 if let Some(ref local_var_str) = limit {
1281 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1282 }
1283 if let Some(ref local_var_str) = app {
1284 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
1285 }
1286 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1287 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1288 }
1289 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1290 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1291 };
1292
1293 let local_var_req = local_var_req_builder.build()?;
1294 let local_var_resp = local_var_client.execute(local_var_req).await?;
1295
1296 let local_var_status = local_var_resp.status();
1297 let local_var_content = local_var_resp.text().await?;
1298
1299 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1300 crate::from_str_patched(&local_var_content).map_err(Error::from)
1301 } else {
1302 let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
1303 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1304 Err(Error::ResponseError(local_var_error))
1305 }
1306}
1307
1308pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
1309 let local_var_configuration = configuration;
1310
1311 let local_var_client = &local_var_configuration.client;
1312
1313 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw/h/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1314 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1315
1316 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1317 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1318 }
1319 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1320 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1321 };
1322
1323 let local_var_req = local_var_req_builder.build()?;
1324 let local_var_resp = local_var_client.execute(local_var_req).await?;
1325
1326 let local_var_status = local_var_resp.status();
1327 let local_var_content = local_var_resp.text().await?;
1328
1329 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1330 crate::from_str_patched(&local_var_content).map_err(Error::from)
1331 } else {
1332 let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
1333 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1334 Err(Error::ResponseError(local_var_error))
1335 }
1336}
1337
1338pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
1339 let local_var_configuration = configuration;
1340
1341 let local_var_client = &local_var_configuration.client;
1342
1343 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1344 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1345
1346 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1347 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1348 }
1349 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1350 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1351 };
1352
1353 let local_var_req = local_var_req_builder.build()?;
1354 let local_var_resp = local_var_client.execute(local_var_req).await?;
1355
1356 let local_var_status = local_var_resp.status();
1357 let local_var_content = local_var_resp.text().await?;
1358
1359 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1360 crate::from_str_patched(&local_var_content).map_err(Error::from)
1361 } else {
1362 let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1363 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1364 Err(Error::ResponseError(local_var_error))
1365 }
1366}
1367
1368pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1369 let local_var_configuration = configuration;
1370
1371 let local_var_client = &local_var_configuration.client;
1372
1373 let local_var_uri_str = format!("{}/scripts_u/tokened_raw/{workspace}/{token}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), token=crate::apis::urlencode(token), path=crate::apis::urlencode(path));
1374 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1375
1376 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1377 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1378 }
1379 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1380 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1381 };
1382
1383 let local_var_req = local_var_req_builder.build()?;
1384 let local_var_resp = local_var_client.execute(local_var_req).await?;
1385
1386 let local_var_status = local_var_resp.status();
1387 let local_var_content = local_var_resp.text().await?;
1388
1389 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1390 crate::from_str_patched(&local_var_content).map_err(Error::from)
1391 } else {
1392 let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched(&local_var_content).ok();
1393 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1394 Err(Error::ResponseError(local_var_error))
1395 }
1396}
1397
1398pub async fn store_raw_script_temp(configuration: &configuration::Configuration, workspace: &str, body: &str) -> Result<String, Error<StoreRawScriptTempError>> {
1399 let local_var_configuration = configuration;
1400
1401 let local_var_client = &local_var_configuration.client;
1402
1403 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/store", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1404 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1405
1406 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1407 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1408 }
1409 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1410 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1411 };
1412 local_var_req_builder = local_var_req_builder.json(&body);
1413
1414 let local_var_req = local_var_req_builder.build()?;
1415 let local_var_resp = local_var_client.execute(local_var_req).await?;
1416
1417 let local_var_status = local_var_resp.status();
1418 let local_var_content = local_var_resp.text().await?;
1419
1420 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1421 crate::from_str_patched(&local_var_content).map_err(Error::from)
1422 } else {
1423 let local_var_entity: Option<StoreRawScriptTempError> = crate::from_str_patched(&local_var_content).ok();
1424 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1425 Err(Error::ResponseError(local_var_error))
1426 }
1427}
1428
1429pub async fn toggle_workspace_error_handler_for_script(configuration: &configuration::Configuration, workspace: &str, path: &str, toggle_workspace_error_handler_for_script_request: models::ToggleWorkspaceErrorHandlerForScriptRequest) -> Result<String, Error<ToggleWorkspaceErrorHandlerForScriptError>> {
1430 let local_var_configuration = configuration;
1431
1432 let local_var_client = &local_var_configuration.client;
1433
1434 let local_var_uri_str = format!("{}/w/{workspace}/scripts/toggle_workspace_error_handler/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1435 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1436
1437 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1438 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1439 }
1440 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1441 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1442 };
1443 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1444
1445 let local_var_req = local_var_req_builder.build()?;
1446 let local_var_resp = local_var_client.execute(local_var_req).await?;
1447
1448 let local_var_status = local_var_resp.status();
1449 let local_var_content = local_var_resp.text().await?;
1450
1451 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1452 crate::from_str_patched(&local_var_content).map_err(Error::from)
1453 } else {
1454 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched(&local_var_content).ok();
1455 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1456 Err(Error::ResponseError(local_var_error))
1457 }
1458}
1459
1460pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1461 let local_var_configuration = configuration;
1462
1463 let local_var_client = &local_var_configuration.client;
1464
1465 let local_var_uri_str = format!("{}/w/{workspace}/scripts/history_update/h/{hash}/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), hash=crate::apis::urlencode(hash), path=crate::apis::urlencode(path));
1466 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1467
1468 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1469 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1470 }
1471 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1472 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1473 };
1474 local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1475
1476 let local_var_req = local_var_req_builder.build()?;
1477 let local_var_resp = local_var_client.execute(local_var_req).await?;
1478
1479 let local_var_status = local_var_resp.status();
1480 let local_var_content = local_var_resp.text().await?;
1481
1482 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1483 crate::from_str_patched(&local_var_content).map_err(Error::from)
1484 } else {
1485 let local_var_entity: Option<UpdateScriptHistoryError> = crate::from_str_patched(&local_var_content).ok();
1486 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1487 Err(Error::ResponseError(local_var_error))
1488 }
1489}
1490