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