Skip to content

Commit be9c073

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add support for API management ListAPIs (#1648)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent a012d47 commit be9c073

File tree

14 files changed

+594
-4
lines changed

14 files changed

+594
-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.6",
7-
"regenerated": "2024-06-11 09:38:21.368112",
8-
"spec_repo_commit": "cee92551"
7+
"regenerated": "2024-06-11 14:30:58.357339",
8+
"spec_repo_commit": "71f2f0da"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-06-11 09:38:21.386389",
13-
"spec_repo_commit": "cee92551"
12+
"regenerated": "2024-06-11 14:30:58.375959",
13+
"spec_repo_commit": "71f2f0da"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10554,6 +10554,52 @@ components:
1055410554
description: Jira project key
1055510555
type: string
1055610556
type: object
10557+
ListAPIsResponse:
10558+
description: Response for `ListAPIs`.
10559+
properties:
10560+
data:
10561+
description: List of API items.
10562+
items:
10563+
$ref: '#/components/schemas/ListAPIsResponseData'
10564+
type: array
10565+
meta:
10566+
$ref: '#/components/schemas/ListAPIsResponseMeta'
10567+
type: object
10568+
ListAPIsResponseData:
10569+
description: Data envelope for `ListAPIsResponse`.
10570+
properties:
10571+
id:
10572+
$ref: '#/components/schemas/ApiID'
10573+
name:
10574+
description: API name.
10575+
example: Payments API
10576+
type: string
10577+
type: object
10578+
ListAPIsResponseMeta:
10579+
description: Metadata for `ListAPIsResponse`.
10580+
properties:
10581+
pagination:
10582+
$ref: '#/components/schemas/ListAPIsResponseMetaPagination'
10583+
type: object
10584+
ListAPIsResponseMetaPagination:
10585+
description: Pagination metadata information for `ListAPIsResponse`.
10586+
properties:
10587+
limit:
10588+
description: Number of items in the current page.
10589+
example: 20
10590+
format: int64
10591+
type: integer
10592+
offset:
10593+
description: Offset for pagination.
10594+
example: 0
10595+
format: int64
10596+
type: integer
10597+
total_count:
10598+
description: Total number of items.
10599+
example: 35
10600+
format: int64
10601+
type: integer
10602+
type: object
1055710603
ListApplicationKeysResponse:
1055810604
description: Response for a list of application keys.
1055910605
properties:
@@ -23350,6 +23396,63 @@ paths:
2335023396
tags:
2335123397
- Key Management
2335223398
x-codegen-request-body-name: body
23399+
/api/v2/apicatalog/api:
23400+
get:
23401+
description: List APIs and their IDs.
23402+
operationId: ListAPIs
23403+
parameters:
23404+
- description: Filter APIs by name
23405+
in: query
23406+
name: query
23407+
required: false
23408+
schema:
23409+
example: payments
23410+
type: string
23411+
- description: Number of items per page.
23412+
in: query
23413+
name: page[limit]
23414+
required: false
23415+
schema:
23416+
default: 20
23417+
format: int64
23418+
minimum: 1
23419+
type: integer
23420+
- description: Offset for pagination.
23421+
in: query
23422+
name: page[offset]
23423+
required: false
23424+
schema:
23425+
default: 0
23426+
format: int64
23427+
minimum: 0
23428+
type: integer
23429+
responses:
23430+
'200':
23431+
content:
23432+
application/json:
23433+
schema:
23434+
$ref: '#/components/schemas/ListAPIsResponse'
23435+
description: OK
23436+
'400':
23437+
content:
23438+
application/json:
23439+
schema:
23440+
$ref: '#/components/schemas/JSONAPIErrorResponse'
23441+
description: Bad request
23442+
'403':
23443+
content:
23444+
application/json:
23445+
schema:
23446+
$ref: '#/components/schemas/JSONAPIErrorResponse'
23447+
description: Forbidden
23448+
'429':
23449+
$ref: '#/components/responses/TooManyRequestsResponse'
23450+
summary: List APIs
23451+
tags:
23452+
- API Management
23453+
x-unstable: '**Note**: This endpoint is in public beta.
23454+
23455+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
2335323456
/api/v2/apicatalog/api/{id}:
2335423457
delete:
2335523458
description: Delete a specific API by ID.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* List APIs returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.listAPIs"] = true;
9+
const apiInstance = new v2.APIManagementApi(configuration);
10+
11+
apiInstance
12+
.listAPIs()
13+
.then((data: v2.ListAPIsResponse) => {
14+
console.log(
15+
"API called successfully. Returned data: " + JSON.stringify(data)
16+
);
17+
})
18+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,21 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
24722472
},
24732473
"operationResponseType": "ApplicationKeyResponse",
24742474
},
2475+
"v2.ListAPIs": {
2476+
"query": {
2477+
"type": "string",
2478+
"format": "",
2479+
},
2480+
"pageLimit": {
2481+
"type": "number",
2482+
"format": "int64",
2483+
},
2484+
"pageOffset": {
2485+
"type": "number",
2486+
"format": "int64",
2487+
},
2488+
"operationResponseType": "ListAPIsResponse",
2489+
},
24752490
"v2.DeleteOpenAPI": {
24762491
"id": {
24772492
"type": "string",

features/v2/api_management.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ Feature: API Management
7373
When the request is sent
7474
Then the response status is 200 OK
7575

76+
@generated @skip @team:DataDog/api-management
77+
Scenario: List APIs returns "Bad request" response
78+
Given operation "ListAPIs" enabled
79+
And new "ListAPIs" request
80+
When the request is sent
81+
Then the response status is 400 Bad request
82+
83+
@generated @skip @team:DataDog/api-management
84+
Scenario: List APIs returns "OK" response
85+
Given operation "ListAPIs" enabled
86+
And new "ListAPIs" request
87+
When the request is sent
88+
Then the response status is 200 OK
89+
7690
@generated @skip @team:DataDog/api-management
7791
Scenario: Update an API returns "API not found error" response
7892
Given operation "UpdateOpenAPI" enabled

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
"type": "idempotent"
3737
}
3838
},
39+
"ListAPIs": {
40+
"tag": "API Management",
41+
"undo": {
42+
"type": "safe"
43+
}
44+
},
3945
"DeleteOpenAPI": {
4046
"tag": "API Management",
4147
"undo": {

packages/datadog-api-client-common/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export function createConfiguration(
217217
"v2.createOpenAPI": false,
218218
"v2.deleteOpenAPI": false,
219219
"v2.getOpenAPI": false,
220+
"v2.listAPIs": false,
220221
"v2.updateOpenAPI": false,
221222
"v2.getActiveBillingDimensions": false,
222223
"v2.getMonthlyCostAttribution": false,

0 commit comments

Comments
 (0)