JSPM

qansigliere-launchdarkly-api-integration

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2502
  • Score
    100M100P100Q126402F
  • License MIT

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

Package Exports

  • qansigliere-launchdarkly-api-integration
  • qansigliere-launchdarkly-api-integration/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qansigliere-launchdarkly-api-integration) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

LaunchDarkly API Integration

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

Author

https://www.youtube.com/@QANSIGLIERE/

Support the project

https://buymeacoffee.com/qansigliere

Installation

Using npm npm i qansigliere-launchdarkly-api-integration

How to use it

Create a *.env file

Create any *.env file (like launchdarkly.env) and write the following information in the created file

export LAUNCHDARKLY_API_TOKEN="__YOUR_APIKEY__"

Make the *.env file works

Just run in the terminal the following command: source launchdarkly.env

Contexts

Evaluate flags for context instance

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',
    );

Context Attribute Names

The documentation is present here

  let newIntegration = new LaunchDarkly_API();
  let request = await newIntegration.getContextAttributeNames(
    "demo",
    "development"
  );

Contexts

The documentation is present here

  let newIntegration = new LaunchDarkly_API();
  let request = await newIntegration.getContexts(
    "demo",
    "development",
    "user",
    "1"
  );

Search for contexts

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',
    );

Environments

List Environments

The documentation is present here

  let newIntegration = new LaunchDarkly_API();
  let request = await newIntegration.getListEnvironments("demo");

Feature Flags

List Feature Flags

The documentation is present here

  let newIntegration = new LaunchDarkly_API();
  let request = await newIntegration.getListFeatureFlags("demo");

Update feature flag

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',
    );

Improvements & Suggestions

https://forms.gle/GZbS9hw42tSYJxKL7