Skip to content

Commit 74f98e2

Browse files
author
LaunchDarklyReleaseBot
committed
Version 6.0.0 automatically generated from ld-openapi.
1 parent 4a11678 commit 74f98e2

File tree

14 files changed

+16694
-12371
lines changed

14 files changed

+16694
-12371
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
wwwroot/*.js
22
node_modules
33
typings
4+
dist

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/FILES

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.gitignore
2+
.npmignore
3+
.openapi-generator-ignore
4+
README.md
5+
api.ts
6+
base.ts
7+
common.ts
8+
configuration.ts
9+
git_push.sh
10+
index.ts
11+
package.json
12+
tsconfig.json

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.3.0-SNAPSHOT

README.md

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,71 @@
11
This repository contains a client library for LaunchDarkly's REST API. This client was automatically
2-
generated from our [OpenAPI specification](https://github.com/launchdarkly/ld-openapi).
2+
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.
33

4-
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)
4+
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).
5+
## launchdarkly-api-typescript@6.0.0
56

7+
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:
8+
9+
Environment
10+
* Node.js
11+
* Webpack
12+
* Browserify
13+
14+
Language level
15+
* ES5 - you must have a Promises/A+ library installed
16+
* ES6
17+
18+
Module system
19+
* CommonJS
20+
* ES6 module system
21+
22+
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))
23+
24+
### Building
25+
26+
To build and compile the typescript sources to javascript use:
27+
```
28+
npm install
29+
npm run build
30+
```
31+
32+
### Publishing
33+
34+
First build the package then run ```npm publish```
35+
36+
### Consuming
37+
38+
navigate to the folder of your consuming project and run one of the following commands.
39+
40+
_published:_
41+
42+
```
43+
npm install launchdarkly-api-typescript@6.0.0 --save
44+
```
45+
46+
_unPublished (not recommended):_
47+
48+
```
49+
npm install PATH_TO_GENERATED_PACKAGE --save
650
## Sample Code
751
852
```ts
9-
import { FeatureFlagsApi, FeatureFlagsApiApiKeys, FeatureFlagBody } from "launchdarkly-api-typescript";
53+
import { FeatureFlagsApi, Configuration, FeatureFlagBody } from "launchdarkly-api-typescript";
1054
11-
let apiInstance = new FeatureFlagsApi();
12-
const apiKey = process.env.LD_API_KEY || '';
13-
apiInstance.setApiKey(FeatureFlagsApiApiKeys.Token, apiKey);
55+
const apiToken = process.env.LD_API_KEY;
56+
const config = new Configuration({apiKey: apiToken});
57+
let apiInstance = new FeatureFlagsApi(config);
1458
15-
const successCallback = function(data){
16-
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
59+
const successCallback = function(res){
60+
console.log('API called successfully. Returned data: ' + JSON.stringify(res.data));
1761
};
1862
const errorCallback = function(error) {
1963
console.error('Error!', error);
2064
process.exit(1);
2165
};
2266
23-
const createSuccessCallback = function(data){
24-
successCallback(data);
67+
const createSuccessCallback = function(res){
68+
successCallback(res);
2569
2670
// Clean up
2771
apiInstance.deleteFeatureFlag(projectName, keyName).then(successCallback, errorCallback);
@@ -35,5 +79,17 @@ const flagBody: FeatureFlagBody = {
3579
variations: [{value: [1, 2]}, {value: [3, 4]}, {value: [5]}]
3680
};
3781
38-
apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
82+
apiInstance.deleteFeatureFlag(projectName, keyName)
83+
.then(() => {
84+
console.log("flag deleted")
85+
apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
86+
})
87+
.catch((err) => {
88+
if (err?.response?.status == 404) {
89+
console.log("No flag to cleanup")
90+
} else {
91+
errorCallback(err)
92+
}
93+
apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
94+
})
3995
```

api.ts

Lines changed: 16209 additions & 12313 deletions
Large diffs are not rendered by default.

base.ts

Lines changed: 71 additions & 0 deletions
Large diffs are not rendered by default.

common.ts

Lines changed: 138 additions & 0 deletions
Large diffs are not rendered by default.

configuration.ts

Lines changed: 101 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)