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