editChatInviteLink method

Future<ChatInviteLink> editChatInviteLink(
  1. dynamic chat_id,
  2. String invite_link, {
  3. int? expire_date,
  4. int? member_limit,
})
inherited

Use this method to edit a non-primary invite link created by the bot

The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

Returns the edited invite link as a ChatInviteLink object.

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

Implementation

Future<ChatInviteLink> editChatInviteLink(dynamic chat_id, String invite_link,
    {int? expire_date, int? member_limit}) async {
  if (chat_id is! String && chat_id is! int) {
    return Future.error(TelegramException(
        'Attribute \'chat_id\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('editChatInviteLink');
  var body = <String, dynamic>{
    'chat_id': chat_id,
    'invite_link': invite_link,
    'expire_date': expire_date,
    'member_limit': member_limit,
  };
  return ChatInviteLink.fromJson(
      await HttpClient.httpPost(requestUrl, body: body));
}