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