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