pub struct LastFmEditClientImpl { /* private fields */ }Implementations§
Source§impl LastFmEditClientImpl
impl LastFmEditClientImpl
pub fn from_session( client: Box<dyn HttpClient + Send + Sync>, session: LastFmEditSession, ) -> Self
pub fn from_session_with_rate_limit_patterns( client: Box<dyn HttpClient + Send + Sync>, session: LastFmEditSession, rate_limit_patterns: Vec<String>, ) -> Self
pub async fn login_with_credentials( client: Box<dyn HttpClient + Send + Sync>, username: &str, password: &str, ) -> Result<Self>
pub fn from_session_with_client_config( client: Box<dyn HttpClient + Send + Sync>, session: LastFmEditSession, config: ClientConfig, ) -> Self
pub async fn login_with_credentials_and_client_config( client: Box<dyn HttpClient + Send + Sync>, username: &str, password: &str, config: ClientConfig, ) -> Result<Self>
pub fn from_session_with_config( client: Box<dyn HttpClient + Send + Sync>, session: LastFmEditSession, retry_config: RetryConfig, rate_limit_config: RateLimitConfig, ) -> Self
pub async fn login_with_credentials_and_config( client: Box<dyn HttpClient + Send + Sync>, username: &str, password: &str, retry_config: RetryConfig, rate_limit_config: RateLimitConfig, ) -> Result<Self>
pub fn get_session(&self) -> LastFmEditSession
pub fn cancel(&self)
pub fn reset_cancel(&self)
pub fn is_cancelled(&self) -> bool
Sourcepub fn non_blocking(&self) -> Self
pub fn non_blocking(&self) -> Self
Get a non-blocking clone of this client that returns errors instead of sleeping when rate limited.
The returned client shares this client’s HTTP client, session, event broadcaster, and
cancellation state (all Arc/channel-shared on plain clone()); only its
ClientConfig::rate_limit_behavior differs, set to RateLimitBehavior::ReturnError.
Any events it emits (including RateLimited) are visible to subscribers of the
original client, and both clients report the same rate_limit_state.
§Intended usage: caller-managed queues
Instead of the client parking internally with backoff sleeps, operations on the
non-blocking clone fail fast with LastFmError::RateLimit. A caller building its own
work queue can:
- Attempt an operation; on
Err(LastFmError::RateLimit { .. }), requeue it. - Watch
watch_rate_limit_statefor theRateLimitState::RateLimited“paused until T” estimate. - Schedule its own retry once the state returns to
RateLimitState::Ready(oruntil_estimatepasses).
pub fn username(&self) -> String
pub async fn validate_session(&self) -> bool
pub async fn delete_scrobble( &self, artist_name: &str, track_name: &str, timestamp: u64, ) -> Result<bool>
pub fn subscribe(&self) -> ClientEventReceiver
pub fn latest_event(&self) -> Option<ClientEvent>
Sourcepub fn rate_limit_state(&self) -> RateLimitState
pub fn rate_limit_state(&self) -> RateLimitState
Get the current rate-limit state snapshot.
Shared across all clones of this client (they share the same broadcaster), so a monitoring task can hold a clone and observe rate limiting caused by any of them.
Sourcepub fn watch_rate_limit_state(&self) -> RateLimitStateWatcher
pub fn watch_rate_limit_state(&self) -> RateLimitStateWatcher
Get a watch receiver tracking the rate-limit state. Await .changed() to react to
pause/resume transitions without polling.
pub async fn get_recent_scrobbles(&self, page: u32) -> Result<Vec<Track>>
pub async fn get_recent_tracks_page(&self, page: u32) -> Result<TrackPage>
pub async fn find_recent_scrobble_for_track( &self, track_name: &str, artist_name: &str, max_pages: u32, ) -> Result<Option<Track>>
pub async fn edit_scrobble(&self, edit: &ScrobbleEdit) -> Result<EditResponse>
pub async fn edit_scrobble_single( &self, exact_edit: &ExactScrobbleEdit, max_retries: u32, ) -> Result<EditResponse>
Sourcepub async fn load_edit_form_values_internal(
&self,
track_name: &str,
artist_name: &str,
) -> Result<Vec<ExactScrobbleEdit>>
👎Deprecated: use get_scrobble_edit_variations
pub async fn load_edit_form_values_internal( &self, track_name: &str, artist_name: &str, ) -> Result<Vec<ExactScrobbleEdit>>
use get_scrobble_edit_variations
Deprecated alias for get_scrobble_edit_variations.
Sourcepub async fn get_scrobble_edit_variations(
&self,
track_name: &str,
artist_name: &str,
) -> Result<Vec<ExactScrobbleEdit>>
pub async fn get_scrobble_edit_variations( &self, track_name: &str, artist_name: &str, ) -> Result<Vec<ExactScrobbleEdit>>
Discover every album variation of a track in the user’s library, fully populated from the scrobble edit forms on the track’s library page.
This scrapes /user/{user}/library/music/{artist}/_/{track} (following pagination up to
a few pages) and returns one ExactScrobbleEdit per unique
(album, album artist) combination, with all original fields — including the
authoritative album_artist_name_original — taken from the hidden form inputs.
pub async fn get_artist_tracks_page( &self, artist: &str, page: u32, ) -> Result<TrackPage>
pub fn extract_tracks_from_document( &self, document: &Html, artist: &str, album: Option<&str>, ) -> Result<Vec<Track>>
pub fn parse_tracks_page( &self, document: &Html, page_number: u32, artist: &str, album: Option<&str>, ) -> Result<TrackPage>
pub async fn get(&self, url: &str) -> Result<Response>
pub async fn get_artists_page(&self, page: u32) -> Result<ArtistPage>
pub async fn get_artist_albums_page( &self, artist: &str, page: u32, ) -> Result<AlbumPage>
pub async fn get_album_tracks_page( &self, album_name: &str, artist_name: &str, page: u32, ) -> Result<TrackPage>
pub async fn search_tracks_page( &self, query: &str, page: u32, ) -> Result<TrackPage>
pub async fn search_albums_page( &self, query: &str, page: u32, ) -> Result<AlbumPage>
pub async fn search_artists_page( &self, query: &str, page: u32, ) -> Result<ArtistPage>
Sourcepub fn api_client(&self) -> Option<LastFmApiClientImpl>
pub fn api_client(&self) -> Option<LastFmApiClientImpl>
Construct a standalone LastFmApiClientImpl from this edit client’s fields.
Returns None if no API key is configured.
Sourcepub fn inner_client(&self) -> Arc<dyn HttpClient + Send + Sync> ⓘ
pub fn inner_client(&self) -> Arc<dyn HttpClient + Send + Sync> ⓘ
Expose the inner HTTP client for advanced use cases like VCR cassette management
Trait Implementations§
Source§impl Clone for LastFmEditClientImpl
impl Clone for LastFmEditClientImpl
Source§fn clone(&self) -> LastFmEditClientImpl
fn clone(&self) -> LastFmEditClientImpl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more