Merge pull request #2220 from xhh/java-exception-javadoc

[Java] Add ApiException to javadoc
This commit is contained in:
wing328 2016-02-24 22:40:35 +08:00
commit b561acb966
8 changed files with 115 additions and 95 deletions

View File

@ -41,18 +41,19 @@ public class {{classname}} {
{{#operation}}
/**
* {{summary}}
* {{notes}}
{{#allParams}} * @param {{paramName}} {{description}}
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{/allParams}}{{#returnType}}
* @return {{{returnType}}}{{/returnType}}
* @throws ApiException if fails to make API call
*/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}");
}
{{/required}}{{/allParams}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}");
}
{{/required}}{{/allParams}}
// create path and map variables
String {{localVariablePrefix}}path = "{{{path}}}".replaceAll("\\{format\\}","json"){{#pathParams}}
.replaceAll("\\{" + "{{baseName}}" + "\\}", {{localVariablePrefix}}apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}};

View File

@ -41,9 +41,10 @@ public class {{classname}} {
{{#operation}}
/**
* {{summary}}
* {{notes}}
{{#allParams}} * @param {{paramName}} {{description}}
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{/allParams}}{{#returnType}}
* @return {{{returnType}}}{{/returnType}}
* @throws ApiException if fails to make API call
*/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
@ -67,7 +68,7 @@ public class {{classname}} {
{{/queryParams}}
{{#headerParams}}if ({{paramName}} != null)
{{localVariablePrefix}}headerParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}}));
{{localVariablePrefix}}headerParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}}));
{{/headerParams}}
{{#formParams}}if ({{paramName}} != null)

View File

@ -15,7 +15,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-23T20:01:57.005+08:00")
public class PetApi {
private ApiClient apiClient;
@ -40,7 +40,7 @@ public class PetApi {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return void
* @throws ApiException if fails to make API call
*/
public void updatePet(Pet body) throws ApiException {
Object postBody = body;
@ -80,7 +80,7 @@ public class PetApi {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return void
* @throws ApiException if fails to make API call
*/
public void addPet(Pet body) throws ApiException {
Object postBody = body;
@ -121,6 +121,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 fails to make API call
*/
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
Object postBody = null;
@ -164,6 +165,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 fails to make API call
*/
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
Object postBody = null;
@ -207,15 +209,16 @@ 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 fails to make API call
*/
public Pet getPetById(Long petId) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
}
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
@ -255,16 +258,16 @@ 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
* @return void
* @throws ApiException if fails to make API call
*/
public void updatePetWithForm(String petId, String name, String status) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
}
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
@ -306,16 +309,16 @@ public class PetApi {
*
* @param petId Pet id to delete
* @param apiKey
* @return void
* @throws ApiException if fails to make API call
*/
public void deletePet(Long petId, String apiKey) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
}
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
@ -356,16 +359,16 @@ public class PetApi {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return void
* @throws ApiException if fails to make API call
*/
public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
}
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
}
// create path and map variables
String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
@ -407,15 +410,16 @@ 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 byte[]
* @throws ApiException if fails to make API call
*/
public byte[] getPetByIdWithByteArray(Long petId) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdWithByteArray");
}
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdWithByteArray");
}
// create path and map variables
String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
@ -453,7 +457,7 @@ public class PetApi {
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
* @param body Pet object in the form of byte array
* @return void
* @throws ApiException if fails to make API call
*/
public void addPetUsingByteArray(byte[] body) throws ApiException {
Object postBody = body;

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-23T20:01:57.005+08:00")
public class StoreApi {
private ApiClient apiClient;
@ -39,6 +39,7 @@ public class StoreApi {
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return Map<String, Integer>
* @throws ApiException if fails to make API call
*/
public Map<String, Integer> getInventory() throws ApiException {
Object postBody = null;
@ -80,6 +81,7 @@ public class StoreApi {
*
* @param body order placed for purchasing the pet
* @return Order
* @throws ApiException if fails to make API call
*/
public Order placeOrder(Order body) throws ApiException {
Object postBody = body;
@ -121,15 +123,16 @@ 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 fails to make API call
*/
public Order getOrderById(String orderId) throws ApiException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
@ -167,16 +170,16 @@ 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
* @return void
* @throws ApiException if fails to make API call
*/
public void deleteOrder(String orderId) throws ApiException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-23T20:01:57.005+08:00")
public class UserApi {
private ApiClient apiClient;
@ -39,7 +39,7 @@ public class UserApi {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return void
* @throws ApiException if fails to make API call
*/
public void createUser(User body) throws ApiException {
Object postBody = body;
@ -79,7 +79,7 @@ public class UserApi {
* Creates list of users with given input array
*
* @param body List of user object
* @return void
* @throws ApiException if fails to make API call
*/
public void createUsersWithArrayInput(List<User> body) throws ApiException {
Object postBody = body;
@ -119,7 +119,7 @@ public class UserApi {
* Creates list of users with given input array
*
* @param body List of user object
* @return void
* @throws ApiException if fails to make API call
*/
public void createUsersWithListInput(List<User> body) throws ApiException {
Object postBody = body;
@ -161,6 +161,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 fails to make API call
*/
public String loginUser(String username, String password) throws ApiException {
Object postBody = null;
@ -204,7 +205,7 @@ public class UserApi {
/**
* Logs out current logged in user session
*
* @return void
* @throws ApiException if fails to make API call
*/
public void logoutUser() throws ApiException {
Object postBody = null;
@ -245,15 +246,16 @@ public class UserApi {
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
* @throws ApiException if fails to make API call
*/
public User getUserByName(String username) throws ApiException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
}
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString()));
@ -292,16 +294,16 @@ 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
* @return void
* @throws ApiException if fails to make API call
*/
public void updateUser(String username, User body) throws ApiException {
Object postBody = body;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
}
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString()));
@ -338,16 +340,16 @@ public class UserApi {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return void
* @throws ApiException if fails to make API call
*/
public void deleteUser(String username) throws ApiException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
}
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString()));

View File

@ -15,7 +15,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-23T20:02:09.740+08:00")
public class PetApi {
private ApiClient apiClient;
@ -40,7 +40,7 @@ public class PetApi {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return void
* @throws ApiException if fails to make API call
*/
public void updatePet(Pet body) throws ApiException {
Object postBody = body;
@ -80,7 +80,7 @@ public class PetApi {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return void
* @throws ApiException if fails to make API call
*/
public void addPet(Pet body) throws ApiException {
Object postBody = body;
@ -121,6 +121,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 fails to make API call
*/
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
Object postBody = null;
@ -164,6 +165,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 fails to make API call
*/
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
Object postBody = null;
@ -207,6 +209,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 fails to make API call
*/
public Pet getPetById(Long petId) throws ApiException {
Object postBody = null;
@ -255,7 +258,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
* @return void
* @throws ApiException if fails to make API call
*/
public void updatePetWithForm(String petId, String name, String status) throws ApiException {
Object postBody = null;
@ -306,7 +309,7 @@ public class PetApi {
*
* @param petId Pet id to delete
* @param apiKey
* @return void
* @throws ApiException if fails to make API call
*/
public void deletePet(Long petId, String apiKey) throws ApiException {
Object postBody = null;
@ -328,7 +331,7 @@ public class PetApi {
if (apiKey != null)
headerParams.put("api_key", apiClient.parameterToString(apiKey));
headerParams.put("api_key", apiClient.parameterToString(apiKey));
@ -356,7 +359,7 @@ public class PetApi {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return void
* @throws ApiException if fails to make API call
*/
public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
Object postBody = null;
@ -407,6 +410,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 byte[]
* @throws ApiException if fails to make API call
*/
public byte[] getPetByIdWithByteArray(Long petId) throws ApiException {
Object postBody = null;
@ -453,7 +457,7 @@ public class PetApi {
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
* @param body Pet object in the form of byte array
* @return void
* @throws ApiException if fails to make API call
*/
public void addPetUsingByteArray(byte[] body) throws ApiException {
Object postBody = body;

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-23T20:02:09.740+08:00")
public class StoreApi {
private ApiClient apiClient;
@ -39,6 +39,7 @@ public class StoreApi {
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return Map<String, Integer>
* @throws ApiException if fails to make API call
*/
public Map<String, Integer> getInventory() throws ApiException {
Object postBody = null;
@ -80,6 +81,7 @@ public class StoreApi {
*
* @param body order placed for purchasing the pet
* @return Order
* @throws ApiException if fails to make API call
*/
public Order placeOrder(Order body) throws ApiException {
Object postBody = body;
@ -121,6 +123,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 fails to make API call
*/
public Order getOrderById(String orderId) throws ApiException {
Object postBody = null;
@ -167,7 +170,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
* @return void
* @throws ApiException if fails to make API call
*/
public void deleteOrder(String orderId) throws ApiException {
Object postBody = null;

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-23T20:02:09.740+08:00")
public class UserApi {
private ApiClient apiClient;
@ -39,7 +39,7 @@ public class UserApi {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return void
* @throws ApiException if fails to make API call
*/
public void createUser(User body) throws ApiException {
Object postBody = body;
@ -79,7 +79,7 @@ public class UserApi {
* Creates list of users with given input array
*
* @param body List of user object
* @return void
* @throws ApiException if fails to make API call
*/
public void createUsersWithArrayInput(List<User> body) throws ApiException {
Object postBody = body;
@ -119,7 +119,7 @@ public class UserApi {
* Creates list of users with given input array
*
* @param body List of user object
* @return void
* @throws ApiException if fails to make API call
*/
public void createUsersWithListInput(List<User> body) throws ApiException {
Object postBody = body;
@ -161,6 +161,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 fails to make API call
*/
public String loginUser(String username, String password) throws ApiException {
Object postBody = null;
@ -204,7 +205,7 @@ public class UserApi {
/**
* Logs out current logged in user session
*
* @return void
* @throws ApiException if fails to make API call
*/
public void logoutUser() throws ApiException {
Object postBody = null;
@ -245,6 +246,7 @@ public class UserApi {
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
* @throws ApiException if fails to make API call
*/
public User getUserByName(String username) throws ApiException {
Object postBody = null;
@ -292,7 +294,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
* @return void
* @throws ApiException if fails to make API call
*/
public void updateUser(String username, User body) throws ApiException {
Object postBody = body;
@ -338,7 +340,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
* @return void
* @throws ApiException if fails to make API call
*/
public void deleteUser(String username) throws ApiException {
Object postBody = null;