deepgram 0.9.2

Community Rust SDK for Deepgram's automated speech recognition APIs.
Documentation
//! Deepgram usage API response types.

use serde::{Deserialize, Serialize};
use uuid::Uuid;

/// Returned by [`Usage::list_requests`](super::Usage::list_requests).
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-all
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Requests {
    #[allow(missing_docs)]
    pub page: usize,

    #[allow(missing_docs)]
    pub limit: usize,

    #[allow(missing_docs)]
    pub requests: Vec<Request>,
}

/// Returned by [`Usage::get_request`](super::Usage::get_request).
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-get
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Request {
    #[allow(missing_docs)]
    pub request_id: Uuid,

    #[allow(missing_docs)]
    pub created: String,

    #[allow(missing_docs)]
    pub path: String,

    #[allow(missing_docs)]
    pub api_key_id: Uuid,

    #[allow(missing_docs)]
    pub response: Option<Response>,

    #[allow(missing_docs)]
    pub callback: Option<Callback>,
}

/// The response generated by the request.
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-get
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Response {
    #[allow(missing_docs)]
    pub details: Option<Details>,

    #[allow(missing_docs)]
    pub message: Option<String>,

    #[allow(missing_docs)]
    pub code: i16,

    #[allow(missing_docs)]
    pub completed: String,
}

/// Details about the request.
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-get
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Details {
    #[allow(missing_docs)]
    pub usd: Option<f64>,

    #[allow(missing_docs)]
    pub duration: f64,

    #[allow(missing_docs)]
    pub total_audio: f64,

    #[allow(missing_docs)]
    pub channels: usize,

    #[allow(missing_docs)]
    pub streams: usize,

    #[allow(missing_docs)]
    pub models: Vec<Uuid>,

    #[allow(missing_docs)]
    pub method: String,

    #[allow(missing_docs)]
    pub tags: Vec<String>,

    #[allow(missing_docs)]
    pub features: Vec<String>,

    #[allow(missing_docs)]
    pub config: Config,
}

/// Configuration used when running the request.
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-get
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Config {
    #[allow(missing_docs)]
    pub alternatives: Option<usize>,

    #[allow(missing_docs)]
    pub diarize: Option<bool>,

    #[allow(missing_docs)]
    pub keywords: Option<Vec<String>>,

    #[allow(missing_docs)]
    pub language: Option<String>,

    #[allow(missing_docs)]
    pub model: Option<String>,

    #[allow(missing_docs)]
    pub tier: Option<String>,

    #[allow(missing_docs)]
    pub multichannel: Option<bool>,

    #[allow(missing_docs)]
    pub ner: Option<bool>,

    #[allow(missing_docs)]
    pub numerals: Option<bool>,

    #[allow(missing_docs)]
    pub profanity_filter: Option<bool>,

    #[allow(missing_docs)]
    pub punctuate: Option<bool>,

    #[allow(missing_docs)]
    pub redact: Option<Vec<String>>,

    #[allow(missing_docs)]
    pub search: Option<Vec<String>>,

    #[allow(missing_docs)]
    pub utterances: Option<bool>,
}

/// Details about a callback request.
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-get
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Callback {
    #[allow(missing_docs)]
    pub attempts: usize,

    #[allow(missing_docs)]
    pub code: Option<i16>,

    #[allow(missing_docs)]
    pub completed: Option<String>,
}

/// Returned by [`Usage::get_usage`](super::Usage::get_usage).
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-summary
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct UsageSummary {
    #[allow(missing_docs)]
    pub start: String,

    #[allow(missing_docs)]
    pub end: String,

    #[allow(missing_docs)]
    pub resolution: Resolution,

    #[allow(missing_docs)]
    pub results: Vec<Result>,
}

/// The amount of time covered by each [`Result`].
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-summary
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Resolution {
    #[allow(missing_docs)]
    pub units: String,

    #[allow(missing_docs)]
    pub amount: usize,
}

/// A summary of the usage over a period of time.
///
/// The resolution of each result is defined in [`UsageSummary::resolution`].
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-summary
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Result {
    #[allow(missing_docs)]
    pub start: String,

    #[allow(missing_docs)]
    pub end: String,

    #[allow(missing_docs)]
    pub hours: f64,

    #[allow(missing_docs)]
    pub total_hours: f64,

    #[allow(missing_docs)]
    pub requests: usize,
}

/// Returned by [`Usage::get_fields`](super::Usage::get_fields).
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-fields
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Fields {
    #[allow(missing_docs)]
    pub tags: Vec<String>,

    #[allow(missing_docs)]
    pub models: Vec<ModelDetail>,

    #[allow(missing_docs)]
    pub processing_methods: Vec<String>,

    #[allow(missing_docs)]
    pub features: Vec<String>,
}

/// Details about the model used.
///
/// See the [Deepgram API Reference][api] for more info.
///
/// [api]: https://developers.deepgram.com/api-reference/#usage-fields
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ModelDetail {
    #[allow(missing_docs)]
    pub name: String,

    #[allow(missing_docs)]
    pub language: String,

    #[allow(missing_docs)]
    pub version: String,

    #[allow(missing_docs)]
    pub model_id: Uuid,
}