add method documentation to android and scala

This commit is contained in:
William Cheng
2015-04-19 23:51:46 +08:00
parent 3622cfd169
commit 5465708a42
8 changed files with 263 additions and 25 deletions
@@ -39,10 +39,12 @@ public class {{classname}} {
}
{{#operation}}
{{#errorList}} //error info- code: {{code}} reason: "{{reason}}" model: {{#responseModel}}{{responseModel}}
{{/responseModel}}{{^responseModel}}<none>
{{/responseModel}}
{{/errorList}}
/**
* {{summary}}
* {{notes}}
{{#allParams}} * @param {{paramName}} {{description}}
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
*/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
@@ -19,6 +19,12 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
{{#operation}}
/**
* {{summary}}
* {{notes}}
{{#allParams}} * @param {{paramName}} {{description}}
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
*/
def {{nickname}} ({{#allParams}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
// create path and map variables
val path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}}))
@@ -66,4 +72,4 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
}
{{/operation}}
}
{{/operations}}
{{/operations}}
@@ -38,7 +38,12 @@ public class PetApi {
}
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return void
*/
public void updatePet (Pet body) throws ApiException {
Object postBody = body;
@@ -88,7 +93,12 @@ public class PetApi {
}
}
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return void
*/
public void addPet (Pet body) throws ApiException {
Object postBody = body;
@@ -138,7 +148,12 @@ public class PetApi {
}
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter
* @return List<Pet>
*/
public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
Object postBody = null;
@@ -190,7 +205,12 @@ public class PetApi {
}
}
/**
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return List<Pet>
*/
public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
Object postBody = null;
@@ -242,7 +262,12 @@ public class PetApi {
}
}
/**
* Find pet by ID
* 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
*/
public Pet getPetById (Long petId) throws ApiException {
Object postBody = null;
@@ -292,7 +317,14 @@ public class PetApi {
}
}
/**
* Updates a pet in the store with form data
*
* @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
*/
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
Object postBody = null;
@@ -352,7 +384,13 @@ public class PetApi {
}
}
/**
* Deletes a pet
*
* @param apiKey
* @param petId Pet id to delete
* @return void
*/
public void deletePet (String apiKey, Long petId) throws ApiException {
Object postBody = null;
@@ -403,7 +441,14 @@ public class PetApi {
}
}
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return void
*/
public void uploadFile (Long petId, String additionalMetadata, File file) throws ApiException {
Object postBody = null;
@@ -38,7 +38,11 @@ public class StoreApi {
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return Map<String, Integer>
*/
public Map<String, Integer> getInventory () throws ApiException {
Object postBody = null;
@@ -88,7 +92,12 @@ public class StoreApi {
}
}
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return Order
*/
public Order placeOrder (Order body) throws ApiException {
Object postBody = body;
@@ -138,7 +147,12 @@ public class StoreApi {
}
}
/**
* Find purchase order by ID
* 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
*/
public Order getOrderById (String orderId) throws ApiException {
Object postBody = null;
@@ -188,7 +202,12 @@ 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
*/
public void deleteOrder (String orderId) throws ApiException {
Object postBody = null;
@@ -38,7 +38,12 @@ public class UserApi {
}
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return void
*/
public void createUser (User body) throws ApiException {
Object postBody = body;
@@ -88,7 +93,12 @@ public class UserApi {
}
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @return void
*/
public void createUsersWithArrayInput (List<User> body) throws ApiException {
Object postBody = body;
@@ -138,7 +148,12 @@ public class UserApi {
}
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @return void
*/
public void createUsersWithListInput (List<User> body) throws ApiException {
Object postBody = body;
@@ -188,7 +203,13 @@ public class UserApi {
}
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
* @return String
*/
public String loginUser (String username, String password) throws ApiException {
Object postBody = null;
@@ -242,7 +263,11 @@ public class UserApi {
}
}
/**
* Logs out current logged in user session
*
* @return void
*/
public void logoutUser () throws ApiException {
Object postBody = null;
@@ -292,7 +317,12 @@ public class UserApi {
}
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
public User getUserByName (String username) throws ApiException {
Object postBody = null;
@@ -342,7 +372,13 @@ public class UserApi {
}
}
/**
* Updated user
* 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
*/
public void updateUser (String username, User body) throws ApiException {
Object postBody = body;
@@ -392,7 +428,12 @@ 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
*/
public void deleteUser (String username) throws ApiException {
Object postBody = null;
@@ -18,6 +18,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return void
*/
def updatePet (body: Pet) = {
// create path and map variables
val path = "/pet".replaceAll("\\{format\\}","json")
@@ -53,6 +59,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return void
*/
def addPet (body: Pet) = {
// create path and map variables
val path = "/pet".replaceAll("\\{format\\}","json")
@@ -88,6 +100,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter
* @return List[Pet]
*/
def findPetsByStatus (status: List[String]) : Option[List[Pet]] = {
// create path and map variables
val path = "/pet/findByStatus".replaceAll("\\{format\\}","json")
@@ -122,6 +140,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return List[Pet]
*/
def findPetsByTags (tags: List[String]) : Option[List[Pet]] = {
// create path and map variables
val path = "/pet/findByTags".replaceAll("\\{format\\}","json")
@@ -156,6 +180,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Find pet by ID
* 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
*/
def getPetById (petId: Long) : Option[Pet] = {
// create path and map variables
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
@@ -191,6 +221,14 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Updates a pet in the store with form data
*
* @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
*/
def updatePetWithForm (petId: String, name: String, status: String) = {
// create path and map variables
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
@@ -225,6 +263,13 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Deletes a pet
*
* @param api_key
* @param petId Pet id to delete
* @return void
*/
def deletePet (api_key: String, petId: Long) = {
// create path and map variables
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
@@ -260,6 +305,14 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return void
*/
def uploadFile (petId: Long, additionalMetadata: String, file: File) = {
// create path and map variables
val path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
@@ -17,6 +17,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return Map[String, Integer]
*/
def getInventory () : Option[Map[String, Integer]] = {
// create path and map variables
val path = "/store/inventory".replaceAll("\\{format\\}","json")
@@ -50,6 +55,12 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return Order
*/
def placeOrder (body: Order) : Option[Order] = {
// create path and map variables
val path = "/store/order".replaceAll("\\{format\\}","json")
@@ -86,6 +97,12 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Find purchase order by ID
* 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
*/
def getOrderById (orderId: String) : Option[Order] = {
// create path and map variables
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
@@ -121,6 +138,12 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* 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
*/
def deleteOrder (orderId: String) = {
// create path and map variables
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
@@ -17,6 +17,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return void
*/
def createUser (body: User) = {
// create path and map variables
val path = "/user".replaceAll("\\{format\\}","json")
@@ -52,6 +58,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @return void
*/
def createUsersWithArrayInput (body: List[User]) = {
// create path and map variables
val path = "/user/createWithArray".replaceAll("\\{format\\}","json")
@@ -87,6 +99,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @return void
*/
def createUsersWithListInput (body: List[User]) = {
// create path and map variables
val path = "/user/createWithList".replaceAll("\\{format\\}","json")
@@ -122,6 +140,13 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
* @return String
*/
def loginUser (username: String, password: String) : Option[String] = {
// create path and map variables
val path = "/user/login".replaceAll("\\{format\\}","json")
@@ -157,6 +182,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Logs out current logged in user session
*
* @return void
*/
def logoutUser () = {
// create path and map variables
val path = "/user/logout".replaceAll("\\{format\\}","json")
@@ -189,6 +219,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
def getUserByName (username: String) : Option[User] = {
// create path and map variables
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
@@ -224,6 +260,13 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Updated user
* 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
*/
def updateUser (username: String, body: User) = {
// create path and map variables
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
@@ -261,6 +304,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
}
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return void
*/
def deleteUser (username: String) = {
// create path and map variables
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))