windmill_api/apis/
settings_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.501.2
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 [`backend_uptodate`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BackendUptodateError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`backend_version`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum BackendVersionError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_license_id`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetLicenseIdError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_open_api_yaml`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetOpenApiYamlError {
43    UnknownValue(serde_json::Value),
44}
45
46
47pub async fn backend_uptodate(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendUptodateError>> {
48    let local_var_configuration = configuration;
49
50    let local_var_client = &local_var_configuration.client;
51
52    let local_var_uri_str = format!("{}/uptodate", local_var_configuration.base_path);
53    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
54
55    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
56        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
57    }
58    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
59        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
60    };
61
62    let local_var_req = local_var_req_builder.build()?;
63    let local_var_resp = local_var_client.execute(local_var_req).await?;
64
65    let local_var_status = local_var_resp.status();
66    let local_var_content = local_var_resp.text().await?;
67
68    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
69        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
70    } else {
71        let local_var_entity: Option<BackendUptodateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
72        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
73        Err(Error::ResponseError(local_var_error))
74    }
75}
76
77pub async fn backend_version(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendVersionError>> {
78    let local_var_configuration = configuration;
79
80    let local_var_client = &local_var_configuration.client;
81
82    let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
83    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
84
85    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
86        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
87    }
88    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
89        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
90    };
91
92    let local_var_req = local_var_req_builder.build()?;
93    let local_var_resp = local_var_client.execute(local_var_req).await?;
94
95    let local_var_status = local_var_resp.status();
96    let local_var_content = local_var_resp.text().await?;
97
98    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
99        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
100    } else {
101        let local_var_entity: Option<BackendVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
102        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
103        Err(Error::ResponseError(local_var_error))
104    }
105}
106
107pub async fn get_license_id(configuration: &configuration::Configuration, ) -> Result<String, Error<GetLicenseIdError>> {
108    let local_var_configuration = configuration;
109
110    let local_var_client = &local_var_configuration.client;
111
112    let local_var_uri_str = format!("{}/ee_license", local_var_configuration.base_path);
113    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
114
115    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
116        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
117    }
118    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
119        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
120    };
121
122    let local_var_req = local_var_req_builder.build()?;
123    let local_var_resp = local_var_client.execute(local_var_req).await?;
124
125    let local_var_status = local_var_resp.status();
126    let local_var_content = local_var_resp.text().await?;
127
128    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
129        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
130    } else {
131        let local_var_entity: Option<GetLicenseIdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
132        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
133        Err(Error::ResponseError(local_var_error))
134    }
135}
136
137pub async fn get_open_api_yaml(configuration: &configuration::Configuration, ) -> Result<String, Error<GetOpenApiYamlError>> {
138    let local_var_configuration = configuration;
139
140    let local_var_client = &local_var_configuration.client;
141
142    let local_var_uri_str = format!("{}/openapi.yaml", local_var_configuration.base_path);
143    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
144
145    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
146        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
147    }
148    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
149        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
150    };
151
152    let local_var_req = local_var_req_builder.build()?;
153    let local_var_resp = local_var_client.execute(local_var_req).await?;
154
155    let local_var_status = local_var_resp.status();
156    let local_var_content = local_var_resp.text().await?;
157
158    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
159        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
160    } else {
161        let local_var_entity: Option<GetOpenApiYamlError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
162        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
163        Err(Error::ResponseError(local_var_error))
164    }
165}
166