JS SDK
Retsly Core SDK Version 2. Useful for clientside and node integration with Retsly.
Installation
``
bash
$ npm install retsly/js-sdk
`
Usage
`
js
var Retsly = require('js-sdk')
var retsly = Retsly.create(ACCESS_TOKEN, [VENDOR]);
var request = retsly.listings()
.query({bedrooms: 3})
.getAll();
`
API
$3
Returns a new instance of Retsly
. Requires an API token and optionally set the vendor (the MLS data source).$3
Returns a new Request
for the Listings resource.$3
Returns a new Request
for the Agents resource.$3
Returns a new Request
for the Offices resource.$3
Returns a new Request
for the Openhouses resource.$3
Appends the query to the querystring.
`
js
request.query({bedrooms: 3})
.query({bathrooms: {gt: 4});
`
$3
Alias for request.query({limit: n})
;$3
Alias for request.query({offset: n})
;$3
Helper function for building queries, works with different signatures.
`
js
request.where(['bedrooms', 'lt', 4])
.where('livingArea', 'gt', 3000)
.where('bathrooms', 3)
.where('garageSpaces eq 2');
`
$3
Gets a single document with id, optionally takes a callback$3
Gets an array of documents that match the query criteria, optionally takes a callback$3
Gets a single document that match the optional query criteria, and optionally takes a callback. It sets the limit to one and only return the first result and not an array.$3
Alias for request.findAll(query, callback)
$3
Alias for request.findAll({}, callback)
$3
callbacks follow standard node syntax of:
`
js
cb(err, res);
``