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