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