import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*
open class QueryPlayer : QueryDb<Player>()
{
}
open class QueryDb<T> : QueryBase()
{
}
@DataContract
open class QueryBase
{
@DataMember(Order=1)
open var skip:Int? = null
@DataMember(Order=2)
open var take:Int? = null
@DataMember(Order=3)
open var orderBy:String? = null
@DataMember(Order=4)
open var orderByDesc:String? = null
@DataMember(Order=5)
open var include:String? = null
@DataMember(Order=6)
open var fields:String? = null
@DataMember(Order=7)
open var meta:HashMap<String,String>? = null
}
open class Player : AuditBase()
{
open var id:Int? = null
@Required()
open var firstName:String? = null
open var lastName:String? = null
open var email:String? = null
open var phoneNumbers:ArrayList<Phone> = ArrayList<Phone>()
open var gameItems:ArrayList<PlayerGameItem> = ArrayList<PlayerGameItem>()
open var profile:Profile? = null
open var profileId:Int? = null
open var savedLevelId:UUID? = null
open var rowVersion:BigInteger? = null
}
@DataContract
open class AuditBase
{
@DataMember(Order=1)
open var createdDate:Date? = null
@DataMember(Order=2)
@Required()
open var createdBy:String? = null
@DataMember(Order=3)
open var modifiedDate:Date? = null
@DataMember(Order=4)
@Required()
open var modifiedBy:String? = null
@DataMember(Order=5)
open var deletedDate:Date? = null
@DataMember(Order=6)
open var deletedBy:String? = null
}
open class Phone
{
open var kind:PhoneKind? = null
open var number:String? = null
open var ext:String? = null
}
enum class PhoneKind
{
Home,
Mobile,
Work,
}
open class PlayerGameItem
{
open var id:Int? = null
@References(Type=Player::class)
open var playerId:Int? = null
@References(Type=GameItem::class)
open var gameItemName:String? = null
}
open class Profile : AuditBase()
{
open var id:Int? = null
open var role:PlayerRole? = null
open var region:PlayerRegion? = null
open var username:String? = null
open var highScore:Long? = null
open var gamesPlayed:Long? = null
open var energy:Int? = null
open var profileUrl:String? = null
open var coverUrl:String? = null
open var meta:HashMap<String,String>? = null
}
enum class PlayerRole
{
Leader,
Player,
NonPlayer,
}
enum class PlayerRegion(val value:Int)
{
Africa(1),
Americas(2),
Asia(3),
Australasia(4),
Europe(5),
}
@DataContract
open class QueryResponse<T>
{
@DataMember(Order=1)
open var offset:Int? = null
@DataMember(Order=2)
open var total:Int? = null
@DataMember(Order=3)
open var results:ArrayList<Todo>? = null
@DataMember(Order=4)
open var meta:HashMap<String,String>? = null
@DataMember(Order=5)
open var responseStatus:ResponseStatus? = null
}
open class Todo
{
open var id:Long? = null
open var text:String? = null
open var isFinished:Boolean? = null
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /csv/reply/QueryPlayer HTTP/1.1
Host: blazor-gallery.servicestack.net
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"skip":0,"take":0,"orderBy":"String","orderByDesc":"String","include":"String","fields":"String","meta":{"String":"String"}}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"offset":0,"total":0,"results":[{"id":0,"firstName":"String","lastName":"String","email":"String","phoneNumbers":[{"kind":"Home","number":"String","ext":"String"}],"gameItems":[{"id":0,"playerId":0,"gameItemName":"String"}],"profile":{"id":0,"role":"Leader","region":"Africa","username":"String","highScore":0,"gamesPlayed":0,"energy":0,"profileUrl":"String","coverUrl":"String","meta":{"String":"String"},"createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"},"profileId":0,"savedLevelId":"00000000-0000-0000-0000-000000000000","rowVersion":0,"createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}