postInsightAnnotation static method
Implementation
static Future<Status> postInsightAnnotation(
String? insightId,
InsightAnnotation annotation, {
String? deviceId,
bool update = true,
final UriHelper uriHelper = uriHelperRobotoffProd,
}) async {
var insightUri = uriHelper.getUri(
path: 'api/v1/insights/annotate',
);
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,
null,
uriHelper: uriHelper,
addCredentialsToBody: false,
addCredentialsToHeader: true,
);
return Status.fromApiResponse(response.body);
}