Skip to content

Commit 44fd78d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit b373efcd of spec repo
1 parent 15a3969 commit 44fd78d

File tree

8 files changed

+249
-4
lines changed

8 files changed

+249
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.5",
7-
"regenerated": "2023-09-04 09:06:17.163397",
8-
"spec_repo_commit": "a5115137"
7+
"regenerated": "2023-09-04 12:33:40.867142",
8+
"spec_repo_commit": "b373efcd"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-09-04 09:06:17.176462",
13-
"spec_repo_commit": "a5115137"
12+
"regenerated": "2023-09-04 12:33:40.880673",
13+
"spec_repo_commit": "b373efcd"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20836,6 +20836,21 @@ paths:
2083620836
required: false
2083720837
schema:
2083820838
type: boolean
20839+
- description: The maximum number of dashboards returned in the list.
20840+
in: query
20841+
name: count
20842+
required: false
20843+
schema:
20844+
default: 100
20845+
format: int64
20846+
type: integer
20847+
- description: The specific offset to use as the beginning of the returned response.
20848+
in: query
20849+
name: start
20850+
required: false
20851+
schema:
20852+
format: int64
20853+
type: integer
2083920854
responses:
2084020855
'200':
2084120856
content:
@@ -20859,6 +20874,10 @@ paths:
2085920874
summary: Get all dashboards
2086020875
tags:
2086120876
- Dashboards
20877+
x-pagination:
20878+
limitParam: count
20879+
pageOffsetParam: start
20880+
resultsPath: dashboards
2086220881
patch:
2086320882
description: Restore dashboards using the specified IDs. If there are any failures,
2086420883
no dashboards will be restored (partial success is not allowed).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-09-04T12:26:51.389Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Get all dashboards returns \"OK\" response with pagination",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "b29213e78fb8044da793bea81fe4dd28",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 0,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
}
23+
],
24+
"headersSize": 512,
25+
"httpVersion": "HTTP/1.1",
26+
"method": "GET",
27+
"queryString": [
28+
{
29+
"name": "count",
30+
"value": "2"
31+
}
32+
],
33+
"url": "https://api.datadoghq.com/api/v1/dashboard?count=2"
34+
},
35+
"response": {
36+
"bodySize": 924,
37+
"content": {
38+
"mimeType": "application/json",
39+
"size": 924,
40+
"text": "{\"dashboards\":[{\"id\":\"5vp-fxm-s4j\",\"title\":\"PCF Testing\",\"description\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/5vp-fxm-s4j/pcf-testing\",\"is_read_only\":false,\"created_at\":\"2022-06-08T10:40:29.941695+00:00\",\"modified_at\":\"2023-07-27T12:26:28.359080+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"deleted_at\":null},{\"id\":\"ubf-m9i-gms\",\"title\":\"OpenStack Controller Overview\",\"description\":\"## OpenStack Controller - Overview\\n\\nPreset dashboard for the OpenStack Controller integration. Used for OpenStack deployments v13 and higher. \\n\\n[See integration docs for more details](https://docs.datadoghq.com/integrations/openstack_controller/)\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/ubf-m9i-gms/openstack-controller-overview\",\"is_read_only\":false,\"created_at\":\"2023-04-28T19:16:35.964720+00:00\",\"modified_at\":\"2023-08-07T13:53:31.924789+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"deleted_at\":null}]}\n"
41+
},
42+
"cookies": [],
43+
"headers": [
44+
{
45+
"name": "content-type",
46+
"value": "application/json"
47+
}
48+
],
49+
"headersSize": 654,
50+
"httpVersion": "HTTP/1.1",
51+
"redirectURL": "",
52+
"status": 200,
53+
"statusText": "OK"
54+
},
55+
"startedDateTime": "2023-09-04T12:26:51.399Z",
56+
"time": 513
57+
},
58+
{
59+
"_id": "40e70edf61ee192e4735474683db8943",
60+
"_order": 0,
61+
"cache": {},
62+
"request": {
63+
"bodySize": 0,
64+
"cookies": [],
65+
"headers": [
66+
{
67+
"_fromType": "array",
68+
"name": "accept",
69+
"value": "application/json"
70+
}
71+
],
72+
"headersSize": 520,
73+
"httpVersion": "HTTP/1.1",
74+
"method": "GET",
75+
"queryString": [
76+
{
77+
"name": "count",
78+
"value": "2"
79+
},
80+
{
81+
"name": "start",
82+
"value": "2"
83+
}
84+
],
85+
"url": "https://api.datadoghq.com/api/v1/dashboard?count=2&start=2"
86+
},
87+
"response": {
88+
"bodySize": 993,
89+
"content": {
90+
"mimeType": "application/json",
91+
"size": 993,
92+
"text": "{\"dashboards\":[{\"id\":\"ja7-nhx-7zs\",\"title\":\"OpenStack Controller Overview [Default Microversion]\",\"description\":\"## OpenStack Controller - Overview\\n\\nPreset dashboard for the OpenStack Controller integration. Used for OpenStack deployments v13 and higher. \\n\\n[See integration docs for more details](https://docs.datadoghq.com/integrations/openstack_controller/)\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/ja7-nhx-7zs/openstack-controller-overview-default-microversion\",\"is_read_only\":false,\"created_at\":\"2023-08-29T19:56:15.999851+00:00\",\"modified_at\":\"2023-08-29T20:12:33.385536+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"deleted_at\":null}]}\n"
93+
},
94+
"cookies": [],
95+
"headers": [
96+
{
97+
"name": "content-type",
98+
"value": "application/json"
99+
}
100+
],
101+
"headersSize": 654,
102+
"httpVersion": "HTTP/1.1",
103+
"redirectURL": "",
104+
"status": 200,
105+
"statusText": "OK"
106+
},
107+
"startedDateTime": "2023-09-04T12:26:51.921Z",
108+
"time": 466
109+
}
110+
],
111+
"pages": [],
112+
"version": "1.2"
113+
}
114+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get all dashboards returns "OK" response with pagination
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.DashboardsApi(configuration);
9+
10+
const params: v1.DashboardsApiListDashboardsRequest = {
11+
count: 2,
12+
};
13+
14+
(async () => {
15+
try {
16+
for await (const item of apiInstance.listDashboardsWithPagination(params)) {
17+
console.log(item);
18+
}
19+
} catch (error) {
20+
console.error(error);
21+
}
22+
})();

