translateUserMessage method
- UserMessage message,
- List<
String> targetLanguages
Translates a user message.
Implementation
Future<UserMessage> translateUserMessage(
UserMessage message,
List<String> targetLanguages,
) async {
sbLog.i(StackTrace.current, 'message: ${message.message}');
checkUnsupportedAction();
if (message.messageId <= 0) {
throw InvalidParameterException();
}
if (targetLanguages.isEmpty) {
throw InvalidParameterException();
}
return await chat.apiClient.send<UserMessage>(
ChannelMessageTranslateRequest(
chat,
channelType: channelType,
channelUrl: channelUrl,
messageId: message.messageId,
targetLanguages: targetLanguages,
),
);
}