async_openai/types/admin/
invites.rs

1use crate::types::OpenAIError;
2use crate::types::OrganizationRole;
3use derive_builder::Builder;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
7#[serde(rename_all = "lowercase")]
8pub enum InviteStatus {
9    Accepted,
10    Expired,
11    Pending,
12}
13
14#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder)]
15#[builder(name = "InviteRequestArgs")]
16#[builder(pattern = "mutable")]
17#[builder(setter(into, strip_option))]
18#[builder(derive(Debug))]
19#[builder(build_fn(error = "OpenAIError"))]
20pub struct InviteRequest {
21    pub email: String,
22    pub role: OrganizationRole,
23}
24
25#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
26pub struct InviteListResponse {
27    pub object: String,
28    pub data: Vec<Invite>,
29    pub first_id: Option<String>,
30    pub last_id: Option<String>,
31    pub has_more: Option<bool>,
32}
33
34#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
35pub struct InviteDeleteResponse {
36    /// The object type, which is always `organization.invite.deleted`
37    pub object: String,
38    pub id: String,
39    pub deleted: bool,
40}
41
42/// Represents an individual `invite` to the organization.
43#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
44pub struct Invite {
45    /// The object type, which is always `organization.invite`
46    pub object: String,
47    /// The identifier, which can be referenced in API endpoints
48    pub id: String,
49    /// The email address of the individual to whom the invite was sent
50    pub email: String,
51    /// `owner` or `reader`
52    pub role: OrganizationRole,
53    /// `accepted`, `expired`, or `pending`
54    pub status: InviteStatus,
55    /// The Unix timestamp (in seconds) of when the invite was sent.
56    pub invited_at: u64,
57    /// The Unix timestamp (in seconds) of when the invite expires.
58    pub expires_at: u64,
59    /// The Unix timestamp (in seconds) of when the invite was accepted.
60    pub accepted_at: Option<u64>,
61}