Skip to content

Commit e44bffe

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 4df80878 of spec repo
1 parent 979f39b commit e44bffe

File tree

8 files changed

+213
-18
lines changed

8 files changed

+213
-18
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-08-30 08:42:52.003609",
8-
"spec_repo_commit": "fee86b40"
7+
"regenerated": "2023-08-30 10:08:16.070304",
8+
"spec_repo_commit": "4df80878"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-08-30 08:42:52.016771",
13-
"spec_repo_commit": "fee86b40"
12+
"regenerated": "2023-08-30 10:08:16.084909",
13+
"spec_repo_commit": "4df80878"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27991,13 +27991,16 @@ paths:
2799127991
in: query
2799227992
name: page_size
2799327993
schema:
27994-
type: string
27994+
default: 100
27995+
format: int64
27996+
type: integer
2799527997
- description: Used for pagination. Which page you want to retrieve. Starts
2799627998
at zero.
2799727999
in: query
2799828000
name: page_number
2799928001
schema:
28000-
type: string
28002+
format: int64
28003+
type: integer
2800128004
responses:
2800228005
'200':
2800328006
content:
@@ -28027,6 +28030,10 @@ paths:
2802728030
summary: Get the list of all Synthetic tests
2802828031
tags:
2802928032
- Synthetics
28033+
x-pagination:
28034+
limitParam: page_size
28035+
pageParam: page_number
28036+
resultsPath: tests
2803028037
/api/v1/synthetics/tests/api:
2803128038
post:
2803228039
description: Create a Synthetic API test.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-08-30T09:42:25.568Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"log": {
3+
"_recordingName": "Synthetics/Get the list of all Synthetic tests returns \"OK - Returns the list of all Synthetic tests.\" response with pagination",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "8bd3539fe2a3d4f5897f5d75b0a8fdce",
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": 532,
25+
"httpVersion": "HTTP/1.1",
26+
"method": "GET",
27+
"queryString": [
28+
{
29+
"name": "page_size",
30+
"value": "2"
31+
},
32+
{
33+
"name": "page_number",
34+
"value": "0"
35+
}
36+
],
37+
"url": "https://api.datadoghq.com/api/v1/synthetics/tests?page_size=2&page_number=0"
38+
},
39+
"response": {
40+
"bodySize": 1878,
41+
"content": {
42+
"mimeType": "application/json",
43+
"size": 1878,
44+
"text": "{\"tests\":[{\"public_id\":\"888-nvp-kbw\",\"name\":\"tf-TestAccDatadogSyntheticsTestBrowserMML_Basic-local-1689951468-updated\",\"status\":\"paused\",\"type\":\"browser\",\"tags\":[\"foo:bar\",\"baz\"],\"created_at\":\"2023-07-21T14:57:51.688079+00:00\",\"modified_at\":\"2023-07-21T14:58:21.332326+00:00\",\"config\":{\"assertions\":[],\"configVariables\":[],\"request\":{\"method\":\"GET\",\"timeout\":60,\"url\":\"https://www.datadoghq.com\"},\"variables\":[]},\"message\":\"Notify @datadog.user\",\"options\":{\"device_ids\":[\"laptop_large\"],\"min_location_failed\":1,\"tick_every\":900},\"locations\":[\"aws:eu-central-1\"],\"monitor_id\":126283369,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}},{\"public_id\":\"i9r-v4f-v3u\",\"name\":\"tf-TestAccDatadogSyntheticsBrowserTest_Updated_RumSettings-local-1689951491-updated-rumsettings\",\"status\":\"live\",\"type\":\"browser\",\"tags\":[\"foo:bar\",\"buz\"],\"created_at\":\"2023-07-21T14:58:17.635359+00:00\",\"modified_at\":\"2023-08-28T14:37:49.734465+00:00\",\"config\":{\"assertions\":[],\"configVariables\":[],\"request\":{\"method\":\"GET\",\"headers\":{\"Accept\":\"application/xml\",\"X-Datadog-Trace-ID\":\"987654321\"},\"url\":\"https://docs.datadoghq.com\"},\"setCookie\":\"\",\"variables\":[{\"example\":\"7956\",\"name\":\"MY_PATTERN_VAR\",\"pattern\":\"{{numeric(4)}}\",\"secure\":false,\"type\":\"text\"}]},\"message\":\"Notify @pagerduty\",\"options\":{\"device_ids\":[\"chrome.laptop_large\",\"chrome.tablet\"],\"ignoreServerCertificateError\":false,\"disableCors\":false,\"disableCsp\":false,\"noScreenshot\":false,\"tick_every\":1800,\"min_failure_duration\":10,\"min_location_failed\":1,\"retry\":{\"count\":3,\"interval\":500},\"monitor_options\":{\"renotify_interval\":120},\"ci\":{\"executionRule\":\"skipped\"},\"rumSettings\":{\"isEnabled\":false},\"enableProfiling\":false,\"enableSecurityTesting\":false},\"locations\":[\"aws:eu-central-1\"],\"monitor_id\":126283421,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}}],\"total\":3}"
45+
},
46+
"cookies": [],
47+
"headers": [
48+
{
49+
"name": "content-type",
50+
"value": "application/json"
51+
}
52+
],
53+
"headersSize": 665,
54+
"httpVersion": "HTTP/1.1",
55+
"redirectURL": "",
56+
"status": 200,
57+
"statusText": "OK"
58+
},
59+
"startedDateTime": "2023-08-30T09:42:25.580Z",
60+
"time": 1867
61+
},
62+
{
63+
"_id": "7ec174e70c2c2725d1fa011cd87e22f9",
64+
"_order": 0,
65+
"cache": {},
66+
"request": {
67+
"bodySize": 0,
68+
"cookies": [],
69+
"headers": [
70+
{
71+
"_fromType": "array",
72+
"name": "accept",
73+
"value": "application/json"
74+
}
75+
],
76+
"headersSize": 532,
77+
"httpVersion": "HTTP/1.1",
78+
"method": "GET",
79+
"queryString": [
80+
{
81+
"name": "page_size",
82+
"value": "2"
83+
},
84+
{
85+
"name": "page_number",
86+
"value": "1"
87+
}
88+
],
89+
"url": "https://api.datadoghq.com/api/v1/synthetics/tests?page_size=2&page_number=1"
90+
},
91+
"response": {
92+
"bodySize": 2014,
93+
"content": {
94+
"mimeType": "application/json",
95+
"size": 2014,
96+
"text": "{\"tests\":[{\"public_id\":\"p34-3up-y6p\",\"name\":\"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response_1692944481\",\"status\":\"live\",\"type\":\"api\",\"tags\":[\"testing:api\"],\"created_at\":\"2023-08-25T06:21:21.640836+00:00\",\"modified_at\":\"2023-08-25T06:21:21.640836+00:00\",\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"xPath\":\"target-xpath\",\"targetValue\":\"0\",\"operator\":\"contains\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1692944481\"},\"method\":\"GET\",\"timeout\":10,\"url\":\"https://datadoghq.com\",\"proxy\":{\"url\":\"https://datadoghq.com\",\"headers\":{}},\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"persistCookies\":true}},\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response_1692944481\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60,\"httpVersion\":\"http2\"},\"locations\":[\"aws:us-east-2\"],\"subtype\":\"http\",\"monitor_id\":130283608,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}}],\"total\":3}"
97+
},
98+
"cookies": [],
99+
"headers": [
100+
{
101+
"name": "content-type",
102+
"value": "application/json"
103+
}
104+
],
105+
"headersSize": 665,
106+
"httpVersion": "HTTP/1.1",
107+
"redirectURL": "",
108+
"status": 200,
109+
"statusText": "OK"
110+
},
111+
"startedDateTime": "2023-08-30T09:42:27.456Z",
112+
"time": 1557
113+
}
114+
],
115+
"pages": [],
116+
"version": "1.2"
117+
}
118+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." 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.SyntheticsApi(configuration);
9+
10+
const params: v1.SyntheticsApiListTestsRequest = {
11+
pageSize: 2,
12+
};
13+
14+
(async () => {
15+
try {
16+
for await (const item of apiInstance.listTestsWithPagination(params)) {
17+
console.log(item);
18+
}
19+
} catch (error) {
20+
console.error(error);
21+
}
22+
})();

