Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow PlaylistItem to contain episodes. #194

Merged
merged 4 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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