Typescript SDK Overview
8 min
kickplan takes care of the complex business logic for monetization, using our sdk, your application only needs to manage access to features and track value metrics these functions are keyed by account for detailed terminology, please consult our documentation configuration to import the package using commonjs const { kickplanapi } = require('sdk typescript') or in es6 import { kickplanapi } = require('sdk typescript') after importing, please initialize your client const kickplan = new kickplanapi({ apikey 'your api key here', baseurl 'your url here' }) env variables are also supported via kickplan api key and kickplan base url respectively https //github com/kickplan/sdk typescript/blob/main/src/resources/features/index ts to check which features are resolvable await kickplan features resolve() to resolve features with context await kickplan features resolvewithaccount(accountid string) to resolve a specific feature with context await kickplan features isfeatureavailableforaccount(featurename string, accountid string) https //github com/kickplan/sdk typescript/blob/main/src/resources/accounts/index ts in order to resolve features for an account, kickplan needs to know an account key and the plan key they are on plan keys are not currently exposed in the api but will be soon await kickplan accounts post({ key string, plans? string\[] }) https //github com/kickplan/sdk typescript/blob/main/src/resources/metrics/index ts a request to set a value for a key metric await kickplan metrics setmetricskey({ key string, value string, timestamp date }) returns a response with https //github com/kickplan/sdk typescript/blob/v1/src/resources/metrics/types ts object https //github com/kickplan/sdk typescript/blob/main/src/resources/evaluation ts 4 evaluation methods are included kickplan evaluation getbooleanvalue(key, value) kickplan evaluation getstringvalue(key, value) kickplan evaluation getnumbervalue(key, value) kickplan evaluation getobjectvalue(key, value)
