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.888.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
84pub async fn backend_version(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendVersionError>> {
85    let local_var_configuration = configuration;
86
87    let local_var_client = &local_var_configuration.client;
88
89    let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
90    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
91
92    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
93        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
94    }
95    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
96        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
97    };
98
99    let local_var_req = local_var_req_builder.build()?;
100    let local_var_resp = local_var_client.execute(local_var_req).await?;
101
102    let local_var_status = local_var_resp.status();
103    let local_var_content = local_var_resp.text().await?;
104
105    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
106        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
107    } else {
108        let local_var_entity: Option<BackendVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
109        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
110        Err(Error::ResponseError(local_var_error))
111    }
112}
113
114/// The address of the client making the request, as Windmill resolves it for per-IP checks such as token IP allowlists: forwarding headers are believed only from the proxies in TRUSTED_PROXIES. Behind a proxy that is not listed, this is the proxy's address. Empty when the server cannot tell. 
115pub async fn get_client_ip(configuration: &configuration::Configuration, ) -> Result<String, Error<GetClientIpError>> {
116    let local_var_configuration = configuration;
117
118    let local_var_client = &local_var_configuration.client;
119
120    let local_var_uri_str = format!("{}/client_ip", local_var_configuration.base_path);
121    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
122
123    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
124        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
125    }
126
127    let local_var_req = local_var_req_builder.build()?;
128    let local_var_resp = local_var_client.execute(local_var_req).await?;
129
130    let local_var_status = local_var_resp.status();
131    let local_var_content = local_var_resp.text().await?;
132
133    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
134        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
135    } else {
136        let local_var_entity: Option<GetClientIpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
137        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
138        Err(Error::ResponseError(local_var_error))
139    }
140}
141
142pub async fn get_license_id(configuration: &configuration::Configuration, ) -> Result<String, Error<GetLicenseIdError>> {
143    let local_var_configuration = configuration;
144
145    let local_var_client = &local_var_configuration.client;
146
147    let local_var_uri_str = format!("{}/ee_license", local_var_configuration.base_path);
148    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
149
150    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
151        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
152    }
153    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
154        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
155    };
156
157    let local_var_req = local_var_req_builder.build()?;
158    let local_var_resp = local_var_client.execute(local_var_req).await?;
159
160    let local_var_status = local_var_resp.status();
161    let local_var_content = local_var_resp.text().await?;
162
163    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
164        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
165    } else {
166        let local_var_entity: Option<GetLicenseIdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
167        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
168        Err(Error::ResponseError(local_var_error))
169    }
170}
171
172pub async fn get_open_api_yaml(configuration: &configuration::Configuration, ) -> Result<String, Error<GetOpenApiYamlError>> {
173    let local_var_configuration = configuration;
174
175    let local_var_client = &local_var_configuration.client;
176
177    let local_var_uri_str = format!("{}/openapi.yaml", local_var_configuration.base_path);
178    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
179
180    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
181        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
182    }
183    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
184        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
185    };
186
187    let local_var_req = local_var_req_builder.build()?;
188    let local_var_resp = local_var_client.execute(local_var_req).await?;
189
190    let local_var_status = local_var_resp.status();
191    let local_var_content = local_var_resp.text().await?;
192
193    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
194        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
195    } else {
196        let local_var_entity: Option<GetOpenApiYamlError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
197        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
198        Err(Error::ResponseError(local_var_error))
199    }
200}
201