windmill_api/apis/
script_api.rs

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