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>) -> 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_user_agent) = local_var_configuration.user_agent {
464 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
465 }
466 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
467 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
468 };
469
470 let local_var_req = local_var_req_builder.build()?;
471 let local_var_resp = local_var_client.execute(local_var_req).await?;
472
473 let local_var_status = local_var_resp.status();
474 let local_var_content = local_var_resp.text().await?;
475
476 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
477 crate::from_str_patched(&local_var_content).map_err(Error::from)
478 } else {
479 let local_var_entity: Option<GetScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
480 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
481 Err(Error::ResponseError(local_var_error))
482 }
483}
484
485pub async fn get_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, with_starred_info: Option<bool>) -> Result<models::Script, Error<GetScriptByPathError>> {
486 let local_var_configuration = configuration;
487
488 let local_var_client = &local_var_configuration.client;
489
490 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));
491 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
492
493 if let Some(ref local_var_str) = with_starred_info {
494 local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
495 }
496 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
497 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
498 }
499 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
500 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
501 };
502
503 let local_var_req = local_var_req_builder.build()?;
504 let local_var_resp = local_var_client.execute(local_var_req).await?;
505
506 let local_var_status = local_var_resp.status();
507 let local_var_content = local_var_resp.text().await?;
508
509 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
510 crate::from_str_patched(&local_var_content).map_err(Error::from)
511 } else {
512 let local_var_entity: Option<GetScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
513 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
514 Err(Error::ResponseError(local_var_error))
515 }
516}
517
518pub async fn get_script_by_path_with_draft(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::NewScriptWithDraft, Error<GetScriptByPathWithDraftError>> {
519 let local_var_configuration = configuration;
520
521 let local_var_client = &local_var_configuration.client;
522
523 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));
524 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
525
526 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
527 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
528 }
529 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
530 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
531 };
532
533 let local_var_req = local_var_req_builder.build()?;
534 let local_var_resp = local_var_client.execute(local_var_req).await?;
535
536 let local_var_status = local_var_resp.status();
537 let local_var_content = local_var_resp.text().await?;
538
539 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
540 crate::from_str_patched(&local_var_content).map_err(Error::from)
541 } else {
542 let local_var_entity: Option<GetScriptByPathWithDraftError> = crate::from_str_patched(&local_var_content).ok();
543 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
544 Err(Error::ResponseError(local_var_error))
545 }
546}
547
548pub async fn get_script_deployment_status(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::GetScriptDeploymentStatus200Response, Error<GetScriptDeploymentStatusError>> {
549 let local_var_configuration = configuration;
550
551 let local_var_client = &local_var_configuration.client;
552
553 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));
554 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
555
556 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
557 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
558 }
559 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
560 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
561 };
562
563 let local_var_req = local_var_req_builder.build()?;
564 let local_var_resp = local_var_client.execute(local_var_req).await?;
565
566 let local_var_status = local_var_resp.status();
567 let local_var_content = local_var_resp.text().await?;
568
569 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
570 crate::from_str_patched(&local_var_content).map_err(Error::from)
571 } else {
572 let local_var_entity: Option<GetScriptDeploymentStatusError> = crate::from_str_patched(&local_var_content).ok();
573 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
574 Err(Error::ResponseError(local_var_error))
575 }
576}
577
578pub async fn get_script_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::ScriptHistory>, Error<GetScriptHistoryByPathError>> {
579 let local_var_configuration = configuration;
580
581 let local_var_client = &local_var_configuration.client;
582
583 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));
584 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
585
586 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
587 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
588 }
589 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
590 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
591 };
592
593 let local_var_req = local_var_req_builder.build()?;
594 let local_var_resp = local_var_client.execute(local_var_req).await?;
595
596 let local_var_status = local_var_resp.status();
597 let local_var_content = local_var_resp.text().await?;
598
599 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
600 crate::from_str_patched(&local_var_content).map_err(Error::from)
601 } else {
602 let local_var_entity: Option<GetScriptHistoryByPathError> = crate::from_str_patched(&local_var_content).ok();
603 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
604 Err(Error::ResponseError(local_var_error))
605 }
606}
607
608pub async fn get_script_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ScriptHistory, Error<GetScriptLatestVersionError>> {
609 let local_var_configuration = configuration;
610
611 let local_var_client = &local_var_configuration.client;
612
613 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));
614 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
615
616 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
617 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
618 }
619 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
620 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
621 };
622
623 let local_var_req = local_var_req_builder.build()?;
624 let local_var_resp = local_var_client.execute(local_var_req).await?;
625
626 let local_var_status = local_var_resp.status();
627 let local_var_content = local_var_resp.text().await?;
628
629 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
630 crate::from_str_patched(&local_var_content).map_err(Error::from)
631 } else {
632 let local_var_entity: Option<GetScriptLatestVersionError> = crate::from_str_patched(&local_var_content).ok();
633 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
634 Err(Error::ResponseError(local_var_error))
635 }
636}
637
638pub async fn get_top_hub_scripts(configuration: &configuration::Configuration, limit: Option<f64>, app: Option<&str>, kind: Option<&str>) -> Result<models::GetTopHubScripts200Response, Error<GetTopHubScriptsError>> {
639 let local_var_configuration = configuration;
640
641 let local_var_client = &local_var_configuration.client;
642
643 let local_var_uri_str = format!("{}/scripts/hub/top", local_var_configuration.base_path);
644 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
645
646 if let Some(ref local_var_str) = limit {
647 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
648 }
649 if let Some(ref local_var_str) = app {
650 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
651 }
652 if let Some(ref local_var_str) = kind {
653 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
654 }
655 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
656 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
657 }
658 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
659 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
660 };
661
662 let local_var_req = local_var_req_builder.build()?;
663 let local_var_resp = local_var_client.execute(local_var_req).await?;
664
665 let local_var_status = local_var_resp.status();
666 let local_var_content = local_var_resp.text().await?;
667
668 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
669 crate::from_str_patched(&local_var_content).map_err(Error::from)
670 } else {
671 let local_var_entity: Option<GetTopHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
672 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
673 Err(Error::ResponseError(local_var_error))
674 }
675}
676
677pub async fn get_triggers_count_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfScriptError>> {
678 let local_var_configuration = configuration;
679
680 let local_var_client = &local_var_configuration.client;
681
682 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));
683 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
684
685 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
686 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
687 }
688 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
689 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
690 };
691
692 let local_var_req = local_var_req_builder.build()?;
693 let local_var_resp = local_var_client.execute(local_var_req).await?;
694
695 let local_var_status = local_var_resp.status();
696 let local_var_content = local_var_resp.text().await?;
697
698 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
699 crate::from_str_patched(&local_var_content).map_err(Error::from)
700 } else {
701 let local_var_entity: Option<GetTriggersCountOfScriptError> = crate::from_str_patched(&local_var_content).ok();
702 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
703 Err(Error::ResponseError(local_var_error))
704 }
705}
706
707pub async fn list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
708 let local_var_configuration = configuration;
709
710 let local_var_client = &local_var_configuration.client;
711
712 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
713 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
714
715 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
716 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
717 }
718 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
719 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
720 };
721
722 let local_var_req = local_var_req_builder.build()?;
723 let local_var_resp = local_var_client.execute(local_var_req).await?;
724
725 let local_var_status = local_var_resp.status();
726 let local_var_content = local_var_resp.text().await?;
727
728 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
729 crate::from_str_patched(&local_var_content).map_err(Error::from)
730 } else {
731 let local_var_entity: Option<ListScriptPathsError> = crate::from_str_patched(&local_var_content).ok();
732 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
733 Err(Error::ResponseError(local_var_error))
734 }
735}
736
737pub async fn list_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
738 let local_var_configuration = configuration;
739
740 let local_var_client = &local_var_configuration.client;
741
742 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));
743 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
744
745 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
746 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
747 }
748 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
749 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
750 };
751
752 let local_var_req = local_var_req_builder.build()?;
753 let local_var_resp = local_var_client.execute(local_var_req).await?;
754
755 let local_var_status = local_var_resp.status();
756 let local_var_content = local_var_resp.text().await?;
757
758 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
759 crate::from_str_patched(&local_var_content).map_err(Error::from)
760 } else {
761 let local_var_entity: Option<ListScriptPathsFromWorkspaceRunnableError> = crate::from_str_patched(&local_var_content).ok();
762 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
763 Err(Error::ResponseError(local_var_error))
764 }
765}
766
767pub 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>> {
768 let local_var_configuration = configuration;
769
770 let local_var_client = &local_var_configuration.client;
771
772 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
773 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
774
775 if let Some(ref local_var_str) = page {
776 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
777 }
778 if let Some(ref local_var_str) = per_page {
779 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
780 }
781 if let Some(ref local_var_str) = order_desc {
782 local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
783 }
784 if let Some(ref local_var_str) = created_by {
785 local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
786 }
787 if let Some(ref local_var_str) = path_start {
788 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
789 }
790 if let Some(ref local_var_str) = path_exact {
791 local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
792 }
793 if let Some(ref local_var_str) = first_parent_hash {
794 local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
795 }
796 if let Some(ref local_var_str) = last_parent_hash {
797 local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
798 }
799 if let Some(ref local_var_str) = parent_hash {
800 local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
801 }
802 if let Some(ref local_var_str) = show_archived {
803 local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
804 }
805 if let Some(ref local_var_str) = include_without_main {
806 local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
807 }
808 if let Some(ref local_var_str) = include_draft_only {
809 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
810 }
811 if let Some(ref local_var_str) = is_template {
812 local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
813 }
814 if let Some(ref local_var_str) = kinds {
815 local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
816 }
817 if let Some(ref local_var_str) = starred_only {
818 local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
819 }
820 if let Some(ref local_var_str) = with_deployment_msg {
821 local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
822 }
823 if let Some(ref local_var_str) = languages {
824 local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
825 }
826 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
827 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
828 }
829 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
830 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
831 };
832
833 let local_var_req = local_var_req_builder.build()?;
834 let local_var_resp = local_var_client.execute(local_var_req).await?;
835
836 let local_var_status = local_var_resp.status();
837 let local_var_content = local_var_resp.text().await?;
838
839 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
840 crate::from_str_patched(&local_var_content).map_err(Error::from)
841 } else {
842 let local_var_entity: Option<ListScriptsError> = crate::from_str_patched(&local_var_content).ok();
843 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
844 Err(Error::ResponseError(local_var_error))
845 }
846}
847
848pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
849 let local_var_configuration = configuration;
850
851 let local_var_client = &local_var_configuration.client;
852
853 let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
854 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
855
856 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
857 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
858 }
859 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
860 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
861 };
862
863 let local_var_req = local_var_req_builder.build()?;
864 let local_var_resp = local_var_client.execute(local_var_req).await?;
865
866 let local_var_status = local_var_resp.status();
867 let local_var_content = local_var_resp.text().await?;
868
869 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
870 crate::from_str_patched(&local_var_content).map_err(Error::from)
871 } else {
872 let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched(&local_var_content).ok();
873 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
874 Err(Error::ResponseError(local_var_error))
875 }
876}
877
878pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
879 let local_var_configuration = configuration;
880
881 let local_var_client = &local_var_configuration.client;
882
883 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));
884 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
885
886 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
887 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
888 }
889 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
890 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
891 };
892
893 let local_var_req = local_var_req_builder.build()?;
894 let local_var_resp = local_var_client.execute(local_var_req).await?;
895
896 let local_var_status = local_var_resp.status();
897 let local_var_content = local_var_resp.text().await?;
898
899 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
900 crate::from_str_patched(&local_var_content).map_err(Error::from)
901 } else {
902 let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched(&local_var_content).ok();
903 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
904 Err(Error::ResponseError(local_var_error))
905 }
906}
907
908pub 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>> {
909 let local_var_configuration = configuration;
910
911 let local_var_client = &local_var_configuration.client;
912
913 let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
914 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
915
916 local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
917 if let Some(ref local_var_str) = kind {
918 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
919 }
920 if let Some(ref local_var_str) = limit {
921 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
922 }
923 if let Some(ref local_var_str) = app {
924 local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
925 }
926 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
927 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
928 }
929 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
930 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
931 };
932
933 let local_var_req = local_var_req_builder.build()?;
934 let local_var_resp = local_var_client.execute(local_var_req).await?;
935
936 let local_var_status = local_var_resp.status();
937 let local_var_content = local_var_resp.text().await?;
938
939 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
940 crate::from_str_patched(&local_var_content).map_err(Error::from)
941 } else {
942 let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched(&local_var_content).ok();
943 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
944 Err(Error::ResponseError(local_var_error))
945 }
946}
947
948pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
949 let local_var_configuration = configuration;
950
951 let local_var_client = &local_var_configuration.client;
952
953 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));
954 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
955
956 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
957 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
958 }
959 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
960 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
961 };
962
963 let local_var_req = local_var_req_builder.build()?;
964 let local_var_resp = local_var_client.execute(local_var_req).await?;
965
966 let local_var_status = local_var_resp.status();
967 let local_var_content = local_var_resp.text().await?;
968
969 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
970 crate::from_str_patched(&local_var_content).map_err(Error::from)
971 } else {
972 let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched(&local_var_content).ok();
973 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
974 Err(Error::ResponseError(local_var_error))
975 }
976}
977
978pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
979 let local_var_configuration = configuration;
980
981 let local_var_client = &local_var_configuration.client;
982
983 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));
984 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
985
986 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
987 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
988 }
989 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
990 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
991 };
992
993 let local_var_req = local_var_req_builder.build()?;
994 let local_var_resp = local_var_client.execute(local_var_req).await?;
995
996 let local_var_status = local_var_resp.status();
997 let local_var_content = local_var_resp.text().await?;
998
999 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1000 crate::from_str_patched(&local_var_content).map_err(Error::from)
1001 } else {
1002 let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched(&local_var_content).ok();
1003 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1004 Err(Error::ResponseError(local_var_error))
1005 }
1006}
1007
1008pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1009 let local_var_configuration = configuration;
1010
1011 let local_var_client = &local_var_configuration.client;
1012
1013 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));
1014 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1015
1016 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1017 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1018 }
1019 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1020 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1021 };
1022
1023 let local_var_req = local_var_req_builder.build()?;
1024 let local_var_resp = local_var_client.execute(local_var_req).await?;
1025
1026 let local_var_status = local_var_resp.status();
1027 let local_var_content = local_var_resp.text().await?;
1028
1029 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1030 crate::from_str_patched(&local_var_content).map_err(Error::from)
1031 } else {
1032 let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched(&local_var_content).ok();
1033 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1034 Err(Error::ResponseError(local_var_error))
1035 }
1036}
1037
1038pub 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>> {
1039 let local_var_configuration = configuration;
1040
1041 let local_var_client = &local_var_configuration.client;
1042
1043 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));
1044 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1045
1046 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1047 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1048 }
1049 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1050 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1051 };
1052 local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1053
1054 let local_var_req = local_var_req_builder.build()?;
1055 let local_var_resp = local_var_client.execute(local_var_req).await?;
1056
1057 let local_var_status = local_var_resp.status();
1058 let local_var_content = local_var_resp.text().await?;
1059
1060 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1061 crate::from_str_patched(&local_var_content).map_err(Error::from)
1062 } else {
1063 let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched(&local_var_content).ok();
1064 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1065 Err(Error::ResponseError(local_var_error))
1066 }
1067}
1068
1069pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1070 let local_var_configuration = configuration;
1071
1072 let local_var_client = &local_var_configuration.client;
1073
1074 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));
1075 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1076
1077 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1078 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1079 }
1080 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1081 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1082 };
1083 local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1084
1085 let local_var_req = local_var_req_builder.build()?;
1086 let local_var_resp = local_var_client.execute(local_var_req).await?;
1087
1088 let local_var_status = local_var_resp.status();
1089 let local_var_content = local_var_resp.text().await?;
1090
1091 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1092 crate::from_str_patched(&local_var_content).map_err(Error::from)
1093 } else {
1094 let local_var_entity: Option<UpdateScriptHistoryError> = crate::from_str_patched(&local_var_content).ok();
1095 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1096 Err(Error::ResponseError(local_var_error))
1097 }
1098}
1099