Giter Club home page Giter Club logo

educational-experiment-service-client-libs's Introduction

UPGRADE CLIENT SIDE SDK

Exported Class

UpgradeClient named class is exported from this library

Functions

setHostUrl (url: string)

This is a static method to set host URL which can be accessed by
UpgradeClient.setHostUrl(url)

Initialize User

Two ways for initializing users const upClient = UpgradeClient('userId'); const upClient = UpgradeClient('userId', 'token');

setAltUserIds(altUserIds: string[])

Set alternative user ids for current user
upClient.setAltUserIds(altUserIds)

setGroupMembership (group: Map<string, Array>)

Updates/Set the group membership of the initialized user
upClient.setGroupMembership(group)

setWorkingGroup (workingGroup: Map<string, string>)

Updates/Set the working group of the initialized user
upClient.setWorkingGroup(workingGroup)

getAllExperimentConditions(context: string)

Get all the experiment assignments for the initialized user
upClient.getAllExperimentConditions(context)

getExperimentCondition (experimentPoint: string, partitionId?: string)

Returns the Experiment Condition for the partition and point received from the getAllExperimentConditions for the initialized user
upClient.getExperimentCondition(experimentPoint)
upClient.getExperimentCondition(experimentPoint, partitionId)

markExperimentPoint (experimentPoint: string, partitionId?: string)

Calls markExperimentPoint for experiment point and partitionId. It will use the user definition from initialized user
upClient.markExperimentPoint(experimentPoint)
upClient.markExperimentPoint(experimentPoint, partitionId)

failedExperimentPoint(experimentPoint: string, reason: string, experimentId?: string)

Use this function to report failure with given reason
upClient.failedExperimentPoint(experimentPoint, reason)
upClient.failedExperimentPoint(experimentPoint, reason, experimentId)

log(value: ILogInput[])

Use this function to log data

interface ILogMetrics {
  attributes: any;
  groupedMetrics: ILogGroupMetrics[];
}

interface ILogGroupMetrics {
  groupClass: string;
  groupKey: string;
  groupUniquifier: string;
  attributes: any;
}

interface ILogInput {
  timestamp: string;
  metrics: ILogMetrics;
}
upClient.log(value)

addMetrics(metrics: Array<IGroupMetric | ISingleMetric>)

Use this function to add metrics in upgrade system

interface IGroupMetric {
    groupClass: string;
    allowedKeys: string[];
    attributes: Array<IGroupMetric | ISingleMetric>;
}
interface ISingleMetric {
    metric: string;
    datatype: IMetricMetaData;
    allowedValues?: Array<string | number>;
}
enum IMetricMetaData {
  CONTINUOUS = 'continuous',
  CATEGORICAL = 'categorical'
}
upClient.addMetrics(metrics)

getAllFeatureFlags()

Use this function to get feature flags list
upClient.getAllFeatureFlags()

getFeatureFlag(key: string)

Use this function to get feature flag matched to given key upClient.getFeatureFlag(key)

Example

Sample Code

educational-experiment-service-client-libs's People

Contributors

vivekfitkariwala avatar jd2455 avatar jerith666 avatar noopurprj avatar ppljdhirapara avatar mfugate1 avatar dhavalocked avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.