openai-client-base 0.14.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};

/// AuditLogRoleBoundToResource : The details for events with this `type`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct AuditLogRoleBoundToResource {
    /// The ID of the resource the role was bound to. ChatGPT workspace connector resources use `<workspace_id>__<connector_id>`.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The ID of the role that was bound to the resource.
    #[serde(rename = "role_id", skip_serializing_if = "Option::is_none")]
    pub role_id: Option<String>,
    /// The ID of the resource the role was bound to.
    #[serde(rename = "resource_id", skip_serializing_if = "Option::is_none")]
    pub resource_id: Option<String>,
    /// The type of resource the role was bound to.
    #[serde(rename = "resource_type", skip_serializing_if = "Option::is_none")]
    pub resource_type: Option<String>,
    /// The permissions granted to the role for the resource.
    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
    pub permissions: Option<Vec<String>>,
    /// The workspace ID for a ChatGPT workspace connector resource.
    #[serde(rename = "workspace_id", skip_serializing_if = "Option::is_none")]
    pub workspace_id: Option<String>,
    /// The connector ID for a ChatGPT workspace connector resource.
    #[serde(rename = "connector_id", skip_serializing_if = "Option::is_none")]
    pub connector_id: Option<String>,
    /// The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
    #[serde(rename = "connector_name", skip_serializing_if = "Option::is_none")]
    pub connector_name: Option<String>,
    /// Whether the connector is enabled for the role.
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// The connector role mutation path that produced the event.
    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
}

impl AuditLogRoleBoundToResource {
    /// The details for events with this `type`.
    pub fn new() -> AuditLogRoleBoundToResource {
        AuditLogRoleBoundToResource {
            id: None,
            role_id: None,
            resource_id: None,
            resource_type: None,
            permissions: None,
            workspace_id: None,
            connector_id: None,
            connector_name: None,
            enabled: None,
            source: None,
        }
    }
}
/// The connector role mutation path that produced the event.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Source {
    #[serde(rename = "role_toggle")]
    RoleToggle,
    #[serde(rename = "role_connector_update")]
    RoleConnectorUpdate,
    #[serde(rename = "role_delete")]
    RoleDelete,
    #[serde(rename = "workspace_permissions")]
    WorkspacePermissions,
    #[serde(rename = "connector_publish")]
    ConnectorPublish,
}

impl Default for Source {
    fn default() -> Source {
        Self::RoleToggle
    }
}

impl std::fmt::Display for AuditLogRoleBoundToResource {
    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),
        }
    }
}