POST | /v1/reports/Csv | Retrieve Report by ReportName and Filters and return as CSV |
---|
import 'package:servicestack/servicestack.dart';
class DashboardReportResult implements IConvertible
{
int? totalCount;
List<dynamic>? reportResult;
DashboardReportResult({this.totalCount,this.reportResult});
DashboardReportResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
totalCount = json['totalCount'];
reportResult = JsonConverters.fromJson(json['reportResult'],'List<dynamic>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'totalCount': totalCount,
'reportResult': JsonConverters.toJson(reportResult,'List<dynamic>',context!)
};
getTypeName() => "DashboardReportResult";
TypeContext? context = _ctx;
}
enum ReportFilterType
{
list,
list_like,
date,
range,
}
class ReportFilter implements IConvertible
{
ReportFilterType? type;
List<String>? values;
DateTime? start;
DateTime? end;
int? higherThan;
int? lowerThan;
ReportFilter({this.type,this.values,this.start,this.end,this.higherThan,this.lowerThan});
ReportFilter.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
type = JsonConverters.fromJson(json['type'],'ReportFilterType',context!);
values = JsonConverters.fromJson(json['values'],'List<String>',context!);
start = JsonConverters.fromJson(json['start'],'DateTime',context!);
end = JsonConverters.fromJson(json['end'],'DateTime',context!);
higherThan = json['higherThan'];
lowerThan = json['lowerThan'];
return this;
}
Map<String, dynamic> toJson() => {
'type': JsonConverters.toJson(type,'ReportFilterType',context!),
'values': JsonConverters.toJson(values,'List<String>',context!),
'start': JsonConverters.toJson(start,'DateTime',context!),
'end': JsonConverters.toJson(end,'DateTime',context!),
'higherThan': higherThan,
'lowerThan': lowerThan
};
getTypeName() => "ReportFilter";
TypeContext? context = _ctx;
}
class DashboardCsvReportsRequest implements IPost, IConvertible
{
/**
* Report Name
*/
// @ApiMember(Description="Report Name", IsRequired=true, ParameterType="body")
String? reportName;
/**
* Filters
*/
// @ApiMember(Description="Filters", IsRequired=true, ParameterType="body")
Map<String,ReportFilter?>? filters = {};
DashboardCsvReportsRequest({this.reportName,this.filters});
DashboardCsvReportsRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
reportName = json['reportName'];
filters = JsonConverters.fromJson(json['filters'],'Map<String,ReportFilter?>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'reportName': reportName,
'filters': JsonConverters.toJson(filters,'Map<String,ReportFilter?>',context!)
};
getTypeName() => "DashboardCsvReportsRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'uat_api_vehicle_mgt_mb_dhc.rapp_customers.co.uk', types: <String, TypeInfo> {
'DashboardReportResult': TypeInfo(TypeOf.Class, create:() => DashboardReportResult()),
'List<dynamic>': TypeInfo(TypeOf.Class, create:() => <dynamic>[]),
'ReportFilterType': TypeInfo(TypeOf.Enum, enumValues:ReportFilterType.values),
'ReportFilter': TypeInfo(TypeOf.Class, create:() => ReportFilter()),
'DashboardCsvReportsRequest': TypeInfo(TypeOf.Class, create:() => DashboardCsvReportsRequest()),
'Map<String,ReportFilter?>': TypeInfo(TypeOf.Class, create:() => Map<String,ReportFilter?>()),
});
Dart DashboardCsvReportsRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/reports/Csv HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"reportName":"String","filters":{"String":{"type":"list","start":"\/Date(-62135596800000-0000)\/","end":"\/Date(-62135596800000-0000)\/","higherThan":0,"lowerThan":0}}}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"totalCount":0}