| GET | /audits |
|---|
import 'package:servicestack/servicestack.dart';
class PagingRequest implements IConvertible
{
int? page;
int? limit;
PagingRequest({this.page,this.limit});
PagingRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
page = json['page'];
limit = json['limit'];
return this;
}
Map<String, dynamic> toJson() => {
'page': page,
'limit': limit
};
getTypeName() => "PagingRequest";
TypeContext? context = _ctx;
}
class MongoObject implements IMongoModel, IConvertible
{
String? id;
MongoObject({this.id});
MongoObject.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = JsonConverters.fromJson(json['id'],'String',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': JsonConverters.toJson(id,'String',context!)
};
getTypeName() => "MongoObject";
TypeContext? context = _ctx;
}
class AuditLog extends MongoObject implements IEntityId, ICreated, IUpdate, IConvertible
{
String? userName;
int? userId;
int? documentId;
String? action;
String? description;
DateTime? createdDate;
DateTime? updatedDate;
String? ipAddress;
String? userAgent;
AuditLog({this.userName,this.userId,this.documentId,this.action,this.description,this.createdDate,this.updatedDate,this.ipAddress,this.userAgent});
AuditLog.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
userName = json['userName'];
userId = json['userId'];
documentId = json['documentId'];
action = json['action'];
description = json['description'];
createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
updatedDate = JsonConverters.fromJson(json['updatedDate'],'DateTime',context!);
ipAddress = json['ipAddress'];
userAgent = json['userAgent'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'userName': userName,
'userId': userId,
'documentId': documentId,
'action': action,
'description': description,
'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
'updatedDate': JsonConverters.toJson(updatedDate,'DateTime',context!),
'ipAddress': ipAddress,
'userAgent': userAgent
});
getTypeName() => "AuditLog";
TypeContext? context = _ctx;
}
class AuditLogRequest extends PagingRequest implements IConvertible
{
String? userName;
int? userId;
int? documentId;
String? action;
String? description;
String? ipAddress;
DateTime? startDate;
DateTime? endDate;
AuditLogRequest({this.userName,this.userId,this.documentId,this.action,this.description,this.ipAddress,this.startDate,this.endDate});
AuditLogRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
userName = json['userName'];
userId = json['userId'];
documentId = json['documentId'];
action = json['action'];
description = json['description'];
ipAddress = json['ipAddress'];
startDate = JsonConverters.fromJson(json['startDate'],'DateTime',context!);
endDate = JsonConverters.fromJson(json['endDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'userName': userName,
'userId': userId,
'documentId': documentId,
'action': action,
'description': description,
'ipAddress': ipAddress,
'startDate': JsonConverters.toJson(startDate,'DateTime',context!),
'endDate': JsonConverters.toJson(endDate,'DateTime',context!)
});
getTypeName() => "AuditLogRequest";
TypeContext? context = _ctx;
}
class Pagination implements IConvertible
{
int? total;
int? pages;
int? offset;
int? limit;
int? currentPage;
Pagination({this.total,this.pages,this.offset,this.limit,this.currentPage});
Pagination.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
total = json['total'];
pages = json['pages'];
offset = json['offset'];
limit = json['limit'];
currentPage = json['currentPage'];
return this;
}
Map<String, dynamic> toJson() => {
'total': total,
'pages': pages,
'offset': offset,
'limit': limit,
'currentPage': currentPage
};
getTypeName() => "Pagination";
TypeContext? context = _ctx;
}
class PageResponse<AuditLog> implements IResponseRequest, IConvertible
{
int? code;
String? message;
List<AuditLog>? data;
Pagination? pagination;
PageResponse({this.code,this.message,this.data,this.pagination});
PageResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
code = json['code'];
message = json['message'];
data = JsonConverters.fromJson(json['data'],'List<${runtimeGenericTypeDefs(this,[0]).join(",")}>',context!);
pagination = JsonConverters.fromJson(json['pagination'],'Pagination',context!);
return this;
}
Map<String, dynamic> toJson() => {
'code': code,
'message': message,
'data': JsonConverters.toJson(data,'List<AuditLog>',context!),
'pagination': JsonConverters.toJson(pagination,'Pagination',context!)
};
getTypeName() => "PageResponse<$AuditLog>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
'PagingRequest': TypeInfo(TypeOf.Class, create:() => PagingRequest()),
'MongoObject': TypeInfo(TypeOf.Class, create:() => MongoObject()),
'AuditLog': TypeInfo(TypeOf.Class, create:() => AuditLog()),
'AuditLogRequest': TypeInfo(TypeOf.Class, create:() => AuditLogRequest()),
'Pagination': TypeInfo(TypeOf.Class, create:() => Pagination()),
'PageResponse<AuditLog>': TypeInfo(TypeOf.Class, create:() => PageResponse<AuditLog>()),
});
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.
GET /audits HTTP/1.1 Host: etc-api.vsmlab.vn Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"code":0,"message":"String","data":[{"userName":"String","userId":0,"documentId":0,"action":"String","description":"String","createdDate":"0001-01-01T00:00:00.0000000+07:06","updatedDate":"0001-01-01T00:00:00.0000000+07:06","ipAddress":"String","userAgent":"String","id":"000000000000000000000000"}],"pagination":null}