Exemple #1
0
        /*
         * Creates a complete collection of all the real estate agents
         * within the specified search queries. And prints the top ten.
         *
         */
        static void GetTopTenAgents(FundaApi fundaApi, List <string> searchQueries)
        {
            Collector topTenAmsterdamCollector = new Collector();

            topTenAmsterdamCollector.GetAllApiResults(fundaApiKey, fundaApi, "koop", searchQueries);
            RealEstateAgent[] topTenAgents = topTenAmsterdamCollector.GetSortedArray();

            Print.AgentHeader();
            Print.FirstNAgents(topTenAgents, 10);
        }
Exemple #2
0
        /*
         * Loops over the different pages of the same Funda Api call untill there are no
         * objects in the result.
         *
         */
        public void GetAllApiResults(string fundaApiKey, FundaApi fundaApi, string type, List <string> searchQueries)
        {
            bool nonEmpty = true;
            int  page     = 0;

            while (nonEmpty)
            {
                string content = fundaApi.Request(fundaApiKey, "koop", searchQueries, page, 25);
                if (string.IsNullOrEmpty(content))
                {
                    break;
                }
                XmlDocument xmlContent = ConvertRequestContentToXML(content);
                nonEmpty = AddAgentsIntoDict(xmlContent);
                page++;
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            FundaApi fundaApi = new FundaApi();

            Console.WriteLine("Top 10 real estate agents in Amsterdam\n");
            List <string> searchQueries = new List <string> {
                "amsterdam"
            };

            GetTopTenAgents(fundaApi, searchQueries);

            Console.WriteLine("\n\nTop 10 real estate agents in Amsterdam with a garden\n");
            searchQueries = new List <string> {
                "amsterdam", "tuin"
            };
            GetTopTenAgents(fundaApi, searchQueries);

            Console.Read();
        }