talkWithResponse method

Future<Uri> talkWithResponse(
  1. LinkResult response, {
  2. String? clientId,
  3. Map<String, String>? serverCallbackArgs,
})

Implementation

Future<Uri> talkWithResponse(LinkResult response,
    {String? clientId, Map<String, String>? serverCallbackArgs}) async {
  final attachmentSize = await _attachmentSize(response,
      clientId: clientId, serverCallbackArgs: serverCallbackArgs);
  if (attachmentSize > 10 * 1024) {
    throw KakaoClientException(
        "Exceeded message template v2 size limit (${attachmentSize / 1024}kb > 10kb).");
  }
  Map<String, String> params = {
    "linkver": "4.0",
    "appkey": clientId ?? KakaoContext.clientId,
    "appver": await KakaoContext.appVer,
    "template_id": response.templateId.toString(),
    "template_args": jsonEncode(response.templateArgs),
    "template_json": jsonEncode(response.templateMsg),
    "extras": jsonEncode(await _extras(serverCallbackArgs))
  };
  return Uri(scheme: "kakaolink", host: "send", queryParameters: params);
}