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); } }
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); } }
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); }