async_openai/
audit_logs.rs

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