Beispiel #1
0
        public IList <Category> GetCategories()
        {
            var request = Spotify.GetCategories();

            if (request.IsSuccess)
            {
                var categoriesResponse = request.Content;

                var categories = categoriesResponse.Categories;
                while (categoriesResponse.Categories.Next != null)
                {
                    request = Spotify.GetNextPageContent <SpotifyCategoriesResponse>(categoriesResponse.Categories.Next);
                    if (request.IsSuccess)
                    {
                        categoriesResponse = request.Content;
                        foreach (var item in categoriesResponse.Categories.Items)
                        {
                            categories.Items.Add(item);
                        }
                    }
                }

                IList <Category> returnList = new List <Category>();
                foreach (var spotifyCategory in categories.Items)
                {
                    returnList.Add(SpotifyFactory.CreateCategory(spotifyCategory));
                }
                return(returnList);
            }
            return(null);
        }