postInsightAnnotation static method
Implementation
static Future<Status> postInsightAnnotation(
String? insightId,
InsightAnnotation annotation, {
User? user,
String? deviceId,
bool update = true,
final QueryType? queryType,
}) async {
var insightUri = UriHelper.getRobotoffUri(
path: 'api/v1/insights/annotate',
queryType: queryType,
);
final Map<String, String> annotationData = {
'annotation': annotation.value.toString(),
'update': update ? '1' : '0'
};
if (insightId != null) {
annotationData['insight_id'] = insightId;
}
if (deviceId != null) {
annotationData['device_id'] = deviceId;
}
Response response = await HttpHelper().doPostRequest(
insightUri,
annotationData,
user,
queryType: queryType,
addCredentialsToBody: false,
addCredentialsToHeader: true,
);
return Status.fromApiResponse(response.body);
}