Add ListenBrainz::import() method

Allows importing listens at a specified timestamp.
This commit is contained in:
Koen Bolhuis 2022-05-12 00:04:19 +02:00
parent b3868fa128
commit 3d156516c6
1 changed files with 12 additions and 0 deletions

View File

@ -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