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