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