Skip to content

How to use GetFollowedArtists #340

@gahujipo

Description

@gahujipo

I tried to output followed artists which a user follows. I took this example to start from:
https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web.Example/Program.cs

I've seen that the output of user's playlists can be achieved by using Paging:

Paging<SimplePlaylist> playlists = await api.GetUserPlaylistsAsync(profile.Id);

But it seem to me that, when doing

var followedArtistSync = api.GetFollowedArtists(FollowType.Artist); 

followedArtistSync.Artist contains a property of the type CursorPaging and followedArtistSync.Artist.Items contain only the first 20 elements (obviously because of the default paging size of 20). But how to get the next page and/or using Paging here?

My try with the async method here was:

Paging<FollowedArtists> followedArtistsAsync = await api.GetFollowedArtistsAsync(FollowType.Artist);

but that fails with the following error:

Cannot implicitly convert type 'SpotifyAPI.Web.Models.FollowedArtists' to 'SpotifyAPI.Web.Models.Paging<SpotifyAPI.Web.Models.FollowedArtists>'

My current progress in that is:

var followedArtistSync = api.GetFollowedArtists(FollowType.Artist); 
followedArtistSync.Artists.Items.ForEach(artist =>
{
    Console.WriteLine($"- {artist.Name}");
});

What am I missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions