cartesia 0.0.1

A Rust library for the Cartesia API.
Documentation
/*
 * Cartesia REST API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2024-06-10
 *
 * Generated by: https://openapi-generator.tech
 */

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

use serde_with::serde_as;

#[serde_as]
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct JsonChunkResponse {
    /// HTTP status code to allow for error handling. This is for errors encountered while streaming the response.
    #[serde(rename = "status_code", skip_serializing_if = "Option::is_none")]
    pub status_code: Option<StatusCode>,
    /// Whether the model has finished generating audio.
    #[serde(rename = "done", skip_serializing_if = "Option::is_none")]
    pub done: Option<bool>,
    /// Binary audio data encoded as base64. The underlying bytes will be in the requested output format.
    #[serde_as(as = "Option<serde_with::base64::Base64>")]
    #[serde(rename = "data", skip_serializing_if = "Option::is_none")]
    pub data: Option<Vec<u8>>,
    /// The time in milliseconds that the model took to generate this chunk of audio.
    #[serde(rename = "step_time", skip_serializing_if = "Option::is_none")]
    pub step_time: Option<i32>,
}

impl JsonChunkResponse {
    pub fn new() -> JsonChunkResponse {
        JsonChunkResponse {
            status_code: None,
            done: None,
            data: None,
            step_time: None,
        }
    }
}
/// HTTP status code to allow for error handling. This is for errors encountered while streaming the response.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StatusCode {
    #[serde(rename = "206")]
    Variant206,
}

impl Default for StatusCode {
    fn default() -> StatusCode {
        Self::Variant206
    }
}