Required role: | Moderator |
import 'package:servicestack/servicestack.dart';
class StatBase implements IConvertible
{
String? refId;
int? appUserId;
String? rawUrl;
String? remoteIp;
DateTime? createdDate;
StatBase({this.refId,this.appUserId,this.rawUrl,this.remoteIp,this.createdDate});
StatBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
refId = json['refId'];
appUserId = json['appUserId'];
rawUrl = json['rawUrl'];
remoteIp = json['remoteIp'];
createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'refId': refId,
'appUserId': appUserId,
'rawUrl': rawUrl,
'remoteIp': remoteIp,
'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!)
};
getTypeName() => "StatBase";
TypeContext? context = _ctx;
}
enum SignupType
{
Updates,
Beta,
}
class Signup extends StatBase implements IConvertible
{
int? id;
SignupType? type;
String? email;
String? name;
DateTime? cancelledDate;
Signup({this.id,this.type,this.email,this.name,this.cancelledDate});
Signup.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
id = json['id'];
type = JsonConverters.fromJson(json['type'],'SignupType',context!);
email = json['email'];
name = json['name'];
cancelledDate = JsonConverters.fromJson(json['cancelledDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'id': id,
'type': JsonConverters.toJson(type,'SignupType',context!),
'email': email,
'name': name,
'cancelledDate': JsonConverters.toJson(cancelledDate,'DateTime',context!)
});
getTypeName() => "Signup";
TypeContext? context = _ctx;
}
// @ValidateRequest(Validator="HasRole(`Moderator`)")
class UpdateSignup implements IPatchDb<Signup>, IConvertible
{
int? id;
SignupType? type;
// @Validate(Validator="Email")
String? email;
String? name;
DateTime? cancelledDate;
UpdateSignup({this.id,this.type,this.email,this.name,this.cancelledDate});
UpdateSignup.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
type = JsonConverters.fromJson(json['type'],'SignupType',context!);
email = json['email'];
name = json['name'];
cancelledDate = JsonConverters.fromJson(json['cancelledDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'type': JsonConverters.toJson(type,'SignupType',context!),
'email': email,
'name': name,
'cancelledDate': JsonConverters.toJson(cancelledDate,'DateTime',context!)
};
getTypeName() => "UpdateSignup";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'blazordiffusion.com', types: <String, TypeInfo> {
'StatBase': TypeInfo(TypeOf.Class, create:() => StatBase()),
'SignupType': TypeInfo(TypeOf.Enum, enumValues:SignupType.values),
'Signup': TypeInfo(TypeOf.Class, create:() => Signup()),
'UpdateSignup': TypeInfo(TypeOf.Class, create:() => UpdateSignup()),
});
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/UpdateSignup HTTP/1.1
Host: blazordiffusion.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateSignup xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
<CancelledDate>0001-01-01T00:00:00</CancelledDate>
<Email>String</Email>
<Id>0</Id>
<Name>String</Name>
<Type>Updates</Type>
</UpdateSignup>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <Signup xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel"> <AppUserId>0</AppUserId> <CreatedDate>0001-01-01T00:00:00</CreatedDate> <RawUrl>String</RawUrl> <RefId>String</RefId> <RemoteIp>String</RemoteIp> <CancelledDate>0001-01-01T00:00:00</CancelledDate> <Email>String</Email> <Id>0</Id> <Name>String</Name> <Type>Updates</Type> </Signup>