Skip to content

Commit dd091ff

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Widgets API v2 OpenAPI spec (#3775)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 07fd483 commit dd091ff

31 files changed

Lines changed: 2889 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

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

features/v2/undo.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6357,6 +6357,47 @@
63576357
"type": "safe"
63586358
}
63596359
},
6360+
"SearchWidgets": {
6361+
"tag": "Widgets",
6362+
"undo": {
6363+
"type": "safe"
6364+
}
6365+
},
6366+
"CreateWidget": {
6367+
"tag": "Widgets",
6368+
"undo": {
6369+
"operationId": "DeleteWidget",
6370+
"parameters": [
6371+
{
6372+
"name": "experience_type",
6373+
"source": "experience_type"
6374+
},
6375+
{
6376+
"name": "uuid",
6377+
"source": "data.id"
6378+
}
6379+
],
6380+
"type": "unsafe"
6381+
}
6382+
},
6383+
"DeleteWidget": {
6384+
"tag": "Widgets",
6385+
"undo": {
6386+
"type": "idempotent"
6387+
}
6388+
},
6389+
"GetWidget": {
6390+
"tag": "Widgets",
6391+
"undo": {
6392+
"type": "safe"
6393+
}
6394+
},
6395+
"UpdateWidget": {
6396+
"tag": "Widgets",
6397+
"undo": {
6398+
"type": "safe"
6399+
}
6400+
},
63606401
"CreateWorkflow": {
63616402
"tag": "Workflow Automation",
63626403
"undo": {

features/v2/widgets.feature

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
@endpoint(widgets) @endpoint(widgets-v2)
2+
Feature: Widgets
3+
Create, read, update, and delete saved widgets. Widgets are reusable
4+
visualization components stored independently from any dashboard or
5+
notebook, partitioned by experience type and identified by a UUID.
6+
7+
Background:
8+
Given a valid "apiKeyAuth" key in the system
9+
And a valid "appKeyAuth" key in the system
10+
And an instance of "Widgets" API
11+
12+
@generated @skip @team:DataDog/reporting-and-sharing
13+
Scenario: Create a widget returns "Bad Request" response
14+
Given new "CreateWidget" request
15+
And request contains "experience_type" parameter from "REPLACE.ME"
16+
And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}}
17+
When the request is sent
18+
Then the response status is 400 Bad Request
19+
20+
@generated @skip @team:DataDog/reporting-and-sharing
21+
Scenario: Create a widget returns "OK" response
22+
Given new "CreateWidget" request
23+
And request contains "experience_type" parameter from "REPLACE.ME"
24+
And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}}
25+
When the request is sent
26+
Then the response status is 200 OK
27+
28+
@generated @skip @team:DataDog/reporting-and-sharing
29+
Scenario: Delete a widget returns "Bad Request" response
30+
Given new "DeleteWidget" request
31+
And request contains "experience_type" parameter from "REPLACE.ME"
32+
And request contains "uuid" parameter from "REPLACE.ME"
33+
When the request is sent
34+
Then the response status is 400 Bad Request
35+
36+
@generated @skip @team:DataDog/reporting-and-sharing
37+
Scenario: Delete a widget returns "No Content" response
38+
Given new "DeleteWidget" request
39+
And request contains "experience_type" parameter from "REPLACE.ME"
40+
And request contains "uuid" parameter from "REPLACE.ME"
41+
When the request is sent
42+
Then the response status is 204 No Content
43+
44+
@generated @skip @team:DataDog/reporting-and-sharing
45+
Scenario: Delete a widget returns "Not Found" response
46+
Given new "DeleteWidget" request
47+
And request contains "experience_type" parameter from "REPLACE.ME"
48+
And request contains "uuid" parameter from "REPLACE.ME"
49+
When the request is sent
50+
Then the response status is 404 Not Found
51+
52+
@generated @skip @team:DataDog/reporting-and-sharing
53+
Scenario: Get a widget returns "Bad Request" response
54+
Given new "GetWidget" request
55+
And request contains "experience_type" parameter from "REPLACE.ME"
56+
And request contains "uuid" parameter from "REPLACE.ME"
57+
When the request is sent
58+
Then the response status is 400 Bad Request
59+
60+
@generated @skip @team:DataDog/reporting-and-sharing
61+
Scenario: Get a widget returns "Not Found" response
62+
Given new "GetWidget" request
63+
And request contains "experience_type" parameter from "REPLACE.ME"
64+
And request contains "uuid" parameter from "REPLACE.ME"
65+
When the request is sent
66+
Then the response status is 404 Not Found
67+
68+
@generated @skip @team:DataDog/reporting-and-sharing
69+
Scenario: Get a widget returns "OK" response
70+
Given new "GetWidget" request
71+
And request contains "experience_type" parameter from "REPLACE.ME"
72+
And request contains "uuid" parameter from "REPLACE.ME"
73+
When the request is sent
74+
Then the response status is 200 OK
75+
76+
@generated @skip @team:DataDog/reporting-and-sharing
77+
Scenario: Search widgets returns "Bad Request" response
78+
Given new "SearchWidgets" request
79+
And request contains "experience_type" parameter from "REPLACE.ME"
80+
When the request is sent
81+
Then the response status is 400 Bad Request
82+
83+
@generated @skip @team:DataDog/reporting-and-sharing
84+
Scenario: Search widgets returns "OK" response
85+
Given new "SearchWidgets" request
86+
And request contains "experience_type" parameter from "REPLACE.ME"
87+
When the request is sent
88+
Then the response status is 200 OK
89+
90+
@generated @skip @team:DataDog/reporting-and-sharing
91+
Scenario: Update a widget returns "Bad Request" response
92+
Given new "UpdateWidget" request
93+
And request contains "experience_type" parameter from "REPLACE.ME"
94+
And request contains "uuid" parameter from "REPLACE.ME"
95+
And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}}
96+
When the request is sent
97+
Then the response status is 400 Bad Request
98+
99+
@generated @skip @team:DataDog/reporting-and-sharing
100+
Scenario: Update a widget returns "Not Found" response
101+
Given new "UpdateWidget" request
102+
And request contains "experience_type" parameter from "REPLACE.ME"
103+
And request contains "uuid" parameter from "REPLACE.ME"
104+
And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}}
105+
When the request is sent
106+
Then the response status is 404 Not Found
107+
108+
@generated @skip @team:DataDog/reporting-and-sharing
109+
Scenario: Update a widget returns "OK" response
110+
Given new "UpdateWidget" request
111+
And request contains "experience_type" parameter from "REPLACE.ME"
112+
And request contains "uuid" parameter from "REPLACE.ME"
113+
And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}}
114+
When the request is sent
115+
Then the response status is 200 OK