features/support/scenarios_model_mapping.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,12 +1975,12 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
19751975
},
19761976
"v1.ListTests": {
19771977
"pageSize": {
1978-
"type": "string",
1979-
"format": "",
1978+
"type": "number",
1979+
"format": "int64",
19801980
},
19811981
"pageNumber": {
1982-
"type": "string",
1983-
"format": "",
1982+
"type": "number",
1983+
"format": "int64",
19841984
},
19851985
"operationResponseType": "SyntheticsListTestsResponse",
19861986
},

features/v1/synthetics.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,14 @@ Feature: Synthetics
534534
When the request is sent
535535
Then the response status is 200 OK - Returns the list of all Synthetic tests.
536536

537+
@team:DataDog/synthetics-app @with-pagination
538+
Scenario: Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." response with pagination
539+
Given new "ListTests" request
540+
And request contains "page_size" parameter with value 2
541+
When the request with pagination is sent
542+
Then the response status is 200 OK - Returns the list of all Synthetic tests.
543+
And the response has 3 items
544+
537545
@generated @skip @team:DataDog/synthetics-app
538546
Scenario: Get the list of all Synthetic tests returns "Synthetic Monitoring is not activated for the user." response
539547
Given new "ListTests" request

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

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,8 @@ export class SyntheticsApiRequestFactory extends BaseAPIRequestFactory {
844844
}
845845

