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