async_openai/
audit_logs.rs

1use serde::Serialize;
2
3use crate::{
4    config::Config, error::OpenAIError, types::admin::audit_logs::ListAuditLogsResponse, Client,
5};
6
7/// Logs of user actions and configuration changes within this organization.
8/// To log events, you must activate logging in the [Organization Settings](https://platform.openai.com/settings/organization/general).
9/// Once activated, for security reasons, logging cannot be deactivated.
10pub struct AuditLogs<'c, C: Config> {
11    client: &'c Client<C>,
12}
13
14impl<'c, C: Config> AuditLogs<'c, C> {
15    pub fn new(client: &'c Client<C>) -> Self {
16        Self { client }
17    }
18
19    /// List user actions and configuration changes within this organization.
20    #[crate::byot(T0 = serde::Serialize, R = serde::de::DeserializeOwned)]
21    pub async fn get<Q>(&self, query: &Q) -> Result<ListAuditLogsResponse, OpenAIError>
22    where
23        Q: Serialize + ?Sized,
24    {
25        self.client
26            .get_with_query("/organization/audit_logs", &query)
27            .await
28    }
29}