Merge remote-tracking branch 'origin/4.2.x' into 5.0.x

This commit is contained in:
William Cheng
2019-09-22 21:00:38 +08:00
2432 changed files with 40079 additions and 14159 deletions

View File

@@ -1 +1,2 @@
rootProject.name = 'kotlin-petstore-client'

View File

@@ -12,9 +12,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
fun <T: Any?> toMultiValue(items: List<T>, collectionFormat: String, map: (item: Any?) -> String = defaultMultiValueConverter): List<String> {
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
= toMultiValue(items.asIterable(), collectionFormat, map)
fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
return when(collectionFormat) {
"multi" -> items.map(map)
else -> listOf(items.map(map).joinToString(separator = collectionDelimiter(collectionFormat)))
else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
}
}

View File

@@ -19,6 +19,7 @@ import com.squareup.moshi.Json
* @param type
* @param message
*/
data class ApiResponse (
@Json(name = "code")
val code: kotlin.Int? = null,
@@ -26,7 +27,5 @@ data class ApiResponse (
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
) {
}
)

View File

@@ -18,12 +18,11 @@ import com.squareup.moshi.Json
* @param id
* @param name
*/
data class Category (
@Json(name = "id")
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
}
)

View File

@@ -22,6 +22,7 @@ import com.squareup.moshi.Json
* @param status Order Status
* @param complete
*/
data class Order (
@Json(name = "id")
val id: kotlin.Long? = null,
@@ -36,23 +37,23 @@ data class Order (
val status: Order.Status? = null,
@Json(name = "complete")
val complete: kotlin.Boolean? = null
) {
)
{
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
@Json(name = "placed")
placed("placed"),
@Json(name = "placed") placed("placed"),
@Json(name = "approved")
approved("approved"),
@Json(name = "approved") approved("approved"),
@Json(name = "delivered")
delivered("delivered");
@Json(name = "delivered") delivered("delivered");
}
}

View File

@@ -24,6 +24,7 @@ import com.squareup.moshi.Json
* @param tags
* @param status pet status in the store
*/
data class Pet (
@Json(name = "name")
val name: kotlin.String,
@@ -38,23 +39,23 @@ data class Pet (
/* pet status in the store */
@Json(name = "status")
val status: Pet.Status? = null
) {
)
{
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String){
@Json(name = "available")
available("available"),
@Json(name = "available") available("available"),
@Json(name = "pending")
pending("pending"),
@Json(name = "pending") pending("pending"),
@Json(name = "sold")
sold("sold");
@Json(name = "sold") sold("sold");
}
}

View File

@@ -18,12 +18,11 @@ import com.squareup.moshi.Json
* @param id
* @param name
*/
data class Tag (
@Json(name = "id")
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
}
)

View File

@@ -24,6 +24,7 @@ import com.squareup.moshi.Json
* @param phone
* @param userStatus User Status
*/
data class User (
@Json(name = "id")
val id: kotlin.Long? = null,
@@ -42,7 +43,5 @@ data class User (
/* User Status */
@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
) {
}
)