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

/// CreateSubagentCallItemResource : A request to spawn a subagent.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateSubagentCallItemResource {
    /// The item type. Always `create_subagent_call`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The ID of the tool call item.
    #[serde(rename = "id")]
    pub id: String,
    /// The ID of the turn that contains this item.
    #[serde(rename = "turn_id")]
    pub turn_id: String,
    #[serde(rename = "status")]
    pub status: models::FunctionCallStatusResource,
    /// The ID of the agent that requested the subagent.
    #[serde(rename = "agent_id")]
    pub agent_id: String,
    /// The task given to the spawned agent.
    #[serde(rename = "content")]
    pub content: Vec<models::AgentContentResource>,
    /// The model requested for the spawned agent.
    #[serde(rename = "model", deserialize_with = "Option::deserialize")]
    pub model: Option<String>,
    /// The reasoning effort requested for the spawned agent.
    #[serde(rename = "reasoning_effort", deserialize_with = "Option::deserialize")]
    pub reasoning_effort: Option<String>,
}

impl CreateSubagentCallItemResource {
    /// A request to spawn a subagent.
    pub fn new(
        r#type: Type,
        id: String,
        turn_id: String,
        status: models::FunctionCallStatusResource,
        agent_id: String,
        content: Vec<models::AgentContentResource>,
        model: Option<String>,
        reasoning_effort: Option<String>,
    ) -> CreateSubagentCallItemResource {
        CreateSubagentCallItemResource {
            r#type,
            id,
            turn_id,
            status,
            agent_id,
            content,
            model,
            reasoning_effort,
        }
    }
}
/// The item type. Always `create_subagent_call`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "create_subagent_call")]
    CreateSubagentCall,
}

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

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