use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Response {
#[allow(missing_docs)]
pub metadata: ListenMetadata,
#[allow(missing_docs)]
pub results: ListenResults,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct CallbackResponse {
#[allow(missing_docs)]
pub request_id: Uuid,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ListenMetadata {
#[allow(missing_docs)]
pub request_id: Uuid,
#[allow(missing_docs)]
pub transaction_key: String,
#[allow(missing_docs)]
pub sha256: String,
#[allow(missing_docs)]
pub created: String,
#[allow(missing_docs)]
pub duration: f64,
#[allow(missing_docs)]
pub channels: usize,
#[allow(missing_docs)]
pub language: Option<String>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ListenResults {
#[allow(missing_docs)]
pub channels: Vec<ChannelResult>,
pub utterances: Option<Vec<Utterance>>,
#[allow(missing_docs)]
pub intents: Option<Intents>,
#[allow(missing_docs)]
pub sentiments: Option<Sentiments>,
#[allow(missing_docs)]
pub topics: Option<Topics>,
#[allow(missing_docs)]
pub summary: Option<Summary>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChannelResult {
pub search: Option<Vec<SearchResults>>,
#[allow(missing_docs)]
pub alternatives: Vec<ResultAlternative>,
pub detected_language: Option<String>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Utterance {
#[allow(missing_docs)]
pub start: f64,
#[allow(missing_docs)]
pub end: f64,
#[allow(missing_docs)]
pub confidence: f64,
#[allow(missing_docs)]
pub channel: usize,
#[allow(missing_docs)]
pub transcript: String,
#[allow(missing_docs)]
pub words: Vec<Word>,
pub speaker: Option<usize>,
#[allow(missing_docs)]
pub id: Uuid,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SearchResults {
#[allow(missing_docs)]
pub query: String,
#[allow(missing_docs)]
pub hits: Vec<Hit>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Sentence {
text: String,
start: f64,
end: f64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Paragraph {
sentences: Vec<Sentence>,
num_words: usize,
start: f64,
end: f64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Paragraphs {
transcript: String,
paragraphs: Vec<Paragraph>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Entity {
label: String,
value: String,
confidence: f64,
start_word: usize,
end_word: usize,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Intent {
intent: String,
confidence_score: f64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Segment {
text: String,
start_word: usize,
end_word: usize,
intents: Vec<Intent>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Intents {
segments: Vec<Segment>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct SentimentSegment {
text: String,
start_word: usize,
end_word: usize,
sentiment: String,
sentiment_score: f64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct SentimentAverage {
sentiment: String,
sentiment_score: f64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Sentiments {
segments: Vec<SentimentSegment>,
average: SentimentAverage,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct TopicDetail {
topic: String,
confidence_score: f64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct TopicSegment {
text: String,
start_word: usize,
end_word: usize,
topics: Vec<TopicDetail>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Topics {
segments: Vec<TopicSegment>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct Summary {
result: String,
short: String,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ResultAlternative {
#[allow(missing_docs)]
pub transcript: String,
#[allow(missing_docs)]
pub confidence: f64,
#[allow(missing_docs)]
pub words: Vec<Word>,
#[allow(missing_docs)]
pub paragraphs: Option<Paragraphs>,
#[allow(missing_docs)]
pub entities: Option<Vec<Entity>>,
#[allow(missing_docs)]
#[serde(default)]
pub languages: Vec<String>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Word {
#[allow(missing_docs)]
pub word: String,
#[allow(missing_docs)]
pub start: f64,
#[allow(missing_docs)]
pub end: f64,
#[allow(missing_docs)]
pub confidence: f64,
pub speaker: Option<usize>,
pub punctuated_word: Option<String>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Hit {
#[allow(missing_docs)]
pub confidence: f64,
#[allow(missing_docs)]
pub start: f64,
#[allow(missing_docs)]
pub end: f64,
#[allow(missing_docs)]
pub snippet: String,
}