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>, 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) = per_page {
1030 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1031 }
1032 if let Some(ref local_var_str) = cursor {
1033 local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1034 }
1035 if let Some(ref local_var_str) = include_draft_only {
1036 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1037 }
1038 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1039 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1040 }
1041 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1042 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1043 };
1044
1045 let local_var_req = local_var_req_builder.build()?;
1046 let local_var_resp = local_var_client.execute(local_var_req).await?;
1047
1048 let local_var_status = local_var_resp.status();
1049 let local_var_content = local_var_resp.text().await?;
1050
1051 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1052 crate::from_str_patched(&local_var_content).map_err(Error::from)
1053 } else {
1054 let local_var_entity: Option<ListRunnablesError> = crate::from_str_patched(&local_var_content).ok();
1055 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1056 Err(Error::ResponseError(local_var_error))
1057 }
1058}
1059
1060pub async fn list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
1061 let local_var_configuration = configuration;
1062
1063 let local_var_client = &local_var_configuration.client;
1064
1065 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1066 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1067
1068 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1069 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1070 }
1071 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1072 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1073 };
1074
1075 let local_var_req = local_var_req_builder.build()?;
1076 let local_var_resp = local_var_client.execute(local_var_req).await?;
1077
1078 let local_var_status = local_var_resp.status();
1079 let local_var_content = local_var_resp.text().await?;
1080
1081 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1082 crate::from_str_patched(&local_var_content).map_err(Error::from)
1083 } else {
1084 let local_var_entity: Option<ListScriptPathsError> = crate::from_str_patched(&local_var_content).ok();
1085 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1086 Err(Error::ResponseError(local_var_error))
1087 }
1088}
1089
1090pub async fn list_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
1091 let local_var_configuration = configuration;
1092
1093 let local_var_client = &local_var_configuration.client;
1094
1095 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));
1096 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1097
1098 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1099 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1100 }
1101 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1102 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1103 };
1104
1105 let local_var_req = local_var_req_builder.build()?;
1106 let local_var_resp = local_var_client.execute(local_var_req).await?;
1107
1108 let local_var_status = local_var_resp.status();
1109 let local_var_content = local_var_resp.text().await?;
1110
1111 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1112 crate::from_str_patched(&local_var_content).map_err(Error::from)
1113 } else {
1114 let local_var_entity: Option<ListScriptPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
1115 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1116 Err(Error::ResponseError(local_var_error))
1117 }
1118}
1119
1120pub 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>> {
1121 let local_var_configuration = configuration;
1122
1123 let local_var_client = &local_var_configuration.client;
1124
1125 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1126 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1127
1128 if let Some(ref local_var_str) = page {
1129 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1130 }
1131 if let Some(ref local_var_str) = per_page {
1132 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1133 }
1134 if let Some(ref local_var_str) = order_desc {
1135 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
1136 }
1137 if let Some(ref local_var_str) = created_by {
1138 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
1139 }
1140 if let Some(ref local_var_str) = path_start {
1141 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1142 }
1143 if let Some(ref local_var_str) = path_exact {
1144 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
1145 }
1146 if let Some(ref local_var_str) = first_parent_hash {
1147 local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
1148 }
1149 if let Some(ref local_var_str) = last_parent_hash {
1150 local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
1151 }
1152 if let Some(ref local_var_str) = parent_hash {
1153 local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
1154 }
1155 if let Some(ref local_var_str) = show_archived {
1156 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1157 }
1158 if let Some(ref local_var_str) = include_without_main {
1159 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1160 }
1161 if let Some(ref local_var_str) = include_draft_only {
1162 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1163 }
1164 if let Some(ref local_var_str) = is_template {
1165 local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
1166 }
1167 if let Some(ref local_var_str) = kinds {
1168 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1169 }
1170 if let Some(ref local_var_str) = starred_only {
1171 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
1172 }
1173 if let Some(ref local_var_str) = with_deployment_msg {
1174 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
1175 }
1176 if let Some(ref local_var_str) = languages {
1177 local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
1178 }
1179 if let Some(ref local_var_str) = without_description {
1180 local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
1181 }
1182 if let Some(ref local_var_str) = dedicated_worker {
1183 local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
1184 }
1185 if let Some(ref local_var_str) = label {
1186 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1187 }
1188 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1189 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1190 }
1191 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1192 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1193 };
1194
1195 let local_var_req = local_var_req_builder.build()?;
1196 let local_var_resp = local_var_client.execute(local_var_req).await?;
1197
1198 let local_var_status = local_var_resp.status();
1199 let local_var_content = local_var_resp.text().await?;
1200
1201 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1202 crate::from_str_patched(&local_var_content).map_err(Error::from)
1203 } else {
1204 let local_var_entity: Option<ListScriptsError> = crate::from_str_patched(&local_var_content).ok();
1205 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1206 Err(Error::ResponseError(local_var_error))
1207 }
1208}
1209
1210pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
1211 let local_var_configuration = configuration;
1212
1213 let local_var_client = &local_var_configuration.client;
1214
1215 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1216 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1217
1218 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1219 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1220 }
1221 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1222 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1223 };
1224
1225 let local_var_req = local_var_req_builder.build()?;
1226 let local_var_resp = local_var_client.execute(local_var_req).await?;
1227
1228 let local_var_status = local_var_resp.status();
1229 let local_var_content = local_var_resp.text().await?;
1230
1231 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1232 crate::from_str_patched(&local_var_content).map_err(Error::from)
1233 } else {
1234 let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched(&local_var_content).ok();
1235 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1236 Err(Error::ResponseError(local_var_error))
1237 }
1238}
1239
1240pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
1241 let local_var_configuration = configuration;
1242
1243 let local_var_client = &local_var_configuration.client;
1244
1245 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));
1246 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1247
1248 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1249 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1250 }
1251 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1252 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1253 };
1254
1255 let local_var_req = local_var_req_builder.build()?;
1256 let local_var_resp = local_var_client.execute(local_var_req).await?;
1257
1258 let local_var_status = local_var_resp.status();
1259 let local_var_content = local_var_resp.text().await?;
1260
1261 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1262 crate::from_str_patched(&local_var_content).map_err(Error::from)
1263 } else {
1264 let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched(&local_var_content).ok();
1265 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1266 Err(Error::ResponseError(local_var_error))
1267 }
1268}
1269
1270pub async fn pick_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::PickHubResourceType200Response, Error<PickHubScriptByPathError>> {
1271 let local_var_configuration = configuration;
1272
1273 let local_var_client = &local_var_configuration.client;
1274
1275 let local_var_uri_str = format!("{}/scripts/hub/pick/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
1276 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1277
1278 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1279 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1280 }
1281 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1282 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1283 };
1284
1285 let local_var_req = local_var_req_builder.build()?;
1286 let local_var_resp = local_var_client.execute(local_var_req).await?;
1287
1288 let local_var_status = local_var_resp.status();
1289 let local_var_content = local_var_resp.text().await?;
1290
1291 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1292 crate::from_str_patched(&local_var_content).map_err(Error::from)
1293 } else {
1294 let local_var_entity: Option<PickHubScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1295 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1296 Err(Error::ResponseError(local_var_error))
1297 }
1298}
1299
1300pub 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>> {
1301 let local_var_configuration = configuration;
1302
1303 let local_var_client = &local_var_configuration.client;
1304
1305 let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
1306 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1307
1308 local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
1309 if let Some(ref local_var_str) = kind {
1310 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
1311 }
1312 if let Some(ref local_var_str) = limit {
1313 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1314 }
1315 if let Some(ref local_var_str) = app {
1316 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
1317 }
1318 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1319 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1320 }
1321 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1322 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1323 };
1324
1325 let local_var_req = local_var_req_builder.build()?;
1326 let local_var_resp = local_var_client.execute(local_var_req).await?;
1327
1328 let local_var_status = local_var_resp.status();
1329 let local_var_content = local_var_resp.text().await?;
1330
1331 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1332 crate::from_str_patched(&local_var_content).map_err(Error::from)
1333 } else {
1334 let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
1335 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1336 Err(Error::ResponseError(local_var_error))
1337 }
1338}
1339
1340pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
1341 let local_var_configuration = configuration;
1342
1343 let local_var_client = &local_var_configuration.client;
1344
1345 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));
1346 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1347
1348 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1349 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1350 }
1351 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1352 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1353 };
1354
1355 let local_var_req = local_var_req_builder.build()?;
1356 let local_var_resp = local_var_client.execute(local_var_req).await?;
1357
1358 let local_var_status = local_var_resp.status();
1359 let local_var_content = local_var_resp.text().await?;
1360
1361 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1362 crate::from_str_patched(&local_var_content).map_err(Error::from)
1363 } else {
1364 let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
1365 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1366 Err(Error::ResponseError(local_var_error))
1367 }
1368}
1369
1370pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
1371 let local_var_configuration = configuration;
1372
1373 let local_var_client = &local_var_configuration.client;
1374
1375 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));
1376 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1377
1378 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1379 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1380 }
1381 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1382 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1383 };
1384
1385 let local_var_req = local_var_req_builder.build()?;
1386 let local_var_resp = local_var_client.execute(local_var_req).await?;
1387
1388 let local_var_status = local_var_resp.status();
1389 let local_var_content = local_var_resp.text().await?;
1390
1391 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1392 crate::from_str_patched(&local_var_content).map_err(Error::from)
1393 } else {
1394 let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1395 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1396 Err(Error::ResponseError(local_var_error))
1397 }
1398}
1399
1400pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1401 let local_var_configuration = configuration;
1402
1403 let local_var_client = &local_var_configuration.client;
1404
1405 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));
1406 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1407
1408 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1409 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1410 }
1411 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1412 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1413 };
1414
1415 let local_var_req = local_var_req_builder.build()?;
1416 let local_var_resp = local_var_client.execute(local_var_req).await?;
1417
1418 let local_var_status = local_var_resp.status();
1419 let local_var_content = local_var_resp.text().await?;
1420
1421 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1422 crate::from_str_patched(&local_var_content).map_err(Error::from)
1423 } else {
1424 let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched(&local_var_content).ok();
1425 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1426 Err(Error::ResponseError(local_var_error))
1427 }
1428}
1429
1430pub async fn store_raw_script_temp(configuration: &configuration::Configuration, workspace: &str, body: &str) -> Result<String, Error<StoreRawScriptTempError>> {
1431 let local_var_configuration = configuration;
1432
1433 let local_var_client = &local_var_configuration.client;
1434
1435 let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/store", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1436 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1437
1438 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1439 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1440 }
1441 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1442 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1443 };
1444 local_var_req_builder = local_var_req_builder.json(&body);
1445
1446 let local_var_req = local_var_req_builder.build()?;
1447 let local_var_resp = local_var_client.execute(local_var_req).await?;
1448
1449 let local_var_status = local_var_resp.status();
1450 let local_var_content = local_var_resp.text().await?;
1451
1452 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1453 crate::from_str_patched(&local_var_content).map_err(Error::from)
1454 } else {
1455 let local_var_entity: Option<StoreRawScriptTempError> = crate::from_str_patched(&local_var_content).ok();
1456 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1457 Err(Error::ResponseError(local_var_error))
1458 }
1459}
1460
1461pub 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>> {
1462 let local_var_configuration = configuration;
1463
1464 let local_var_client = &local_var_configuration.client;
1465
1466 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));
1467 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1468
1469 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1470 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1471 }
1472 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1473 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1474 };
1475 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1476
1477 let local_var_req = local_var_req_builder.build()?;
1478 let local_var_resp = local_var_client.execute(local_var_req).await?;
1479
1480 let local_var_status = local_var_resp.status();
1481 let local_var_content = local_var_resp.text().await?;
1482
1483 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1484 crate::from_str_patched(&local_var_content).map_err(Error::from)
1485 } else {
1486 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched(&local_var_content).ok();
1487 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1488 Err(Error::ResponseError(local_var_error))
1489 }
1490}
1491
1492pub async fn trigger_ci_tests_batch(configuration: &configuration::Configuration, workspace: &str, trigger_ci_tests_batch_request: models::TriggerCiTestsBatchRequest) -> Result<models::TriggerCiTestsBatch200Response, Error<TriggerCiTestsBatchError>> {
1494 let local_var_configuration = configuration;
1495
1496 let local_var_client = &local_var_configuration.client;
1497
1498 let local_var_uri_str = format!("{}/w/{workspace}/scripts/trigger_ci_tests_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1499 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1500
1501 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1502 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1503 }
1504 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1505 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1506 };
1507 local_var_req_builder = local_var_req_builder.json(&trigger_ci_tests_batch_request);
1508
1509 let local_var_req = local_var_req_builder.build()?;
1510 let local_var_resp = local_var_client.execute(local_var_req).await?;
1511
1512 let local_var_status = local_var_resp.status();
1513 let local_var_content = local_var_resp.text().await?;
1514
1515 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1516 crate::from_str_patched(&local_var_content).map_err(Error::from)
1517 } else {
1518 let local_var_entity: Option<TriggerCiTestsBatchError> = crate::from_str_patched(&local_var_content).ok();
1519 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1520 Err(Error::ResponseError(local_var_error))
1521 }
1522}
1523
1524pub async fn update_script(configuration: &configuration::Configuration, workspace: &str, path: &str, new_script: models::NewScript, skip_ci_tests: Option<bool>) -> Result<String, Error<UpdateScriptError>> {
1526 let local_var_configuration = configuration;
1527
1528 let local_var_client = &local_var_configuration.client;
1529
1530 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));
1531 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1532
1533 if let Some(ref local_var_str) = skip_ci_tests {
1534 local_var_req_builder = local_var_req_builder.query(&[("skip_ci_tests", &local_var_str.to_string())]);
1535 }
1536 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1537 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1538 }
1539 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1540 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1541 };
1542 local_var_req_builder = local_var_req_builder.json(&new_script);
1543
1544 let local_var_req = local_var_req_builder.build()?;
1545 let local_var_resp = local_var_client.execute(local_var_req).await?;
1546
1547 let local_var_status = local_var_resp.status();
1548 let local_var_content = local_var_resp.text().await?;
1549
1550 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1551 crate::from_str_patched(&local_var_content).map_err(Error::from)
1552 } else {
1553 let local_var_entity: Option<UpdateScriptError> = crate::from_str_patched(&local_var_content).ok();
1554 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1555 Err(Error::ResponseError(local_var_error))
1556 }
1557}
1558
1559pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1560 let local_var_configuration = configuration;
1561
1562 let local_var_client = &local_var_configuration.client;
1563
1564 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));
1565 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1566
1567 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1568 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1569 }
1570 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1571 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1572 };
1573 local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1574
1575 let local_var_req = local_var_req_builder.build()?;
1576 let local_var_resp = local_var_client.execute(local_var_req).await?;
1577
1578 let local_var_status = local_var_resp.status();
1579 let local_var_content = local_var_resp.text().await?;
1580
1581 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1582 crate::from_str_patched(&local_var_content).map_err(Error::from)
1583 } else {
1584 let local_var_entity: Option<UpdateScriptHistoryError> = crate::from_str_patched(&local_var_content).ok();
1585 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1586 Err(Error::ResponseError(local_var_error))
1587 }
1588}
1589