# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
class SubType
include ServiceStack::DTO
# @return [Integer]
attr_accessor :id
# @return [String]
attr_accessor :name
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
}
end
end
class AllTypes
include ServiceStack::DTO
# @return [Integer]
attr_accessor :id
# @return [Integer]
attr_accessor :nullable_id
# @return [Integer]
attr_accessor :byte
# @return [Integer]
attr_accessor :short
# @return [Integer]
attr_accessor :int
# @return [Integer]
attr_accessor :long
# @return [Integer]
attr_accessor :u_short
# @return [Integer]
attr_accessor :u_int
# @return [Integer]
attr_accessor :u_long
# @return [Float]
attr_accessor :float
# @return [Float]
attr_accessor :double
# @return [BigDecimal]
attr_accessor :decimal
# @return [String]
attr_accessor :string
# @return [DateTime]
attr_accessor :date_time
# @return [Time]
attr_accessor :time_span
# @return [DateTime]
attr_accessor :date_time_offset
# @return [String]
attr_accessor :guid
# @return [String]
attr_accessor :char
# @return [KeyValuePair]
attr_accessor :key_value_pair
# @return [DateTime]
attr_accessor :nullable_date_time
# @return [Time]
attr_accessor :nullable_time_span
# @return [List]
attr_accessor :string_list
# @return [Array]
attr_accessor :string_array
# @return [Dictionary]
attr_accessor :string_map
# @return [Dictionary]
attr_accessor :int_string_map
# @return [SubType]
attr_accessor :sub_type
# @return [Point]
attr_accessor :point
# @DataMember(Name="aliasedName")
# @return [String]
attr_accessor :original_name
def self.properties
{
id: { name: 'id' },
nullable_id: { name: 'nullableId' },
byte: { name: 'byte' },
short: { name: 'short' },
int: { name: 'int' },
long: { name: 'long' },
u_short: { name: 'uShort' },
u_int: { name: 'uInt' },
u_long: { name: 'uLong' },
float: { name: 'float' },
double: { name: 'double' },
decimal: { name: 'decimal' },
string: { name: 'string' },
date_time: { name: 'dateTime', type: DateTime },
time_span: { name: 'timeSpan' },
date_time_offset: { name: 'dateTimeOffset', type: DateTime },
guid: { name: 'guid' },
char: { name: 'char' },
key_value_pair: { name: 'keyValuePair' },
nullable_date_time: { name: 'nullableDateTime', type: DateTime },
nullable_time_span: { name: 'nullableTimeSpan' },
string_list: { name: 'stringList' },
string_array: { name: 'stringArray' },
string_map: { name: 'stringMap' },
int_string_map: { name: 'intStringMap' },
sub_type: { name: 'subType', type: SubType },
point: { name: 'point' },
original_name: { name: 'aliasedName' },
}
end
def response_type() = AllTypes
def get_type_name() = 'AllTypes'
end
class Poco
include ServiceStack::DTO
# @return [String]
attr_accessor :name
def self.properties
{
name: { name: 'name' },
}
end
end
class AllCollectionTypes
include ServiceStack::DTO
# @return [Array]
attr_accessor :int_array
# @return [List]
attr_accessor :int_list
# @return [Array]
attr_accessor :string_array
# @return [List]
attr_accessor :string_list
# @return [Array]
attr_accessor :poco_array
# @return [List]
attr_accessor :poco_list
# @return [Array]
attr_accessor :nullable_byte_array
# @return [List]
attr_accessor :nullable_byte_list
# @return [Array]
attr_accessor :nullable_date_time_array
# @return [List]
attr_accessor :nullable_date_time_list
# @return [Dictionary]
attr_accessor :poco_lookup
# @return [Dictionary]
attr_accessor :poco_lookup_map
def self.properties
{
int_array: { name: 'intArray' },
int_list: { name: 'intList' },
string_array: { name: 'stringArray' },
string_list: { name: 'stringList' },
poco_array: { name: 'pocoArray', type: [Poco] },
poco_list: { name: 'pocoList', type: [Poco] },
nullable_byte_array: { name: 'nullableByteArray' },
nullable_byte_list: { name: 'nullableByteList' },
nullable_date_time_array: { name: 'nullableDateTimeArray' },
nullable_date_time_list: { name: 'nullableDateTimeList' },
poco_lookup: { name: 'pocoLookup' },
poco_lookup_map: { name: 'pocoLookupMap' },
}
end
end
class HelloAllTypesResponse
include ServiceStack::DTO
# @return [String]
attr_accessor :result
# @return [AllTypes]
attr_accessor :all_types
# @return [AllCollectionTypes]
attr_accessor :all_collection_types
def self.properties
{
result: { name: 'result' },
all_types: { name: 'allTypes', type: AllTypes },
all_collection_types: { name: 'allCollectionTypes', type: AllCollectionTypes },
}
end
end
class HelloAllTypes
include ServiceStack::DTO
# @return [String]
attr_accessor :name
# @return [AllTypes]
attr_accessor :all_types
# @return [AllCollectionTypes]
attr_accessor :all_collection_types
def self.properties
{
name: { name: 'name' },
all_types: { name: 'allTypes', type: AllTypes },
all_collection_types: { name: 'allCollectionTypes', type: AllCollectionTypes },
}
end
def response_type() = HelloAllTypesResponse
def get_type_name() = 'HelloAllTypes'
end
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=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
}
}
]
}
}
}