Skip to content

Commit 57f2106

Browse files
committed
feat(swagger): update structures to match upstream
api definitions have broken contract, so update to match + add getCustomRoles wrapper
1 parent 6b92655 commit 57f2106

File tree

3 files changed

+739
-122
lines changed

3 files changed

+739
-122
lines changed

api.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ log.info(`command line args: ${args}`);
8989
result = await ldUtils.toggleFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery, enabled);
9090
break;
9191

92+
case 'getCustomRoles':
93+
result = await ldUtils.getCustomRoles();
94+
break;
95+
9296
default:
9397
result = 'please supply a mode parameter: getFeatureFlags, getFeatureFlag';
9498

src/LaunchDarklyUtils.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ export class LaunchDarklyUtils {
99
async create(API_TOKEN, customLogger) {
1010
if (customLogger) log = customLogger;
1111
this.apiClient = await LaunchDarklyApiClient.create(API_TOKEN, log);
12+
log.debug(this.apiClient.apis);
1213
return this;
1314
}
1415

1516
async getFeatureFlags(projectKey) {
16-
return this.apiClient.apis.flags.getFeatureFlags({ projectKey: projectKey });
17+
return this.apiClient.apis['Feature flags'].getFeatureFlags({ projectKey: projectKey });
1718
}
1819

1920
async getFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery) {
20-
return this.apiClient.apis.flags.getFeatureFlag({
21+
return this.apiClient.apis['Feature flags'].getFeatureFlag({
2122
projectKey: projectKey,
2223
featureFlagKey: featureFlagKey,
2324
environmentKeyQuery: environmentKeyQuery
@@ -31,10 +32,14 @@ export class LaunchDarklyUtils {
3132
}
3233

3334
async toggleFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery, value) {
34-
return this.apiClient.apis.flags.patchFeatureFlag({
35+
return this.apiClient.apis['Feature flags'].patchFeatureFlag({
3536
projectKey: projectKey,
3637
featureFlagKey: featureFlagKey,
3738
patchDelta: [{ op: 'replace', path: `/environments/${environmentKeyQuery}/on`, value: value }]
3839
});
3940
}
41+
42+
async getCustomRoles() {
43+
return this.apiClient.apis['Custom roles'].getCustomRoles();
44+
}
4045
}

0 commit comments

Comments
 (0)