rets-client
Advanced tools
Comparing version 4.1.0 to 4.1.1
{ | ||
"name": "rets-client", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "A RETS client (Real Estate Transaction Standard).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -71,7 +71,5 @@ rets-client | ||
#### Example RETS Session | ||
##### Output helper used in many examples below | ||
```javascript | ||
var rets = require('rets-client'); | ||
var fs = require('fs'); | ||
var photoSourceId = '12345'; // <--- dummy example ID! this will usually be a MLS number / listing id | ||
var outputFields = function(obj, opts) { | ||
@@ -104,2 +102,9 @@ if (!opts) opts = {}; | ||
}; | ||
``` | ||
#### Example RETS Session | ||
```javascript | ||
var rets = require('rets-client'); | ||
var fs = require('fs'); | ||
var photoSourceId = '12345'; // <--- dummy example ID! this will usually be a MLS number / listing id | ||
@@ -212,3 +217,3 @@ // establish connection to RETS server which auto-logs out when we're done | ||
// resolves only once we're done processing the stream | ||
return new Promise(function (reject, resolve) { | ||
return new Promise(function (resolve, reject) { | ||
var retsStream = client.search.stream.query("OpenHouse", "OPENHOUSE", "(OpenHouseType=PUBLIC),(ActiveYN=1)", {limit:100, offset:10}); | ||
@@ -262,3 +267,3 @@ var processorStream = through2.obj(function (event, encoding, callback) { | ||
var i=0; | ||
photoStream.on('data', function (photoEvent) { | ||
photoStream.objectStream.on('data', function (photoEvent) { | ||
i++; | ||
@@ -269,3 +274,3 @@ if (photoEvent.error) { | ||
console.log("Photo " + (i + 1) + ":"); | ||
outputFields(photoResults.objects[i].headerInfo); | ||
outputFields(photoEvent.headerInfo); | ||
fileStream = fs.createWriteStream( | ||
@@ -276,3 +281,3 @@ "/tmp/photo" + i + "." + photoEvent.headerInfo.contentType.match(/\w+\/(\w+)/i)[1]); | ||
}); | ||
photoStream.on('end', function () { | ||
photoStream.objectStream.on('end', function () { | ||
resolve(); | ||
@@ -279,0 +284,0 @@ }); |
82164
296