Skip to main content

windmill_api/apis/
resource_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.786.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 [`clear_resource_history`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ClearResourceHistoryError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`create_resource`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CreateResourceError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`create_resource_type`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateResourceTypeError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`delete_resource`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteResourceError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`delete_resource_type`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeleteResourceTypeError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`delete_resources_bulk`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeleteResourcesBulkError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`exists_resource`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ExistsResourceError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`exists_resource_type`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ExistsResourceTypeError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`file_resource_type_to_file_ext_map`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum FileResourceTypeToFileExtMapError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_git_commit_hash`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetGitCommitHashError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_mcp_tools`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetMcpToolsError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_resource`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetResourceError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_resource_history`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetResourceHistoryError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_resource_type`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetResourceTypeError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_resource_value`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetResourceValueError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_resource_value_interpolated`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetResourceValueInterpolatedError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`get_resource_version`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetResourceVersionError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`list_resource`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum ListResourceError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`list_resource_names`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ListResourceNamesError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`list_resource_type`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum ListResourceTypeError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`list_resource_type_names`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ListResourceTypeNamesError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`list_search_resource`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum ListSearchResourceError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`query_resource_types`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum QueryResourceTypesError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`restore_resource_version`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum RestoreResourceVersionError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`update_resource`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum UpdateResourceError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`update_resource_type`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum UpdateResourceTypeError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`update_resource_value`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum UpdateResourceValueError {
204    UnknownValue(serde_json::Value),
205}
206
207
208pub async fn clear_resource_history(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<ClearResourceHistoryError>> {
209    let local_var_configuration = configuration;
210
211    let local_var_client = &local_var_configuration.client;
212
213    let local_var_uri_str = format!("{}/w/{workspace}/resources/history/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
214    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
215
216    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
217        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
218    }
219    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
220        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
221    };
222
223    let local_var_req = local_var_req_builder.build()?;
224    let local_var_resp = local_var_client.execute(local_var_req).await?;
225
226    let local_var_status = local_var_resp.status();
227    let local_var_content = local_var_resp.text().await?;
228
229    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
230        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
231    } else {
232        let local_var_entity: Option<ClearResourceHistoryError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
233        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
234        Err(Error::ResponseError(local_var_error))
235    }
236}
237
238pub async fn create_resource(configuration: &configuration::Configuration, workspace: &str, create_resource: models::CreateResource, update_if_exists: Option<bool>) -> Result<String, Error<CreateResourceError>> {
239    let local_var_configuration = configuration;
240
241    let local_var_client = &local_var_configuration.client;
242
243    let local_var_uri_str = format!("{}/w/{workspace}/resources/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
244    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
245
246    if let Some(ref local_var_str) = update_if_exists {
247        local_var_req_builder = local_var_req_builder.query(&[("update_if_exists", &local_var_str.to_string())]);
248    }
249    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
250        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
251    }
252    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
253        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
254    };
255    local_var_req_builder = local_var_req_builder.json(&create_resource);
256
257    let local_var_req = local_var_req_builder.build()?;
258    let local_var_resp = local_var_client.execute(local_var_req).await?;
259
260    let local_var_status = local_var_resp.status();
261    let local_var_content = local_var_resp.text().await?;
262
263    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
264        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
265    } else {
266        let local_var_entity: Option<CreateResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
267        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
268        Err(Error::ResponseError(local_var_error))
269    }
270}
271
272pub async fn create_resource_type(configuration: &configuration::Configuration, workspace: &str, resource_type: models::ResourceType) -> Result<String, Error<CreateResourceTypeError>> {
273    let local_var_configuration = configuration;
274
275    let local_var_client = &local_var_configuration.client;
276
277    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
278    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
279
280    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
281        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
282    }
283    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
284        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
285    };
286    local_var_req_builder = local_var_req_builder.json(&resource_type);
287
288    let local_var_req = local_var_req_builder.build()?;
289    let local_var_resp = local_var_client.execute(local_var_req).await?;
290
291    let local_var_status = local_var_resp.status();
292    let local_var_content = local_var_resp.text().await?;
293
294    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
295        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
296    } else {
297        let local_var_entity: Option<CreateResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
298        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
299        Err(Error::ResponseError(local_var_error))
300    }
301}
302
303pub async fn delete_resource(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteResourceError>> {
304    let local_var_configuration = configuration;
305
306    let local_var_client = &local_var_configuration.client;
307
308    let local_var_uri_str = format!("{}/w/{workspace}/resources/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
309    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
310
311    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
312        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
313    }
314    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
315        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
316    };
317
318    let local_var_req = local_var_req_builder.build()?;
319    let local_var_resp = local_var_client.execute(local_var_req).await?;
320
321    let local_var_status = local_var_resp.status();
322    let local_var_content = local_var_resp.text().await?;
323
324    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
325        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
326    } else {
327        let local_var_entity: Option<DeleteResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
328        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
329        Err(Error::ResponseError(local_var_error))
330    }
331}
332
333pub async fn delete_resource_type(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteResourceTypeError>> {
334    let local_var_configuration = configuration;
335
336    let local_var_client = &local_var_configuration.client;
337
338    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
339    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
340
341    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
342        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
343    }
344    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
345        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
346    };
347
348    let local_var_req = local_var_req_builder.build()?;
349    let local_var_resp = local_var_client.execute(local_var_req).await?;
350
351    let local_var_status = local_var_resp.status();
352    let local_var_content = local_var_resp.text().await?;
353
354    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
355        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
356    } else {
357        let local_var_entity: Option<DeleteResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
358        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
359        Err(Error::ResponseError(local_var_error))
360    }
361}
362
363pub async fn delete_resources_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteResourcesBulkError>> {
364    let local_var_configuration = configuration;
365
366    let local_var_client = &local_var_configuration.client;
367
368    let local_var_uri_str = format!("{}/w/{workspace}/resources/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
369    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
370
371    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
372        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
373    }
374    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
375        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
376    };
377    local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
378
379    let local_var_req = local_var_req_builder.build()?;
380    let local_var_resp = local_var_client.execute(local_var_req).await?;
381
382    let local_var_status = local_var_resp.status();
383    let local_var_content = local_var_resp.text().await?;
384
385    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
386        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
387    } else {
388        let local_var_entity: Option<DeleteResourcesBulkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
389        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
390        Err(Error::ResponseError(local_var_error))
391    }
392}
393
394pub async fn exists_resource(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsResourceError>> {
395    let local_var_configuration = configuration;
396
397    let local_var_client = &local_var_configuration.client;
398
399    let local_var_uri_str = format!("{}/w/{workspace}/resources/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
400    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
401
402    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
403        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
404    }
405    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
406        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
407    };
408
409    let local_var_req = local_var_req_builder.build()?;
410    let local_var_resp = local_var_client.execute(local_var_req).await?;
411
412    let local_var_status = local_var_resp.status();
413    let local_var_content = local_var_resp.text().await?;
414
415    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
416        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
417    } else {
418        let local_var_entity: Option<ExistsResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
419        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
420        Err(Error::ResponseError(local_var_error))
421    }
422}
423
424pub async fn exists_resource_type(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsResourceTypeError>> {
425    let local_var_configuration = configuration;
426
427    let local_var_client = &local_var_configuration.client;
428
429    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
430    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
431
432    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
433        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
434    }
435    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
436        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
437    };
438
439    let local_var_req = local_var_req_builder.build()?;
440    let local_var_resp = local_var_client.execute(local_var_req).await?;
441
442    let local_var_status = local_var_resp.status();
443    let local_var_content = local_var_resp.text().await?;
444
445    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
446        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
447    } else {
448        let local_var_entity: Option<ExistsResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
449        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
450        Err(Error::ResponseError(local_var_error))
451    }
452}
453
454pub async fn file_resource_type_to_file_ext_map(configuration: &configuration::Configuration, workspace: &str) -> Result<std::collections::HashMap<String, models::FileResourceTypeToFileExtMap200ResponseValue>, Error<FileResourceTypeToFileExtMapError>> {
455    let local_var_configuration = configuration;
456
457    let local_var_client = &local_var_configuration.client;
458
459    let local_var_uri_str = format!("{}/w/{workspace}/resources/file_resource_type_to_file_ext_map", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
460    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
461
462    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
463        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
464    }
465    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
466        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
467    };
468
469    let local_var_req = local_var_req_builder.build()?;
470    let local_var_resp = local_var_client.execute(local_var_req).await?;
471
472    let local_var_status = local_var_resp.status();
473    let local_var_content = local_var_resp.text().await?;
474
475    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
476        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
477    } else {
478        let local_var_entity: Option<FileResourceTypeToFileExtMapError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
479        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
480        Err(Error::ResponseError(local_var_error))
481    }
482}
483
484pub async fn get_git_commit_hash(configuration: &configuration::Configuration, workspace: &str, path: &str, git_ssh_identity: Option<&str>) -> Result<models::GetGitCommitHash200Response, Error<GetGitCommitHashError>> {
485    let local_var_configuration = configuration;
486
487    let local_var_client = &local_var_configuration.client;
488
489    let local_var_uri_str = format!("{}/w/{workspace}/resources/git_commit_hash/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
490    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
491
492    if let Some(ref local_var_str) = git_ssh_identity {
493        local_var_req_builder = local_var_req_builder.query(&[("git_ssh_identity", &local_var_str.to_string())]);
494    }
495    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
496        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
497    }
498    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
499        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
500    };
501
502    let local_var_req = local_var_req_builder.build()?;
503    let local_var_resp = local_var_client.execute(local_var_req).await?;
504
505    let local_var_status = local_var_resp.status();
506    let local_var_content = local_var_resp.text().await?;
507
508    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
509        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
510    } else {
511        let local_var_entity: Option<GetGitCommitHashError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
512        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
513        Err(Error::ResponseError(local_var_error))
514    }
515}
516
517pub async fn get_mcp_tools(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::GetMcpTools200ResponseInner>, Error<GetMcpToolsError>> {
518    let local_var_configuration = configuration;
519
520    let local_var_client = &local_var_configuration.client;
521
522    let local_var_uri_str = format!("{}/w/{workspace}/resources/mcp_tools/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
523    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
524
525    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
526        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
527    }
528    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
529        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
530    };
531
532    let local_var_req = local_var_req_builder.build()?;
533    let local_var_resp = local_var_client.execute(local_var_req).await?;
534
535    let local_var_status = local_var_resp.status();
536    let local_var_content = local_var_resp.text().await?;
537
538    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
539        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
540    } else {
541        let local_var_entity: Option<GetMcpToolsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
542        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
543        Err(Error::ResponseError(local_var_error))
544    }
545}
546
547pub async fn get_resource(configuration: &configuration::Configuration, workspace: &str, path: &str, get_draft: Option<bool>) -> Result<models::GetResource200Response, Error<GetResourceError>> {
548    let local_var_configuration = configuration;
549
550    let local_var_client = &local_var_configuration.client;
551
552    let local_var_uri_str = format!("{}/w/{workspace}/resources/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
553    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
554
555    if let Some(ref local_var_str) = get_draft {
556        local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
557    }
558    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
559        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
560    }
561    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
562        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
563    };
564
565    let local_var_req = local_var_req_builder.build()?;
566    let local_var_resp = local_var_client.execute(local_var_req).await?;
567
568    let local_var_status = local_var_resp.status();
569    let local_var_content = local_var_resp.text().await?;
570
571    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
572        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
573    } else {
574        let local_var_entity: Option<GetResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
575        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
576        Err(Error::ResponseError(local_var_error))
577    }
578}
579
580pub async fn get_resource_history(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::GetResourceHistory200Response, Error<GetResourceHistoryError>> {
581    let local_var_configuration = configuration;
582
583    let local_var_client = &local_var_configuration.client;
584
585    let local_var_uri_str = format!("{}/w/{workspace}/resources/history/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
586    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
587
588    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
589        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
590    }
591    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
592        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
593    };
594
595    let local_var_req = local_var_req_builder.build()?;
596    let local_var_resp = local_var_client.execute(local_var_req).await?;
597
598    let local_var_status = local_var_resp.status();
599    let local_var_content = local_var_resp.text().await?;
600
601    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
602        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
603    } else {
604        let local_var_entity: Option<GetResourceHistoryError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
605        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
606        Err(Error::ResponseError(local_var_error))
607    }
608}
609
610pub async fn get_resource_type(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ResourceType, Error<GetResourceTypeError>> {
611    let local_var_configuration = configuration;
612
613    let local_var_client = &local_var_configuration.client;
614
615    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
616    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
617
618    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
619        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
620    }
621    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
622        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
623    };
624
625    let local_var_req = local_var_req_builder.build()?;
626    let local_var_resp = local_var_client.execute(local_var_req).await?;
627
628    let local_var_status = local_var_resp.status();
629    let local_var_content = local_var_resp.text().await?;
630
631    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
632        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
633    } else {
634        let local_var_entity: Option<GetResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
635        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
636        Err(Error::ResponseError(local_var_error))
637    }
638}
639
640pub async fn get_resource_value(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<serde_json::Value, Error<GetResourceValueError>> {
641    let local_var_configuration = configuration;
642
643    let local_var_client = &local_var_configuration.client;
644
645    let local_var_uri_str = format!("{}/w/{workspace}/resources/get_value/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
646    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
647
648    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
649        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
650    }
651    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
652        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
653    };
654
655    let local_var_req = local_var_req_builder.build()?;
656    let local_var_resp = local_var_client.execute(local_var_req).await?;
657
658    let local_var_status = local_var_resp.status();
659    let local_var_content = local_var_resp.text().await?;
660
661    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
662        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
663    } else {
664        let local_var_entity: Option<GetResourceValueError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
665        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
666        Err(Error::ResponseError(local_var_error))
667    }
668}
669
670pub async fn get_resource_value_interpolated(configuration: &configuration::Configuration, workspace: &str, path: &str, job_id: Option<&str>, allow_cache: Option<bool>) -> Result<serde_json::Value, Error<GetResourceValueInterpolatedError>> {
671    let local_var_configuration = configuration;
672
673    let local_var_client = &local_var_configuration.client;
674
675    let local_var_uri_str = format!("{}/w/{workspace}/resources/get_value_interpolated/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
676    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
677
678    if let Some(ref local_var_str) = job_id {
679        local_var_req_builder = local_var_req_builder.query(&[("job_id", &local_var_str.to_string())]);
680    }
681    if let Some(ref local_var_str) = allow_cache {
682        local_var_req_builder = local_var_req_builder.query(&[("allow_cache", &local_var_str.to_string())]);
683    }
684    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
685        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
686    }
687    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
688        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
689    };
690
691    let local_var_req = local_var_req_builder.build()?;
692    let local_var_resp = local_var_client.execute(local_var_req).await?;
693
694    let local_var_status = local_var_resp.status();
695    let local_var_content = local_var_resp.text().await?;
696
697    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
698        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
699    } else {
700        let local_var_entity: Option<GetResourceValueInterpolatedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
701        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
702        Err(Error::ResponseError(local_var_error))
703    }
704}
705
706pub async fn get_resource_version(configuration: &configuration::Configuration, workspace: &str, version: i64) -> Result<models::GetResourceVersion200Response, Error<GetResourceVersionError>> {
707    let local_var_configuration = configuration;
708
709    let local_var_client = &local_var_configuration.client;
710
711    let local_var_uri_str = format!("{}/w/{workspace}/resources/history/v/{version}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version);
712    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
713
714    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
715        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
716    }
717    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
718        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
719    };
720
721    let local_var_req = local_var_req_builder.build()?;
722    let local_var_resp = local_var_client.execute(local_var_req).await?;
723
724    let local_var_status = local_var_resp.status();
725    let local_var_content = local_var_resp.text().await?;
726
727    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
728        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
729    } else {
730        let local_var_entity: Option<GetResourceVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
731        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
732        Err(Error::ResponseError(local_var_error))
733    }
734}
735
736pub async fn list_resource(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, resource_type: Option<&str>, resource_type_exclude: Option<&str>, path_start: Option<&str>, path: Option<&str>, description: Option<&str>, value: Option<&str>, broad_filter: Option<&str>, label: Option<&str>, include_draft_only: Option<bool>) -> Result<Vec<models::ListableResource>, Error<ListResourceError>> {
737    let local_var_configuration = configuration;
738
739    let local_var_client = &local_var_configuration.client;
740
741    let local_var_uri_str = format!("{}/w/{workspace}/resources/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
742    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
743
744    if let Some(ref local_var_str) = page {
745        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
746    }
747    if let Some(ref local_var_str) = per_page {
748        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
749    }
750    if let Some(ref local_var_str) = resource_type {
751        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
752    }
753    if let Some(ref local_var_str) = resource_type_exclude {
754        local_var_req_builder = local_var_req_builder.query(&[("resource_type_exclude", &local_var_str.to_string())]);
755    }
756    if let Some(ref local_var_str) = path_start {
757        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
758    }
759    if let Some(ref local_var_str) = path {
760        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
761    }
762    if let Some(ref local_var_str) = description {
763        local_var_req_builder = local_var_req_builder.query(&[("description", &local_var_str.to_string())]);
764    }
765    if let Some(ref local_var_str) = value {
766        local_var_req_builder = local_var_req_builder.query(&[("value", &local_var_str.to_string())]);
767    }
768    if let Some(ref local_var_str) = broad_filter {
769        local_var_req_builder = local_var_req_builder.query(&[("broad_filter", &local_var_str.to_string())]);
770    }
771    if let Some(ref local_var_str) = label {
772        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
773    }
774    if let Some(ref local_var_str) = include_draft_only {
775        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
776    }
777    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
778        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
779    }
780    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
781        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
782    };
783
784    let local_var_req = local_var_req_builder.build()?;
785    let local_var_resp = local_var_client.execute(local_var_req).await?;
786
787    let local_var_status = local_var_resp.status();
788    let local_var_content = local_var_resp.text().await?;
789
790    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
791        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
792    } else {
793        let local_var_entity: Option<ListResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
794        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
795        Err(Error::ResponseError(local_var_error))
796    }
797}
798
799pub async fn list_resource_names(configuration: &configuration::Configuration, workspace: &str, name: &str) -> Result<Vec<models::ListResourceNames200ResponseInner>, Error<ListResourceNamesError>> {
800    let local_var_configuration = configuration;
801
802    let local_var_client = &local_var_configuration.client;
803
804    let local_var_uri_str = format!("{}/w/{workspace}/resources/list_names/{name}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), name=crate::apis::urlencode(name));
805    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
806
807    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
808        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
809    }
810    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
811        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
812    };
813
814    let local_var_req = local_var_req_builder.build()?;
815    let local_var_resp = local_var_client.execute(local_var_req).await?;
816
817    let local_var_status = local_var_resp.status();
818    let local_var_content = local_var_resp.text().await?;
819
820    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
821        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
822    } else {
823        let local_var_entity: Option<ListResourceNamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
824        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
825        Err(Error::ResponseError(local_var_error))
826    }
827}
828
829pub async fn list_resource_type(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ResourceType>, Error<ListResourceTypeError>> {
830    let local_var_configuration = configuration;
831
832    let local_var_client = &local_var_configuration.client;
833
834    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
835    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
836
837    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
838        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
839    }
840    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
841        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
842    };
843
844    let local_var_req = local_var_req_builder.build()?;
845    let local_var_resp = local_var_client.execute(local_var_req).await?;
846
847    let local_var_status = local_var_resp.status();
848    let local_var_content = local_var_resp.text().await?;
849
850    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
851        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
852    } else {
853        let local_var_entity: Option<ListResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
854        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
855        Err(Error::ResponseError(local_var_error))
856    }
857}
858
859pub async fn list_resource_type_names(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListResourceTypeNamesError>> {
860    let local_var_configuration = configuration;
861
862    let local_var_client = &local_var_configuration.client;
863
864    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/listnames", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
865    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
866
867    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
868        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
869    }
870    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
871        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
872    };
873
874    let local_var_req = local_var_req_builder.build()?;
875    let local_var_resp = local_var_client.execute(local_var_req).await?;
876
877    let local_var_status = local_var_resp.status();
878    let local_var_content = local_var_resp.text().await?;
879
880    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
881        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
882    } else {
883        let local_var_entity: Option<ListResourceTypeNamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
884        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
885        Err(Error::ResponseError(local_var_error))
886    }
887}
888
889pub async fn list_search_resource(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchResource200ResponseInner>, Error<ListSearchResourceError>> {
890    let local_var_configuration = configuration;
891
892    let local_var_client = &local_var_configuration.client;
893
894    let local_var_uri_str = format!("{}/w/{workspace}/resources/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
895    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
896
897    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
898        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
899    }
900    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
901        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
902    };
903
904    let local_var_req = local_var_req_builder.build()?;
905    let local_var_resp = local_var_client.execute(local_var_req).await?;
906
907    let local_var_status = local_var_resp.status();
908    let local_var_content = local_var_resp.text().await?;
909
910    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
911        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
912    } else {
913        let local_var_entity: Option<ListSearchResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
914        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
915        Err(Error::ResponseError(local_var_error))
916    }
917}
918
919pub async fn query_resource_types(configuration: &configuration::Configuration, workspace: &str, text: &str, limit: Option<f64>) -> Result<Vec<models::QueryResourceTypes200ResponseInner>, Error<QueryResourceTypesError>> {
920    let local_var_configuration = configuration;
921
922    let local_var_client = &local_var_configuration.client;
923
924    let local_var_uri_str = format!("{}/w/{workspace}/embeddings/query_resource_types", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
925    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
926
927    local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
928    if let Some(ref local_var_str) = limit {
929        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
930    }
931    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
932        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
933    }
934    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
935        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
936    };
937
938    let local_var_req = local_var_req_builder.build()?;
939    let local_var_resp = local_var_client.execute(local_var_req).await?;
940
941    let local_var_status = local_var_resp.status();
942    let local_var_content = local_var_resp.text().await?;
943
944    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
945        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
946    } else {
947        let local_var_entity: Option<QueryResourceTypesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
948        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
949        Err(Error::ResponseError(local_var_error))
950    }
951}
952
953pub async fn restore_resource_version(configuration: &configuration::Configuration, workspace: &str, version: i64) -> Result<String, Error<RestoreResourceVersionError>> {
954    let local_var_configuration = configuration;
955
956    let local_var_client = &local_var_configuration.client;
957
958    let local_var_uri_str = format!("{}/w/{workspace}/resources/history/restore/v/{version}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), version=version);
959    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
960
961    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
962        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
963    }
964    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
965        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
966    };
967
968    let local_var_req = local_var_req_builder.build()?;
969    let local_var_resp = local_var_client.execute(local_var_req).await?;
970
971    let local_var_status = local_var_resp.status();
972    let local_var_content = local_var_resp.text().await?;
973
974    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
975        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
976    } else {
977        let local_var_entity: Option<RestoreResourceVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
978        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
979        Err(Error::ResponseError(local_var_error))
980    }
981}
982
983pub async fn update_resource(configuration: &configuration::Configuration, workspace: &str, path: &str, edit_resource: models::EditResource) -> Result<String, Error<UpdateResourceError>> {
984    let local_var_configuration = configuration;
985
986    let local_var_client = &local_var_configuration.client;
987
988    let local_var_uri_str = format!("{}/w/{workspace}/resources/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
989    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
990
991    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
992        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
993    }
994    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
995        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
996    };
997    local_var_req_builder = local_var_req_builder.json(&edit_resource);
998
999    let local_var_req = local_var_req_builder.build()?;
1000    let local_var_resp = local_var_client.execute(local_var_req).await?;
1001
1002    let local_var_status = local_var_resp.status();
1003    let local_var_content = local_var_resp.text().await?;
1004
1005    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1006        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1007    } else {
1008        let local_var_entity: Option<UpdateResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1009        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1010        Err(Error::ResponseError(local_var_error))
1011    }
1012}
1013
1014pub async fn update_resource_type(configuration: &configuration::Configuration, workspace: &str, path: &str, edit_resource_type: models::EditResourceType) -> Result<String, Error<UpdateResourceTypeError>> {
1015    let local_var_configuration = configuration;
1016
1017    let local_var_client = &local_var_configuration.client;
1018
1019    let local_var_uri_str = format!("{}/w/{workspace}/resources/type/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1020    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1021
1022    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1023        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1024    }
1025    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1026        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1027    };
1028    local_var_req_builder = local_var_req_builder.json(&edit_resource_type);
1029
1030    let local_var_req = local_var_req_builder.build()?;
1031    let local_var_resp = local_var_client.execute(local_var_req).await?;
1032
1033    let local_var_status = local_var_resp.status();
1034    let local_var_content = local_var_resp.text().await?;
1035
1036    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1037        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1038    } else {
1039        let local_var_entity: Option<UpdateResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1040        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1041        Err(Error::ResponseError(local_var_error))
1042    }
1043}
1044
1045pub async fn update_resource_value(configuration: &configuration::Configuration, workspace: &str, path: &str, set_global_request: models::SetGlobalRequest) -> Result<String, Error<UpdateResourceValueError>> {
1046    let local_var_configuration = configuration;
1047
1048    let local_var_client = &local_var_configuration.client;
1049
1050    let local_var_uri_str = format!("{}/w/{workspace}/resources/update_value/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1051    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1052
1053    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1054        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1055    }
1056    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1057        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1058    };
1059    local_var_req_builder = local_var_req_builder.json(&set_global_request);
1060
1061    let local_var_req = local_var_req_builder.build()?;
1062    let local_var_resp = local_var_client.execute(local_var_req).await?;
1063
1064    let local_var_status = local_var_resp.status();
1065    let local_var_content = local_var_resp.text().await?;
1066
1067    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1068        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1069    } else {
1070        let local_var_entity: Option<UpdateResourceValueError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1071        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1072        Err(Error::ResponseError(local_var_error))
1073    }
1074}
1075