From 3d156516c6f13690112ac1506f279e62055b2d89 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Thu, 12 May 2022 00:04:19 +0200 Subject: [PATCH] Add ListenBrainz::import() method Allows importing listens at a specified timestamp. --- src/wrapper.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/wrapper.rs b/src/wrapper.rs index 4db387f..9d5be33 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -136,6 +136,18 @@ impl ListenBrainz { self.submit_listen(ListenType::Single, Some(now), artist, track, release) } + /// Submit a listened track with the given listen time, intended for importing + /// previously saved listens. This requires authentication. + /// + /// # Errors + /// + /// If not authenticated, returns [`Error::NotAuthenticated`]. + /// Otherwise, see the Errors section of [`Client`] for more info on + /// what errors might occur. + pub fn import(&self, artist: &str, track: &str, release: &str, timestamp: i64) -> Result<(), Error> { + self.submit_listen(ListenType::Import, Some(timestamp), artist, track, release) + } + /// Submit a currently playing track. This requires authentication. /// /// # Errors