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.692.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 [`create_script`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateScriptError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`delete_script_by_hash`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteScriptByHashError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`delete_script_by_path`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeleteScriptByPathError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`delete_scripts_bulk`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeleteScriptsBulkError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`diff_raw_scripts_with_deployed`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DiffRawScriptsWithDeployedError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`exists_script_by_path`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ExistsScriptByPathError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_ci_test_results`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetCiTestResultsError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_ci_test_results_batch`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetCiTestResultsBatchError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_hub_script_by_path`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetHubScriptByPathError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_hub_script_content_by_path`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetHubScriptContentByPathError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_script_by_hash`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetScriptByHashError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_script_by_path`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetScriptByPathError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_script_by_path_with_draft`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetScriptByPathWithDraftError {
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/// 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`. 
318pub async fn create_script(configuration: &configuration::Configuration, workspace: &str, new_script: models::NewScript) -> Result<String, Error<CreateScriptError>> {
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/create", 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(&new_script);
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<CreateScriptError> = 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
349pub async fn delete_script_by_hash(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::Script, Error<DeleteScriptByHashError>> {
350    let local_var_configuration = configuration;
351
352    let local_var_client = &local_var_configuration.client;
353
354    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));
355    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
356
357    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
358        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
359    }
360    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
361        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
362    };
363
364    let local_var_req = local_var_req_builder.build()?;
365    let local_var_resp = local_var_client.execute(local_var_req).await?;
366
367    let local_var_status = local_var_resp.status();
368    let local_var_content = local_var_resp.text().await?;
369
370    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
371        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
372    } else {
373        let local_var_entity: Option<DeleteScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
374        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
375        Err(Error::ResponseError(local_var_error))
376    }
377}
378
379pub async fn delete_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, keep_captures: Option<bool>) -> Result<String, Error<DeleteScriptByPathError>> {
380    let local_var_configuration = configuration;
381
382    let local_var_client = &local_var_configuration.client;
383
384    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));
385    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
386
387    if let Some(ref local_var_str) = keep_captures {
388        local_var_req_builder = local_var_req_builder.query(&[("keep_captures", &local_var_str.to_string())]);
389    }
390    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
391        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
392    }
393    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
394        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
395    };
396
397    let local_var_req = local_var_req_builder.build()?;
398    let local_var_resp = local_var_client.execute(local_var_req).await?;
399
400    let local_var_status = local_var_resp.status();
401    let local_var_content = local_var_resp.text().await?;
402
403    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
404        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
405    } else {
406        let local_var_entity: Option<DeleteScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
407        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
408        Err(Error::ResponseError(local_var_error))
409    }
410}
411
412pub async fn delete_scripts_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteScriptsBulkError>> {
413    let local_var_configuration = configuration;
414
415    let local_var_client = &local_var_configuration.client;
416
417    let local_var_uri_str = format!("{}/w/{workspace}/scripts/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
418    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
419
420    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
421        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
422    }
423    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
424        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
425    };
426    local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
427
428    let local_var_req = local_var_req_builder.build()?;
429    let local_var_resp = local_var_client.execute(local_var_req).await?;
430
431    let local_var_status = local_var_resp.status();
432    let local_var_content = local_var_resp.text().await?;
433
434    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
435        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
436    } else {
437        let local_var_entity: Option<DeleteScriptsBulkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
438        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
439        Err(Error::ResponseError(local_var_error))
440    }
441}
442
443pub 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>> {
444    let local_var_configuration = configuration;
445
446    let local_var_client = &local_var_configuration.client;
447
448    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/diff", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
449    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
450
451    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
452        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
453    }
454    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
455        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
456    };
457    local_var_req_builder = local_var_req_builder.json(&diff_raw_scripts_with_deployed_request);
458
459    let local_var_req = local_var_req_builder.build()?;
460    let local_var_resp = local_var_client.execute(local_var_req).await?;
461
462    let local_var_status = local_var_resp.status();
463    let local_var_content = local_var_resp.text().await?;
464
465    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
466        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
467    } else {
468        let local_var_entity: Option<DiffRawScriptsWithDeployedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
469        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
470        Err(Error::ResponseError(local_var_error))
471    }
472}
473
474pub async fn exists_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsScriptByPathError>> {
475    let local_var_configuration = configuration;
476
477    let local_var_client = &local_var_configuration.client;
478
479    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));
480    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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<ExistsScriptByPathError> = 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 get_ci_test_results(configuration: &configuration::Configuration, workspace: &str, kind: &str, path: &str) -> Result<Vec<models::CiTestResult>, Error<GetCiTestResultsError>> {
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/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));
510    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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
519    let local_var_req = local_var_req_builder.build()?;
520    let local_var_resp = local_var_client.execute(local_var_req).await?;
521
522    let local_var_status = local_var_resp.status();
523    let local_var_content = local_var_resp.text().await?;
524
525    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
526        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
527    } else {
528        let local_var_entity: Option<GetCiTestResultsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
529        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
530        Err(Error::ResponseError(local_var_error))
531    }
532}
533
534pub 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>> {
535    let local_var_configuration = configuration;
536
537    let local_var_client = &local_var_configuration.client;
538
539    let local_var_uri_str = format!("{}/w/{workspace}/scripts/ci_test_results_batch", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
540    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
541
542    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
543        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
544    }
545    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
546        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
547    };
548    local_var_req_builder = local_var_req_builder.json(&get_ci_test_results_batch_request);
549
550    let local_var_req = local_var_req_builder.build()?;
551    let local_var_resp = local_var_client.execute(local_var_req).await?;
552
553    let local_var_status = local_var_resp.status();
554    let local_var_content = local_var_resp.text().await?;
555
556    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
557        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
558    } else {
559        let local_var_entity: Option<GetCiTestResultsBatchError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
560        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
561        Err(Error::ResponseError(local_var_error))
562    }
563}
564
565pub async fn get_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::GetHubScriptByPath200Response, Error<GetHubScriptByPathError>> {
566    let local_var_configuration = configuration;
567
568    let local_var_client = &local_var_configuration.client;
569
570    let local_var_uri_str = format!("{}/scripts/hub/get_full/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
571    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
572
573    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
574        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
575    }
576    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
577        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
578    };
579
580    let local_var_req = local_var_req_builder.build()?;
581    let local_var_resp = local_var_client.execute(local_var_req).await?;
582
583    let local_var_status = local_var_resp.status();
584    let local_var_content = local_var_resp.text().await?;
585
586    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
587        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
588    } else {
589        let local_var_entity: Option<GetHubScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
590        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
591        Err(Error::ResponseError(local_var_error))
592    }
593}
594
595pub async fn get_hub_script_content_by_path(configuration: &configuration::Configuration, path: &str) -> Result<String, Error<GetHubScriptContentByPathError>> {
596    let local_var_configuration = configuration;
597
598    let local_var_client = &local_var_configuration.client;
599
600    let local_var_uri_str = format!("{}/scripts/hub/get/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
601    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
602
603    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
604        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
605    }
606    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
607        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
608    };
609
610    let local_var_req = local_var_req_builder.build()?;
611    let local_var_resp = local_var_client.execute(local_var_req).await?;
612
613    let local_var_status = local_var_resp.status();
614    let local_var_content = local_var_resp.text().await?;
615
616    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
617        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
618    } else {
619        let local_var_entity: Option<GetHubScriptContentByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
620        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
621        Err(Error::ResponseError(local_var_error))
622    }
623}
624
625pub 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>> {
626    let local_var_configuration = configuration;
627
628    let local_var_client = &local_var_configuration.client;
629
630    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));
631    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
632
633    if let Some(ref local_var_str) = with_starred_info {
634        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
635    }
636    if let Some(ref local_var_str) = authed {
637        local_var_req_builder = local_var_req_builder.query(&[("authed", &local_var_str.to_string())]);
638    }
639    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
640        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
641    }
642    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
643        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
644    };
645
646    let local_var_req = local_var_req_builder.build()?;
647    let local_var_resp = local_var_client.execute(local_var_req).await?;
648
649    let local_var_status = local_var_resp.status();
650    let local_var_content = local_var_resp.text().await?;
651
652    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
653        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
654    } else {
655        let local_var_entity: Option<GetScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
656        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
657        Err(Error::ResponseError(local_var_error))
658    }
659}
660
661pub async fn get_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, with_starred_info: Option<bool>) -> Result<models::Script, Error<GetScriptByPathError>> {
662    let local_var_configuration = configuration;
663
664    let local_var_client = &local_var_configuration.client;
665
666    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));
667    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
668
669    if let Some(ref local_var_str) = with_starred_info {
670        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
671    }
672    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
673        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
674    }
675    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
676        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
677    };
678
679    let local_var_req = local_var_req_builder.build()?;
680    let local_var_resp = local_var_client.execute(local_var_req).await?;
681
682    let local_var_status = local_var_resp.status();
683    let local_var_content = local_var_resp.text().await?;
684
685    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
686        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
687    } else {
688        let local_var_entity: Option<GetScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
689        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
690        Err(Error::ResponseError(local_var_error))
691    }
692}
693
694pub async fn get_script_by_path_with_draft(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::NewScriptWithDraft, Error<GetScriptByPathWithDraftError>> {
695    let local_var_configuration = configuration;
696
697    let local_var_client = &local_var_configuration.client;
698
699    let local_var_uri_str = format!("{}/w/{workspace}/scripts/get/draft/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
700    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
701
702    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
703        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
704    }
705    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
706        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
707    };
708
709    let local_var_req = local_var_req_builder.build()?;
710    let local_var_resp = local_var_client.execute(local_var_req).await?;
711
712    let local_var_status = local_var_resp.status();
713    let local_var_content = local_var_resp.text().await?;
714
715    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
716        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
717    } else {
718        let local_var_entity: Option<GetScriptByPathWithDraftError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
719        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
720        Err(Error::ResponseError(local_var_error))
721    }
722}
723
724pub async fn get_script_deployment_status(configuration: &configuration::Configuration, workspace: &str, hash: &str) -> Result<models::GetScriptDeploymentStatus200Response, Error<GetScriptDeploymentStatusError>> {
725    let local_var_configuration = configuration;
726
727    let local_var_client = &local_var_configuration.client;
728
729    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));
730    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
731
732    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
733        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
734    }
735    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
736        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
737    };
738
739    let local_var_req = local_var_req_builder.build()?;
740    let local_var_resp = local_var_client.execute(local_var_req).await?;
741
742    let local_var_status = local_var_resp.status();
743    let local_var_content = local_var_resp.text().await?;
744
745    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
746        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
747    } else {
748        let local_var_entity: Option<GetScriptDeploymentStatusError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
749        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
750        Err(Error::ResponseError(local_var_error))
751    }
752}
753
754pub async fn get_script_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::ScriptHistory>, Error<GetScriptHistoryByPathError>> {
755    let local_var_configuration = configuration;
756
757    let local_var_client = &local_var_configuration.client;
758
759    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));
760    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
761
762    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
763        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
764    }
765    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
766        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
767    };
768
769    let local_var_req = local_var_req_builder.build()?;
770    let local_var_resp = local_var_client.execute(local_var_req).await?;
771
772    let local_var_status = local_var_resp.status();
773    let local_var_content = local_var_resp.text().await?;
774
775    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
776        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
777    } else {
778        let local_var_entity: Option<GetScriptHistoryByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
779        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
780        Err(Error::ResponseError(local_var_error))
781    }
782}
783
784pub async fn get_script_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ScriptHistory, Error<GetScriptLatestVersionError>> {
785    let local_var_configuration = configuration;
786
787    let local_var_client = &local_var_configuration.client;
788
789    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));
790    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
791
792    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
793        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
794    }
795    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
796        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
797    };
798
799    let local_var_req = local_var_req_builder.build()?;
800    let local_var_resp = local_var_client.execute(local_var_req).await?;
801
802    let local_var_status = local_var_resp.status();
803    let local_var_content = local_var_resp.text().await?;
804
805    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
806        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
807    } else {
808        let local_var_entity: Option<GetScriptLatestVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
809        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
810        Err(Error::ResponseError(local_var_error))
811    }
812}
813
814pub async fn get_top_hub_scripts(configuration: &configuration::Configuration, limit: Option<f64>, app: Option<&str>, kind: Option<&str>) -> Result<models::GetTopHubScripts200Response, Error<GetTopHubScriptsError>> {
815    let local_var_configuration = configuration;
816
817    let local_var_client = &local_var_configuration.client;
818
819    let local_var_uri_str = format!("{}/scripts/hub/top", local_var_configuration.base_path);
820    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
821
822    if let Some(ref local_var_str) = limit {
823        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
824    }
825    if let Some(ref local_var_str) = app {
826        local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
827    }
828    if let Some(ref local_var_str) = kind {
829        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
830    }
831    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
832        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
833    }
834    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
835        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
836    };
837
838    let local_var_req = local_var_req_builder.build()?;
839    let local_var_resp = local_var_client.execute(local_var_req).await?;
840
841    let local_var_status = local_var_resp.status();
842    let local_var_content = local_var_resp.text().await?;
843
844    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
845        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
846    } else {
847        let local_var_entity: Option<GetTopHubScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
848        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
849        Err(Error::ResponseError(local_var_error))
850    }
851}
852
853pub async fn get_triggers_count_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::TriggersCount, Error<GetTriggersCountOfScriptError>> {
854    let local_var_configuration = configuration;
855
856    let local_var_client = &local_var_configuration.client;
857
858    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));
859    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
860
861    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
862        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
863    }
864    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
865        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
866    };
867
868    let local_var_req = local_var_req_builder.build()?;
869    let local_var_resp = local_var_client.execute(local_var_req).await?;
870
871    let local_var_status = local_var_resp.status();
872    let local_var_content = local_var_resp.text().await?;
873
874    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
875        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
876    } else {
877        let local_var_entity: Option<GetTriggersCountOfScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
878        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
879        Err(Error::ResponseError(local_var_error))
880    }
881}
882
883pub async fn list_dedicated_with_deps(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListDedicatedWithDeps200ResponseInner>, Error<ListDedicatedWithDepsError>> {
884    let local_var_configuration = configuration;
885
886    let local_var_client = &local_var_configuration.client;
887
888    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_dedicated_with_deps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
889    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
890
891    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
892        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
893    }
894    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
895        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
896    };
897
898    let local_var_req = local_var_req_builder.build()?;
899    let local_var_resp = local_var_client.execute(local_var_req).await?;
900
901    let local_var_status = local_var_resp.status();
902    let local_var_content = local_var_resp.text().await?;
903
904    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
905        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
906    } else {
907        let local_var_entity: Option<ListDedicatedWithDepsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
908        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
909        Err(Error::ResponseError(local_var_error))
910    }
911}
912
913pub async fn list_script_paths(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListScriptPathsError>> {
914    let local_var_configuration = configuration;
915
916    let local_var_client = &local_var_configuration.client;
917
918    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_paths", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
919    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
920
921    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
922        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
923    }
924    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
925        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
926    };
927
928    let local_var_req = local_var_req_builder.build()?;
929    let local_var_resp = local_var_client.execute(local_var_req).await?;
930
931    let local_var_status = local_var_resp.status();
932    let local_var_content = local_var_resp.text().await?;
933
934    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
935        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
936    } else {
937        let local_var_entity: Option<ListScriptPathsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
938        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
939        Err(Error::ResponseError(local_var_error))
940    }
941}
942
943pub async fn list_script_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListScriptPathsFromWorkspaceRunnableError>> {
944    let local_var_configuration = configuration;
945
946    let local_var_client = &local_var_configuration.client;
947
948    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));
949    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
950
951    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
952        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
953    }
954    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
955        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
956    };
957
958    let local_var_req = local_var_req_builder.build()?;
959    let local_var_resp = local_var_client.execute(local_var_req).await?;
960
961    let local_var_status = local_var_resp.status();
962    let local_var_content = local_var_resp.text().await?;
963
964    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
965        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
966    } else {
967        let local_var_entity: Option<ListScriptPathsFromWorkspaceRunnableError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
968        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
969        Err(Error::ResponseError(local_var_error))
970    }
971}
972
973pub 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::Script>, Error<ListScriptsError>> {
974    let local_var_configuration = configuration;
975
976    let local_var_client = &local_var_configuration.client;
977
978    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
979    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
980
981    if let Some(ref local_var_str) = page {
982        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
983    }
984    if let Some(ref local_var_str) = per_page {
985        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
986    }
987    if let Some(ref local_var_str) = order_desc {
988        local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
989    }
990    if let Some(ref local_var_str) = created_by {
991        local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
992    }
993    if let Some(ref local_var_str) = path_start {
994        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
995    }
996    if let Some(ref local_var_str) = path_exact {
997        local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
998    }
999    if let Some(ref local_var_str) = first_parent_hash {
1000        local_var_req_builder = local_var_req_builder.query(&[("first_parent_hash", &local_var_str.to_string())]);
1001    }
1002    if let Some(ref local_var_str) = last_parent_hash {
1003        local_var_req_builder = local_var_req_builder.query(&[("last_parent_hash", &local_var_str.to_string())]);
1004    }
1005    if let Some(ref local_var_str) = parent_hash {
1006        local_var_req_builder = local_var_req_builder.query(&[("parent_hash", &local_var_str.to_string())]);
1007    }
1008    if let Some(ref local_var_str) = show_archived {
1009        local_var_req_builder = local_var_req_builder.query(&[("show_archived", &local_var_str.to_string())]);
1010    }
1011    if let Some(ref local_var_str) = include_without_main {
1012        local_var_req_builder = local_var_req_builder.query(&[("include_without_main", &local_var_str.to_string())]);
1013    }
1014    if let Some(ref local_var_str) = include_draft_only {
1015        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
1016    }
1017    if let Some(ref local_var_str) = is_template {
1018        local_var_req_builder = local_var_req_builder.query(&[("is_template", &local_var_str.to_string())]);
1019    }
1020    if let Some(ref local_var_str) = kinds {
1021        local_var_req_builder = local_var_req_builder.query(&[("kinds", &local_var_str.to_string())]);
1022    }
1023    if let Some(ref local_var_str) = starred_only {
1024        local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
1025    }
1026    if let Some(ref local_var_str) = with_deployment_msg {
1027        local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
1028    }
1029    if let Some(ref local_var_str) = languages {
1030        local_var_req_builder = local_var_req_builder.query(&[("languages", &local_var_str.to_string())]);
1031    }
1032    if let Some(ref local_var_str) = without_description {
1033        local_var_req_builder = local_var_req_builder.query(&[("without_description", &local_var_str.to_string())]);
1034    }
1035    if let Some(ref local_var_str) = dedicated_worker {
1036        local_var_req_builder = local_var_req_builder.query(&[("dedicated_worker", &local_var_str.to_string())]);
1037    }
1038    if let Some(ref local_var_str) = label {
1039        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
1040    }
1041    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1042        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1043    }
1044    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1045        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1046    };
1047
1048    let local_var_req = local_var_req_builder.build()?;
1049    let local_var_resp = local_var_client.execute(local_var_req).await?;
1050
1051    let local_var_status = local_var_resp.status();
1052    let local_var_content = local_var_resp.text().await?;
1053
1054    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1055        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1056    } else {
1057        let local_var_entity: Option<ListScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1058        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1059        Err(Error::ResponseError(local_var_error))
1060    }
1061}
1062
1063pub async fn list_search_script(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchScript200ResponseInner>, Error<ListSearchScriptError>> {
1064    let local_var_configuration = configuration;
1065
1066    let local_var_client = &local_var_configuration.client;
1067
1068    let local_var_uri_str = format!("{}/w/{workspace}/scripts/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1069    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1070
1071    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1072        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1073    }
1074    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1075        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1076    };
1077
1078    let local_var_req = local_var_req_builder.build()?;
1079    let local_var_resp = local_var_client.execute(local_var_req).await?;
1080
1081    let local_var_status = local_var_resp.status();
1082    let local_var_content = local_var_resp.text().await?;
1083
1084    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1085        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1086    } else {
1087        let local_var_entity: Option<ListSearchScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1088        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1089        Err(Error::ResponseError(local_var_error))
1090    }
1091}
1092
1093pub async fn list_tokens_of_script(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::TruncatedToken>, Error<ListTokensOfScriptError>> {
1094    let local_var_configuration = configuration;
1095
1096    let local_var_client = &local_var_configuration.client;
1097
1098    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));
1099    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1100
1101    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1102        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1103    }
1104    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1105        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1106    };
1107
1108    let local_var_req = local_var_req_builder.build()?;
1109    let local_var_resp = local_var_client.execute(local_var_req).await?;
1110
1111    let local_var_status = local_var_resp.status();
1112    let local_var_content = local_var_resp.text().await?;
1113
1114    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1115        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1116    } else {
1117        let local_var_entity: Option<ListTokensOfScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1118        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1119        Err(Error::ResponseError(local_var_error))
1120    }
1121}
1122
1123pub async fn pick_hub_script_by_path(configuration: &configuration::Configuration, path: &str) -> Result<models::PickHubScriptByPath200Response, Error<PickHubScriptByPathError>> {
1124    let local_var_configuration = configuration;
1125
1126    let local_var_client = &local_var_configuration.client;
1127
1128    let local_var_uri_str = format!("{}/scripts/hub/pick/{path}", local_var_configuration.base_path, path=crate::apis::urlencode(path));
1129    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1130
1131    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1132        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1133    }
1134    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1135        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1136    };
1137
1138    let local_var_req = local_var_req_builder.build()?;
1139    let local_var_resp = local_var_client.execute(local_var_req).await?;
1140
1141    let local_var_status = local_var_resp.status();
1142    let local_var_content = local_var_resp.text().await?;
1143
1144    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1145        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1146    } else {
1147        let local_var_entity: Option<PickHubScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1148        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1149        Err(Error::ResponseError(local_var_error))
1150    }
1151}
1152
1153pub 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>> {
1154    let local_var_configuration = configuration;
1155
1156    let local_var_client = &local_var_configuration.client;
1157
1158    let local_var_uri_str = format!("{}/embeddings/query_hub_scripts", local_var_configuration.base_path);
1159    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1160
1161    local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
1162    if let Some(ref local_var_str) = kind {
1163        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
1164    }
1165    if let Some(ref local_var_str) = limit {
1166        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1167    }
1168    if let Some(ref local_var_str) = app {
1169        local_var_req_builder = local_var_req_builder.query(&[("app", &local_var_str.to_string())]);
1170    }
1171    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1172        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1173    }
1174    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1175        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1176    };
1177
1178    let local_var_req = local_var_req_builder.build()?;
1179    let local_var_resp = local_var_client.execute(local_var_req).await?;
1180
1181    let local_var_status = local_var_resp.status();
1182    let local_var_content = local_var_resp.text().await?;
1183
1184    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1185        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1186    } else {
1187        let local_var_entity: Option<QueryHubScriptsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1188        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1189        Err(Error::ResponseError(local_var_error))
1190    }
1191}
1192
1193pub async fn raw_script_by_hash(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByHashError>> {
1194    let local_var_configuration = configuration;
1195
1196    let local_var_client = &local_var_configuration.client;
1197
1198    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));
1199    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1200
1201    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1202        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1203    }
1204    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1205        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1206    };
1207
1208    let local_var_req = local_var_req_builder.build()?;
1209    let local_var_resp = local_var_client.execute(local_var_req).await?;
1210
1211    let local_var_status = local_var_resp.status();
1212    let local_var_content = local_var_resp.text().await?;
1213
1214    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1215        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1216    } else {
1217        let local_var_entity: Option<RawScriptByHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1218        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1219        Err(Error::ResponseError(local_var_error))
1220    }
1221}
1222
1223pub async fn raw_script_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<RawScriptByPathError>> {
1224    let local_var_configuration = configuration;
1225
1226    let local_var_client = &local_var_configuration.client;
1227
1228    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));
1229    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1230
1231    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1232        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1233    }
1234    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1235        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1236    };
1237
1238    let local_var_req = local_var_req_builder.build()?;
1239    let local_var_resp = local_var_client.execute(local_var_req).await?;
1240
1241    let local_var_status = local_var_resp.status();
1242    let local_var_content = local_var_resp.text().await?;
1243
1244    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1245        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1246    } else {
1247        let local_var_entity: Option<RawScriptByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1248        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1249        Err(Error::ResponseError(local_var_error))
1250    }
1251}
1252
1253pub async fn raw_script_by_path_tokened(configuration: &configuration::Configuration, workspace: &str, token: &str, path: &str) -> Result<String, Error<RawScriptByPathTokenedError>> {
1254    let local_var_configuration = configuration;
1255
1256    let local_var_client = &local_var_configuration.client;
1257
1258    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));
1259    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1260
1261    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1262        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1263    }
1264    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1265        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1266    };
1267
1268    let local_var_req = local_var_req_builder.build()?;
1269    let local_var_resp = local_var_client.execute(local_var_req).await?;
1270
1271    let local_var_status = local_var_resp.status();
1272    let local_var_content = local_var_resp.text().await?;
1273
1274    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1275        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1276    } else {
1277        let local_var_entity: Option<RawScriptByPathTokenedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1278        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1279        Err(Error::ResponseError(local_var_error))
1280    }
1281}
1282
1283pub async fn store_raw_script_temp(configuration: &configuration::Configuration, workspace: &str, body: &str) -> Result<String, Error<StoreRawScriptTempError>> {
1284    let local_var_configuration = configuration;
1285
1286    let local_var_client = &local_var_configuration.client;
1287
1288    let local_var_uri_str = format!("{}/w/{workspace}/scripts/raw_temp/store", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1289    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1290
1291    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1292        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1293    }
1294    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1295        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1296    };
1297    local_var_req_builder = local_var_req_builder.json(&body);
1298
1299    let local_var_req = local_var_req_builder.build()?;
1300    let local_var_resp = local_var_client.execute(local_var_req).await?;
1301
1302    let local_var_status = local_var_resp.status();
1303    let local_var_content = local_var_resp.text().await?;
1304
1305    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1306        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1307    } else {
1308        let local_var_entity: Option<StoreRawScriptTempError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1309        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1310        Err(Error::ResponseError(local_var_error))
1311    }
1312}
1313
1314pub 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>> {
1315    let local_var_configuration = configuration;
1316
1317    let local_var_client = &local_var_configuration.client;
1318
1319    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));
1320    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1321
1322    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1323        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1324    }
1325    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1326        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1327    };
1328    local_var_req_builder = local_var_req_builder.json(&toggle_workspace_error_handler_for_script_request);
1329
1330    let local_var_req = local_var_req_builder.build()?;
1331    let local_var_resp = local_var_client.execute(local_var_req).await?;
1332
1333    let local_var_status = local_var_resp.status();
1334    let local_var_content = local_var_resp.text().await?;
1335
1336    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1337        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1338    } else {
1339        let local_var_entity: Option<ToggleWorkspaceErrorHandlerForScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1340        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1341        Err(Error::ResponseError(local_var_error))
1342    }
1343}
1344
1345pub async fn update_script_history(configuration: &configuration::Configuration, workspace: &str, hash: &str, path: &str, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateScriptHistoryError>> {
1346    let local_var_configuration = configuration;
1347
1348    let local_var_client = &local_var_configuration.client;
1349
1350    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));
1351    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1352
1353    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1354        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1355    }
1356    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1357        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1358    };
1359    local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1360
1361    let local_var_req = local_var_req_builder.build()?;
1362    let local_var_resp = local_var_client.execute(local_var_req).await?;
1363
1364    let local_var_status = local_var_resp.status();
1365    let local_var_content = local_var_resp.text().await?;
1366
1367    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1368        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1369    } else {
1370        let local_var_entity: Option<UpdateScriptHistoryError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1371        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1372        Err(Error::ResponseError(local_var_error))
1373    }
1374}
1375