diff --git a/README.md b/README.md index a86754e..b5fe1ba 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,17 @@ var Bing = require('node-bing-api')({ accKey: "your-account-key" }); Bing.web("Pizza", function(error, res, body){ console.log(body); }, + { + top: 10, // Number of results (max 50) + skip: 3, // Skip first 3 results + }); +``` + +#### Composite Search: +```js +Bing.composite("xbox", function(error, res, body){ + console.log(body); + }, { top: 10, // Number of results (max 50) skip: 3, // Skip first 3 results diff --git a/lib/bing.js b/lib/bing.js index 12b3248..7a7332a 100644 --- a/lib/bing.js +++ b/lib/bing.js @@ -22,7 +22,7 @@ var Bing = function( options ) { var defaults = { //Bing Search API URI - rootUri: "https://api.datamarket.azure.com/Bing/Search/", + rootUri: "https://api.datamarket.azure.com/Bing/Search/v1/", //Account Key accKey: null, @@ -131,6 +131,27 @@ Bing.prototype.web = function(query, callback, options) { Bing.prototype.search = Bing.prototype.web; +/** + * Performs a Bing search in the Composite vertical. + * + * @param {String} query Query term to search for. + * + * @param {requestCallback} callback Callback called with (potentially + * json-parsed) response. + * + * @param {Object} options Options to command, allows overriding + * of rootUri, accKey (Bing API key), + * userAgent, reqTimeout, top, skip, + * @function + */ +Bing.prototype.composite = function(query, callback, options) { + this.searchVertical(query, "Composite", callback, options); +}; + +// Alias Bing.search to Bing.web +// Note: Keep this for compatibility with older versions +Bing.prototype.search = Bing.prototype.composite; + /** * Performs a Bing search in the Images vertical. *