Skip to main content

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.794.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 [`check_schema_contracts`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CheckSchemaContractsError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`count_runnables_by_owner`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CountRunnablesByOwnerError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`create_script`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateScriptError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`delete_script_by_hash`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeleteScriptByHashError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`delete_script_by_path`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeleteScriptByPathError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`delete_scripts_bulk`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteScriptsBulkError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`diff_raw_scripts_with_deployed`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum DiffRawScriptsWithDeployedError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`exists_script_by_path`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ExistsScriptByPathError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_ci_test_results`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetCiTestResultsError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_ci_test_results_batch`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetCiTestResultsBatchError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_hub_script_by_path`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetHubScriptByPathError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_hub_script_content_by_path`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetHubScriptContentByPathError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_script_by_hash`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetScriptByHashError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_script_by_path`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetScriptByPathError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`get_script_deployment_status`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetScriptDeploymentStatusError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`get_script_history_by_path`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetScriptHistoryByPathError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`get_script_latest_version`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetScriptLatestVersionError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`get_top_hub_scripts`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetTopHubScriptsError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`get_triggers_count_of_script`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetTriggersCountOfScriptError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`list_dedicated_with_deps`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum ListDedicatedWithDepsError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`list_runnables`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ListRunnablesError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`list_script_paths`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum ListScriptPathsError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`list_script_paths_from_workspace_runnable`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ListScriptPathsFromWorkspaceRunnableError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`list_scripts`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum ListScriptsError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`list_search_script`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ListSearchScriptError {
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`list_tokens_of_script`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum ListTokensOfScriptError {
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`pick_hub_script_by_path`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PickHubScriptByPathError {
218    UnknownValue(serde_json::Value),
219}
220
221/// struct for typed errors of method [`query_hub_scripts`]
222#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum QueryHubScriptsError {
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`raw_script_by_hash`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum RawScriptByHashError {
232    UnknownValue(serde_json::Value),
233}
234
235/// struct for typed errors of method [`raw_script_by_path`]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum RawScriptByPathError {
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`raw_script_by_path_tokened`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum RawScriptByPathTokenedError {
246    UnknownValue(serde_json::Value),
247}
248
249/// struct for typed errors of method [`store_raw_script_temp`]
250#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum StoreRawScriptTempError {
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`toggle_workspace_error_handler_for_script`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ToggleWorkspaceErrorHandlerForScriptError {
260    UnknownValue(serde_json::Value),
261}
262
263/// struct for typed errors of method [`update_script`]
264#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum UpdateScriptError {
267    UnknownValue(serde_json::Value),
268}
269
270/// struct for typed errors of method [`update_script_history`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum UpdateScriptHistoryError {
274    UnknownValue(serde_json::Value),
275}
276
277
278pub async fn archive_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<ArchiveScriptByHashError>> {
279    let local_var_configuration = configuration;
280
281    let local_var_client = &local_var_configuration.client;
282
283    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));
284    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
285
286    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
287        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
288    }
289    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
290        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
291    };
292
293    let local_var_req = local_var_req_builder.build()?;
294    let local_var_resp = local_var_client.execute(local_var_req).await?;
295
296    let local_var_status = local_var_resp.status();
297    let local_var_content = local_var_resp.text().await?;
298
299    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
300        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
301    } else {
302        let local_var_entity: Option<ArchiveScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
303        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
304        Err(Error::ResponseError(local_var_error))
305    }
306}
307
308pub async fn archive_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<ArchiveScriptByPathError>> {
309    let local_var_configuration = configuration;
310
311    let local_var_client = &local_var_configuration.client;
312
313    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));
314    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
315
316    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
317        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
318    }
319    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
320        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
321    };
322
323    let local_var_req = local_var_req_builder.build()?;
324    let local_var_resp = local_var_client.execute(local_var_req).await?;
325
326    let local_var_status = local_var_resp.status();
327    let local_var_content = local_var_resp.text().await?;
328
329    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
330        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
331    } else {
332        let local_var_entity: Option<ArchiveScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
333        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
334        Err(Error::ResponseError(local_var_error))
335    }
336}
337
338/// Save-time schema-contract check for data pipelines: validates the given script content's asset references (body column reads, `// column` lineage, `// data_test relationships`) against the latest captured producer schemas and returns warnings. Warnings never block a save/deploy; an asset whose producer declares `on_schema_change=ignore` is suppressed to a single informational entry. 
339pub async fn check_schema_contracts(configuration: &configuration::Configuration, workspace: &str, check_schema_contracts_request: models::CheckSchemaContractsRequest) -> Result<models::CheckSchemaContracts200Response, Error<CheckSchemaContractsError>> {
340    let local_var_configuration = configuration;
341
342    let local_var_client = &local_var_configuration.client;
343
344    let local_var_uri_str = format!("{}/w/{workspace}/scripts/check_schema_contracts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
345    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
346
347    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
348        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
349    }
350    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
351        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
352    };
353    local_var_req_builder = local_var_req_builder.json(&check_schema_contracts_request);
354
355    let local_var_req = local_var_req_builder.build()?;
356    let local_var_resp = local_var_client.execute(local_var_req).await?;
357
358    let local_var_status = local_var_resp.status();
359    let local_var_content = local_var_resp.text().await?;
360
361    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
362        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
363    } else {
364        let local_var_entity: Option<CheckSchemaContractsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
365        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
366        Err(Error::ResponseError(local_var_error))
367    }
368}
369
370pub async fn count_runnables_by_owner(configuration: &configuration::Configuration, workspace: &str, kinds: Option<&str>, include_without_main: Option<bool>, include_draft_only: Option<bool>) -> Result<models::CountRunnablesByOwner200Response, Error<CountRunnablesByOwnerError>> {
371    let local_var_configuration = configuration;
372
373    let local_var_client = &local_var_configuration.client;
374
375    let local_var_uri_str = format!("{}/w/{workspace}/runnables/counts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
376    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
377
378    if let Some(ref local_var_str) = kinds {
379        local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
380    }
381    if let Some(ref local_var_str) = include_without_main {
382        local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
383    }
384    if let Some(ref local_var_str) = include_draft_only {
385        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
386    }
387    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
388        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
389    }
390    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
391        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
392    };
393
394    let local_var_req = local_var_req_builder.build()?;
395    let local_var_resp = local_var_client.execute(local_var_req).await?;
396
397    let local_var_status = local_var_resp.status();
398    let local_var_content = local_var_resp.text().await?;
399
400    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
401        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
402    } else {
403        let local_var_entity: Option<CountRunnablesByOwnerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
404        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
405        Err(Error::ResponseError(local_var_error))
406    }
407}
408
409/// Creates a new script at a path that does not already hold one. Supplying `parent_hash` instead deploys a new version of the script that hash names, and a `path` differing from that version's moves the script there. `POST /w/{workspace}/scripts/update/{path}` does the same, naming the superseded version in its URL. 
410pub async fn create_script(configuration: &configuration::Configuration, workspace: &str, new_script: models::NewScript) -> Result<String, Error<CreateScriptError>> {
411    let local_var_configuration = configuration;
412
413    let local_var_client = &local_var_configuration.client;
414
415    let local_var_uri_str = format!("{}/w/{workspace}/scripts/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
416    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
417
418    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
419        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
420    }
421    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
422        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
423    };
424    local_var_req_builder = local_var_req_builder.json(&new_script);
425
426    let local_var_req = local_var_req_builder.build()?;
427    let local_var_resp = local_var_client.execute(local_var_req).await?;
428
429    let local_var_status = local_var_resp.status();
430    let local_var_content = local_var_resp.text().await?;
431
432    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
433        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
434    } else {
435        let local_var_entity: Option<CreateScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
436        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
437        Err(Error::ResponseError(local_var_error))
438    }
439}
440
441pub async fn delete_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<DeleteScriptByHashError>> {
442    let local_var_configuration = configuration;
443
444    let local_var_client = &local_var_configuration.client;
445
446    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));
447    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
448
449    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
450        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
451    }
452    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
453        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
454    };
455
456    let local_var_req = local_var_req_builder.build()?;
457    let local_var_resp = local_var_client.execute(local_var_req).await?;
458
459    let local_var_status = local_var_resp.status();
460    let local_var_content = local_var_resp.text().await?;
461
462    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
463        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
464    } else {
465        let local_var_entity: Option<DeleteScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
466        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
467        Err(Error::ResponseError(local_var_error))
468    }
469}
470
471pub async fn delete_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, keep_captures: Option<bool>) -> Result<String, Error<DeleteScriptByPathError>> {
472    let local_var_configuration = configuration;
473
474    let local_var_client = &local_var_configuration.client;
475
476    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));
477    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
478
479    if let Some(ref local_var_str) = keep_captures {
480        local_var_req_builder = local_var_req_builder.query(&[("keep_captures", &local_var_str.to_string())]);
481    }
482    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
483        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
484    }
485    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
486        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
487    };
488
489    let local_var_req = local_var_req_builder.build()?;
490    let local_var_resp = local_var_client.execute(local_var_req).await?;
491
492    let local_var_status = local_var_resp.status();
493    let local_var_content = local_var_resp.text().await?;
494
495    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
496        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
497    } else {
498        let local_var_entity: Option<DeleteScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
499        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
500        Err(Error::ResponseError(local_var_error))
501    }
502}
503
504pub async fn delete_scripts_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteScriptsBulkError>> {
505    let local_var_configuration = configuration;
506
507    let local_var_client = &local_var_configuration.client;
508
509    let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
510    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
511
512    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
513        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
514    }
515    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
516        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
517    };
518    local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
519
520    let local_var_req = local_var_req_builder.build()?;
521    let local_var_resp = local_var_client.execute(local_var_req).await?;
522
523    let local_var_status = local_var_resp.status();
524    let local_var_content = local_var_resp.text().await?;
525
526    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
527        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
528    } else {
529        let local_var_entity: Option<DeleteScriptsBulkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
530        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
531        Err(Error::ResponseError(local_var_error))
532    }
533}
534
535pub 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>> {
536    let local_var_configuration = configuration;
537
538    let local_var_client = &local_var_configuration.client;
539
540    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/diff", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
541    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
542
543    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
544        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
545    }
546    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
547        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
548    };
549    local_var_req_builder = local_var_req_builder.json(&diff_raw_scripts_with_deployed_request);
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<DiffRawScriptsWithDeployedError> = 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 exists_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsScriptByPathError>> {
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/exists/p/{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<ExistsScriptByPathError> = 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_ci_test_results(configuration: &configuration::Configuration, workspace: &str, kind: &str, path: &str) -> Result<Vec<models::CiTestResult>, Error<GetCiTestResultsError>> {
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/ci_test_results/{kind}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), kind=crate::apis::urlencode(kind), path=crate::apis::urlencode(path));
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<GetCiTestResultsError> = 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_ci_test_results_batch(configuration: &configuration::Configuration, workspace: &str, get_ci_test_results_batch_request: models::GetCiTestResultsBatchRequest) -> Result<std::collections::HashMap<String, Vec<models::CiTestResult>>, Error<GetCiTestResultsBatchError>> {
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/ci_test_results_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
632    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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    local_var_req_builder = local_var_req_builder.json(&get_ci_test_results_batch_request);
641
642    let local_var_req = local_var_req_builder.build()?;
643    let local_var_resp = local_var_client.execute(local_var_req).await?;
644
645    let local_var_status = local_var_resp.status();
646    let local_var_content = local_var_resp.text().await?;
647
648    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
649        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
650    } else {
651        let local_var_entity: Option<GetCiTestResultsBatchError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
652        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
653        Err(Error::ResponseError(local_var_error))
654    }
655}
656
657pub async fn get_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::GetHubScriptByPath200Response, Error<GetHubScriptByPathError>> {
658    let local_var_configuration = configuration;
659
660    let local_var_client = &local_var_configuration.client;
661
662    let local_var_uri_str = format!("{}/scripts/hub/get_full/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
663    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
664
665    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
666        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
667    }
668    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
669        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
670    };
671
672    let local_var_req = local_var_req_builder.build()?;
673    let local_var_resp = local_var_client.execute(local_var_req).await?;
674
675    let local_var_status = local_var_resp.status();
676    let local_var_content = local_var_resp.text().await?;
677
678    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
679        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
680    } else {
681        let local_var_entity: Option<GetHubScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
682        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
683        Err(Error::ResponseError(local_var_error))
684    }
685}
686
687pub async fn get_hub_script_content_by_path(configuration: &configuration::Configuration, path: &str) -> Result<String, Error<GetHubScriptContentByPathError>> {
688    let local_var_configuration = configuration;
689
690    let local_var_client = &local_var_configuration.client;
691
692    let local_var_uri_str = format!("{}/scripts/hub/get/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
693    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
694
695    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
696        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
697    }
698    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
699        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
700    };
701
702    let local_var_req = local_var_req_builder.build()?;
703    let local_var_resp = local_var_client.execute(local_var_req).await?;
704
705    let local_var_status = local_var_resp.status();
706    let local_var_content = local_var_resp.text().await?;
707
708    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
709        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
710    } else {
711        let local_var_entity: Option<GetHubScriptContentByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
712        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
713        Err(Error::ResponseError(local_var_error))
714    }
715}
716
717pub 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>> {
718    let local_var_configuration = configuration;
719
720    let local_var_client = &local_var_configuration.client;
721
722    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));
723    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
724
725    if let Some(ref local_var_str) = with_starred_info {
726        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
727    }
728    if let Some(ref local_var_str) = authed {
729        local_var_req_builder = local_var_req_builder.query(&[("authed", &local_var_str.to_string())]);
730    }
731    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
732        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
733    }
734    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
735        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
736    };
737
738    let local_var_req = local_var_req_builder.build()?;
739    let local_var_resp = local_var_client.execute(local_var_req).await?;
740
741    let local_var_status = local_var_resp.status();
742    let local_var_content = local_var_resp.text().await?;
743
744    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
745        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
746    } else {
747        let local_var_entity: Option<GetScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
748        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
749        Err(Error::ResponseError(local_var_error))
750    }
751}
752
753pub async fn get_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, with_starred_info: Option<bool>, get_draft: Option<bool>) -> Result<models::GetScriptByPath200Response, Error<GetScriptByPathError>> {
754    let local_var_configuration = configuration;
755
756    let local_var_client = &local_var_configuration.client;
757
758    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));
759    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
760
761    if let Some(ref local_var_str) = with_starred_info {
762        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
763    }
764    if let Some(ref local_var_str) = get_draft {
765        local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
766    }
767    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
768        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
769    }
770    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
771        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
772    };
773
774    let local_var_req = local_var_req_builder.build()?;
775    let local_var_resp = local_var_client.execute(local_var_req).await?;
776
777    let local_var_status = local_var_resp.status();
778    let local_var_content = local_var_resp.text().await?;
779
780    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
781        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
782    } else {
783        let local_var_entity: Option<GetScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
784        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
785        Err(Error::ResponseError(local_var_error))
786    }
787}
788
789pub async fn get_script_deployment_status(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::GetScriptDeploymentStatus200Response, Error<GetScriptDeploymentStatusError>> {
790    let local_var_configuration = configuration;
791
792    let local_var_client = &local_var_configuration.client;
793
794    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));
795    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
796
797    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
798        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
799    }
800    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
801        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
802    };
803
804    let local_var_req = local_var_req_builder.build()?;
805    let local_var_resp = local_var_client.execute(local_var_req).await?;
806
807    let local_var_status = local_var_resp.status();
808    let local_var_content = local_var_resp.text().await?;
809
810    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
811        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
812    } else {
813        let local_var_entity: Option<GetScriptDeploymentStatusError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
814        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
815        Err(Error::ResponseError(local_var_error))
816    }
817}
818
819pub async fn get_script_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::ScriptHistory>, Error<GetScriptHistoryByPathError>> {
820    let local_var_configuration = configuration;
821
822    let local_var_client = &local_var_configuration.client;
823
824    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));
825    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
826
827    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
828        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
829    }
830    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
831        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
832    };
833
834    let local_var_req = local_var_req_builder.build()?;
835    let local_var_resp = local_var_client.execute(local_var_req).await?;
836
837    let local_var_status = local_var_resp.status();
838    let local_var_content = local_var_resp.text().await?;
839
840    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
841        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
842    } else {
843        let local_var_entity: Option<GetScriptHistoryByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
844        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
845        Err(Error::ResponseError(local_var_error))
846    }
847}
848
849pub async fn get_script_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ScriptHistory, Error<GetScriptLatestVersionError>> {
850    let local_var_configuration = configuration;
851
852    let local_var_client = &local_var_configuration.client;
853
854    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));
855    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
856
857    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
858        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
859    }
860    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
861        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
862    };
863
864    let local_var_req = local_var_req_builder.build()?;
865    let local_var_resp = local_var_client.execute(local_var_req).await?;
866
867    let local_var_status = local_var_resp.status();
868    let local_var_content = local_var_resp.text().await?;
869
870    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
871        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
872    } else {
873        let local_var_entity: Option<GetScriptLatestVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
874        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
875        Err(Error::ResponseError(local_var_error))
876    }
877}
878
879pub async fn get_top_hub_scripts(configuration: &configuration::Configuration, limit: Option<f64>, app: Option<&str>, kind: Option<&str>) -> Result<models::GetTopHubScripts200Response, Error<GetTopHubScriptsError>> {
880    let local_var_configuration = configuration;
881
882    let local_var_client = &local_var_configuration.client;
883
884    let local_var_uri_str = format!("{}/scripts/hub/top", local_var_configuration.base_path);
885    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
886
887    if let Some(ref local_var_str) = limit {
888        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
889    }
890    if let Some(ref local_var_str) = app {
891        local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
892    }
893    if let Some(ref local_var_str) = kind {
894        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
895    }
896    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
897        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
898    }
899    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
900        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
901    };
902
903    let local_var_req = local_var_req_builder.build()?;
904    let local_var_resp = local_var_client.execute(local_var_req).await?;
905
906    let local_var_status = local_var_resp.status();
907    let local_var_content = local_var_resp.text().await?;
908
909    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
910        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
911    } else {
912        let local_var_entity: Option<GetTopHubScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
913        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
914        Err(Error::ResponseError(local_var_error))
915    }
916}
917
918pub async fn get_triggers_count_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfScriptError>> {
919    let local_var_configuration = configuration;
920
921    let local_var_client = &local_var_configuration.client;
922
923    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));
924    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
925
926    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
927        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
928    }
929    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
930        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
931    };
932
933    let local_var_req = local_var_req_builder.build()?;
934    let local_var_resp = local_var_client.execute(local_var_req).await?;
935
936    let local_var_status = local_var_resp.status();
937    let local_var_content = local_var_resp.text().await?;
938
939    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
940        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
941    } else {
942        let local_var_entity: Option<GetTriggersCountOfScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
943        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
944        Err(Error::ResponseError(local_var_error))
945    }
946}
947
948pub async fn list_dedicated_with_deps(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListDedicatedWithDeps200ResponseInner>, Error<ListDedicatedWithDepsError>> {
949    let local_var_configuration = configuration;
950
951    let local_var_client = &local_var_configuration.client;
952
953    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_dedicated_with_deps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
954    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
955
956    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
957        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
958    }
959    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
960        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
961    };
962
963    let local_var_req = local_var_req_builder.build()?;
964    let local_var_resp = local_var_client.execute(local_var_req).await?;
965
966    let local_var_status = local_var_resp.status();
967    let local_var_content = local_var_resp.text().await?;
968
969    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
970        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
971    } else {
972        let local_var_entity: Option<ListDedicatedWithDepsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
973        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
974        Err(Error::ResponseError(local_var_error))
975    }
976}
977
978pub async fn list_runnables(configuration: &configuration::Configuration, workspace: &str, order_by: Option<&str>, order_desc: Option<bool>, kinds: Option<&str>, show_archived: Option<bool>, include_without_main: Option<bool>, path_start: Option<&str>, label: Option<&str>, search: Option<&str>, per_page: Option<i32>, cursor: Option<&str>, include_draft_only: Option<bool>) -> Result<models::ListRunnables200Response, Error<ListRunnablesError>> {
979    let local_var_configuration = configuration;
980
981    let local_var_client = &local_var_configuration.client;
982
983    let local_var_uri_str = format!("{}/w/{workspace}/runnables/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
984    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
985
986    if let Some(ref local_var_str) = order_by {
987        local_var_req_builder = local_var_req_builder.query(&[("order_by", &local_var_str.to_string())]);
988    }
989    if let Some(ref local_var_str) = order_desc {
990        local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
991    }
992    if let Some(ref local_var_str) = kinds {
993        local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
994    }
995    if let Some(ref local_var_str) = show_archived {
996        local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
997    }
998    if let Some(ref local_var_str) = include_without_main {
999        local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1000    }
1001    if let Some(ref local_var_str) = path_start {
1002        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1003    }
1004    if let Some(ref local_var_str) = label {
1005        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1006    }
1007    if let Some(ref local_var_str) = search {
1008        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1009    }
1010    if let Some(ref local_var_str) = per_page {
1011        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1012    }
1013    if let Some(ref local_var_str) = cursor {
1014        local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1015    }
1016    if let Some(ref local_var_str) = include_draft_only {
1017        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1018    }
1019    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1020        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1021    }
1022    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1023        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1024    };
1025
1026    let local_var_req = local_var_req_builder.build()?;
1027    let local_var_resp = local_var_client.execute(local_var_req).await?;
1028
1029    let local_var_status = local_var_resp.status();
1030    let local_var_content = local_var_resp.text().await?;
1031
1032    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1033        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1034    } else {
1035        let local_var_entity: Option<ListRunnablesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1036        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1037        Err(Error::ResponseError(local_var_error))
1038    }
1039}
1040
1041pub async fn list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
1042    let local_var_configuration = configuration;
1043
1044    let local_var_client = &local_var_configuration.client;
1045
1046    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1047    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1048
1049    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1050        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1051    }
1052    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1053        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1054    };
1055
1056    let local_var_req = local_var_req_builder.build()?;
1057    let local_var_resp = local_var_client.execute(local_var_req).await?;
1058
1059    let local_var_status = local_var_resp.status();
1060    let local_var_content = local_var_resp.text().await?;
1061
1062    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1063        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1064    } else {
1065        let local_var_entity: Option<ListScriptPathsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1066        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1067        Err(Error::ResponseError(local_var_error))
1068    }
1069}
1070
1071pub async fn list_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
1072    let local_var_configuration = configuration;
1073
1074    let local_var_client = &local_var_configuration.client;
1075
1076    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));
1077    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1078
1079    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1080        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1081    }
1082    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1083        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1084    };
1085
1086    let local_var_req = local_var_req_builder.build()?;
1087    let local_var_resp = local_var_client.execute(local_var_req).await?;
1088
1089    let local_var_status = local_var_resp.status();
1090    let local_var_content = local_var_resp.text().await?;
1091
1092    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1093        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1094    } else {
1095        let local_var_entity: Option<ListScriptPathsFromWorkspaceRunnableError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1096        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1097        Err(Error::ResponseError(local_var_error))
1098    }
1099}
1100
1101pub 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>, label: Option<&str>) -> Result<Vec<models::ListScripts200ResponseInner>, Error<ListScriptsError>> {
1102    let local_var_configuration = configuration;
1103
1104    let local_var_client = &local_var_configuration.client;
1105
1106    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1107    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1108
1109    if let Some(ref local_var_str) = page {
1110        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1111    }
1112    if let Some(ref local_var_str) = per_page {
1113        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1114    }
1115    if let Some(ref local_var_str) = order_desc {
1116        local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
1117    }
1118    if let Some(ref local_var_str) = created_by {
1119        local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
1120    }
1121    if let Some(ref local_var_str) = path_start {
1122        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1123    }
1124    if let Some(ref local_var_str) = path_exact {
1125        local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
1126    }
1127    if let Some(ref local_var_str) = first_parent_hash {
1128        local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
1129    }
1130    if let Some(ref local_var_str) = last_parent_hash {
1131        local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
1132    }
1133    if let Some(ref local_var_str) = parent_hash {
1134        local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
1135    }
1136    if let Some(ref local_var_str) = show_archived {
1137        local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1138    }
1139    if let Some(ref local_var_str) = include_without_main {
1140        local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1141    }
1142    if let Some(ref local_var_str) = include_draft_only {
1143        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1144    }
1145    if let Some(ref local_var_str) = is_template {
1146        local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
1147    }
1148    if let Some(ref local_var_str) = kinds {
1149        local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1150    }
1151    if let Some(ref local_var_str) = starred_only {
1152        local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
1153    }
1154    if let Some(ref local_var_str) = with_deployment_msg {
1155        local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
1156    }
1157    if let Some(ref local_var_str) = languages {
1158        local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
1159    }
1160    if let Some(ref local_var_str) = without_description {
1161        local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
1162    }
1163    if let Some(ref local_var_str) = dedicated_worker {
1164        local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
1165    }
1166    if let Some(ref local_var_str) = label {
1167        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1168    }
1169    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1170        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1171    }
1172    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1173        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1174    };
1175
1176    let local_var_req = local_var_req_builder.build()?;
1177    let local_var_resp = local_var_client.execute(local_var_req).await?;
1178
1179    let local_var_status = local_var_resp.status();
1180    let local_var_content = local_var_resp.text().await?;
1181
1182    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1183        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1184    } else {
1185        let local_var_entity: Option<ListScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1186        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1187        Err(Error::ResponseError(local_var_error))
1188    }
1189}
1190
1191pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
1192    let local_var_configuration = configuration;
1193
1194    let local_var_client = &local_var_configuration.client;
1195
1196    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1197    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1198
1199    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1200        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1201    }
1202    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1203        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1204    };
1205
1206    let local_var_req = local_var_req_builder.build()?;
1207    let local_var_resp = local_var_client.execute(local_var_req).await?;
1208
1209    let local_var_status = local_var_resp.status();
1210    let local_var_content = local_var_resp.text().await?;
1211
1212    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1213        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1214    } else {
1215        let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1216        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1217        Err(Error::ResponseError(local_var_error))
1218    }
1219}
1220
1221pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
1222    let local_var_configuration = configuration;
1223
1224    let local_var_client = &local_var_configuration.client;
1225
1226    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));
1227    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1228
1229    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1230        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1231    }
1232    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1233        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1234    };
1235
1236    let local_var_req = local_var_req_builder.build()?;
1237    let local_var_resp = local_var_client.execute(local_var_req).await?;
1238
1239    let local_var_status = local_var_resp.status();
1240    let local_var_content = local_var_resp.text().await?;
1241
1242    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1243        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1244    } else {
1245        let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1246        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1247        Err(Error::ResponseError(local_var_error))
1248    }
1249}
1250
1251pub async fn pick_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::PickHubScriptByPath200Response, Error<PickHubScriptByPathError>> {
1252    let local_var_configuration = configuration;
1253
1254    let local_var_client = &local_var_configuration.client;
1255
1256    let local_var_uri_str = format!("{}/scripts/hub/pick/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
1257    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1258
1259    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1260        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1261    }
1262    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1263        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1264    };
1265
1266    let local_var_req = local_var_req_builder.build()?;
1267    let local_var_resp = local_var_client.execute(local_var_req).await?;
1268
1269    let local_var_status = local_var_resp.status();
1270    let local_var_content = local_var_resp.text().await?;
1271
1272    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1273        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1274    } else {
1275        let local_var_entity: Option<PickHubScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1276        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1277        Err(Error::ResponseError(local_var_error))
1278    }
1279}
1280
1281pub 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>> {
1282    let local_var_configuration = configuration;
1283
1284    let local_var_client = &local_var_configuration.client;
1285
1286    let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
1287    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1288
1289    local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
1290    if let Some(ref local_var_str) = kind {
1291        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
1292    }
1293    if let Some(ref local_var_str) = limit {
1294        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1295    }
1296    if let Some(ref local_var_str) = app {
1297        local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
1298    }
1299    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1300        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1301    }
1302    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1303        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1304    };
1305
1306    let local_var_req = local_var_req_builder.build()?;
1307    let local_var_resp = local_var_client.execute(local_var_req).await?;
1308
1309    let local_var_status = local_var_resp.status();
1310    let local_var_content = local_var_resp.text().await?;
1311
1312    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1313        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1314    } else {
1315        let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1316        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1317        Err(Error::ResponseError(local_var_error))
1318    }
1319}
1320
1321pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
1322    let local_var_configuration = configuration;
1323
1324    let local_var_client = &local_var_configuration.client;
1325
1326    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));
1327    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1328
1329    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1330        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1331    }
1332    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1333        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1334    };
1335
1336    let local_var_req = local_var_req_builder.build()?;
1337    let local_var_resp = local_var_client.execute(local_var_req).await?;
1338
1339    let local_var_status = local_var_resp.status();
1340    let local_var_content = local_var_resp.text().await?;
1341
1342    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1343        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1344    } else {
1345        let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1346        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1347        Err(Error::ResponseError(local_var_error))
1348    }
1349}
1350
1351pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
1352    let local_var_configuration = configuration;
1353
1354    let local_var_client = &local_var_configuration.client;
1355
1356    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));
1357    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1358
1359    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1360        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1361    }
1362    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1363        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1364    };
1365
1366    let local_var_req = local_var_req_builder.build()?;
1367    let local_var_resp = local_var_client.execute(local_var_req).await?;
1368
1369    let local_var_status = local_var_resp.status();
1370    let local_var_content = local_var_resp.text().await?;
1371
1372    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1373        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1374    } else {
1375        let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1376        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1377        Err(Error::ResponseError(local_var_error))
1378    }
1379}
1380
1381pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1382    let local_var_configuration = configuration;
1383
1384    let local_var_client = &local_var_configuration.client;
1385
1386    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));
1387    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1388
1389    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1390        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1391    }
1392    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1393        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1394    };
1395
1396    let local_var_req = local_var_req_builder.build()?;
1397    let local_var_resp = local_var_client.execute(local_var_req).await?;
1398
1399    let local_var_status = local_var_resp.status();
1400    let local_var_content = local_var_resp.text().await?;
1401
1402    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1403        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1404    } else {
1405        let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1406        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1407        Err(Error::ResponseError(local_var_error))
1408    }
1409}
1410
1411pub async fn store_raw_script_temp(configuration: &configuration::Configuration, workspace: &str, body: &str) -> Result<String, Error<StoreRawScriptTempError>> {
1412    let local_var_configuration = configuration;
1413
1414    let local_var_client = &local_var_configuration.client;
1415
1416    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/store", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1417    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1418
1419    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1420        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1421    }
1422    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1423        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1424    };
1425    local_var_req_builder = local_var_req_builder.json(&body);
1426
1427    let local_var_req = local_var_req_builder.build()?;
1428    let local_var_resp = local_var_client.execute(local_var_req).await?;
1429
1430    let local_var_status = local_var_resp.status();
1431    let local_var_content = local_var_resp.text().await?;
1432
1433    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1434        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1435    } else {
1436        let local_var_entity: Option<StoreRawScriptTempError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1437        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1438        Err(Error::ResponseError(local_var_error))
1439    }
1440}
1441
1442pub 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>> {
1443    let local_var_configuration = configuration;
1444
1445    let local_var_client = &local_var_configuration.client;
1446
1447    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));
1448    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1449
1450    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1451        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1452    }
1453    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1454        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1455    };
1456    local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1457
1458    let local_var_req = local_var_req_builder.build()?;
1459    let local_var_resp = local_var_client.execute(local_var_req).await?;
1460
1461    let local_var_status = local_var_resp.status();
1462    let local_var_content = local_var_resp.text().await?;
1463
1464    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1465        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1466    } else {
1467        let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1468        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1469        Err(Error::ResponseError(local_var_error))
1470    }
1471}
1472
1473/// Deploys a new version of the script at `path`, which must already hold one. The body's `path` is the destination: the same path leaves the script where it is, a different one moves it there and archives the old path. 
1474pub async fn update_script(configuration: &configuration::Configuration, workspace: &str, path: &str, new_script: models::NewScript) -> Result<String, Error<UpdateScriptError>> {
1475    let local_var_configuration = configuration;
1476
1477    let local_var_client = &local_var_configuration.client;
1478
1479    let local_var_uri_str = format!("{}/w/{workspace}/scripts/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1480    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1481
1482    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1483        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1484    }
1485    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1486        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1487    };
1488    local_var_req_builder = local_var_req_builder.json(&new_script);
1489
1490    let local_var_req = local_var_req_builder.build()?;
1491    let local_var_resp = local_var_client.execute(local_var_req).await?;
1492
1493    let local_var_status = local_var_resp.status();
1494    let local_var_content = local_var_resp.text().await?;
1495
1496    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1497        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1498    } else {
1499        let local_var_entity: Option<UpdateScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1500        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1501        Err(Error::ResponseError(local_var_error))
1502    }
1503}
1504
1505pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1506    let local_var_configuration = configuration;
1507
1508    let local_var_client = &local_var_configuration.client;
1509
1510    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));
1511    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1512
1513    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1514        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1515    }
1516    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1517        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1518    };
1519    local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1520
1521    let local_var_req = local_var_req_builder.build()?;
1522    let local_var_resp = local_var_client.execute(local_var_req).await?;
1523
1524    let local_var_status = local_var_resp.status();
1525    let local_var_content = local_var_resp.text().await?;
1526
1527    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1528        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1529    } else {
1530        let local_var_entity: Option<UpdateScriptHistoryError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1531        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1532        Err(Error::ResponseError(local_var_error))
1533    }
1534}
1535