-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathCreateFlagSuggestion.ts
More file actions
37 lines (33 loc) · 1.02 KB
/
CreateFlagSuggestion.ts
File metadata and controls
37 lines (33 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Create a flag suggestion returns "Created" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.FeatureFlagsApi(configuration);
const params: v2.FeatureFlagsApiCreateFlagSuggestionRequest = {
body: {
data: {
attributes: {
action: "archived",
comment: "Archive this deprecated flag",
environmentId: "550e8400-e29b-41d4-a716-446655440001",
notificationRuleTargets: ["user@example.com"],
property: "FLAG",
suggestion: "ENABLED",
suggestionMetadata: {
variantId: "550e8400-e29b-41d4-a716-446655440005",
},
},
type: "flag-suggestions",
},
},
featureFlagId: "550e8400-e29b-41d4-a716-446655440000",
};
apiInstance
.createFlagSuggestion(params)
.then((data: v2.FlagSuggestionResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));