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