Skip to main content

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.896.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 [`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_client_ip`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetClientIpError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_license_id`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetLicenseIdError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_open_api_yaml`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetOpenApiYamlError {
50    UnknownValue(serde_json::Value),
51}
52
53
54pub async fn backend_uptodate(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendUptodateError>> {
55    let local_var_configuration = configuration;
56
57    let local_var_client = &local_var_configuration.client;
58
59    let local_var_uri_str = format!("{}/uptodate", local_var_configuration.base_path);
60    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
61
62    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
63        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
64    }
65    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
66        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
67    };
68
69    let local_var_req = local_var_req_builder.build()?;
70    let local_var_resp = local_var_client.execute(local_var_req).await?;
71
72    let local_var_status = local_var_resp.status();
73    let local_var_content = local_var_resp.text().await?;
74
75    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
76        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
77    } else {
78        let local_var_entity: Option<BackendUptodateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
79        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
80        Err(Error::ResponseError(local_var_error))
81    }
82}
83
84/// The edition and version (e.g. `EE v1.893.0`) for an authenticated caller. Without credentials it answers 200 with the edition alone (`EE` or `CE`), so it stays usable as a liveness probe. 
85pub async fn backend_version(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendVersionError>> {
86    let local_var_configuration = configuration;
87
88    let local_var_client = &local_var_configuration.client;
89
90    let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
91    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
92
93    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
94        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
95    }
96    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
97        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
98    };
99
100    let local_var_req = local_var_req_builder.build()?;
101    let local_var_resp = local_var_client.execute(local_var_req).await?;
102
103    let local_var_status = local_var_resp.status();
104    let local_var_content = local_var_resp.text().await?;
105
106    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
107        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
108    } else {
109        let local_var_entity: Option<BackendVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
110        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
111        Err(Error::ResponseError(local_var_error))
112    }
113}
114
115/// The address of the client making the request, as token IP allowlists see it: forwarding headers are believed only from the proxies in TRUSTED_PROXIES, or, when it is unset, from loopback and the private ranges, never from Cloudflare. Behind a proxy that is not trusted, this is the proxy's address. Empty when the server cannot tell. 
116pub async fn get_client_ip(configuration: &configuration::Configuration, ) -> Result<String, Error<GetClientIpError>> {
117    let local_var_configuration = configuration;
118
119    let local_var_client = &local_var_configuration.client;
120
121    let local_var_uri_str = format!("{}/client_ip", local_var_configuration.base_path);
122    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
123
124    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
125        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
126    }
127
128    let local_var_req = local_var_req_builder.build()?;
129    let local_var_resp = local_var_client.execute(local_var_req).await?;
130
131    let local_var_status = local_var_resp.status();
132    let local_var_content = local_var_resp.text().await?;
133
134    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
135        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
136    } else {
137        let local_var_entity: Option<GetClientIpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
138        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
139        Err(Error::ResponseError(local_var_error))
140    }
141}
142
143pub async fn get_license_id(configuration: &configuration::Configuration, ) -> Result<String, Error<GetLicenseIdError>> {
144    let local_var_configuration = configuration;
145
146    let local_var_client = &local_var_configuration.client;
147
148    let local_var_uri_str = format!("{}/ee_license", local_var_configuration.base_path);
149    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
150
151    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
152        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
153    }
154    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
155        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
156    };
157
158    let local_var_req = local_var_req_builder.build()?;
159    let local_var_resp = local_var_client.execute(local_var_req).await?;
160
161    let local_var_status = local_var_resp.status();
162    let local_var_content = local_var_resp.text().await?;
163
164    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
165        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
166    } else {
167        let local_var_entity: Option<GetLicenseIdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
168        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
169        Err(Error::ResponseError(local_var_error))
170    }
171}
172
173pub async fn get_open_api_yaml(configuration: &configuration::Configuration, ) -> Result<String, Error<GetOpenApiYamlError>> {
174    let local_var_configuration = configuration;
175
176    let local_var_client = &local_var_configuration.client;
177
178    let local_var_uri_str = format!("{}/openapi.yaml", local_var_configuration.base_path);
179    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
180
181    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
182        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
183    }
184    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
185        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
186    };
187
188    let local_var_req = local_var_req_builder.build()?;
189    let local_var_resp = local_var_client.execute(local_var_req).await?;
190
191    let local_var_status = local_var_resp.status();
192    let local_var_content = local_var_resp.text().await?;
193
194    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
195        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
196    } else {
197        let local_var_entity: Option<GetOpenApiYamlError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
198        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
199        Err(Error::ResponseError(local_var_error))
200    }
201}
202