Ejemplo n.º 1
0
        private static DatabasesResponse DownloadDatabase(int page)
        {
            using (WebClient client = new WebClient())
            {
                var json = client.DownloadString(Utils.Constants.DATABASES_URL + "?page=" + page + "&api_key=" + Utils.Constants.API_KEY);
                DatabasesResponse response =
                    JsonConvert.DeserializeObject <DatabasesResponse>(json, new JsonSerializerSettings {
                    ContractResolver = Utils.Converters.MakeUnderscoreContract()
                });

                return(response);
            }
        }
Ejemplo n.º 2
0
        private static async Task DownloadDatabasesAsync(int page)
        {
            using (WebClient client = new WebClient())
            {
                string data = await client.DownloadStringTaskAsync(new Uri(Utils.Constants.DATABASES_URL + "?page=" + page + "&api_key=" + Utils.Constants.API_KEY));

                DatabasesResponse response =
                    JsonConvert.DeserializeObject <DatabasesResponse>(data, new JsonSerializerSettings {
                    ContractResolver = Utils.Converters.MakeUnderscoreContract()
                });

                Utils.ConsoleInformer.PrintProgress("1A", "Fetching databases: ", Utils.Helpers.GetPercent(page, response.Meta.TotalPages).ToString() + "%");
                databases.AddRange(response.Databases);
            }
        }
Ejemplo n.º 3
0
        public async Task <List <string> > GetListDatabase(string url)
        {
            DatabasesResponse response = await restClient.PostAsync <DatabasesResponse, JObject>(url + ApiURI.URI_GET_DATABASE_LIST, new JObject());

            return(response?.Result);
        }