features/support/scenarios_model_mapping.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,14 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
605605
"type": "boolean",
606606
"format": "",
607607
},
608+
"count": {
609+
"type": "number",
610+
"format": "int64",
611+
},
612+
"start": {
613+
"type": "number",
614+
"format": "int64",
615+
},
608616
"operationResponseType": "DashboardSummary",
609617
},
610618
"v1.RestoreDashboards": {

features/v1/dashboards.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,14 @@ Feature: Dashboards
874874
And the response "dashboards[0].title" has the same value as "dashboard.title"
875875
And the response "dashboards[0].id" has the same value as "dashboard.id"
876876

877+
@replay-only @skip-validation @team:DataDog/dashboards-backend @with-pagination
878+
Scenario: Get all dashboards returns "OK" response with pagination
879+
Given new "ListDashboards" request
880+
And request contains "count" parameter with value 2
881+
When the request with pagination is sent
882+
Then the response status is 200 OK
883+
And the response has 3 items
884+
877885
@generated @skip @team:DataDog/dashboards-backend
878886
Scenario: Get all invitations for a shared dashboard returns "Not Found" response
879887
Given new "GetPublicDashboardInvitations" request

packages/datadog-api-client-v1/apis/DashboardsApi.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { DashboardBulkDeleteRequest } from "../models/DashboardBulkDeleteRequest
2222
import { DashboardDeleteResponse } from "../models/DashboardDeleteResponse";
2323
import { DashboardRestoreRequest } from "../models/DashboardRestoreRequest";
2424
import { DashboardSummary } from "../models/DashboardSummary";
25+
import { DashboardSummaryDefinition } from "../models/DashboardSummaryDefinition";
2526
import { DeleteSharedDashboardResponse } from "../models/DeleteSharedDashboardResponse";
2627
import { SharedDashboard } from "../models/SharedDashboard";
2728
import { SharedDashboardInvites } from "../models/SharedDashboardInvites";
@@ -394,6 +395,8 @@ export class DashboardsApiRequestFactory extends BaseAPIRequestFactory {
394395
public async listDashboards(
395396
filterShared?: boolean,
396397
filterDeleted?: boolean,
398+
count?: number,
399+
start?: number,
397400
_options?: Configuration
398401
): Promise<RequestContext> {
399402
const _config = _options || this.configuration;
@@ -421,6 +424,18 @@ export class DashboardsApiRequestFactory extends BaseAPIRequestFactory {
421424
ObjectSerializer.serialize(filterDeleted, "boolean", "")
422425
);
423426
}
427+
if (count !== undefined) {
428+
requestContext.setQueryParam(
429+
"count",
430+
ObjectSerializer.serialize(count, "number", "int64")
431+
);
432+
}
433+
if (start !== undefined) {
434+
requestContext.setQueryParam(
435+
"start",
436+
ObjectSerializer.serialize(start, "number", "int64")
437+
);
438+
}
424439

425440
// Apply auth methods
426441
applySecurityAuthentication(_config, requestContext, [
@@ -1578,6 +1593,16 @@ export interface DashboardsApiListDashboardsRequest {
15781593
* @type boolean
15791594
*/
15801595
filterDeleted?: boolean;
1596+
/**
1597+
* The maximum number of dashboards returned in the list.
1598+
* @type number
1599+
*/
1600+
count?: number;
1601+
/**
1602+
* The specific offset to use as the beginning of the returned response.
1603+
* @type number
1604+
*/
1605+
start?: number;
15811606
}
15821607

15831608
export interface DashboardsApiRestoreDashboardsRequest {
@@ -1857,6 +1882,8 @@ export class DashboardsApi {
18571882
const requestContextPromise = this.requestFactory.listDashboards(
18581883
param.filterShared,
18591884
param.filterDeleted,
1885+
param.count,
1886+
param.start,
18601887
options
18611888
);
18621889
return requestContextPromise.then((requestContext) => {
@@ -1868,6 +1895,52 @@ export class DashboardsApi {
18681895
});
18691896
}
18701897

1898+
/**
1899+
* Provide a paginated version of listDashboards returning a generator with all the items.
1900+
*/
1901+
public async *listDashboardsWithPagination(
1902+
param: DashboardsApiListDashboardsRequest = {},
1903+
options?: Configuration
1904+
): AsyncGenerator<DashboardSummaryDefinition> {
1905+
let pageSize = 100;
1906+
if (param.count !== undefined) {
1907+
pageSize = param.count;
1908+
}
1909+
param.count = pageSize;
1910+
while (true) {
1911+
const requestContext = await this.requestFactory.listDashboards(
1912+
param.filterShared,
1913+
param.filterDeleted,
1914+
param.count,
1915+
param.start,
1916+
options
1917+
);
1918+
const responseContext = await this.configuration.httpApi.send(
1919+
requestContext
1920+
);
1921+
1922+
const response = await this.responseProcessor.listDashboards(
1923+
responseContext
1924+
);
1925+
const responseDashboards = response.dashboards;
1926+
if (responseDashboards === undefined) {
1927+
break;
1928+
}
1929+
const results = responseDashboards;
1930+
for (const item of results) {
1931+
yield item;
1932+
}
1933+
if (results.length < pageSize) {
1934+
break;
1935+
}
1936+
if (param.start === undefined) {
1937+
param.start = pageSize;
1938+
} else {
1939+
param.start = param.start + pageSize;
1940+
}
1941+
}
1942+
}
1943+
18711944
/**
18721945
* Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed).
18731946
* @param param The request object

0 commit comments

Comments
 (0)