namespace MyApp.ServiceModel
open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations
[<DataContract>]
[<AllowNullLiteral>]
type IdResponse() =
[<DataMember(Order=1)>]
member val Id:String = null with get,set
[<DataMember(Order=2)>]
member val ResponseStatus:ResponseStatus = null with get,set
type PhoneKind =
| Home = 0
| Mobile = 1
| Work = 2
[<AllowNullLiteral>]
type Phone() =
member val Kind:PhoneKind = new PhoneKind() with get,set
member val Number:String = null with get,set
member val Ext:String = null with get,set
[<AllowNullLiteral>]
type UpdatePlayer() =
member val Id:Int32 = new Int32() with get,set
[<Validate(Validator="NotEmpty")>]
member val FirstName:String = null with get,set
member val LastName:String = null with get,set
member val Email:String = null with get,set
member val PhoneNumbers:ResizeArray<Phone> = null with get,set
member val ProfileId:Nullable<Int32> = new Nullable<Int32>() with get,set
member val SavedLevelId:Nullable<Guid> = new Nullable<Guid>() with get,set
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/UpdatePlayer HTTP/1.1
Host: blazor-gallery.servicestack.net
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":0,"firstName":"String","lastName":"String","email":"String","phoneNumbers":[{"kind":"Home","number":"String","ext":"String"}],"profileId":0,"savedLevelId":"00000000000000000000000000000000"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"id":"String","responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}