sendVenue method

Future<Message> sendVenue(
  1. dynamic chatId,
  2. double latitude,
  3. double longitude,
  4. String title,
  5. String address, {
  6. int? messageThreadId,
  7. String? foursquareId,
  8. String? foursquareType,
  9. String? googlePlaceId,
  10. String? googlePlaceType,
  11. bool? disableNotification,
  12. bool? protectContent,
  13. int? replyToMessageId,
  14. bool? allowSendingWithoutReply,
  15. ReplyMarkup? replyMarkup,
})

Use this method to send information about a venue

On success, the sent Message is returned.

https://core.telegram.org/bots/api#sendvenue

Implementation

Future<Message> sendVenue(dynamic chatId, double latitude, double longitude,
    String title, String address,
    {int? messageThreadId,
    String? foursquareId,
    String? foursquareType,
    String? googlePlaceId,
    String? googlePlaceType,
    bool? disableNotification,
    bool? protectContent,
    int? replyToMessageId,
    bool? allowSendingWithoutReply,
    ReplyMarkup? replyMarkup}) async {
  if (chatId is! String && chatId is! int) {
    return Future.error(TelegramException(
        'Attribute \'chatId\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('sendVenue');
  var body = <String, dynamic>{
    'chat_id': chatId,
    'message_thread_id': messageThreadId,
    'latitude': latitude,
    'longitude': longitude,
    'title': title,
    'address': address,
    'foursquare_id': foursquareId,
    'foursquare_type': foursquareType,
    'google_place_id': googlePlaceId,
    'google_place_type': googlePlaceType,
    'disable_notification': disableNotification,
    'protect_content': protectContent,
    'reply_to_message_id': replyToMessageId,
    'allow_sending_without_reply': allowSendingWithoutReply,
    'reply_markup': replyMarkup == null ? null : jsonEncode(replyMarkup),
  };
  return Message.fromJson(await HttpClient.httpPost(requestUrl, body: body));
}