audrey/src/subsonic/schema.rs

54 lines
1.1 KiB
Rust
Raw Normal View History

2024-11-01 08:29:59 +00:00
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,
}
2024-11-01 08:43:55 +00:00
#[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,
2024-11-01 12:55:47 +00:00
pub track: Option<u32>,
pub year: Option<u32>,
2024-11-01 18:33:10 +00:00
pub starred: Option<chrono::DateTime<chrono::offset::Utc>>, // TODO: check which is best
// applicable
2024-11-01 08:43:55 +00:00
pub duration: u64,
2024-11-03 19:00:46 +00:00
//pub play_count: Option<u32>,
2024-11-01 08:43:55 +00:00
pub genre: Option<String>,
pub cover_art: String,
}