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