Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports MyApp.ServiceModel
Namespace Global
Namespace MyApp.ServiceModel
Public Partial Class Phone
Public Overridable Property Kind As PhoneKind
Public Overridable Property Number As String
Public Overridable Property Ext As String
End Class
Public Enum PhoneKind
Home
Mobile
Work
End Enum
Public Partial Class UpdatePlayer
Implements IPatchDb(Of Player)
Public Overridable Property Id As Integer
<Validate(Validator:="NotEmpty")>
Public Overridable Property FirstName As String
Public Overridable Property LastName As String
Public Overridable Property Email As String
Public Overridable Property PhoneNumbers As List(Of Phone)
Public Overridable Property ProfileId As Integer?
Public Overridable Property SavedLevelId As Guid?
End Class
End Namespace
Namespace ServiceStack
<DataContract>
Public Partial Class IdResponse
<DataMember(Order:=1)>
Public Overridable Property Id As String
<DataMember(Order:=2)>
Public Overridable Property ResponseStatus As ResponseStatus
End Class
End Namespace
End Namespace
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"}}}