async_openai/types/
invites.rs

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