packages/datadog-api-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,5 @@ apiInstance
464464
| Usage Metering | @datadog/datadog-api-client-usage-metering | [README.md](../../services/usage-metering/README.md) |
465465
| Users | @datadog/datadog-api-client-users | [README.md](../../services/users/README.md) |
466466
| Webhooks Integration | @datadog/datadog-api-client-webhooks-integration | [README.md](../../services/webhooks-integration/README.md) |
467+
| Widgets | @datadog/datadog-api-client-widgets | [README.md](../../services/widgets/README.md) |
467468
| Workflow Automation | @datadog/datadog-api-client-workflow-automation | [README.md](../../services/workflow-automation/README.md) |

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11761,6 +11761,93 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
1176111761
},
1176211762
operationResponseType: "PermissionsResponse",
1176311763
},
11764+
"WidgetsApi.V2.SearchWidgets": {
11765+
experienceType: {
11766+
type: "WidgetExperienceType",
11767+
format: "",
11768+
},
11769+
filterWidgetType: {
11770+
type: "WidgetType",
11771+
format: "",
11772+
},
11773+
filterCreatorHandle: {
11774+
type: "string",
11775+
format: "",
11776+
},
11777+
filterIsFavorited: {
11778+
type: "boolean",
11779+
format: "",
11780+
},
11781+
filterTitle: {
11782+
type: "string",
11783+
format: "",
11784+
},
11785+
filterTags: {
11786+
type: "string",
11787+
format: "",
11788+
},
11789+
sort: {
11790+
type: "string",
11791+
format: "",
11792+
},
11793+
pageNumber: {
11794+
type: "number",
11795+
format: "",
11796+
},
11797+
pageSize: {
11798+
type: "number",
11799+
format: "",
11800+
},
11801+
operationResponseType: "WidgetListResponse",
11802+
},
11803+
"WidgetsApi.V2.CreateWidget": {
11804+
experienceType: {
11805+
type: "WidgetExperienceType",
11806+
format: "",
11807+
},
11808+
body: {
11809+
type: "CreateOrUpdateWidgetRequest",
11810+
format: "",
11811+
},
11812+
operationResponseType: "WidgetResponse",
11813+
},
11814+
"WidgetsApi.V2.GetWidget": {
11815+
experienceType: {
11816+
type: "WidgetExperienceType",
11817+
format: "",
11818+
},
11819+
uuid: {
11820+
type: "string",
11821+
format: "uuid",
11822+
},
11823+
operationResponseType: "WidgetResponse",
11824+
},
11825+
"WidgetsApi.V2.UpdateWidget": {
11826+
experienceType: {
11827+
type: "WidgetExperienceType",
11828+
format: "",
11829+
},
11830+
uuid: {
11831+
type: "string",
11832+
format: "uuid",
11833+
},
11834+
body: {
11835+
type: "CreateOrUpdateWidgetRequest",
11836+
format: "",
11837+
},
11838+
operationResponseType: "WidgetResponse",
11839+
},
11840+
"WidgetsApi.V2.DeleteWidget": {
11841+
experienceType: {
11842+
type: "WidgetExperienceType",
11843+
format: "",
11844+
},
11845+
uuid: {
11846+
type: "string",
11847+
format: "uuid",
11848+
},
11849+
operationResponseType: "{}",
11850+
},
1176411851
"WorkflowAutomationApi.V2.CreateWorkflow": {
1176511852
body: {
1176611853
type: "CreateWorkflowRequest",

services/widgets/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

services/widgets/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# @datadog/datadog-api-client-widgets
2+
3+
## Description
4+
5+
Create, read, update, and delete saved widgets. Widgets are reusable
6+
visualization components stored independently from any dashboard or notebook,
7+
partitioned by experience type and identified by a UUID.
8+
9+
## Navigation
10+
11+
- [Installation](#installation)
12+
- [Getting Started](#getting-started)
13+
14+
## Installation
15+
16+
```sh
17+
# NPM
18+
npm install @datadog/datadog-api-client-widgets
19+
# Yarn
20+
yarn add @datadog/datadog-api-client-widgets
21+
```
22+
23+
## Getting Started
24+
```ts
25+
import { createConfiguration } from "@datadog/datadog-api-client";
26+
import { WidgetsApiV2 } from "@datadog/datadog-api-client-widgets";
27+
import { v2 } from "@datadog/datadog-api-client-widgets";
28+
29+
const configuration = createConfiguration();
30+
const apiInstance = new WidgetsApiV2(configuration);
31+
const params = {/* parameters */};
32+
33+
apiInstance.searchWidgets(params).then((data) => {
34+
console.log("API called successfully. Returned data: " + JSON.stringify(data));
35+
}).catch((error) => {
36+
console.error("Error calling API: " + error);
37+
});
38+
```

services/widgets/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@datadog/datadog-api-client-widgets",
3+
"description": "",
4+
"author": "",
5+
"keywords": [
6+
"api",
7+
"fetch",
8+
"typescript"
9+
],
10+
"license": "Apache-2.0",
11+
"licenses": [
12+
{
13+
"type": "Apache-2.0",
14+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
15+
}
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
20+
"directory": "services/widgets"
21+
},
22+
"files": [
23+
"dist/**/*"
24+
],
25+
"main": "./dist/index.js",
26+
"typings": "./dist/index.d.ts",
27+
"scripts": {
28+
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
29+
"build": "yarn generate-version-files && tsc",
30+
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
31+
},
32+
"dependencies": {
33+
"@datadog/datadog-api-client": "^2.0.0-beta.2"
34+
},
35+
"devDependencies": {
36+
"typescript": "5.8.3"
37+
},
38+
"engines": {
39+
"node": ">=18.0.0"
40+
},
41+
"version": "0.0.1",
42+
"packageManager": "yarn@4.9.1"
43+
}

services/widgets/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * as v2 from "./v2";
2+
3+
export { WidgetsApi as WidgetsApiV2 } from "./v2/WidgetsApi";

0 commit comments

Comments
 (0)