recommendation-library

1.0.2 • Public • Published

recommendation-library

To get product recommendations

NPM JavaScript Style Guide

Install

npm install --save recommendation-library

Usage

const recommendations = require('recommendation-library');

const queryBody = {
tenant: 'tenant',
lob: 'lob',
countries:'country_code',
channels:'channels',
components: 'components',
customer_id:'customer_id',
item_id:'item_id',
event_name:'event_name'
};

const tokenBody = {
    tokenAvailable: 'TRUE/FALSE',
    CLIENT_ID: 'CLIENT_ID',
    CLIENT_SECRET: 'CLIENT_SECRET',
    token: 'TOKEN_HERE_IF_AVAILABLE'
};

async function getRecommendations(){
    let response = await recommendations.getRecommendations(queryBody, tokenBody);
    console.log("recommendation response:: " + JSON.stringify(response));
}

const metricBody = {
    token: 'YOUR_TOKEN_HERE',
    tenant: 'TENANT_HERE',
    recommendation_id: 'RECOMMENDATION_ID',
    action: 'ACTION_HERE'
}

async function updateMetric(){
    let response = await recommendations.updateMetric(metricBody);
    console.log("updateMetric response:: " + JSON.stringify(response));
}
getRecommendations();
updateMetric();

The token generated and the tenant will be stored in sessionStorage after the first call with following keys: 'prToken': 'AUTHENTICATION_TOKEN' 'prTenant': 'TENANT'

License

MIT © ramiBoss

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i recommendation-library

    Weekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    5.59 kB

    Total Files

    3

    Last publish

    Collaborators

    • ramiz_khan