change java default lib to okhttp-gson

This commit is contained in:
wing328
2016-07-06 22:10:00 +08:00
parent d402f35711
commit 3b780e30d8
127 changed files with 5393 additions and 3484 deletions

View File

@@ -7,13 +7,6 @@ Name | Type | Description | Notes
**arrayOfString** | **List<String>** | | [optional]
**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional]
**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional]
**arrayOfEnum** | [**List<ArrayOfEnumEnum>**](#List<ArrayOfEnumEnum>) | | [optional]
<a name="List<ArrayOfEnumEnum>"></a>
## Enum: List&lt;ArrayOfEnumEnum&gt;
Name | Value
---- | -----

View File

@@ -4,53 +4,10 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection &#x3D;end
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
<a name="testCodeInjectEnd"></a>
# **testCodeInjectEnd**
> testCodeInjectEnd(testCodeInjectEnd)
To test code injection &#x3D;end
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String testCodeInjectEnd = "testCodeInjectEnd_example"; // String | To test code injection =end
try {
apiInstance.testCodeInjectEnd(testCodeInjectEnd);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testCodeInjectEnd");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**testCodeInjectEnd** | **String**| To test code injection &#x3D;end | [optional]
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json, */ =end'));(phpinfo('
- **Accept**: application/json, */ end
<a name="testEndpointParameters"></a>
# **testEndpointParameters**
> testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password)

View File

@@ -812,6 +812,7 @@ public class ApiClient {
* @throws ApiException If fail to deserialize response body, i.e. cannot read response body
* or the Content-Type of the response is not supported.
*/
@SuppressWarnings("unchecked")
public <T> T deserialize(Response response, Type returnType) throws ApiException {
if (response == null || returnType == null) {
return null;
@@ -1006,6 +1007,7 @@ public class ApiClient {
* @param returnType Return type
* @param callback ApiCallback
*/
@SuppressWarnings("unchecked")
public <T> void executeAsync(Call call, final Type returnType, final ApiCallback<T> callback) {
call.enqueue(new Callback() {
@Override

View File

@@ -103,6 +103,7 @@ public class JSON {
* @param returnType The type to deserialize inot
* @return The deserialized Java object
*/
@SuppressWarnings("unchecked")
public <T> T deserialize(String body, Type returnType) {
try {
if (apiClient.isLenientOnJson()) {

View File

@@ -67,105 +67,6 @@ public class FakeApi {
this.apiClient = apiClient;
}
/* Build call for testCodeInjectEnd */
private com.squareup.okhttp.Call testCodeInjectEndCall(String testCodeInjectEnd, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake".replaceAll("\\{format\\}","json");
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (testCodeInjectEnd != null)
localVarFormParams.put("test code inject */ &#x3D;end", testCodeInjectEnd);
final String[] localVarAccepts = {
"application/json", "*/ end"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json", "*/ =end'));(phpinfo('"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
/**
* To test code injection &#x3D;end
*
* @param testCodeInjectEnd To test code injection &#x3D;end (optional)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void testCodeInjectEnd(String testCodeInjectEnd) throws ApiException {
testCodeInjectEndWithHttpInfo(testCodeInjectEnd);
}
/**
* To test code injection &#x3D;end
*
* @param testCodeInjectEnd To test code injection &#x3D;end (optional)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> testCodeInjectEndWithHttpInfo(String testCodeInjectEnd) throws ApiException {
com.squareup.okhttp.Call call = testCodeInjectEndCall(testCodeInjectEnd, null, null);
return apiClient.execute(call);
}
/**
* To test code injection &#x3D;end (asynchronously)
*
* @param testCodeInjectEnd To test code injection &#x3D;end (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 testCodeInjectEndAsync(String testCodeInjectEnd, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = testCodeInjectEndCall(testCodeInjectEnd, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/* Build call for testEndpointParameters */
private com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;

View File

@@ -48,31 +48,6 @@ public class ArrayTest {
@SerializedName("array_array_of_model")
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
/**
* Gets or Sets arrayOfEnum
*/
public enum ArrayOfEnumEnum {
@SerializedName("UPPER")
UPPER("UPPER"),
@SerializedName("lower")
LOWER("lower");
private String value;
ArrayOfEnumEnum(String value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
@SerializedName("array_of_enum")
private List<ArrayOfEnumEnum> arrayOfEnum = new ArrayList<ArrayOfEnumEnum>();
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
return this;
@@ -127,24 +102,6 @@ public class ArrayTest {
this.arrayArrayOfModel = arrayArrayOfModel;
}
public ArrayTest arrayOfEnum(List<ArrayOfEnumEnum> arrayOfEnum) {
this.arrayOfEnum = arrayOfEnum;
return this;
}
/**
* Get arrayOfEnum
* @return arrayOfEnum
**/
@ApiModelProperty(example = "null", value = "")
public List<ArrayOfEnumEnum> getArrayOfEnum() {
return arrayOfEnum;
}
public void setArrayOfEnum(List<ArrayOfEnumEnum> arrayOfEnum) {
this.arrayOfEnum = arrayOfEnum;
}
@Override
public boolean equals(java.lang.Object o) {
@@ -157,13 +114,12 @@ public class ArrayTest {
ArrayTest arrayTest = (ArrayTest) o;
return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) &&
Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) &&
Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel) &&
Objects.equals(this.arrayOfEnum, arrayTest.arrayOfEnum);
Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel);
}
@Override
public int hashCode() {
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel, arrayOfEnum);
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel);
}
@Override
@@ -174,7 +130,6 @@ public class ArrayTest {
sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n");
sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n");
sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n");
sb.append(" arrayOfEnum: ").append(toIndentedString(arrayOfEnum)).append("\n");
sb.append("}");
return sb.toString();
}