Skip to content

Commit

Permalink
Merge pull request #194 from kstep/playlist-item-episodes
Browse files Browse the repository at this point in the history
Allow `PlaylistItem` to contain episodes.
  • Loading branch information
marioortizmanero authored Mar 10, 2021
2 parents ec3f24d + 6679079 commit 0b2d444
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ If we missed any change or there's something you'd like to discuss about this ve
+ `PageCategory`
+ `Page`
+ `PlayHistory`
+ `PlayableItem`
+ `PlayingItem`
+ `PlaylistItem`
+ `PlaylistResult`
Expand Down Expand Up @@ -198,6 +199,7 @@ If we missed any change or there's something you'd like to discuss about this ve
+ Change `Token.scope` from `String` to `HashSet`.
+ Change `OAuth.scope` from `String` to `HashSet`.
+ Change `SimplifiedPlaylist::tracks` from `HashMap` to `PlaylistTracksRef`
- ([#194](https://github.com/ramsayleung/rspotify/pull/194)) Rename `PlayingItem` to `PlayableItem`, `PlaylistItem::track` type changed to `Option<PlayableItem>`, so playlists can contain episodes as well

## 0.10 (2020/07/01)

Expand Down
6 changes: 3 additions & 3 deletions src/model/context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! All objects related to context
use super::device::Device;
use super::PlayingItem;
use super::PlayableItem;
use crate::model::{
millisecond_timestamp, option_duration_ms, CurrentlyPlayingType, DisallowKey, RepeatState, Type,
};
Expand Down Expand Up @@ -34,7 +34,7 @@ pub struct CurrentlyPlayingContext {
#[serde(with = "option_duration_ms", rename = "progress_ms")]
pub progress: Option<Duration>,
pub is_playing: bool,
pub item: Option<PlayingItem>,
pub item: Option<PlayableItem>,
pub currently_playing_type: CurrentlyPlayingType,
pub actions: Actions,
}
Expand All @@ -51,7 +51,7 @@ pub struct CurrentPlaybackContext {
#[serde(with = "option_duration_ms", rename = "progress_ms")]
pub progress: Option<Duration>,
pub is_playing: bool,
pub item: Option<PlayingItem>,
pub item: Option<PlayableItem>,
pub currently_playing_type: CurrentlyPlayingType,
pub actions: Actions,
}
Expand Down
2 changes: 1 addition & 1 deletion src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub struct Followers {
/// + [Reference to full episode](https://developer.spotify.com/documentation/web-api/reference/#object-episodeobject)
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(untagged)]
pub enum PlayingItem {
pub enum PlayableItem {
Track(track::FullTrack),
Episode(show::FullEpisode),
}
Expand Down
5 changes: 2 additions & 3 deletions src/model/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use std::collections::HashMap;

use super::image::Image;
use super::page::Page;
use super::track::FullTrack;
use super::user::PublicUser;
use crate::model::{Followers, Type};
use crate::model::{Followers, PlayableItem, Type};

/// Playlist result object
///
Expand Down Expand Up @@ -77,7 +76,7 @@ pub struct PlaylistItem {
pub added_at: Option<DateTime<Utc>>,
pub added_by: Option<PublicUser>,
pub is_local: bool,
pub track: Option<FullTrack>,
pub track: Option<PlayableItem>,
}
/// Featured playlists object
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-featured-playlists)
Expand Down

0 comments on commit 0b2d444

Please sign in to comment.