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