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>();
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
		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>();
		}