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 TriggerCiTestsBatchError {
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum UpdateScriptError {
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum UpdateScriptHistoryError {
281 UnknownValue(serde_json::Value),
282}
283
284
285pub async fn archive_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<ArchiveScriptByHashError>> {
286 let local_var_configuration = configuration;
287
288 let local_var_client = &local_var_configuration.client;
289
290 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));
291 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
292
293 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
294 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
295 }
296 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
297 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
298 };
299
300 let local_var_req = local_var_req_builder.build()?;
301 let local_var_resp = local_var_client.execute(local_var_req).await?;
302
303 let local_var_status = local_var_resp.status();
304 let local_var_content = local_var_resp.text().await?;
305
306 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
307 crate::from_str_patched(&local_var_content).map_err(Error::from)
308 } else {
309 let local_var_entity: Option<ArchiveScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
310 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
311 Err(Error::ResponseError(local_var_error))
312 }
313}
314
315pub async fn archive_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<ArchiveScriptByPathError>> {
316 let local_var_configuration = configuration;
317
318 let local_var_client = &local_var_configuration.client;
319
320 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));
321 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
322
323 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
324 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
325 }
326 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
327 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
328 };
329
330 let local_var_req = local_var_req_builder.build()?;
331 let local_var_resp = local_var_client.execute(local_var_req).await?;
332
333 let local_var_status = local_var_resp.status();
334 let local_var_content = local_var_resp.text().await?;
335
336 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
337 crate::from_str_patched(&local_var_content).map_err(Error::from)
338 } else {
339 let local_var_entity: Option<ArchiveScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
340 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
341 Err(Error::ResponseError(local_var_error))
342 }
343}
344
345pub async fn check_schema_contracts(configuration: &configuration::Configuration, workspace: &str, check_schema_contracts_request: models::CheckSchemaContractsRequest) -> Result<models::CheckSchemaContracts200Response, Error<CheckSchemaContractsError>> {
347 let local_var_configuration = configuration;
348
349 let local_var_client = &local_var_configuration.client;
350
351 let local_var_uri_str = format!("{}/w/{workspace}/scripts/check_schema_contracts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
352 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
353
354 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
355 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
356 }
357 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
358 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
359 };
360 local_var_req_builder = local_var_req_builder.json(&check_schema_contracts_request);
361
362 let local_var_req = local_var_req_builder.build()?;
363 let local_var_resp = local_var_client.execute(local_var_req).await?;
364
365 let local_var_status = local_var_resp.status();
366 let local_var_content = local_var_resp.text().await?;
367
368 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
369 crate::from_str_patched(&local_var_content).map_err(Error::from)
370 } else {
371 let local_var_entity: Option<CheckSchemaContractsError> = crate::from_str_patched(&local_var_content).ok();
372 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
373 Err(Error::ResponseError(local_var_error))
374 }
375}
376
377pub async fn count_runnables_by_owner(configuration: &configuration::Configuration, workspace: &str, kinds: Option<&str>, include_without_main: Option<bool>, include_draft_only: Option<bool>) -> Result<models::CountRunnablesByOwner200Response, Error<CountRunnablesByOwnerError>> {
378 let local_var_configuration = configuration;
379
380 let local_var_client = &local_var_configuration.client;
381
382 let local_var_uri_str = format!("{}/w/{workspace}/runnables/counts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
383 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
384
385 if let Some(ref local_var_str) = kinds {
386 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
387 }
388 if let Some(ref local_var_str) = include_without_main {
389 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
390 }
391 if let Some(ref local_var_str) = include_draft_only {
392 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
393 }
394 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
395 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
396 }
397 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
398 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
399 };
400
401 let local_var_req = local_var_req_builder.build()?;
402 let local_var_resp = local_var_client.execute(local_var_req).await?;
403
404 let local_var_status = local_var_resp.status();
405 let local_var_content = local_var_resp.text().await?;
406
407 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
408 crate::from_str_patched(&local_var_content).map_err(Error::from)
409 } else {
410 let local_var_entity: Option<CountRunnablesByOwnerError> = crate::from_str_patched(&local_var_content).ok();
411 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
412 Err(Error::ResponseError(local_var_error))
413 }
414}
415
416pub async fn create_script(configuration: &configuration::Configuration, workspace: &str, new_script: models::NewScript, skip_ci_tests: Option<bool>) -> Result<String, Error<CreateScriptError>> {
418 let local_var_configuration = configuration;
419
420 let local_var_client = &local_var_configuration.client;
421
422 let local_var_uri_str = format!("{}/w/{workspace}/scripts/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
423 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
424
425 if let Some(ref local_var_str) = skip_ci_tests {
426 local_var_req_builder = local_var_req_builder.query(&[("skip_ci_tests", &local_var_str.to_string())]);
427 }
428 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
429 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
430 }
431 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
432 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
433 };
434 local_var_req_builder = local_var_req_builder.json(&new_script);
435
436 let local_var_req = local_var_req_builder.build()?;
437 let local_var_resp = local_var_client.execute(local_var_req).await?;
438
439 let local_var_status = local_var_resp.status();
440 let local_var_content = local_var_resp.text().await?;
441
442 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
443 crate::from_str_patched(&local_var_content).map_err(Error::from)
444 } else {
445 let local_var_entity: Option<CreateScriptError> = crate::from_str_patched(&local_var_content).ok();
446 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
447 Err(Error::ResponseError(local_var_error))
448 }
449}
450
451pub async fn delete_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<DeleteScriptByHashError>> {
452 let local_var_configuration = configuration;
453
454 let local_var_client = &local_var_configuration.client;
455
456 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));
457 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
458
459 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
460 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
461 }
462 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
463 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
464 };
465
466 let local_var_req = local_var_req_builder.build()?;
467 let local_var_resp = local_var_client.execute(local_var_req).await?;
468
469 let local_var_status = local_var_resp.status();
470 let local_var_content = local_var_resp.text().await?;
471
472 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
473 crate::from_str_patched(&local_var_content).map_err(Error::from)
474 } else {
475 let local_var_entity: Option<DeleteScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
476 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
477 Err(Error::ResponseError(local_var_error))
478 }
479}
480
481pub async fn delete_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, keep_captures: Option<bool>) -> Result<String, Error<DeleteScriptByPathError>> {
482 let local_var_configuration = configuration;
483
484 let local_var_client = &local_var_configuration.client;
485
486 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));
487 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
488
489 if let Some(ref local_var_str) = keep_captures {
490 local_var_req_builder = local_var_req_builder.query(&[("keep_captures", &local_var_str.to_string())]);
491 }
492 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
493 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
494 }
495 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
496 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
497 };
498
499 let local_var_req = local_var_req_builder.build()?;
500 let local_var_resp = local_var_client.execute(local_var_req).await?;
501
502 let local_var_status = local_var_resp.status();
503 let local_var_content = local_var_resp.text().await?;
504
505 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
506 crate::from_str_patched(&local_var_content).map_err(Error::from)
507 } else {
508 let local_var_entity: Option<DeleteScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
509 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
510 Err(Error::ResponseError(local_var_error))
511 }
512}
513
514pub async fn delete_scripts_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteScriptsBulkError>> {
515 let local_var_configuration = configuration;
516
517 let local_var_client = &local_var_configuration.client;
518
519 let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
520 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
521
522 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
523 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
524 }
525 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
526 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
527 };
528 local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
529
530 let local_var_req = local_var_req_builder.build()?;
531 let local_var_resp = local_var_client.execute(local_var_req).await?;
532
533 let local_var_status = local_var_resp.status();
534 let local_var_content = local_var_resp.text().await?;
535
536 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
537 crate::from_str_patched(&local_var_content).map_err(Error::from)
538 } else {
539 let local_var_entity: Option<DeleteScriptsBulkError> = crate::from_str_patched(&local_var_content).ok();
540 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
541 Err(Error::ResponseError(local_var_error))
542 }
543}
544
545pub 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>> {
546 let local_var_configuration = configuration;
547
548 let local_var_client = &local_var_configuration.client;
549
550 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/diff", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
551 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
552
553 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
554 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
555 }
556 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
557 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
558 };
559 local_var_req_builder = local_var_req_builder.json(&diff_raw_scripts_with_deployed_request);
560
561 let local_var_req = local_var_req_builder.build()?;
562 let local_var_resp = local_var_client.execute(local_var_req).await?;
563
564 let local_var_status = local_var_resp.status();
565 let local_var_content = local_var_resp.text().await?;
566
567 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
568 crate::from_str_patched(&local_var_content).map_err(Error::from)
569 } else {
570 let local_var_entity: Option<DiffRawScriptsWithDeployedError> = crate::from_str_patched(&local_var_content).ok();
571 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
572 Err(Error::ResponseError(local_var_error))
573 }
574}
575
576pub async fn exists_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsScriptByPathError>> {
577 let local_var_configuration = configuration;
578
579 let local_var_client = &local_var_configuration.client;
580
581 let local_var_uri_str = format!("{}/w/{workspace}/scripts/exists/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
582 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
583
584 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
585 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
586 }
587 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
588 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
589 };
590
591 let local_var_req = local_var_req_builder.build()?;
592 let local_var_resp = local_var_client.execute(local_var_req).await?;
593
594 let local_var_status = local_var_resp.status();
595 let local_var_content = local_var_resp.text().await?;
596
597 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
598 crate::from_str_patched(&local_var_content).map_err(Error::from)
599 } else {
600 let local_var_entity: Option<ExistsScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
601 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
602 Err(Error::ResponseError(local_var_error))
603 }
604}
605
606pub async fn get_ci_test_results(configuration: &configuration::Configuration, workspace: &str, kind: &str, path: &str) -> Result<Vec<models::CiTestResult>, Error<GetCiTestResultsError>> {
607 let local_var_configuration = configuration;
608
609 let local_var_client = &local_var_configuration.client;
610
611 let local_var_uri_str = format!("{}/w/{workspace}/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));
612 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
613
614 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
615 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
616 }
617 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
618 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
619 };
620
621 let local_var_req = local_var_req_builder.build()?;
622 let local_var_resp = local_var_client.execute(local_var_req).await?;
623
624 let local_var_status = local_var_resp.status();
625 let local_var_content = local_var_resp.text().await?;
626
627 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
628 crate::from_str_patched(&local_var_content).map_err(Error::from)
629 } else {
630 let local_var_entity: Option<GetCiTestResultsError> = crate::from_str_patched(&local_var_content).ok();
631 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
632 Err(Error::ResponseError(local_var_error))
633 }
634}
635
636pub 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>> {
637 let local_var_configuration = configuration;
638
639 let local_var_client = &local_var_configuration.client;
640
641 let local_var_uri_str = format!("{}/w/{workspace}/scripts/ci_test_results_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
642 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
643
644 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
645 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
646 }
647 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
648 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
649 };
650 local_var_req_builder = local_var_req_builder.json(&get_ci_test_results_batch_request);
651
652 let local_var_req = local_var_req_builder.build()?;
653 let local_var_resp = local_var_client.execute(local_var_req).await?;
654
655 let local_var_status = local_var_resp.status();
656 let local_var_content = local_var_resp.text().await?;
657
658 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
659 crate::from_str_patched(&local_var_content).map_err(Error::from)
660 } else {
661 let local_var_entity: Option<GetCiTestResultsBatchError> = crate::from_str_patched(&local_var_content).ok();
662 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
663 Err(Error::ResponseError(local_var_error))
664 }
665}
666
667pub async fn get_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::GetHubScriptByPath200Response, Error<GetHubScriptByPathError>> {
668 let local_var_configuration = configuration;
669
670 let local_var_client = &local_var_configuration.client;
671
672 let local_var_uri_str = format!("{}/scripts/hub/get_full/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
673 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
674
675 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
676 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
677 }
678 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
679 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
680 };
681
682 let local_var_req = local_var_req_builder.build()?;
683 let local_var_resp = local_var_client.execute(local_var_req).await?;
684
685 let local_var_status = local_var_resp.status();
686 let local_var_content = local_var_resp.text().await?;
687
688 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
689 crate::from_str_patched(&local_var_content).map_err(Error::from)
690 } else {
691 let local_var_entity: Option<GetHubScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
692 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
693 Err(Error::ResponseError(local_var_error))
694 }
695}
696
697pub async fn get_hub_script_content_by_path(configuration: &configuration::Configuration, path: &str) -> Result<String, Error<GetHubScriptContentByPathError>> {
698 let local_var_configuration = configuration;
699
700 let local_var_client = &local_var_configuration.client;
701
702 let local_var_uri_str = format!("{}/scripts/hub/get/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
703 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
704
705 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
706 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
707 }
708 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
709 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
710 };
711
712 let local_var_req = local_var_req_builder.build()?;
713 let local_var_resp = local_var_client.execute(local_var_req).await?;
714
715 let local_var_status = local_var_resp.status();
716 let local_var_content = local_var_resp.text().await?;
717
718 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
719 crate::from_str_patched(&local_var_content).map_err(Error::from)
720 } else {
721 let local_var_entity: Option<GetHubScriptContentByPathError> = crate::from_str_patched(&local_var_content).ok();
722 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
723 Err(Error::ResponseError(local_var_error))
724 }
725}
726
727pub 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>> {
728 let local_var_configuration = configuration;
729
730 let local_var_client = &local_var_configuration.client;
731
732 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));
733 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
734
735 if let Some(ref local_var_str) = with_starred_info {
736 local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
737 }
738 if let Some(ref local_var_str) = authed {
739 local_var_req_builder = local_var_req_builder.query(&[("authed", &local_var_str.to_string())]);
740 }
741 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
742 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
743 }
744 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
745 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
746 };
747
748 let local_var_req = local_var_req_builder.build()?;
749 let local_var_resp = local_var_client.execute(local_var_req).await?;
750
751 let local_var_status = local_var_resp.status();
752 let local_var_content = local_var_resp.text().await?;
753
754 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
755 crate::from_str_patched(&local_var_content).map_err(Error::from)
756 } else {
757 let local_var_entity: Option<GetScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
758 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
759 Err(Error::ResponseError(local_var_error))
760 }
761}
762
763pub 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>> {
764 let local_var_configuration = configuration;
765
766 let local_var_client = &local_var_configuration.client;
767
768 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));
769 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
770
771 if let Some(ref local_var_str) = with_starred_info {
772 local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
773 }
774 if let Some(ref local_var_str) = get_draft {
775 local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
776 }
777 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
778 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
779 }
780 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
781 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
782 };
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<GetScriptByPathError> = 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 get_script_deployment_status(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::GetScriptDeploymentStatus200Response, Error<GetScriptDeploymentStatusError>> {
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}/scripts/deployment_status/h/{hash}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), hash=crate::apis::urlencode(hash));
805 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
806
807 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
808 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
809 }
810 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
811 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
812 };
813
814 let local_var_req = local_var_req_builder.build()?;
815 let local_var_resp = local_var_client.execute(local_var_req).await?;
816
817 let local_var_status = local_var_resp.status();
818 let local_var_content = local_var_resp.text().await?;
819
820 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
821 crate::from_str_patched(&local_var_content).map_err(Error::from)
822 } else {
823 let local_var_entity: Option<GetScriptDeploymentStatusError> = crate::from_str_patched(&local_var_content).ok();
824 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
825 Err(Error::ResponseError(local_var_error))
826 }
827}
828
829pub async fn get_script_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::ScriptHistory>, Error<GetScriptHistoryByPathError>> {
830 let local_var_configuration = configuration;
831
832 let local_var_client = &local_var_configuration.client;
833
834 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));
835 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
836
837 if let Some(ref local_var_str) = page {
838 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
839 }
840 if let Some(ref local_var_str) = per_page {
841 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
842 }
843 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
844 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
845 }
846 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
847 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
848 };
849
850 let local_var_req = local_var_req_builder.build()?;
851 let local_var_resp = local_var_client.execute(local_var_req).await?;
852
853 let local_var_status = local_var_resp.status();
854 let local_var_content = local_var_resp.text().await?;
855
856 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
857 crate::from_str_patched(&local_var_content).map_err(Error::from)
858 } else {
859 let local_var_entity: Option<GetScriptHistoryByPathError> = crate::from_str_patched(&local_var_content).ok();
860 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
861 Err(Error::ResponseError(local_var_error))
862 }
863}
864
865pub async fn get_script_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ScriptHistory, Error<GetScriptLatestVersionError>> {
866 let local_var_configuration = configuration;
867
868 let local_var_client = &local_var_configuration.client;
869
870 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));
871 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
872
873 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
874 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
875 }
876 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
877 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
878 };
879
880 let local_var_req = local_var_req_builder.build()?;
881 let local_var_resp = local_var_client.execute(local_var_req).await?;
882
883 let local_var_status = local_var_resp.status();
884 let local_var_content = local_var_resp.text().await?;
885
886 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
887 crate::from_str_patched(&local_var_content).map_err(Error::from)
888 } else {
889 let local_var_entity: Option<GetScriptLatestVersionError> = crate::from_str_patched(&local_var_content).ok();
890 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
891 Err(Error::ResponseError(local_var_error))
892 }
893}
894
895pub async fn get_top_hub_scripts(configuration: &configuration::Configuration, limit: Option<f64>, app: Option<&str>, kind: Option<&str>) -> Result<models::GetTopHubScripts200Response, Error<GetTopHubScriptsError>> {
896 let local_var_configuration = configuration;
897
898 let local_var_client = &local_var_configuration.client;
899
900 let local_var_uri_str = format!("{}/scripts/hub/top", local_var_configuration.base_path);
901 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
902
903 if let Some(ref local_var_str) = limit {
904 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
905 }
906 if let Some(ref local_var_str) = app {
907 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
908 }
909 if let Some(ref local_var_str) = kind {
910 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
911 }
912 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
913 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
914 }
915 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
916 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
917 };
918
919 let local_var_req = local_var_req_builder.build()?;
920 let local_var_resp = local_var_client.execute(local_var_req).await?;
921
922 let local_var_status = local_var_resp.status();
923 let local_var_content = local_var_resp.text().await?;
924
925 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
926 crate::from_str_patched(&local_var_content).map_err(Error::from)
927 } else {
928 let local_var_entity: Option<GetTopHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
929 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
930 Err(Error::ResponseError(local_var_error))
931 }
932}
933
934pub async fn get_triggers_count_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfScriptError>> {
935 let local_var_configuration = configuration;
936
937 let local_var_client = &local_var_configuration.client;
938
939 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));
940 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
941
942 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
943 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
944 }
945 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
946 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
947 };
948
949 let local_var_req = local_var_req_builder.build()?;
950 let local_var_resp = local_var_client.execute(local_var_req).await?;
951
952 let local_var_status = local_var_resp.status();
953 let local_var_content = local_var_resp.text().await?;
954
955 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
956 crate::from_str_patched(&local_var_content).map_err(Error::from)
957 } else {
958 let local_var_entity: Option<GetTriggersCountOfScriptError> = crate::from_str_patched(&local_var_content).ok();
959 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
960 Err(Error::ResponseError(local_var_error))
961 }
962}
963
964pub async fn list_dedicated_with_deps(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListDedicatedWithDeps200ResponseInner>, Error<ListDedicatedWithDepsError>> {
965 let local_var_configuration = configuration;
966
967 let local_var_client = &local_var_configuration.client;
968
969 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_dedicated_with_deps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
970 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
971
972 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
973 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
974 }
975 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
976 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
977 };
978
979 let local_var_req = local_var_req_builder.build()?;
980 let local_var_resp = local_var_client.execute(local_var_req).await?;
981
982 let local_var_status = local_var_resp.status();
983 let local_var_content = local_var_resp.text().await?;
984
985 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
986 crate::from_str_patched(&local_var_content).map_err(Error::from)
987 } else {
988 let local_var_entity: Option<ListDedicatedWithDepsError> = crate::from_str_patched(&local_var_content).ok();
989 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
990 Err(Error::ResponseError(local_var_error))
991 }
992}
993
994pub 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>, paths: Option<&str>, label: Option<&str>, search: Option<&str>, search_any_order: Option<bool>, per_page: Option<i32>, cursor: Option<&str>, include_draft_only: Option<bool>) -> Result<models::ListRunnables200Response, Error<ListRunnablesError>> {
995 let local_var_configuration = configuration;
996
997 let local_var_client = &local_var_configuration.client;
998
999 let local_var_uri_str = format!("{}/w/{workspace}/runnables/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1000 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1001
1002 if let Some(ref local_var_str) = order_by {
1003 local_var_req_builder = local_var_req_builder.query(&[("order_by", &local_var_str.to_string())]);
1004 }
1005 if let Some(ref local_var_str) = order_desc {
1006 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
1007 }
1008 if let Some(ref local_var_str) = kinds {
1009 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1010 }
1011 if let Some(ref local_var_str) = show_archived {
1012 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1013 }
1014 if let Some(ref local_var_str) = include_without_main {
1015 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1016 }
1017 if let Some(ref local_var_str) = path_start {
1018 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1019 }
1020 if let Some(ref local_var_str) = paths {
1021 local_var_req_builder = local_var_req_builder.query(&[("paths", &local_var_str.to_string())]);
1022 }
1023 if let Some(ref local_var_str) = label {
1024 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1025 }
1026 if let Some(ref local_var_str) = search {
1027 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1028 }
1029 if let Some(ref local_var_str) = search_any_order {
1030 local_var_req_builder = local_var_req_builder.query(&[("search_any_order", &local_var_str.to_string())]);
1031 }
1032 if let Some(ref local_var_str) = per_page {
1033 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1034 }
1035 if let Some(ref local_var_str) = cursor {
1036 local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1037 }
1038 if let Some(ref local_var_str) = include_draft_only {
1039 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1040 }
1041 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1042 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1043 }
1044 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1045 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1046 };
1047
1048 let local_var_req = local_var_req_builder.build()?;
1049 let local_var_resp = local_var_client.execute(local_var_req).await?;
1050
1051 let local_var_status = local_var_resp.status();
1052 let local_var_content = local_var_resp.text().await?;
1053
1054 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1055 crate::from_str_patched(&local_var_content).map_err(Error::from)
1056 } else {
1057 let local_var_entity: Option<ListRunnablesError> = crate::from_str_patched(&local_var_content).ok();
1058 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1059 Err(Error::ResponseError(local_var_error))
1060 }
1061}
1062
1063pub async fn list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
1064 let local_var_configuration = configuration;
1065
1066 let local_var_client = &local_var_configuration.client;
1067
1068 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1069 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1070
1071 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1072 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1073 }
1074 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1075 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1076 };
1077
1078 let local_var_req = local_var_req_builder.build()?;
1079 let local_var_resp = local_var_client.execute(local_var_req).await?;
1080
1081 let local_var_status = local_var_resp.status();
1082 let local_var_content = local_var_resp.text().await?;
1083
1084 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1085 crate::from_str_patched(&local_var_content).map_err(Error::from)
1086 } else {
1087 let local_var_entity: Option<ListScriptPathsError> = crate::from_str_patched(&local_var_content).ok();
1088 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1089 Err(Error::ResponseError(local_var_error))
1090 }
1091}
1092
1093pub async fn list_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
1094 let local_var_configuration = configuration;
1095
1096 let local_var_client = &local_var_configuration.client;
1097
1098 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));
1099 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1100
1101 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1102 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1103 }
1104 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1105 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1106 };
1107
1108 let local_var_req = local_var_req_builder.build()?;
1109 let local_var_resp = local_var_client.execute(local_var_req).await?;
1110
1111 let local_var_status = local_var_resp.status();
1112 let local_var_content = local_var_resp.text().await?;
1113
1114 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1115 crate::from_str_patched(&local_var_content).map_err(Error::from)
1116 } else {
1117 let local_var_entity: Option<ListScriptPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
1118 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1119 Err(Error::ResponseError(local_var_error))
1120 }
1121}
1122
1123pub 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>> {
1124 let local_var_configuration = configuration;
1125
1126 let local_var_client = &local_var_configuration.client;
1127
1128 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1129 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1130
1131 if let Some(ref local_var_str) = page {
1132 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1133 }
1134 if let Some(ref local_var_str) = per_page {
1135 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1136 }
1137 if let Some(ref local_var_str) = order_desc {
1138 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
1139 }
1140 if let Some(ref local_var_str) = created_by {
1141 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
1142 }
1143 if let Some(ref local_var_str) = path_start {
1144 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1145 }
1146 if let Some(ref local_var_str) = path_exact {
1147 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
1148 }
1149 if let Some(ref local_var_str) = first_parent_hash {
1150 local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
1151 }
1152 if let Some(ref local_var_str) = last_parent_hash {
1153 local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
1154 }
1155 if let Some(ref local_var_str) = parent_hash {
1156 local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
1157 }
1158 if let Some(ref local_var_str) = show_archived {
1159 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1160 }
1161 if let Some(ref local_var_str) = include_without_main {
1162 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1163 }
1164 if let Some(ref local_var_str) = include_draft_only {
1165 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1166 }
1167 if let Some(ref local_var_str) = is_template {
1168 local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
1169 }
1170 if let Some(ref local_var_str) = kinds {
1171 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1172 }
1173 if let Some(ref local_var_str) = starred_only {
1174 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
1175 }
1176 if let Some(ref local_var_str) = with_deployment_msg {
1177 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
1178 }
1179 if let Some(ref local_var_str) = languages {
1180 local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
1181 }
1182 if let Some(ref local_var_str) = without_description {
1183 local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
1184 }
1185 if let Some(ref local_var_str) = dedicated_worker {
1186 local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
1187 }
1188 if let Some(ref local_var_str) = label {
1189 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1190 }
1191 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1192 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1193 }
1194 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1195 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1196 };
1197
1198 let local_var_req = local_var_req_builder.build()?;
1199 let local_var_resp = local_var_client.execute(local_var_req).await?;
1200
1201 let local_var_status = local_var_resp.status();
1202 let local_var_content = local_var_resp.text().await?;
1203
1204 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1205 crate::from_str_patched(&local_var_content).map_err(Error::from)
1206 } else {
1207 let local_var_entity: Option<ListScriptsError> = crate::from_str_patched(&local_var_content).ok();
1208 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1209 Err(Error::ResponseError(local_var_error))
1210 }
1211}
1212
1213pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
1214 let local_var_configuration = configuration;
1215
1216 let local_var_client = &local_var_configuration.client;
1217
1218 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1219 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1220
1221 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1222 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1223 }
1224 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1225 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1226 };
1227
1228 let local_var_req = local_var_req_builder.build()?;
1229 let local_var_resp = local_var_client.execute(local_var_req).await?;
1230
1231 let local_var_status = local_var_resp.status();
1232 let local_var_content = local_var_resp.text().await?;
1233
1234 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1235 crate::from_str_patched(&local_var_content).map_err(Error::from)
1236 } else {
1237 let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched(&local_var_content).ok();
1238 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1239 Err(Error::ResponseError(local_var_error))
1240 }
1241}
1242
1243pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
1244 let local_var_configuration = configuration;
1245
1246 let local_var_client = &local_var_configuration.client;
1247
1248 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));
1249 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1250
1251 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1252 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1253 }
1254 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1255 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1256 };
1257
1258 let local_var_req = local_var_req_builder.build()?;
1259 let local_var_resp = local_var_client.execute(local_var_req).await?;
1260
1261 let local_var_status = local_var_resp.status();
1262 let local_var_content = local_var_resp.text().await?;
1263
1264 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1265 crate::from_str_patched(&local_var_content).map_err(Error::from)
1266 } else {
1267 let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched(&local_var_content).ok();
1268 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1269 Err(Error::ResponseError(local_var_error))
1270 }
1271}
1272
1273pub async fn pick_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::PickHubResourceType200Response, Error<PickHubScriptByPathError>> {
1274 let local_var_configuration = configuration;
1275
1276 let local_var_client = &local_var_configuration.client;
1277
1278 let local_var_uri_str = format!("{}/scripts/hub/pick/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
1279 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1280
1281 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1282 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1283 }
1284 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1285 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1286 };
1287
1288 let local_var_req = local_var_req_builder.build()?;
1289 let local_var_resp = local_var_client.execute(local_var_req).await?;
1290
1291 let local_var_status = local_var_resp.status();
1292 let local_var_content = local_var_resp.text().await?;
1293
1294 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1295 crate::from_str_patched(&local_var_content).map_err(Error::from)
1296 } else {
1297 let local_var_entity: Option<PickHubScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1298 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1299 Err(Error::ResponseError(local_var_error))
1300 }
1301}
1302
1303pub 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>> {
1304 let local_var_configuration = configuration;
1305
1306 let local_var_client = &local_var_configuration.client;
1307
1308 let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
1309 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1310
1311 local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
1312 if let Some(ref local_var_str) = kind {
1313 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
1314 }
1315 if let Some(ref local_var_str) = limit {
1316 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1317 }
1318 if let Some(ref local_var_str) = app {
1319 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
1320 }
1321 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1322 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1323 }
1324 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1325 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1326 };
1327
1328 let local_var_req = local_var_req_builder.build()?;
1329 let local_var_resp = local_var_client.execute(local_var_req).await?;
1330
1331 let local_var_status = local_var_resp.status();
1332 let local_var_content = local_var_resp.text().await?;
1333
1334 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1335 crate::from_str_patched(&local_var_content).map_err(Error::from)
1336 } else {
1337 let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
1338 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1339 Err(Error::ResponseError(local_var_error))
1340 }
1341}
1342
1343pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
1344 let local_var_configuration = configuration;
1345
1346 let local_var_client = &local_var_configuration.client;
1347
1348 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));
1349 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1350
1351 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1352 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1353 }
1354 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1355 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1356 };
1357
1358 let local_var_req = local_var_req_builder.build()?;
1359 let local_var_resp = local_var_client.execute(local_var_req).await?;
1360
1361 let local_var_status = local_var_resp.status();
1362 let local_var_content = local_var_resp.text().await?;
1363
1364 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1365 crate::from_str_patched(&local_var_content).map_err(Error::from)
1366 } else {
1367 let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
1368 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1369 Err(Error::ResponseError(local_var_error))
1370 }
1371}
1372
1373pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
1374 let local_var_configuration = configuration;
1375
1376 let local_var_client = &local_var_configuration.client;
1377
1378 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));
1379 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1380
1381 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1382 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1383 }
1384 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1385 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1386 };
1387
1388 let local_var_req = local_var_req_builder.build()?;
1389 let local_var_resp = local_var_client.execute(local_var_req).await?;
1390
1391 let local_var_status = local_var_resp.status();
1392 let local_var_content = local_var_resp.text().await?;
1393
1394 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1395 crate::from_str_patched(&local_var_content).map_err(Error::from)
1396 } else {
1397 let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1398 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1399 Err(Error::ResponseError(local_var_error))
1400 }
1401}
1402
1403pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1404 let local_var_configuration = configuration;
1405
1406 let local_var_client = &local_var_configuration.client;
1407
1408 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));
1409 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1410
1411 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1412 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1413 }
1414 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1415 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1416 };
1417
1418 let local_var_req = local_var_req_builder.build()?;
1419 let local_var_resp = local_var_client.execute(local_var_req).await?;
1420
1421 let local_var_status = local_var_resp.status();
1422 let local_var_content = local_var_resp.text().await?;
1423
1424 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1425 crate::from_str_patched(&local_var_content).map_err(Error::from)
1426 } else {
1427 let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched(&local_var_content).ok();
1428 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1429 Err(Error::ResponseError(local_var_error))
1430 }
1431}
1432
1433pub async fn store_raw_script_temp(configuration: &configuration::Configuration, workspace: &str, body: &str) -> Result<String, Error<StoreRawScriptTempError>> {
1434 let local_var_configuration = configuration;
1435
1436 let local_var_client = &local_var_configuration.client;
1437
1438 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/store", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1439 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1440
1441 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1442 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1443 }
1444 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1445 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1446 };
1447 local_var_req_builder = local_var_req_builder.json(&body);
1448
1449 let local_var_req = local_var_req_builder.build()?;
1450 let local_var_resp = local_var_client.execute(local_var_req).await?;
1451
1452 let local_var_status = local_var_resp.status();
1453 let local_var_content = local_var_resp.text().await?;
1454
1455 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1456 crate::from_str_patched(&local_var_content).map_err(Error::from)
1457 } else {
1458 let local_var_entity: Option<StoreRawScriptTempError> = crate::from_str_patched(&local_var_content).ok();
1459 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1460 Err(Error::ResponseError(local_var_error))
1461 }
1462}
1463
1464pub 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>> {
1465 let local_var_configuration = configuration;
1466
1467 let local_var_client = &local_var_configuration.client;
1468
1469 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));
1470 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1471
1472 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1473 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1474 }
1475 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1476 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1477 };
1478 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1479
1480 let local_var_req = local_var_req_builder.build()?;
1481 let local_var_resp = local_var_client.execute(local_var_req).await?;
1482
1483 let local_var_status = local_var_resp.status();
1484 let local_var_content = local_var_resp.text().await?;
1485
1486 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1487 crate::from_str_patched(&local_var_content).map_err(Error::from)
1488 } else {
1489 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched(&local_var_content).ok();
1490 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1491 Err(Error::ResponseError(local_var_error))
1492 }
1493}
1494
1495pub async fn trigger_ci_tests_batch(configuration: &configuration::Configuration, workspace: &str, trigger_ci_tests_batch_request: models::TriggerCiTestsBatchRequest) -> Result<models::TriggerCiTestsBatch200Response, Error<TriggerCiTestsBatchError>> {
1497 let local_var_configuration = configuration;
1498
1499 let local_var_client = &local_var_configuration.client;
1500
1501 let local_var_uri_str = format!("{}/w/{workspace}/scripts/trigger_ci_tests_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1502 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1503
1504 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1505 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1506 }
1507 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1508 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1509 };
1510 local_var_req_builder = local_var_req_builder.json(&trigger_ci_tests_batch_request);
1511
1512 let local_var_req = local_var_req_builder.build()?;
1513 let local_var_resp = local_var_client.execute(local_var_req).await?;
1514
1515 let local_var_status = local_var_resp.status();
1516 let local_var_content = local_var_resp.text().await?;
1517
1518 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1519 crate::from_str_patched(&local_var_content).map_err(Error::from)
1520 } else {
1521 let local_var_entity: Option<TriggerCiTestsBatchError> = crate::from_str_patched(&local_var_content).ok();
1522 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1523 Err(Error::ResponseError(local_var_error))
1524 }
1525}
1526
1527pub async fn update_script(configuration: &configuration::Configuration, workspace: &str, path: &str, new_script: models::NewScript, skip_ci_tests: Option<bool>) -> Result<String, Error<UpdateScriptError>> {
1529 let local_var_configuration = configuration;
1530
1531 let local_var_client = &local_var_configuration.client;
1532
1533 let local_var_uri_str = format!("{}/w/{workspace}/scripts/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1534 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1535
1536 if let Some(ref local_var_str) = skip_ci_tests {
1537 local_var_req_builder = local_var_req_builder.query(&[("skip_ci_tests", &local_var_str.to_string())]);
1538 }
1539 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1540 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1541 }
1542 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1543 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1544 };
1545 local_var_req_builder = local_var_req_builder.json(&new_script);
1546
1547 let local_var_req = local_var_req_builder.build()?;
1548 let local_var_resp = local_var_client.execute(local_var_req).await?;
1549
1550 let local_var_status = local_var_resp.status();
1551 let local_var_content = local_var_resp.text().await?;
1552
1553 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1554 crate::from_str_patched(&local_var_content).map_err(Error::from)
1555 } else {
1556 let local_var_entity: Option<UpdateScriptError> = crate::from_str_patched(&local_var_content).ok();
1557 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1558 Err(Error::ResponseError(local_var_error))
1559 }
1560}
1561
1562pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1563 let local_var_configuration = configuration;
1564
1565 let local_var_client = &local_var_configuration.client;
1566
1567 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));
1568 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1569
1570 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1571 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1572 }
1573 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1574 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1575 };
1576 local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1577
1578 let local_var_req = local_var_req_builder.build()?;
1579 let local_var_resp = local_var_client.execute(local_var_req).await?;
1580
1581 let local_var_status = local_var_resp.status();
1582 let local_var_content = local_var_resp.text().await?;
1583
1584 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1585 crate::from_str_patched(&local_var_content).map_err(Error::from)
1586 } else {
1587 let local_var_entity: Option<UpdateScriptHistoryError> = crate::from_str_patched(&local_var_content).ok();
1588 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1589 Err(Error::ResponseError(local_var_error))
1590 }
1591}
1592