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

/// PublicRoleListResource : Paginated list of roles available on an organization or project.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct PublicRoleListResource {
    /// Always `list`.
    #[serde(rename = "object")]
    pub object: Object,
    /// Roles returned in the current page.
    #[serde(rename = "data")]
    pub data: Vec<models::Role>,
    /// Whether more roles are available when paginating.
    #[serde(rename = "has_more")]
    pub has_more: bool,
    #[serde(rename = "next", deserialize_with = "Option::deserialize")]
    pub next: Option<String>,
}

impl PublicRoleListResource {
    /// Paginated list of roles available on an organization or project.
    pub fn new(
        object: Object,
        data: Vec<models::Role>,
        has_more: bool,
        next: Option<String>,
    ) -> PublicRoleListResource {
        PublicRoleListResource {
            object,
            data,
            has_more,
            next,
        }
    }
}
/// Always `list`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "list")]
    List,
}

impl Default for Object {
    fn default() -> Object {
        Self::List
    }
}

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