dynamo_async_openai/types/
projects.rs

1// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Based on https://github.com/64bit/async-openai/ by Himanshu Neema
5// Original Copyright (c) 2022 Himanshu Neema
6// Licensed under MIT License (see ATTRIBUTIONS-Rust.md)
7//
8// Modifications Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
9// Licensed under Apache 2.0
10
11use crate::types::OpenAIError;
12use derive_builder::Builder;
13use serde::{Deserialize, Serialize};
14
15/// `active` or `archived`
16#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
17#[serde(rename_all = "lowercase")]
18pub enum ProjectStatus {
19    Active,
20    Archived,
21}
22
23/// Represents an individual project.
24#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
25pub struct Project {
26    /// The identifier, which can be referenced in API endpoints
27    pub id: String,
28    /// The object type, which is always `organization.project`
29    pub object: String,
30    /// The name of the project. This appears in reporting.
31    pub name: String,
32    /// The Unix timestamp (in seconds) of when the project was created.
33    pub created_at: u32,
34    /// The Unix timestamp (in seconds) of when the project was archived or `null`.
35    pub archived_at: Option<u32>,
36    /// `active` or `archived`
37    pub status: ProjectStatus,
38}
39
40/// A list of Project objects.
41#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
42pub struct ProjectListResponse {
43    pub object: String,
44    pub data: Vec<Project>,
45    pub first_id: String,
46    pub last_id: String,
47    pub has_more: String,
48}
49
50/// The project create request payload.
51#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
52#[builder(name = "ProjectCreateRequestArgs")]
53#[builder(pattern = "mutable")]
54#[builder(setter(into, strip_option))]
55#[builder(derive(Debug))]
56#[builder(build_fn(error = "OpenAIError"))]
57pub struct ProjectCreateRequest {
58    /// The friendly name of the project, this name appears in reports.
59    pub name: String,
60}
61
62/// The project update request payload.
63#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
64#[builder(name = "ProjectUpdateRequestArgs")]
65#[builder(pattern = "mutable")]
66#[builder(setter(into, strip_option))]
67#[builder(derive(Debug))]
68#[builder(build_fn(error = "OpenAIError"))]
69pub struct ProjectUpdateRequest {
70    /// The updated name of the project, this name appears in reports.
71    pub name: String,
72}