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