Skip to content

Commit 72bc3ea

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 542b5e9f of spec repo
1 parent fa55bc8 commit 72bc3ea

29 files changed

+404
-85
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": "2023-10-10 13:47:40.326078",
8-
"spec_repo_commit": "afb48804"
7+
"regenerated": "2023-10-11 19:28:58.600471",
8+
"spec_repo_commit": "542b5e9f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-10 13:47:40.346011",
13-
"spec_repo_commit": "afb48804"
12+
"regenerated": "2023-10-11 19:28:58.615017",
13+
"spec_repo_commit": "542b5e9f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23874,6 +23874,18 @@ paths:
2387423874
get:
2387523875
description: Get a list of all powerpacks.
2387623876
operationId: ListPowerpacks
23877+
parameters:
23878+
- description: Maximum number of powerpacks in the response.
23879+
example: 25
23880+
in: query
23881+
name: page[limit]
23882+
required: false
23883+
schema:
23884+
default: 25
23885+
format: int64
23886+
maximum: 1000
23887+
type: integer
23888+
- $ref: '#/components/parameters/PageOffset'
2387723889
responses:
2387823890
'200':
2387923891
content:
@@ -23891,6 +23903,10 @@ paths:
2389123903
summary: Get all powerpacks
2389223904
tags:
2389323905
- Powerpack
23906+
x-pagination:
23907+
limitParam: page[limit]
23908+
pageOffsetParam: page[offset]
23909+
resultsPath: data
2389423910
post:
2389523911
description: Create a powerpack.
2389623912
operationId: CreatePowerpack

