Skip to main content

bitwarden_api_identity/apis/
info_api.rs

1/*
2 * Bitwarden Identity
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use std::sync::Arc;
12
13use async_trait::async_trait;
14#[cfg(feature = "mockall")]
15use mockall::automock;
16use reqwest;
17use serde::{Deserialize, Serialize, de::Error as _};
18
19use super::{Error, configuration};
20use crate::{
21    apis::{AuthRequired, ContentType, ResponseContent},
22    models,
23};
24
25#[cfg_attr(feature = "mockall", automock)]
26#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
27#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
28pub trait InfoApi: Send + Sync {
29    /// GET /alive
30    async fn get_alive(&self) -> Result<String, Error<GetAliveError>>;
31
32    /// GET /version
33    async fn get_version(&self) -> Result<(), Error<GetVersionError>>;
34}
35
36pub struct InfoApiClient {
37    configuration: Arc<configuration::Configuration>,
38}
39
40impl InfoApiClient {
41    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
42        Self { configuration }
43    }
44}
45
46#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
47#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
48impl InfoApi for InfoApiClient {
49    async fn get_alive(&self) -> Result<String, Error<GetAliveError>> {
50        let local_var_configuration = &self.configuration;
51
52        let local_var_client = &local_var_configuration.client;
53
54        let local_var_uri_str = format!("{}/alive", local_var_configuration.base_path);
55        let mut local_var_req_builder =
56            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
57
58        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
59    }
60
61    async fn get_version(&self) -> Result<(), Error<GetVersionError>> {
62        let local_var_configuration = &self.configuration;
63
64        let local_var_client = &local_var_configuration.client;
65
66        let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
67        let mut local_var_req_builder =
68            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
69
70        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
71    }
72}
73
74/// struct for typed errors of method [`InfoApi::get_alive`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetAliveError {
78    UnknownValue(serde_json::Value),
79}
80/// struct for typed errors of method [`InfoApi::get_version`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum GetVersionError {
84    UnknownValue(serde_json::Value),
85}