async_openai/types/
project_users.rs

1use crate::types::OpenAIError;
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5/// Represents an individual user in a project.
6#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
7pub struct ProjectUser {
8    /// The object type, which is always `organization.project.user`
9    pub object: String,
10    /// The identifier, which can be referenced in API endpoints
11    pub id: String,
12    /// The name of the project
13    pub name: String,
14    /// The email address of the user
15    pub email: String,
16    /// `owner` or `member`
17    pub role: ProjectUserRole,
18    /// The Unix timestamp (in seconds) of when the project was added.
19    pub added_at: u32,
20}
21
22/// `owner` or `member`
23#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
24#[serde(rename_all = "lowercase")]
25pub enum ProjectUserRole {
26    Owner,
27    Member,
28}
29
30#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
31pub struct ProjectUserListResponse {
32    pub object: String,
33    pub data: Vec<ProjectUser>,
34    pub first_id: String,
35    pub last_id: String,
36    pub has_more: String,
37}
38
39/// The project user create request payload.
40#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
41#[builder(name = "ProjectUserCreateRequestArgs")]
42#[builder(pattern = "mutable")]
43#[builder(setter(into, strip_option))]
44#[builder(derive(Debug))]
45#[builder(build_fn(error = "OpenAIError"))]
46pub struct ProjectUserCreateRequest {
47    /// The ID of the user.
48    pub user_id: String,
49    /// `owner` or `member`
50    pub role: ProjectUserRole,
51}
52
53#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
54#[builder(name = "ProjectUserUpdateRequestArgs")]
55#[builder(pattern = "mutable")]
56#[builder(setter(into, strip_option))]
57#[builder(derive(Debug))]
58#[builder(build_fn(error = "OpenAIError"))]
59pub struct ProjectUserUpdateRequest {
60    /// `owner` or `member`
61    pub role: ProjectUserRole,
62}
63
64#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
65pub struct ProjectUserDeleteResponse {
66    pub object: String,
67    pub id: String,
68    pub deleted: bool,
69}