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

/// VectorStoreFileContentResponse : Represents the parsed content of a vector store file.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct VectorStoreFileContentResponse {
    /// The object type, which is always `vector_store.file_content.page`
    #[serde(rename = "object")]
    pub object: Object,
    /// Parsed content of the file.
    #[serde(rename = "data")]
    pub data: Vec<models::VectorStoreFileContentResponseDataInner>,
    /// Indicates if there are more content pages to fetch.
    #[serde(rename = "has_more")]
    pub has_more: bool,
    /// The token for the next page, if any.
    #[serde(rename = "next_page", deserialize_with = "Option::deserialize")]
    pub next_page: Option<String>,
}

impl VectorStoreFileContentResponse {
    /// Represents the parsed content of a vector store file.
    pub fn new(
        object: Object,
        data: Vec<models::VectorStoreFileContentResponseDataInner>,
        has_more: bool,
        next_page: Option<String>,
    ) -> VectorStoreFileContentResponse {
        VectorStoreFileContentResponse {
            object,
            data,
            has_more,
            next_page,
        }
    }
}
/// The object type, which is always `vector_store.file_content.page`
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "vector_store.file_content.page")]
    VectorStoreFileContentPage,
}

impl Default for Object {
    fn default() -> Object {
        Self::VectorStoreFileContentPage
    }
}

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