53 lines
1.1 KiB
Rust
53 lines
1.1 KiB
Rust
use serde::Deserialize;
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub struct SubsonicResponseOuter<T> {
|
|
pub subsonic_response: SubsonicResponse<T>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[serde(rename_all = "kebab-case", tag = "status")]
|
|
pub enum SubsonicResponse<T> {
|
|
Ok {
|
|
#[serde(flatten)]
|
|
inner: T,
|
|
},
|
|
Failed {
|
|
error: Error,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct Error {
|
|
pub code: u32,
|
|
pub message: String,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RandomSongsOuter {
|
|
pub random_songs: RandomSongs,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct RandomSongs {
|
|
pub song: Vec<Child>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Child {
|
|
pub id: String,
|
|
pub title: String,
|
|
pub album: String,
|
|
pub artist: String,
|
|
pub track: Option<u32>,
|
|
pub year: Option<u32>,
|
|
pub starred: Option<chrono::DateTime<chrono::offset::Utc>>, // TODO: check which is best
|
|
// applicable
|
|
pub duration: u64,
|
|
//pub play_count: Option<u32>,
|
|
pub genre: Option<String>,
|
|
pub cover_art: String,
|
|
}
|