async_openai/types/admin/
users.rs

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