846846
public async listTests(
847-
pageSize?: string,
848-
pageNumber?: string,
847+
pageSize?: number,
848+
pageNumber?: number,
849849
_options?: Configuration
850850
): Promise<RequestContext> {
851851
const _config = _options || this.configuration;
@@ -864,13 +864,13 @@ export class SyntheticsApiRequestFactory extends BaseAPIRequestFactory {
864864
if (pageSize !== undefined) {
865865
requestContext.setQueryParam(
866866
"page_size",
867-
ObjectSerializer.serialize(pageSize, "string", "")
867+
ObjectSerializer.serialize(pageSize, "number", "int64")
868868
);
869869
}
870870
if (pageNumber !== undefined) {
871871
requestContext.setQueryParam(
872872
"page_number",
873-
ObjectSerializer.serialize(pageNumber, "string", "")
873+
ObjectSerializer.serialize(pageNumber, "number", "int64")
874874
);
875875
}
876876

@@ -3083,14 +3083,14 @@ export interface SyntheticsApiGetTestRequest {
30833083
export interface SyntheticsApiListTestsRequest {
30843084
/**
30853085
* Used for pagination. The number of tests returned in the page.
3086-
* @type string
3086+
* @type number
30873087
*/
3088-
pageSize?: string;
3088+
pageSize?: number;
30893089
/**
30903090
* Used for pagination. Which page you want to retrieve. Starts at zero.
3091-
* @type string
3091+
* @type number
30923092
*/
3093-
pageNumber?: string;
3093+
pageNumber?: number;
30943094
}
30953095

30963096
export interface SyntheticsApiTriggerCITestsRequest {
@@ -3650,6 +3650,45 @@ export class SyntheticsApi {
36503650
});
36513651
}
36523652

3653+
/**
3654+
* Provide a paginated version of listTests returning a generator with all the items.
3655+
*/
3656+
public async *listTestsWithPagination(
3657+
param: SyntheticsApiListTestsRequest = {},
3658+
options?: Configuration
3659+
): AsyncGenerator<SyntheticsTestDetails> {
3660+
let pageSize = 100;
3661+
if (param.pageSize !== undefined) {
3662+
pageSize = param.pageSize;
3663+
}
3664+
param.pageSize = pageSize;
3665+
param.pageNumber = 0;
3666+
while (true) {
3667+
const requestContext = await this.requestFactory.listTests(
3668+
param.pageSize,
3669+
param.pageNumber,
3670+
options
3671+
);
3672+
const responseContext = await this.configuration.httpApi.send(
3673+
requestContext
3674+
);
3675+
3676+
const response = await this.responseProcessor.listTests(responseContext);
3677+
const responseTests = response.tests;
3678+
if (responseTests === undefined) {
3679+
break;
3680+
}
3681+
const results = responseTests;
3682+
for (const item of results) {
3683+
yield item;
3684+
}
3685+
if (results.length < pageSize) {
3686+
break;
3687+
}
3688+
param.pageNumber = param.pageNumber + 1;
3689+
}
3690+
}
3691+
36533692
/**
36543693
* Trigger a set of Synthetic tests for continuous integration.
36553694
* @param param The request object

0 commit comments

Comments
 (0)