Skip to content

Commit 37eabc6

Browse files
committed
fixed commas, regenerated samples
1 parent 61014c0 commit 37eabc6

File tree

256 files changed

+51822
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+51822
-1370
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public class {{classname}} {
129129
@Deprecated
130130
{{/isDeprecated}}
131131
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException {
132-
return {{operationId}}(apiRequest, null);
132+
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}(apiRequest, null);
133133
}
134134

135135
/**
@@ -240,7 +240,7 @@ public class {{classname}} {
240240
@Deprecated
241241
{{/isDeprecated}}
242242
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
243-
return {{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, null);
243+
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}null);
244244
}
245245

246246
/**
@@ -279,7 +279,7 @@ public class {{classname}} {
279279
{{/asyncNative}}
280280
{{#asyncNative}}
281281
try {
282-
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#allParams}}, {{/allParams}}headers);
282+
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
283283
return memberVarHttpClient.sendAsync(
284284
localVarRequestBuilder.build(),
285285
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -327,7 +327,7 @@ public class {{classname}} {
327327
@Deprecated
328328
{{/isDeprecated}}
329329
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
330-
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, null);
330+
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}null);
331331
}
332332

333333
/**

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/AuthApi.java

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ public class AuthApi {
5454
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
5555
private final Consumer<HttpResponse<String>> memberVarAsyncResponseInterceptor;
5656

57-
// Custom headers to be sent with every request from this API client
58-
private final Map<String, String> extraHeaders = new java.util.HashMap<>();
59-
6057
public AuthApi() {
6158
this(Configuration.getDefaultApiClient());
6259
}
@@ -71,27 +68,6 @@ public AuthApi(ApiClient apiClient) {
7168
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
7269
}
7370

74-
/**
75-
* Add a custom header to be sent with every request from this API client.
76-
* @param name Header name
77-
* @param value Header value
78-
* @return this
79-
*/
80-
public AuthApi addHeader(String name, String value) {
81-
this.extraHeaders.put(name, value);
82-
return this;
83-
}
84-
85-
/**
86-
* Remove a custom header.
87-
* @param name Header name
88-
* @return this
89-
*/
90-
public AuthApi removeHeader(String name) {
91-
this.extraHeaders.remove(name);
92-
return this;
93-
}
94-
9571

