async_openai/types/
users.rs

1use crate::types::OpenAIError;
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5use super::OrganizationRole;
6
7/// Represents an individual `user` within an organization.
8#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
9pub struct User {
10    /// The object type, which is always `organization.user`
11    pub object: String,
12    /// The identifier, which can be referenced in API endpoints
13    pub id: String,
14    /// The name of the user
15    pub name: String,
16    /// The email address of the user
17    pub email: String,
18    /// `owner` or `reader`
19    pub role: OrganizationRole,
20    /// The Unix timestamp (in seconds) of when the users was added.
21    pub added_at: u32,
22}
23
24/// A list of `User` objects.
25#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
26pub struct UserListResponse {
27    pub object: String,
28    pub data: Vec<User>,
29    pub first_id: String,
30    pub last_id: String,
31    pub has_more: bool,
32}
33
34#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
35#[builder(name = "UserRoleUpdateRequestArgs")]
36#[builder(pattern = "mutable")]
37#[builder(setter(into, strip_option))]
38#[builder(derive(Debug))]
39#[builder(build_fn(error = "OpenAIError"))]
40pub struct UserRoleUpdateRequest {
41    /// `owner` or `reader`
42    pub role: OrganizationRole,
43}
44
45/// Confirmation of the deleted user
46#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
47pub struct UserDeleteResponse {
48    pub object: String,
49    pub id: String,
50    pub deleted: bool,
51}