translateUserMessage method
Translates a message
with given list of targetLanguages
.
An element of target language should be from http://www.lingoes.net/en/translator/langcode.htm
Implementation
Future<UserMessage> translateUserMessage(
UserMessage message,
List<String> targetLanguages,
) async {
if (message.messageId <= 0) {
throw InvalidParameterError();
}
if (targetLanguages.isEmpty) {
throw InvalidParameterError();
}
return _sdk.api.send<UserMessage>(
ChannelMessageTranslateRequest(
channelType: channelType,
channelUrl: channelUrl,
messageId: message.messageId,
targetLanguages: targetLanguages,
),
);
}