async_openai/
audit_logs.rs

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