MyApp

<back to all web services

HelloAllTypes

package dtos

import (
	"time"
)

type SubType struct {
	Id   int    `json:"id,omitempty"`
	Name string `json:"name"`
}

type AllTypes struct {
	Id               int                          `json:"id,omitempty"`
	NullableId       *int                         `json:"nullableId,omitempty"`
	Byte             byte                         `json:"byte,omitempty"`
	Short            int16                        `json:"short,omitempty"`
	Int              int                          `json:"int,omitempty"`
	Long             int64                        `json:"long,omitempty"`
	UShort           uint16                       `json:"uShort,omitempty"`
	UInt             uint32                       `json:"uInt,omitempty"`
	ULong            uint64                       `json:"uLong,omitempty"`
	Float            float32                      `json:"float,omitempty"`
	Double           float64                      `json:"double,omitempty"`
	Decimal          float64                      `json:"decimal,omitempty"`
	String           string                       `json:"string"`
	DateTime         time.Time                    `json:"dateTime,omitempty"`
	TimeSpan         time.Duration                `json:"timeSpan,omitempty"`
	DateTimeOffset   time.Time                    `json:"dateTimeOffset,omitempty"`
	Guid             string                       `json:"guid,omitempty"`
	Char             string                       `json:"char,omitempty"`
	KeyValuePair     KeyValuePair[string, string] `json:"keyValuePair,omitempty"`
	NullableDateTime *time.Time                   `json:"nullableDateTime,omitempty"`
	NullableTimeSpan *time.Duration               `json:"nullableTimeSpan,omitempty"`
	StringList       []string                     `json:"stringList"`
	StringArray      []string                     `json:"stringArray"`
	StringMap        map[string]string            `json:"stringMap"`
	IntStringMap     map[int]string               `json:"intStringMap"`
	SubType          SubType                      `json:"subType"`
	Point            string                       `json:"point,omitempty"`
	// @DataMember(Name="aliasedName")
	AliasedName string `json:"aliasedName"`
}

type Poco struct {
	Name string `json:"name"`
}

type AllCollectionTypes struct {
	IntArray              []int                        `json:"intArray"`
	IntList               []int                        `json:"intList"`
	StringArray           []string                     `json:"stringArray"`
	StringList            []string                     `json:"stringList"`
	PocoArray             []Poco                       `json:"pocoArray"`
	PocoList              []Poco                       `json:"pocoList"`
	NullableByteArray     []*byte                      `json:"nullableByteArray"`
	NullableByteList      []byte                       `json:"nullableByteList"`
	NullableDateTimeArray []*time.Time                 `json:"nullableDateTimeArray"`
	NullableDateTimeList  []time.Time                  `json:"nullableDateTimeList"`
	PocoLookup            map[string][]Poco            `json:"pocoLookup"`
	PocoLookupMap         map[string][]map[string]Poco `json:"pocoLookupMap"`
}

type HelloAllTypesResponse struct {
	Result             string             `json:"result"`
	AllTypes           AllTypes           `json:"allTypes"`
	AllCollectionTypes AllCollectionTypes `json:"allCollectionTypes"`
}

type HelloAllTypes struct {
	Name               string             `json:"name"`
	AllTypes           AllTypes           `json:"allTypes"`
	AllCollectionTypes AllCollectionTypes `json:"allCollectionTypes"`
}

Go HelloAllTypes DTOs

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

HTTP + OTHER

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

POST /jsonl/reply/HelloAllTypes HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"name":"String","allTypes":{"id":0,"nullableId":0,"byte":0,"short":0,"int":0,"long":0,"uShort":0,"uInt":0,"uLong":0,"float":0,"double":0,"decimal":0,"string":"String","dateTime":"0001-01-01T00:00:00","timeSpan":"PT0S","dateTimeOffset":"0001-01-01T00:00:00+00:00","guid":"00000000-0000-0000-0000-000000000000","char":"\u0000","keyValuePair":{"key":"String","value":"String"},"nullableDateTime":"0001-01-01T00:00:00","nullableTimeSpan":"PT0S","stringList":["String"],"stringArray":["String"],"stringMap":{"String":"String"},"intStringMap":{"0":"String"},"subType":{"id":0,"name":"String"},"point":"0,0","aliasedName":"String"},"allCollectionTypes":{"intArray":[0],"intList":[0],"stringArray":["String"],"stringList":["String"],"pocoArray":[{"name":"String"}],"pocoList":[{"name":"String"}],"nullableByteArray":[0],"nullableByteList":[0],"nullableDateTimeArray":["0001-01-01T00:00:00"],"nullableDateTimeList":["0001-01-01T00:00:00"],"pocoLookup":{"String":[{"name":"String"}]},"pocoLookupMap":{"String":[{"String":{"name":"String"}}]}}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"result":"String","allTypes":{"id":0,"nullableId":0,"byte":0,"short":0,"int":0,"long":0,"uShort":0,"uInt":0,"uLong":0,"float":0,"double":0,"decimal":0,"string":"String","dateTime":"0001-01-01T00:00:00","timeSpan":"PT0S","dateTimeOffset":"0001-01-01T00:00:00+00:00","guid":"00000000-0000-0000-0000-000000000000","char":"\u0000","keyValuePair":{"key":"String","value":"String"},"nullableDateTime":"0001-01-01T00:00:00","nullableTimeSpan":"PT0S","stringList":["String"],"stringArray":["String"],"stringMap":{"String":"String"},"intStringMap":{"0":"String"},"subType":{"id":0,"name":"String"},"point":"0,0","aliasedName":"String"},"allCollectionTypes":{"intArray":[0],"intList":[0],"stringArray":["String"],"stringList":["String"],"pocoArray":[{"name":"String"}],"pocoList":[{"name":"String"}],"nullableByteArray":[0],"nullableByteList":[0],"nullableDateTimeArray":["0001-01-01T00:00:00"],"nullableDateTimeList":["0001-01-01T00:00:00"],"pocoLookup":{"String":[{"name":"String"}]},"pocoLookupMap":{"String":[{"String":{"name":"String"}}]}}}