btfm_api_structs/
clip.rs

1use chrono::NaiveDateTime;
2use serde::{Deserialize, Serialize};
3
4use crate::Phrases;
5
6#[derive(Clone, Debug, Serialize, Deserialize)]
7pub struct Clip {
8    /// The unique identifier for the clip and primary key for the table.
9    pub ulid: ulid::Ulid,
10    /// The time when the clip was added to the database.
11    pub created_on: NaiveDateTime,
12    /// The last time the clip was played; this is equal to `created_on` when created.
13    pub last_played: NaiveDateTime,
14    /// Number of times the clip has been played.
15    pub plays: i64,
16    /// The output of speech-to-text on the `audio_file`, optionally used as a matching phrase.
17    pub speech_detected: String,
18    /// A description of the clip for human consumption.
19    pub description: String,
20    /// Path to the audio file, relative to the BTFM_DATA_DIR.
21    pub audio_file: String,
22    /// Phrases associated with the clip.
23    pub phrases: Option<Phrases>,
24}
25
26#[derive(Debug, Deserialize, Serialize)]
27pub struct Clips {
28    pub items: u64,
29    pub clips: Vec<Clip>,
30}
31
32#[derive(Debug, Deserialize, Serialize)]
33pub struct ClipUpload {
34    pub description: String,
35    pub phrases: Option<Vec<String>>,
36}
37
38#[derive(Clone, Debug, Deserialize, Serialize)]
39pub struct ClipUpdated {
40    /// The new clip.
41    pub new_clip: Clip,
42    /// The old clip.
43    pub old_clip: Clip,
44}