langgraph-api 0.1.1

Rust Client API of LangGraph
Documentation
/*
 * LangSmith Deployment
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CronCreate : Payload for creating a stateless cron job (creates a new thread for each execution).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CronCreate {
    /// The cron schedule to execute this job on.
    #[serde(rename = "schedule")]
    pub schedule: String,
    /// The end date to stop running the cron.
    #[serde(rename = "end_time", skip_serializing_if = "Option::is_none")]
    pub end_time: Option<String>,
    #[serde(rename = "assistant_id")]
    pub assistant_id: Box<models::CronCreateAssistantId>,
    #[serde(rename = "input", skip_serializing_if = "Option::is_none")]
    pub input: Option<Box<models::Input>>,
    /// Metadata to assign to the cron job runs.
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
    #[serde(rename = "config", skip_serializing_if = "Option::is_none")]
    pub config: Option<Box<models::Config2>>,
    /// Static context added to the assistant.
    #[serde(rename = "context", skip_serializing_if = "Option::is_none")]
    pub context: Option<serde_json::Value>,
    /// Webhook to call after LangGraph API call is done.
    #[serde(rename = "webhook", skip_serializing_if = "Option::is_none")]
    pub webhook: Option<String>,
    #[serde(rename = "interrupt_before", skip_serializing_if = "Option::is_none")]
    pub interrupt_before: Option<Box<models::InterruptBefore>>,
    #[serde(rename = "interrupt_after", skip_serializing_if = "Option::is_none")]
    pub interrupt_after: Option<Box<models::InterruptAfter>>,
    /// What to do with the thread after the run completes. 'delete' removes the thread after execution. 'keep' creates a new thread for each execution but does not clean them up.
    #[serde(rename = "on_run_completed", skip_serializing_if = "Option::is_none")]
    pub on_run_completed: Option<OnRunCompleted>,
}

impl CronCreate {
    /// Payload for creating a stateless cron job (creates a new thread for each execution).
    pub fn new(schedule: String, assistant_id: models::CronCreateAssistantId) -> CronCreate {
        CronCreate {
            schedule,
            end_time: None,
            assistant_id: Box::new(assistant_id),
            input: None,
            metadata: None,
            config: None,
            context: None,
            webhook: None,
            interrupt_before: None,
            interrupt_after: None,
            on_run_completed: None,
        }
    }
}
/// What to do with the thread after the run completes. 'delete' removes the thread after execution. 'keep' creates a new thread for each execution but does not clean them up.
#[derive(
    Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
pub enum OnRunCompleted {
    #[serde(rename = "delete")]
    #[default]
    Delete,
    #[serde(rename = "keep")]
    Keep,
}