Feature/shows and episodes#437
Conversation
Mostly small changes except for one major (Item in PlaybackContext). Since Item can be either FullTrack or FullEpisode, I had to use an interface that decodes this on the fly.
|
Thanks for the cleanup. Sorry about indentation issues. My VS went nuts with your code. |
|
Do you mean I removed it because it doesn't offer any more information that is not already present in the class instance. You can already do the following: Do you have any specific advantages of having it? |
|
No. You're probably right. I'm a bit rusty on C#. Looks like "instanceof" is a good solution and you don't need to query the itemtype. |
|
I'm wondering how we can make it easier for the user to get the correct types. Right now, the user has to know that it returns either |
|
I'm not sure what got into me earlier, but The only thing we have available is if (item.Track is FullTrack)
{
var track = item.Track as FullTrack;
}
if (item.Track is FullEpisode)
{
var episode = item.Track as FullEpisode;
} |
|
SGTM
…On Sat, May 2, 2020, 15:41 Jonas Dellinger ***@***.***> wrote:
I'm not sure what got into me earlier, but instanceof is not a c# thing.
It's Java. I thought I've tested it...
The only thing we have available is as and is, so users could use the
following:
if (item.Track is FullTrack)
{
var track = item.Track as FullTrack;
}if (item.Track is FullEpisode)
{
var episode = item.Track as FullEpisode;
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#437 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPC2DVZJBQAHWR4GTVWYKDRPSOPZANCNFSM4MHVVOWQ>
.
|
|
I will merge this into the current master if people want to build it on their own. However, since this is a breaking change because of the For 6.X, it's already implemented based on your work and following the same pattern (e.g https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/4c38f958a09c162eef5f9e6c3a2d1f79a91b20a9/SpotifyAPI.Web/Models/Response/Interfaces/IPlaylistElement.cs). Huge thanks to you for the work 👍 |
This is the successor to #436
First of all, thanks @shayo, Great work!
I had to create a new branch because I was unable to commit to your master branch @shayo. Next time, it would be good if you open a feature branch in your fork and grant write access (This is done automatically on GitHub normally). If you want to add/fix anything here, feel free to make a PR against this branch.
What changes I did:
ItemTypebut rather an interface which covers"type"properties.GetPlaylistalso neededadditional_types.What do you think?