@tomlahav/cms-sdk
v0.0.9
Published
1. SDKClient.getInstance() gets the singleton instance 2. client must be initalized before use with following values: 1. LD_AUTH_TOKEN=auth token from LD for API 2. LD_PROJECT_ID=project within LD to interact with 3. LD_ENV=Launchdarkly envir
Downloads
5
Readme
Instructions
- SDKClient.getInstance() gets the singleton instance
- client must be initalized before use with following values:
- LD_AUTH_TOKEN=auth token from LD for API
- LD_PROJECT_ID=project within LD to interact with
- LD_ENV=Launchdarkly environment name
Main ways of using
- client.init(config: IConfig) =>
- Initalizes SDK with LaunchDarkly auth and environment values
- client.getValueOrCreate(contentNamespace, contentKey) =>
- If combination of namespace and key exist, this will return the value stored
- If combination of namespace and key does NOT exist, SDK will create a stub in service with placeholder text and return placeholder value
- client.getValue(contentNamespace, contentKey) =>
- returns a single value by namespace and key but does NOT create missing entries
Other available methods for devs
- getFlagValue(contentNamespace)
- gets raw value from Variation 1 of a specific flag
- updateContentEntry(data: IUpdateContent)
- Updates/Overwrites a variation
- createContentEntry(dto: ICreateContentEntryDTO)
- Creates a new Flag in LaunchDarkly with an Optional Content or default placeholder text
- deleteContentEntry(contentNamespace: string)
- Deletes a LaunchDarkly flag by Key
Interfaces:
export interface IConfig {
LD_AUTH_TOKEN: string,
LD_PROJECT_ID: string,
LD_ENV: string
}
export interface ICreateContentEntryDTO {
contentNamespace: string,
contentKey: string,
contentName?: string,
contentValue?: string
}
export interface IUpdateContent {
contentNamespace: string,
newValue: json
variation?: number,
}