예제 #1
0
		public static PlaylistsList Paginate(Dictionary<string,string> query, Client client) {

			var playlists = new PlaylistsList (client);

			playlists.records.Read(query);
			playlists.Initialize ();

			return playlists;
		}
예제 #2
0
		public static IEnumerable<Playlist> EachItem(Dictionary<string, string> query, Client client) {

			var playlists = new PlaylistsList (client);

			playlists.records.Read (query);

			do {

				playlists.Initialize ();

				foreach (var item in playlists.Page) {
					yield return item;
				}

			} while (playlists.records.Next());

		}
예제 #3
0
        public static void ReadingPlaylistsList(string id, string token)
        {
            try {
                Console.WriteLine("--EachItem()--");
                foreach (Playlist item in PlaylistsList.EachItem())
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }

                Console.WriteLine("--EachItem(query)--");

                Dictionary <string, string> query = new Dictionary <string, string>()
                {
                    { "sort", "created_at" },
                    { "order", "desc" },
                    { "per_page", "2" }
                };

                Client client = new Client()
                {
                    CfgClientId = id, CfgAuthToken = token
                };
                foreach (var item in PlaylistsList.EachItem(query, client))
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }

                Console.WriteLine("--Paginate--");

                var items1 = PlaylistsList.Paginate();
                foreach (var item in items1.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }

                Console.WriteLine("--Paginate(query)--");

                var items2 = PlaylistsList.Paginate(query, new Client());

                Console.WriteLine("--Paginate(query)--Initial-First--");
                foreach (var item in items2.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }

                while (items2.Next())
                {
                    Console.WriteLine("--Paginate(query)--Next--");

                    foreach (var item in items2.Page)
                    {
                        Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                    }
                }

                Console.WriteLine("--Paginate(query)--Previous--");
                items2.Prevous();
                foreach (var item in items2.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }

                Console.WriteLine("--Paginate(query)--Last--");
                items2.Last();
                foreach (var item in items2.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }

                Console.WriteLine("--Paginate(query)--First--");
                items2.First();
                foreach (var item in items2.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " Title: " + item["title"]);
                }
            } catch (VzaarApiException ve) {
                Console.Write("!!!!!!!!! EXCEPTION !!!!!!!!!");
                Console.WriteLine(ve.Message);
            } catch (Exception e) {
                Console.Write("!!!!!!!!! EXCEPTION !!!!!!!!!");
                Console.WriteLine(e.Message);

                if (e is AggregateException)
                {
                    AggregateException ae = (AggregateException)e;

                    var flatten = ae.Flatten();

                    foreach (var fe in flatten.InnerExceptions)
                    {
                        if (fe is VzaarApiException)
                        {
                            Console.WriteLine(fe.Message);
                        }
                    }
                }
            }
        }
예제 #4
0
		public static IEnumerable<Playlist> EachItem(Client client) {
			return PlaylistsList.EachItem (new Dictionary<string, string> (), client);
		}
예제 #5
0
		public static PlaylistsList Paginate(Client client){
			return PlaylistsList.Paginate (new Dictionary<string, string> (), client);
		}
예제 #6
0
		public static PlaylistsList Paginate(){
			return PlaylistsList.Paginate (new Dictionary<string, string> ());
		}