diff --git a/.gitignore b/.gitignore index 96ef6c0..869df07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /target -Cargo.lock +Cargo.lock \ No newline at end of file diff --git a/examples/user_listens.rs b/examples/user_listens.rs index e1b166b..3748675 100644 --- a/examples/user_listens.rs +++ b/examples/user_listens.rs @@ -11,6 +11,6 @@ fn main() { let result = client.user_playing_now(&user_name); println!("Playing now: {:#?}", result); - let result = client.user_listens(&user_name, None, None, Some(5), None); + let result = client.user_listens(&user_name, None, None, Some(5)); println!("Recent listens: {:#?}", result); } diff --git a/src/raw/client.rs b/src/raw/client.rs index f705c7c..7b15954 100644 --- a/src/raw/client.rs +++ b/src/raw/client.rs @@ -141,14 +141,13 @@ impl Client { self.get(Endpoint::UserPlayingNow(user_name)) } - /// Endpoint: [`user/{user_name}/listens`](https://listenbrainz.readthedocs.io/en/production/dev/api/#get--1-user-(user_name)-listens) + /// Endpoint: [`user/{user_name}/listens`](https://listenbrainz.readthedocs.io/en/latest/users/api/core.html#get--1-user-(user_name)-listens) pub fn user_listens( &self, user_name: &str, min_ts: Option, max_ts: Option, count: Option, - time_range: Option, ) -> Result { let endpoint = format!("{}{}", self.api_root_url, Endpoint::UserListens(user_name)); @@ -163,9 +162,6 @@ impl Client { if let Some(count) = count { request = request.param("count", count); } - if let Some(time_range) = time_range { - request = request.param("time_range", time_range); - } let response = request.send()?; diff --git a/src/raw/response.rs b/src/raw/response.rs index 719b379..85267aa 100644 --- a/src/raw/response.rs +++ b/src/raw/response.rs @@ -207,6 +207,7 @@ response_type! { pub struct UserListensPayload { pub count: u64, pub latest_listen_ts: i64, + pub oldest_listen_ts: i64, pub user_id: String, pub listens: Vec, } @@ -228,6 +229,24 @@ pub struct UserListensTrackMetadata { pub track_name: String, pub release_name: Option, pub additional_info: HashMap, + pub mbid_mapping: Option, +} + +/// Type of the [`UserListensTrackMetadata::mbid_mapping`] field. +#[derive(Debug, Deserialize, Clone, PartialEq, Eq)] +pub struct UserListensMBIDMapping { + pub artist_mbids: Option>, + pub artists: Option>, + pub recording_mbid: String, + pub recording_name: Option, +} + +/// Type of the [`UserListensMBIDMapping::artists`] field. +#[derive(Debug, Deserialize, Clone, PartialEq, Eq)] +pub struct UserListensMappingArtist { + pub artist_mbid: String, + pub artist_credit_name: String, + pub join_phrase: String, } // --------- latest-import (GET)