[kotlin][jvm-retrofit2] Update templates (#7592)

* Fix indent of return tag

* Trim trailing whitespace

* Update samples

Co-authored-by: Jim Schubert <james.schubert@gmail.com>
This commit is contained in:
Go Shibata 2020-10-20 10:55:49 +09:00 committed by GitHub
parent 1dec9ebfb8
commit 5bac98cd99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 63 additions and 63 deletions

View File

@ -58,7 +58,7 @@ interface {{classname}} {
{{#allParams}} {{#allParams}}
* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} * @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}} {{/allParams}}
* @return {{^useCoroutines}}[Call]<{{/useCoroutines}}{{#isResponseFile}}[ResponseBody]{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}[{{{returnType}}}]{{/returnType}}{{^returnType}}[Unit]{{/returnType}}{{/isResponseFile}}{{^useCoroutines}}>{{/useCoroutines}} * @return {{^useCoroutines}}[Call]<{{/useCoroutines}}{{#isResponseFile}}[ResponseBody]{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}[{{{returnType}}}]{{/returnType}}{{^returnType}}[Unit]{{/returnType}}{{/isResponseFile}}{{^useCoroutines}}>{{/useCoroutines}}
*/ */
{{#isDeprecated}} {{#isDeprecated}}
@Deprecated("This api was deprecated") @Deprecated("This api was deprecated")

View File

@ -19,7 +19,7 @@ interface PetApi {
* - 405: Invalid input * - 405: Invalid input
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("pet") @POST("pet")
fun addPet(@Body body: Pet): Completable fun addPet(@Body body: Pet): Completable
@ -32,7 +32,7 @@ interface PetApi {
* *
* @param petId Pet id to delete * @param petId Pet id to delete
* @param apiKey (optional) * @param apiKey (optional)
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@DELETE("pet/{petId}") @DELETE("pet/{petId}")
fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Completable fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Completable
@ -45,7 +45,7 @@ interface PetApi {
* - 400: Invalid status value * - 400: Invalid status value
* *
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
* @return [Call]<[kotlin.collections.List<Pet>]> * @return [Call]<[kotlin.collections.List<Pet>]>
*/ */
@GET("pet/findByStatus") @GET("pet/findByStatus")
fun findPetsByStatus(@Query("status") status: CSVParams): Single<kotlin.collections.List<Pet>> fun findPetsByStatus(@Query("status") status: CSVParams): Single<kotlin.collections.List<Pet>>
@ -58,7 +58,7 @@ interface PetApi {
* - 400: Invalid tag value * - 400: Invalid tag value
* *
* @param tags Tags to filter by * @param tags Tags to filter by
* @return [Call]<[kotlin.collections.List<Pet>]> * @return [Call]<[kotlin.collections.List<Pet>]>
*/ */
@Deprecated("This api was deprecated") @Deprecated("This api was deprecated")
@GET("pet/findByTags") @GET("pet/findByTags")
@ -73,7 +73,7 @@ interface PetApi {
* - 404: Pet not found * - 404: Pet not found
* *
* @param petId ID of pet to return * @param petId ID of pet to return
* @return [Call]<[Pet]> * @return [Call]<[Pet]>
*/ */
@GET("pet/{petId}") @GET("pet/{petId}")
fun getPetById(@Path("petId") petId: kotlin.Long): Single<Pet> fun getPetById(@Path("petId") petId: kotlin.Long): Single<Pet>
@ -87,7 +87,7 @@ interface PetApi {
* - 405: Validation exception * - 405: Validation exception
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@PUT("pet") @PUT("pet")
fun updatePet(@Body body: Pet): Completable fun updatePet(@Body body: Pet): Completable
@ -101,7 +101,7 @@ interface PetApi {
* @param petId ID of pet that needs to be updated * @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional) * @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional) * @param status Updated status of the pet (optional)
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@FormUrlEncoded @FormUrlEncoded
@POST("pet/{petId}") @POST("pet/{petId}")
@ -116,7 +116,7 @@ interface PetApi {
* @param petId ID of pet to update * @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional) * @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional) * @param file file to upload (optional)
* @return [Call]<[ApiResponse]> * @return [Call]<[ApiResponse]>
*/ */
@Multipart @Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")

View File

@ -17,7 +17,7 @@ interface StoreApi {
* - 404: Order not found * - 404: Order not found
* *
* @param orderId ID of the order that needs to be deleted * @param orderId ID of the order that needs to be deleted
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@DELETE("store/order/{orderId}") @DELETE("store/order/{orderId}")
fun deleteOrder(@Path("orderId") orderId: kotlin.String): Completable fun deleteOrder(@Path("orderId") orderId: kotlin.String): Completable
@ -28,7 +28,7 @@ interface StoreApi {
* Responses: * Responses:
* - 200: successful operation * - 200: successful operation
* *
* @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]> * @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]>
*/ */
@GET("store/inventory") @GET("store/inventory")
fun getInventory(): Single<kotlin.collections.Map<kotlin.String, kotlin.Int>> fun getInventory(): Single<kotlin.collections.Map<kotlin.String, kotlin.Int>>
@ -42,7 +42,7 @@ interface StoreApi {
* - 404: Order not found * - 404: Order not found
* *
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
* @return [Call]<[Order]> * @return [Call]<[Order]>
*/ */
@GET("store/order/{orderId}") @GET("store/order/{orderId}")
fun getOrderById(@Path("orderId") orderId: kotlin.Long): Single<Order> fun getOrderById(@Path("orderId") orderId: kotlin.Long): Single<Order>
@ -55,7 +55,7 @@ interface StoreApi {
* - 400: Invalid Order * - 400: Invalid Order
* *
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
* @return [Call]<[Order]> * @return [Call]<[Order]>
*/ */
@POST("store/order") @POST("store/order")
fun placeOrder(@Body body: Order): Single<Order> fun placeOrder(@Body body: Order): Single<Order>

View File

@ -16,7 +16,7 @@ interface UserApi {
* - 0: successful operation * - 0: successful operation
* *
* @param body Created user object * @param body Created user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("user") @POST("user")
fun createUser(@Body body: User): Completable fun createUser(@Body body: User): Completable
@ -28,7 +28,7 @@ interface UserApi {
* - 0: successful operation * - 0: successful operation
* *
* @param body List of user object * @param body List of user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("user/createWithArray") @POST("user/createWithArray")
fun createUsersWithArrayInput(@Body body: kotlin.collections.List<User>): Completable fun createUsersWithArrayInput(@Body body: kotlin.collections.List<User>): Completable
@ -40,7 +40,7 @@ interface UserApi {
* - 0: successful operation * - 0: successful operation
* *
* @param body List of user object * @param body List of user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("user/createWithList") @POST("user/createWithList")
fun createUsersWithListInput(@Body body: kotlin.collections.List<User>): Completable fun createUsersWithListInput(@Body body: kotlin.collections.List<User>): Completable
@ -53,7 +53,7 @@ interface UserApi {
* - 404: User not found * - 404: User not found
* *
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@DELETE("user/{username}") @DELETE("user/{username}")
fun deleteUser(@Path("username") username: kotlin.String): Completable fun deleteUser(@Path("username") username: kotlin.String): Completable
@ -67,7 +67,7 @@ interface UserApi {
* - 404: User not found * - 404: User not found
* *
* @param username The name that needs to be fetched. Use user1 for testing. * @param username The name that needs to be fetched. Use user1 for testing.
* @return [Call]<[User]> * @return [Call]<[User]>
*/ */
@GET("user/{username}") @GET("user/{username}")
fun getUserByName(@Path("username") username: kotlin.String): Single<User> fun getUserByName(@Path("username") username: kotlin.String): Single<User>
@ -81,7 +81,7 @@ interface UserApi {
* *
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
* @return [Call]<[kotlin.String]> * @return [Call]<[kotlin.String]>
*/ */
@GET("user/login") @GET("user/login")
fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Single<kotlin.String> fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Single<kotlin.String>
@ -92,7 +92,7 @@ interface UserApi {
* Responses: * Responses:
* - 0: successful operation * - 0: successful operation
* *
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@GET("user/logout") @GET("user/logout")
fun logoutUser(): Completable fun logoutUser(): Completable
@ -106,7 +106,7 @@ interface UserApi {
* *
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@PUT("user/{username}") @PUT("user/{username}")
fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Completable fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Completable

View File

@ -18,7 +18,7 @@ interface PetApi {
* - 405: Invalid input * - 405: Invalid input
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("pet") @POST("pet")
fun addPet(@Body body: Pet): Call<Unit> fun addPet(@Body body: Pet): Call<Unit>
@ -31,7 +31,7 @@ interface PetApi {
* *
* @param petId Pet id to delete * @param petId Pet id to delete
* @param apiKey (optional) * @param apiKey (optional)
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@DELETE("pet/{petId}") @DELETE("pet/{petId}")
fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Call<Unit> fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Call<Unit>
@ -44,7 +44,7 @@ interface PetApi {
* - 400: Invalid status value * - 400: Invalid status value
* *
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
* @return [Call]<[kotlin.collections.List<Pet>]> * @return [Call]<[kotlin.collections.List<Pet>]>
*/ */
@GET("pet/findByStatus") @GET("pet/findByStatus")
fun findPetsByStatus(@Query("status") status: CSVParams): Call<kotlin.collections.List<Pet>> fun findPetsByStatus(@Query("status") status: CSVParams): Call<kotlin.collections.List<Pet>>
@ -57,7 +57,7 @@ interface PetApi {
* - 400: Invalid tag value * - 400: Invalid tag value
* *
* @param tags Tags to filter by * @param tags Tags to filter by
* @return [Call]<[kotlin.collections.List<Pet>]> * @return [Call]<[kotlin.collections.List<Pet>]>
*/ */
@Deprecated("This api was deprecated") @Deprecated("This api was deprecated")
@GET("pet/findByTags") @GET("pet/findByTags")
@ -72,7 +72,7 @@ interface PetApi {
* - 404: Pet not found * - 404: Pet not found
* *
* @param petId ID of pet to return * @param petId ID of pet to return
* @return [Call]<[Pet]> * @return [Call]<[Pet]>
*/ */
@GET("pet/{petId}") @GET("pet/{petId}")
fun getPetById(@Path("petId") petId: kotlin.Long): Call<Pet> fun getPetById(@Path("petId") petId: kotlin.Long): Call<Pet>
@ -86,7 +86,7 @@ interface PetApi {
* - 405: Validation exception * - 405: Validation exception
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@PUT("pet") @PUT("pet")
fun updatePet(@Body body: Pet): Call<Unit> fun updatePet(@Body body: Pet): Call<Unit>
@ -100,7 +100,7 @@ interface PetApi {
* @param petId ID of pet that needs to be updated * @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional) * @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional) * @param status Updated status of the pet (optional)
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@FormUrlEncoded @FormUrlEncoded
@POST("pet/{petId}") @POST("pet/{petId}")
@ -115,7 +115,7 @@ interface PetApi {
* @param petId ID of pet to update * @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional) * @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional) * @param file file to upload (optional)
* @return [Call]<[ApiResponse]> * @return [Call]<[ApiResponse]>
*/ */
@Multipart @Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")

View File

@ -16,7 +16,7 @@ interface StoreApi {
* - 404: Order not found * - 404: Order not found
* *
* @param orderId ID of the order that needs to be deleted * @param orderId ID of the order that needs to be deleted
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@DELETE("store/order/{orderId}") @DELETE("store/order/{orderId}")
fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call<Unit> fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call<Unit>
@ -27,7 +27,7 @@ interface StoreApi {
* Responses: * Responses:
* - 200: successful operation * - 200: successful operation
* *
* @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]> * @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]>
*/ */
@GET("store/inventory") @GET("store/inventory")
fun getInventory(): Call<kotlin.collections.Map<kotlin.String, kotlin.Int>> fun getInventory(): Call<kotlin.collections.Map<kotlin.String, kotlin.Int>>
@ -41,7 +41,7 @@ interface StoreApi {
* - 404: Order not found * - 404: Order not found
* *
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
* @return [Call]<[Order]> * @return [Call]<[Order]>
*/ */
@GET("store/order/{orderId}") @GET("store/order/{orderId}")
fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call<Order> fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call<Order>
@ -54,7 +54,7 @@ interface StoreApi {
* - 400: Invalid Order * - 400: Invalid Order
* *
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
* @return [Call]<[Order]> * @return [Call]<[Order]>
*/ */
@POST("store/order") @POST("store/order")
fun placeOrder(@Body body: Order): Call<Order> fun placeOrder(@Body body: Order): Call<Order>

View File

@ -15,7 +15,7 @@ interface UserApi {
* - 0: successful operation * - 0: successful operation
* *
* @param body Created user object * @param body Created user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("user") @POST("user")
fun createUser(@Body body: User): Call<Unit> fun createUser(@Body body: User): Call<Unit>
@ -27,7 +27,7 @@ interface UserApi {
* - 0: successful operation * - 0: successful operation
* *
* @param body List of user object * @param body List of user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("user/createWithArray") @POST("user/createWithArray")
fun createUsersWithArrayInput(@Body body: kotlin.collections.List<User>): Call<Unit> fun createUsersWithArrayInput(@Body body: kotlin.collections.List<User>): Call<Unit>
@ -39,7 +39,7 @@ interface UserApi {
* - 0: successful operation * - 0: successful operation
* *
* @param body List of user object * @param body List of user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@POST("user/createWithList") @POST("user/createWithList")
fun createUsersWithListInput(@Body body: kotlin.collections.List<User>): Call<Unit> fun createUsersWithListInput(@Body body: kotlin.collections.List<User>): Call<Unit>
@ -52,7 +52,7 @@ interface UserApi {
* - 404: User not found * - 404: User not found
* *
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@DELETE("user/{username}") @DELETE("user/{username}")
fun deleteUser(@Path("username") username: kotlin.String): Call<Unit> fun deleteUser(@Path("username") username: kotlin.String): Call<Unit>
@ -66,7 +66,7 @@ interface UserApi {
* - 404: User not found * - 404: User not found
* *
* @param username The name that needs to be fetched. Use user1 for testing. * @param username The name that needs to be fetched. Use user1 for testing.
* @return [Call]<[User]> * @return [Call]<[User]>
*/ */
@GET("user/{username}") @GET("user/{username}")
fun getUserByName(@Path("username") username: kotlin.String): Call<User> fun getUserByName(@Path("username") username: kotlin.String): Call<User>
@ -80,7 +80,7 @@ interface UserApi {
* *
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
* @return [Call]<[kotlin.String]> * @return [Call]<[kotlin.String]>
*/ */
@GET("user/login") @GET("user/login")
fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Call<kotlin.String> fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Call<kotlin.String>
@ -91,7 +91,7 @@ interface UserApi {
* Responses: * Responses:
* - 0: successful operation * - 0: successful operation
* *
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@GET("user/logout") @GET("user/logout")
fun logoutUser(): Call<Unit> fun logoutUser(): Call<Unit>
@ -105,7 +105,7 @@ interface UserApi {
* *
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
* @return [Call]<[Unit]> * @return [Call]<[Unit]>
*/ */
@PUT("user/{username}") @PUT("user/{username}")
fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Call<Unit> fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Call<Unit>