orvanta_api/apis/
settings_api.rs1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BackendUptodateError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum BackendVersionError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetEntitlementsError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetLicenseIdError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetOpenApiYamlError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ListFeaturesError {
57 UnknownValue(serde_json::Value),
58}
59
60
61pub async fn backend_uptodate(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendUptodateError>> {
62 let local_var_configuration = configuration;
63
64 let local_var_client = &local_var_configuration.client;
65
66 let local_var_uri_str = format!("{}/uptodate", local_var_configuration.base_path);
67 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
68
69 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
70 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
71 }
72 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
73 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
74 };
75
76 let local_var_req = local_var_req_builder.build()?;
77 let local_var_resp = local_var_client.execute(local_var_req).await?;
78
79 let local_var_status = local_var_resp.status();
80 let local_var_content = local_var_resp.text().await?;
81
82 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
83 crate::from_str_patched(&local_var_content).map_err(Error::from)
84 } else {
85 let local_var_entity: Option<BackendUptodateError> = crate::from_str_patched(&local_var_content).ok();
86 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
87 Err(Error::ResponseError(local_var_error))
88 }
89}
90
91pub async fn backend_version(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendVersionError>> {
92 let local_var_configuration = configuration;
93
94 let local_var_client = &local_var_configuration.client;
95
96 let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
97 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
98
99 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
100 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
101 }
102 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
103 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
104 };
105
106 let local_var_req = local_var_req_builder.build()?;
107 let local_var_resp = local_var_client.execute(local_var_req).await?;
108
109 let local_var_status = local_var_resp.status();
110 let local_var_content = local_var_resp.text().await?;
111
112 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
113 crate::from_str_patched(&local_var_content).map_err(Error::from)
114 } else {
115 let local_var_entity: Option<BackendVersionError> = crate::from_str_patched(&local_var_content).ok();
116 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
117 Err(Error::ResponseError(local_var_error))
118 }
119}
120
121pub async fn get_entitlements(configuration: &configuration::Configuration, ) -> Result<models::GetEntitlements200Response, Error<GetEntitlementsError>> {
122 let local_var_configuration = configuration;
123
124 let local_var_client = &local_var_configuration.client;
125
126 let local_var_uri_str = format!("{}/entitlements", local_var_configuration.base_path);
127 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
128
129 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
130 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
131 }
132 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
133 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
134 };
135
136 let local_var_req = local_var_req_builder.build()?;
137 let local_var_resp = local_var_client.execute(local_var_req).await?;
138
139 let local_var_status = local_var_resp.status();
140 let local_var_content = local_var_resp.text().await?;
141
142 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
143 crate::from_str_patched(&local_var_content).map_err(Error::from)
144 } else {
145 let local_var_entity: Option<GetEntitlementsError> = crate::from_str_patched(&local_var_content).ok();
146 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
147 Err(Error::ResponseError(local_var_error))
148 }
149}
150
151pub async fn get_license_id(configuration: &configuration::Configuration, ) -> Result<String, Error<GetLicenseIdError>> {
152 let local_var_configuration = configuration;
153
154 let local_var_client = &local_var_configuration.client;
155
156 let local_var_uri_str = format!("{}/ee_license", local_var_configuration.base_path);
157 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
158
159 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
160 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
161 }
162 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
163 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
164 };
165
166 let local_var_req = local_var_req_builder.build()?;
167 let local_var_resp = local_var_client.execute(local_var_req).await?;
168
169 let local_var_status = local_var_resp.status();
170 let local_var_content = local_var_resp.text().await?;
171
172 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
173 crate::from_str_patched(&local_var_content).map_err(Error::from)
174 } else {
175 let local_var_entity: Option<GetLicenseIdError> = crate::from_str_patched(&local_var_content).ok();
176 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
177 Err(Error::ResponseError(local_var_error))
178 }
179}
180
181pub async fn get_open_api_yaml(configuration: &configuration::Configuration, ) -> Result<String, Error<GetOpenApiYamlError>> {
182 let local_var_configuration = configuration;
183
184 let local_var_client = &local_var_configuration.client;
185
186 let local_var_uri_str = format!("{}/openapi.yaml", local_var_configuration.base_path);
187 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
188
189 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
190 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
191 }
192 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
193 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
194 };
195
196 let local_var_req = local_var_req_builder.build()?;
197 let local_var_resp = local_var_client.execute(local_var_req).await?;
198
199 let local_var_status = local_var_resp.status();
200 let local_var_content = local_var_resp.text().await?;
201
202 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
203 crate::from_str_patched(&local_var_content).map_err(Error::from)
204 } else {
205 let local_var_entity: Option<GetOpenApiYamlError> = crate::from_str_patched(&local_var_content).ok();
206 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
207 Err(Error::ResponseError(local_var_error))
208 }
209}
210
211pub async fn list_features(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<ListFeaturesError>> {
212 let local_var_configuration = configuration;
213
214 let local_var_client = &local_var_configuration.client;
215
216 let local_var_uri_str = format!("{}/features", local_var_configuration.base_path);
217 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
218
219 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
220 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
221 }
222 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
223 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
224 };
225
226 let local_var_req = local_var_req_builder.build()?;
227 let local_var_resp = local_var_client.execute(local_var_req).await?;
228
229 let local_var_status = local_var_resp.status();
230 let local_var_content = local_var_resp.text().await?;
231
232 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
233 crate::from_str_patched(&local_var_content).map_err(Error::from)
234 } else {
235 let local_var_entity: Option<ListFeaturesError> = crate::from_str_patched(&local_var_content).ok();
236 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
237 Err(Error::ResponseError(local_var_error))
238 }
239}
240