listenbrainz-rs/src/models/request.rs

48 lines
914 B
Rust
Raw Normal View History

2021-01-09 03:36:14 +00:00
use std::collections::HashMap;
use serde::Serialize;
// --------- submit-listens
#[derive(Debug, Serialize)]
2021-01-09 16:03:03 +00:00
pub struct SubmitListens<'a> {
2021-01-09 03:36:14 +00:00
pub listen_type: ListenType,
pub payload: Vec<Payload<'a>>,
}
#[derive(Debug, Serialize)]
pub enum ListenType {
Single,
PlayingNow,
Import,
}
#[derive(Debug, Serialize)]
pub struct Payload<'a> {
pub listened_at: i64,
pub track_metadata: TrackMetadata<'a>,
2021-01-09 03:36:14 +00:00
}
#[derive(Debug, Serialize)]
pub struct TrackMetadata<'a> {
pub artist_name: &'a str,
pub track_name: &'a str,
pub release_name: Option<&'a str>,
pub additional_info: Option<HashMap<&'a str, &'a str>>,
}
// --------- delete-listen
#[derive(Debug, Serialize)]
pub struct DeleteListen<'a> {
pub listened_at: i64,
pub recording_msid: &'a str,
}
// --------- latest-import (POST)
#[derive(Debug, Serialize)]
pub struct UpdateLatestImport {
pub ts: i64,
}