getReport method
Get report values in the form of FrappeReport.
Optionally specify filters which should conform to DBFilter.
Optionally specify the target user. Defaults to null
.
Implementation
@override
Future<RequestResponse<FrappeReport?>> getReport(
{required String report, dynamic filters, String? user}) async {
await getFrappe().checkAppInstalled(features: ['getReport']);
if (filters != null) {
if (!DBFilter.isDBFilter(filters)) throw InvalidFrappeFilter();
}
filters ??= <String, dynamic>{};
final response = await Request.initiateRequest(
url: '${config.hostUrl}/api/method/renovation/report',
method: HttpMethod.POST,
contentType: ContentTypeLiterals.APPLICATION_JSON,
data: <String, dynamic>{
'report': report,
'filters': filters,
'user': user
},
isFrappeResponse: false,
);
if (response.isSuccess && response.data != null) {
return RequestResponse.success(
FrappeReport.fromJson(response.data!.message),
rawResponse: response.rawResponse);
} else {
return RequestResponse.fail(handleError('get_report', response.error));
}
}