60 lines
1.1 KiB
Rust
60 lines
1.1 KiB
Rust
use chrono::NaiveDateTime;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone)]
|
|
pub struct User {
|
|
pub id: i64,
|
|
pub username: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
#[serde(rename_all = "lowercase")]
|
|
pub enum DeviceType {
|
|
Desktop,
|
|
Laptop,
|
|
Mobile,
|
|
Server,
|
|
Other,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct Device {
|
|
pub id: String,
|
|
pub caption: String,
|
|
pub r#type: DeviceType,
|
|
pub subscriptions: i64,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct DevicePatch {
|
|
pub caption: Option<String>,
|
|
pub r#type: Option<DeviceType>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
#[serde(rename_all = "lowercase")]
|
|
#[serde(tag = "action")]
|
|
pub enum EpisodeActionType {
|
|
Download,
|
|
Play {
|
|
#[serde(default)]
|
|
started: Option<i32>,
|
|
position: i32,
|
|
#[serde(default)]
|
|
total: Option<i32>,
|
|
},
|
|
Delete,
|
|
New,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct EpisodeAction {
|
|
pub podcast: String,
|
|
pub episode: String,
|
|
pub timestamp: Option<NaiveDateTime>,
|
|
#[serde(default)]
|
|
pub device: Option<String>,
|
|
#[serde(flatten)]
|
|
pub action: EpisodeActionType,
|
|
}
|