lastfm_rust/api/
artist.rs

1mod add_tags;
2mod get_correction;
3mod get_info;
4mod get_similar;
5mod get_tags;
6mod get_top_albums;
7mod get_top_tags;
8mod get_top_tracks;
9mod remove_tag;
10mod search;
11
12use crate::Lastfm;
13
14pub use add_tags::ArtistAddTagsRequest;
15pub use get_correction::ArtistGetCorrection;
16pub use get_info::ArtistGetInfo;
17pub use get_similar::ArtistGetSimilar;
18pub use get_tags::ArtistGetTags;
19pub use get_top_albums::ArtistGetTopAlbums;
20pub use get_top_tags::ArtistGetTopTags;
21pub use get_top_tracks::ArtistGetTopTracks;
22pub use remove_tag::ArtistRemoveTag;
23pub use search::ArtistSearch;
24
25/// Represents artist-related operations in the Last.fm API.
26#[derive(Debug)]
27pub struct Artist<'a> {
28    lastfm: &'a Lastfm,
29}
30
31impl<'a> Artist<'a> {
32    /// Creates a new `Artist` instance.
33    pub(crate) fn new(lastfm: &'a Lastfm) -> Self {
34        Self { lastfm }
35    }
36
37    /// Creates a request to get tags for the artist.
38    pub fn get_tags(&mut self) -> ArtistGetTags<'_> {
39        ArtistGetTags::new(self.lastfm)
40    }
41
42    /// Creates a request to get corrections for the artist.
43    pub fn get_correction(&mut self) -> ArtistGetCorrection<'_> {
44        ArtistGetCorrection::new(self.lastfm)
45    }
46
47    /// Creates a request to get info for the artist.
48    pub fn get_info(&mut self) -> ArtistGetInfo<'_> {
49        ArtistGetInfo::new(self.lastfm)
50    }
51
52    /// Creates a request to get similar artist to this artist.
53    pub fn get_similar(&mut self) -> ArtistGetSimilar<'_> {
54        ArtistGetSimilar::new(self.lastfm)
55    }
56
57    /// Creates a request to add tags to the artist.
58    pub fn add_tags(&mut self) -> ArtistAddTagsRequest<'_> {
59        ArtistAddTagsRequest::new(self.lastfm)
60    }
61
62    /// Creates a request to get top albums for the artist.
63    pub fn get_top_albums(&mut self) -> ArtistGetTopAlbums<'_> {
64        ArtistGetTopAlbums::new(self.lastfm)
65    }
66
67    /// Creates a request to get top tags for the artist.
68    pub fn get_top_tags(&mut self) -> ArtistGetTopTags<'_> {
69        ArtistGetTopTags::new(self.lastfm)
70    }
71
72    /// Creates a request to get top tracks for the artist.
73    pub fn get_top_tracks(&mut self) -> ArtistGetTopTracks<'_> {
74        ArtistGetTopTracks::new(self.lastfm)
75    }
76
77    /// Creates a request to remove a tag for the artist.
78    pub fn remove_tag(&mut self) -> ArtistRemoveTag<'_> {
79        ArtistRemoveTag::new(self.lastfm)
80    }
81
82    /// Creates a request to search a artist.
83    pub fn search(&mut self) -> ArtistSearch<'_> {
84        ArtistSearch::new(self.lastfm)
85    }
86}