namespace Test.ServiceModel.Types
open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations
[<AllowNullLiteral>]
type Poco() =
member val Name:String = null with get,set
[<AllowNullLiteral>]
type AllCollectionTypes() =
member val IntArray:Int32[] = null with get,set
member val IntList:ResizeArray<Int32> = null with get,set
member val StringArray:String[] = null with get,set
member val StringList:ResizeArray<String> = null with get,set
member val FloatArray:Single[] = null with get,set
member val DoubleList:ResizeArray<Double> = null with get,set
member val ByteArray:Byte[] = null with get,set
member val CharArray:Char[] = null with get,set
member val DecimalList:ResizeArray<Decimal> = null with get,set
member val PocoArray:Poco[] = null with get,set
member val PocoList:ResizeArray<Poco> = null with get,set
member val PocoLookup:Dictionary<String, List<Poco>> = null with get,set
member val PocoLookupMap:Dictionary<String, List<Dictionary<String,Poco>>> = null 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/AllCollectionTypes HTTP/1.1
Host: test.servicestack.net
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"intArray":[0],"intList":[0],"stringArray":["String"],"stringList":["String"],"floatArray":[0],"doubleList":[0],"byteArray":"AA==","charArray":["\u0000"],"decimalList":[0],"pocoArray":[{"name":"String"}],"pocoList":[{"name":"String"}],"pocoLookup":{"String":[{"name":"String"}]},"pocoLookupMap":{"String":[{"String":{"name":"String"}}]}}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"intArray":[0],"intList":[0],"stringArray":["String"],"stringList":["String"],"floatArray":[0],"doubleList":[0],"byteArray":"AA==","charArray":["\u0000"],"decimalList":[0],"pocoArray":[{"name":"String"}],"pocoList":[{"name":"String"}],"pocoLookup":{"String":[{"name":"String"}]},"pocoLookupMap":{"String":[{"String":{"name":"String"}}]}}