@@ -35,23 +35,47 @@ function TradeoffAnalytics(options) {
3535 * The resolution contains a set of optimal options,
3636 * their analytical characteristics, and representation on a 2D space.
3737 *
38- * @param {Array } params .columns List of possible objectives
39- * @param {String } params .subject Name of the decision problem
40- * @param {String } params .options A list of options. Typically, the rows in a
38+ * @param {Array } requestBody .columns List of possible objectives
39+ * @param {String } requestBody .subject Name of the decision problem
40+ * @param {String } requestBody .options A list of options. Typically, the rows in a
4141 * table representation of your data
42+ * @param {String } metadataHeader Value of the x-watson-metadata header to be forwarded
43+ * for analytics purposes
4244 */
43- TradeoffAnalytics . prototype . dilemmas = function ( params , callback ) {
45+ TradeoffAnalytics . prototype . dilemmas = function ( requestBody , callback , metadataHeader ) {
4446 var parameters = {
4547 options : {
4648 method : 'POST' ,
4749 url : '/v1/dilemmas' ,
48- body : params ,
49- json : true ,
50+ body : requestBody ,
51+ headers : {
52+ 'x-watson-metadata' : metadataHeader
53+ } ,
54+ json : true
5055 } ,
5156 requiredParams : [ 'columns' , 'subject' , 'options' ] ,
5257 defaultOptions : this . _options
5358 } ;
5459 return requestFactory ( parameters , callback ) ;
5560} ;
5661
62+ /**
63+ * Forward events from the Tradeoff Analytics widget to the service
64+ */
65+ TradeoffAnalytics . prototype . events = function ( requestBody , callback , metadataHeader ) {
66+ var parameters = {
67+ options : {
68+ method : 'POST' ,
69+ url : '/v1/events' ,
70+ body : requestBody ,
71+ headers : {
72+ 'x-watson-metadata' : metadataHeader
73+ } ,
74+ json : true
75+ } ,
76+ defaultOptions : this . _options
77+ } ;
78+ return requestFactory ( parameters , callback ) ;
79+ } ;
80+
5781module . exports = TradeoffAnalytics ;
0 commit comments