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 Artifact extends AuditBase implements IConvertible
{
int? id;
// @References(typeof(Creative))
int? creativeId;
String? fileName;
String? filePath;
String? contentType;
int? contentLength;
int? width;
int? height;
int? seed;
String? prompt;
bool? nsfw;
int? averageHash;
int? perceptualHash;
int? differenceHash;
String? background;
String? lqip;
int? quality;
int? likesCount;
int? albumsCount;
int? downloadsCount;
int? searchCount;
int? temporalScore;
int? score;
int? rank;
String? refId;
Map<String,String?>? versions = {};
Artifact({this.id,this.creativeId,this.fileName,this.filePath,this.contentType,this.contentLength,this.width,this.height,this.seed,this.prompt,this.nsfw,this.averageHash,this.perceptualHash,this.differenceHash,this.background,this.lqip,this.quality,this.likesCount,this.albumsCount,this.downloadsCount,this.searchCount,this.temporalScore,this.score,this.rank,this.refId,this.versions});
Artifact.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
id = json['id'];
creativeId = json['creativeId'];
fileName = json['fileName'];
filePath = json['filePath'];
contentType = json['contentType'];
contentLength = json['contentLength'];
width = json['width'];
height = json['height'];
seed = json['seed'];
prompt = json['prompt'];
nsfw = json['nsfw'];
averageHash = json['averageHash'];
perceptualHash = json['perceptualHash'];
differenceHash = json['differenceHash'];
background = json['background'];
lqip = json['lqip'];
quality = json['quality'];
likesCount = json['likesCount'];
albumsCount = json['albumsCount'];
downloadsCount = json['downloadsCount'];
searchCount = json['searchCount'];
temporalScore = json['temporalScore'];
score = json['score'];
rank = json['rank'];
refId = json['refId'];
versions = JsonConverters.toStringMap(json['versions']);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'id': id,
'creativeId': creativeId,
'fileName': fileName,
'filePath': filePath,
'contentType': contentType,
'contentLength': contentLength,
'width': width,
'height': height,
'seed': seed,
'prompt': prompt,
'nsfw': nsfw,
'averageHash': averageHash,
'perceptualHash': perceptualHash,
'differenceHash': differenceHash,
'background': background,
'lqip': lqip,
'quality': quality,
'likesCount': likesCount,
'albumsCount': albumsCount,
'downloadsCount': downloadsCount,
'searchCount': searchCount,
'temporalScore': temporalScore,
'score': score,
'rank': rank,
'refId': refId,
'versions': versions
});
getTypeName() => "Artifact";
TypeContext? context = _ctx;
}
enum ReportType
{
Nsfw,
Malformed,
Blurred,
LowQuality,
Other,
}
class ArtifactReport implements IConvertible
{
int? id;
// @References(typeof(Artifact))
int? artifactId;
int? appUserId;
Artifact? artifact;
ReportType? type;
String? description;
DateTime? createdDate;
String? notes;
DateTime? actionedDate;
String? actionedBy;
ArtifactReport({this.id,this.artifactId,this.appUserId,this.artifact,this.type,this.description,this.createdDate,this.notes,this.actionedDate,this.actionedBy});
ArtifactReport.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
artifactId = json['artifactId'];
appUserId = json['appUserId'];
artifact = JsonConverters.fromJson(json['artifact'],'Artifact',context!);
type = JsonConverters.fromJson(json['type'],'ReportType',context!);
description = json['description'];
createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
notes = json['notes'];
actionedDate = JsonConverters.fromJson(json['actionedDate'],'DateTime',context!);
actionedBy = json['actionedBy'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'artifactId': artifactId,
'appUserId': appUserId,
'artifact': JsonConverters.toJson(artifact,'Artifact',context!),
'type': JsonConverters.toJson(type,'ReportType',context!),
'description': description,
'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
'notes': notes,
'actionedDate': JsonConverters.toJson(actionedDate,'DateTime',context!),
'actionedBy': actionedBy
};
getTypeName() => "ArtifactReport";
TypeContext? context = _ctx;
}
// @ValidateRequest(Validator="IsAuthenticated")
class CreateArtifactReport implements ICreateDb<ArtifactReport>, IConvertible
{
// @Validate(Validator="GreaterThan(0)")
int? artifactId;
ReportType? type;
String? description;
CreateArtifactReport({this.artifactId,this.type,this.description});
CreateArtifactReport.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
artifactId = json['artifactId'];
type = JsonConverters.fromJson(json['type'],'ReportType',context!);
description = json['description'];
return this;
}
Map<String, dynamic> toJson() => {
'artifactId': artifactId,
'type': JsonConverters.toJson(type,'ReportType',context!),
'description': description
};
getTypeName() => "CreateArtifactReport";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'blazordiffusion.com', types: <String, TypeInfo> {
'Artifact': TypeInfo(TypeOf.Class, create:() => Artifact()),
'ReportType': TypeInfo(TypeOf.Enum, enumValues:ReportType.values),
'ArtifactReport': TypeInfo(TypeOf.Class, create:() => ArtifactReport()),
'CreateArtifactReport': TypeInfo(TypeOf.Class, create:() => CreateArtifactReport()),
});
Dart CreateArtifactReport 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/CreateArtifactReport HTTP/1.1
Host: blazordiffusion.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"artifactId":0,"type":"Nsfw","description":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"id":0,"artifactId":0,"appUserId":0,"artifact":{"id":0,"creativeId":0,"fileName":"String","filePath":"String","contentType":"String","contentLength":0,"width":0,"height":0,"seed":0,"prompt":"String","nsfw":false,"averageHash":0,"perceptualHash":0,"differenceHash":0,"background":"String","lqip":"String","quality":0,"likesCount":0,"albumsCount":0,"downloadsCount":0,"searchCount":0,"temporalScore":0,"score":0,"rank":0,"refId":"String","versions":{"String":"String"},"createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"},"type":"Nsfw","description":"String","createdDate":"0001-01-01T00:00:00","notes":"String","actionedDate":"0001-01-01T00:00:00","actionedBy":"String"}