Have ideas to improve npm?Join in the discussion! »

    launchdarkly-api

    5.1.0 • Public • Published

    This repository contains a client library for LaunchDarkly's REST API. This client was automatically generated from our OpenAPI specification.

    This REST API is for custom integrations, data export, or automating your feature flag workflows. DO NOT use this client library to include feature flags in your web or mobile application. To integrate feature flags with your application, please see the SDK documentation

    launchdarkly-api

    LaunchDarklyApi - JavaScript client for launchdarkly-api Build custom integrations with the LaunchDarkly REST API This SDK is automatically generated by the Swagger Codegen project:

    • API version: 5.1.0
    • Package version: 5.1.0
    • Build package: io.swagger.codegen.languages.JavascriptClientCodegen For more information, please visit https://support.launchdarkly.com

    Installation

    For Node.js

    npm

    To publish the library as a npm, please follow the procedure in "Publishing npm packages".

    Then install it via:

    npm install launchdarkly-api --save
    Local development

    To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

    npm install

    Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

    npm link

    Finally, switch to the directory you want to use your launchdarkly-api from, and run:

    npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

    You should now be able to require('launchdarkly-api') in javascript files from the directory you ran the last command above from.

    git

    If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

    For browser

    The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

    browserify main.js > bundle.js

    Then include bundle.js in the HTML pages.

    Webpack Configuration

    Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

    module: {
    rules: [
    {
    parser: {
    amd: false
    }
    }
    ]
    }

    Documentation for API Endpoints

    All URIs are relative to https://app.launchdarkly.com/api/v2

    Class Method HTTP request Description
    LaunchDarklyApi.AccessTokensApi deleteToken DELETE /tokens/{tokenId} Delete an access token by ID.
    LaunchDarklyApi.AccessTokensApi getToken GET /tokens/{tokenId} Get a single access token by ID.
    LaunchDarklyApi.AccessTokensApi getTokens GET /tokens Returns a list of tokens in the account.
    LaunchDarklyApi.AccessTokensApi patchToken PATCH /tokens/{tokenId} Modify an access token by ID.
    LaunchDarklyApi.AccessTokensApi postToken POST /tokens Create a new token.
    LaunchDarklyApi.AccessTokensApi resetToken POST /tokens/{tokenId}/reset Reset an access token's secret key with an optional expiry time for the old key.
    LaunchDarklyApi.AuditLogApi getAuditLogEntries GET /auditlog Get a list of all audit log entries. The query parameters allow you to restrict the returned results by date ranges, resource specifiers, or a full-text search query.
    LaunchDarklyApi.AuditLogApi getAuditLogEntry GET /auditlog/{resourceId} Use this endpoint to fetch a single audit log entry by its resouce ID.
    LaunchDarklyApi.CustomRolesApi deleteCustomRole DELETE /roles/{customRoleKey} Delete a custom role by key.
    LaunchDarklyApi.CustomRolesApi getCustomRole GET /roles/{customRoleKey} Get one custom role by key.
    LaunchDarklyApi.CustomRolesApi getCustomRoles GET /roles Return a complete list of custom roles.
    LaunchDarklyApi.CustomRolesApi patchCustomRole PATCH /roles/{customRoleKey} Modify a custom role by key.
    LaunchDarklyApi.CustomRolesApi postCustomRole POST /roles Create a new custom role.
    LaunchDarklyApi.CustomerMetricsApi getEvaluations GET /usage/evaluations/{envId}/{flagKey} Get events usage by event id and the feature flag key.
    LaunchDarklyApi.CustomerMetricsApi getEvent GET /usage/events/{type} Get events usage by event type.
    LaunchDarklyApi.CustomerMetricsApi getEvents GET /usage/events Get events usage endpoints.
    LaunchDarklyApi.CustomerMetricsApi getMAU GET /usage/mau Get monthly active user data.
    LaunchDarklyApi.CustomerMetricsApi getMAUByCategory GET /usage/mau/bycategory Get monthly active user data by category.
    LaunchDarklyApi.CustomerMetricsApi getStream GET /usage/streams/{source} Get a stream endpoint and return timeseries data.
    LaunchDarklyApi.CustomerMetricsApi getStreamBySDK GET /usage/streams/{source}/bysdkversion Get a stream timeseries data by source show sdk version metadata.
    LaunchDarklyApi.CustomerMetricsApi getStreamSDKVersion GET /usage/streams/{source}/sdkversions Get a stream timeseries data by source and show all sdk version associated.
    LaunchDarklyApi.CustomerMetricsApi getStreams GET /usage/streams Returns a list of all streams.
    LaunchDarklyApi.CustomerMetricsApi getUsage GET /usage Returns of the usage endpoints available.
    LaunchDarklyApi.DataExportDestinationsApi deleteDestination DELETE /destinations/{projectKey}/{environmentKey}/{destinationId} Get a single data export destination by ID
    LaunchDarklyApi.DataExportDestinationsApi getDestination GET /destinations/{projectKey}/{environmentKey}/{destinationId} Get a single data export destination by ID
    LaunchDarklyApi.DataExportDestinationsApi getDestinations GET /destinations Returns a list of all data export destinations.
    LaunchDarklyApi.DataExportDestinationsApi patchDestination PATCH /destinations/{projectKey}/{environmentKey}/{destinationId} Perform a partial update to a data export destination.
    LaunchDarklyApi.DataExportDestinationsApi postDestination POST /destinations/{projectKey}/{environmentKey} Create a new data export destination
    LaunchDarklyApi.EnvironmentsApi deleteEnvironment DELETE /projects/{projectKey}/environments/{environmentKey} Delete an environment in a specific project.
    LaunchDarklyApi.EnvironmentsApi getEnvironment GET /projects/{projectKey}/environments/{environmentKey} Get an environment given a project and key.
    LaunchDarklyApi.EnvironmentsApi patchEnvironment PATCH /projects/{projectKey}/environments/{environmentKey} Modify an environment by ID.
    LaunchDarklyApi.EnvironmentsApi postEnvironment POST /projects/{projectKey}/environments Create a new environment in a specified project with a given name, key, and swatch color.
    LaunchDarklyApi.EnvironmentsApi resetEnvironmentMobileKey POST /projects/{projectKey}/environments/{environmentKey}/mobileKey Reset an environment's mobile key. The optional expiry for the old key is deprecated for this endpoint, so the old key will always expire immediately.
    LaunchDarklyApi.EnvironmentsApi resetEnvironmentSDKKey POST /projects/{projectKey}/environments/{environmentKey}/apiKey Reset an environment's SDK key with an optional expiry time for the old key.
    LaunchDarklyApi.FeatureFlagsApi copyFeatureFlag POST /flags/{projectKey}/{featureFlagKey}/copy Copies the feature flag configuration from one environment to the same feature flag in another environment.
    LaunchDarklyApi.FeatureFlagsApi deleteApprovalRequest DELETE /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Delete an approval request for a feature flag config
    LaunchDarklyApi.FeatureFlagsApi deleteFeatureFlag DELETE /flags/{projectKey}/{featureFlagKey} Delete a feature flag in all environments. Be careful-- only delete feature flags that are no longer being used by your application.
    LaunchDarklyApi.FeatureFlagsApi deleteFlagConfigScheduledChanges DELETE /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Delete a scheduled change on a feature flag in an environment.
    LaunchDarklyApi.FeatureFlagsApi flagsProjectKeyEnvironmentKeyFeatureFlagKeyDependentFlagsGet GET /flags/{projectKey}/{environmentKey}/{featureFlagKey}/dependent-flags Get dependent flags for the flag in the environment specified in path parameters
    LaunchDarklyApi.FeatureFlagsApi flagsProjectKeyFeatureFlagKeyDependentFlagsGet GET /flags/{projectKey}/{featureFlagKey}/dependent-flags Get dependent flags across all environments for the flag specified in the path parameters
    LaunchDarklyApi.FeatureFlagsApi getApprovalRequest GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Get a single approval request for a feature flag config
    LaunchDarklyApi.FeatureFlagsApi getApprovalRequests GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests Get all approval requests for a feature flag config
    LaunchDarklyApi.FeatureFlagsApi getExpiringUserTargets GET /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey} Get expiring user targets for feature flag
    LaunchDarklyApi.FeatureFlagsApi getFeatureFlag GET /flags/{projectKey}/{featureFlagKey} Get a single feature flag by key.
    LaunchDarklyApi.FeatureFlagsApi getFeatureFlagStatus GET /flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey} Get the status for a particular feature flag.
    LaunchDarklyApi.FeatureFlagsApi getFeatureFlagStatusAcrossEnvironments GET /flag-status/{projectKey}/{featureFlagKey} Get the status for a particular feature flag across environments
    LaunchDarklyApi.FeatureFlagsApi getFeatureFlagStatuses GET /flag-statuses/{projectKey}/{environmentKey} Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as the state of the flag.
    LaunchDarklyApi.FeatureFlagsApi getFeatureFlags GET /flags/{projectKey} Get a list of all features in the given project.
    LaunchDarklyApi.FeatureFlagsApi getFlagConfigScheduledChange GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Get a scheduled change on a feature flag by id.
    LaunchDarklyApi.FeatureFlagsApi getFlagConfigScheduledChanges GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes Get all scheduled workflows for a feature flag by key.
    LaunchDarklyApi.FeatureFlagsApi getFlagConfigScheduledChangesConflicts POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes-conflicts Lists conflicts between the given instructions and any existing scheduled changes for the feature flag. The actual HTTP verb should be REPORT, not POST.
    LaunchDarklyApi.FeatureFlagsApi patchExpiringUserTargets PATCH /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey} Update, add, or delete expiring user targets on feature flag
    LaunchDarklyApi.FeatureFlagsApi patchFeatureFlag PATCH /flags/{projectKey}/{featureFlagKey} Perform a partial update to a feature.
    LaunchDarklyApi.FeatureFlagsApi patchFlagConfigScheduledChange PATCH /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Updates an existing scheduled-change on a feature flag in an environment.
    LaunchDarklyApi.FeatureFlagsApi postApplyApprovalRequest POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/apply Apply approval request for a feature flag config
    LaunchDarklyApi.FeatureFlagsApi postApprovalRequest POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Create an approval request for a feature flag config
    LaunchDarklyApi.FeatureFlagsApi postFeatureFlag POST /flags/{projectKey} Creates a new feature flag.
    LaunchDarklyApi.FeatureFlagsApi postFlagConfigScheduledChanges POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes Creates a new scheduled change for a feature flag.
    LaunchDarklyApi.FeatureFlagsApi postReviewApprovalRequest POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/review Review approval request for a feature flag config
    LaunchDarklyApi.IntegrationsApi deleteIntegrationSubscription DELETE /integrations/{integrationKey}/{integrationId} Delete an integration subscription by ID.
    LaunchDarklyApi.IntegrationsApi getIntegrationSubscription GET /integrations/{integrationKey}/{integrationId} Get a single integration subscription by ID.
    LaunchDarklyApi.IntegrationsApi getIntegrationSubscriptions GET /integrations/{integrationKey} Get a list of all configured integrations of a given kind.
    LaunchDarklyApi.IntegrationsApi getIntegrations GET /integrations Get a list of all configured audit log event integrations associated with this account.
    LaunchDarklyApi.IntegrationsApi patchIntegrationSubscription PATCH /integrations/{integrationKey}/{integrationId} Modify an integration subscription by ID.
    LaunchDarklyApi.IntegrationsApi postIntegrationSubscription POST /integrations/{integrationKey} Create a new integration subscription of a given kind.
    LaunchDarklyApi.ProjectsApi deleteProject DELETE /projects/{projectKey} Delete a project by key. Caution-- deleting a project will delete all associated environments and feature flags. You cannot delete the last project in an account.
    LaunchDarklyApi.ProjectsApi getProject GET /projects/{projectKey} Fetch a single project by key.
    LaunchDarklyApi.ProjectsApi getProjects GET /projects Returns a list of all projects in the account.
    LaunchDarklyApi.ProjectsApi patchProject PATCH /projects/{projectKey} Modify a project by ID.
    LaunchDarklyApi.ProjectsApi postProject POST /projects Create a new project with the given key and name.
    LaunchDarklyApi.RelayProxyConfigurationsApi deleteRelayProxyConfig DELETE /account/relay-auto-configs/{id} Delete a relay proxy configuration by ID.
    LaunchDarklyApi.RelayProxyConfigurationsApi getRelayProxyConfig GET /account/relay-auto-configs/{id} Get a single relay proxy configuration by ID.
    LaunchDarklyApi.RelayProxyConfigurationsApi getRelayProxyConfigs GET /account/relay-auto-configs Returns a list of relay proxy configurations in the account.
    LaunchDarklyApi.RelayProxyConfigurationsApi patchRelayProxyConfig PATCH /account/relay-auto-configs/{id} Modify a relay proxy configuration by ID.
    LaunchDarklyApi.RelayProxyConfigurationsApi postRelayAutoConfig POST /account/relay-auto-configs Create a new relay proxy config.
    LaunchDarklyApi.RelayProxyConfigurationsApi resetRelayProxyConfig POST /account/relay-auto-configs/{id}/reset Reset a relay proxy configuration's secret key with an optional expiry time for the old key.
    LaunchDarklyApi.RootApi getRoot GET /
    LaunchDarklyApi.TeamMembersApi deleteMember DELETE /members/{memberId} Delete a team member by ID.
    LaunchDarklyApi.TeamMembersApi getMe GET /members/me Get the current team member associated with the token
    LaunchDarklyApi.TeamMembersApi getMember GET /members/{memberId} Get a single team member by ID.
    LaunchDarklyApi.TeamMembersApi getMembers GET /members Returns a list of all members in the account.
    LaunchDarklyApi.TeamMembersApi patchMember PATCH /members/{memberId} Modify a team member by ID.
    LaunchDarklyApi.TeamMembersApi postMembers POST /members Invite new members.
    LaunchDarklyApi.UserSegmentsApi deleteUserSegment DELETE /segments/{projectKey}/{environmentKey}/{userSegmentKey} Delete a user segment.
    LaunchDarklyApi.UserSegmentsApi getExpiringUserTargetsOnSegment GET /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey} Get expiring user targets for user segment
    LaunchDarklyApi.UserSegmentsApi getUserSegment GET /segments/{projectKey}/{environmentKey}/{userSegmentKey} Get a single user segment by key.
    LaunchDarklyApi.UserSegmentsApi getUserSegments GET /segments/{projectKey}/{environmentKey} Get a list of all user segments in the given project.
    LaunchDarklyApi.UserSegmentsApi patchExpiringUserTargetsOnSegment PATCH /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey} Update, add, or delete expiring user targets on user segment
    LaunchDarklyApi.UserSegmentsApi patchUserSegment PATCH /segments/{projectKey}/{environmentKey}/{userSegmentKey} Perform a partial update to a user segment.
    LaunchDarklyApi.UserSegmentsApi postUserSegment POST /segments/{projectKey}/{environmentKey} Creates a new user segment.
    LaunchDarklyApi.UserSegmentsApi updateBigSegmentTargets POST /segments/{projectKey}/{environmentKey}/{userSegmentKey}/users Update targets included or excluded in a big segment
    LaunchDarklyApi.UserSettingsApi getExpiringUserTargetsForUser GET /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} Get expiring dates on flags for user
    LaunchDarklyApi.UserSettingsApi getUserFlagSetting GET /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} Fetch a single flag setting for a user by key.
    LaunchDarklyApi.UserSettingsApi getUserFlagSettings GET /users/{projectKey}/{environmentKey}/{userKey}/flags Fetch a single flag setting for a user by key.
    LaunchDarklyApi.UserSettingsApi patchExpiringUserTargetsForFlags PATCH /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} Update, add, or delete expiring user targets for a single user on all flags
    LaunchDarklyApi.UserSettingsApi putFlagSetting PUT /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} Specifically enable or disable a feature flag for a user based on their key.
    LaunchDarklyApi.UsersApi deleteUser DELETE /users/{projectKey}/{environmentKey}/{userKey} Delete a user by ID.
    LaunchDarklyApi.UsersApi getSearchUsers GET /user-search/{projectKey}/{environmentKey} Search users in LaunchDarkly based on their last active date, or a search query. It should not be used to enumerate all users in LaunchDarkly-- use the List users API resource.
    LaunchDarklyApi.UsersApi getUser GET /users/{projectKey}/{environmentKey}/{userKey} Get a user by key.
    LaunchDarklyApi.UsersApi getUsers GET /users/{projectKey}/{environmentKey} List all users in the environment. Includes the total count of users. In each page, there will be up to 'limit' users returned (default 20). This is useful for exporting all users in the system for further analysis. Paginated collections will include a next link containing a URL with the next set of elements in the collection.
    LaunchDarklyApi.WebhooksApi deleteWebhook DELETE /webhooks/{resourceId} Delete a webhook by ID.
    LaunchDarklyApi.WebhooksApi getWebhook GET /webhooks/{resourceId} Get a webhook by ID.
    LaunchDarklyApi.WebhooksApi getWebhooks GET /webhooks Fetch a list of all webhooks.
    LaunchDarklyApi.WebhooksApi patchWebhook PATCH /webhooks/{resourceId} Modify a webhook by ID.
    LaunchDarklyApi.WebhooksApi postWebhook POST /webhooks Create a webhook.

    Documentation for Models

    Documentation for Authorization

    Token

    • Type: API key
      • API key parameter name: Authorization
      • Location: HTTP header

    Sample Code

    var LaunchDarklyApi = require('launchdarkly-api');
    
    var defaultClient = LaunchDarklyApi.ApiClient.instance;
    
    var Token = defaultClient.authentications['Token'];
    Token.apiKey = process.env.LD_API_KEY;
    
    var apiInstance = new LaunchDarklyApi.FeatureFlagsApi();
    
    const projectName = "openapi";
    const keyName = "test-javascript";
    
    var callback = function(error, data) {
      if (error) {
        console.error(error);
        process.exit(1);
      } else {
        console.log('API called successfully. Returned data: ' + JSON.stringify(data));
      }
    };
    
    var postCallback = function(error, data) {
      callback(error, data);
    
      if (!error) {
        // Clean up
        apiInstance.deleteFeatureFlag(projectName, keyName, callback);
      }
    };
    
    apiInstance.postFeatureFlag(projectName,
      {
        name: "Test Flag Javascript",
        key: keyName,
        variations: [{value: [1, 2]}, {value: [3, 4]}, {value: [5]}]
      }, {}, postCallback);

    Keywords

    none

    Install

    npm i launchdarkly-api

    DownloadsWeekly Downloads

    742

    Version

    5.1.0

    License

    Apache 2.0

    Unpacked Size

    2.01 MB

    Total Files

    465

    Last publish

    Collaborators

    • avatar