Skip to main content

orvanta_api/apis/
settings_api.rs

1/*
2 * Orvanta 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.6.0
7 * Contact: contact@orvanta.cloud
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_version`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BackendVersionError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_entitlements`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetEntitlementsError {
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/// struct for typed errors of method [`list_features`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ListFeaturesError {
50    UnknownValue(serde_json::Value),
51}
52
53
54pub async fn backend_version(configuration: &configuration::Configuration, ) -> Result<String, Error<BackendVersionError>> {
55    let local_var_configuration = configuration;
56
57    let local_var_client = &local_var_configuration.client;
58
59    let local_var_uri_str = format!("{}/version", 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<BackendVersionError> = 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 get_entitlements(configuration: &configuration::Configuration, ) -> Result<models::GetEntitlements200Response, Error<GetEntitlementsError>> {
85    let local_var_configuration = configuration;
86
87    let local_var_client = &local_var_configuration.client;
88
89    let local_var_uri_str = format!("{}/entitlements", 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<GetEntitlementsError> = 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
114pub async fn get_license_id(configuration: &configuration::Configuration, ) -> Result<String, Error<GetLicenseIdError>> {
115    let local_var_configuration = configuration;
116
117    let local_var_client = &local_var_configuration.client;
118
119    let local_var_uri_str = format!("{}/ee_license", local_var_configuration.base_path);
120    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
121
122    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
123        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
124    }
125    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
126        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
127    };
128
129    let local_var_req = local_var_req_builder.build()?;
130    let local_var_resp = local_var_client.execute(local_var_req).await?;
131
132    let local_var_status = local_var_resp.status();
133    let local_var_content = local_var_resp.text().await?;
134
135    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
136        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
137    } else {
138        let local_var_entity: Option<GetLicenseIdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
139        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
140        Err(Error::ResponseError(local_var_error))
141    }
142}
143
144pub async fn get_open_api_yaml(configuration: &configuration::Configuration, ) -> Result<String, Error<GetOpenApiYamlError>> {
145    let local_var_configuration = configuration;
146
147    let local_var_client = &local_var_configuration.client;
148
149    let local_var_uri_str = format!("{}/openapi.yaml", local_var_configuration.base_path);
150    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
151
152    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
153        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
154    }
155    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
156        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
157    };
158
159    let local_var_req = local_var_req_builder.build()?;
160    let local_var_resp = local_var_client.execute(local_var_req).await?;
161
162    let local_var_status = local_var_resp.status();
163    let local_var_content = local_var_resp.text().await?;
164
165    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
166        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
167    } else {
168        let local_var_entity: Option<GetOpenApiYamlError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
169        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
170        Err(Error::ResponseError(local_var_error))
171    }
172}
173
174pub async fn list_features(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<ListFeaturesError>> {
175    let local_var_configuration = configuration;
176
177    let local_var_client = &local_var_configuration.client;
178
179    let local_var_uri_str = format!("{}/features", local_var_configuration.base_path);
180    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
181
182    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
183        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184    }
185    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
186        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
187    };
188
189    let local_var_req = local_var_req_builder.build()?;
190    let local_var_resp = local_var_client.execute(local_var_req).await?;
191
192    let local_var_status = local_var_resp.status();
193    let local_var_content = local_var_resp.text().await?;
194
195    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
196        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
197    } else {
198        let local_var_entity: Option<ListFeaturesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
199        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
200        Err(Error::ResponseError(local_var_error))
201    }
202}
203