Skip to content

Commit ea00ffc

Browse files
author
LaunchDarklyCI
committed
Version 5.0.2 automatically generated from ld-openapi@5f6514d.
1 parent 1005038 commit ea00ffc

File tree

6 files changed

+287
-210
lines changed

6 files changed

+287
-210
lines changed

.swagger-codegen/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.8
1+
2.4.17

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,37 @@ generated from our [OpenAPI specification](https://github.com/launchdarkly/ld-op
33

44
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)
55

6+
## Sample Code
7+
8+
```ts
9+
import { FeatureFlagsApi, FeatureFlagsApiApiKeys, FeatureFlagBody } from "launchdarkly-api-typescript";
10+
11+
let apiInstance = new FeatureFlagsApi();
12+
const apiKey = process.env.LD_API_KEY || '';
13+
apiInstance.setApiKey(FeatureFlagsApiApiKeys.Token, apiKey);
14+
15+
const successCallback = function(data){
16+
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
17+
};
18+
const errorCallback = function(error) {
19+
console.error('Error!', error);
20+
process.exit(1);
21+
};
22+
23+
const createSuccessCallback = function(data){
24+
successCallback(data);
25+
26+
// Clean up
27+
apiInstance.deleteFeatureFlag(projectName, keyName).then(successCallback, errorCallback);
28+
};
29+
30+
const projectName = "openapi";
31+
const keyName = "test-typescript";
32+
const flagBody: FeatureFlagBody = {
33+
name: "Test Flag Typescript",
34+
key: keyName,
35+
variations: [{value: [1, 2]}, {value: [3, 4]}, {value: [5]}]
36+
};
37+
38+
apiInstance.postFeatureFlag(projectName, flagBody).then(createSuccessCallback, errorCallback);
39+
```

0 commit comments

Comments
 (0)