#![allow(
dead_code,
non_camel_case_types,
non_snake_case,
clippy::upper_case_acronyms
)]
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct SubType {
pub id: i32,
pub name: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct AllTypes {
pub id: i32,
#[serde(rename = "nullableId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nullable_id: Option<i32>,
pub byte: u8,
pub short: i16,
pub int: i32,
pub long: i64,
#[serde(rename = "uShort")]
pub u_short: u16,
#[serde(rename = "uInt")]
pub u_int: u32,
#[serde(rename = "uLong")]
pub u_long: u64,
pub float: f32,
pub double: f64,
pub decimal: f64,
pub string: String,
#[serde(rename = "dateTime")]
pub date_time: String,
#[serde(rename = "timeSpan")]
pub time_span: String,
#[serde(rename = "dateTimeOffset")]
pub date_time_offset: String,
pub guid: String,
pub char: char,
#[serde(rename = "keyValuePair")]
pub key_value_pair: KeyValuePair<String, String>,
#[serde(rename = "nullableDateTime")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nullable_date_time: Option<String>,
#[serde(rename = "nullableTimeSpan")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nullable_time_span: Option<String>,
#[serde(rename = "stringList")]
pub string_list: Vec<String>,
#[serde(rename = "stringArray")]
pub string_array: Vec<String>,
#[serde(rename = "stringMap")]
pub string_map: HashMap<String, String>,
#[serde(rename = "intStringMap")]
pub int_string_map: HashMap<i32, String>,
#[serde(rename = "subType")]
pub sub_type: SubType,
pub point: String,
#[serde(rename = "aliasedName")]
pub original_name: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct Poco {
pub name: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct AllCollectionTypes {
#[serde(rename = "intArray")]
pub int_array: Vec<i32>,
#[serde(rename = "intList")]
pub int_list: Vec<i32>,
#[serde(rename = "stringArray")]
pub string_array: Vec<String>,
#[serde(rename = "stringList")]
pub string_list: Vec<String>,
#[serde(rename = "pocoArray")]
pub poco_array: Vec<Poco>,
#[serde(rename = "pocoList")]
pub poco_list: Vec<Poco>,
#[serde(rename = "nullableByteArray")]
pub nullable_byte_array: Vec<Option<u8>>,
#[serde(rename = "nullableByteList")]
pub nullable_byte_list: Vec<Option<u8>>,
#[serde(rename = "nullableDateTimeArray")]
pub nullable_date_time_array: Vec<Option<String>>,
#[serde(rename = "nullableDateTimeList")]
pub nullable_date_time_list: Vec<Option<String>>,
#[serde(rename = "pocoLookup")]
pub poco_lookup: HashMap<String, Vec<Poco>>,
#[serde(rename = "pocoLookupMap")]
pub poco_lookup_map: HashMap<String, Vec<HashMap<String, Poco>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct HelloAllTypesResponse {
pub result: String,
#[serde(rename = "allTypes")]
pub all_types: AllTypes,
#[serde(rename = "allCollectionTypes")]
pub all_collection_types: AllCollectionTypes,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct HelloAllTypes {
pub name: String,
#[serde(rename = "allTypes")]
pub all_types: AllTypes,
#[serde(rename = "allCollectionTypes")]
pub all_collection_types: AllCollectionTypes,
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=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"}}]}}}