import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
import 'dart:collection';
enum LivingStatus
{
Alive,
Dead,
}
abstract class RockstarBase
{
String? firstName;
String? lastName;
int? age;
DateTime? dateOfBirth;
DateTime? dateDied;
LivingStatus? livingStatus;
RockstarBase({this.firstName,this.lastName,this.age,this.dateOfBirth,this.dateDied,this.livingStatus});
RockstarBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
firstName = json['firstName'];
lastName = json['lastName'];
age = json['age'];
dateOfBirth = JsonConverters.fromJson(json['dateOfBirth'],'DateTime',context!);
dateDied = JsonConverters.fromJson(json['dateDied'],'DateTime',context!);
livingStatus = JsonConverters.fromJson(json['livingStatus'],'LivingStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'firstName': firstName,
'lastName': lastName,
'age': age,
'dateOfBirth': JsonConverters.toJson(dateOfBirth,'DateTime',context!),
'dateDied': JsonConverters.toJson(dateDied,'DateTime',context!),
'livingStatus': JsonConverters.toJson(livingStatus,'LivingStatus',context!)
};
getTypeName() => "RockstarBase";
TypeContext? context = _ctx;
}
class RockstarWithIdResponse implements IConvertible
{
int? id;
ResponseStatus? responseStatus;
RockstarWithIdResponse({this.id,this.responseStatus});
RockstarWithIdResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
};
getTypeName() => "RockstarWithIdResponse";
TypeContext? context = _ctx;
}
class CreateRockstarAuditMqToken extends RockstarBase implements ICreateDb<RockstarAudit>, IHasBearerToken, IConvertible
{
String? bearerToken;
CreateRockstarAuditMqToken({this.bearerToken});
CreateRockstarAuditMqToken.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
bearerToken = json['bearerToken'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'bearerToken': bearerToken
});
getTypeName() => "CreateRockstarAuditMqToken";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
'LivingStatus': TypeInfo(TypeOf.Enum, enumValues:LivingStatus.values),
'RockstarBase': TypeInfo(TypeOf.AbstractClass),
'RockstarWithIdResponse': TypeInfo(TypeOf.Class, create:() => RockstarWithIdResponse()),
'CreateRockstarAuditMqToken': TypeInfo(TypeOf.Class, create:() => CreateRockstarAuditMqToken()),
});
Dart CreateRockstarAuditMqToken DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /json/reply/CreateRockstarAuditMqToken HTTP/1.1
Host: test.servicestack.net
Accept: application/json
Content-Type: application/json
Content-Length: length
{"bearerToken":"String","firstName":"String","lastName":"String","age":0,"dateOfBirth":"\/Date(-62135596800000-0000)\/","dateDied":"\/Date(-62135596800000-0000)\/","livingStatus":"Alive"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"id":0,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}