Required role: | Moderator |
import 'package:servicestack/servicestack.dart';
// @DataContract
abstract class AuditBase
{
// @DataMember(Order=1)
DateTime? createdDate;
// @DataMember(Order=2)
// @required()
String? createdBy;
// @DataMember(Order=3)
DateTime? modifiedDate;
// @DataMember(Order=4)
// @required()
String? modifiedBy;
// @DataMember(Order=5)
DateTime? deletedDate;
// @DataMember(Order=6)
String? deletedBy;
AuditBase({this.createdDate,this.createdBy,this.modifiedDate,this.modifiedBy,this.deletedDate,this.deletedBy});
AuditBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
createdBy = json['createdBy'];
modifiedDate = JsonConverters.fromJson(json['modifiedDate'],'DateTime',context!);
modifiedBy = json['modifiedBy'];
deletedDate = JsonConverters.fromJson(json['deletedDate'],'DateTime',context!);
deletedBy = json['deletedBy'];
return this;
}
Map<String, dynamic> toJson() => {
'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
'createdBy': createdBy,
'modifiedDate': JsonConverters.toJson(modifiedDate,'DateTime',context!),
'modifiedBy': modifiedBy,
'deletedDate': JsonConverters.toJson(deletedDate,'DateTime',context!),
'deletedBy': deletedBy
};
getTypeName() => "AuditBase";
TypeContext? context = _ctx;
}
class Artist extends AuditBase implements IConvertible
{
int? id;
String? firstName;
String? lastName;
int? yearDied;
List<String>? type;
int? score;
int? rank;
Artist({this.id,this.firstName,this.lastName,this.yearDied,this.type,this.score,this.rank});
Artist.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
id = json['id'];
firstName = json['firstName'];
lastName = json['lastName'];
yearDied = json['yearDied'];
type = JsonConverters.fromJson(json['type'],'List<String>',context!);
score = json['score'];
rank = json['rank'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'id': id,
'firstName': firstName,
'lastName': lastName,
'yearDied': yearDied,
'type': JsonConverters.toJson(type,'List<String>',context!),
'score': score,
'rank': rank
});
getTypeName() => "Artist";
TypeContext? context = _ctx;
}
// @ValidateRequest(Validator="HasRole(`Moderator`)")
class CreativeArtist implements IConvertible
{
int? id;
// @References(typeof(Creative))
int? creativeId;
// @References(typeof(Artist))
int? artistId;
Artist? artist;
CreativeArtist({this.id,this.creativeId,this.artistId,this.artist});
CreativeArtist.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
creativeId = json['creativeId'];
artistId = json['artistId'];
artist = JsonConverters.fromJson(json['artist'],'Artist',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'creativeId': creativeId,
'artistId': artistId,
'artist': JsonConverters.toJson(artist,'Artist',context!)
};
getTypeName() => "CreativeArtist";
TypeContext? context = _ctx;
}
// @ValidateRequest(Validator="HasRole(`Moderator`)")
class CreateCreativeArtist implements ICreateDb<CreativeArtist>, IConvertible
{
// @Validate(Validator="GreaterThan(0)")
int? creativeId;
// @Validate(Validator="GreaterThan(0)")
int? modifierId;
CreateCreativeArtist({this.creativeId,this.modifierId});
CreateCreativeArtist.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
creativeId = json['creativeId'];
modifierId = json['modifierId'];
return this;
}
Map<String, dynamic> toJson() => {
'creativeId': creativeId,
'modifierId': modifierId
};
getTypeName() => "CreateCreativeArtist";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'blazordiffusion.com', types: <String, TypeInfo> {
'Artist': TypeInfo(TypeOf.Class, create:() => Artist()),
'CreativeArtist': TypeInfo(TypeOf.Class, create:() => CreativeArtist()),
'CreateCreativeArtist': TypeInfo(TypeOf.Class, create:() => CreateCreativeArtist()),
});
Dart CreateCreativeArtist 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/CreateCreativeArtist HTTP/1.1
Host: blazordiffusion.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"creativeId":0,"modifierId":0}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"id":0,"creativeId":0,"artistId":0,"artist":{"id":0,"firstName":"String","lastName":"String","yearDied":0,"type":["String"],"score":0,"rank":0,"createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"}}