1.0.2 • Published 3 years ago
wasabi-assignment v1.0.2
wasabi-assignment-pkg
NPM module to submit-generate-fetch user bucket assignment data in Wasabi
Install
$ npm install wasabi-assignment
Usage
The function in the package takes 7 params as argument out of which 4 are compulsory and 3 are optional. We'll be explaining the significance of the seven params here :
- wasabiURL : The URL where your wasabi is hosted. If it is on local, it'll be http://localhost:8080
- userID : The unique ID of the user for which asssignment is being done.
- appName : The Application Name (mentioned while creating the experiment on WASABI).
- experimentLabel : The Experiment Label (mentioned while creating the experiment on WASABI).
- context (optional) : Optional param. This param specifies context for the experiment, e.g. PROD, QA. By default it is 'PROD'.
- createAssignment (optional) : Optional param. This specifies whether an assignment should be generated if one doesn't exist. By default it is 'true'.
- ignoreSamplingPercent (optional) : Optional param. This specifies whether the sampling percent for the experiment should be ignored, forcing the user into the experiment (if eligible). By default it is 'false'.
const wasabiAssignment = require('wasabi-assignment');
const data = await wasabiAssignment(wasabiURL, userID, appName, experimentLabel, context(optional), createAssignment(optional), ignoreSamplingPercent(optional));
console.log(data);
// => {
// "cache": true,
// "payload": "orange",
// "assignment": "BucketB",
// "context": "PROD",
// "status": "EXISTING_ASSIGNMENT"
// }