queryBill method
Returns the results of the query.
Implementation
Future<List<Bill>> queryBill({
required String query,
String? realmId,
String? authToken,
}) async {
authToken ??= authenticationService.getCachedToken()?.access_token;
realmId ??= authenticationService.getCachedRealmId();
Map<String, String> headers = {
"Authorization": "Bearer ${authToken ?? ""}",
//'Content-Type': 'application/json; charset=UTF-8',
'Accept': 'application/json',
};
Map<String, String> params = {
"query": query,
"minorversion": minorVersion.toString()
};
Uri endpoint = Uri.https(
baseUrl, "/v3/company/$realmId/query", params);
//print (endpoint.toString());
var response = await
http.get(endpoint, headers: headers);
if (response.statusCode == 200) {
//print (jsonDecode(response.body));
return QueryResponse.fromJson(jsonDecode(response.body)["QueryResponse"]).bill!;
}
else {
throw BillException(statusCode: response.statusCode, message: response.body);
}
}