bitwarden_api_api/apis/
secrets_manager_events_api.rs1use 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 SecretsManagerEventsApi: Send + Sync {
29 async fn get_service_account_events<'a>(
31 &self,
32 service_account_id: uuid::Uuid,
33 start: Option<String>,
34 end: Option<String>,
35 continuation_token: Option<&'a str>,
36 ) -> Result<models::EventResponseModelListResponseModel, Error<GetServiceAccountEventsError>>;
37}
38
39pub struct SecretsManagerEventsApiClient {
40 configuration: Arc<configuration::Configuration>,
41}
42
43impl SecretsManagerEventsApiClient {
44 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
45 Self { configuration }
46 }
47}
48
49#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
50#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
51impl SecretsManagerEventsApi for SecretsManagerEventsApiClient {
52 async fn get_service_account_events<'a>(
53 &self,
54 service_account_id: uuid::Uuid,
55 start: Option<String>,
56 end: Option<String>,
57 continuation_token: Option<&'a str>,
58 ) -> Result<models::EventResponseModelListResponseModel, Error<GetServiceAccountEventsError>>
59 {
60 let local_var_configuration = &self.configuration;
61
62 let local_var_client = &local_var_configuration.client;
63
64 let local_var_uri_str = format!(
65 "{}/sm/events/service-accounts/{serviceAccountId}",
66 local_var_configuration.base_path,
67 serviceAccountId = service_account_id
68 );
69 let mut local_var_req_builder =
70 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
71
72 if let Some(ref param_value) = start {
73 local_var_req_builder =
74 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
75 }
76 if let Some(ref param_value) = end {
77 local_var_req_builder =
78 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
79 }
80 if let Some(ref param_value) = continuation_token {
81 local_var_req_builder =
82 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
83 }
84 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
85
86 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
87 }
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum GetServiceAccountEventsError {
94 UnknownValue(serde_json::Value),
95}