outfox_openai/spec/admin/project_api_keys/project_api_keys_.rs
1use serde::{Deserialize, Serialize};
2
3use crate::spec::admin::project_service_accounts::ProjectServiceAccount;
4use crate::spec::admin::project_users::ProjectUser;
5
6/// Represents an individual API key in a project.
7#[derive(Debug, Serialize, Deserialize)]
8pub struct ProjectApiKey {
9 /// The object type, which is always `organization.project.api_key`.
10 pub object: String,
11 /// The redacted value of the API key.
12 pub redacted_value: String,
13 /// The name of the API key.
14 pub name: String,
15 /// The Unix timestamp (in seconds) of when the API key was created.
16 pub created_at: u64,
17 /// The identifier, which can be referenced in API endpoints.
18 pub id: String,
19 /// The owner of the API key.
20 pub owner: ProjectApiKeyOwner,
21}
22
23#[derive(Debug, Serialize, Deserialize)]
24#[serde(rename = "snake_case")]
25pub enum ProjectApiKeyOwnerType {
26 User,
27 ServiceAccount,
28}
29
30/// Represents the owner of a project API key.
31#[derive(Debug, Serialize, Deserialize)]
32pub struct ProjectApiKeyOwner {
33 /// The type of owner, which is either `user` or `service_account`.
34 pub kind: ProjectApiKeyOwnerType,
35 /// The user owner of the API key, if applicable.
36 pub user: Option<ProjectUser>,
37 /// The service account owner of the API key, if applicable.
38 pub service_account: Option<ProjectServiceAccount>,
39}
40
41/// Represents the response object for listing project API keys.
42#[derive(Debug, Serialize, Deserialize)]
43pub struct ProjectApiKeyListResponse {
44 /// The object type, which is always `list`.
45 pub object: String,
46 /// The list of project API keys.
47 pub data: Vec<ProjectApiKey>,
48 /// The ID of the first project API key in the list.
49 pub first_id: Option<String>,
50 /// The ID of the last project API key in the list.
51 pub last_id: Option<String>,
52 /// Indicates if there are more project API keys available.
53 pub has_more: bool,
54}
55
56/// Represents the response object for deleting a project API key.
57#[derive(Debug, Serialize, Deserialize)]
58pub struct ProjectApiKeyDeleteResponse {
59 /// The object type, which is always `organization.project.api_key.deleted`.
60 pub object: String,
61 /// The ID of the deleted API key.
62 pub id: String,
63 /// Indicates if the API key was successfully deleted.
64 pub deleted: bool,
65}