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.748.0
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 [`create_script`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateScriptError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`delete_script_by_hash`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeleteScriptByHashError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`delete_script_by_path`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeleteScriptByPathError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`delete_scripts_bulk`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeleteScriptsBulkError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`diff_raw_scripts_with_deployed`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DiffRawScriptsWithDeployedError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`exists_script_by_path`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ExistsScriptByPathError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_ci_test_results`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetCiTestResultsError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_ci_test_results_batch`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetCiTestResultsBatchError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_hub_script_by_path`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetHubScriptByPathError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_hub_script_content_by_path`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetHubScriptContentByPathError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_script_by_hash`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetScriptByHashError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_script_by_path`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetScriptByPathError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_script_deployment_status`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetScriptDeploymentStatusError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`get_script_history_by_path`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetScriptHistoryByPathError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`get_script_latest_version`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetScriptLatestVersionError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`get_top_hub_scripts`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetTopHubScriptsError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`get_triggers_count_of_script`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetTriggersCountOfScriptError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`list_dedicated_with_deps`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ListDedicatedWithDepsError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`list_script_paths`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum ListScriptPathsError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`list_script_paths_from_workspace_runnable`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ListScriptPathsFromWorkspaceRunnableError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`list_scripts`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum ListScriptsError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`list_search_script`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ListSearchScriptError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`list_tokens_of_script`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum ListTokensOfScriptError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`pick_hub_script_by_path`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum PickHubScriptByPathError {
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`query_hub_scripts`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum QueryHubScriptsError {
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`raw_script_by_hash`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum RawScriptByHashError {
218    UnknownValue(serde_json::Value),
219}
220
221/// struct for typed errors of method [`raw_script_by_path`]
222#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum RawScriptByPathError {
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`raw_script_by_path_tokened`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum RawScriptByPathTokenedError {
232    UnknownValue(serde_json::Value),
233}
234
235/// struct for typed errors of method [`store_raw_script_temp`]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum StoreRawScriptTempError {
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`toggle_workspace_error_handler_for_script`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum ToggleWorkspaceErrorHandlerForScriptError {
246    UnknownValue(serde_json::Value),
247}
248
249/// struct for typed errors of method [`update_script_history`]
250#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum UpdateScriptHistoryError {
253    UnknownValue(serde_json::Value),
254}
255
256
257pub async fn archive_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<ArchiveScriptByHashError>> {
258    let local_var_configuration = configuration;
259
260    let local_var_client = &local_var_configuration.client;
261
262    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));
263    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
264
265    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
266        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
267    }
268    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
269        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
270    };
271
272    let local_var_req = local_var_req_builder.build()?;
273    let local_var_resp = local_var_client.execute(local_var_req).await?;
274
275    let local_var_status = local_var_resp.status();
276    let local_var_content = local_var_resp.text().await?;
277
278    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
279        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
280    } else {
281        let local_var_entity: Option<ArchiveScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
282        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
283        Err(Error::ResponseError(local_var_error))
284    }
285}
286
287pub async fn archive_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<ArchiveScriptByPathError>> {
288    let local_var_configuration = configuration;
289
290    let local_var_client = &local_var_configuration.client;
291
292    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));
293    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
294
295    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
296        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
297    }
298    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
299        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
300    };
301
302    let local_var_req = local_var_req_builder.build()?;
303    let local_var_resp = local_var_client.execute(local_var_req).await?;
304
305    let local_var_status = local_var_resp.status();
306    let local_var_content = local_var_resp.text().await?;
307
308    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
309        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
310    } else {
311        let local_var_entity: Option<ArchiveScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
312        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
313        Err(Error::ResponseError(local_var_error))
314    }
315}
316
317/// 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. 
318pub async fn check_schema_contracts(configuration: &configuration::Configuration, workspace: &str, check_schema_contracts_request: models::CheckSchemaContractsRequest) -> Result<models::CheckSchemaContracts200Response, Error<CheckSchemaContractsError>> {
319    let local_var_configuration = configuration;
320
321    let local_var_client = &local_var_configuration.client;
322
323    let local_var_uri_str = format!("{}/w/{workspace}/scripts/check_schema_contracts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
324    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
325
326    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
327        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
328    }
329    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
330        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
331    };
332    local_var_req_builder = local_var_req_builder.json(&check_schema_contracts_request);
333
334    let local_var_req = local_var_req_builder.build()?;
335    let local_var_resp = local_var_client.execute(local_var_req).await?;
336
337    let local_var_status = local_var_resp.status();
338    let local_var_content = local_var_resp.text().await?;
339
340    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
341        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
342    } else {
343        let local_var_entity: Option<CheckSchemaContractsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
344        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
345        Err(Error::ResponseError(local_var_error))
346    }
347}
348
349/// Creates a new script when the path does not already exist. Creates a new version of an existing script when called with the same path and the current `parent_hash`. 
350pub async fn create_script(configuration: &configuration::Configuration, workspace: &str, new_script: models::NewScript) -> Result<String, Error<CreateScriptError>> {
351    let local_var_configuration = configuration;
352
353    let local_var_client = &local_var_configuration.client;
354
355    let local_var_uri_str = format!("{}/w/{workspace}/scripts/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
356    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
357
358    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
359        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
360    }
361    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
362        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
363    };
364    local_var_req_builder = local_var_req_builder.json(&new_script);
365
366    let local_var_req = local_var_req_builder.build()?;
367    let local_var_resp = local_var_client.execute(local_var_req).await?;
368
369    let local_var_status = local_var_resp.status();
370    let local_var_content = local_var_resp.text().await?;
371
372    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
373        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
374    } else {
375        let local_var_entity: Option<CreateScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
376        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
377        Err(Error::ResponseError(local_var_error))
378    }
379}
380
381pub async fn delete_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<DeleteScriptByHashError>> {
382    let local_var_configuration = configuration;
383
384    let local_var_client = &local_var_configuration.client;
385
386    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));
387    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
388
389    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
390        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
391    }
392    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
393        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
394    };
395
396    let local_var_req = local_var_req_builder.build()?;
397    let local_var_resp = local_var_client.execute(local_var_req).await?;
398
399    let local_var_status = local_var_resp.status();
400    let local_var_content = local_var_resp.text().await?;
401
402    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
403        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
404    } else {
405        let local_var_entity: Option<DeleteScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
406        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
407        Err(Error::ResponseError(local_var_error))
408    }
409}
410
411pub async fn delete_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, keep_captures: Option<bool>) -> Result<String, Error<DeleteScriptByPathError>> {
412    let local_var_configuration = configuration;
413
414    let local_var_client = &local_var_configuration.client;
415
416    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));
417    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
418
419    if let Some(ref local_var_str) = keep_captures {
420        local_var_req_builder = local_var_req_builder.query(&[("keep_captures", &local_var_str.to_string())]);
421    }
422    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
423        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
424    }
425    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
426        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
427    };
428
429    let local_var_req = local_var_req_builder.build()?;
430    let local_var_resp = local_var_client.execute(local_var_req).await?;
431
432    let local_var_status = local_var_resp.status();
433    let local_var_content = local_var_resp.text().await?;
434
435    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
436        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
437    } else {
438        let local_var_entity: Option<DeleteScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
439        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
440        Err(Error::ResponseError(local_var_error))
441    }
442}
443
444pub async fn delete_scripts_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteScriptsBulkError>> {
445    let local_var_configuration = configuration;
446
447    let local_var_client = &local_var_configuration.client;
448
449    let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
450    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
451
452    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
453        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
454    }
455    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
456        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
457    };
458    local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
459
460    let local_var_req = local_var_req_builder.build()?;
461    let local_var_resp = local_var_client.execute(local_var_req).await?;
462
463    let local_var_status = local_var_resp.status();
464    let local_var_content = local_var_resp.text().await?;
465
466    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
467        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
468    } else {
469        let local_var_entity: Option<DeleteScriptsBulkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
470        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
471        Err(Error::ResponseError(local_var_error))
472    }
473}
474
475pub 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>> {
476    let local_var_configuration = configuration;
477
478    let local_var_client = &local_var_configuration.client;
479
480    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/diff", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
481    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
482
483    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
484        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
485    }
486    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
487        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
488    };
489    local_var_req_builder = local_var_req_builder.json(&diff_raw_scripts_with_deployed_request);
490
491    let local_var_req = local_var_req_builder.build()?;
492    let local_var_resp = local_var_client.execute(local_var_req).await?;
493
494    let local_var_status = local_var_resp.status();
495    let local_var_content = local_var_resp.text().await?;
496
497    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
498        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
499    } else {
500        let local_var_entity: Option<DiffRawScriptsWithDeployedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
501        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
502        Err(Error::ResponseError(local_var_error))
503    }
504}
505
506pub async fn exists_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsScriptByPathError>> {
507    let local_var_configuration = configuration;
508
509    let local_var_client = &local_var_configuration.client;
510
511    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));
512    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
513
514    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
515        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
516    }
517    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
518        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
519    };
520
521    let local_var_req = local_var_req_builder.build()?;
522    let local_var_resp = local_var_client.execute(local_var_req).await?;
523
524    let local_var_status = local_var_resp.status();
525    let local_var_content = local_var_resp.text().await?;
526
527    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
528        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
529    } else {
530        let local_var_entity: Option<ExistsScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
531        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
532        Err(Error::ResponseError(local_var_error))
533    }
534}
535
536pub async fn get_ci_test_results(configuration: &configuration::Configuration, workspace: &str, kind: &str, path: &str) -> Result<Vec<models::CiTestResult>, Error<GetCiTestResultsError>> {
537    let local_var_configuration = configuration;
538
539    let local_var_client = &local_var_configuration.client;
540
541    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));
542    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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<GetCiTestResultsError> = 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_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>> {
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/ci_test_results_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
572    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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    local_var_req_builder = local_var_req_builder.json(&get_ci_test_results_batch_request);
581
582    let local_var_req = local_var_req_builder.build()?;
583    let local_var_resp = local_var_client.execute(local_var_req).await?;
584
585    let local_var_status = local_var_resp.status();
586    let local_var_content = local_var_resp.text().await?;
587
588    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
589        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
590    } else {
591        let local_var_entity: Option<GetCiTestResultsBatchError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
592        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
593        Err(Error::ResponseError(local_var_error))
594    }
595}
596
597pub async fn get_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::GetHubScriptByPath200Response, Error<GetHubScriptByPathError>> {
598    let local_var_configuration = configuration;
599
600    let local_var_client = &local_var_configuration.client;
601
602    let local_var_uri_str = format!("{}/scripts/hub/get_full/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
603    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
604
605    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
606        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
607    }
608    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
609        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
610    };
611
612    let local_var_req = local_var_req_builder.build()?;
613    let local_var_resp = local_var_client.execute(local_var_req).await?;
614
615    let local_var_status = local_var_resp.status();
616    let local_var_content = local_var_resp.text().await?;
617
618    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
619        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
620    } else {
621        let local_var_entity: Option<GetHubScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
622        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
623        Err(Error::ResponseError(local_var_error))
624    }
625}
626
627pub async fn get_hub_script_content_by_path(configuration: &configuration::Configuration, path: &str) -> Result<String, Error<GetHubScriptContentByPathError>> {
628    let local_var_configuration = configuration;
629
630    let local_var_client = &local_var_configuration.client;
631
632    let local_var_uri_str = format!("{}/scripts/hub/get/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
633    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
634
635    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
636        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
637    }
638    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
639        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
640    };
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<GetHubScriptContentByPathError> = 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_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str, with_starred_info: Option<bool>, authed: Option<bool>) -> Result<models::Script, Error<GetScriptByHashError>> {
658    let local_var_configuration = configuration;
659
660    let local_var_client = &local_var_configuration.client;
661
662    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));
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_str) = with_starred_info {
666        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
667    }
668    if let Some(ref local_var_str) = authed {
669        local_var_req_builder = local_var_req_builder.query(&[("authed", &local_var_str.to_string())]);
670    }
671    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
672        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
673    }
674    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
675        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
676    };
677
678    let local_var_req = local_var_req_builder.build()?;
679    let local_var_resp = local_var_client.execute(local_var_req).await?;
680
681    let local_var_status = local_var_resp.status();
682    let local_var_content = local_var_resp.text().await?;
683
684    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
685        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
686    } else {
687        let local_var_entity: Option<GetScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
688        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
689        Err(Error::ResponseError(local_var_error))
690    }
691}
692
693pub 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>> {
694    let local_var_configuration = configuration;
695
696    let local_var_client = &local_var_configuration.client;
697
698    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));
699    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
700
701    if let Some(ref local_var_str) = with_starred_info {
702        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
703    }
704    if let Some(ref local_var_str) = get_draft {
705        local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
706    }
707    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
708        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
709    }
710    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
711        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
712    };
713
714    let local_var_req = local_var_req_builder.build()?;
715    let local_var_resp = local_var_client.execute(local_var_req).await?;
716
717    let local_var_status = local_var_resp.status();
718    let local_var_content = local_var_resp.text().await?;
719
720    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
721        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
722    } else {
723        let local_var_entity: Option<GetScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
724        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
725        Err(Error::ResponseError(local_var_error))
726    }
727}
728
729pub async fn get_script_deployment_status(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::GetScriptDeploymentStatus200Response, Error<GetScriptDeploymentStatusError>> {
730    let local_var_configuration = configuration;
731
732    let local_var_client = &local_var_configuration.client;
733
734    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));
735    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
736
737    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
738        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
739    }
740    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
741        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
742    };
743
744    let local_var_req = local_var_req_builder.build()?;
745    let local_var_resp = local_var_client.execute(local_var_req).await?;
746
747    let local_var_status = local_var_resp.status();
748    let local_var_content = local_var_resp.text().await?;
749
750    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
751        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
752    } else {
753        let local_var_entity: Option<GetScriptDeploymentStatusError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
754        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
755        Err(Error::ResponseError(local_var_error))
756    }
757}
758
759pub async fn get_script_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::ScriptHistory>, Error<GetScriptHistoryByPathError>> {
760    let local_var_configuration = configuration;
761
762    let local_var_client = &local_var_configuration.client;
763
764    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));
765    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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<GetScriptHistoryByPathError> = 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_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ScriptHistory, Error<GetScriptLatestVersionError>> {
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/get_latest_version/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
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<GetScriptLatestVersionError> = 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_top_hub_scripts(configuration: &configuration::Configuration, limit: Option<f64>, app: Option<&str>, kind: Option<&str>) -> Result<models::GetTopHubScripts200Response, Error<GetTopHubScriptsError>> {
820    let local_var_configuration = configuration;
821
822    let local_var_client = &local_var_configuration.client;
823
824    let local_var_uri_str = format!("{}/scripts/hub/top", local_var_configuration.base_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_str) = limit {
828        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
829    }
830    if let Some(ref local_var_str) = app {
831        local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
832    }
833    if let Some(ref local_var_str) = kind {
834        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
835    }
836    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
837        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
838    }
839    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
840        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
841    };
842
843    let local_var_req = local_var_req_builder.build()?;
844    let local_var_resp = local_var_client.execute(local_var_req).await?;
845
846    let local_var_status = local_var_resp.status();
847    let local_var_content = local_var_resp.text().await?;
848
849    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
850        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
851    } else {
852        let local_var_entity: Option<GetTopHubScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
853        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
854        Err(Error::ResponseError(local_var_error))
855    }
856}
857
858pub async fn get_triggers_count_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfScriptError>> {
859    let local_var_configuration = configuration;
860
861    let local_var_client = &local_var_configuration.client;
862
863    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));
864    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
865
866    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
867        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
868    }
869    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
870        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
871    };
872
873    let local_var_req = local_var_req_builder.build()?;
874    let local_var_resp = local_var_client.execute(local_var_req).await?;
875
876    let local_var_status = local_var_resp.status();
877    let local_var_content = local_var_resp.text().await?;
878
879    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
880        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
881    } else {
882        let local_var_entity: Option<GetTriggersCountOfScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
883        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
884        Err(Error::ResponseError(local_var_error))
885    }
886}
887
888pub async fn list_dedicated_with_deps(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListDedicatedWithDeps200ResponseInner>, Error<ListDedicatedWithDepsError>> {
889    let local_var_configuration = configuration;
890
891    let local_var_client = &local_var_configuration.client;
892
893    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_dedicated_with_deps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
894    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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<ListDedicatedWithDepsError> = 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 list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
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/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
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<ListScriptPathsError> = 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_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
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_paths_from_workspace_runnable/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
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<ListScriptPathsFromWorkspaceRunnableError> = 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_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>> {
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}/scripts/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) = page {
987        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
988    }
989    if let Some(ref local_var_str) = per_page {
990        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
991    }
992    if let Some(ref local_var_str) = order_desc {
993        local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
994    }
995    if let Some(ref local_var_str) = created_by {
996        local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
997    }
998    if let Some(ref local_var_str) = path_start {
999        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
1000    }
1001    if let Some(ref local_var_str) = path_exact {
1002        local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
1003    }
1004    if let Some(ref local_var_str) = first_parent_hash {
1005        local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
1006    }
1007    if let Some(ref local_var_str) = last_parent_hash {
1008        local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
1009    }
1010    if let Some(ref local_var_str) = parent_hash {
1011        local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
1012    }
1013    if let Some(ref local_var_str) = show_archived {
1014        local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1015    }
1016    if let Some(ref local_var_str) = include_without_main {
1017        local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1018    }
1019    if let Some(ref local_var_str) = include_draft_only {
1020        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1021    }
1022    if let Some(ref local_var_str) = is_template {
1023        local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
1024    }
1025    if let Some(ref local_var_str) = kinds {
1026        local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1027    }
1028    if let Some(ref local_var_str) = starred_only {
1029        local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
1030    }
1031    if let Some(ref local_var_str) = with_deployment_msg {
1032        local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
1033    }
1034    if let Some(ref local_var_str) = languages {
1035        local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
1036    }
1037    if let Some(ref local_var_str) = without_description {
1038        local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
1039    }
1040    if let Some(ref local_var_str) = dedicated_worker {
1041        local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
1042    }
1043    if let Some(ref local_var_str) = label {
1044        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1045    }
1046    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1047        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1048    }
1049    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1050        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1051    };
1052
1053    let local_var_req = local_var_req_builder.build()?;
1054    let local_var_resp = local_var_client.execute(local_var_req).await?;
1055
1056    let local_var_status = local_var_resp.status();
1057    let local_var_content = local_var_resp.text().await?;
1058
1059    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1060        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1061    } else {
1062        let local_var_entity: Option<ListScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1063        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1064        Err(Error::ResponseError(local_var_error))
1065    }
1066}
1067
1068pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
1069    let local_var_configuration = configuration;
1070
1071    let local_var_client = &local_var_configuration.client;
1072
1073    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1074    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1075
1076    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1077        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1078    }
1079    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1080        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1081    };
1082
1083    let local_var_req = local_var_req_builder.build()?;
1084    let local_var_resp = local_var_client.execute(local_var_req).await?;
1085
1086    let local_var_status = local_var_resp.status();
1087    let local_var_content = local_var_resp.text().await?;
1088
1089    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1090        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1091    } else {
1092        let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1093        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1094        Err(Error::ResponseError(local_var_error))
1095    }
1096}
1097
1098pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
1099    let local_var_configuration = configuration;
1100
1101    let local_var_client = &local_var_configuration.client;
1102
1103    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));
1104    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1105
1106    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1107        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1108    }
1109    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1110        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1111    };
1112
1113    let local_var_req = local_var_req_builder.build()?;
1114    let local_var_resp = local_var_client.execute(local_var_req).await?;
1115
1116    let local_var_status = local_var_resp.status();
1117    let local_var_content = local_var_resp.text().await?;
1118
1119    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1120        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1121    } else {
1122        let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1123        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1124        Err(Error::ResponseError(local_var_error))
1125    }
1126}
1127
1128pub async fn pick_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::PickHubScriptByPath200Response, Error<PickHubScriptByPathError>> {
1129    let local_var_configuration = configuration;
1130
1131    let local_var_client = &local_var_configuration.client;
1132
1133    let local_var_uri_str = format!("{}/scripts/hub/pick/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
1134    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1135
1136    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1137        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1138    }
1139    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1140        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1141    };
1142
1143    let local_var_req = local_var_req_builder.build()?;
1144    let local_var_resp = local_var_client.execute(local_var_req).await?;
1145
1146    let local_var_status = local_var_resp.status();
1147    let local_var_content = local_var_resp.text().await?;
1148
1149    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1150        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1151    } else {
1152        let local_var_entity: Option<PickHubScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1153        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1154        Err(Error::ResponseError(local_var_error))
1155    }
1156}
1157
1158pub 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>> {
1159    let local_var_configuration = configuration;
1160
1161    let local_var_client = &local_var_configuration.client;
1162
1163    let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
1164    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1165
1166    local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
1167    if let Some(ref local_var_str) = kind {
1168        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
1169    }
1170    if let Some(ref local_var_str) = limit {
1171        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1172    }
1173    if let Some(ref local_var_str) = app {
1174        local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
1175    }
1176    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1177        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1178    }
1179    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1180        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1181    };
1182
1183    let local_var_req = local_var_req_builder.build()?;
1184    let local_var_resp = local_var_client.execute(local_var_req).await?;
1185
1186    let local_var_status = local_var_resp.status();
1187    let local_var_content = local_var_resp.text().await?;
1188
1189    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1190        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1191    } else {
1192        let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1193        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1194        Err(Error::ResponseError(local_var_error))
1195    }
1196}
1197
1198pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
1199    let local_var_configuration = configuration;
1200
1201    let local_var_client = &local_var_configuration.client;
1202
1203    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw/h/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1204    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1205
1206    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1207        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1208    }
1209    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1210        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1211    };
1212
1213    let local_var_req = local_var_req_builder.build()?;
1214    let local_var_resp = local_var_client.execute(local_var_req).await?;
1215
1216    let local_var_status = local_var_resp.status();
1217    let local_var_content = local_var_resp.text().await?;
1218
1219    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1220        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1221    } else {
1222        let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1223        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1224        Err(Error::ResponseError(local_var_error))
1225    }
1226}
1227
1228pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
1229    let local_var_configuration = configuration;
1230
1231    let local_var_client = &local_var_configuration.client;
1232
1233    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));
1234    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1235
1236    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1237        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1238    }
1239    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1240        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1241    };
1242
1243    let local_var_req = local_var_req_builder.build()?;
1244    let local_var_resp = local_var_client.execute(local_var_req).await?;
1245
1246    let local_var_status = local_var_resp.status();
1247    let local_var_content = local_var_resp.text().await?;
1248
1249    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1250        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1251    } else {
1252        let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1253        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1254        Err(Error::ResponseError(local_var_error))
1255    }
1256}
1257
1258pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1259    let local_var_configuration = configuration;
1260
1261    let local_var_client = &local_var_configuration.client;
1262
1263    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));
1264    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1265
1266    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1267        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1268    }
1269    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1270        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1271    };
1272
1273    let local_var_req = local_var_req_builder.build()?;
1274    let local_var_resp = local_var_client.execute(local_var_req).await?;
1275
1276    let local_var_status = local_var_resp.status();
1277    let local_var_content = local_var_resp.text().await?;
1278
1279    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1280        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1281    } else {
1282        let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1283        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1284        Err(Error::ResponseError(local_var_error))
1285    }
1286}
1287
1288pub async fn store_raw_script_temp(configuration: &configuration::Configuration, workspace: &str, body: &str) -> Result<String, Error<StoreRawScriptTempError>> {
1289    let local_var_configuration = configuration;
1290
1291    let local_var_client = &local_var_configuration.client;
1292
1293    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/store", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1294    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1295
1296    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1297        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1298    }
1299    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1300        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1301    };
1302    local_var_req_builder = local_var_req_builder.json(&body);
1303
1304    let local_var_req = local_var_req_builder.build()?;
1305    let local_var_resp = local_var_client.execute(local_var_req).await?;
1306
1307    let local_var_status = local_var_resp.status();
1308    let local_var_content = local_var_resp.text().await?;
1309
1310    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1311        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1312    } else {
1313        let local_var_entity: Option<StoreRawScriptTempError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1314        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1315        Err(Error::ResponseError(local_var_error))
1316    }
1317}
1318
1319pub 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>> {
1320    let local_var_configuration = configuration;
1321
1322    let local_var_client = &local_var_configuration.client;
1323
1324    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));
1325    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1326
1327    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1328        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1329    }
1330    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1331        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1332    };
1333    local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1334
1335    let local_var_req = local_var_req_builder.build()?;
1336    let local_var_resp = local_var_client.execute(local_var_req).await?;
1337
1338    let local_var_status = local_var_resp.status();
1339    let local_var_content = local_var_resp.text().await?;
1340
1341    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1342        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1343    } else {
1344        let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1345        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1346        Err(Error::ResponseError(local_var_error))
1347    }
1348}
1349
1350pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1351    let local_var_configuration = configuration;
1352
1353    let local_var_client = &local_var_configuration.client;
1354
1355    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));
1356    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1357
1358    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1359        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1360    }
1361    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1362        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1363    };
1364    local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
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<UpdateScriptHistoryError> = 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