diff --git a/index.js b/index.js index 210ccc5..49ce1d8 100644 --- a/index.js +++ b/index.js @@ -309,6 +309,15 @@ AlchemyAPI.prototype.taxonomies = function(data, options, cb) { this._doRequest(this._getQuery(data, options, "GetRankedTaxonomy"), cb); }; +/** + * Function to return emotions of the data passed in + * @param {String} data The text to be passed to Alchemy can either a url, html text or plain text + * @return {Object} + */ +AlchemyAPI.prototype.emotions = function(data, options, cb) { + this._doRequest(this._getQuery(data, options, "GetEmotion"), cb); +}; + /** * Function to return category of the data passed in * @param {String} data The text to be passed to Alchemy can either a url, html text or plain text diff --git a/test/index.js b/test/index.js index 7b1eb9e..4d850a7 100644 --- a/test/index.js +++ b/test/index.js @@ -83,6 +83,15 @@ module.exports = { test.done(); }); }, + 'get emotions': function(test) { + var alchemy = new Alchemy(apikey); + alchemy.emotions(testURL, {}, function(error, result) { + //console.log(result); + test.ifError(error); + //test.deepEqual(result.status, "OK"); + test.done(); + }); + }, 'get entities': function(test) { var alchemy = new Alchemy(apikey); alchemy.entities(testURL, {}, function(error, result) {