examples/v2/powerpack/CreatePowerpack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void main(String[] args) {
4848
.width(12L)
4949
.x(0L)
5050
.y(0L)))
51-
.name("Sample Powerpack")
51+
.name("Example-Powerpack")
5252
.tags(Collections.singletonList("tag:sample"))
5353
.templateVariables(
5454
Collections.singletonList(

examples/v2/powerpack/ListPowerpacks.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.datadog.api.client.ApiClient;
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.v2.api.PowerpackApi;
6+
import com.datadog.api.client.v2.api.PowerpackApi.ListPowerpacksOptionalParameters;
67
import com.datadog.api.client.v2.model.ListPowerpacksResponse;
78

89
public class Example {
@@ -11,7 +12,8 @@ public static void main(String[] args) {
1112
PowerpackApi apiInstance = new PowerpackApi(defaultClient);
1213

1314
try {
14-
ListPowerpacksResponse result = apiInstance.listPowerpacks();
15+
ListPowerpacksResponse result =
16+
apiInstance.listPowerpacks(new ListPowerpacksOptionalParameters().pageLimit(1000L));
1517
System.out.println(result);
1618
} catch (ApiException e) {
1719
System.err.println("Exception when calling PowerpackApi#listPowerpacks");
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Get all powerpacks returns "OK" response with pagination
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.PaginationIterable;
5+
import com.datadog.api.client.v2.api.PowerpackApi;
6+
import com.datadog.api.client.v2.api.PowerpackApi.ListPowerpacksOptionalParameters;
7+
import com.datadog.api.client.v2.model.PowerpackData;
8+
9+
public class Example {
10+
public static void main(String[] args) {
11+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
12+
PowerpackApi apiInstance = new PowerpackApi(defaultClient);
13+
14+
try {
15+
PaginationIterable<PowerpackData> iterable =
16+
apiInstance.listPowerpacksWithPagination(
17+
new ListPowerpacksOptionalParameters().pageLimit(2L));
18+
19+
for (PowerpackData item : iterable) {
20+
System.out.println(item);
21+
}
22+
} catch (RuntimeException e) {
23+
System.err.println("Exception when calling PowerpackApi#listPowerpacksWithPagination");
24+
System.err.println("Reason: " + e.getMessage());
25+
e.printStackTrace();
26+
}
27+
}
28+
}

examples/v2/powerpack/UpdatePowerpack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static void main(String[] args) {
5151
.width(12L)
5252
.x(0L)
5353
.y(0L)))
54-
.name("Sample Powerpack")
54+
.name("Example-Powerpack")
5555
.tags(Collections.singletonList("tag:sample"))
5656
.templateVariables(
5757
Collections.singletonList(

src/main/java/com/datadog/api/client/v2/api/PowerpackApi.java

Lines changed: 138 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
import com.datadog.api.client.ApiClient;
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.ApiResponse;
6+
import com.datadog.api.client.PaginationIterable;
67
import com.datadog.api.client.Pair;
78
import com.datadog.api.client.v2.model.ListPowerpacksResponse;
89
import com.datadog.api.client.v2.model.Powerpack;
10+
import com.datadog.api.client.v2.model.PowerpackData;
911
import com.datadog.api.client.v2.model.PowerpackResponse;
1012
import jakarta.ws.rs.client.Invocation;
1113
import jakarta.ws.rs.core.GenericType;
1214
import java.util.ArrayList;
1315
import java.util.HashMap;
16+
import java.util.LinkedHashMap;
17+
import java.util.List;
1418
import java.util.Map;
1519
import java.util.concurrent.CompletableFuture;
1620

@@ -444,6 +448,35 @@ public CompletableFuture<ApiResponse<PowerpackResponse>> getPowerpackWithHttpInf
444448
new GenericType<PowerpackResponse>() {});
445449
}
446450

451+
/** Manage optional parameters to listPowerpacks. */
452+
public static class ListPowerpacksOptionalParameters {
453+
private Long pageLimit;
454+
private Long pageOffset;
455+
456+
/**
457+
* Set pageLimit.
458+
*
459+
* @param pageLimit Maximum number of powerpacks in the response. (optional, default to 25)
460+
* @return ListPowerpacksOptionalParameters
461+
*/
462+
public ListPowerpacksOptionalParameters pageLimit(Long pageLimit) {
463+
this.pageLimit = pageLimit;
464+
return this;
465+
}
466+
467+
/**
468+
* Set pageOffset.
469+
*
470+
* @param pageOffset Specific offset to use as the beginning of the returned page. (optional,
471+
* default to 0)
472+
* @return ListPowerpacksOptionalParameters
473+
*/
474+
public ListPowerpacksOptionalParameters pageOffset(Long pageOffset) {
475+
this.pageOffset = pageOffset;
476+
return this;
477+
}
478+
}
479+
447480
/**
448481
* Get all powerpacks.
449482
*
@@ -453,7 +486,7 @@ public CompletableFuture<ApiResponse<PowerpackResponse>> getPowerpackWithHttpInf
453486
* @throws ApiException if fails to make API call
454487
*/
455488
public ListPowerpacksResponse listPowerpacks() throws ApiException {
456-
return listPowerpacksWithHttpInfo().getData();
489+
return listPowerpacksWithHttpInfo(new ListPowerpacksOptionalParameters()).getData();
457490
}
458491

459492
/**
@@ -464,16 +497,100 @@ public ListPowerpacksResponse listPowerpacks() throws ApiException {
464497
* @return CompletableFuture&lt;ListPowerpacksResponse&gt;
465498
*/
466499
public CompletableFuture<ListPowerpacksResponse> listPowerpacksAsync() {
467-
return listPowerpacksWithHttpInfoAsync()
500+
return listPowerpacksWithHttpInfoAsync(new ListPowerpacksOptionalParameters())
501+
.thenApply(
502+
response -> {
503+
return response.getData();
504+
});
505+
}
506+
507+
/**
508+
* Get all powerpacks.
509+
*
510+
* <p>See {@link #listPowerpacksWithHttpInfo}.
511+
*
512+
* @param parameters Optional parameters for the request.
513+
* @return ListPowerpacksResponse
514+
* @throws ApiException if fails to make API call
515+
*/
516+
public ListPowerpacksResponse listPowerpacks(ListPowerpacksOptionalParameters parameters)
517+
throws ApiException {
518+
return listPowerpacksWithHttpInfo(parameters).getData();
519+
}
520+
521+
/**
522+
* Get all powerpacks.
523+
*
524+
* <p>See {@link #listPowerpacksWithHttpInfoAsync}.
525+
*
526+
* @param parameters Optional parameters for the request.
527+
* @return CompletableFuture&lt;ListPowerpacksResponse&gt;
528+
*/
529+
public CompletableFuture<ListPowerpacksResponse> listPowerpacksAsync(
530+
ListPowerpacksOptionalParameters parameters) {
531+
return listPowerpacksWithHttpInfoAsync(parameters)
468532
.thenApply(
469533
response -> {
470534
return response.getData();
471535
});
472536
}
473537

538+
/**
539+
* Get all powerpacks.
540+
*
541+
* <p>See {@link #listPowerpacksWithHttpInfo}.
542+
*
543+
* @return PaginationIterable&lt;PowerpackData&gt;
544+
*/
545+
public PaginationIterable<PowerpackData> listPowerpacksWithPagination() {
546+
ListPowerpacksOptionalParameters parameters = new ListPowerpacksOptionalParameters();
547+
return listPowerpacksWithPagination(parameters);
548+
}
549+
550+
/**
551+
* Get all powerpacks.
552+
*
553+
* <p>See {@link #listPowerpacksWithHttpInfo}.
554+
*
555+
* @return ListPowerpacksResponse
556+
*/
557+
public PaginationIterable<PowerpackData> listPowerpacksWithPagination(
558+
ListPowerpacksOptionalParameters parameters) {
559+
String resultsPath = "getData";
560+
String valueGetterPath = "";
561+
String valueSetterPath = "pageOffset";
562+
Boolean valueSetterParamOptional = true;
563+
Long limit;
564+
565+
if (parameters.pageLimit == null) {
566+
limit = 25l;
567+
parameters.pageLimit(limit);
568+
} else {
569+
limit = parameters.pageLimit;
570+
}
571+
572+
LinkedHashMap<String, Object> args = new LinkedHashMap<String, Object>();
573+
args.put("optionalParams", parameters);
574+
575+
PaginationIterable iterator =
576+
new PaginationIterable(
577+
this,
578+
"listPowerpacks",
579+
resultsPath,
580+
valueGetterPath,
581+
valueSetterPath,
582+
valueSetterParamOptional,
583+
true,
584+
limit,
585+
args);
586+
587+
return iterator;
588+
}
589+
474590
/**
475591
* Get a list of all powerpacks.
476592
*
593+
* @param parameters Optional parameters for the request.
477594
* @return ApiResponse&lt;ListPowerpacksResponse&gt;
478595
* @throws ApiException if fails to make API call
479596
* @http.response.details
@@ -484,18 +601,25 @@ public CompletableFuture<ListPowerpacksResponse> listPowerpacksAsync() {
484601
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
485602
* </table>
486603
*/
487-
public ApiResponse<ListPowerpacksResponse> listPowerpacksWithHttpInfo() throws ApiException {
604+
public ApiResponse<ListPowerpacksResponse> listPowerpacksWithHttpInfo(
605+
ListPowerpacksOptionalParameters parameters) throws ApiException {
488606
Object localVarPostBody = null;
607+
Long pageLimit = parameters.pageLimit;
608+
Long pageOffset = parameters.pageOffset;
489609
// create path and map variables
490610
String localVarPath = "/api/v2/powerpacks";
491611

612+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
492613
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
493614

615+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit));
616+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset));
617+
494618
Invocation.Builder builder =
495619
apiClient.createBuilder(
496620
"v2.PowerpackApi.listPowerpacks",
497621
localVarPath,
498-
new ArrayList<Pair>(),
622+
localVarQueryParams,
499623
localVarHeaderParams,
500624
new HashMap<String, String>(),
501625
new String[] {"application/json"},
@@ -516,22 +640,30 @@ public ApiResponse<ListPowerpacksResponse> listPowerpacksWithHttpInfo() throws A
516640
*
517641
* <p>See {@link #listPowerpacksWithHttpInfo}.
518642
*
643+
* @param parameters Optional parameters for the request.
519644
* @return CompletableFuture&lt;ApiResponse&lt;ListPowerpacksResponse&gt;&gt;
520645
*/
521-
public CompletableFuture<ApiResponse<ListPowerpacksResponse>> listPowerpacksWithHttpInfoAsync() {
646+
public CompletableFuture<ApiResponse<ListPowerpacksResponse>> listPowerpacksWithHttpInfoAsync(
647+
ListPowerpacksOptionalParameters parameters) {
522648
Object localVarPostBody = null;
649+
Long pageLimit = parameters.pageLimit;
650+
Long pageOffset = parameters.pageOffset;
523651
// create path and map variables
524652
String localVarPath = "/api/v2/powerpacks";
525653

654+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
526655
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
527656

657+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit));
658+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset));
659+
528660
Invocation.Builder builder;
529661
try {
530662
builder =
531663
apiClient.createBuilder(
532664
"v2.PowerpackApi.listPowerpacks",
533665
localVarPath,
534-
new ArrayList<Pair>(),
666+
localVarQueryParams,
535667
localVarHeaderParams,
536668
new HashMap<String, String>(),
537669
new String[] {"application/json"},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-09-26T21:29:30.230Z
1+
2023-10-11T18:44:47.026Z

0 commit comments

Comments
 (0)