private static void Main() { // ************ Configuration *************** const string apiKey = "ac1b0b1572524640a0ecc54de453ea9f"; FundaApi.RateLimiter.Set(100, TimeSpan.FromMinutes(1)); // ********** End configuration ************* using var cancelTokenSource = new CancellationTokenSource(); var funda = new FundaApi(apiKey); var makelaarTop10 = funda.ForSale(QueryAmsterdam, cancelTokenSource.Token) .GroupBy(o => o.MakelaarId) .Select(m => new MakelaarAggregateResult() { AantalObjecten = m.Count(), Makelaar = m.First().MakelaarNaam, Koopprijs = m.Sum(_ => _.Koopprijs), Woonoppervlakte = m.Sum(_ => _.Woonoppervlakte) }) .OrderByDescending(_ => _.AantalObjecten) .Take(10); Console.WriteLine("Top 10 realtors in Amsterdam selling properties"); Console.WriteLine("---------------------------"); Console.WriteLine(TableFormatter.Format(makelaarTop10)); var makelaarTuinTop10 = funda.ForSale(QueryAmsterdamGarden, cancelTokenSource.Token) .GroupBy(o => o.MakelaarId) .Select(m => new MakelaarAggregateResult() { AantalObjecten = m.Count(), Makelaar = m.First().MakelaarNaam, Koopprijs = m.Sum(_ => _.Koopprijs), Woonoppervlakte = m.Sum(_ => _.Woonoppervlakte) }) .OrderByDescending(_ => _.AantalObjecten) .Take(10); Console.WriteLine("Top 10 realtors in Amsterdam selling properties with a garden"); Console.WriteLine("---------------------------"); Console.WriteLine(TableFormatter.Format(makelaarTuinTop10)); }
public void SetUp() { _apiClientStub = new ApiClientStub(); _fundaApi = new FundaApi(_apiClientStub, new FundaApiSettings(2, 1000), new NullLogger <FundaApi>()); }