|
220 | 220 | * |
221 | 221 | * @param user {object} the user-information |
222 | 222 | * @param nrOfRecommendations {number|null} the amount of recommendations to get |
| 223 | + * @param category {string|null} contains an optional category for the recommendation |
223 | 224 | * @param sign {boolean|null} true if a signature should be added (needs the secret to be configured - not recommended in open systems), otherwise false (can be null or undefined) |
224 | 225 | * @param onReady {function|null} unction to be executed after triggering the recommendation request |
225 | 226 | */ |
|
228 | 229 |
|
229 | 230 | overload.overload({ |
230 | 231 | 'Object,Function': function (user, callback) { |
231 | | - Breinify.recommendationUser(user, 3, false, function (data) { |
| 232 | + Breinify.recommendationUser(user, 3, null, false, function (data) { |
232 | 233 | _privates.ajax(url, data, callback, callback); |
233 | 234 | }); |
234 | 235 | }, |
235 | 236 | 'Object,Number,Function': function (user, nrOfRecommendations, callback) { |
236 | | - Breinify.recommendationUser(user, nrOfRecommendations, false, function (data) { |
| 237 | + Breinify.recommendationUser(user, nrOfRecommendations, null, false, function (data) { |
| 238 | + _privates.ajax(url, data, callback, callback); |
| 239 | + }); |
| 240 | + }, |
| 241 | + 'Object,Number,String,Function': function (user, nrOfRecommendations, category, callback) { |
| 242 | + Breinify.recommendationUser(user, nrOfRecommendations, category, false, function (data) { |
237 | 243 | _privates.ajax(url, data, callback, callback); |
238 | 244 | }); |
239 | 245 | }, |
240 | 246 | 'Object,Number,Boolean,Function': function (user, nrOfRecommendations, sign, callback) { |
241 | | - Breinify.recommendationUser(user, nrOfRecommendations, sign, function (data) { |
| 247 | + Breinify.recommendationUser(user, nrOfRecommendations, null, sign, function (data) { |
| 248 | + _privates.ajax(url, data, callback, callback); |
| 249 | + }); |
| 250 | + }, |
| 251 | + 'Object,Number,String,Boolean,Function': function (user, nrOfRecommendations, category, sign, callback) { |
| 252 | + Breinify.recommendationUser(user, nrOfRecommendations, category, sign, function (data) { |
242 | 253 | _privates.ajax(url, data, callback, callback); |
243 | 254 | }); |
244 | 255 | } |
|
250 | 261 | * |
251 | 262 | * @param user {object} the user-information |
252 | 263 | * @param nrOfRecommendations {number|null} the amount of recommendations to get |
| 264 | + * @param category {string|null} contains an optional category for the recommendation |
253 | 265 | * @param sign {boolean|null} true if a signature should be added (needs the secret to be configured - not recommended in open systems), otherwise false (can be null or undefined) |
254 | 266 | * @param onReady {function|null} function to be executed after successful user creation |
255 | 267 | */ |
256 | | - Breinify.recommendationUser = function (user, nrOfRecommendations, sign, onReady) { |
| 268 | + Breinify.recommendationUser = function (user, nrOfRecommendations, category, sign, onReady) { |
257 | 269 |
|
258 | 270 | var _onReady = function (user) { |
259 | 271 | if ($.isFunction(onReady)) { |
|
286 | 298 | } |
287 | 299 | } |
288 | 300 |
|
| 301 | + category = typeof category === 'undefined' || category === null ? '' : category; |
| 302 | + |
289 | 303 | // create the data set |
290 | 304 | var data = { |
291 | 305 | 'user': user.all(), |
292 | 306 |
|
293 | 307 | 'recommendation': { |
294 | | - 'numRecommendations': nrOfRecommendations |
| 308 | + 'numRecommendations': nrOfRecommendations, |
| 309 | + 'recommendationCategory': category |
295 | 310 | }, |
296 | 311 |
|
297 | 312 | 'apiKey': _config.get(ATTR_CONFIG.API_KEY), |
|
0 commit comments