Example #1
0
        public async Task <JSON_ListPlaylists> SearchPlaylists(string Keyword, PlaylistSortEnum Sort = PlaylistSortEnum.recent, int OffSet = 1)
        {
            string flds = string.Join(",", GetStringsFromClassConstants(typeof(FieldsPlaylist)));

            return(await Core.SDK.SearchForAPlaylist("me", flds, Keyword, Sort, OffSet));
        }
Example #2
0
        public async Task <JSON_ListPlaylists> ListPlaylists(PlaylistSortEnum Sort = PlaylistSortEnum.recent, int Limit = 100, int OffSet = 1)
        {
            string flds = string.Join(",", GetStringsFromClassConstants(typeof(FieldsPlaylist)));

            return(await Core.SDK.ListPlaylists("me", flds, Sort, Limit, OffSet));
        }
Example #3
0
        public static async Task <JSON_ListPlaylists> ListPlaylists(string UserID, string Fields, PlaylistSortEnum Sort = PlaylistSortEnum.recent, int Limit = 100, int OffSet = 1)
        {
            var parameters = new Dictionary <string, string>
            {
                { "fields", Fields },
                { "limit", Limit.ToString() },
                { "page", OffSet.ToString() },
                { "sort", Sort.ToString() }
            };

            using (HtpClient localHttpClient = new HtpClient(new HCHandler()))
            {
                HttpResponseMessage ResPonse = await localHttpClient.GetAsync(new pUri($"/user/{UserID}/playlists", parameters)).ConfigureAwait(false);

                string result = await ResPonse.Content.ReadAsStringAsync();

                return(ResPonse.IsSuccessStatusCode ? JsonConvert.DeserializeObject <JSON_ListPlaylists>(result, JSONhandler) : throw ShowError(result));
            }
        }