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 BackendVersionError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetEntitlementsError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetLicenseIdError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetOpenApiYamlError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetWorkspaceEntitlementsError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ListWorkspaceFeaturesError {
64 UnknownValue(serde_json::Value),
65}
66
67
68pub async fn backend_version(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendVersionError>> {
69 let local_var_configuration = configuration;
70
71 let local_var_client = &local_var_configuration.client;
72
73 let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
74 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
75
76 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
77 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
78 }
79 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
80 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
81 };
82
83 let local_var_req = local_var_req_builder.build()?;
84 let local_var_resp = local_var_client.execute(local_var_req).await?;
85
86 let local_var_status = local_var_resp.status();
87 let local_var_content = local_var_resp.text().await?;
88
89 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
90 crate::from_str_patched(&local_var_content).map_err(Error::from)
91 } else {
92 let local_var_entity: Option<BackendVersionError> = crate::from_str_patched(&local_var_content).ok();
93 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
94 Err(Error::ResponseError(local_var_error))
95 }
96}
97
98pub async fn get_entitlements(configuration: &configuration::Configuration, ) -> Result<models::GetEntitlements200Response, Error<GetEntitlementsError>> {
99 let local_var_configuration = configuration;
100
101 let local_var_client = &local_var_configuration.client;
102
103 let local_var_uri_str = format!("{}/entitlements", local_var_configuration.base_path);
104 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
105
106 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
107 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
108 }
109 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
110 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
111 };
112
113 let local_var_req = local_var_req_builder.build()?;
114 let local_var_resp = local_var_client.execute(local_var_req).await?;
115
116 let local_var_status = local_var_resp.status();
117 let local_var_content = local_var_resp.text().await?;
118
119 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
120 crate::from_str_patched(&local_var_content).map_err(Error::from)
121 } else {
122 let local_var_entity: Option<GetEntitlementsError> = crate::from_str_patched(&local_var_content).ok();
123 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
124 Err(Error::ResponseError(local_var_error))
125 }
126}
127
128pub async fn get_license_id(configuration: &configuration::Configuration, ) -> Result<String, Error<GetLicenseIdError>> {
129 let local_var_configuration = configuration;
130
131 let local_var_client = &local_var_configuration.client;
132
133 let local_var_uri_str = format!("{}/ee_license", local_var_configuration.base_path);
134 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
135
136 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
137 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
138 }
139 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
140 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
141 };
142
143 let local_var_req = local_var_req_builder.build()?;
144 let local_var_resp = local_var_client.execute(local_var_req).await?;
145
146 let local_var_status = local_var_resp.status();
147 let local_var_content = local_var_resp.text().await?;
148
149 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
150 crate::from_str_patched(&local_var_content).map_err(Error::from)
151 } else {
152 let local_var_entity: Option<GetLicenseIdError> = crate::from_str_patched(&local_var_content).ok();
153 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
154 Err(Error::ResponseError(local_var_error))
155 }
156}
157
158pub async fn get_open_api_yaml(configuration: &configuration::Configuration, ) -> Result<String, Error<GetOpenApiYamlError>> {
159 let local_var_configuration = configuration;
160
161 let local_var_client = &local_var_configuration.client;
162
163 let local_var_uri_str = format!("{}/openapi.yaml", local_var_configuration.base_path);
164 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
165
166 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
167 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
168 }
169 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
170 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
171 };
172
173 let local_var_req = local_var_req_builder.build()?;
174 let local_var_resp = local_var_client.execute(local_var_req).await?;
175
176 let local_var_status = local_var_resp.status();
177 let local_var_content = local_var_resp.text().await?;
178
179 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
180 crate::from_str_patched(&local_var_content).map_err(Error::from)
181 } else {
182 let local_var_entity: Option<GetOpenApiYamlError> = crate::from_str_patched(&local_var_content).ok();
183 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
184 Err(Error::ResponseError(local_var_error))
185 }
186}
187
188pub async fn get_workspace_entitlements(configuration: &configuration::Configuration, workspace: &str) -> Result<models::WorkspaceEntitlements, Error<GetWorkspaceEntitlementsError>> {
190 let local_var_configuration = configuration;
191
192 let local_var_client = &local_var_configuration.client;
193
194 let local_var_uri_str = format!("{}/w/{workspace}/entitlements", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
195 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
196
197 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
198 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
199 }
200 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
201 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
202 };
203
204 let local_var_req = local_var_req_builder.build()?;
205 let local_var_resp = local_var_client.execute(local_var_req).await?;
206
207 let local_var_status = local_var_resp.status();
208 let local_var_content = local_var_resp.text().await?;
209
210 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
211 crate::from_str_patched(&local_var_content).map_err(Error::from)
212 } else {
213 let local_var_entity: Option<GetWorkspaceEntitlementsError> = crate::from_str_patched(&local_var_content).ok();
214 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
215 Err(Error::ResponseError(local_var_error))
216 }
217}
218
219pub async fn list_features(configuration: &configuration::Configuration, ) -> Result<models::FeatureCatalogResponse, Error<ListFeaturesError>> {
220 let local_var_configuration = configuration;
221
222 let local_var_client = &local_var_configuration.client;
223
224 let local_var_uri_str = format!("{}/features", local_var_configuration.base_path);
225 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
226
227 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
228 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
229 }
230
231 let local_var_req = local_var_req_builder.build()?;
232 let local_var_resp = local_var_client.execute(local_var_req).await?;
233
234 let local_var_status = local_var_resp.status();
235 let local_var_content = local_var_resp.text().await?;
236
237 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
238 crate::from_str_patched(&local_var_content).map_err(Error::from)
239 } else {
240 let local_var_entity: Option<ListFeaturesError> = crate::from_str_patched(&local_var_content).ok();
241 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
242 Err(Error::ResponseError(local_var_error))
243 }
244}
245
246pub async fn list_workspace_features(configuration: &configuration::Configuration, workspace: &str) -> Result<models::FeatureCatalogResponse, Error<ListWorkspaceFeaturesError>> {
248 let local_var_configuration = configuration;
249
250 let local_var_client = &local_var_configuration.client;
251
252 let local_var_uri_str = format!("{}/w/{workspace}/features", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
253 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
254
255 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
256 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
257 }
258 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
259 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
260 };
261
262 let local_var_req = local_var_req_builder.build()?;
263 let local_var_resp = local_var_client.execute(local_var_req).await?;
264
265 let local_var_status = local_var_resp.status();
266 let local_var_content = local_var_resp.text().await?;
267
268 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
269 crate::from_str_patched(&local_var_content).map_err(Error::from)
270 } else {
271 let local_var_entity: Option<ListWorkspaceFeaturesError> = crate::from_str_patched(&local_var_content).ok();
272 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
273 Err(Error::ResponseError(local_var_error))
274 }
275}
276