Test

<back to all web services

TestDataAllCollectionTypes

The following routes are available for this service:
All Verbs/testdata/AllCollectionTypes
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Poco:
    name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AllCollectionTypes:
    int_array: List[int] = field(default_factory=list)
    int_list: List[int] = field(default_factory=list)
    string_array: List[str] = field(default_factory=list)
    string_list: List[str] = field(default_factory=list)
    float_array: List[float] = field(default_factory=list)
    double_list: List[float] = field(default_factory=list)
    byte_array: bytes = field(default_factory=list)
    char_array: List[str] = field(default_factory=list)
    decimal_list: List[Decimal] = field(default_factory=list)
    poco_array: List[Poco] = field(default_factory=list)
    poco_list: List[Poco] = field(default_factory=list)
    poco_lookup: Dict[str, List[Poco]] = field(default_factory=dict)
    poco_lookup_map: Dict[str, List[Dict[str, Poco]]] = field(default_factory=dict)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TestDataAllCollectionTypes:
    pass

Python TestDataAllCollectionTypes DTOs

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

HTTP + CSV

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

POST /testdata/AllCollectionTypes HTTP/1.1 
Host: test.servicestack.net 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{}
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"}}]}}