async_openai_alt/types/
projects.rs

1use crate::types::OpenAIError;
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5/// `active` or `archived`
6#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
7#[serde(rename_all = "lowercase")]
8pub enum ProjectStatus {
9    Active,
10    Archived,
11}
12
13/// Represents an individual project.
14#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
15pub struct Project {
16    /// The identifier, which can be referenced in API endpoints
17    pub id: String,
18    /// The object type, which is always `organization.project`
19    pub object: String,
20    /// The name of the project. This appears in reporting.
21    pub name: String,
22    /// The Unix timestamp (in seconds) of when the project was created.
23    pub created_at: u32,
24    /// The Unix timestamp (in seconds) of when the project was archived or `null`.
25    pub archived_at: Option<u32>,
26    /// `active` or `archived`
27    pub status: ProjectStatus,
28}
29
30/// A list of Project objects.
31#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
32pub struct ProjectListResponse {
33    pub object: String,
34    pub data: Vec<Project>,
35    pub first_id: String,
36    pub last_id: String,
37    pub has_more: String,
38}
39
40/// The project create request payload.
41#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
42#[builder(name = "ProjectCreateRequestArgs")]
43#[builder(pattern = "mutable")]
44#[builder(setter(into, strip_option))]
45#[builder(derive(Debug))]
46#[builder(build_fn(error = "OpenAIError"))]
47pub struct ProjectCreateRequest {
48    /// The friendly name of the project, this name appears in reports.
49    pub name: String,
50}
51
52/// The project update request payload.
53#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
54#[builder(name = "ProjectUpdateRequestArgs")]
55#[builder(pattern = "mutable")]
56#[builder(setter(into, strip_option))]
57#[builder(derive(Debug))]
58#[builder(build_fn(error = "OpenAIError"))]
59pub struct ProjectUpdateRequest {
60    /// The updated name of the project, this name appears in reports.
61    pub name: String,
62}