actionOnMessage method
Implementation
Future<bool> actionOnMessage({
required String content,
required String id,
required String action,
}) async {
if (_sdkInfo == null) throw _clientError(LiveTalkErrorCodes.emptyInfo);
final request = http.Request(
'POST',
Uri.parse('$_base${LiveTalkEndpoints.actionOnMessage}'),
)
..headers.addAll({
'Content-Type': 'application/json',
'Authorization': 'Bearer ${_sdkInfo!["access_token"]}',
})
..body = json.encode({
'content': content,
'uuid': _uuid,
'ref_id': id,
'room_id': _sdkInfo!['room_id'],
'action': action,
});
final streamed = await request.send();
if (streamed.statusCode != 200) {
throw _httpError(streamed.statusCode, streamed.reasonPhrase);
}
final data = await streamed.stream.bytesToString();
final jsonData = json.decode(data) as Map<String, dynamic>;
if (jsonData['status_code'] == -9999) throw _apiBodyError(jsonData);
return true;
}