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

/// ComputerUseApprovalRequestKindResourceBrowserAuthentication : A registered form awaiting the application's response.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ComputerUseApprovalRequestKindResourceBrowserAuthentication {
    /// The type of the object. Always `browser_authentication`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Why the agent needs the user to sign in.
    #[serde(rename = "reason", deserialize_with = "Option::deserialize")]
    pub reason: Option<String>,
    /// The registered form or frame origin where values will be entered.
    #[serde(rename = "credential_origin", deserialize_with = "Option::deserialize")]
    pub credential_origin: Option<String>,
    /// Controls to render. All submitted values are sensitive.
    #[serde(rename = "fields")]
    pub fields: Vec<models::BrowserAuthenticationFieldResource>,
    /// Sign-in methods. Empty for a plain form.
    #[serde(rename = "options")]
    pub options: Vec<models::BrowserAuthenticationOptionResource>,
}

impl ComputerUseApprovalRequestKindResourceBrowserAuthentication {
    /// A registered form awaiting the application's response.
    pub fn new(
        r#type: Type,
        reason: Option<String>,
        credential_origin: Option<String>,
        fields: Vec<models::BrowserAuthenticationFieldResource>,
        options: Vec<models::BrowserAuthenticationOptionResource>,
    ) -> ComputerUseApprovalRequestKindResourceBrowserAuthentication {
        ComputerUseApprovalRequestKindResourceBrowserAuthentication {
            r#type,
            reason,
            credential_origin,
            fields,
            options,
        }
    }
}
/// The type of the object. Always `browser_authentication`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "browser_authentication")]
    BrowserAuthentication,
}

impl Default for Type {
    fn default() -> Type {
        Self::BrowserAuthentication
    }
}

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