コード例 #1
0
ファイル: PresetsList.cs プロジェクト: lbsbv/vzaar-api-net
        public static PresetsList Paginate(Dictionary <string, string> query, Client client)
        {
            var presets = new PresetsList(client);

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

            return(presets);
        }
コード例 #2
0
ファイル: PresetsList.cs プロジェクト: lbsbv/vzaar-api-net
        public static IEnumerable <Preset> EachItem(Dictionary <string, string> query, Client client)
        {
            var presets = new PresetsList(client);

            presets.records.Read(query);

            do
            {
                presets.Initialize();

                foreach (var item in presets.Page)
                {
                    yield return(item);
                }
            } while (presets.records.Next());
        }
コード例 #3
0
        //Read EncodingPresets
        public static void ReadingEncodingPresetsList(string id, string token)
        {
            try {
                Console.WriteLine("--EachItem()--");
                foreach (Preset item in PresetsList.EachItem())
                {
                    Console.WriteLine("Id: " + item["id"] + " Name: " + item["name"]);
                }

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

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

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

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

                var items1 = PresetsList.Paginate();
                foreach (var item in items1.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " Name: " + item["name"]);
                }

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

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

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

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

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

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

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

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

                Console.WriteLine("--Rate Information--");
                var client3 = items2.GetClient();

                Console.WriteLine("RateLimit: " + client3.RateLimit);
                Console.WriteLine("RateRemaining: " + client3.RateRemaining);
                Console.WriteLine("RateReset: " + client3.RateReset);
            } 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
ファイル: PresetsList.cs プロジェクト: lbsbv/vzaar-api-net
 public static IEnumerable <Preset> EachItem(Client client)
 {
     return(PresetsList.EachItem(new Dictionary <string, string> (), client));
 }
コード例 #5
0
ファイル: PresetsList.cs プロジェクト: lbsbv/vzaar-api-net
 public static PresetsList Paginate(Client client)
 {
     return(PresetsList.Paginate(new Dictionary <string, string> (), client));
 }
コード例 #6
0
ファイル: PresetsList.cs プロジェクト: lbsbv/vzaar-api-net
 public static PresetsList Paginate()
 {
     return(PresetsList.Paginate(new Dictionary <string, string> ()));
 }