Test

<back to all web services

HelloWithEnumList

import java.math.*
import java.util.*
import net.servicestack.client.*


open class HelloWithEnumList
{
    var enumProp:ArrayList<EnumType> = ArrayList<EnumType>()
    var enumWithValues:ArrayList<EnumWithValues> = ArrayList<EnumWithValues>()
    var nullableEnumProp:ArrayList<EnumType?> = ArrayList<EnumType?>()
    var enumFlags:ArrayList<EnumFlags> = ArrayList<EnumFlags>()
    var enumStyle:ArrayList<EnumStyle> = ArrayList<EnumStyle>()
}

enum class EnumType
{
    Value1,
    Value2,
    Value3,
}

enum class EnumWithValues
{
    None,
    Value1,
    Value2,
}

@Flags()
enum class EnumFlags(val value:Int)
{
    @SerializedName("0") Value0(0),
    @SerializedName("1") Value1(1),
    @SerializedName("2") Value2(2),
    @SerializedName("4") Value3(4),
    @SerializedName("7") Value123(7),
}

enum class EnumStyle
{
    Lower,
    Upper,
    PascalCase,
    CamelCase,
    CamelUPPER,
    PascalUPPER,
}

Kotlin HelloWithEnumList DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /json/oneway/HelloWithEnumList HTTP/1.1 
Host: test.servicestack.net 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"enumProp":["Value1"],"enumWithValues":["None"],"nullableEnumProp":["Value1"],"enumFlags":[0],"enumStyle":["lower"]}