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};

/// UpdateProjectServiceAccountBody : Parameters for updating a project service account.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct UpdateProjectServiceAccountBody {
    /// The updated service account name.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The updated service account role.
    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
    pub role: Option<Role>,
}

impl UpdateProjectServiceAccountBody {
    /// Parameters for updating a project service account.
    pub fn new() -> UpdateProjectServiceAccountBody {
        UpdateProjectServiceAccountBody {
            name: None,
            role: None,
        }
    }
}
/// The updated service account role.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Role {
    #[serde(rename = "member")]
    Member,
    #[serde(rename = "owner")]
    Owner,
}

impl Default for Role {
    fn default() -> Role {
        Self::Member
    }
}

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