import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
import 'dart:collection';
class Channel implements IConvertible
{
String? name;
String? value;
Channel({this.name,this.value});
Channel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
value = json['value'];
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'value': value
};
getTypeName() => "Channel";
TypeContext? context = _ctx;
}
class Device implements IConvertible
{
int? id;
String? type;
int? timeStamp;
List<Channel>? channels = [];
Device({this.id,this.type,this.timeStamp,this.channels});
Device.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
type = json['type'];
timeStamp = json['timeStamp'];
channels = JsonConverters.fromJson(json['channels'],'List<Channel>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'type': type,
'timeStamp': timeStamp,
'channels': JsonConverters.toJson(channels,'List<Channel>',context!)
};
getTypeName() => "Device";
TypeContext? context = _ctx;
}
class Logger implements IConvertible
{
int? id;
List<Device>? devices = [];
Logger({this.id,this.devices});
Logger.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
devices = JsonConverters.fromJson(json['devices'],'List<Device>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'devices': JsonConverters.toJson(devices,'List<Device>',context!)
};
getTypeName() => "Logger";
TypeContext? context = _ctx;
}
class StoreLogs implements IConvertible
{
List<Logger>? loggers = [];
StoreLogs({this.loggers});
StoreLogs.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
loggers = JsonConverters.fromJson(json['loggers'],'List<Logger>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'loggers': JsonConverters.toJson(loggers,'List<Logger>',context!)
};
getTypeName() => "StoreLogs";
TypeContext? context = _ctx;
}
class StoreLogsResponse implements IConvertible
{
List<Logger>? existingLogs = [];
ResponseStatus? responseStatus;
StoreLogsResponse({this.existingLogs,this.responseStatus});
StoreLogsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
existingLogs = JsonConverters.fromJson(json['existingLogs'],'List<Logger>',context!);
responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'existingLogs': JsonConverters.toJson(existingLogs,'List<Logger>',context!),
'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
};
getTypeName() => "StoreLogsResponse";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
'Channel': TypeInfo(TypeOf.Class, create:() => Channel()),
'Device': TypeInfo(TypeOf.Class, create:() => Device()),
'List<Channel>': TypeInfo(TypeOf.Class, create:() => <Channel>[]),
'Logger': TypeInfo(TypeOf.Class, create:() => Logger()),
'List<Device>': TypeInfo(TypeOf.Class, create:() => <Device>[]),
'StoreLogs': TypeInfo(TypeOf.Class, create:() => StoreLogs()),
'List<Logger>': TypeInfo(TypeOf.Class, create:() => <Logger>[]),
'StoreLogsResponse': TypeInfo(TypeOf.Class, create:() => StoreLogsResponse()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /xml/reply/StoreLogs HTTP/1.1
Host: test.servicestack.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<StoreLogs xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Test.ServiceModel">
<Loggers>
<Logger>
<Devices>
<Device>
<Channels>
<Channel>
<Name>String</Name>
<Value>String</Value>
</Channel>
</Channels>
<Id>0</Id>
<TimeStamp>0</TimeStamp>
<Type>String</Type>
</Device>
</Devices>
<Id>0</Id>
</Logger>
</Loggers>
</StoreLogs>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <StoreLogsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Test.ServiceModel"> <ExistingLogs> <Logger> <Devices> <Device> <Channels> <Channel> <Name>String</Name> <Value>String</Value> </Channel> </Channels> <Id>0</Id> <TimeStamp>0</TimeStamp> <Type>String</Type> </Device> </Devices> <Id>0</Id> </Logger> </ExistingLogs> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> </StoreLogsResponse>