static void Main() { ZooplaDotNetClient client = new ZooplaDotNetClient("INSERT KEY HERE"); StandardLocationParameters locationParameters = new StandardLocationParameters(); Console.WriteLine("Enter in a postcode:"); locationParameters.PostCode = Console.ReadLine(); locationParameters.OutputType = OutputType.OUTCODE; locationParameters.AreaType = AreaType.POSTCODES; Console.WriteLine("Enter minimum number of beds: "); locationParameters.MinimumBeds = Convert.ToInt32(Console.ReadLine()); ListingBaseOptions listingBaseOptions = new ListingBaseOptions { PageSize = 100, PageNumber = 1, OrderBy = OrderBy.AGE, ListingStatus = "sale" }; Console.WriteLine("Enter the max price you are willing to pay:"); int MaxPrice = Convert.ToInt32(Console.ReadLine()); var listingResponse = client.GetPropertyListings(locationParameters, listingBaseOptions); int AverageCurrentMarketPrice = (int)CalculateAverageHouseValue(listingResponse.Result); CalculateUndervaluedHouses(listingResponse.Result, AverageCurrentMarketPrice, MaxPrice); Console.WriteLine(AverageCurrentMarketPrice); }
/// <summary> /// Gets listings of properties by IDs for sale, rent or either, depending on the supplied options. /// </summary> /// <param name="options">The byId, rental or sales listing options.</param> /// <returns>A list of properties matching the given criteria.</returns> public Task <PropertyListingsResponse> GetPropertyListingsByIds(ListingBaseOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (string.IsNullOrEmpty(options.ListingId)) { throw new ArgumentNullException(nameof(options.ListingId), "The listing options object must have a listingId set"); } string url = Endpoints.PROPERTY_LISTINGS + "?api_key=" + _accessToken; url += options.GetUrlParams(); return(_httpClient.GetObject <PropertyListingsResponse>(url)); }
/// <summary> /// Gets listings of properties either for sale or rent, depending on the supplied options. /// </summary> /// <param name="locationParams">The standard location parameters.</param> /// <param name="options">The rental or sales listing options.</param> /// <returns>A list of properties matching the given criteria.</returns> public Task <PropertyListingsResponse> GetPropertyListings(StandardLocationParameters locationParams, ListingBaseOptions options) { string url = Endpoints.PROPERTY_LISTINGS + "?api_key=" + _accessToken; url += locationParams.GetUrlParams(); url += options.GetUrlParams(); return(_httpClient.GetObject <PropertyListingsResponse>(url)); }