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