public void ClearForm() { //blank out the other fields after upload this.PlaylistName = ""; this.PlaylistType = PlaylistTypeEnum.EXPLICIT; this.ReferenceID = ""; this.ShortDescription = ""; //this.VideoIDs = new BCCollection<long>(); this.FilterTags = new BCCollection <string>(); }
public async Task <List <RecommendationResponse> > GetPlaylistByTypeAsync(PlaylistTypeEnum recommend) { var token = await Authenticate(); var searchResult = await SearchForPlaylists(recommend, token); var result = new List <RecommendationResponse>(); searchResult.Playlists.Items.ToList().ForEach(x => result.Add(new RecommendationResponse(x.Name, x.External_Urls.Spotify))); return(result); }
private static async Task <SpotifyQueryPlaylistResponse> SearchForPlaylists(PlaylistTypeEnum recommend, string token) { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue($"Bearer", token); var url = SearchUrl.Replace("{genre}", recommend.ToString()); var httpResult = await client.GetAsync(url); if (!httpResult.IsSuccessStatusCode) { throw new HttpResponseException("Error while searching for playlists on Spotify."); } var stringContent = await httpResult.Content.ReadAsStringAsync(); var content = JsonConvert.DeserializeObject <SpotifyQueryPlaylistResponse>(stringContent); return(content); }
public void ClearForm() { //blank out the other fields after upload this.PlaylistName = ""; this.PlaylistType = PlaylistTypeEnum.EXPLICIT; this.ReferenceID = ""; this.ShortDescription = ""; //this.VideoIDs = new BCCollection<long>(); this.FilterTags = new BCCollection<string>(); }