Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

launchdarkly-api-typescript

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-api-typescript - npm Package Compare versions

Comparing version 5.4.0 to 6.0.0

base.ts

49

package.json
{
"name": "launchdarkly-api-typescript",
"version": "5.4.0",
"description": "Build custom integrations with the LaunchDarkly REST API",
"repository": {
"type": "git",
"url": "https://github.com/launchdarkly/api-client-typescript.git"
},
"main": "api.js",
"scripts": {
"clean": "rm -Rf node_modules/ *.js *.js.map api.d.ts package-lock.json",
"build": "./node_modules/.bin/tsc",
"test": "echo No tests are defined."
},
"author": "Swagger Codegen Contributors",
"license": "Apache 2.0",
"dependencies": {
"bluebird": "^3.5.0",
"request": "^2.81.0",
"@types/bluebird": "*",
"@types/request": "*"
},
"devDependencies": {
"typescript": "^3.9.3"
}
"name": "launchdarkly-api-typescript",
"version": "6.0.0",
"description": "OpenAPI client for launchdarkly-api-typescript",
"author": "OpenAPI-Generator Contributors",
"keywords": [
"axios",
"typescript",
"openapi-client",
"openapi-generator",
"launchdarkly-api-typescript"
],
"license": "Unlicense",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"build": "tsc --outDir dist/",
"prepublishOnly": "npm run build"
},
"dependencies": {
"axios": "^0.21.1"
},
"devDependencies": {
"@types/node": "^12.11.5",
"typescript": "^3.6.4"
}
}
This repository contains a client library for LaunchDarkly's REST API. This client was automatically
generated from our [OpenAPI specification](https://github.com/launchdarkly/ld-openapi).
generated from our [OpenAPI specification](https://app.launchdarkly.com/api/v2/openapi.json) using a [code generation library](https://github.com/launchdarkly/ld-openapi). View our [sample code](#sample-code) for example usage.
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](https://docs.launchdarkly.com/v2.0/docs)
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, read the [SDK documentation](https://docs.launchdarkly.com/sdk).
## launchdarkly-api-typescript@6.0.0
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
Environment
* Node.js
* Webpack
* Browserify
Language level
* ES5 - you must have a Promises/A+ library installed
* ES6
Module system
* CommonJS
* ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
### Building
To build and compile the typescript sources to javascript use:
```
npm install
npm run build
```
### Publishing
First build the package then run ```npm publish```
### Consuming
navigate to the folder of your consuming project and run one of the following commands.
_published:_
```
npm install launchdarkly-api-typescript@6.0.0 --save
```
_unPublished (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
## Sample Code
```ts
import { FeatureFlagsApi, FeatureFlagsApiApiKeys, FeatureFlagBody } from "launchdarkly-api-typescript";
import { FeatureFlagsApi, Configuration, FeatureFlagBody } from "launchdarkly-api-typescript";
let apiInstance = new FeatureFlagsApi();
const apiKey = process.env.LD_API_KEY || '';
apiInstance.setApiKey(FeatureFlagsApiApiKeys.Token, apiKey);
const apiToken = process.env.LD_API_KEY;
const config = new Configuration({apiKey: apiToken});
let apiInstance = new FeatureFlagsApi(config);
const successCallback = function(data){
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
const successCallback = function(res){
console.log('API called successfully. Returned data: ' + JSON.stringify(res.data));
};

@@ -23,4 +67,4 @@ const errorCallback = function(error) {

const createSuccessCallback = function(data){
successCallback(data);
const createSuccessCallback = function(res){
successCallback(res);

@@ -39,3 +83,15 @@ // Clean up

apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
apiInstance.deleteFeatureFlag(projectName, keyName)
.then(() => {
console.log("flag deleted")
apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
})
.catch((err) => {
if (err?.response?.status == 404) {
console.log("No flag to cleanup")
} else {
errorCallback(err)
}
apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
})
```
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "es2016",
"strict": true,
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"noLib": false,
"declaration": true,
"lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"]
},
"exclude": [
"node_modules"
"compilerOptions": {
"declaration": true,
"target": "es6",
"module": "commonjs",
"noImplicitAny": true,
"outDir": "dist",
"rootDir": ".",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"dist",
"node_modules"
]
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc