using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MvvmCross.ViewModels;
using SpotifyAPI.Web;
namespace Example.UWP.ViewModels
{
///
/// Spotify Token is the parameter
///
public class PlaylistsListViewModel : MvxViewModel
{
private SpotifyClient _spotify;
private List _playlists;
public List Playlists {
get => _playlists ?? (_playlists = new List());
set => SetProperty(ref _playlists, value);
}
public override void Prepare(string token)
{
_spotify = new SpotifyClient(SpotifyClientConfig.CreateDefault(token));
}
public override async Task Initialize()
{
await base.Initialize();
Playlists = await _spotify.Paginate(() => _spotify.Playlists.CurrentUsers());
}
}
}