diff --git a/CHANGELOG.md b/CHANGELOG.md index 90985cb0..629979f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -310,6 +310,8 @@ More in the [`examples` directory](https://github.com/ramsayleung/rspotify/tree/ + `get_an_episode` + `get_several_episodes` + `remove_users_saved_shows` +- ([#261](https://github.com/ramsayleung/rspotify/pull/261/files)) `PageSimpliedAlbums` has been renamed to `PageSimplifiedAlbums` +- ([#261](https://github.com/ramsayleung/rspotify/pull/261/files)) `Default` has been implemented for all the possible models - ([#257](https://github.com/ramsayleung/rspotify/pull/257)) Fix naming for most playlist-related endpoints. They used to work only for tracks, but they've been extended to episodes as well, so we call the contents of a playlist "items" instead of "tracks". + `playlist_add_tracks` is now `playlist_add_items` + `playlist_tracks` is now `playlist_items` diff --git a/rspotify-model/src/album.rs b/rspotify-model/src/album.rs index 216b5440..2e7d36d7 100644 --- a/rspotify-model/src/album.rs +++ b/rspotify-model/src/album.rs @@ -13,7 +13,7 @@ use crate::{ /// Simplified Album Object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedalbumobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct SimplifiedAlbum { #[serde(skip_serializing_if = "Option::is_none")] pub album_group: Option, @@ -56,7 +56,7 @@ pub struct FullAlbum { pub tracks: Page, } -/// Full Albums wrapped by Vec object +/// Intermediate full Albums wrapped by Vec object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-multiple-albums) #[derive(Deserialize)] @@ -64,11 +64,11 @@ pub struct FullAlbums { pub albums: Vec, } -/// Simplified Albums wrapped by Page object +/// Intermediate simplified Albums wrapped by Page object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-new-releases) #[derive(Deserialize)] -pub struct PageSimpliedAlbums { +pub struct PageSimplifiedAlbums { pub albums: Page, } diff --git a/rspotify-model/src/artist.rs b/rspotify-model/src/artist.rs index d6e27f6c..41fb2fa9 100644 --- a/rspotify-model/src/artist.rs +++ b/rspotify-model/src/artist.rs @@ -9,7 +9,7 @@ use crate::{ArtistId, CursorBasedPage, Followers, Image}; /// Simplified Artist Object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedartistobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct SimplifiedArtist { pub external_urls: HashMap, pub href: Option, @@ -32,7 +32,7 @@ pub struct FullArtist { pub popularity: u32, } -/// Full artist object wrapped by `Vec` +/// Intermediate full artist object wrapped by `Vec` /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-multiple-artists) #[derive(Deserialize)] @@ -40,7 +40,7 @@ pub struct FullArtists { pub artists: Vec, } -/// Full Artists vector wrapped by cursor-based-page object +/// Intermediate full Artists vector wrapped by cursor-based-page object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-followed) #[derive(Deserialize)] diff --git a/rspotify-model/src/audio.rs b/rspotify-model/src/audio.rs index ae6fa381..ae013fef 100644 --- a/rspotify-model/src/audio.rs +++ b/rspotify-model/src/audio.rs @@ -34,7 +34,7 @@ pub struct AudioFeatures { pub valence: f32, } -/// Audio feature object wrapped by `Vec` +/// Intermediate audio feature object wrapped by `Vec` /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-several-audio-features) #[derive(Deserialize)] @@ -58,7 +58,7 @@ pub struct AudioAnalysis { /// Time interval object /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-audio-analysis) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)] pub struct TimeInterval { pub start: f32, pub duration: f32, @@ -87,7 +87,7 @@ pub struct AudioAnalysisSection { /// Audio analysis meta object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-audio-analysis) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)] pub struct AudioAnalysisMeta { pub analyzer_version: String, pub platform: String, @@ -101,7 +101,7 @@ pub struct AudioAnalysisMeta { /// Audio analysis segment object /// ///[Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-audio-analysis) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)] pub struct AudioAnalysisSegment { #[serde(flatten)] pub time_interval: TimeInterval, diff --git a/rspotify-model/src/auth.rs b/rspotify-model/src/auth.rs index b7be2b62..e238028f 100644 --- a/rspotify-model/src/auth.rs +++ b/rspotify-model/src/auth.rs @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize}; /// Spotify access token information /// /// [Reference](https://developer.spotify.com/documentation/general/guides/authorization-guide/) -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct Token { /// An access token that can be provided in subsequent calls pub access_token: String, diff --git a/rspotify-model/src/category.rs b/rspotify-model/src/category.rs index 241b1397..14121a97 100644 --- a/rspotify-model/src/category.rs +++ b/rspotify-model/src/category.rs @@ -7,7 +7,7 @@ use crate::{Image, Page}; /// Category object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-categories) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct Category { pub href: String, pub icons: Vec, @@ -15,7 +15,7 @@ pub struct Category { pub name: String, } -/// Categories wrapped by page object +/// Intermediate categories wrapped by page object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-categories) #[derive(Deserialize)] diff --git a/rspotify-model/src/context.rs b/rspotify-model/src/context.rs index 456a5d30..24167195 100644 --- a/rspotify-model/src/context.rs +++ b/rspotify-model/src/context.rs @@ -61,7 +61,7 @@ pub struct CurrentPlaybackContext { /// Actions object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-recently-played) -#[derive(Clone, Debug, Serialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, PartialEq, Eq, Default)] pub struct Actions { pub disallows: Vec, } diff --git a/rspotify-model/src/device.rs b/rspotify-model/src/device.rs index a92b47a3..18430ecf 100644 --- a/rspotify-model/src/device.rs +++ b/rspotify-model/src/device.rs @@ -16,7 +16,7 @@ pub struct Device { pub volume_percent: Option, } -/// Device payload object +/// Intermediate device payload object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-a-users-available-devices) #[derive(Deserialize)] diff --git a/rspotify-model/src/image.rs b/rspotify-model/src/image.rs index 830365c5..bec92437 100644 --- a/rspotify-model/src/image.rs +++ b/rspotify-model/src/image.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// Image object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-imageobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct Image { pub height: Option, pub url: String, diff --git a/rspotify-model/src/lib.rs b/rspotify-model/src/lib.rs index 2d2040e8..b845ae2e 100644 --- a/rspotify-model/src/lib.rs +++ b/rspotify-model/src/lib.rs @@ -35,7 +35,7 @@ use serde::{Deserialize, Serialize}; /// Followers object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-followersobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct Followers { // This field will always set to null, as the Web API does not support it at the moment. // pub href: Option, diff --git a/rspotify-model/src/page.rs b/rspotify-model/src/page.rs index db324c26..87d08396 100644 --- a/rspotify-model/src/page.rs +++ b/rspotify-model/src/page.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// Paging object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-pagingobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct Page { pub href: String, pub items: Vec, @@ -19,7 +19,7 @@ pub struct Page { /// Cursor-based paging object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-cursorpagingobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct CursorBasedPage { pub href: String, pub items: Vec, @@ -34,7 +34,7 @@ pub struct CursorBasedPage { /// Cursor object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-cursorobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct Cursor { pub after: Option, } diff --git a/rspotify-model/src/playlist.rs b/rspotify-model/src/playlist.rs index 78a062cd..4b433674 100644 --- a/rspotify-model/src/playlist.rs +++ b/rspotify-model/src/playlist.rs @@ -10,7 +10,7 @@ use crate::{Followers, Image, Page, PlayableItem, PlaylistId, PublicUser}; /// Playlist result object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-add-tracks-to-playlist) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct PlaylistResult { pub snapshot_id: String, } @@ -18,7 +18,7 @@ pub struct PlaylistResult { /// Playlist Track Reference Object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playlisttracksrefobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct PlaylistTracksRef { pub href: String, pub total: u32, @@ -63,7 +63,7 @@ pub struct FullPlaylist { /// Playlist track object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playlisttrackobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct PlaylistItem { pub added_at: Option>, pub added_by: Option, @@ -78,7 +78,7 @@ pub struct FeaturedPlaylists { pub playlists: Page, } -/// Category playlists object wrapped by `Page` +/// Intermediate category playlists object wrapped by `Page` /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-a-categories-playlists) #[derive(Deserialize)] diff --git a/rspotify-model/src/recommend.rs b/rspotify-model/src/recommend.rs index d1d0f292..3c6456bd 100644 --- a/rspotify-model/src/recommend.rs +++ b/rspotify-model/src/recommend.rs @@ -8,7 +8,7 @@ use crate::{RecommendationsSeedType, SimplifiedTrack}; /// Recommendations object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-recommendationsobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct Recommendations { pub seeds: Vec, pub tracks: Vec, diff --git a/rspotify-model/src/search.rs b/rspotify-model/src/search.rs index 8eb6a253..09848581 100644 --- a/rspotify-model/src/search.rs +++ b/rspotify-model/src/search.rs @@ -18,7 +18,7 @@ pub struct SearchPlaylists { /// Search for albums /// ///[Reference](https://developer.spotify.com/documentation/web-api/reference/#category-search) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct SearchAlbums { pub albums: Page, } diff --git a/rspotify-model/src/show.rs b/rspotify-model/src/show.rs index 456079b6..303a2ec3 100644 --- a/rspotify-model/src/show.rs +++ b/rspotify-model/src/show.rs @@ -130,10 +130,10 @@ pub struct FullEpisode { pub show: SimplifiedShow, } -/// Episodes feature object wrapped by `Vec` +/// Intermediate episodes feature object wrapped by `Vec` /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-multiple-episodes) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Deserialize)] pub struct EpisodesPayload { pub episodes: Vec, } @@ -141,7 +141,7 @@ pub struct EpisodesPayload { /// Resume point object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-resumepointobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct ResumePoint { pub fully_played: bool, #[serde(with = "duration_ms", rename = "resume_position_ms")] diff --git a/rspotify-model/src/track.rs b/rspotify-model/src/track.rs index a54149ac..3854118d 100644 --- a/rspotify-model/src/track.rs +++ b/rspotify-model/src/track.rs @@ -49,7 +49,7 @@ pub struct TrackLink { pub id: TrackId, } -/// Full track wrapped by `Vec` +/// Intermediate full track wrapped by `Vec` /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-several-tracks) #[derive(Deserialize)] @@ -63,7 +63,7 @@ pub struct FullTracks { /// relinking is applied. /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedtrackobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct SimplifiedTrack { pub artists: Vec, pub available_markets: Option>, diff --git a/rspotify-model/src/user.rs b/rspotify-model/src/user.rs index 6e2c5cbd..0ab2df85 100644 --- a/rspotify-model/src/user.rs +++ b/rspotify-model/src/user.rs @@ -40,7 +40,7 @@ pub struct PrivateUser { /// Explicit content setting object /// /// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-explicitcontentsettingsobject) -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct ExplicitContent { pub filter_enabled: bool, pub filter_locked: bool, diff --git a/src/clients/base.rs b/src/clients/base.rs index 495b2693..b1737c01 100644 --- a/src/clients/base.rs +++ b/src/clients/base.rs @@ -891,7 +891,7 @@ where }; let result = self.endpoint_get("browse/new-releases", ¶ms).await?; - convert_result::(&result).map(|x| x.albums) + convert_result::(&result).map(|x| x.albums) } /// Get Recommendations Based on Seeds