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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ProvenanceResource {
    #[serde(rename = "object")]
    pub object: models::ProvenanceCheckObject,
    /// The Unix timestamp, in seconds, when the provenance check was created.
    #[serde(rename = "created_at")]
    pub created_at: i32,
    /// The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID.
    #[serde(rename = "results")]
    pub results: Vec<models::ProvenanceResourceResultsInner>,
}

impl ProvenanceResource {
    pub fn new(
        object: models::ProvenanceCheckObject,
        created_at: i32,
        results: Vec<models::ProvenanceResourceResultsInner>,
    ) -> ProvenanceResource {
        ProvenanceResource {
            object,
            created_at,
            results,
        }
    }
}

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