openai-client-base 0.13.0

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// GroupResponse : Details about an organization group.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct GroupResponse {
    /// Identifier for the group.
    #[serde(rename = "id")]
    pub id: String,
    /// Display name of the group.
    #[serde(rename = "name")]
    pub name: String,
    /// Unix timestamp (in seconds) when the group was created.
    #[serde(rename = "created_at")]
    pub created_at: i32,
    /// Whether the group is managed through SCIM and controlled by your identity provider.
    #[serde(rename = "is_scim_managed")]
    pub is_scim_managed: bool,
    /// The type of the group.
    #[serde(rename = "group_type")]
    pub group_type: GroupType,
}

impl GroupResponse {
    /// Details about an organization group.
    pub fn new(
        id: String,
        name: String,
        created_at: i32,
        is_scim_managed: bool,
        group_type: GroupType,
    ) -> GroupResponse {
        GroupResponse {
            id,
            name,
            created_at,
            is_scim_managed,
            group_type,
        }
    }
}
/// The type of the group.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum GroupType {
    #[serde(rename = "group")]
    Group,
    #[serde(rename = "tenant_group")]
    TenantGroup,
}

impl Default for GroupType {
    fn default() -> GroupType {
        Self::Group
    }
}

impl std::fmt::Display for GroupResponse {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}