1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
use crate::iterator::AsyncPaginatedIterator;
use crate::types::{
Album, Artist, ArtistPage, ClientEvent, ClientEventReceiver, EditResponse, ExactScrobbleEdit,
LastFmEditSession, ScrobbleEdit, Track,
};
use crate::Result;
use async_trait::async_trait;
/// Low-level trait for individual Last.fm page fetches, search, and session management.
///
/// This trait abstracts single-request operations: fetching a page of data,
/// performing a search query, and managing session/cancellation state.
/// It serves as the foundation that higher-level traits like [`LastFmEditClient`]
/// build upon.
///
/// # Mocking Support
///
/// When the `mock` feature is enabled, this crate provides `MockLastFmBaseClient`
/// that implements this trait using the `mockall` library.
#[cfg_attr(feature = "mock", mockall::automock)]
#[async_trait(?Send)]
pub trait LastFmBaseClient {
// =============================================================================
// PAGE FETCHING - Single page data access
// =============================================================================
/// Get a page of artists from the user's library.
async fn get_artists_page(&self, page: u32) -> Result<ArtistPage>;
/// Get a page of tracks from the user's library for the specified artist.
async fn get_artist_tracks_page(&self, artist: &str, page: u32) -> Result<crate::TrackPage>;
/// Get a page of albums from the user's library for the specified artist.
async fn get_artist_albums_page(&self, artist: &str, page: u32) -> Result<crate::AlbumPage>;
/// Get a page of tracks from a specific album in the user's library.
async fn get_album_tracks_page(
&self,
album_name: &str,
artist_name: &str,
page: u32,
) -> Result<crate::TrackPage>;
/// Get a page of tracks from the user's recent listening history.
async fn get_recent_tracks_page(&self, page: u32) -> Result<crate::TrackPage>;
// =============================================================================
// SEARCH PAGES - Single page search results
// =============================================================================
/// Get a single page of track search results from the user's library.
///
/// This performs a search using Last.fm's library search functionality,
/// returning one page of tracks that match the provided query string.
/// For iterator-based access, use [`LastFmEditClient::search_tracks`] instead.
///
/// # Arguments
///
/// * `query` - The search query (e.g., "remaster", "live", artist name, etc.)
/// * `page` - The page number to retrieve (1-based)
///
/// # Returns
///
/// Returns a `TrackPage` containing the search results with pagination information.
async fn search_tracks_page(&self, query: &str, page: u32) -> Result<crate::TrackPage>;
/// Get a single page of album search results from the user's library.
///
/// This performs a search using Last.fm's library search functionality,
/// returning one page of albums that match the provided query string.
/// For iterator-based access, use [`LastFmEditClient::search_albums`] instead.
///
/// # Arguments
///
/// * `query` - The search query (e.g., "remaster", "deluxe", artist name, etc.)
/// * `page` - The page number to retrieve (1-based)
///
/// # Returns
///
/// Returns an `AlbumPage` containing the search results with pagination information.
async fn search_albums_page(&self, query: &str, page: u32) -> Result<crate::AlbumPage>;
/// Get a single page of artist search results from the user's library.
///
/// This performs a search using Last.fm's library search functionality,
/// returning one page of artists that match the provided query string.
/// For iterator-based access, use [`LastFmEditClient::search_artists`] instead.
///
/// # Arguments
///
/// * `query` - The search query (e.g., artist name, partial match, etc.)
/// * `page` - The page number to retrieve (1-based)
///
/// # Returns
///
/// Returns an `ArtistPage` containing the search results with pagination information.
async fn search_artists_page(&self, query: &str, page: u32) -> Result<crate::ArtistPage>;
// =============================================================================
// INFRASTRUCTURE - Session, events, and authentication
// =============================================================================
/// Get the currently authenticated username.
fn username(&self) -> String;
/// Extract the current session state for persistence.
///
/// This allows you to save the authentication state and restore it later
/// without requiring the user to log in again.
///
/// # Returns
///
/// Returns a [`LastFmEditSession`] that can be serialized and saved.
fn get_session(&self) -> LastFmEditSession;
/// Subscribe to internal client events.
///
/// Returns a broadcast receiver that can be used to listen to events like rate limiting.
/// Multiple subscribers can listen simultaneously.
///
/// # Example
/// ```rust,no_run
/// use lastfm_edit::{LastFmEditClientImpl, LastFmEditSession, ClientEvent};
///
/// let http_client = http_client::native::NativeClient::new();
/// let test_session = LastFmEditSession::new("test".to_string(), vec!["sessionid=.test123".to_string()], Some("csrf".to_string()), "https://www.last.fm".to_string());
/// let client = LastFmEditClientImpl::from_session(Box::new(http_client), test_session);
/// let mut events = client.subscribe();
///
/// // Listen for events in a background task
/// tokio::spawn(async move {
/// while let Ok(event) = events.recv().await {
/// match event {
/// ClientEvent::RequestStarted { request } => {
/// println!("Request started: {}", request.short_description());
/// }
/// ClientEvent::RequestCompleted { request, status_code, duration_ms } => {
/// println!("Request completed: {} - {} ({} ms)", request.short_description(), status_code, duration_ms);
/// }
/// ClientEvent::RateLimited { delay_seconds, .. } => {
/// println!("Rate limited! Waiting {} seconds", delay_seconds);
/// }
/// ClientEvent::RateLimitEnded { total_rate_limit_duration_seconds, .. } => {
/// println!("Rate limiting ended after {} seconds", total_rate_limit_duration_seconds);
/// }
/// ClientEvent::Delaying { delay_ms, reason, .. } => {
/// println!("Delaying ({reason:?}) for {delay_ms}ms");
/// }
/// ClientEvent::EditAttempted { edit, success, .. } => {
/// println!("Edit attempt: '{}' -> '{}' - {}",
/// edit.track_name_original, edit.track_name,
/// if success { "Success" } else { "Failed" });
/// }
/// _ => {}
/// }
/// }
/// });
/// ```
fn subscribe(&self) -> ClientEventReceiver;
/// Get the latest client event without subscribing to future events.
///
/// This returns the most recent event that occurred, or `None` if no events have occurred yet.
/// Unlike `subscribe()`, this provides instant access to the current state without waiting.
///
/// # Example
/// ```rust,no_run
/// use lastfm_edit::{LastFmEditClientImpl, LastFmEditSession, ClientEvent};
///
/// let http_client = http_client::native::NativeClient::new();
/// let test_session = LastFmEditSession::new("test".to_string(), vec!["sessionid=.test123".to_string()], Some("csrf".to_string()), "https://www.last.fm".to_string());
/// let client = LastFmEditClientImpl::from_session(Box::new(http_client), test_session);
///
/// if let Some(ClientEvent::RateLimited { delay_seconds, .. }) = client.latest_event() {
/// println!("Currently rate limited for {} seconds", delay_seconds);
/// }
/// ```
fn latest_event(&self) -> Option<ClientEvent>;
/// Validate if the current session is still working.
///
/// This method makes a test request to a protected Last.fm settings page to verify
/// that the current session is still valid. If the session has expired or become
/// invalid, Last.fm will redirect to the login page.
///
/// This is useful for checking session validity before attempting operations that
/// require authentication, especially after loading a previously saved session.
///
/// # Returns
///
/// Returns `true` if the session is valid and can be used for authenticated operations,
/// `false` if the session is invalid or expired.
async fn validate_session(&self) -> bool;
// =============================================================================
// READ HELPER
// =============================================================================
/// Find the most recent scrobble for a specific track.
async fn find_recent_scrobble_for_track(
&self,
track_name: &str,
artist_name: &str,
max_pages: u32,
) -> Result<Option<Track>>;
// =============================================================================
// CANCELLATION - Cooperative cancellation for long-running operations
// =============================================================================
/// Request cooperative cancellation of ongoing operations (best-effort).
///
/// Implementations should interrupt internal waits (retry backoff, operational delays)
/// and return `LastFmError::Io(ErrorKind::Interrupted)` where appropriate.
fn cancel(&self) {}
/// Clear the cancellation request so future operations can run again.
fn reset_cancel(&self) {}
/// Whether cancellation has been requested.
fn is_cancelled(&self) -> bool {
false
}
}
/// High-level trait for Last.fm client operations including iterators, discovery, and editing.
///
/// This trait builds on [`LastFmBaseClient`] to provide composite operations:
/// iterator factories for paginated browsing, scrobble discovery, and editing workflows.
///
/// # Mocking Support
///
/// When the `mock` feature is enabled, this crate provides `MockLastFmEditClient`
/// that implements this trait using the `mockall` library.
///
#[async_trait(?Send)]
pub trait LastFmEditClient: LastFmBaseClient {
// =============================================================================
// CORE EDITING METHODS - Most important functionality
// =============================================================================
/// Edit scrobbles by discovering and updating all matching instances.
///
/// This is the main editing method that automatically discovers all scrobble instances
/// that match the provided criteria and applies the specified changes to each one.
///
/// # How it works
///
/// 1. **Discovery**: Analyzes the `ScrobbleEdit` to determine what to search for:
/// - If `track_name_original` is specified: finds all album variations of that track
/// - If only `album_name_original` is specified: finds all tracks in that album
/// - If neither is specified: finds all tracks by that artist
///
/// 2. **Enrichment**: For each discovered scrobble, extracts complete metadata
/// including album artist information from the user's library
///
/// 3. **Editing**: Applies the requested changes to each discovered instance
///
/// # Arguments
///
/// * `edit` - A `ScrobbleEdit` specifying what to find and how to change it
///
/// # Returns
///
/// Returns an `EditResponse` containing results for all edited scrobbles, including:
/// - Overall success status
/// - Individual results for each scrobble instance
/// - Detailed error messages if any edits fail
///
/// # Errors
///
/// Returns `LastFmError::Parse` if no matching scrobbles are found, or other errors
/// for network/authentication issues.
///
/// # Example
///
/// ```rust,no_run
/// # use lastfm_edit::{LastFmEditClient, ScrobbleEdit, Result};
/// # async fn example(client: &dyn LastFmEditClient) -> Result<()> {
/// // Change track name for all instances of a track
/// let edit = ScrobbleEdit::from_track_and_artist("Old Track Name", "Artist")
/// .with_track_name("New Track Name");
///
/// let response = client.edit_scrobble(&edit).await?;
/// if response.success() {
/// println!("Successfully edited {} scrobbles", response.total_edits());
/// }
/// # Ok(())
/// # }
/// ```
async fn edit_scrobble(&self, edit: &ScrobbleEdit) -> Result<EditResponse>;
/// Edit a single scrobble with complete information and retry logic.
///
/// This method performs a single edit operation on a fully-specified scrobble.
/// Unlike [`edit_scrobble`], this method does not perform discovery, enrichment,
/// or multiple edits - it edits exactly one scrobble instance.
///
/// # Key Differences from `edit_scrobble`
///
/// - **No discovery**: Requires a fully-specified `ExactScrobbleEdit`
/// - **Single edit**: Only edits one scrobble instance
/// - **No enrichment**: All fields must be provided upfront
/// - **Retry logic**: Automatically retries on rate limiting
///
/// # Arguments
///
/// * `exact_edit` - A fully-specified edit with all required fields populated,
/// including original metadata and timestamps
/// * `max_retries` - Maximum number of retry attempts for rate limiting.
/// The method will wait with exponential backoff between retries.
///
/// # Returns
///
/// Returns an `EditResponse` with a single result indicating success or failure.
/// If max retries are exceeded due to rate limiting, returns a failed response
/// rather than an error.
///
/// # Example
///
/// ```rust,no_run
/// # use lastfm_edit::{LastFmEditClient, ExactScrobbleEdit, Result};
/// # async fn example(client: &dyn LastFmEditClient) -> Result<()> {
/// let exact_edit = ExactScrobbleEdit::new(
/// "Original Track".to_string(),
/// "Original Album".to_string(),
/// "Artist".to_string(),
/// "Artist".to_string(),
/// "New Track Name".to_string(),
/// "Original Album".to_string(),
/// "Artist".to_string(),
/// "Artist".to_string(),
/// 1640995200, // timestamp
/// false
/// );
///
/// let response = client.edit_scrobble_single(&exact_edit, 3).await?;
/// # Ok(())
/// # }
/// ```
async fn edit_scrobble_single(
&self,
exact_edit: &ExactScrobbleEdit,
max_retries: u32,
) -> Result<EditResponse>;
/// Delete a scrobble by its identifying information.
///
/// This method deletes a specific scrobble from the user's library using the
/// artist name, track name, and timestamp to uniquely identify it.
///
/// # Arguments
///
/// * `artist_name` - The artist name of the scrobble to delete
/// * `track_name` - The track name of the scrobble to delete
/// * `timestamp` - The unix timestamp of the scrobble to delete
///
/// # Returns
///
/// Returns `true` if the deletion was successful, `false` otherwise.
async fn delete_scrobble(
&self,
artist_name: &str,
track_name: &str,
timestamp: u64,
) -> Result<bool>;
/// Create an incremental discovery iterator for scrobble editing.
///
/// This returns the appropriate discovery iterator based on what fields are specified
/// in the ScrobbleEdit. The iterator yields `ExactScrobbleEdit` results incrementally,
/// which helps avoid rate limiting issues when discovering many scrobbles.
///
/// Returns a `Box<dyn AsyncDiscoveryIterator<ExactScrobbleEdit>>` to handle the different
/// discovery strategies uniformly.
fn discover_scrobbles(
&self,
edit: ScrobbleEdit,
) -> Box<dyn crate::AsyncDiscoveryIterator<crate::ExactScrobbleEdit>>;
// =============================================================================
// ITERATOR METHODS - Core library browsing functionality
// =============================================================================
/// Create an iterator for browsing all artists in the user's library.
fn artists(&self) -> Box<dyn AsyncPaginatedIterator<Artist>>;
/// Create an iterator for browsing an artist's tracks from the user's library.
fn artist_tracks(&self, artist: &str) -> Box<dyn AsyncPaginatedIterator<Track>>;
/// Create an iterator for browsing an artist's tracks directly using the paginated endpoint.
///
/// This alternative approach uses
/// `/user/{username}/library/music/{artist}/+tracks` directly with
/// pagination, which is more efficient than the album-based approach since
/// it doesn't need to iterate through albums first. The downside of this
/// approach is that the tracks will not come with album information, which
/// will need to get looked up eventually in the process of making edits.
fn artist_tracks_direct(&self, artist: &str) -> Box<dyn AsyncPaginatedIterator<Track>>;
/// Create an iterator for browsing an artist's albums from the user's library.
fn artist_albums(&self, artist: &str) -> Box<dyn AsyncPaginatedIterator<Album>>;
/// Create an iterator for browsing tracks from a specific album.
fn album_tracks(
&self,
album_name: &str,
artist_name: &str,
) -> Box<dyn AsyncPaginatedIterator<Track>>;
/// Create an iterator for browsing the user's recent tracks/scrobbles.
fn recent_tracks(&self) -> Box<dyn AsyncPaginatedIterator<Track>>;
/// Create an iterator for browsing the user's recent tracks starting from a specific page.
fn recent_tracks_from_page(&self, starting_page: u32)
-> Box<dyn AsyncPaginatedIterator<Track>>;
/// Create an iterator for searching tracks in the user's library.
///
/// This returns an iterator that uses Last.fm's library search functionality
/// to find tracks matching the provided query string. The iterator handles
/// pagination automatically.
///
/// # Arguments
///
/// * `query` - The search query (e.g., "remaster", "live", artist name, etc.)
///
/// # Returns
///
/// Returns a `SearchTracksIterator` for streaming search results.
fn search_tracks(&self, query: &str) -> Box<dyn AsyncPaginatedIterator<Track>>;
/// Create an iterator for searching albums in the user's library.
///
/// This returns an iterator that uses Last.fm's library search functionality
/// to find albums matching the provided query string. The iterator handles
/// pagination automatically.
///
/// # Arguments
///
/// * `query` - The search query (e.g., "remaster", "deluxe", artist name, etc.)
///
/// # Returns
///
/// Returns a `SearchAlbumsIterator` for streaming search results.
fn search_albums(&self, query: &str) -> Box<dyn AsyncPaginatedIterator<Album>>;
/// Create an iterator for searching artists in the user's library.
///
/// This returns an iterator that uses Last.fm's library search functionality
/// to find artists matching the provided query string. The iterator handles
/// pagination automatically.
///
/// # Arguments
///
/// * `query` - The search query (e.g., artist name, partial match, etc.)
///
/// # Returns
///
/// Returns a `SearchArtistsIterator` for streaming search results.
fn search_artists(&self, query: &str) -> Box<dyn AsyncPaginatedIterator<Artist>>;
// =============================================================================
// CONVENIENCE METHODS - Higher-level helpers and shortcuts
// =============================================================================
/// Discover all scrobble edit variations based on the provided ScrobbleEdit template.
///
/// This method analyzes what fields are specified in the input ScrobbleEdit and discovers
/// all relevant scrobble instances that match the criteria:
/// - If track_name_original is specified: discovers all album variations of that track
/// - If only album_name_original is specified: discovers all tracks in that album
/// - If neither is specified: discovers all tracks by that artist
///
/// Returns fully-specified ExactScrobbleEdit instances with all metadata populated
/// from the user's library, ready for editing operations.
async fn discover_scrobble_edit_variations(
&self,
edit: &ScrobbleEdit,
) -> Result<Vec<ExactScrobbleEdit>> {
// Use the incremental iterator and collect all results
let mut discovery_iterator = self.discover_scrobbles(edit.clone());
discovery_iterator.collect_all().await
}
/// Edit album metadata by updating scrobbles with new album name.
async fn edit_album(
&self,
old_album_name: &str,
new_album_name: &str,
artist_name: &str,
) -> Result<EditResponse> {
log::debug!("Editing album '{old_album_name}' -> '{new_album_name}' by '{artist_name}'");
let edit = ScrobbleEdit::for_album(old_album_name, artist_name, artist_name)
.with_album_name(new_album_name);
self.edit_scrobble(&edit).await
}
/// Edit artist metadata by updating scrobbles with new artist name.
///
/// This edits ALL tracks from the artist that are found in recent scrobbles.
async fn edit_artist(
&self,
old_artist_name: &str,
new_artist_name: &str,
) -> Result<EditResponse> {
log::debug!("Editing artist '{old_artist_name}' -> '{new_artist_name}'");
let edit = ScrobbleEdit::for_artist(old_artist_name, new_artist_name);
self.edit_scrobble(&edit).await
}
/// Edit artist metadata for a specific track only.
///
/// This edits only the specified track if found in recent scrobbles.
async fn edit_artist_for_track(
&self,
track_name: &str,
old_artist_name: &str,
new_artist_name: &str,
) -> Result<EditResponse> {
log::debug!("Editing artist for track '{track_name}' from '{old_artist_name}' -> '{new_artist_name}'");
let edit = ScrobbleEdit::from_track_and_artist(track_name, old_artist_name)
.with_artist_name(new_artist_name);
self.edit_scrobble(&edit).await
}
/// Edit artist metadata for all tracks in a specific album.
///
/// This edits ALL tracks from the specified album that are found in recent scrobbles.
async fn edit_artist_for_album(
&self,
album_name: &str,
old_artist_name: &str,
new_artist_name: &str,
) -> Result<EditResponse> {
log::debug!("Editing artist for album '{album_name}' from '{old_artist_name}' -> '{new_artist_name}'");
let edit = ScrobbleEdit::for_album(album_name, old_artist_name, old_artist_name)
.with_artist_name(new_artist_name);
self.edit_scrobble(&edit).await
}
}
#[cfg(feature = "mock")]
mockall::mock! {
pub LastFmEditClient {}
#[async_trait(?Send)]
impl LastFmBaseClient for LastFmEditClient {
async fn get_artists_page(&self, page: u32) -> Result<ArtistPage>;
async fn get_artist_tracks_page(&self, artist: &str, page: u32) -> Result<crate::TrackPage>;
async fn get_artist_albums_page(&self, artist: &str, page: u32) -> Result<crate::AlbumPage>;
async fn get_album_tracks_page(
&self,
album_name: &str,
artist_name: &str,
page: u32,
) -> Result<crate::TrackPage>;
async fn get_recent_tracks_page(&self, page: u32) -> Result<crate::TrackPage>;
async fn search_tracks_page(&self, query: &str, page: u32) -> Result<crate::TrackPage>;
async fn search_albums_page(&self, query: &str, page: u32) -> Result<crate::AlbumPage>;
async fn search_artists_page(&self, query: &str, page: u32) -> Result<crate::ArtistPage>;
fn username(&self) -> String;
fn get_session(&self) -> LastFmEditSession;
fn subscribe(&self) -> ClientEventReceiver;
fn latest_event(&self) -> Option<ClientEvent>;
async fn validate_session(&self) -> bool;
async fn find_recent_scrobble_for_track(
&self,
track_name: &str,
artist_name: &str,
max_pages: u32,
) -> Result<Option<Track>>;
fn cancel(&self);
fn reset_cancel(&self);
fn is_cancelled(&self) -> bool;
}
#[async_trait(?Send)]
impl LastFmEditClient for LastFmEditClient {
async fn edit_scrobble(&self, edit: &ScrobbleEdit) -> Result<EditResponse>;
async fn edit_scrobble_single(
&self,
exact_edit: &ExactScrobbleEdit,
max_retries: u32,
) -> Result<EditResponse>;
async fn delete_scrobble(
&self,
artist_name: &str,
track_name: &str,
timestamp: u64,
) -> Result<bool>;
fn discover_scrobbles(
&self,
edit: ScrobbleEdit,
) -> Box<dyn crate::AsyncDiscoveryIterator<crate::ExactScrobbleEdit>>;
fn artists(&self) -> Box<dyn AsyncPaginatedIterator<Artist>>;
fn artist_tracks(&self, artist: &str) -> Box<dyn AsyncPaginatedIterator<Track>>;
fn artist_tracks_direct(&self, artist: &str) -> Box<dyn AsyncPaginatedIterator<Track>>;
fn artist_albums(&self, artist: &str) -> Box<dyn AsyncPaginatedIterator<Album>>;
fn album_tracks(
&self,
album_name: &str,
artist_name: &str,
) -> Box<dyn AsyncPaginatedIterator<Track>>;
fn recent_tracks(&self) -> Box<dyn AsyncPaginatedIterator<Track>>;
fn recent_tracks_from_page(&self, starting_page: u32)
-> Box<dyn AsyncPaginatedIterator<Track>>;
fn search_tracks(&self, query: &str) -> Box<dyn AsyncPaginatedIterator<Track>>;
fn search_albums(&self, query: &str) -> Box<dyn AsyncPaginatedIterator<Album>>;
fn search_artists(&self, query: &str) -> Box<dyn AsyncPaginatedIterator<Artist>>;
}
}