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