mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 17:12:49 +00:00
[Java][okhttp-gson] Add option to employ builders for API requests (#1341)
* Generate APIs that use the builder pattern * Add option to use builders for API requests * Fix template spacing * Add new sample-generation script and generated samples * Update docs * Add new sample-generation script for Windows * Replace config option with vendor extension * Remove useBuildersForApiRequests config option * Remove builders sample-generation scripts * Replace config option with vendor extension in api_test template * Remove okhttp-gson-requestBuilders sample * Rename x-builders-for-api-requests to x-group-parameters * Add modified api_doc.mustache under okhttp-gson resources * Add modified README.mustache under okhttp-gson resources * Update petstore samples * Fix FakeApiTest.java in petstore samples * Add whitespace to rerun checks * Remove whitespace to rerun tests * Fix FakeApiTest.java in parcelable petstore sample * Update versions in samples * Update versions in samples
This commit is contained in:
committed by
William Cheng
parent
3efe56752e
commit
9df70798b3
@@ -1305,20 +1305,7 @@ public class FakeApi {
|
||||
apiClient.executeAsync(call, callback);
|
||||
return call;
|
||||
}
|
||||
/**
|
||||
* Build call for testGroupParameters
|
||||
* @param requiredStringGroup Required String in group parameters (required)
|
||||
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||
* @param stringGroup String in group parameters (optional)
|
||||
* @param booleanGroup Boolean in group parameters (optional)
|
||||
* @param int64Group Integer in group parameters (optional)
|
||||
* @param progressListener Progress listener
|
||||
* @param progressRequestListener Progress request listener
|
||||
* @return Call to execute
|
||||
* @throws ApiException If fail to serialize the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
private com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// create path and map variables
|
||||
@@ -1406,52 +1393,13 @@ public class FakeApi {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* @param requiredStringGroup Required String in group parameters (required)
|
||||
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||
* @param stringGroup String in group parameters (optional)
|
||||
* @param booleanGroup Boolean in group parameters (optional)
|
||||
* @param int64Group Integer in group parameters (optional)
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||
testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* @param requiredStringGroup Required String in group parameters (required)
|
||||
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||
* @param stringGroup String in group parameters (optional)
|
||||
* @param booleanGroup Boolean in group parameters (optional)
|
||||
* @param int64Group Integer in group parameters (optional)
|
||||
* @return ApiResponse<Void>
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||
com.squareup.okhttp.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, null);
|
||||
return apiClient.execute(call);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test group parameters (optional) (asynchronously)
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* @param requiredStringGroup Required String in group parameters (required)
|
||||
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||
* @param stringGroup String in group parameters (optional)
|
||||
* @param booleanGroup Boolean in group parameters (optional)
|
||||
* @param int64Group Integer in group parameters (optional)
|
||||
* @param callback The callback to be executed when the API call finishes
|
||||
* @return The request call
|
||||
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback<Void> callback) throws ApiException {
|
||||
private com.squareup.okhttp.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback<Void> callback) throws ApiException {
|
||||
|
||||
ProgressResponseBody.ProgressListener progressListener = null;
|
||||
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||
@@ -1476,6 +1424,101 @@ public class FakeApi {
|
||||
apiClient.executeAsync(call, callback);
|
||||
return call;
|
||||
}
|
||||
|
||||
public class APItestGroupParametersRequest {
|
||||
private final Integer requiredStringGroup;
|
||||
private final Boolean requiredBooleanGroup;
|
||||
private final Long requiredInt64Group;
|
||||
private Integer stringGroup;
|
||||
private Boolean booleanGroup;
|
||||
private Long int64Group;
|
||||
|
||||
private APItestGroupParametersRequest(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group) {
|
||||
this.requiredStringGroup = requiredStringGroup;
|
||||
this.requiredBooleanGroup = requiredBooleanGroup;
|
||||
this.requiredInt64Group = requiredInt64Group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stringGroup
|
||||
* @param stringGroup String in group parameters (optional)
|
||||
* @return APItestGroupParametersRequest
|
||||
*/
|
||||
public APItestGroupParametersRequest stringGroup(Integer stringGroup) {
|
||||
this.stringGroup = stringGroup;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set booleanGroup
|
||||
* @param booleanGroup Boolean in group parameters (optional)
|
||||
* @return APItestGroupParametersRequest
|
||||
*/
|
||||
public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) {
|
||||
this.booleanGroup = booleanGroup;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set int64Group
|
||||
* @param int64Group Integer in group parameters (optional)
|
||||
* @return APItestGroupParametersRequest
|
||||
*/
|
||||
public APItestGroupParametersRequest int64Group(Long int64Group) {
|
||||
this.int64Group = int64Group;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build call for testGroupParameters
|
||||
* @param progressListener Progress listener
|
||||
* @param progressRequestListener Progress request listener
|
||||
* @return Call to execute
|
||||
* @throws ApiException If fail to serialize the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute testGroupParameters request
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public void execute() throws ApiException {
|
||||
testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute testGroupParameters request with HTTP info returned
|
||||
* @return ApiResponse<Void>
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public ApiResponse<Void> executeWithHttpInfo() throws ApiException {
|
||||
return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute testGroupParameters request (asynchronously)
|
||||
* @param callback The callback to be executed when the API call finishes
|
||||
* @return The request call
|
||||
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call executeAsync(final ApiCallback<Void> callback) throws ApiException {
|
||||
return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, callback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
* @param requiredStringGroup Required String in group parameters (required)
|
||||
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||
* @return APItestGroupParametersRequest
|
||||
*/
|
||||
public APItestGroupParametersRequest testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group) {
|
||||
return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group);
|
||||
}
|
||||
/**
|
||||
* Build call for testInlineAdditionalProperties
|
||||
* @param requestBody request body (required)
|
||||
|
||||
@@ -220,7 +220,11 @@ public class FakeApiTest {
|
||||
Integer stringGroup = null;
|
||||
Boolean booleanGroup = null;
|
||||
Long int64Group = null;
|
||||
api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group)
|
||||
.stringGroup(stringGroup)
|
||||
.booleanGroup(booleanGroup)
|
||||
.int64Group(int64Group)
|
||||
.execute();
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user