MyApp

<back to all web services

HelloAllTypes

const std = @import("std");

pub const SubType = struct {
    id: i32 = 0,
    name: ?[]const u8 = null,
};

pub const AllTypes = struct {
    id: i32 = 0,
    nullableId: ?i32 = null,
    byte: u8 = 0,
    short: i16 = 0,
    int: i32 = 0,
    long: i64 = 0,
    uShort: u16 = 0,
    uInt: u32 = 0,
    uLong: u64 = 0,
    float: f32 = 0,
    double: f64 = 0,
    decimal: f64 = 0,
    string: ?[]const u8 = null,
    dateTime: ?[]const u8 = null,
    timeSpan: ?[]const u8 = null,
    dateTimeOffset: ?[]const u8 = null,
    guid: ?[]const u8 = null,
    char: u8 = 0,
    keyValuePair: ?KeyValuePair = null,
    nullableDateTime: ?[]const u8 = null,
    nullableTimeSpan: ?[]const u8 = null,
    stringList: [][]const u8 = &.{},
    stringArray: [][]const u8 = &.{},
    stringMap: ?std.json.Value = null,
    intStringMap: ?std.json.Value = null,
    subType: ?SubType = null,
    point: ?[]const u8 = null,
    // @DataMember(Name="aliasedName")
    aliasedName: ?[]const u8 = null,
};

pub const Poco = struct {
    name: ?[]const u8 = null,
};

pub const AllCollectionTypes = struct {
    intArray: []i32 = &.{},
    intList: []i32 = &.{},
    stringArray: [][]const u8 = &.{},
    stringList: [][]const u8 = &.{},
    pocoArray: []Poco = &.{},
    pocoList: []Poco = &.{},
    nullableByteArray: []?u8 = &.{},
    nullableByteList: []?u8 = &.{},
    nullableDateTimeArray: []?[]const u8 = &.{},
    nullableDateTimeList: []?[]const u8 = &.{},
    pocoLookup: ?std.json.Value = null,
    pocoLookupMap: ?std.json.Value = null,
};

pub const HelloAllTypesResponse = struct {
    result: ?[]const u8 = null,
    allTypes: ?AllTypes = null,
    allCollectionTypes: ?AllCollectionTypes = null,
};

pub const HelloAllTypes = struct {
    name: ?[]const u8 = null,
    allTypes: ?AllTypes = null,
    allCollectionTypes: ?AllCollectionTypes = null,
};

Zig HelloAllTypes DTOs

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

HTTP + JSV

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

POST /jsv/reply/HelloAllTypes HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
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-01,
		timeSpan: PT0S,
		dateTimeOffset: 0001-01-01T00:00:00.0000000+00:00,
		guid: 00000000-0000-0000-0000-000000000000,
		char: ,
		keyValuePair: 
		{
			key: String,
			value: String
		},
		nullableDateTime: 0001-01-01,
		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-01
		],
		nullableDateTimeList: 
		[
			0001-01-01
		],
		pocoLookup: 
		{
			String: 
			[
				{
					name: String
				}
			]
		},
		pocoLookupMap: 
		{
			String: 
			[
				{
					String: 
					{
						name: String
					}
				}
			]
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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-01,
		timeSpan: PT0S,
		dateTimeOffset: 0001-01-01T00:00:00.0000000+00:00,
		guid: 00000000-0000-0000-0000-000000000000,
		char: ,
		keyValuePair: 
		{
			key: String,
			value: String
		},
		nullableDateTime: 0001-01-01,
		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-01
		],
		nullableDateTimeList: 
		[
			0001-01-01
		],
		pocoLookup: 
		{
			String: 
			[
				{
					name: String
				}
			]
		},
		pocoLookupMap: 
		{
			String: 
			[
				{
					String: 
					{
						name: String
					}
				}
			]
		}
	}
}