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