Skip to content

Latest commit

 

History

History
45 lines (39 loc) · 1.42 KB

README.md

File metadata and controls

45 lines (39 loc) · 1.42 KB

PredictionIO Client

Installation

Configuration

Set up PredictionIO credentials

var prediction = require('predictionio');
prediction.config.APP_KEY = '...';
prediction.config.APP_URL = 'http://localhost:8000' // default

Usage

Manage users

var prediction = require('predictionio');
prediction.user.getUser(userId, customOptions, callback);
prediction.user.postUser(userId, customOptions, callback);
prediction.user.deleteUser(userId, customOptions, callback);

Manage items

var prediction = require('predictionio');
prediction.item.getItem(itemId, customOptions, callback);
prediction.item.postItem(itemId, customOptions, callback);
prediction.item.deleteItem(itemId, customOptions, callback);

Create actions

var prediction = require('predictionio');
prediction.action.rate(userId, itemId, rate, customOptions, callback);
prediction.action.like(userId, itemId, customOptions, callback);
prediction.action.dislike(userId, itemId, customOptions, callback);
prediction.action.view(userId, itemId, customOptions, callback);
prediction.action.conversion(userId, itemId, customOptions, callback);

Fetch similar/recommended items

var prediction = require('predictionio');
prediction.engine.similarItems(engineName, itemId, maxNumber, customOptions, callback);
prediction.engine.recommendedItems(engineName, userId, maxNumber, customOptions, callback);