public final Message execute(SendVoice sendVoice) throws TelegramApiException { assertParamNotNull(sendVoice, "sendVoice"); sendVoice.validate(); try { String url = getBaseUrl() + SendVoice.PATH; builder.setLaxMode(); builder.setCharset(StandardCharsets.UTF_8); builder.addTextBody(SendVoice.CHATID_FIELD, sendVoice.getChatId(), TEXT_PLAIN_CONTENT_TYPE); addInputFile(builder, sendVoice.getVoice(), SendVoice.VOICE_FIELD, true); if (sendVoice.getReplyMarkup() != null) { builder.addTextBody(SendVoice.REPLYMARKUP_FIELD, objectMapper.writeValueAsString(sendVoice.getReplyMarkup()), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getReplyToMessageId() != null) { builder.addTextBody(SendVoice.REPLYTOMESSAGEID_FIELD, sendVoice.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getDisableNotification() != null) { builder.addTextBody(SendVoice.DISABLENOTIFICATION_FIELD, sendVoice.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getDuration() != null) { builder.addTextBody(SendVoice.DURATION_FIELD, sendVoice.getDuration().toString(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getCaption() != null) { builder.addTextBody(SendVoice.CAPTION_FIELD, sendVoice.getCaption(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getParseMode() != null) { builder.addTextBody(SendVoice.PARSEMODE_FIELD, sendVoice.getParseMode(), TEXT_PLAIN_CONTENT_TYPE); return sendVoice.deserializeResponse(sendHttpPostRequest(httppost));
public final Message execute(SendVoice sendVoice) throws TelegramApiException { assertParamNotNull(sendVoice, "sendVoice"); sendVoice.validate(); try { String url = getBaseUrl() + SendVoice.PATH; builder.setLaxMode(); builder.setCharset(StandardCharsets.UTF_8); builder.addTextBody(SendVoice.CHATID_FIELD, sendVoice.getChatId(), TEXT_PLAIN_CONTENT_TYPE); addInputFile(builder, sendVoice.getVoice(), SendVoice.VOICE_FIELD, true); if (sendVoice.getReplyMarkup() != null) { builder.addTextBody(SendVoice.REPLYMARKUP_FIELD, objectMapper.writeValueAsString(sendVoice.getReplyMarkup()), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getReplyToMessageId() != null) { builder.addTextBody(SendVoice.REPLYTOMESSAGEID_FIELD, sendVoice.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getDisableNotification() != null) { builder.addTextBody(SendVoice.DISABLENOTIFICATION_FIELD, sendVoice.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getDuration() != null) { builder.addTextBody(SendVoice.DURATION_FIELD, sendVoice.getDuration().toString(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getCaption() != null) { builder.addTextBody(SendVoice.CAPTION_FIELD, sendVoice.getCaption(), TEXT_PLAIN_CONTENT_TYPE); if (sendVoice.getParseMode() != null) { builder.addTextBody(SendVoice.PARSEMODE_FIELD, sendVoice.getParseMode(), TEXT_PLAIN_CONTENT_TYPE); return sendVoice.deserializeResponse(sendHttpPostRequest(httppost));