9672
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
9773
String body = response.body() == null ? null : new String(response.body().readAllBytes());
@@ -113,7 +89,18 @@ private String formatExceptionMessage(String operationId, int statusCode, String
11389
* @throws ApiException if fails to make API call
11490
*/
11591
public String testAuthHttpBasic() throws ApiException {
116-
ApiResponse<String> localVarResponse = testAuthHttpBasicWithHttpInfo();
92+
return testAuthHttpBasic(null);
93+
}
94+
95+
/**
96+
* To test HTTP basic authentication
97+
* To test HTTP basic authentication
98+
* @param headers Optional headers to include in the request
99+
* @return String
100+
* @throws ApiException if fails to make API call
101+
*/
102+
public String testAuthHttpBasic(Map<String, String> headers) throws ApiException {
103+
ApiResponse<String> localVarResponse = testAuthHttpBasicWithHttpInfo(headers);
117104
return localVarResponse.getData();
118105
}
119106

@@ -124,7 +111,18 @@ public String testAuthHttpBasic() throws ApiException {
124111
* @throws ApiException if fails to make API call
125112
*/
126113
public ApiResponse<String> testAuthHttpBasicWithHttpInfo() throws ApiException {
127-
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBasicRequestBuilder();
114+
return testAuthHttpBasicWithHttpInfo(null);
115+
}
116+
117+
/**
118+
* To test HTTP basic authentication
119+
* To test HTTP basic authentication
120+
* @param headers Optional headers to include in the request
121+
* @return ApiResponse&lt;String&gt;
122+
* @throws ApiException if fails to make API call
123+
*/
124+
public ApiResponse<String> testAuthHttpBasicWithHttpInfo(Map<String, String> headers) throws ApiException {
125+
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBasicRequestBuilder(headers);
128126
try {
129127
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
130128
localVarRequestBuilder.build(),
@@ -160,7 +158,7 @@ public ApiResponse<String> testAuthHttpBasicWithHttpInfo() throws ApiException {
160158
}
161159
}
162160

163-
private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiException {
161+
private HttpRequest.Builder testAuthHttpBasicRequestBuilder(Map<String, String> headers) throws ApiException {
164162

165163
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
166164

@@ -174,9 +172,11 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio
174172
if (memberVarReadTimeout != null) {
175173
localVarRequestBuilder.timeout(memberVarReadTimeout);
176174
}
177-
// Add custom headers
178-
for (Map.Entry<String, String> entry : extraHeaders.entrySet()) {
179-
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
175+
// Add custom headers if provided
176+
if (headers != null) {
177+
for (Map.Entry<String, String> entry : headers.entrySet()) {
178+
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
179+
}
180180
}
181181
if (memberVarInterceptor != null) {
182182
memberVarInterceptor.accept(localVarRequestBuilder);
@@ -191,7 +191,18 @@ private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiExceptio
191191
* @throws ApiException if fails to make API call
192192
*/
193193
public String testAuthHttpBearer() throws ApiException {
194-
ApiResponse<String> localVarResponse = testAuthHttpBearerWithHttpInfo();
194+
return testAuthHttpBearer(null);
195+
}
196+
197+
/**
198+
* To test HTTP bearer authentication
199+
* To test HTTP bearer authentication
200+
* @param headers Optional headers to include in the request
201+
* @return String
202+
* @throws ApiException if fails to make API call
203+
*/
204+
public String testAuthHttpBearer(Map<String, String> headers) throws ApiException {
205+
ApiResponse<String> localVarResponse = testAuthHttpBearerWithHttpInfo(headers);
195206
return localVarResponse.getData();
196207
}
197208

@@ -202,7 +213,18 @@ public String testAuthHttpBearer() throws ApiException {
202213
* @throws ApiException if fails to make API call
203214
*/
204215
public ApiResponse<String> testAuthHttpBearerWithHttpInfo() throws ApiException {
205-
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBearerRequestBuilder();
216+
return testAuthHttpBearerWithHttpInfo(null);
217+
}
218+
219+
/**
220+
* To test HTTP bearer authentication
221+
* To test HTTP bearer authentication
222+
* @param headers Optional headers to include in the request
223+
* @return ApiResponse&lt;String&gt;
224+
* @throws ApiException if fails to make API call
225+
*/
226+
public ApiResponse<String> testAuthHttpBearerWithHttpInfo(Map<String, String> headers) throws ApiException {
227+
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBearerRequestBuilder(headers);
206228
try {
207229
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
208230
localVarRequestBuilder.build(),
@@ -238,7 +260,7 @@ public ApiResponse<String> testAuthHttpBearerWithHttpInfo() throws ApiException
238260
}
239261
}
240262

241-
private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiException {
263+
private HttpRequest.Builder testAuthHttpBearerRequestBuilder(Map<String, String> headers) throws ApiException {
242264

243265
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
244266

@@ -252,9 +274,11 @@ private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiExcepti
252274
if (memberVarReadTimeout != null) {
253275
localVarRequestBuilder.timeout(memberVarReadTimeout);
254276
}
255-
// Add custom headers
256-
for (Map.Entry<String, String> entry : extraHeaders.entrySet()) {
257-
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
277+
// Add custom headers if provided
278+
if (headers != null) {
279+
for (Map.Entry<String, String> entry : headers.entrySet()) {
280+
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
281+
}
258282
}
259283
if (memberVarInterceptor != null) {
260284
memberVarInterceptor.accept(localVarRequestBuilder);

0 commit comments

Comments
 (0)