Skip to content

miasmos/condos

Repository files navigation

Condos

npm version Known Vulnerabilities Build Status codecov

Condos is a promise-based Node.js library for the Condos.ca api.

Installation

Install condos and save to your package.json in one easy step.

With npm:

npm install condos --save

With yarn:

yarn add condos

Documentation

You may find the Condos documentation here.

Usage

  1. Import Condos into your application:
import Condos from 'condos';
  1. Call an api method to request data:

With Promises:

import Condos, { 
    Precision,
    GroupType,
    OfferType,
    NeighbourhoodTorontoDowntown,
    NeighbourhoodTorontoEastEnd,
    SublocalityToronto
} from 'condos';

Condos.listings({
    precision: Precision.Normal,
    neighbourhood: [
        NeighbourhoodTorontoDowntown.KingWest,
        NeighbourhoodTorontoEastEnd.EastEndDanforth,
    ],
    sublocality: [SublocalityToronto.Etobicoke],
    groupBy: GroupType.Neighbourhood,
    offer: OfferType.Sale,
}).then(data => {
  console.log(data);
});

With async/await:

import Condos, { 
    Precision,
    GroupType,
    OfferType,
    NeighbourhoodTorontoDowntown,
    NeighbourhoodTorontoEastEnd,
    SublocalityToronto
} from 'condos';

(async () => {
  const data = await Condos.listings({
      precision: Precision.Normal,
      neighbourhood: [
          NeighbourhoodTorontoDowntown.KingWest,
          NeighbourhoodTorontoEastEnd.EastEndDanforth,
      ],
      sublocality: [SublocalityToronto.Etobicoke],
      groupBy: GroupType.Neighbourhood,
      offer: OfferType.Sale,
  });
  console.log(data);
})();