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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ProjectServiceAccountCreateRequest {
    /// The name of the service account being created.
    #[serde(rename = "name")]
    pub name: String,
    /// Create the service account without default roles or an API key.
    #[serde(
        rename = "create_service_account_only",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub create_service_account_only: Option<Option<bool>>,
    #[serde(
        rename = "expires_in_seconds",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub expires_in_seconds: Option<Option<i32>>,
}

impl ProjectServiceAccountCreateRequest {
    pub fn new(name: String) -> ProjectServiceAccountCreateRequest {
        ProjectServiceAccountCreateRequest {
            name,
            create_service_account_only: None,
            expires_in_seconds: None,
        }
    }
}

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