Skip to main content

async_openai/admin/
admin_.rs

1use crate::{
2    config::Config, AdminAPIKeys, AuditLogs, Certificates, Client, Groups, Invites,
3    OrganizationDataRetentions, OrganizationSpendAlerts, OrganizationSpendLimit, Projects, Roles,
4    Usage, Users,
5};
6
7/// Admin group for all administration APIs.
8/// This groups together admin API keys, invites, users, projects, audit logs, certificates, roles, and groups.
9pub struct Admin<'c, C: Config> {
10    client: &'c Client<C>,
11}
12
13impl<'c, C: Config> Admin<'c, C> {
14    pub(crate) fn new(client: &'c Client<C>) -> Self {
15        Self { client }
16    }
17
18    /// To call [AdminAPIKeys] group related APIs using this client.
19    pub fn api_keys(&self) -> AdminAPIKeys<'_, C> {
20        AdminAPIKeys::new(self.client)
21    }
22
23    /// To call [Invites] group related APIs using this client.
24    pub fn invites(&self) -> Invites<'_, C> {
25        Invites::new(self.client)
26    }
27
28    /// To call [Users] group related APIs using this client.
29    pub fn users(&self) -> Users<'_, C> {
30        Users::new(self.client)
31    }
32
33    /// To call [Projects] group related APIs using this client.
34    pub fn projects(&self) -> Projects<'_, C> {
35        Projects::new(self.client)
36    }
37
38    /// To call [AuditLogs] group related APIs using this client.
39    pub fn audit_logs(&self) -> AuditLogs<'_, C> {
40        AuditLogs::new(self.client)
41    }
42
43    /// To call [Certificates] group related APIs using this client.
44    pub fn certificates(&self) -> Certificates<'_, C> {
45        Certificates::new(self.client)
46    }
47
48    /// To call [Roles] group related APIs using this client.
49    pub fn roles(&self) -> Roles<'_, C> {
50        Roles::new(self.client)
51    }
52
53    /// To call [Groups] group related APIs using this client.
54    pub fn groups(&self) -> Groups<'_, C> {
55        Groups::new(self.client)
56    }
57
58    /// To call [Usage] group related APIs using this client.
59    pub fn usage(&self) -> Usage<'_, C> {
60        Usage::new(self.client)
61    }
62
63    /// Access data retention endpoints.
64    pub fn data_retention(&self) -> OrganizationDataRetentions<'_, C> {
65        OrganizationDataRetentions::new(self.client)
66    }
67
68    /// Access spend alerts endpoints.
69    pub fn spend_alerts(&self) -> OrganizationSpendAlerts<'_, C> {
70        OrganizationSpendAlerts::new(self.client)
71    }
72
73    /// Access spend limit endpoints.
74    pub fn spend_limit(&self) -> OrganizationSpendLimit<'_, C> {
75        OrganizationSpendLimit::new(self.client)
76    }
77}