The main idea of this library created in the JavaScript language is to provide a ready-made set of API methods for integration with LaunchDarkly
https://www.youtube.com/@QANSIGLIERE/
https://buymeacoffee.com/qansigliere
Using npm npm i qansigliere-launchdarkly-api-integration
Create any *.env file (like launchdarkly.env) and write the following information in the created file
export LAUNCHDARKLY_API_TOKEN="__YOUR_APIKEY__"
Just run in the terminal the following command: source launchdarkly.env
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.postEvaluateFlagsForContextInstance(
'demo',
'development',
{ key: '12331', kind: 'user' },
'filter=query equals qan-flag-name',
);
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.getContextAttributeNames(
"demo",
"development"
);
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.getContexts(
"demo",
"development",
"user",
"1"
);
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.postSearchForContexts(
'demo',
'development',
{ filter: 'q equals "11156"', sort: '-ts' },
'includeTotalCount=true',
);
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.getListEnvironments("demo");
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.getListFeatureFlags("demo");
The documentation is present here
let newIntegration = new LaunchDarkly_API();
let request = await newIntegration.patchUpdateFeatureFlag(
'demo',
'myFlagName',
{
comment: '',
environmentKey: 'development',
instructions: [
{
kind: 'removeTargets',
contextKind: 'user',
values: ['111561'],
variationId: 'ee84241f-3a11-472e-bdcf-8eb6bc2b1f8d',
},
{
kind: 'addTargets',
contextKind: 'user',
values: ['111561'],
variationId: 'db2d8752-442d-4a8e-811c-de7d969208cf',
},
],
},
'ignoreConflicts=true',
);