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