use super::{common, models::GatewayAuditLogsResponse};
use crate::{Client, RawRequest, RequestOptions, Result, validation::NativeDate};
#[derive(Clone, Copy)]
#[non_exhaustive]
pub struct AIGatewayAuditLogListOptions {
pub start: NativeDate,
pub end: NativeDate,
}
impl AIGatewayAuditLogListOptions {
pub fn new(start: NativeDate, end: NativeDate) -> Self {
Self { start, end }
}
}
crate::redaction::redacted_debug!(AIGatewayAuditLogListOptions);
#[derive(Clone, Debug)]
pub struct AIGatewayAuditLogsClient {
pub(super) client: Client,
}
impl AIGatewayAuditLogsClient {
pub fn new(client: Client) -> Result<Self> {
Ok(Self {
client: common::oauth(client)?,
})
}
pub async fn list(
&self,
query: &AIGatewayAuditLogListOptions,
options: Option<&RequestOptions>,
) -> Result<GatewayAuditLogsResponse> {
let query = [
("start_time".into(), common::date_iso(&query.start)?),
("end_time".into(), common::date_iso(&query.end)?),
];
self.client
.send_contract(
RawRequest::read("/audit-logs")
.named("airs.gateway.audit_logs.list")
.query(query),
"GatewayAuditLogsResponseSchema",
options,
)
.await
}
}