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