pub struct TopAlbumsRequestBuilder { /* private fields */ }Expand description
Builder for top albums requests
Implementations§
Source§impl TopAlbumsRequestBuilder
impl TopAlbumsRequestBuilder
Sourcepub const fn limit(self, limit: u32) -> Self
pub const fn limit(self, limit: u32) -> Self
Set the maximum number of albums to fetch
§Arguments
limit- Maximum number of albums to fetch. The Last.fm API supports fetching up to thousands of albums. If you need all albums, useunlimited()instead.
Sourcepub const fn period(self, period: Period) -> Self
pub const fn period(self, period: Period) -> Self
Set the time period for top albums
§Arguments
period- The time range to calculate top albums over. UsePeriod::Overallfor all-time,Period::Weekfor last 7 days,Period::Monthfor last 30 days, etc. If not set, defaults to the Last.fm API’s default behavior (typically overall).
Sourcepub async fn fetch(self) -> Result<TrackList<TopAlbum>>
pub async fn fetch(self) -> Result<TrackList<TopAlbum>>
Fetch the albums
§Errors
Returns an error if the HTTP request fails or the response cannot be parsed.
Sourcepub async fn fetch_and_save(
self,
format: FileFormat,
filename_prefix: &str,
) -> Result<String>
pub async fn fetch_and_save( self, format: FileFormat, filename_prefix: &str, ) -> Result<String>
Fetch albums and save them to a file
§Arguments
format- The file format to save the albums infilename_prefix- Prefix for the generated filename
§Errors
Returns an error if the HTTP request fails, response cannot be parsed, or file cannot be saved.
§Returns
Result<String>- The filename of the saved file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TopAlbumsRequestBuilder
impl !RefUnwindSafe for TopAlbumsRequestBuilder
impl Send for TopAlbumsRequestBuilder
impl Sync for TopAlbumsRequestBuilder
impl Unpin for TopAlbumsRequestBuilder
impl UnsafeUnpin for TopAlbumsRequestBuilder
impl !UnwindSafe for TopAlbumsRequestBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more