Add more javadoc to Java okhttp-gson client

This commit is contained in:
xhh 2015-12-07 12:23:50 +08:00
parent b1bc75189a
commit 80ed75eef0
16 changed files with 125 additions and 10 deletions

View File

@ -597,6 +597,8 @@ public class ApiClient {
* @param response HTTP response
* @param returnType The type of the Java object
* @return The deserialized Java object
* @throws ApiException If fail to deserialize response body, i.e. cannot read response body
* or the Content-Type of the response is not supported.
*/
public <T> T deserialize(Response response, Type returnType) throws ApiException {
if (response == null || returnType == null)
@ -645,6 +647,7 @@ public class ApiClient {
* @param obj The Java object
* @param contentType The request Content-Type
* @return The serialized string
* @throws ApiException If fail to serialize the given object
*/
public String serialize(Object obj, String contentType) throws ApiException {
if (contentType.startsWith("application/json")) {
@ -659,6 +662,7 @@ public class ApiClient {
/**
* Download file from the given response.
* @throws ApiException If fail to read file content from response and write to disk
*/
public File downloadFileFromResponse(Response response) throws ApiException {
try {
@ -722,6 +726,7 @@ public class ApiClient {
* @return <code>ApiResponse</code> object containing response status, headers and
* data, which is a Java object deserialized from response body and would be null
* when returnType is null.
* @throws ApiException If fail to execute the call
*/
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
try {
@ -736,7 +741,7 @@ public class ApiClient {
/**
* #see executeAsync(Call, Type, ApiCallback)
*/
public <T> void executeAsync(Call call, ApiCallback<T> callback) throws ApiException {
public <T> void executeAsync(Call call, ApiCallback<T> callback) {
executeAsync(call, null, callback);
}
@ -767,6 +772,12 @@ public class ApiClient {
});
}
/**
* Handle the given response, return the deserialized object when the response is successful.
*
* @throws ApiException If the response has a unsuccessful status code or
* fail to deserialize the response body
*/
public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) {
@ -800,6 +811,7 @@ public class ApiClient {
* @param formParams The form parameters
* @param authNames The authentications to apply
* @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);

View File

@ -3,15 +3,29 @@ package {{invokerPackage}};
import java.util.List;
import java.util.Map;
/**
* API response returned by API call.
*
* @param T The type of data that is deserialized from response body
*/
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;

View File

@ -105,6 +105,7 @@ public class {{classname}} {
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{/allParams}}{{#returnType}}
* @return {{{returnType}}}{{/returnType}}
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
{{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
@ -116,6 +117,7 @@ public class {{classname}} {
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{/allParams}}
* @return ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null);
@ -129,6 +131,7 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{/allParams}}
* @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 Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException {

View File

@ -596,6 +596,8 @@ public class ApiClient {
* @param response HTTP response
* @param returnType The type of the Java object
* @return The deserialized Java object
* @throws ApiException If fail to deserialize response body, i.e. cannot read response body
* or the Content-Type of the response is not supported.
*/
public <T> T deserialize(Response response, Type returnType) throws ApiException {
if (response == null || returnType == null)
@ -644,6 +646,7 @@ public class ApiClient {
* @param obj The Java object
* @param contentType The request Content-Type
* @return The serialized string
* @throws ApiException If fail to serialize the given object
*/
public String serialize(Object obj, String contentType) throws ApiException {
if (contentType.startsWith("application/json")) {
@ -658,6 +661,7 @@ public class ApiClient {
/**
* Download file from the given response.
* @throws ApiException If fail to read file content from response and write to disk
*/
public File downloadFileFromResponse(Response response) throws ApiException {
try {
@ -721,6 +725,7 @@ public class ApiClient {
* @return <code>ApiResponse</code> object containing response status, headers and
* data, which is a Java object deserialized from response body and would be null
* when returnType is null.
* @throws ApiException If fail to execute the call
*/
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
try {
@ -735,7 +740,7 @@ public class ApiClient {
/**
* #see executeAsync(Call, Type, ApiCallback)
*/
public <T> void executeAsync(Call call, ApiCallback<T> callback) throws ApiException {
public <T> void executeAsync(Call call, ApiCallback<T> callback) {
executeAsync(call, null, callback);
}
@ -766,6 +771,12 @@ public class ApiClient {
});
}
/**
* Handle the given response, return the deserialized object when the response is successful.
*
* @throws ApiException If the response has a unsuccessful status code or
* fail to deserialize the response body
*/
public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) {
@ -799,6 +810,7 @@ public class ApiClient {
* @param formParams The form parameters
* @param authNames The authentications to apply
* @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);

View File

@ -3,7 +3,7 @@ package io.swagger.client;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;

View File

@ -3,15 +3,29 @@ package io.swagger.client;
import java.util.List;
import java.util.Map;
/**
* API response returned by API call.
*
* @param T The type of data that is deserialized from response body
*/
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class Pair {
private String name = "";
private String value = "";

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -89,6 +89,7 @@ public class PetApi {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void updatePet(Pet body) throws ApiException {
updatePetWithHttpInfo(body);
@ -99,6 +100,7 @@ public class PetApi {
*
* @param body Pet object that needs to be added to the store
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException {
Call call = updatePetCall(body, null, null);
@ -111,6 +113,7 @@ public class PetApi {
* @param body Pet object that needs to be added to the store
* @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 Call updatePetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException {
@ -184,6 +187,7 @@ public class PetApi {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void addPet(Pet body) throws ApiException {
addPetWithHttpInfo(body);
@ -194,6 +198,7 @@ public class PetApi {
*
* @param body Pet object that needs to be added to the store
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException {
Call call = addPetCall(body, null, null);
@ -206,6 +211,7 @@ public class PetApi {
* @param body Pet object that needs to be added to the store
* @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 Call addPetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException {
@ -282,6 +288,7 @@ public class PetApi {
* Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter
* @return List<Pet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
ApiResponse<List<Pet>> resp = findPetsByStatusWithHttpInfo(status);
@ -293,6 +300,7 @@ public class PetApi {
* Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter
* @return ApiResponse<List<Pet>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException {
Call call = findPetsByStatusCall(status, null, null);
@ -306,6 +314,7 @@ public class PetApi {
* @param status Status values that need to be considered for filter
* @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 Call findPetsByStatusAsync(List<String> status, final ApiCallback<List<Pet>> callback) throws ApiException {
@ -383,6 +392,7 @@ public class PetApi {
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return List<Pet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
ApiResponse<List<Pet>> resp = findPetsByTagsWithHttpInfo(tags);
@ -394,6 +404,7 @@ public class PetApi {
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiResponse<List<Pet>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
Call call = findPetsByTagsCall(tags, null, null);
@ -407,6 +418,7 @@ public class PetApi {
* @param tags Tags to filter by
* @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 Call findPetsByTagsAsync(List<String> tags, final ApiCallback<List<Pet>> callback) throws ApiException {
@ -488,6 +500,7 @@ public class PetApi {
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return Pet
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Pet getPetById(Long petId) throws ApiException {
ApiResponse<Pet> resp = getPetByIdWithHttpInfo(petId);
@ -499,6 +512,7 @@ public class PetApi {
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return ApiResponse<Pet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException {
Call call = getPetByIdCall(petId, null, null);
@ -512,6 +526,7 @@ public class PetApi {
* @param petId ID of pet that needs to be fetched
* @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 Call getPetByIdAsync(Long petId, final ApiCallback<Pet> callback) throws ApiException {
@ -598,6 +613,7 @@ public class PetApi {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void updatePetWithForm(String petId, String name, String status) throws ApiException {
updatePetWithFormWithHttpInfo(petId, name, status);
@ -610,6 +626,7 @@ public class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(String petId, String name, String status) throws ApiException {
Call call = updatePetWithFormCall(petId, name, status, null, null);
@ -624,6 +641,7 @@ public class PetApi {
* @param status Updated status of the pet
* @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 Call updatePetWithFormAsync(String petId, String name, String status, final ApiCallback<Void> callback) throws ApiException {
@ -706,6 +724,7 @@ public class PetApi {
*
* @param petId Pet id to delete
* @param apiKey
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void deletePet(Long petId, String apiKey) throws ApiException {
deletePetWithHttpInfo(petId, apiKey);
@ -717,6 +736,7 @@ public class PetApi {
* @param petId Pet id to delete
* @param apiKey
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
Call call = deletePetCall(petId, apiKey, null, null);
@ -730,6 +750,7 @@ public class PetApi {
* @param apiKey
* @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 Call deletePetAsync(Long petId, String apiKey, final ApiCallback<Void> callback) throws ApiException {
@ -815,6 +836,7 @@ public class PetApi {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
uploadFileWithHttpInfo(petId, additionalMetadata, file);
@ -827,6 +849,7 @@ public class PetApi {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException {
Call call = uploadFileCall(petId, additionalMetadata, file, null, null);
@ -841,6 +864,7 @@ public class PetApi {
* @param file file to upload
* @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 Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback<Void> callback) throws ApiException {

View File

@ -89,6 +89,7 @@ public class StoreApi {
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return Map<String, Integer>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Map<String, Integer> getInventory() throws ApiException {
ApiResponse<Map<String, Integer>> resp = getInventoryWithHttpInfo();
@ -99,6 +100,7 @@ public class StoreApi {
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiResponse<Map<String, Integer>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
Call call = getInventoryCall(null, null);
@ -111,6 +113,7 @@ public class StoreApi {
* Returns a map of status codes to quantities
* @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 Call getInventoryAsync(final ApiCallback<Map<String, Integer>> callback) throws ApiException {
@ -186,6 +189,7 @@ public class StoreApi {
*
* @param body order placed for purchasing the pet
* @return Order
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Order placeOrder(Order body) throws ApiException {
ApiResponse<Order> resp = placeOrderWithHttpInfo(body);
@ -197,6 +201,7 @@ public class StoreApi {
*
* @param body order placed for purchasing the pet
* @return ApiResponse<Order>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException {
Call call = placeOrderCall(body, null, null);
@ -210,6 +215,7 @@ public class StoreApi {
* @param body order placed for purchasing the pet
* @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 Call placeOrderAsync(Order body, final ApiCallback<Order> callback) throws ApiException {
@ -291,6 +297,7 @@ public class StoreApi {
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return Order
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Order getOrderById(String orderId) throws ApiException {
ApiResponse<Order> resp = getOrderByIdWithHttpInfo(orderId);
@ -302,6 +309,7 @@ public class StoreApi {
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiResponse<Order>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(String orderId) throws ApiException {
Call call = getOrderByIdCall(orderId, null, null);
@ -315,6 +323,7 @@ public class StoreApi {
* @param orderId ID of pet that needs to be fetched
* @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 Call getOrderByIdAsync(String orderId, final ApiCallback<Order> callback) throws ApiException {
@ -395,6 +404,7 @@ public class StoreApi {
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void deleteOrder(String orderId) throws ApiException {
deleteOrderWithHttpInfo(orderId);
@ -405,6 +415,7 @@ public class StoreApi {
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException {
Call call = deleteOrderCall(orderId, null, null);
@ -417,6 +428,7 @@ public class StoreApi {
* @param orderId ID of the order that needs to be deleted
* @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 Call deleteOrderAsync(String orderId, final ApiCallback<Void> callback) throws ApiException {

View File

@ -89,6 +89,7 @@ public class UserApi {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void createUser(User body) throws ApiException {
createUserWithHttpInfo(body);
@ -99,6 +100,7 @@ public class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException {
Call call = createUserCall(body, null, null);
@ -111,6 +113,7 @@ public class UserApi {
* @param body Created user object
* @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 Call createUserAsync(User body, final ApiCallback<Void> callback) throws ApiException {
@ -184,6 +187,7 @@ public class UserApi {
* Creates list of users with given input array
*
* @param body List of user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void createUsersWithArrayInput(List<User> body) throws ApiException {
createUsersWithArrayInputWithHttpInfo(body);
@ -194,6 +198,7 @@ public class UserApi {
*
* @param body List of user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) throws ApiException {
Call call = createUsersWithArrayInputCall(body, null, null);
@ -206,6 +211,7 @@ public class UserApi {
* @param body List of user object
* @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 Call createUsersWithArrayInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException {
@ -279,6 +285,7 @@ public class UserApi {
* Creates list of users with given input array
*
* @param body List of user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void createUsersWithListInput(List<User> body) throws ApiException {
createUsersWithListInputWithHttpInfo(body);
@ -289,6 +296,7 @@ public class UserApi {
*
* @param body List of user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) throws ApiException {
Call call = createUsersWithListInputCall(body, null, null);
@ -301,6 +309,7 @@ public class UserApi {
* @param body List of user object
* @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 Call createUsersWithListInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException {
@ -380,6 +389,7 @@ public class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String loginUser(String username, String password) throws ApiException {
ApiResponse<String> resp = loginUserWithHttpInfo(username, password);
@ -392,6 +402,7 @@ public class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException {
Call call = loginUserCall(username, password, null, null);
@ -406,6 +417,7 @@ public class UserApi {
* @param password The password for login in clear text
* @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 Call loginUserAsync(String username, String password, final ApiCallback<String> callback) throws ApiException {
@ -479,6 +491,7 @@ public class UserApi {
/**
* Logs out current logged in user session
*
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void logoutUser() throws ApiException {
logoutUserWithHttpInfo();
@ -488,6 +501,7 @@ public class UserApi {
* Logs out current logged in user session
*
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
Call call = logoutUserCall(null, null);
@ -499,6 +513,7 @@ public class UserApi {
*
* @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 Call logoutUserAsync(final ApiCallback<Void> callback) throws ApiException {
@ -579,6 +594,7 @@ public class UserApi {
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public User getUserByName(String username) throws ApiException {
ApiResponse<User> resp = getUserByNameWithHttpInfo(username);
@ -590,6 +606,7 @@ public class UserApi {
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiResponse<User>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException {
Call call = getUserByNameCall(username, null, null);
@ -603,6 +620,7 @@ public class UserApi {
* @param username The name that needs to be fetched. Use user1 for testing.
* @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 Call getUserByNameAsync(String username, final ApiCallback<User> callback) throws ApiException {
@ -684,6 +702,7 @@ public class UserApi {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void updateUser(String username, User body) throws ApiException {
updateUserWithHttpInfo(username, body);
@ -695,6 +714,7 @@ public class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) throws ApiException {
Call call = updateUserCall(username, body, null, null);
@ -708,6 +728,7 @@ public class UserApi {
* @param body Updated user object
* @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 Call updateUserAsync(String username, User body, final ApiCallback<Void> callback) throws ApiException {
@ -787,6 +808,7 @@ public class UserApi {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void deleteUser(String username) throws ApiException {
deleteUserWithHttpInfo(username);
@ -797,6 +819,7 @@ public class UserApi {
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException {
Call call = deleteUserCall(username, null, null);
@ -809,6 +832,7 @@ public class UserApi {
* @param username The name that needs to be deleted
* @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 Call deleteUserAsync(String username, final ApiCallback<Void> callback) throws ApiException {

View File

@ -5,7 +5,7 @@ import io.swagger.client.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;

View File

@ -5,7 +5,7 @@ import io.swagger.client.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public interface Authentication {
/** Apply authentication settings to header and query params. */
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);

View File

@ -5,7 +5,7 @@ import io.swagger.client.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class OAuth implements Authentication {
private String accessToken;

View File

@ -2,8 +2,8 @@ package io.swagger.client.model;
import io.swagger.client.StringUtil;
import io.swagger.client.model.Category;
import io.swagger.client.model.Tag;
import java.util.*;
import io.swagger.client.model.Tag;
import com.google.gson.annotations.SerializedName;