Jelajahi Sumber

Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings

painor 5 tahun lalu
induk
melakukan
f7c98099b3
82 mengubah file dengan 13742 tambahan dan 25139 penghapusan
  1. 13 0
      src/@types/global.d.ts
  2. 64 0
      src/api/gramjs/builders/chats.ts
  3. 3 2
      src/api/gramjs/builders/common.ts
  4. 44 26
      src/api/gramjs/builders/messages.ts
  5. 13 0
      src/api/gramjs/builders/peers.ts
  6. 39 0
      src/api/gramjs/builders/users.ts
  7. 19 31
      src/api/gramjs/client.ts
  8. 98 0
      src/api/gramjs/connectors/auth.ts
  9. 123 0
      src/api/gramjs/connectors/chats.ts
  10. 32 0
      src/api/gramjs/connectors/files.ts
  11. 61 29
      src/api/gramjs/connectors/messages.ts
  12. 18 0
      src/api/gramjs/init.ts
  13. 46 0
      src/api/gramjs/inputHelpers.ts
  14. 3 2
      src/api/gramjs/localDb.ts
  15. 126 0
      src/api/gramjs/onGramJsUpdate.ts
  16. 3 0
      src/api/gramjs/types.ts
  17. 1 0
      src/api/gramjs/utils.ts
  18. 33 0
      src/api/types/files.ts
  19. 80 0
      src/api/types/messages.ts
  20. 6 6
      src/lib/gramjs/Password.js
  21. 71 71
      src/lib/gramjs/Utils.js
  22. 11 0
      src/lib/gramjs/client/TelegramClient.d.ts
  23. 99 84
      src/lib/gramjs/client/TelegramClient.js
  24. 61 0
      src/lib/gramjs/crypto/AuthKey.js
  25. 3 3
      src/lib/gramjs/crypto/RSA.js
  26. 6 13
      src/lib/gramjs/errors/Common.js
  27. 47 2884
      src/lib/gramjs/errors/RPCErrorList.js
  28. 27 0
      src/lib/gramjs/errors/index.js
  29. 92 0
      src/lib/gramjs/events/NewMessage.js
  30. 3 5
      src/lib/gramjs/extensions/MessagePacker.js
  31. 22 0
      src/lib/gramjs/index.d.ts
  32. 6 1
      src/lib/gramjs/index.js
  33. 17 28
      src/lib/gramjs/network/Authenticator.js
  34. 14 16
      src/lib/gramjs/network/MTProtoSender.js
  35. 9 8
      src/lib/gramjs/network/MTProtoState.js
  36. 46 103
      src/lib/gramjs/sessions/Memory.js
  37. 6 0
      src/lib/gramjs/sessions/index.js
  38. 19 0
      src/lib/gramjs/tl/AllTLObjects.js
  39. 46 0
      src/lib/gramjs/tl/core/GZIPPacked.js
  40. 45 0
      src/lib/gramjs/tl/core/MessageContainer.js
  41. 33 0
      src/lib/gramjs/tl/core/RPCResult.js
  42. 14 0
      src/lib/gramjs/tl/core/TLMessage.js
  43. 0 2333
      src/lib/gramjs/tl/functions/account.js
  44. 0 556
      src/lib/gramjs/tl/functions/auth.js
  45. 0 83
      src/lib/gramjs/tl/functions/bots.js
  46. 0 1506
      src/lib/gramjs/tl/functions/channels.js
  47. 0 725
      src/lib/gramjs/tl/functions/contacts.js
  48. 0 79
      src/lib/gramjs/tl/functions/folders.js
  49. 0 578
      src/lib/gramjs/tl/functions/help.js
  50. 0 704
      src/lib/gramjs/tl/functions/index.js
  51. 0 205
      src/lib/gramjs/tl/functions/langpack.js
  52. 0 5464
      src/lib/gramjs/tl/functions/messages.js
  53. 0 242
      src/lib/gramjs/tl/functions/payments.js
  54. 0 354
      src/lib/gramjs/tl/functions/phone.js
  55. 0 179
      src/lib/gramjs/tl/functions/photos.js
  56. 0 185
      src/lib/gramjs/tl/functions/stickers.js
  57. 0 147
      src/lib/gramjs/tl/functions/updates.js
  58. 0 343
      src/lib/gramjs/tl/functions/upload.js
  59. 0 134
      src/lib/gramjs/tl/functions/users.js
  60. 336 0
      src/lib/gramjs/tl/generationHelpers.js
  61. 8139 0
      src/lib/gramjs/tl/gramJsApi.d.ts
  62. 377 0
      src/lib/gramjs/tl/gramJsApi.js
  63. 11 0
      src/lib/gramjs/tl/index.js
  64. 1418 0
      src/lib/gramjs/tl/static/api.tl
  65. 113 0
      src/lib/gramjs/tl/static/schema.tl
  66. 59 0
      src/lib/gramjs/tl/types-generator/generate.js
  67. 236 0
      src/lib/gramjs/tl/types-generator/template.js
  68. 0 766
      src/lib/gramjs/tl/types/account.js
  69. 0 425
      src/lib/gramjs/tl/types/auth.js
  70. 0 189
      src/lib/gramjs/tl/types/channels.js
  71. 0 493
      src/lib/gramjs/tl/types/contacts.js
  72. 0 765
      src/lib/gramjs/tl/types/help.js
  73. 0 1905
      src/lib/gramjs/tl/types/index.js
  74. 0 1877
      src/lib/gramjs/tl/types/messages.js
  75. 0 383
      src/lib/gramjs/tl/types/payments.js
  76. 0 51
      src/lib/gramjs/tl/types/phone.js
  77. 0 154
      src/lib/gramjs/tl/types/photos.js
  78. 0 248
      src/lib/gramjs/tl/types/storage.js
  79. 0 530
      src/lib/gramjs/tl/types/updates.js
  80. 0 224
      src/lib/gramjs/tl/types/upload.js
  81. 1418 0
      static/api.tl
  82. 113 0
      static/schema.tl

+ 13 - 0
src/@types/global.d.ts

@@ -0,0 +1,13 @@
+declare const process: { env: Record<string, string> };
+
+type AnyLiteral = Record<string, any>;
+type AnyClass = new (...args: any[]) => any;
+
+type Country = {
+  id: string;
+  name: string;
+  flag: string;
+  code: string;
+};
+
+declare module '*.png';

+ 64 - 0
src/api/gramjs/builders/chats.ts

@@ -0,0 +1,64 @@
+import { MTProto } from '../../../lib/gramjs';
+import { ApiChat } from '../../types';
+import { isPeerChat, isPeerUser } from './peers';
+import { buildApiPhotoLocations } from './common';
+
+export function buildApiChatFromDialog(dialog: MTProto.dialog, peerEntity: MTProto.user | MTProto.chat): ApiChat {
+  return {
+    id: getApiChatIdFromMtpPeer(dialog.peer),
+    type: {
+      '@type': getApiChatTypeFromMtpPeer(dialog.peer),
+      ...(isPeerUser(dialog.peer) && { user_id: dialog.peer.userId }),
+    },
+    title: getApiChatTitleFromMtpPeer(dialog.peer, peerEntity),
+    photo_locations: buildApiPhotoLocations(peerEntity),
+    last_read_outbox_message_id: dialog.readOutboxMaxId,
+    last_read_inbox_message_id: dialog.readInboxMaxId,
+    unread_count: dialog.unreadCount,
+    unread_mention_count: 0, // TODO
+    is_pinned: dialog.pinned || false,
+  };
+}
+
+export function getApiChatIdFromMtpPeer(peer: MTProto.Peer) {
+  if (isPeerUser(peer)) {
+    return peer.userId;
+  } else if (isPeerChat(peer)) {
+    return -peer.chatId;
+  } else {
+    return -peer.channelId;
+  }
+}
+
+export function getApiChatTypeFromMtpPeer(peer: MTProto.Peer) {
+  if (isPeerUser(peer)) {
+    return 'chatTypePrivate';
+  } else if (isPeerChat(peer)) {
+    return 'chatTypeBasicGroup';
+  } else {
+    // TODO Support channels, supergroups, etc.
+    return 'chatTypeBasicGroup';
+  }
+}
+
+export function getPeerKey(peer: MTProto.Peer) {
+  if (isPeerUser(peer)) {
+    return `user${peer.userId}`;
+  } else if (isPeerChat(peer)) {
+    return `chat${peer.chatId}`;
+  } else {
+    return `chat${peer.channelId}`;
+  }
+}
+
+export function getApiChatTitleFromMtpPeer(peer: MTProto.Peer, peerEntity: MTProto.user | MTProto.chat) {
+  if (isPeerUser(peer)) {
+    return getUserName(peerEntity as MTProto.user);
+  } else {
+    return (peerEntity as MTProto.chat).title;
+  }
+}
+
+function getUserName(user: MTProto.user) {
+  return user.firstName ? `${user.firstName}${user.lastName ? ` ${user.lastName}` : ''}` : undefined;
+}

+ 3 - 2
src/api/gramjs/builders/common.ts

@@ -1,6 +1,7 @@
+import { MTProto } from '../../../lib/gramjs';
 import { ApiFileLocation } from '../../types';
 
-export function buildApiPhotoLocations(entity: MTP.user | MTP.chat): {
+export function buildApiPhotoLocations(entity: MTProto.user | MTProto.chat): {
   small: ApiFileLocation;
   big: ApiFileLocation;
 } | undefined {
@@ -8,7 +9,7 @@ export function buildApiPhotoLocations(entity: MTP.user | MTP.chat): {
     return undefined;
   }
 
-  const { photoSmall, photoBig, dcId } = entity.photo as (MTPNext.UserProfilePhoto | MTPNext.ChatPhoto);
+  const { photoSmall, photoBig, dcId } = entity.photo as (MTProto.userProfilePhoto | MTProto.chatPhoto);
 
   return {
     small: {

+ 44 - 26
src/api/gramjs/builders/messages.ts

@@ -1,18 +1,25 @@
-import * as gramJsApi from '../../../lib/gramjs/tl/types';
+import { gramJsApi, MTProto } from '../../../lib/gramjs';
 import { strippedPhotoToJpg } from '../../../lib/gramjs/Utils';
 import {
   ApiMessage, ApiMessageForwardInfo, ApiPhoto, ApiPhotoCachedSize, ApiPhotoSize, ApiSticker,
 } from '../../types';
-import { OmitFlags } from '../types/types';
 
 import { getApiChatIdFromMtpPeer } from './chats';
 import { isPeerUser } from './peers';
 import { bytesToDataUri } from './common';
 
+const ctors = gramJsApi.constructors;
+
 // TODO Maybe we do not need it.
 const DEFAULT_USER_ID = 0;
 
-export function buildApiMessage(mtpMessage: OmitFlags<MTP.message>): ApiMessage {
+export function buildApiMessage(mtpMessage: MTProto.Message): ApiMessage {
+  if (
+    !(mtpMessage instanceof ctors.Message)
+    && !(mtpMessage instanceof ctors.MessageService)) {
+    throw new Error('Not supported');
+  }
+
   const isPrivateToMe = mtpMessage.out !== true && isPeerUser(mtpMessage.toId);
   const chatId = isPrivateToMe
     ? (mtpMessage.fromId || DEFAULT_USER_ID)
@@ -22,9 +29,9 @@ export function buildApiMessage(mtpMessage: OmitFlags<MTP.message>): ApiMessage
 }
 
 export function buildApiMessageFromShort(
-  mtpMessage: OmitFlags<MTP.updateShortMessage>,
+  mtpMessage: MTProto.updateShortMessage,
 ): ApiMessage {
-  const chatId = getApiChatIdFromMtpPeer({ userId: mtpMessage.userId });
+  const chatId = getApiChatIdFromMtpPeer({ userId: mtpMessage.userId } as MTProto.Peer);
 
   return buildApiMessageWithChatId(chatId, {
     ...mtpMessage,
@@ -34,16 +41,18 @@ export function buildApiMessageFromShort(
 }
 
 export function buildApiMessageFromShortChat(
-  mtpMessage: OmitFlags<MTP.updateShortChatMessage>,
+  mtpMessage: MTProto.updateShortChatMessage,
 ): ApiMessage {
-  const chatId = getApiChatIdFromMtpPeer({ chatId: mtpMessage.chatId });
+  const chatId = getApiChatIdFromMtpPeer({ chatId: mtpMessage.chatId } as MTProto.Peer);
 
   return buildApiMessageWithChatId(chatId, mtpMessage);
 }
 
 export function buildApiMessageWithChatId(
   chatId: number,
-  mtpMessage: Pick<MTP.message, 'id' | 'out' | 'message' | 'date' | 'fromId' | 'fwdFrom' | 'replyToMsgId' | 'media'>,
+  mtpMessage: Pick<MTProto.message, (
+    'id' | 'out' | 'message' | 'date' | 'fromId' | 'fwdFrom' | 'replyToMsgId' | 'media'
+  )>,
 ): ApiMessage {
   const sticker = mtpMessage.media && buildSticker(mtpMessage.media);
   const photo = mtpMessage.media && buildPhoto(mtpMessage.media);
@@ -57,7 +66,7 @@ export function buildApiMessageWithChatId(
   return {
     id: mtpMessage.id,
     chat_id: chatId,
-    is_outgoing: mtpMessage.out === true,
+    is_outgoing: Boolean(mtpMessage.out),
     content: {
       '@type': 'message',
       ...(text && { text }),
@@ -72,27 +81,33 @@ export function buildApiMessageWithChatId(
   };
 }
 
-function buildApiMessageForwardInfo(fwdFrom: MTP.messageFwdHeader): ApiMessageForwardInfo {
+function buildApiMessageForwardInfo(fwdFrom: MTProto.messageFwdHeader): ApiMessageForwardInfo {
   return {
     '@type': 'messageForwardInfo',
     from_chat_id: fwdFrom.fromId,
     origin: {
       '@type': 'messageForwardOriginUser',
       // TODO Handle when empty `fromId`.
-      sender_user_id: fwdFrom.fromId!,
+      sender_user_id: fwdFrom.fromId,
       // TODO @gramjs Not supported?
       // sender_user_name: fwdFrom.fromName,
     },
   };
 }
 
-function buildSticker(media: MTP.MessageMedia): ApiSticker | null {
-  if (!(media instanceof gramJsApi.MessageMediaDocument)) {
+function buildSticker(media: MTProto.MessageMedia): ApiSticker | null {
+  if (
+    !(media instanceof ctors.MessageMediaDocument)
+    || !media.document
+    || !(media.document instanceof ctors.Document)
+  ) {
     return null;
   }
 
   const stickerAttribute = media.document.attributes
-    .find((attr: any) => attr instanceof gramJsApi.DocumentAttributeSticker);
+    .find((attr: any): attr is MTProto.documentAttributeSticker => (
+      attr instanceof ctors.DocumentAttributeSticker
+    ));
 
   if (!stickerAttribute) {
     return null;
@@ -100,8 +115,8 @@ function buildSticker(media: MTP.MessageMedia): ApiSticker | null {
 
   const emoji = stickerAttribute.alt;
   const isAnimated = media.document.mimeType === 'application/x-tgsticker';
-  const thumb = media.document.thumbs.find((s: any) => s instanceof gramJsApi.PhotoCachedSize);
-  const thumbnail = thumb && buildApiPhotoCachedSize(thumb);
+  const thumb = media.document.thumbs && media.document.thumbs.find((s: any) => s instanceof ctors.PhotoCachedSize);
+  const thumbnail = thumb && buildApiPhotoCachedSize(thumb as MTProto.photoCachedSize);
   const { width, height } = thumbnail || {};
 
   return {
@@ -114,22 +129,24 @@ function buildSticker(media: MTP.MessageMedia): ApiSticker | null {
   };
 }
 
-function buildPhoto(media: MTP.MessageMedia): ApiPhoto | null {
-  if (!(media instanceof gramJsApi.MessageMediaPhoto)) {
+function buildPhoto(media: MTProto.MessageMedia): ApiPhoto | null {
+  if (!(media instanceof ctors.MessageMediaPhoto) || !media.photo || !(media.photo instanceof ctors.Photo)) {
     return null;
   }
 
-  const hasStickers = media.photo.has_stickers;
-  const thumb = media.photo.sizes.find((s: any) => s instanceof gramJsApi.PhotoStrippedSize);
-  const mSize = media.photo.sizes.find((s: any) => s.type === 'm');
-  const { width, height } = mSize;
+  const hasStickers = Boolean(media.photo.hasStickers);
+  const thumb = media.photo.sizes.find((s: any) => s instanceof ctors.PhotoStrippedSize);
+  const sizes = media.photo.sizes
+    .filter((s: any): s is MTProto.photoSize => s instanceof ctors.PhotoSize)
+    .map(buildApiPhotoSize);
+  const mSize = sizes.find((s: any) => s.type === 'm');
+  const { width, height } = mSize as ApiPhotoSize;
   const minithumbnail: ApiPhoto['minithumbnail'] = thumb && {
     '@type': 'minithumbnail',
-    data: bytesToDataUri(strippedPhotoToJpg(thumb.bytes as Buffer), true),
+    data: bytesToDataUri(strippedPhotoToJpg((thumb as MTProto.photoStrippedSize).bytes as Buffer), true),
     width,
     height,
   };
-  const sizes = media.photo.sizes.filter((s: any) => s instanceof gramJsApi.PhotoSize).map(buildApiPhotoSize);
 
   return {
     '@type': 'photo',
@@ -139,7 +156,7 @@ function buildPhoto(media: MTP.MessageMedia): ApiPhoto | null {
   };
 }
 
-function buildApiPhotoCachedSize(photoSize: MTP.photoCachedSize): ApiPhotoCachedSize {
+function buildApiPhotoCachedSize(photoSize: MTProto.photoCachedSize): ApiPhotoCachedSize {
   const {
     w, h, type, bytes,
   } = photoSize;
@@ -154,7 +171,7 @@ function buildApiPhotoCachedSize(photoSize: MTP.photoCachedSize): ApiPhotoCached
   };
 }
 
-function buildApiPhotoSize(photoSize: MTP.photoSize): ApiPhotoSize {
+function buildApiPhotoSize(photoSize: MTProto.photoSize): ApiPhotoSize {
   const { w, h, type } = photoSize;
 
   return {
@@ -167,6 +184,7 @@ function buildApiPhotoSize(photoSize: MTP.photoSize): ApiPhotoSize {
 
 // We only support 100000 local pending messages here and expect it will not interfere with real IDs.
 let localMessageCounter = -1;
+
 export function buildLocalMessage(chatId: number, text: string): ApiMessage {
   const localId = localMessageCounter--;
 

+ 13 - 0
src/api/gramjs/builders/peers.ts

@@ -0,0 +1,13 @@
+import { MTProto } from '../../../lib/gramjs';
+
+export function isPeerUser(peer: MTProto.Peer): peer is MTProto.peerUser {
+  return peer.hasOwnProperty('userId');
+}
+
+export function isPeerChat(peer: MTProto.Peer): peer is MTProto.peerChat {
+  return peer.hasOwnProperty('chatId');
+}
+
+export function isPeerChannel(peer: MTProto.Peer): peer is MTProto.peerChannel {
+  return peer.hasOwnProperty('channelId');
+}

+ 39 - 0
src/api/gramjs/builders/users.ts

@@ -0,0 +1,39 @@
+import { gramJsApi, MTProto } from '../../../lib/gramjs';
+import { ApiUser, ApiUserStatus } from '../../types';
+import { buildApiPhotoLocations } from './common';
+
+const ctors = gramJsApi.constructors;
+
+export function buildApiUser(mtpUser: MTProto.user): ApiUser {
+  return {
+    id: mtpUser.id,
+    type: {
+      // TODO Support other user types.
+      '@type': 'userTypeRegular',
+    },
+    first_name: mtpUser.firstName,
+    last_name: mtpUser.lastName,
+    username: mtpUser.username || '',
+    phone_number: mtpUser.phone || '',
+    profile_photo_locations: buildApiPhotoLocations(mtpUser),
+    status: buildApiUserStatus(mtpUser.status),
+  };
+}
+
+export function buildApiUserStatus(mtpStatus?: MTProto.UserStatus): ApiUserStatus | undefined {
+  if (!mtpStatus || mtpStatus instanceof ctors.UserStatusEmpty) {
+    return { '@type': 'userStatusEmpty' };
+  } else if (mtpStatus instanceof ctors.UserStatusOnline) {
+    return { '@type': 'userStatusOnline' };
+  } else if (mtpStatus instanceof ctors.UserStatusOffline) {
+    return { '@type': 'userStatusOffline', was_online: mtpStatus.wasOnline };
+  } else if (mtpStatus instanceof ctors.UserStatusRecently) {
+    return { '@type': 'userStatusRecently' };
+  } else if (mtpStatus instanceof ctors.UserStatusLastWeek) {
+    return { '@type': 'userStatusLastWeek' };
+  } else if (mtpStatus instanceof ctors.UserStatusLastMonth) {
+    return { '@type': 'userStatusLastMonth' };
+  }
+
+  return undefined;
+}

+ 19 - 31
src/api/gramjs/client.ts

@@ -1,28 +1,26 @@
-import * as gramJsApi from '../../lib/gramjs/tl/types';
 import {
-  InvokeRequestPayload,
-  SupportedMessageRequests,
-  SupportedUploadRequests,
-} from './types/types';
-import * as apiRequests from '../../lib/gramjs/tl/functions';
+  TelegramClient, session, GramJsApi, MTProto,
+} from '../../lib/gramjs';
 import { Logger as GramJsLogger } from '../../lib/gramjs/extensions';
 
-import { TelegramClient, session } from '../../lib/gramjs';
 import { DEBUG } from '../../config';
 import {
   onAuthReady, onRequestCode, onRequestPassword, onRequestPhoneNumber,
 } from './connectors/auth';
 import { onGramJsUpdate } from './onGramJsUpdate';
+<<<<<<< HEAD
 import localDb from './localDb';
 import { buildInputPeerPhotoFileLocation } from './inputHelpers';
 import { ApiFileLocation } from '../types';
 <<<<<<< HEAD
 =======
+=======
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
 
 GramJsLogger.getLogger().level = 'debug';
 >>>>>>> dda7e47e... Fix images loading; Various Gram JS fixes; Refactor Gram JS Logger
 
-let client: any;
+let client: TelegramClient;
 
 export async function init(sessionId: string) {
   const { StringSession } = session;
@@ -67,42 +65,23 @@ export async function init(sessionId: string) {
   }
 }
 
-export async function invokeRequest(data: InvokeRequestPayload) {
-  const { namespace, name, args } = data;
-
-  let RequestClass;
-
-  // For some reason these types are not working automatically.
-  switch (namespace) {
-    case 'messages':
-      RequestClass = apiRequests.messages[name as SupportedMessageRequests];
-      break;
-    case 'upload':
-      RequestClass = apiRequests.upload[name as SupportedUploadRequests];
-      break;
-    default:
-      return null;
-  }
-
-  const request = new RequestClass(args);
-
+export async function invokeRequest<T extends InstanceType<GramJsApi.AnyRequest>>(request: T) {
   if (DEBUG) {
     // eslint-disable-next-line no-console
-    console.log(`[GramJs/worker] INVOKE ${name}`, args);
+    console.log(`[GramJs/client] INVOKE ${request.className}`);
   }
 
   const result = await client.invoke(request);
 
-  postProcess(name, result, args);
-
   if (DEBUG) {
     // eslint-disable-next-line no-console
-    console.log(`[GramJs/worker] INVOKE RESPONSE ${name}`, result);
+    console.log(`[GramJs/client] INVOKE RESPONSE ${request.className}`, result);
   }
 
   return result;
 }
 
+<<<<<<< HEAD
 <<<<<<< HEAD
 export function downloadFile(id: number, fileLocation: ApiFileLocation, dcId?: number) {
   return client.downloadFile(
@@ -168,3 +147,12 @@ function postProcess(name: string, anyResult: any, args: AnyLiteral) {
     }
   }
 }
+=======
+export function downloadAvatar(entity: MTProto.chat | MTProto.user, isBig = false) {
+  return client.downloadProfilePhoto(entity, isBig);
+}
+
+export function downloadMessageImage(message: MTProto.message) {
+  return client.downloadMedia(message, { sizeType: 'x' });
+}
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings

+ 98 - 0
src/api/gramjs/connectors/auth.ts

@@ -0,0 +1,98 @@
+import { ApiUpdateAuthorizationState, ApiUpdateAuthorizationStateType } from '../../types';
+import { OnApiUpdate } from '../types';
+
+const authPromiseResolvers: {
+  resolvePhoneNumber: null | Function;
+  resolveCode: null | Function;
+  resolvePassword: null | Function;
+} = {
+  resolvePhoneNumber: null,
+  resolveCode: null,
+  resolvePassword: null,
+};
+
+let onUpdate: OnApiUpdate;
+
+export function init(_onUpdate: OnApiUpdate) {
+  onUpdate = _onUpdate;
+}
+
+export function onRequestPhoneNumber() {
+  if (!onUpdate) {
+    return null;
+  }
+
+  onUpdate(buildAuthState('authorizationStateWaitPhoneNumber'));
+
+  return new Promise((resolve) => {
+    authPromiseResolvers.resolvePhoneNumber = resolve;
+  });
+}
+
+export function onRequestCode() {
+  if (!onUpdate) {
+    return null;
+  }
+
+  onUpdate(buildAuthState('authorizationStateWaitCode'));
+
+  return new Promise((resolve) => {
+    authPromiseResolvers.resolveCode = resolve;
+  });
+}
+
+export function onRequestPassword() {
+  if (!onUpdate) {
+    return null;
+  }
+
+  onUpdate(buildAuthState('authorizationStateWaitPassword'));
+
+  return new Promise((resolve) => {
+    authPromiseResolvers.resolvePassword = resolve;
+  });
+}
+
+export function onAuthReady(sessionId: string) {
+  if (!onUpdate) {
+    return;
+  }
+
+  onUpdate({
+    ...buildAuthState('authorizationStateReady'),
+    session_id: sessionId,
+  });
+}
+
+export function buildAuthState(authState: ApiUpdateAuthorizationStateType): ApiUpdateAuthorizationState {
+  return {
+    '@type': 'updateAuthorizationState',
+    authorization_state: {
+      '@type': authState,
+    },
+  };
+}
+
+export function provideAuthPhoneNumber(phoneNumber: string) {
+  if (!authPromiseResolvers.resolvePhoneNumber) {
+    return;
+  }
+
+  authPromiseResolvers.resolvePhoneNumber(phoneNumber);
+}
+
+export function provideAuthCode(code: string) {
+  if (!authPromiseResolvers.resolveCode) {
+    return;
+  }
+
+  authPromiseResolvers.resolveCode(code);
+}
+
+export function provideAuthPassword(password: string) {
+  if (!authPromiseResolvers.resolvePassword) {
+    return;
+  }
+
+  authPromiseResolvers.resolvePassword(password);
+}

+ 123 - 0
src/api/gramjs/connectors/chats.ts

@@ -0,0 +1,123 @@
+import { gramJsApi, MTProto } from '../../../lib/gramjs';
+
+import { OnApiUpdate } from '../types';
+import { invokeRequest } from '../client';
+import { buildApiChatFromDialog, getApiChatIdFromMtpPeer, getPeerKey } from '../builders/chats';
+import { buildApiMessage } from '../builders/messages';
+import { buildApiUser } from '../builders/users';
+import { buildCollectionByKey } from '../../../util/iteratees';
+import { loadAvatar } from './files';
+import localDb from '../localDb';
+import { UNSUPPORTED_RESPONSE } from '../utils';
+
+const { constructors: ctors, requests } = gramJsApi;
+
+let onUpdate: OnApiUpdate;
+
+export function init(_onUpdate: OnApiUpdate) {
+  onUpdate = _onUpdate;
+}
+
+export async function fetchChats(
+  {
+    limit,
+    offsetDate,
+  }: {
+    limit: number;
+    offsetDate?: number;
+  },
+): Promise<{ chat_ids: number[] } | null> {
+  const result = await invokeRequest(new requests.messages.GetDialogsRequest({
+    offsetPeer: new ctors.InputPeerEmpty({}),
+    limit,
+    offsetDate,
+  }));
+
+  if (!result || !(result instanceof ctors.messages.DialogsSlice) || !result.dialogs.length) {
+    throw new Error(UNSUPPORTED_RESPONSE);
+  }
+
+  updateLocalDb(result);
+
+  const lastMessagesByChatId = buildCollectionByKey(result.messages.map(buildApiMessage), 'chat_id');
+  const peersByKey = preparePeers(result);
+  const chats = result.dialogs.map((dialog) => {
+    const peerEntity = peersByKey[getPeerKey(dialog.peer)];
+    const chat = buildApiChatFromDialog(dialog as MTProto.dialog, peerEntity);
+    chat.last_message = lastMessagesByChatId[chat.id];
+    return chat;
+  });
+
+  onUpdate({
+    '@type': 'chats',
+    chats,
+  });
+
+  const users = (result.users as MTProto.user[]).map(buildApiUser);
+  onUpdate({
+    '@type': 'users',
+    users,
+  });
+
+  loadAvatars(result);
+
+  const chatIds = chats.map((chat) => chat.id);
+
+  return {
+    chat_ids: chatIds,
+  };
+}
+
+function preparePeers(result: MTProto.messages_dialogsSlice) {
+  const store: Record<string, MTProto.chat | MTProto.user> = {};
+
+  result.chats.forEach((chat) => {
+    store[`chat${chat.id}`] = chat as MTProto.chat;
+  });
+
+  result.users.forEach((user) => {
+    store[`user${user.id}`] = user as MTProto.user;
+  });
+
+  return store;
+}
+
+function updateLocalDb(result: MTProto.messages_dialogsSlice) {
+  result.users.forEach((user) => {
+    localDb.users[user.id] = user as MTProto.user;
+  });
+
+  result.chats.forEach((chat) => {
+    localDb.chats[chat.id] = chat as MTProto.chat | MTProto.channel;
+  });
+}
+
+function loadAvatars(result: MTProto.messages_dialogsSlice) {
+  result.users.forEach((user) => {
+    loadAvatar(user as MTProto.user).then((dataUri) => {
+      if (!dataUri) {
+        return;
+      }
+
+      onUpdate({
+        '@type': 'updateAvatar',
+        chat_id: getApiChatIdFromMtpPeer({ userId: user.id } as MTProto.Peer),
+        data_uri: dataUri,
+      });
+    });
+  });
+
+  result.chats.forEach((chat) => {
+    loadAvatar(chat as MTProto.chat).then((dataUri) => {
+      if (!dataUri) {
+        return;
+      }
+
+      onUpdate({
+        '@type': 'updateAvatar',
+        chat_id: getApiChatIdFromMtpPeer({ chatId: chat.id } as MTProto.Peer),
+        data_uri: dataUri,
+      });
+    });
+  });
+}

+ 32 - 0
src/api/gramjs/connectors/files.ts

@@ -1,9 +1,14 @@
+<<<<<<< HEAD
 import { ApiFileLocation } from '../../types';
 
 <<<<<<< HEAD
 import { downloadFile } from '../client';
 =======
 import { downloadFile, downloadMessageImage } from '../client';
+=======
+import { MTProto } from '../../../lib/gramjs';
+import { downloadAvatar, downloadMessageImage } from '../client';
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
 import localDb from '../localDb';
 import { bytesToDataUri } from '../builders/common';
 >>>>>>> dda7e47e... Fix images loading; Various Gram JS fixes; Refactor Gram JS Logger
@@ -11,18 +16,45 @@ import { bytesToDataUri } from '../builders/common';
 export function init() {
 }
 
+<<<<<<< HEAD
 export async function loadFile(id: any, fileLocation: ApiFileLocation): Promise<string | null> {
   const fileBuffer = await downloadFile(id, fileLocation);
+=======
+export function loadAvatar(entity: MTProto.user | MTProto.chat): Promise<string | null> {
+  const entityId = entity.id;
+
+  if (!localDb.avatarRequests[entityId]) {
+    localDb.avatarRequests[entityId] = downloadAvatar(entity)
+      .then(
+        (fileBuffer: Buffer) => {
+          if (fileBuffer) {
+            return bytesToDataUri(fileBuffer);
+          } else {
+            delete localDb.avatarRequests[entityId];
+            return null;
+          }
+        },
+        () => {
+          delete localDb.avatarRequests[entityId];
+          return null;
+        },
+      );
+  }
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
 
   return fileBuffer ? bytesToUrl(fileBuffer) : null;
 }
 
+<<<<<<< HEAD
 <<<<<<< HEAD
 function bytesToUrl(bytes: Uint8Array, mimeType?: string) {
   if (!mimeType) {
     mimeType = 'image/jpg';
 =======
 export function loadMessageMedia(message: MTP.message): Promise<string | null> {
+=======
+export function loadMessageMedia(message: MTProto.message): Promise<string | null> {
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
   const messageId = message.id;
 
   if (!localDb.mediaRequests[messageId]) {

+ 61 - 29
src/api/gramjs/connectors/messages.ts

@@ -1,7 +1,7 @@
-import * as gramJsApi from '../../../lib/gramjs/tl/types';
+import { gramJsApi, MTProto } from '../../../lib/gramjs';
 
 import { ApiMessage } from '../../types';
-import { OnApiUpdate } from '../types/types';
+import { OnApiUpdate } from '../types';
 
 import { invokeRequest } from '../client';
 import { buildApiMessage, buildLocalMessage } from '../builders/messages';
@@ -9,6 +9,10 @@ import { buildApiUser } from '../builders/users';
 import { buildInputPeer, generateRandomBigInt } from '../inputHelpers';
 import localDb from '../localDb';
 import { loadMessageMedia } from './files';
+import { UNSUPPORTED_RESPONSE } from '../utils';
+import { onGramJsUpdate } from '../onGramJsUpdate';
+
+const { constructors: ctors, requests } = gramJsApi;
 
 let onUpdate: OnApiUpdate;
 
@@ -21,21 +25,21 @@ export async function fetchMessages({ chatId, fromMessageId, limit }: {
   fromMessageId: number;
   limit: number;
 }): Promise<{ messages: ApiMessage[] } | null> {
-  const result = await invokeRequest({
-    namespace: 'messages',
-    name: 'GetHistoryRequest',
-    args: {
-      offsetId: fromMessageId,
-      limit,
-      peer: buildInputPeer(chatId),
-    },
-  }) as MTP.messages$Messages;
-
-  if (!result || !result.messages) {
-    return null;
+  const result = await invokeRequest(new requests.messages.GetHistoryRequest({
+    offsetId: fromMessageId,
+    limit,
+    peer: buildInputPeer(chatId),
+  }));
+
+  if (
+    !result
+    || !(result instanceof ctors.messages.MessagesSlice || result instanceof ctors.messages.ChannelMessages)
+    || !result.messages
+  ) {
+    throw new Error(UNSUPPORTED_RESPONSE);
   }
 
-  (result.users as MTP.user[]).forEach((mtpUser) => {
+  (result.users as MTProto.user[]).forEach((mtpUser) => {
     const user = buildApiUser(mtpUser);
 
     onUpdate({
@@ -45,7 +49,7 @@ export async function fetchMessages({ chatId, fromMessageId, limit }: {
     });
   });
 
-  const messages = (result.messages as MTP.message[])
+  const messages = (result.messages as MTProto.message[])
     .map((mtpMessage) => {
       if (isMessageWithImage(mtpMessage)) {
         loadMessageMedia(mtpMessage).then((dataUri) => {
@@ -87,33 +91,61 @@ export function sendMessage(chatId: number, text: string) {
   });
 
   const randomId = generateRandomBigInt();
-
   localDb.localMessages[randomId.toString()] = localMessage;
-
-  void invokeRequest({
-    namespace: 'messages',
-    name: 'SendMessageRequest',
-    args: {
-      message: text,
-      peer: buildInputPeer(chatId),
-      randomId,
-    },
+  const request = new requests.messages.SendMessageRequest({
+    message: text,
+    peer: buildInputPeer(chatId),
+    randomId,
   });
+  const result = invokeRequest(request);
+
+  if (result instanceof ctors.UpdatesTooLong) {
+    throw new Error(UNSUPPORTED_RESPONSE);
+  }
+
+  if (result instanceof ctors.Updates) {
+    result.updates.forEach((update) => onGramJsUpdate(update, request));
+  } else {
+    onGramJsUpdate(result, request);
+  }
 }
 
+<<<<<<< HEAD
 function isMessageWithImage(message: MTP.message) {
+=======
+function loadImage(mtpMessage: MTProto.message) {
+  if (!isMessageWithImage(mtpMessage)) {
+    return;
+  }
+
+  loadMessageMedia(mtpMessage).then((dataUri) => {
+    if (!dataUri) {
+      return;
+    }
+
+    onUpdate({
+      '@type': 'updateMessageImage',
+      message_id: mtpMessage.id,
+      data_uri: dataUri,
+    });
+  });
+}
+
+function isMessageWithImage(message: MTProto.message) {
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
   const { media } = message;
 
   if (!media) {
     return false;
   }
 
-  if (media instanceof gramJsApi.MessageMediaPhoto) {
+  if (media instanceof ctors.MessageMediaPhoto) {
     return true;
   }
 
-  if (media instanceof gramJsApi.MessageMediaDocument) {
-    return media.document.attributes.some((attr: any) => attr instanceof gramJsApi.DocumentAttributeSticker);
+  if (media instanceof ctors.MessageMediaDocument && media.document) {
+    return ('attributes' in media.document) && media.document.attributes
+      .some((attr: any) => attr instanceof ctors.DocumentAttributeSticker);
   }
 
   return false;

+ 18 - 0
src/api/gramjs/init.ts

@@ -0,0 +1,18 @@
+import { OnApiUpdate } from './types';
+
+import { init as initUpdater } from './onGramJsUpdate';
+import { init as initAuth } from './connectors/auth';
+import { init as initChats } from './connectors/chats';
+import { init as initMessages } from './connectors/messages';
+import { init as initFiles } from './connectors/files';
+import { init as initClient } from './client';
+
+export async function init(onUpdate: OnApiUpdate, sessionId = '') {
+  initUpdater(onUpdate);
+  initAuth(onUpdate);
+  initChats(onUpdate);
+  initMessages(onUpdate);
+  initFiles();
+
+  await initClient(sessionId);
+}

+ 46 - 0
src/api/gramjs/inputHelpers.ts

@@ -0,0 +1,46 @@
+import { BigInteger } from 'big-integer';
+import { gramJsApi, MTProto } from '../../lib/gramjs';
+
+import { generateRandomBytes, readBigIntFromBuffer } from '../../lib/gramjs/Helpers';
+import localDb from './localDb';
+
+const ctors = gramJsApi.constructors;
+
+export function buildInputPeer(chatOrUserId: number): MTProto.Peer {
+  if (chatOrUserId > 0) {
+    const user = localDb.users[chatOrUserId] as MTProto.user;
+
+    return user && new ctors.InputPeerUser({
+      userId: chatOrUserId,
+      accessHash: user.accessHash as BigInteger,
+    });
+  } else if (chatOrUserId <= -1000000000) {
+    const channel = localDb.chats[-chatOrUserId] as MTProto.channel;
+
+    return channel && new ctors.InputPeerChannel({
+      channelId: -chatOrUserId,
+      accessHash: channel.accessHash as BigInteger,
+    });
+  } else {
+    return new ctors.InputPeerChat({
+      chatId: -chatOrUserId,
+    });
+  }
+}
+
+export function buildInputPeerPhotoFileLocation(
+  chatOrUserId: number,
+  volumeId: MTProto.long,
+  localId: number,
+): MTProto.inputPeerPhotoFileLocation {
+  const peer = buildInputPeer(chatOrUserId);
+  return new ctors.InputPeerPhotoFileLocation({
+    peer,
+    volumeId,
+    localId,
+  });
+}
+
+export function generateRandomBigInt() {
+  return readBigIntFromBuffer(generateRandomBytes(8), false);
+}

+ 3 - 2
src/api/gramjs/localDb.ts

@@ -1,8 +1,9 @@
 import { ApiMessage } from '../types';
+import { MTProto } from '../../lib/gramjs';
 
 export default <{
-  chats: Record<number, MTP.chat | MTP.channel>;
-  users: Record<number, MTP.user>;
+  chats: Record<number, MTProto.chat | MTProto.channel>;
+  users: Record<number, MTProto.user>;
   localMessages: Record<string, ApiMessage>;
   // TODO Replace with persistent storage for all downloads.
   avatarRequests: Record<number, Promise<string | null>>;

+ 126 - 0
src/api/gramjs/onGramJsUpdate.ts

@@ -0,0 +1,126 @@
+import { GramJsApi, gramJsApi, MTProto } from '../../lib/gramjs';
+import { OnApiUpdate } from './types';
+
+import { buildApiMessage, buildApiMessageFromShort, buildApiMessageFromShortChat } from './builders/messages';
+import { getApiChatIdFromMtpPeer } from './builders/chats';
+import { buildApiUserStatus } from './builders/users';
+import localDb from './localDb';
+import { UNSUPPORTED_RESPONSE } from './utils';
+
+const { constructors: ctors, requests } = gramJsApi;
+
+let onUpdate: OnApiUpdate;
+
+export function init(_onUpdate: OnApiUpdate) {
+  onUpdate = _onUpdate;
+}
+
+export function onGramJsUpdate(update: AnyLiteral, originRequest?: InstanceType<GramJsApi.AnyRequest>) {
+  if (
+    update instanceof ctors.UpdateNewMessage
+    || update instanceof ctors.UpdateShortChatMessage
+    || update instanceof ctors.UpdateShortMessage
+    // TODO UpdateNewChannelMessage
+  ) {
+    let message;
+
+    if (update instanceof ctors.UpdateNewMessage) {
+      message = buildApiMessage(update.message);
+    } else if (update instanceof ctors.UpdateShortChatMessage) {
+      message = buildApiMessageFromShortChat(update);
+    } else if (update instanceof ctors.UpdateShortMessage) {
+      message = buildApiMessageFromShort(update);
+    } else {
+      throw new Error(UNSUPPORTED_RESPONSE);
+    }
+
+    onUpdate({
+      '@type': 'updateMessage',
+      id: message.id,
+      chat_id: message.chat_id,
+      message,
+    });
+
+    onUpdate({
+      '@type': 'updateChat',
+      id: message.chat_id,
+      chat: {
+        last_message: message,
+      },
+    });
+  } else if (
+    (originRequest instanceof requests.messages.SendMessageRequest)
+    && (
+      update instanceof ctors.UpdateMessageID
+      || update instanceof ctors.UpdateShortSentMessage
+    )
+  ) {
+    const { randomId } = originRequest;
+    const localMessage = localDb.localMessages[randomId!.toString()];
+    if (!localMessage) {
+      throw new Error('Local message not found');
+    }
+
+    onUpdate({
+      '@type': 'updateMessageSendSucceeded',
+      chat_id: localMessage.chat_id,
+      old_message_id: localMessage.id,
+      message: {
+        ...localMessage,
+        id: update.id,
+        sending_state: undefined,
+      },
+    });
+  } else if (update instanceof ctors.UpdateReadHistoryInbox) {
+    onUpdate({
+      '@type': 'updateChat',
+      id: getApiChatIdFromMtpPeer(update.peer),
+      chat: {
+        last_read_inbox_message_id: update.maxId,
+        unread_count: update.stillUnreadCount,
+      },
+    });
+  } else if (update instanceof ctors.UpdateReadHistoryOutbox) {
+    onUpdate({
+      '@type': 'updateChat',
+      id: getApiChatIdFromMtpPeer(update.peer),
+      chat: {
+        last_read_outbox_message_id: update.maxId,
+      },
+    });
+  } else if (update instanceof ctors.UpdateReadChannelInbox) {
+    onUpdate({
+      '@type': 'updateChat',
+      id: getApiChatIdFromMtpPeer({ channelId: update.channelId } as MTProto.Peer),
+      chat: {
+        last_read_inbox_message_id: update.maxId,
+        unread_count: update.stillUnreadCount,
+      },
+    });
+  } else if (update instanceof ctors.UpdateReadChannelOutbox) {
+    onUpdate({
+      '@type': 'updateChat',
+      id: getApiChatIdFromMtpPeer({ channelId: update.channelId } as MTProto.Peer),
+      chat: {
+        last_read_outbox_message_id: update.maxId,
+      },
+    });
+  } else if (update instanceof ctors.UpdateUserStatus) {
+    onUpdate({
+      '@type': 'updateUser',
+      id: update.userId,
+      user: {
+        status: buildApiUserStatus(update.status),
+      },
+    });
+    // TODO @gramjs This one never comes for some reason. `UpdatePinnedDialogs` comes instead.
+    // } else if (update instanceof ctors.UpdateDialogPinned) {
+    //   onUpdate({
+    //     '@type': 'updateChat',
+    //     id: getApiChatIdFromMtpPeer(update.peer),
+    //     chat: {
+    //       is_pinned: update.pinned || false,
+    //     },
+    //   });
+  }
+}

+ 3 - 0
src/api/gramjs/types.ts

@@ -0,0 +1,3 @@
+import { ApiUpdate } from '../types';
+
+export type OnApiUpdate = (update: ApiUpdate) => void;

+ 1 - 0
src/api/gramjs/utils.ts

@@ -0,0 +1 @@
+export const UNSUPPORTED_RESPONSE = 'Unsupported response';

+ 33 - 0
src/api/types/files.ts

@@ -0,0 +1,33 @@
+export interface ApiFile {
+  '@type': 'file';
+  id: number;
+  size: number;
+  expected_size: number;
+  local: {
+    '@type': 'localFile';
+    path: string;
+    can_be_downloaded: boolean;
+    can_be_deleted: boolean;
+    is_downloading_active: boolean;
+    is_downloading_completed: boolean;
+  };
+  remote: {
+    '@type': 'remoteFile';
+    id: string;
+    is_uploading_active: boolean;
+    is_uploading_completed: boolean;
+    uploaded_size: number;
+  };
+  blob?: Blob;
+  blobUrl?: string;
+}
+
+export interface ApiFileSource {
+  dataUri: string;
+}
+
+export interface ApiFileLocation {
+  dcId: int;
+  volumeId: MTProto.long;
+  localId: number;
+}

+ 80 - 0
src/api/types/messages.ts

@@ -0,0 +1,80 @@
+import { ApiFile } from './files';
+
+export interface ApiPhotoSize {
+  '@type': 'photoSize';
+  type: 'm' | 'x' | 'y';
+  width: number;
+  height: number;
+  // TdLib only.
+  photo?: ApiFile;
+}
+
+export interface ApiPhotoCachedSize {
+  '@type': 'photoCachedSize';
+  dataUri: string;
+  type: 'm' | 'x' | 'y';
+  width: number;
+  height: number;
+}
+
+export interface ApiPhoto {
+  '@type': 'photo';
+  has_stickers: boolean;
+  minithumbnail?: {
+    '@type': 'minithumbnail';
+    data: string;
+    height: number;
+    width: number;
+  };
+  sizes: ApiPhotoSize[];
+}
+
+export interface ApiSticker {
+  '@type': 'sticker';
+  emoji: string;
+  is_animated: boolean;
+  width?: number;
+  height?: number;
+  thumbnail?: ApiPhotoCachedSize;
+  // TdLib only.
+  sticker?: ApiPhotoSize;
+}
+
+export interface ApiMessageForwardInfo {
+  '@type': 'messageForwardInfo';
+  from_chat_id?: number;
+  from_message_id?: number;
+  origin: {
+    '@type': 'messageForwardOriginUser';
+    sender_user_id: number;
+    // GramJS only.
+    sender_user_name?: string;
+  };
+}
+
+export interface ApiMessage {
+  id: number;
+  chat_id: number;
+  content: {
+    // TODO Enum
+    '@type': string;
+    text?: {
+      '@type': 'formattedText';
+      text: string;
+    };
+    photo?: ApiPhoto;
+    caption?: {
+      '@type': 'formattedText';
+      text: string;
+    };
+    sticker?: ApiSticker;
+  };
+  date: number;
+  is_outgoing: boolean;
+  sender_user_id: number;
+  reply_to_message_id?: number;
+  sending_state?: {
+    '@type': 'messageSendingStatePending' | 'messageSendingStateFailed';
+  };
+  forward_info?: ApiMessageForwardInfo;
+}

+ 6 - 6
src/lib/gramjs/Password.js

@@ -1,5 +1,5 @@
 const Factorizator = require('./crypto/Factorizator')
-const { types } = require('./tl')
+const { constructors } = require('./tl')
 const { readBigIntFromBuffer, readBufferFromBigInt, sha256, bigIntMod, modExp,
     generateRandomBytes } = require('./Helpers')
 const crypto = require('crypto')
@@ -154,7 +154,7 @@ function pbkdf2sha512(password, salt, iterations) {
 
 /**
  *
- * @param algo {types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow}
+ * @param algo {constructors.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow}
  * @param password
  * @returns {Buffer|*}
  */
@@ -167,7 +167,7 @@ function computeHash(algo, password) {
 
 /**
  *
- * @param algo {types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow}
+ * @param algo {constructors.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow}
  * @param password
  */
 function computeDigest(algo, password) {
@@ -185,12 +185,12 @@ function computeDigest(algo, password) {
 
 /**
  *
- * @param request {types.account.Password}
+ * @param request {constructors.account.Password}
  * @param password {string}
  */
 function computeCheck(request, password) {
     const algo = request.currentAlgo
-    if (!(algo instanceof types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
+    if (!(algo instanceof constructors.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
         throw new Error(`Unsupported password algorithm ${algo.constructor.name}`)
     }
 
@@ -249,7 +249,7 @@ function computeCheck(request, password) {
     ]))
 
 
-    return new types.InputCheckPasswordSRP({
+    return new constructors.InputCheckPasswordSRP({
         srpId: request.srpId,
         A: Buffer.from(aForHash),
         M1: M1,

+ 71 - 71
src/lib/gramjs/Utils.js

@@ -1,4 +1,4 @@
-const { types } = require('./tl')
+const { constructors } = require('./tl')
 
 const USERNAME_RE = new RegExp('@|(?:https?:\\/\\/)?(?:www\\.)?' +
     '(?:telegram\\.(?:me|dog)|t\\.me)\\/(@|joinchat\\/)?')
@@ -48,11 +48,11 @@ function getInputPeer(entity, allowSelf = true, checkHash = true) {
         return entity
     }
 
-    if (entity instanceof types.User) {
+    if (entity instanceof constructors.User) {
         if (entity.isSelf && allowSelf) {
-            return new types.InputPeerSelf()
+            return new constructors.InputPeerSelf()
         } else if ((entity.accessHash !== undefined && !entity.min) || !checkHash) {
-            return new types.InputPeerUser({
+            return new constructors.InputPeerUser({
                 userId: entity.id,
                 accessHash: entity.accessHash,
             })
@@ -60,42 +60,42 @@ function getInputPeer(entity, allowSelf = true, checkHash = true) {
             throw new Error('User without access_hash or min info cannot be input')
         }
     }
-    if (entity instanceof types.Chat || entity instanceof types.ChatEmpty ||
-        entity instanceof types.ChatForbidden) {
-        return new types.InputPeerChat({ chatId: entity.id })
+    if (entity instanceof constructors.Chat || entity instanceof constructors.ChatEmpty ||
+        entity instanceof constructors.ChatForbidden) {
+        return new constructors.InputPeerChat({ chatId: entity.id })
     }
-    if (entity instanceof types.Channel) {
+    if (entity instanceof constructors.Channel) {
         if ((entity.accessHash !== undefined && !entity.min) || !checkHash) {
-            return new types.InputPeerChannel({ channelId: entity.id, accessHash: entity.accessHash })
+            return new constructors.InputPeerChannel({ channelId: entity.id, accessHash: entity.accessHash })
         } else {
             throw new TypeError('Channel without access_hash or min info cannot be input')
         }
     }
-    if (entity instanceof types.ChannelForbidden) {
+    if (entity instanceof constructors.ChannelForbidden) {
         // "channelForbidden are never min", and since their hash is
         // also not optional, we assume that this truly is the case.
-        return new types.InputPeerChannel({ channelId: entity.id, accessHash: entity.accessHash })
+        return new constructors.InputPeerChannel({ channelId: entity.id, accessHash: entity.accessHash })
     }
 
-    if (entity instanceof types.InputUser) {
-        return new types.InputPeerUser({ userId: entity.userId, accessHash: entity.accessHash })
+    if (entity instanceof constructors.InputUser) {
+        return new constructors.InputPeerUser({ userId: entity.userId, accessHash: entity.accessHash })
     }
-    if (entity instanceof types.InputChannel) {
-        return new types.InputPeerChannel({ channelId: entity.channelId, accessHash: entity.accessHash })
+    if (entity instanceof constructors.InputChannel) {
+        return new constructors.InputPeerChannel({ channelId: entity.channelId, accessHash: entity.accessHash })
     }
-    if (entity instanceof types.UserEmpty) {
-        return new types.InputPeerEmpty()
+    if (entity instanceof constructors.UserEmpty) {
+        return new constructors.InputPeerEmpty()
     }
-    if (entity instanceof types.UserFull) {
+    if (entity instanceof constructors.UserFull) {
         return getInputPeer(entity.user)
     }
 
-    if (entity instanceof types.ChatFull) {
-        return new types.InputPeerChat({ chatId: entity.id })
+    if (entity instanceof constructors.ChatFull) {
+        return new constructors.InputPeerChat({ chatId: entity.id })
     }
 
-    if (entity instanceof types.PeerChat) {
-        return new types.InputPeerChat(entity.chat_id)
+    if (entity instanceof constructors.PeerChat) {
+        return new constructors.InputPeerChat(entity.chat_id)
     }
 
     _raiseCastFail(entity, 'InputPeer')
@@ -122,12 +122,12 @@ function getInputChannel(entity) {
     if (entity.SUBCLASS_OF_ID === 0x40f202fd) { // crc32(b'InputChannel')
         return entity
     }
-    if (entity instanceof types.Channel || entity instanceof types.ChannelForbidden) {
-        return new types.InputChannel({ channelId: entity.id, accessHash: entity.accessHash || 0 })
+    if (entity instanceof constructors.Channel || entity instanceof constructors.ChannelForbidden) {
+        return new constructors.InputChannel({ channelId: entity.id, accessHash: entity.accessHash || 0 })
     }
 
-    if (entity instanceof types.InputPeerChannel) {
-        return new types.InputChannel({ channelId: entity.channelId, accessHash: entity.accessHash })
+    if (entity instanceof constructors.InputPeerChannel) {
+        return new constructors.InputChannel({ channelId: entity.channelId, accessHash: entity.accessHash })
     }
     _raiseCastFail(entity, 'InputChannel')
 }
@@ -151,29 +151,29 @@ function getInputUser(entity) {
         return entity
     }
 
-    if (entity instanceof types.User) {
+    if (entity instanceof constructors.User) {
         if (entity.isSelf) {
-            return new types.InputPeerSelf()
+            return new constructors.InputPeerSelf()
         } else {
-            return new types.InputUser({
+            return new constructors.InputUser({
                 userId: entity.id,
                 accessHash: entity.accessHash || 0,
             })
         }
     }
-    if (entity instanceof types.InputPeerSelf) {
-        return new types.InputPeerSelf()
+    if (entity instanceof constructors.InputPeerSelf) {
+        return new constructors.InputPeerSelf()
     }
-    if (entity instanceof types.UserEmpty || entity instanceof types.InputPeerEmpty) {
-        return new types.InputUserEmpty()
+    if (entity instanceof constructors.UserEmpty || entity instanceof constructors.InputPeerEmpty) {
+        return new constructors.InputUserEmpty()
     }
 
-    if (entity instanceof types.UserFull) {
+    if (entity instanceof constructors.UserFull) {
         return getInputUser(entity.user)
     }
 
-    if (entity instanceof types.InputPeerUser) {
-        return new types.InputUser({ userId: entity.userId, accessHash: entity.accessHash })
+    if (entity instanceof constructors.InputPeerUser) {
+        return new constructors.InputUser({ userId: entity.userId, accessHash: entity.accessHash })
     }
 
     _raiseCastFail(entity, 'InputUser')
@@ -189,14 +189,14 @@ function getInputDialog(dialog) {
             return dialog
         }
         if (dialog.SUBCLASS_OF_ID === 0xc91c90b6) { // crc32(b'InputPeer')
-            return new types.InputDialogPeer({ peer: dialog })
+            return new constructors.InputDialogPeer({ peer: dialog })
         }
     } catch (e) {
         _raiseCastFail(dialog, 'InputDialogPeer')
     }
 
     try {
-        return new types.InputDialogPeer(getInputPeer(dialog))
+        return new constructors.InputDialogPeer(getInputPeer(dialog))
         // eslint-disable-next-line no-empty
     } catch (e) {
 
@@ -207,13 +207,13 @@ function getInputDialog(dialog) {
 function getInputMessage(message) {
     try {
         if (typeof message == 'number') { // This case is really common too
-            return new types.InputMessageID({
+            return new constructors.InputMessageID({
                 id: message,
             })
         } else if (message.SUBCLASS_OF_ID === 0x54b6bcc5) { // crc32(b'InputMessage')
             return message
         } else if (message.SUBCLASS_OF_ID === 0x790009e3) { // crc32(b'Message')
-            return new types.InputMessageID(message.id)
+            return new constructors.InputMessageID(message.id)
         }
         // eslint-disable-next-line no-empty
     } catch (e) {
@@ -253,28 +253,28 @@ function getInputLocation(location) {
     } catch (e) {
         _raiseCastFail(location, 'InputFileLocation')
     }
-    if (location instanceof types.Message) {
+    if (location instanceof constructors.Message) {
         location = location.media
     }
 
-    if (location instanceof types.MessageMediaDocument) {
+    if (location instanceof constructors.MessageMediaDocument) {
         location = location.document
-    } else if (location instanceof types.MessageMediaPhoto) {
+    } else if (location instanceof constructors.MessageMediaPhoto) {
         location = location.photo
     }
 
-    if (location instanceof types.Document) {
+    if (location instanceof constructors.Document) {
         return {
-            dcId: location.dcId, inputLocation: new types.InputDocumentFileLocation({
+            dcId: location.dcId, inputLocation: new constructors.InputDocumentFileLocation({
                 id: location.id,
                 accessHash: location.accessHash,
                 fileReference: location.fileReference,
                 thumbSize: '', // Presumably to download one of its thumbnails
             }),
         }
-    } else if (location instanceof types.Photo) {
+    } else if (location instanceof constructors.Photo) {
         return {
-            dcId: location.dcId, inputLocation: new types.InputPhotoFileLocation({
+            dcId: location.dcId, inputLocation: new constructors.InputPhotoFileLocation({
                 id: location.id,
                 accessHash: location.accessHash,
                 fileReference: location.fileReference,
@@ -283,7 +283,7 @@ function getInputLocation(location) {
         }
     }
 
-    if (location instanceof types.FileLocationToBeDeprecated) {
+    if (location instanceof constructors.FileLocationToBeDeprecated) {
         throw new Error('Unavailable location cannot be used as input')
     }
     _raiseCastFail(location, 'InputFileLocation')
@@ -316,9 +316,9 @@ function getPeer(peer) {
         if (typeof peer === 'number') {
             const res = resolveId(peer)
 
-            if (res[1] === types.PeerChannel) {
+            if (res[1] === constructors.PeerChannel) {
                 return new res[1]({ channelId: res[0] })
-            } else if (res[1] === types.PeerChat) {
+            } else if (res[1] === constructors.PeerChat) {
                 return new res[1]({ chatId: res[0] })
             } else {
                 return new res[1]({ userId: res[0] })
@@ -329,25 +329,25 @@ function getPeer(peer) {
         }
         if (peer.SUBCLASS_OF_ID === 0x2d45687) {
             return peer
-        } else if (peer instanceof types.contacts.ResolvedPeer ||
-            peer instanceof types.InputNotifyPeer || peer instanceof types.TopPeer ||
-            peer instanceof types.Dialog || peer instanceof types.DialogPeer) {
+        } else if (peer instanceof constructors.contacts.ResolvedPeer ||
+            peer instanceof constructors.InputNotifyPeer || peer instanceof constructors.TopPeer ||
+            peer instanceof constructors.Dialog || peer instanceof constructors.DialogPeer) {
             return peer.peer
-        } else if (peer instanceof types.ChannelFull) {
-            return new types.PeerChannel({ channelId: peer.id })
+        } else if (peer instanceof constructors.ChannelFull) {
+            return new constructors.PeerChannel({ channelId: peer.id })
         }
         if (peer.SUBCLASS_OF_ID === 0x7d7c6f86 || peer.SUBCLASS_OF_ID === 0xd9c7fc18) {
             // ChatParticipant, ChannelParticipant
-            return new types.PeerUser({ userId: peer.userId })
+            return new constructors.PeerUser({ userId: peer.userId })
         }
         peer = getInputPeer(peer, false, false)
 
-        if (peer instanceof types.InputPeerUser) {
-            return new types.PeerUser({ userId: peer.userId })
-        } else if (peer instanceof types.InputPeerChat) {
-            return new types.PeerChat({ chatId: peer.chatId })
-        } else if (peer instanceof types.InputPeerChannel) {
-            return new types.PeerChannel({ channelId: peer.channelId })
+        if (peer instanceof constructors.InputPeerUser) {
+            return new constructors.PeerUser({ userId: peer.userId })
+        } else if (peer instanceof constructors.InputPeerChat) {
+            return new constructors.PeerChat({ chatId: peer.chatId })
+        } else if (peer instanceof constructors.InputPeerChannel) {
+            return new constructors.PeerChannel({ channelId: peer.channelId })
         }
         // eslint-disable-next-line no-empty
     } catch (e) {
@@ -380,7 +380,7 @@ function getPeerId(peer, addMark = true) {
     }
 
     // Tell the user to use their client to resolve InputPeerSelf if we got one
-    if (peer instanceof types.InputPeerSelf) {
+    if (peer instanceof constructors.InputPeerSelf) {
         _raiseCastFail(peer, 'int (you might want to use client.get_peer_id)')
     }
 
@@ -389,16 +389,16 @@ function getPeerId(peer, addMark = true) {
     } catch (e) {
         _raiseCastFail(peer, 'int')
     }
-    if (peer instanceof types.PeerUser) {
+    if (peer instanceof constructors.PeerUser) {
         return peer.userId
-    } else if (peer instanceof types.PeerChat) {
+    } else if (peer instanceof constructors.PeerChat) {
         // Check in case the user mixed things up to avoid blowing up
         if (!(0 < peer.chatId <= 0x7fffffff)) {
             peer.chatId = resolveId(peer.chatId)[0]
         }
 
         return addMark ? -(peer.chatId) : peer.chatId
-    } else { // if (peer instanceof types.PeerChannel)
+    } else { // if (peer instanceof constructors.PeerChannel)
         // Check in case the user mixed things up to avoid blowing up
         if (!(0 < peer.channelId <= 0x7fffffff)) {
             peer.channelId = resolveId(peer.channelId)[0]
@@ -422,7 +422,7 @@ function getPeerId(peer, addMark = true) {
  */
 function resolveId(markedId) {
     if (markedId >= 0) {
-        return [markedId, types.PeerUser]
+        return [markedId, constructors.PeerUser]
     }
 
     // There have been report of chat IDs being 10000xyz, which means their
@@ -431,9 +431,9 @@ function resolveId(markedId) {
     // two zeroes.
     const m = markedId.toString().match(/-100([^0]\d*)/)
     if (m) {
-        return [parseInt(m[1]), types.PeerChannel]
+        return [parseInt(m[1]), constructors.PeerChannel]
     }
-    return [-markedId, types.PeerChat]
+    return [-markedId, constructors.PeerChat]
 }
 
 /**
@@ -527,7 +527,7 @@ function rtrim(s, mask) {
  * @param entity
  */
 function getDisplayName(entity) {
-    if (entity instanceof types.User) {
+    if (entity instanceof constructors.User) {
         if (entity.lastName && entity.firstName) {
             return `${entity.firstName} ${entity.lastName}`
         } else if (entity.firstName) {
@@ -537,7 +537,7 @@ function getDisplayName(entity) {
         } else {
             return ''
         }
-    } else if (entity instanceof types.Chat || entity instanceof types.Channel) {
+    } else if (entity instanceof constructors.Chat || entity instanceof constructors.Channel) {
         return entity.title
     }
     return ''

+ 11 - 0
src/lib/gramjs/client/TelegramClient.d.ts

@@ -0,0 +1,11 @@
+import { GramJsApi } from '..';
+
+declare class TelegramClient {
+    constructor(...args: any)
+
+    async invoke<I extends InstanceType<GramJsApi.AnyRequest>>(request: I): Promise<I['__response']>;
+
+    [prop: string]: any;
+}
+
+export default TelegramClient;

+ 99 - 84
src/lib/gramjs/client/TelegramClient.js

@@ -5,16 +5,14 @@ const MemorySession = require('../sessions/Memory')
 const { addKey } = require('../crypto/RSA')
 const Helpers = require('../Helpers')
 const { BinaryWriter } = require('../extensions')
-const { TLRequest } = require('../tl/tlobject')
 const utils = require('../Utils')
 const Session = require('../sessions/Abstract')
-const JSONSession = require('../sessions/JSONSession')
 const os = require('os')
-const { GetConfigRequest } = require('../tl/functions/help')
 const { LAYER } = require('../tl/AllTLObjects')
-const { functions, types } = require('../tl')
+const { constructors, requests } = require('../tl')
 const { computeCheck } = require('../Password')
 const MTProtoSender = require('../network/MTProtoSender')
+const { FloodWaitError } = require("../errors/RPCErrorList")
 const { ConnectionTCPObfuscated } = require('../network/connection/TCPObfuscated')
 
 const DEFAULT_DC_ID = 2
@@ -65,7 +63,7 @@ class TelegramClient {
         // Determine what session we will use
         if (typeof session === 'string' || !session) {
             try {
-                session = JSONSession.tryLoadOrCreateNew(session)
+                throw new Error("not implemented")
             } catch (e) {
                 console.log(e)
                 session = new MemorySession()
@@ -101,9 +99,9 @@ class TelegramClient {
         this._floodWaitedRequests = {}
 
         this._initWith = (x) => {
-            return new functions.InvokeWithLayerRequest({
+            return new requests.InvokeWithLayerRequest({
                 layer: LAYER,
-                query: new functions.InitConnectionRequest({
+                query: new requests.InitConnectionRequest({
                     apiId: this.apiId,
                     deviceModel: args.deviceModel || os.type().toString() || 'Unknown',
                     systemVersion: args.systemVersion || os.release().toString() || '1.0',
@@ -150,7 +148,7 @@ class TelegramClient {
         this.session.authKey = this._sender.authKey
         await this.session.save()
         await this._sender.send(this._initWith(
-            new GetConfigRequest(),
+            new requests.help.GetConfigRequest({}),
         ))
         this._updateLoop()
     }
@@ -162,7 +160,7 @@ class TelegramClient {
             // We don't care about the result we just want to send it every
             // 60 seconds so telegram doesn't stop the connection
             try {
-                this._sender.send(new functions.PingRequest({
+                this._sender.send(new requests.PingRequest({
                     pingId: rnd,
                 }))
             } catch (e) {
@@ -178,7 +176,7 @@ class TelegramClient {
             // TODO Call getDifference instead since it's more relevant
             if (new Date().getTime() - this._lastRequest > 30 * 60 * 1000) {
                 try {
-                    await this.invoke(new functions.updates.GetStateRequest())
+                    await this.invoke(new requests.updates.GetStateRequest())
                 } catch (e) {
                     console.log('err is ', e)
                 }
@@ -253,8 +251,8 @@ class TelegramClient {
                 ))
                 if (this.session.dcId !== dcId) {
                     this._log.info(`Exporting authorization for data center ${dc.ipAddress}`)
-                    const auth = await this.invoke(new functions.auth.ExportAuthorizationRequest({ dcId: dcId }))
-                    const req = this._initWith(new functions.auth.ImportAuthorizationRequest({
+                    const auth = await this.invoke(new requests.auth.ExportAuthorizationRequest({ dcId: dcId }))
+                    const req = this._initWith(new requests.auth.ImportAuthorizationRequest({
                             id: auth.id, bytes: auth.bytes,
                         },
                     ))
@@ -276,7 +274,7 @@ class TelegramClient {
 
     /**
      * Complete flow to download a file.
-     * @param inputLocation {types.InputFileLocation}
+     * @param inputLocation {constructors.InputFileLocation}
      * @param [args[partSizeKb] {number}]
      * @param [args[fileSize] {number}]
      * @param [args[progressCallback] {Function}]
@@ -312,7 +310,7 @@ class TelegramClient {
             try {
                 sender = await this._borrowExportedSender(dcId)
             } catch (e) {
-                if (e instanceof errors.DcIdInvalidError) {
+                if (e.message==='DC_ID_INVALID') {
                     // Can't export a sender for the ID we are currently in
                     sender = this._sender
                     exported = false
@@ -332,12 +330,12 @@ class TelegramClient {
             while (true) {
                 let result
                 try {
-                    result = await sender.send(new functions.upload.GetFileRequest({
+                    result = await sender.send(new requests.upload.GetFileRequest({
                         location: res.inputLocation,
                         offset: offset,
                         limit: partSize,
                     }))
-                    if (result instanceof types.upload.FileCdnRedirect) {
+                    if (result instanceof constructors.upload.FileCdnRedirect) {
                         throw new Error('not implemented')
                     }
                 } catch (e) {
@@ -378,7 +376,7 @@ class TelegramClient {
     }) {
         let date
         let media
-        if (message instanceof types.Message) {
+        if (message instanceof constructors.Message) {
             date = message.date
             media = message.media
         } else {
@@ -389,11 +387,12 @@ class TelegramClient {
             throw new Error('not implemented')
         }
 
-        if (media instanceof types.MessageMediaWebPage) {
-            if (media.webpage instanceof types.WebPage) {
+        if (media instanceof constructors.MessageMediaWebPage) {
+            if (media.webpage instanceof constructors.WebPage) {
                 media = media.webpage.document || media.webpage.photo
             }
         }
+<<<<<<< HEAD
         if (media instanceof types.MessageMediaPhoto || media instanceof types.Photo) {
 <<<<<<< HEAD
             return await this._downloadPhoto(media, saveToMemory, date, args.thumb, args.progressCallback)
@@ -404,12 +403,15 @@ class TelegramClient {
         } else if ((media instanceof types.WebDocument || media instanceof types.WebDocumentNoProxy) && args.thumb == null) {
             return await this._downloadWebDocument(media, saveToMemory, args.progressCallback)
 =======
+=======
+        if (media instanceof constructors.MessageMediaPhoto || media instanceof constructors.Photo) {
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
             return this._downloadPhoto(media, args)
-        } else if (media instanceof types.MessageMediaDocument || media instanceof types.Document) {
+        } else if (media instanceof constructors.MessageMediaDocument || media instanceof constructors.Document) {
             return this._downloadDocument(media, args, media.dcId)
-        } else if (media instanceof types.MessageMediaContact) {
+        } else if (media instanceof constructors.MessageMediaContact) {
             return this._downloadContact(media, args)
-        } else if (media instanceof types.WebDocument || media instanceof types.WebDocumentNoProxy) {
+        } else if (media instanceof constructors.WebDocument || media instanceof constructors.WebDocumentNoProxy) {
             return this._downloadWebDocument(media, args)
 >>>>>>> dda7e47e... Fix images loading; Various Gram JS fixes; Refactor Gram JS Logger
         }
@@ -445,11 +447,11 @@ class TelegramClient {
         }
         let dcId
         let loc
-        if (photo instanceof types.UserProfilePhoto || photo instanceof types.ChatPhoto) {
+        if (photo instanceof constructors.UserProfilePhoto || photo instanceof constructors.ChatPhoto) {
             console.log('i am ere')
             dcId = photo.dcId
             const size = isBig ? photo.photoBig : photo.photoSmall
-            loc = new types.InputPeerPhotoFileLocation({
+            loc = new constructors.InputPeerPhotoFileLocation({
                 peer: await this.getInputEntity(entity),
                 localId: size.localId,
                 volumeId: size.volumeId,
@@ -472,10 +474,10 @@ class TelegramClient {
             })
             return result
         } catch (e) {
-            if (e instanceof errors.LocationInvalidError) {
+            if (e.message==='LOCATION_INVALID') {
                 const ie = await this.getInputEntity(entity)
-                if (ie instanceof types.InputPeerChannel) {
-                    const full = await this.invoke(new functions.channels.GetFullChannelRequest({
+                if (ie instanceof constructors.InputPeerChannel) {
+                    const full = await this.invoke(new requests.channels.GetFullChannelRequest({
                         channel: ie,
                     }))
 <<<<<<< HEAD
@@ -506,7 +508,7 @@ class TelegramClient {
     _downloadCachedPhotoSize(size) {
         // No need to download anything, simply write the bytes
         let data
-        if (size instanceof types.PhotoStrippedSize) {
+        if (size instanceof constructors.PhotoStrippedSize) {
             data = utils.strippedPhotoToJpg(size.bytes)
         } else {
             data = size.bytes
@@ -515,17 +517,18 @@ class TelegramClient {
     }
 
     async _downloadPhoto(photo, args) {
-        if (photo instanceof types.MessageMediaPhoto) {
+        if (photo instanceof constructors.MessageMediaPhoto) {
             photo = photo.photo
         }
-        if (!(photo instanceof types.Photo)) {
+        if (!(photo instanceof constructors.Photo)) {
             return
         }
         const size = this._pickFileSize(photo.sizes, args.sizeType)
-        if (!size || (size instanceof types.PhotoSizeEmpty)) {
+        if (!size || (size instanceof constructors.PhotoSizeEmpty)) {
             return
         }
 
+<<<<<<< HEAD
 
         if (size instanceof types.PhotoCachedSize || size instanceof types.PhotoStrippedSize) {
             return this._downloadCachedPhotoSize(size)
@@ -533,6 +536,14 @@ class TelegramClient {
 
         const result = await this.downloadFile(
             new types.InputPhotoFileLocation({
+=======
+        if (size instanceof constructors.PhotoCachedSize || size instanceof constructors.PhotoStrippedSize) {
+            return this._downloadCachedPhotoSize(size)
+        }
+
+        return this.downloadFile(
+            new constructors.InputPhotoFileLocation({
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
                 id: photo.id,
                 accessHash: photo.accessHash,
                 fileReference: photo.fileReference,
@@ -553,19 +564,19 @@ class TelegramClient {
             doc = document.document
 =======
     async _downloadDocument(media, args) {
-        if (!(media instanceof types.MessageMediaDocument)) {
+        if (!(media instanceof constructors.MessageMediaDocument)) {
             return
 >>>>>>> dda7e47e... Fix images loading; Various Gram JS fixes; Refactor Gram JS Logger
         }
 
         const doc = media.document
 
-        if (!(doc instanceof types.Document)) {
+        if (!(doc instanceof constructors.Document)) {
             return
         }
 
         const size = doc.thumbs ? this._pickFileSize(doc.thumbs, args.sizeType) : null;
-        if (size && (size instanceof types.PhotoCachedSize || size instanceof types.PhotoStrippedSize)) {
+        if (size && (size instanceof constructors.PhotoCachedSize || size instanceof constructors.PhotoStrippedSize)) {
             return this._downloadCachedPhotoSize(size)
         }
 <<<<<<< HEAD
@@ -573,8 +584,12 @@ class TelegramClient {
 =======
 
         return this.downloadFile(
+<<<<<<< HEAD
 >>>>>>> dda7e47e... Fix images loading; Various Gram JS fixes; Refactor Gram JS Logger
             new types.InputDocumentFileLocation({
+=======
+            new constructors.InputDocumentFileLocation({
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
                 id: doc.id,
                 accessHash: doc.accessHash,
                 fileReference: doc.fileReference,
@@ -617,10 +632,10 @@ class TelegramClient {
         // TODO chose based on current connection method
         /*
         if (!this._config) {
-            this._config = await this.invoke(new functions.help.GetConfigRequest())
+            this._config = await this.invoke(new requests.help.GetConfigRequest())
         }
         if (cdn && !this._cdnConfig) {
-            this._cdnConfig = await this.invoke(new functions.help.GetCdnConfigRequest())
+            this._cdnConfig = await this.invoke(new requests.help.GetCdnConfigRequest())
             for (const pk of this._cdnConfig.publicKeys) {
                 addKey(pk.publicKey)
             }
@@ -641,7 +656,7 @@ class TelegramClient {
      * @returns {Promise}
      */
     async invoke(request) {
-        if (!(request instanceof TLRequest)) {
+        if (request.classType !== 'request') {
             throw new Error('You can only invoke MTProtoRequests')
         }
         await request.resolve(this, utils)
@@ -656,7 +671,7 @@ class TelegramClient {
                 await sleep(diff)
                 delete this._floodWaitedRequests[request.CONSTRUCTOR_ID]
             } else {
-                throw new errors.FloodWaitError({
+                throw new FloodWaitError({
                     request: request,
                     capture: diff,
                 })
@@ -666,17 +681,14 @@ class TelegramClient {
         let attempt = 0
         for (attempt = 0; attempt < this._requestRetries; attempt++) {
             try {
-                console.log("invoking",request)
-
                 const promise = this._sender.send(request)
                 const result = await promise
-                console.log("got answer",promise)
                 this.session.processEntities(result)
                 this._entityCache.add(result)
                 return result
             } catch (e) {
-                if (e instanceof errors.ServerError || e instanceof errors.RpcCallFailError ||
-                    e instanceof errors.RpcMcgetFailError) {
+                if (e instanceof errors.ServerError || e.message==='RPC_CALL_FAIL' ||
+                    e.message==='RPC_MCGET_FAIL') {
                     this._log.warn(`Telegram is having internal issues ${e.constructor.name}`)
                     await sleep(2000)
                 } else if (e instanceof errors.FloodWaitError || e instanceof errors.FloodTestPhoneWaitError) {
@@ -704,8 +716,8 @@ class TelegramClient {
     }
 
     async getMe() {
-        const me = (await this.invoke(new functions.users
-            .GetUsersRequest({ id: [new types.InputUserSelf()] })))[0]
+        const me = (await this.invoke(new requests.users
+            .GetUsersRequest({ id: [new constructors.InputUserSelf()] })))[0]
         return me
     }
 
@@ -763,9 +775,7 @@ class TelegramClient {
             try {
                 const value = await args.code()
                 if (!value) {
-                    throw new errors.PhoneCodeEmptyError({
-                        request: null,
-                    })
+                    throw new Error("the phone code is empty")
                 }
 
                 if (signUp) {
@@ -783,17 +793,17 @@ class TelegramClient {
                 }
                 break
             } catch (e) {
-                if (e instanceof errors.SessionPasswordNeededError) {
+                if (e.message==='SESSION_PASSWORD_NEEDED') {
                     twoStepDetected = true
                     break
-                } else if (e instanceof errors.PhoneNumberOccupiedError) {
+                } else if (e.message==='PHONE_NUMBER_OCCUPIED') {
                     signUp = true
-                } else if (e instanceof errors.PhoneNumberUnoccupiedError) {
+                } else if (e.message==='PHONE_NUMBER_UNOCCUPIED') {
                     signUp = true
-                } else if (e instanceof errors.PhoneCodeEmptyError ||
-                    e instanceof errors.PhoneCodeExpiredError ||
-                    e instanceof errors.PhoneCodeHashEmptyError ||
-                    e instanceof errors.PhoneCodeInvalidError) {
+                } else if (e.message==='PHONE_CODE_EMPTY' ||
+                    e.message==='PHONE_CODE_EXPIRED' ||
+                    e.message==='PHONE_CODE_HASH_EMPTY' ||
+                    e.message==='PHONE_CODE_INVALID') {
                     console.log('Invalid code. Please try again.')
                 } else {
                     throw e
@@ -854,7 +864,7 @@ class TelegramClient {
                 this._parsePhoneAndHash(args.phone, args.phoneCodeHash)
             // May raise PhoneCodeEmptyError, PhoneCodeExpiredError,
             // PhoneCodeHashEmptyError or PhoneCodeInvalidError.
-            result = await this.invoke(new functions.auth.SignInRequest({
+            result = await this.invoke(new requests.auth.SignInRequest({
                 phoneNumber: phone,
                 phoneCodeHash: phoneCodeHash,
                 phoneCode: args.code.toString(),
@@ -862,8 +872,8 @@ class TelegramClient {
         } else if (args.password) {
             for (let i = 0; i < 5; i++) {
                 try {
-                    const pwd = await this.invoke(new functions.account.GetPasswordRequest())
-                    result = await this.invoke(new functions.auth.CheckPasswordRequest({
+                    const pwd = await this.invoke(new requests.account.GetPasswordRequest())
+                    result = await this.invoke(new requests.auth.CheckPasswordRequest({
                         password: computeCheck(pwd, args.password),
                     }))
                     break
@@ -872,7 +882,7 @@ class TelegramClient {
                 }
             }
         } else if (args.botToken) {
-            result = await this.invoke(new functions.auth.ImportBotAuthorizationRequest(
+            result = await this.invoke(new requests.auth.ImportBotAuthorizationRequest(
                 {
                     flags: 0,
                     botAuthToken: args.botToken,
@@ -905,7 +915,7 @@ class TelegramClient {
     async isUserAuthorized() {
         if (this._authorized === undefined || this._authorized === null) {
             try {
-                await this.invoke(new functions.updates.GetStateRequest())
+                await this.invoke(new requests.updates.GetStateRequest())
                 this._authorized = true
             } catch (e) {
                 this._authorized = false
@@ -933,21 +943,26 @@ class TelegramClient {
 
         if (!phoneHash) {
             try {
-                result = await this.invoke(new functions.auth.SendCodeRequest({
+                result = await this.invoke(new requests.auth.SendCodeRequest({
                     phoneNumber: phone,
                     apiId: this.apiId,
                     apiHash: this.apiHash,
-                    settings: new types.CodeSettings(),
+                    settings: new constructors.CodeSettings(),
                 }))
             } catch (e) {
+<<<<<<< HEAD
                 if (e instanceof errors.AuthRestartError) {
                     return await this.sendCodeRequest(phone, forceSMS)
+=======
+                if (e.message==='AUTH_RESTART') {
+                    return this.sendCodeRequest(phone, forceSMS)
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
                 }
                 throw e
             }
 
             // If we already sent a SMS, do not resend the code (hash may be empty)
-            if (result.type instanceof types.auth.SentCodeTypeSms) {
+            if (result.type instanceof constructors.auth.SentCodeTypeSms) {
                 forceSMS = false
             }
             if (result.phoneCodeHash) {
@@ -958,7 +973,7 @@ class TelegramClient {
         }
         this._phone = phone
         if (forceSMS) {
-            result = await this.invoke(new functions.auth.ResendCodeRequest({
+            result = await this.invoke(new requests.auth.ResendCodeRequest({
                 phone: phone,
                 phoneHash: phoneHash,
             }))
@@ -978,7 +993,7 @@ class TelegramClient {
         this.session.processEntities(update)
         this._entityCache.add(update)
 
-        if (update instanceof types.Updates || update instanceof types.UpdatesCombined) {
+        if (update instanceof constructors.Updates || update instanceof constructors.UpdatesCombined) {
             // TODO deal with entities
             const entities = {}
             for (const x of [...update.users, ...update.chats]) {
@@ -987,7 +1002,7 @@ class TelegramClient {
             for (const u of update.updates) {
                 this._processUpdate(u, update.updates, entities)
             }
-        } else if (update instanceof types.UpdateShort) {
+        } else if (update instanceof constructors.UpdateShort) {
             this._processUpdate(update.update, null)
         } else {
             this._processUpdate(update, null)
@@ -1029,13 +1044,13 @@ class TelegramClient {
         if (phone) {
             try {
                 for (const user of (await this.invoke(
-                    new functions.contacts.GetContactsRequest(0))).users) {
+                    new requests.contacts.GetContactsRequest(0))).users) {
                     if (user.phone === phone) {
                         return user
                     }
                 }
             } catch (e) {
-                if (e instanceof errors.BotMethodInvalidError) {
+                if (e.message==='BOT_METHOD_INVALID') {
                     throw new Error('Cannot get entity by phone number as a ' +
                         'bot (try using integer IDs, not strings)')
                 }
@@ -1051,22 +1066,22 @@ class TelegramClient {
         } else {
             const { username, isJoinChat } = utils.parseUsername(string)
             if (isJoinChat) {
-                const invite = await this.invoke(new functions.messages.CheckChatInviteRequest({
+                const invite = await this.invoke(new requests.messages.CheckChatInviteRequest({
                     'hash': username,
                 }))
-                if (invite instanceof types.ChatInvite) {
+                if (invite instanceof constructors.ChatInvite) {
                     throw new Error('Cannot get entity from a channel (or group) ' +
                         'that you are not part of. Join the group and retry',
                     )
-                } else if (invite instanceof types.ChatInviteAlready) {
+                } else if (invite instanceof constructors.ChatInviteAlready) {
                     return invite.chat
                 }
             } else if (username) {
                 try {
                     const result = await this.invoke(
-                        new functions.contacts.ResolveUsernameRequest(username))
+                        new requests.contacts.ResolveUsernameRequest(username))
                     const pid = utils.getPeerId(result.peer, false)
-                    if (result.peer instanceof types.PeerUser) {
+                    if (result.peer instanceof constructors.PeerUser) {
                         for (const x of result.users) {
                             if (x.id === pid) {
                                 return x
@@ -1080,7 +1095,7 @@ class TelegramClient {
                         }
                     }
                 } catch (e) {
-                    if (e instanceof errors.UsernameNotOccupiedError) {
+                    if (e.message ==='USERNAME_NOT_OCCUPIED') {
                         throw new Error(`No user has "${username}" as username`)
                     }
                     throw e
@@ -1178,7 +1193,7 @@ class TelegramClient {
         }
         // Then come known strings that take precedence
         if (['me', 'this'].includes(peer)) {
-            return new types.InputPeerSelf()
+            return new constructors.InputPeerSelf()
         }
         // No InputPeer, cached peer, or known string. Fetch from disk cache
         try {
@@ -1195,13 +1210,13 @@ class TelegramClient {
         // If we're not a bot but the user is in our contacts, it seems to work
         // regardless. These are the only two special-cased requests.
         peer = utils.getPeer(peer)
-        if (peer instanceof types.PeerUser) {
-            const users = await this.invoke(new functions.users.GetUsersRequest({
-                id: [new types.InputUser({
+        if (peer instanceof constructors.PeerUser) {
+            const users = await this.invoke(new requests.users.GetUsersRequest({
+                id: [new constructors.InputUser({
                     userId: peer.userId, accessHash: 0,
                 })],
             }))
-            if (users && !(users[0] instanceof types.UserEmpty)) {
+            if (users && !(users[0] instanceof constructors.UserEmpty)) {
                 // If the user passed a valid ID they expect to work for
                 // channels but would be valid for users, we get UserEmpty.
                 // Avoid returning the invalid empty input peer for that.
@@ -1211,14 +1226,14 @@ class TelegramClient {
                 // another request, but that becomes too much work.
                 return utils.getInputPeer(users[0])
             }
-        } else if (peer instanceof types.PeerChat) {
-            return new types.InputPeerChat({
+        } else if (peer instanceof constructors.PeerChat) {
+            return new constructors.InputPeerChat({
                 chatId: peer.chatId,
             })
-        } else if (peer instanceof types.PeerChannel) {
+        } else if (peer instanceof constructors.PeerChannel) {
             try {
-                const channels = await this.invoke(new functions.channels.GetChannelsRequest({
-                    id: [new types.InputChannel({
+                const channels = await this.invoke(new requests.channels.GetChannelsRequest({
+                    id: [new constructors.InputChannel({
                         channelId: peer.channelId,
                         accessHash: 0,
                     })],

+ 61 - 0
src/lib/gramjs/crypto/AuthKey.js

@@ -0,0 +1,61 @@
+const { sha1, readBufferFromBigInt, readBigIntFromBuffer } = require('../Helpers')
+const BinaryReader = require('../extensions/BinaryReader')
+const struct = require('python-struct')
+const { sleep } = require("../Helpers")
+
+class AuthKey {
+    constructor(data) {
+        this.key = data
+    }
+
+    set key(value) {
+        if (!value) {
+            this._key = this.auxHash = this.keyId = null
+            return
+        }
+        if (value instanceof AuthKey) {
+            this._key = value._key
+            this.auxHash = value.auxHash
+            this.keyId = value.keyId
+            return
+        }
+        this._key = value
+        const reader = new BinaryReader(sha1(this._key))
+        this.auxHash = reader.readLong(false)
+        reader.read(4)
+        this.keyId = reader.readLong(false)
+    }
+
+    async waitForKey(){
+        while (!this.key){
+            await sleep(20)
+        }
+    }
+
+    get key() {
+        return this._key
+    }
+
+    // TODO : This doesn't really fit here, it's only used in authentication
+
+    /**
+     * Calculates the new nonce hash based on the current class fields' values
+     * @param newNonce
+     * @param number
+     * @returns {bigint}
+     */
+    calcNewNonceHash(newNonce, number) {
+        newNonce = readBufferFromBigInt(newNonce, 32, true, true)
+        const data = Buffer.concat([newNonce, struct.pack('<BQ', number.toString(), this.auxHash.toString())])
+
+        // Calculates the message key from the given data
+        const shaData = sha1(data).slice(4, 20)
+        return readBigIntFromBuffer(shaData, true, true)
+    }
+
+    equals(other) {
+        return other instanceof this.constructor && other.key === this._key
+    }
+}
+
+module.exports = AuthKey

+ 3 - 3
src/lib/gramjs/crypto/RSA.js

@@ -1,5 +1,5 @@
 const NodeRSA = require('node-rsa')
-const { TLObject } = require('../tl/tlobject')
+const { serializeBytes } = require('../tl')
 const { readBigIntFromBuffer, readBufferFromBigInt, getByteArray, sha1, generateRandomBytes, modExp } = require('../Helpers')
 const _serverKeys = {}
 const BigInt = require('big-integer')
@@ -9,8 +9,8 @@ function _computeFingerprint(key) {
     const buf = readBigIntFromBuffer(key.keyPair.n.toBuffer(), false)
     const nArray = getByteArray(buf)
 
-    const n = TLObject.serializeBytes(nArray)
-    const e = TLObject.serializeBytes(getByteArray(key.keyPair.e))
+    const n = serializeBytes(nArray)
+    const e = serializeBytes(getByteArray(key.keyPair.e))
     // Telegram uses the last 8 bytes as the fingerprint
     const sh = sha1(Buffer.concat([ n, e ]))
     return readBigIntFromBuffer(sh.slice(-8), true, true)

+ 6 - 13
src/lib/gramjs/errors/Common.js

@@ -47,7 +47,7 @@ class InvalidBufferError extends Error {
     constructor(payload) {
         let code = null
         if (payload.length === 4) {
-            code = -(struct.unpack('<i', payload)[0])
+            code = -payload.readInt32LE(0)
             super(`Invalid response buffer (HTTP code ${code})`)
         } else {
             super(`Invalid response buffer (too short ${payload})`)
@@ -79,15 +79,6 @@ class CdnFileTamperedError extends SecurityError {
     }
 }
 
-/**
- * Occurs when another exclusive conversation is opened in the same chat.
- */
-class AlreadyInConversationError extends Error {
-    constructor() {
-        super('Cannot open exclusive conversation in a chat that already has one open conversation')
-    }
-}
-
 /**
  * Occurs when handling a badMessageNotification
  */
@@ -132,8 +123,11 @@ class BadMessageError extends Error {
         64: 'Invalid container.',
     }
 
-    constructor(code) {
-        super(BadMessageError.ErrorMessages[code] || `Unknown error code (this should not happen): ${code}.`)
+    constructor(request,code) {
+        let errorMessage = BadMessageError.ErrorMessages[code] ||
+            `Unknown error code (this should not happen): ${code}.`
+        errorMessage+= `  Caused by ${request.className}`
+        super(errorMessage)
         this.code = code
     }
 }
@@ -147,6 +141,5 @@ module.exports = {
     InvalidBufferError,
     SecurityError,
     CdnFileTamperedError,
-    AlreadyInConversationError,
     BadMessageError,
 }

+ 47 - 2884
src/lib/gramjs/errors/RPCErrorList.js

@@ -1,2924 +1,87 @@
-const { RPCError, BadRequestError, UnauthorizedError, AuthKeyError, ServerError, ForbiddenError, InvalidDCError, FloodError, TimedOutError } = require('./RPCBaseErrors');
-const format = require('string-format');
+const { RPCError, InvalidDCError, FloodError } = require('./RPCBaseErrors')
+const format = require('string-format')
 
-class AboutTooLongError extends BadRequestError {
-    constructor(args) {
-        super('The provided bio is too long' + RPCError._fmtRequest(args.request));
-this.message = 'The provided bio is too long' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AccessTokenExpiredError extends BadRequestError {
-    constructor(args) {
-        super('Bot token expired' + RPCError._fmtRequest(args.request));
-this.message = 'Bot token expired' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AccessTokenInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided token is not valid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided token is not valid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ActiveUserRequiredError extends UnauthorizedError {
-    constructor(args) {
-        super('The method is only available to already activated users' + RPCError._fmtRequest(args.request));
-this.message = 'The method is only available to already activated users' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AdminsTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('Too many admins' + RPCError._fmtRequest(args.request));
-this.message = 'Too many admins' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AdminRankEmojiNotAllowedError extends BadRequestError {
-    constructor(args) {
-        super('Emoji are not allowed in admin titles or ranks' + RPCError._fmtRequest(args.request));
-this.message = 'Emoji are not allowed in admin titles or ranks' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AdminRankInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The given admin title or rank was invalid (possibly larger than 16 characters)' + RPCError._fmtRequest(args.request));
-this.message = 'The given admin title or rank was invalid (possibly larger than 16 characters)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ApiIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The api_id/api_hash combination is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The api_id/api_hash combination is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ApiIdPublishedFloodError extends BadRequestError {
-    constructor(args) {
-        super('This API id was published somewhere, you can\'t use it now' + RPCError._fmtRequest(args.request));
-this.message = 'This API id was published somewhere, you can\'t use it now' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ArticleTitleEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The title of the article is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The title of the article is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AuthBytesInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided authorization is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided authorization is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AuthKeyDuplicatedError extends AuthKeyError {
-    constructor(args) {
-        super('The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions' + RPCError._fmtRequest(args.request));
-this.message = 'The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AuthKeyInvalidError extends UnauthorizedError {
-    constructor(args) {
-        super('The key is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The key is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AuthKeyPermEmptyError extends UnauthorizedError {
-    constructor(args) {
-        super('The method is unavailable for temporary authorization key, not bound to permanent' + RPCError._fmtRequest(args.request));
-this.message = 'The method is unavailable for temporary authorization key, not bound to permanent' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AuthKeyUnregisteredError extends UnauthorizedError {
-    constructor(args) {
-        super('The key is not registered in the system' + RPCError._fmtRequest(args.request));
-this.message = 'The key is not registered in the system' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class AuthRestartError extends ServerError {
-    constructor(args) {
-        super('Restart the authorization process' + RPCError._fmtRequest(args.request));
-this.message = 'Restart the authorization process' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BannedRightsInvalidError extends BadRequestError {
-    constructor(args) {
-        super('You cannot use that set of permissions in this request, i.e. restricting view_messages as a default' + RPCError._fmtRequest(args.request));
-this.message = 'You cannot use that set of permissions in this request, i.e. restricting view_messages as a default' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotsTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('There are too many bots in this chat/channel' + RPCError._fmtRequest(args.request));
-this.message = 'There are too many bots in this chat/channel' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotChannelsNaError extends BadRequestError {
-    constructor(args) {
-        super('Bots can\'t edit admin privileges' + RPCError._fmtRequest(args.request));
-this.message = 'Bots can\'t edit admin privileges' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotGroupsBlockedError extends BadRequestError {
-    constructor(args) {
-        super('This bot can\'t be added to groups' + RPCError._fmtRequest(args.request));
-this.message = 'This bot can\'t be added to groups' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotInlineDisabledError extends BadRequestError {
-    constructor(args) {
-        super('This bot can\'t be used in inline mode' + RPCError._fmtRequest(args.request));
-this.message = 'This bot can\'t be used in inline mode' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotInvalidError extends BadRequestError {
-    constructor(args) {
-        super('This is not a valid bot' + RPCError._fmtRequest(args.request));
-this.message = 'This is not a valid bot' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotMethodInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot' + RPCError._fmtRequest(args.request));
-this.message = 'The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotMissingError extends BadRequestError {
-    constructor(args) {
-        super('This method can only be run by a bot' + RPCError._fmtRequest(args.request));
-this.message = 'This method can only be run by a bot' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotPaymentsDisabledError extends BadRequestError {
-    constructor(args) {
-        super('This method can only be run by a bot' + RPCError._fmtRequest(args.request));
-this.message = 'This method can only be run by a bot' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BotPollsDisabledError extends BadRequestError {
-    constructor(args) {
-        super('You cannot create polls under a bot account' + RPCError._fmtRequest(args.request));
-this.message = 'You cannot create polls under a bot account' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class BroadcastIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The channel is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The channel is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ButtonDataInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided button data is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided button data is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ButtonTypeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The type of one of the buttons you provided is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The type of one of the buttons you provided is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ButtonUrlInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Button URL invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Button URL invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CallAlreadyAcceptedError extends BadRequestError {
-    constructor(args) {
-        super('The call was already accepted' + RPCError._fmtRequest(args.request));
-this.message = 'The call was already accepted' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CallAlreadyDeclinedError extends BadRequestError {
-    constructor(args) {
-        super('The call was already declined' + RPCError._fmtRequest(args.request));
-this.message = 'The call was already declined' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CallOccupyFailedError extends ServerError {
-    constructor(args) {
-        super('The call failed because the user is already making another call' + RPCError._fmtRequest(args.request));
-this.message = 'The call failed because the user is already making another call' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CallPeerInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided call peer object is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided call peer object is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CallProtocolFlagsInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Call protocol flags invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Call protocol flags invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CdnMethodInvalidError extends BadRequestError {
-    constructor(args) {
-        super('This method cannot be invoked on a CDN server. Refer to https://core.telegram.org/cdn#schema for available methods' + RPCError._fmtRequest(args.request));
-this.message = 'This method cannot be invoked on a CDN server. Refer to https://core.telegram.org/cdn#schema for available methods' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChannelsAdminPublicTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('You\'re admin of too many public channels, make some channels private to change the username of this channel' + RPCError._fmtRequest(args.request));
-this.message = 'You\'re admin of too many public channels, make some channels private to change the username of this channel' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChannelsTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('You have joined too many channels/supergroups' + RPCError._fmtRequest(args.request));
-this.message = 'You have joined too many channels/supergroups' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChannelInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChannelPrivateError extends BadRequestError {
-    constructor(args) {
-        super('The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it' + RPCError._fmtRequest(args.request));
-this.message = 'The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChannelPublicGroupNaError extends ForbiddenError {
-    constructor(args) {
-        super('channel/supergroup not available' + RPCError._fmtRequest(args.request));
-this.message = 'channel/supergroup not available' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatAboutNotModifiedError extends BadRequestError {
-    constructor(args) {
-        super('About text has not changed' + RPCError._fmtRequest(args.request));
-this.message = 'About text has not changed' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatAboutTooLongError extends BadRequestError {
-    constructor(args) {
-        super('Chat about too long' + RPCError._fmtRequest(args.request));
-this.message = 'Chat about too long' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatAdminInviteRequiredError extends ForbiddenError {
-    constructor(args) {
-        super('You do not have the rights to do this' + RPCError._fmtRequest(args.request));
-this.message = 'You do not have the rights to do this' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatAdminRequiredError extends BadRequestError {
-    constructor(args) {
-        super('Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group' + RPCError._fmtRequest(args.request));
-this.message = 'Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatForbiddenError extends BadRequestError {
-    constructor(args) {
-        super('You cannot write in this chat' + RPCError._fmtRequest(args.request));
-this.message = 'You cannot write in this chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatIdEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The provided chat ID is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The provided chat ID is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The chat is invalid for this request' + RPCError._fmtRequest(args.request));
-this.message = 'The chat is invalid for this request' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatLinkExistsError extends BadRequestError {
-    constructor(args) {
-        super('The chat is linked to a channel and cannot be used in that request' + RPCError._fmtRequest(args.request));
-this.message = 'The chat is linked to a channel and cannot be used in that request' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatNotModifiedError extends BadRequestError {
-    constructor(args) {
-        super('The chat or channel wasn\'t modified (title, invites, username, admins, etc. are the same)' + RPCError._fmtRequest(args.request));
-this.message = 'The chat or channel wasn\'t modified (title, invites, username, admins, etc. are the same)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatRestrictedError extends BadRequestError {
-    constructor(args) {
-        super('The chat is restricted and cannot be used in that request' + RPCError._fmtRequest(args.request));
-this.message = 'The chat is restricted and cannot be used in that request' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatSendGifsForbiddenError extends ForbiddenError {
-    constructor(args) {
-        super('You can\'t send gifs in this chat' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t send gifs in this chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatSendInlineForbiddenError extends BadRequestError {
-    constructor(args) {
-        super('You cannot send inline results in this chat' + RPCError._fmtRequest(args.request));
-this.message = 'You cannot send inline results in this chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatSendMediaForbiddenError extends ForbiddenError {
-    constructor(args) {
-        super('You can\'t send media in this chat' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t send media in this chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatSendStickersForbiddenError extends ForbiddenError {
-    constructor(args) {
-        super('You can\'t send stickers in this chat' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t send stickers in this chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatTitleEmptyError extends BadRequestError {
-    constructor(args) {
-        super('No chat title provided' + RPCError._fmtRequest(args.request));
-this.message = 'No chat title provided' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ChatWriteForbiddenError extends ForbiddenError {
-    constructor(args) {
-        super('You can\'t write in this chat' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t write in this chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CodeEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The provided code is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The provided code is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CodeHashInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Code hash invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Code hash invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class CodeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Code invalid (i.e. from email)' + RPCError._fmtRequest(args.request));
-this.message = 'Code invalid (i.e. from email)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ConnectionApiIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided API id is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided API id is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ConnectionDeviceModelEmptyError extends BadRequestError {
-    constructor(args) {
-        super('Device model empty' + RPCError._fmtRequest(args.request));
-this.message = 'Device model empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ConnectionLangPackInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The specified language pack is not valid. This is meant to be used by official applications only so far, leave it empty' + RPCError._fmtRequest(args.request));
-this.message = 'The specified language pack is not valid. This is meant to be used by official applications only so far, leave it empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ConnectionLayerInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The very first request must always be InvokeWithLayerRequest' + RPCError._fmtRequest(args.request));
-this.message = 'The very first request must always be InvokeWithLayerRequest' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ConnectionNotInitedError extends BadRequestError {
-    constructor(args) {
-        super('Connection not initialized' + RPCError._fmtRequest(args.request));
-this.message = 'Connection not initialized' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ConnectionSystemEmptyError extends BadRequestError {
-    constructor(args) {
-        super('Connection system empty' + RPCError._fmtRequest(args.request));
-this.message = 'Connection system empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ContactIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided contact ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided contact ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class DataInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Encrypted data invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Encrypted data invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class DataJsonInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided JSON data is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided JSON data is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class DateEmptyError extends BadRequestError {
-    constructor(args) {
-        super('Date empty' + RPCError._fmtRequest(args.request));
-this.message = 'Date empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class DcIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('This occurs when an authorization is tried to be exported for the same data center one is currently connected to' + RPCError._fmtRequest(args.request));
-this.message = 'This occurs when an authorization is tried to be exported for the same data center one is currently connected to' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class DhGAInvalidError extends BadRequestError {
-    constructor(args) {
-        super('g_a invalid' + RPCError._fmtRequest(args.request));
-this.message = 'g_a invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EmailHashExpiredError extends BadRequestError {
-    constructor(args) {
-        super('The email hash expired and cannot be used to verify it' + RPCError._fmtRequest(args.request));
-this.message = 'The email hash expired and cannot be used to verify it' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EmailInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The given email is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The given email is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EmailUnconfirmedError extends BadRequestError {
-    constructor(args) {
-        const codeLength = Number(args.capture || 0);
-        super(format('Email unconfirmed, the length of the code must be {code_length}', {codeLength}) + RPCError._fmtRequest(args.request));
-this.message = format('Email unconfirmed, the length of the code must be {code_length}', {codeLength}) + RPCError._fmtRequest(args.request);
-        this.codeLength = codeLength;
-    }
-}
-
-
-class EmoticonEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The emoticon field cannot be empty' + RPCError._fmtRequest(args.request));
-this.message = 'The emoticon field cannot be empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EncryptedMessageInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Encrypted message invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Encrypted message invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EncryptionAlreadyAcceptedError extends BadRequestError {
-    constructor(args) {
-        super('Secret chat already accepted' + RPCError._fmtRequest(args.request));
-this.message = 'Secret chat already accepted' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EncryptionAlreadyDeclinedError extends BadRequestError {
-    constructor(args) {
-        super('The secret chat was already declined' + RPCError._fmtRequest(args.request));
-this.message = 'The secret chat was already declined' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EncryptionDeclinedError extends BadRequestError {
-    constructor(args) {
-        super('The secret chat was declined' + RPCError._fmtRequest(args.request));
-this.message = 'The secret chat was declined' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EncryptionIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided secret chat ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided secret chat ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EncryptionOccupyFailedError extends ServerError {
-    constructor(args) {
-        super('TDLib developer claimed it is not an error while accepting secret chats and 500 is used instead of 420' + RPCError._fmtRequest(args.request));
-this.message = 'TDLib developer claimed it is not an error while accepting secret chats and 500 is used instead of 420' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EntitiesTooLongError extends BadRequestError {
-    constructor(args) {
-        super('It is no longer possible to send such long data inside entity tags (for example inline text URLs)' + RPCError._fmtRequest(args.request));
-this.message = 'It is no longer possible to send such long data inside entity tags (for example inline text URLs)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class EntityMentionUserInvalidError extends BadRequestError {
-    constructor(args) {
-        super('You can\'t use this entity' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t use this entity' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ErrorTextEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The provided error message is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The provided error message is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ExportCardInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Provided card is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Provided card is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ExternalUrlInvalidError extends BadRequestError {
-    constructor(args) {
-        super('External URL invalid' + RPCError._fmtRequest(args.request));
-this.message = 'External URL invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FieldNameEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The field with the name FIELD_NAME is missing' + RPCError._fmtRequest(args.request));
-this.message = 'The field with the name FIELD_NAME is missing' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FieldNameInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The field with the name FIELD_NAME is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The field with the name FIELD_NAME is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FileIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided file id is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided file id is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FileMigrateError extends InvalidDCError {
-    constructor(args) {
-        const newDc = Number(args.capture || 0);
-        super(format('The file to be accessed is currently stored in DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
-this.message = format('The file to be accessed is currently stored in DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
-        this.newDc = newDc;
-    }
-}
-
-
-class FilePartsInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The number of file parts is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The number of file parts is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FilePart0MissingError extends BadRequestError {
-    constructor(args) {
-        super('File part 0 missing' + RPCError._fmtRequest(args.request));
-this.message = 'File part 0 missing' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FilePartEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The provided file part is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The provided file part is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FilePartInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The file part number is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The file part number is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FilePartLengthInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The length of a file part is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The length of a file part is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FilePartSizeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided file part size is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided file part size is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FilePartMissingError extends BadRequestError {
-    constructor(args) {
-        const which = Number(args.capture || 0);
-        super(format('Part {which} of the file is missing from storage', {which}) + RPCError._fmtRequest(args.request));
-this.message = format('Part {which} of the file is missing from storage', {which}) + RPCError._fmtRequest(args.request);
-        this.which = which;
-    }
-}
-
-
-class FilerefUpgradeNeededError extends AuthKeyError {
-    constructor(args) {
-        super('The file reference needs to be refreshed before being used again' + RPCError._fmtRequest(args.request));
-this.message = 'The file reference needs to be refreshed before being used again' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FirstNameInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The first name is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The first name is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FloodTestPhoneWaitError extends FloodError {
-    constructor(args) {
-        const seconds = Number(args.capture || 0);
-        super(format('A wait of {seconds} seconds is required in the test servers', {seconds}) + RPCError._fmtRequest(args.request));
-this.message = format('A wait of {seconds} seconds is required in the test servers', {seconds}) + RPCError._fmtRequest(args.request);
-        this.seconds = seconds;
-    }
-}
-
-
-class FloodWaitError extends FloodError {
-    constructor(args) {
-        const seconds = Number(args.capture || 0);
-        super(format('A wait of {seconds} seconds is required', {seconds}) + RPCError._fmtRequest(args.request));
-this.message = format('A wait of {seconds} seconds is required', {seconds}) + RPCError._fmtRequest(args.request);
-        this.seconds = seconds;
-    }
-}
-
-
-class FolderIdEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The folder you tried to delete was already empty' + RPCError._fmtRequest(args.request));
-this.message = 'The folder you tried to delete was already empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FolderIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The folder you tried to use was not valid' + RPCError._fmtRequest(args.request));
-this.message = 'The folder you tried to use was not valid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class FreshResetAuthorisationForbiddenError extends AuthKeyError {
-    constructor(args) {
-        super('The current session is too new and cannot be used to reset other authorisations yet' + RPCError._fmtRequest(args.request));
-this.message = 'The current session is too new and cannot be used to reset other authorisations yet' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class GifIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided GIF ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided GIF ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class GroupedMediaInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Invalid grouped media' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid grouped media' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class HashInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided hash is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided hash is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class HistoryGetFailedError extends ServerError {
-    constructor(args) {
-        super('Fetching of history failed' + RPCError._fmtRequest(args.request));
-this.message = 'Fetching of history failed' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ImageProcessFailedError extends BadRequestError {
-    constructor(args) {
-        super('Failure while processing image' + RPCError._fmtRequest(args.request));
-this.message = 'Failure while processing image' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InlineResultExpiredError extends BadRequestError {
-    constructor(args) {
-        super('The inline query expired' + RPCError._fmtRequest(args.request));
-this.message = 'The inline query expired' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputConstructorInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided constructor is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided constructor is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputFetchErrorError extends BadRequestError {
-    constructor(args) {
-        super('An error occurred while deserializing TL parameters' + RPCError._fmtRequest(args.request));
-this.message = 'An error occurred while deserializing TL parameters' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputFetchFailError extends BadRequestError {
-    constructor(args) {
-        super('Failed deserializing TL payload' + RPCError._fmtRequest(args.request));
-this.message = 'Failed deserializing TL payload' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputLayerInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided layer is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided layer is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputMethodInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The invoked method does not exist anymore or has never existed' + RPCError._fmtRequest(args.request));
-this.message = 'The invoked method does not exist anymore or has never existed' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputRequestTooLongError extends BadRequestError {
-    constructor(args) {
-        super('The input request was too long. This may be a bug in the library as it can occur when serializing more bytes than it should (like appending the vector constructor code at the end of a message)' + RPCError._fmtRequest(args.request));
-this.message = 'The input request was too long. This may be a bug in the library as it can occur when serializing more bytes than it should (like appending the vector constructor code at the end of a message)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InputUserDeactivatedError extends BadRequestError {
-    constructor(args) {
-        super('The specified user was deleted' + RPCError._fmtRequest(args.request));
-this.message = 'The specified user was deleted' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InterdcCallErrorError extends BadRequestError {
-    constructor(args) {
-        const dc = Number(args.capture || 0);
-        super(format('An error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request));
-this.message = format('An error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request);
-        this.dc = dc;
-    }
-}
-
-
-class InterdcCallRichErrorError extends BadRequestError {
-    constructor(args) {
-        const dc = Number(args.capture || 0);
-        super(format('A rich error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request));
-this.message = format('A rich error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request);
-        this.dc = dc;
-    }
-}
-
-
-class InviteHashEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The invite hash is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The invite hash is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InviteHashExpiredError extends BadRequestError {
-    constructor(args) {
-        super('The chat the user tried to join has expired and is not valid anymore' + RPCError._fmtRequest(args.request));
-this.message = 'The chat the user tried to join has expired and is not valid anymore' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class InviteHashInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The invite hash is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The invite hash is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class LangPackInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided language pack is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided language pack is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class LastnameInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The last name is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The last name is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class LimitInvalidError extends BadRequestError {
-    constructor(args) {
-        super('An invalid limit was provided. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request));
-this.message = 'An invalid limit was provided. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class LinkNotModifiedError extends BadRequestError {
-    constructor(args) {
-        super('The channel is already linked to this group' + RPCError._fmtRequest(args.request));
-this.message = 'The channel is already linked to this group' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class LocationInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The location given for a file was invalid. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request));
-this.message = 'The location given for a file was invalid. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MaxIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided max ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided max ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MaxQtsInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided QTS were invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided QTS were invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class Md5ChecksumInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The MD5 check-sums do not match' + RPCError._fmtRequest(args.request));
-this.message = 'The MD5 check-sums do not match' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MediaCaptionTooLongError extends BadRequestError {
-    constructor(args) {
-        super('The caption is too long' + RPCError._fmtRequest(args.request));
-this.message = 'The caption is too long' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MediaEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The provided media object is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided media object is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MediaInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Media invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Media invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MediaNewInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The new media to edit the message with is invalid (such as stickers or voice notes)' + RPCError._fmtRequest(args.request));
-this.message = 'The new media to edit the message with is invalid (such as stickers or voice notes)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MediaPrevInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The old media cannot be edited with anything else (such as stickers or voice notes)' + RPCError._fmtRequest(args.request));
-this.message = 'The old media cannot be edited with anything else (such as stickers or voice notes)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MegagroupIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The group is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The group is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MegagroupPrehistoryHiddenError extends BadRequestError {
-    constructor(args) {
-        super('You can\'t set this discussion group because it\'s history is hidden' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t set this discussion group because it\'s history is hidden' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MemberNoLocationError extends ServerError {
-    constructor(args) {
-        super('An internal failure occurred while fetching user info (couldn\'t find location)' + RPCError._fmtRequest(args.request));
-this.message = 'An internal failure occurred while fetching user info (couldn\'t find location)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MemberOccupyPrimaryLocFailedError extends ServerError {
-    constructor(args) {
-        super('Occupation of primary member location failed' + RPCError._fmtRequest(args.request));
-this.message = 'Occupation of primary member location failed' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageAuthorRequiredError extends ForbiddenError {
-    constructor(args) {
-        super('Message author required' + RPCError._fmtRequest(args.request));
-this.message = 'Message author required' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageDeleteForbiddenError extends ForbiddenError {
-    constructor(args) {
-        super('You can\'t delete one of the messages you tried to delete, most likely because it is a service message.' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t delete one of the messages you tried to delete, most likely because it is a service message.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageEditTimeExpiredError extends BadRequestError {
-    constructor(args) {
-        super('You can\'t edit this message anymore, too much time has passed since its creation.' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t edit this message anymore, too much time has passed since its creation.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageEmptyError extends BadRequestError {
-    constructor(args) {
-        super('Empty or invalid UTF-8 message was sent' + RPCError._fmtRequest(args.request));
-this.message = 'Empty or invalid UTF-8 message was sent' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageIdsEmptyError extends BadRequestError {
-    constructor(args) {
-        super('No message ids were provided' + RPCError._fmtRequest(args.request));
-this.message = 'No message ids were provided' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The specified message ID is invalid or you can\'t do that operation on such message' + RPCError._fmtRequest(args.request));
-this.message = 'The specified message ID is invalid or you can\'t do that operation on such message' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageNotModifiedError extends BadRequestError {
-    constructor(args) {
-        super('Content of the message was not modified' + RPCError._fmtRequest(args.request));
-this.message = 'Content of the message was not modified' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MessageTooLongError extends BadRequestError {
-    constructor(args) {
-        super('Message was too long. Current maximum length is 4096 UTF-8 characters' + RPCError._fmtRequest(args.request));
-this.message = 'Message was too long. Current maximum length is 4096 UTF-8 characters' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MsgWaitFailedError extends BadRequestError {
-    constructor(args) {
-        super('A waiting call returned an error' + RPCError._fmtRequest(args.request));
-this.message = 'A waiting call returned an error' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class MtSendQueueTooLongError extends ServerError {
-    constructor(args) {
-        super('' + RPCError._fmtRequest(args.request));
-this.message = '' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class NeedChatInvalidError extends ServerError {
-    constructor(args) {
-        super('The provided chat is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided chat is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class NeedMemberInvalidError extends ServerError {
-    constructor(args) {
-        super('The provided member is invalid or does not exist (for example a thumb size)' + RPCError._fmtRequest(args.request));
-this.message = 'The provided member is invalid or does not exist (for example a thumb size)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class NetworkMigrateError extends InvalidDCError {
-    constructor(args) {
-        const newDc = Number(args.capture || 0);
-        super(format('The source IP address is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
-this.message = format('The source IP address is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
-        this.newDc = newDc;
-    }
-}
-
-
-class NewSaltInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The new salt is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The new salt is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class NewSettingsInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The new settings are invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The new settings are invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class OffsetInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The given offset was invalid, it must be divisible by 1KB. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request));
-this.message = 'The given offset was invalid, it must be divisible by 1KB. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class OffsetPeerIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided offset peer is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided offset peer is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class OptionsTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('You defined too many options for the poll' + RPCError._fmtRequest(args.request));
-this.message = 'You defined too many options for the poll' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PackShortNameInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Invalid sticker pack name. It must begin with a letter, can\'t contain consecutive underscores and must end in "_by_<bot username>".' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid sticker pack name. It must begin with a letter, can\'t contain consecutive underscores and must end in "_by_<bot username>".' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PackShortNameOccupiedError extends BadRequestError {
-    constructor(args) {
-        super('A stickerpack with this name already exists' + RPCError._fmtRequest(args.request));
-this.message = 'A stickerpack with this name already exists' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ParticipantsTooFewError extends BadRequestError {
-    constructor(args) {
-        super('Not enough participants' + RPCError._fmtRequest(args.request));
-this.message = 'Not enough participants' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ParticipantCallFailedError extends ServerError {
-    constructor(args) {
-        super('Failure while making call' + RPCError._fmtRequest(args.request));
-this.message = 'Failure while making call' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ParticipantVersionOutdatedError extends BadRequestError {
-    constructor(args) {
-        super('The other participant does not use an up to date telegram client with support for calls' + RPCError._fmtRequest(args.request));
-this.message = 'The other participant does not use an up to date telegram client with support for calls' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PasswordEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The provided password is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The provided password is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PasswordHashInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The password (and thus its hash value) you entered is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The password (and thus its hash value) you entered is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PasswordRequiredError extends BadRequestError {
-    constructor(args) {
-        super('The account must have 2-factor authentication enabled (a password) before this method can be used' + RPCError._fmtRequest(args.request));
-this.message = 'The account must have 2-factor authentication enabled (a password) before this method can be used' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PaymentProviderInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The payment provider was not recognised or its token was invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The payment provider was not recognised or its token was invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PeerFloodError extends BadRequestError {
-    constructor(args) {
-        super('Too many requests' + RPCError._fmtRequest(args.request));
-this.message = 'Too many requests' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PeerIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('An invalid Peer was used. Make sure to pass the right peer type' + RPCError._fmtRequest(args.request));
-this.message = 'An invalid Peer was used. Make sure to pass the right peer type' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PeerIdNotSupportedError extends BadRequestError {
-    constructor(args) {
-        super('The provided peer ID is not supported' + RPCError._fmtRequest(args.request));
-this.message = 'The provided peer ID is not supported' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PersistentTimestampEmptyError extends BadRequestError {
-    constructor(args) {
-        super('Persistent timestamp empty' + RPCError._fmtRequest(args.request));
-this.message = 'Persistent timestamp empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PersistentTimestampInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Persistent timestamp invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Persistent timestamp invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PersistentTimestampOutdatedError extends ServerError {
-    constructor(args) {
-        super('Persistent timestamp outdated' + RPCError._fmtRequest(args.request));
-this.message = 'Persistent timestamp outdated' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneCodeEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The phone code is missing' + RPCError._fmtRequest(args.request));
-this.message = 'The phone code is missing' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneCodeExpiredError extends BadRequestError {
-    constructor(args) {
-        super('The confirmation code has expired' + RPCError._fmtRequest(args.request));
-this.message = 'The confirmation code has expired' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneCodeHashEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The phone code hash is missing' + RPCError._fmtRequest(args.request));
-this.message = 'The phone code hash is missing' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneCodeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The phone code entered was invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The phone code entered was invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneMigrateError extends InvalidDCError {
-    constructor(args) {
-        const newDc = Number(args.capture || 0);
-        super(format('The phone number a user is trying to use for authorization is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
-this.message = format('The phone number a user is trying to use for authorization is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
-        this.newDc = newDc;
-    }
-}
-
-
-class PhoneNumberAppSignupForbiddenError extends BadRequestError {
-    constructor(args) {
-        super('' + RPCError._fmtRequest(args.request));
-this.message = '' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneNumberBannedError extends BadRequestError {
-    constructor(args) {
-        super('The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam' + RPCError._fmtRequest(args.request));
-this.message = 'The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneNumberFloodError extends BadRequestError {
-    constructor(args) {
-        super('You asked for the code too many times.' + RPCError._fmtRequest(args.request));
-this.message = 'You asked for the code too many times.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneNumberInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The phone number is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The phone number is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneNumberOccupiedError extends BadRequestError {
-    constructor(args) {
-        super('The phone number is already in use' + RPCError._fmtRequest(args.request));
-this.message = 'The phone number is already in use' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhoneNumberUnoccupiedError extends BadRequestError {
-    constructor(args) {
-        super('The phone number is not yet being used' + RPCError._fmtRequest(args.request));
-this.message = 'The phone number is not yet being used' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhonePasswordFloodError extends AuthKeyError {
-    constructor(args) {
-        super('You have tried logging in too many times' + RPCError._fmtRequest(args.request));
-this.message = 'You have tried logging in too many times' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhonePasswordProtectedError extends BadRequestError {
-    constructor(args) {
-        super('This phone is password protected' + RPCError._fmtRequest(args.request));
-this.message = 'This phone is password protected' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoContentUrlEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The content from the URL used as a photo appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request));
-this.message = 'The content from the URL used as a photo appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoCropSizeSmallError extends BadRequestError {
-    constructor(args) {
-        super('Photo is too small' + RPCError._fmtRequest(args.request));
-this.message = 'Photo is too small' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoExtInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The extension of the photo is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The extension of the photo is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Photo invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Photo invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoInvalidDimensionsError extends BadRequestError {
-    constructor(args) {
-        super('The photo dimensions are invalid (hint: `pip install pillow` for `send_file` to resize images)' + RPCError._fmtRequest(args.request));
-this.message = 'The photo dimensions are invalid (hint: `pip install pillow` for `send_file` to resize images)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoSaveFileInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10MB. Try resizing it locally' + RPCError._fmtRequest(args.request));
-this.message = 'The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10MB. Try resizing it locally' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PhotoThumbUrlEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The URL used as a thumbnail appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request));
-this.message = 'The URL used as a thumbnail appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PinRestrictedError extends BadRequestError {
-    constructor(args) {
-        super('You can\'t pin messages in private chats with other people' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t pin messages in private chats with other people' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PollOptionDuplicateError extends BadRequestError {
-    constructor(args) {
-        super('A duplicate option was sent in the same poll' + RPCError._fmtRequest(args.request));
-this.message = 'A duplicate option was sent in the same poll' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PollUnsupportedError extends BadRequestError {
-    constructor(args) {
-        super('This layer does not support polls in the issued method' + RPCError._fmtRequest(args.request));
-this.message = 'This layer does not support polls in the issued method' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PrivacyKeyInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The privacy key is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The privacy key is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class PtsChangeEmptyError extends ServerError {
-    constructor(args) {
-        super('No PTS change' + RPCError._fmtRequest(args.request));
-this.message = 'No PTS change' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class QueryIdEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The query ID is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The query ID is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class QueryIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The query ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The query ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class QueryTooShortError extends BadRequestError {
-    constructor(args) {
-        super('The query string is too short' + RPCError._fmtRequest(args.request));
-this.message = 'The query string is too short' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RandomIdDuplicateError extends ServerError {
-    constructor(args) {
-        super('You provided a random ID that was already used' + RPCError._fmtRequest(args.request));
-this.message = 'You provided a random ID that was already used' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RandomIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('A provided random ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'A provided random ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RandomLengthInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Random length invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Random length invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RangesInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Invalid range provided' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid range provided' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ReactionEmptyError extends BadRequestError {
-    constructor(args) {
-        super('No reaction provided' + RPCError._fmtRequest(args.request));
-this.message = 'No reaction provided' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ReactionInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Invalid reaction provided (only emoji are allowed)' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid reaction provided (only emoji are allowed)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RegIdGenerateFailedError extends ServerError {
-    constructor(args) {
-        super('Failure while generating registration ID' + RPCError._fmtRequest(args.request));
-this.message = 'Failure while generating registration ID' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ReplyMarkupInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided reply markup is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided reply markup is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ReplyMarkupTooLongError extends BadRequestError {
-    constructor(args) {
-        super('The data embedded in the reply markup buttons was too much' + RPCError._fmtRequest(args.request));
-this.message = 'The data embedded in the reply markup buttons was too much' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ResultIdDuplicateError extends BadRequestError {
-    constructor(args) {
-        super('Duplicated IDs on the sent results. Make sure to use unique IDs.' + RPCError._fmtRequest(args.request));
-this.message = 'Duplicated IDs on the sent results. Make sure to use unique IDs.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ResultTypeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Result type invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Result type invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ResultsTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.' + RPCError._fmtRequest(args.request));
-this.message = 'You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RightForbiddenError extends ForbiddenError {
-    constructor(args) {
-        super('Either your admin rights do not allow you to do this or you passed the wrong rights combination (some rights only apply to channels and vice versa)' + RPCError._fmtRequest(args.request));
-this.message = 'Either your admin rights do not allow you to do this or you passed the wrong rights combination (some rights only apply to channels and vice versa)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RpcCallFailError extends BadRequestError {
-    constructor(args) {
-        super('Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request));
-this.message = 'Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RpcMcgetFailError extends BadRequestError {
-    constructor(args) {
-        super('Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request));
-this.message = 'Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class RsaDecryptFailedError extends BadRequestError {
-    constructor(args) {
-        super('Internal RSA decryption failed' + RPCError._fmtRequest(args.request));
-this.message = 'Internal RSA decryption failed' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ScheduleDateTooLateError extends BadRequestError {
-    constructor(args) {
-        super('The date you tried to schedule is too far in the future (last known limit of 1 year and a few hours)' + RPCError._fmtRequest(args.request));
-this.message = 'The date you tried to schedule is too far in the future (last known limit of 1 year and a few hours)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ScheduleTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('You cannot schedule more messages in this chat (last known limit of 100 per chat)' + RPCError._fmtRequest(args.request));
-this.message = 'You cannot schedule more messages in this chat (last known limit of 100 per chat)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SearchQueryEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The search query is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The search query is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SecondsInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Slow mode only supports certain values (e.g. 0, 10s, 30s, 1m, 5m, 15m and 1h)' + RPCError._fmtRequest(args.request));
-this.message = 'Slow mode only supports certain values (e.g. 0, 10s, 30s, 1m, 5m, 15m and 1h)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SendMessageMediaInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The message media was invalid or not specified' + RPCError._fmtRequest(args.request));
-this.message = 'The message media was invalid or not specified' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SendMessageTypeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The message type is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The message type is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SessionExpiredError extends UnauthorizedError {
-    constructor(args) {
-        super('The authorization has expired' + RPCError._fmtRequest(args.request));
-this.message = 'The authorization has expired' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SessionPasswordNeededError extends UnauthorizedError {
-    constructor(args) {
-        super('Two-steps verification is enabled and a password is required' + RPCError._fmtRequest(args.request));
-this.message = 'Two-steps verification is enabled and a password is required' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SessionRevokedError extends UnauthorizedError {
-    constructor(args) {
-        super('The authorization has been invalidated, because of the user terminating all sessions' + RPCError._fmtRequest(args.request));
-this.message = 'The authorization has been invalidated, because of the user terminating all sessions' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class Sha256HashInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided SHA256 hash is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided SHA256 hash is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class ShortnameOccupyFailedError extends BadRequestError {
-    constructor(args) {
-        super('An error occurred when trying to register the short-name used for the sticker pack. Try a different name' + RPCError._fmtRequest(args.request));
-this.message = 'An error occurred when trying to register the short-name used for the sticker pack. Try a different name' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class SlowModeWaitError extends FloodError {
-    constructor(args) {
-        const seconds = Number(args.capture || 0);
-        super(format('A wait of {seconds} seconds is required before sending another message in this chat', {seconds}) + RPCError._fmtRequest(args.request));
-this.message = format('A wait of {seconds} seconds is required before sending another message in this chat', {seconds}) + RPCError._fmtRequest(args.request);
-        this.seconds = seconds;
-    }
-}
-
-
-class StartParamEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The start parameter is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The start parameter is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StartParamInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Start parameter invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Start parameter invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StickersetInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided sticker set is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided sticker set is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StickersEmptyError extends BadRequestError {
-    constructor(args) {
-        super('No sticker provided' + RPCError._fmtRequest(args.request));
-this.message = 'No sticker provided' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StickerEmojiInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Sticker emoji invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Sticker emoji invalid' + RPCError._fmtRequest(args.request);
-    }
-}
 
-
-class StickerFileInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Sticker file invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Sticker file invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StickerIdInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided sticker ID is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided sticker ID is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StickerInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided sticker is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided sticker is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StickerPngDimensionsError extends BadRequestError {
-    constructor(args) {
-        super('Sticker png dimensions invalid' + RPCError._fmtRequest(args.request));
-this.message = 'Sticker png dimensions invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StorageCheckFailedError extends ServerError {
-    constructor(args) {
-        super('Server storage check failed' + RPCError._fmtRequest(args.request));
-this.message = 'Server storage check failed' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class StoreInvalidScalarTypeError extends ServerError {
-    constructor(args) {
-        super('' + RPCError._fmtRequest(args.request));
-this.message = '' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TakeoutInitDelayError extends FloodError {
-    constructor(args) {
-        const seconds = Number(args.capture || 0);
-        super(format('A wait of {seconds} seconds is required before being able to initiate the takeout', {seconds}) + RPCError._fmtRequest(args.request));
-this.message = format('A wait of {seconds} seconds is required before being able to initiate the takeout', {seconds}) + RPCError._fmtRequest(args.request);
-        this.seconds = seconds;
-    }
-}
-
-
-class TakeoutInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The takeout session has been invalidated by another data export session' + RPCError._fmtRequest(args.request));
-this.message = 'The takeout session has been invalidated by another data export session' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TakeoutRequiredError extends BadRequestError {
-    constructor(args) {
-        super('You must initialize a takeout request first' + RPCError._fmtRequest(args.request));
-this.message = 'You must initialize a takeout request first' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TempAuthKeyEmptyError extends BadRequestError {
-    constructor(args) {
-        super('No temporary auth key provided' + RPCError._fmtRequest(args.request));
-this.message = 'No temporary auth key provided' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TimeoutError extends TimedOutError {
-    constructor(args) {
-        super('A timeout occurred while fetching data from the worker' + RPCError._fmtRequest(args.request));
-this.message = 'A timeout occurred while fetching data from the worker' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TmpPasswordDisabledError extends BadRequestError {
-    constructor(args) {
-        super('The temporary password is disabled' + RPCError._fmtRequest(args.request));
-this.message = 'The temporary password is disabled' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TokenInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided token is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided token is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TtlDaysInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The provided TTL is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The provided TTL is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TypesEmptyError extends BadRequestError {
-    constructor(args) {
-        super('The types field is empty' + RPCError._fmtRequest(args.request));
-this.message = 'The types field is empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class TypeConstructorInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The type constructor is invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The type constructor is invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UnknownMethodError extends ServerError {
-    constructor(args) {
-        super('The method you tried to call cannot be called on non-CDN DCs' + RPCError._fmtRequest(args.request));
-this.message = 'The method you tried to call cannot be called on non-CDN DCs' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UntilDateInvalidError extends BadRequestError {
-    constructor(args) {
-        super('That date cannot be specified in this request (try using None)' + RPCError._fmtRequest(args.request));
-this.message = 'That date cannot be specified in this request (try using None)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UrlInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The URL used was invalid (e.g. when answering a callback with an URL that\'s not t.me/yourbot or your game\'s URL)' + RPCError._fmtRequest(args.request));
-this.message = 'The URL used was invalid (e.g. when answering a callback with an URL that\'s not t.me/yourbot or your game\'s URL)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UsernameInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Nobody is using this username, or the username is unacceptable. If the latter, it must match r"[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]"' + RPCError._fmtRequest(args.request));
-this.message = 'Nobody is using this username, or the username is unacceptable. If the latter, it must match r"[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]"' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UsernameNotModifiedError extends BadRequestError {
-    constructor(args) {
-        super('The username is not different from the current username' + RPCError._fmtRequest(args.request));
-this.message = 'The username is not different from the current username' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UsernameNotOccupiedError extends BadRequestError {
-    constructor(args) {
-        super('The username is not in use by anyone else yet' + RPCError._fmtRequest(args.request));
-this.message = 'The username is not in use by anyone else yet' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UsernameOccupiedError extends BadRequestError {
-    constructor(args) {
-        super('The username is already taken' + RPCError._fmtRequest(args.request));
-this.message = 'The username is already taken' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UsersTooFewError extends BadRequestError {
-    constructor(args) {
-        super('Not enough users (to create a chat, for example)' + RPCError._fmtRequest(args.request));
-this.message = 'Not enough users (to create a chat, for example)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UsersTooMuchError extends BadRequestError {
-    constructor(args) {
-        super('The maximum number of users has been exceeded (to create a chat, for example)' + RPCError._fmtRequest(args.request));
-this.message = 'The maximum number of users has been exceeded (to create a chat, for example)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserAdminInvalidError extends BadRequestError {
-    constructor(args) {
-        super('Either you\'re not an admin or you tried to ban an admin that you didn\'t promote' + RPCError._fmtRequest(args.request));
-this.message = 'Either you\'re not an admin or you tried to ban an admin that you didn\'t promote' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserAlreadyParticipantError extends BadRequestError {
-    constructor(args) {
-        super('The authenticated user is already a participant of the chat' + RPCError._fmtRequest(args.request));
-this.message = 'The authenticated user is already a participant of the chat' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserBannedInChannelError extends BadRequestError {
-    constructor(args) {
-        super('You\'re banned from sending messages in supergroups/channels' + RPCError._fmtRequest(args.request));
-this.message = 'You\'re banned from sending messages in supergroups/channels' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserBlockedError extends BadRequestError {
-    constructor(args) {
-        super('User blocked' + RPCError._fmtRequest(args.request));
-this.message = 'User blocked' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserBotError extends BadRequestError {
-    constructor(args) {
-        super('Bots can only be admins in channels.' + RPCError._fmtRequest(args.request));
-this.message = 'Bots can only be admins in channels.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserBotInvalidError extends BadRequestError {
-    constructor(args) {
-        super('This method can only be called by a bot' + RPCError._fmtRequest(args.request));
-this.message = 'This method can only be called by a bot' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserBotRequiredError extends BadRequestError {
-    constructor(args) {
-        super('This method can only be called by a bot' + RPCError._fmtRequest(args.request));
-this.message = 'This method can only be called by a bot' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserChannelsTooMuchError extends ForbiddenError {
-    constructor(args) {
-        super('One of the users you tried to add is already in too many channels/supergroups' + RPCError._fmtRequest(args.request));
-this.message = 'One of the users you tried to add is already in too many channels/supergroups' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserCreatorError extends BadRequestError {
-    constructor(args) {
-        super('You can\'t leave this channel, because you\'re its creator' + RPCError._fmtRequest(args.request));
-this.message = 'You can\'t leave this channel, because you\'re its creator' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserDeactivatedError extends UnauthorizedError {
-    constructor(args) {
-        super('The user has been deleted/deactivated' + RPCError._fmtRequest(args.request));
-this.message = 'The user has been deleted/deactivated' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserDeactivatedBanError extends UnauthorizedError {
+class UserMigrateError extends InvalidDCError {
     constructor(args) {
-        super('The user has been deleted/deactivated' + RPCError._fmtRequest(args.request));
-this.message = 'The user has been deleted/deactivated' + RPCError._fmtRequest(args.request);
+        const newDc = Number(args.capture || 0)
+        super(format('The user whose identity is being used to execute queries is associated with DC {new_dc}', { newDc }) + RPCError._fmtRequest(args.request))
+        this.message = format('The user whose identity is being used to execute queries is associated with DC {new_dc}', { newDc }) + RPCError._fmtRequest(args.request)
+        this.newDc = newDc
     }
 }
 
 
-class UserIdInvalidError extends BadRequestError {
+class PhoneMigrateError extends InvalidDCError {
     constructor(args) {
-        super('Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request));
-this.message = 'Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request);
+        const newDc = Number(args.capture || 0)
+        super(format('The phone number a user is trying to use for authorization is associated with DC {new_dc}', { newDc }) + RPCError._fmtRequest(args.request))
+        this.message = format('The phone number a user is trying to use for authorization is associated with DC {new_dc}', { newDc }) + RPCError._fmtRequest(args.request)
+        this.newDc = newDc
     }
 }
 
-
-class UserInvalidError extends BadRequestError {
+class SlowModeWaitError extends FloodError {
     constructor(args) {
-        super('The given user was invalid' + RPCError._fmtRequest(args.request));
-this.message = 'The given user was invalid' + RPCError._fmtRequest(args.request);
+        const seconds = Number(args.capture || 0)
+        super(format('A wait of {seconds} seconds is required before sending another message in this chat', { seconds }) + RPCError._fmtRequest(args.request))
+        this.message = format('A wait of {seconds} seconds is required before sending another message in this chat', { seconds }) + RPCError._fmtRequest(args.request)
+        this.seconds = seconds
     }
 }
 
-
-class UserIsBlockedError extends BadRequestError {
+class FloodWaitError extends FloodError {
     constructor(args) {
-        super('User is blocked' + RPCError._fmtRequest(args.request));
-this.message = 'User is blocked' + RPCError._fmtRequest(args.request);
+        const seconds = Number(args.capture || 0)
+        super(format('A wait of {seconds} seconds is required', { seconds }) + RPCError._fmtRequest(args.request))
+        this.message = format('A wait of {seconds} seconds is required', { seconds }) + RPCError._fmtRequest(args.request)
+        this.seconds = seconds
     }
 }
 
-
-class UserIsBotError extends BadRequestError {
+class FloodTestPhoneWaitError extends FloodError {
     constructor(args) {
-        super('Bots can\'t send messages to other bots' + RPCError._fmtRequest(args.request));
-this.message = 'Bots can\'t send messages to other bots' + RPCError._fmtRequest(args.request);
+        const seconds = Number(args.capture || 0)
+        super(format('A wait of {seconds} seconds is required in the test servers', { seconds }) + RPCError._fmtRequest(args.request))
+        this.message = format('A wait of {seconds} seconds is required in the test servers', { seconds }) + RPCError._fmtRequest(args.request)
+        this.seconds = seconds
     }
 }
 
-
-class UserKickedError extends BadRequestError {
+class FileMigrateError extends InvalidDCError {
     constructor(args) {
-        super('This user was kicked from this supergroup/channel' + RPCError._fmtRequest(args.request));
-this.message = 'This user was kicked from this supergroup/channel' + RPCError._fmtRequest(args.request);
+        const newDc = Number(args.capture || 0)
+        super(format('The file to be accessed is currently stored in DC {new_dc}', { newDc }) + RPCError._fmtRequest(args.request))
+        this.message = format('The file to be accessed is currently stored in DC {new_dc}', { newDc }) + RPCError._fmtRequest(args.request)
+        this.newDc = newDc
     }
 }
-
-
-class UserMigrateError extends InvalidDCError {
+class NetworkMigrateError extends InvalidDCError {
     constructor(args) {
         const newDc = Number(args.capture || 0);
-        super(format('The user whose identity is being used to execute queries is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
-this.message = format('The user whose identity is being used to execute queries is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
+        super(format('The source IP address is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
+        this.message = format('The source IP address is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
         this.newDc = newDc;
     }
 }
 
-
-class UserNotMutualContactError extends BadRequestError {
-    constructor(args) {
-        super('The provided user is not a mutual contact' + RPCError._fmtRequest(args.request));
-this.message = 'The provided user is not a mutual contact' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserNotParticipantError extends BadRequestError {
-    constructor(args) {
-        super('The target user is not a member of the specified megagroup or channel' + RPCError._fmtRequest(args.request));
-this.message = 'The target user is not a member of the specified megagroup or channel' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserPrivacyRestrictedError extends ForbiddenError {
-    constructor(args) {
-        super('The user\'s privacy settings do not allow you to do this' + RPCError._fmtRequest(args.request));
-this.message = 'The user\'s privacy settings do not allow you to do this' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class UserRestrictedError extends ForbiddenError {
-    constructor(args) {
-        super('You\'re spamreported, you can\'t create channels or chats.' + RPCError._fmtRequest(args.request));
-this.message = 'You\'re spamreported, you can\'t create channels or chats.' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class VideoContentTypeInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The video content type is not supported with the given parameters (i.e. supports_streaming)' + RPCError._fmtRequest(args.request));
-this.message = 'The video content type is not supported with the given parameters (i.e. supports_streaming)' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class WallpaperFileInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The given file cannot be used as a wallpaper' + RPCError._fmtRequest(args.request));
-this.message = 'The given file cannot be used as a wallpaper' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class WallpaperInvalidError extends BadRequestError {
-    constructor(args) {
-        super('The input wallpaper was not valid' + RPCError._fmtRequest(args.request));
-this.message = 'The input wallpaper was not valid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class WcConvertUrlInvalidError extends BadRequestError {
-    constructor(args) {
-        super('WC convert URL invalid' + RPCError._fmtRequest(args.request));
-this.message = 'WC convert URL invalid' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class WebpageCurlFailedError extends BadRequestError {
-    constructor(args) {
-        super('Failure while fetching the webpage with cURL' + RPCError._fmtRequest(args.request));
-this.message = 'Failure while fetching the webpage with cURL' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class WebpageMediaEmptyError extends BadRequestError {
-    constructor(args) {
-        super('Webpage media empty' + RPCError._fmtRequest(args.request));
-this.message = 'Webpage media empty' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class WorkerBusyTooLongRetryError extends ServerError {
-    constructor(args) {
-        super('Telegram workers are too busy to respond immediately' + RPCError._fmtRequest(args.request));
-this.message = 'Telegram workers are too busy to respond immediately' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-class YouBlockedUserError extends BadRequestError {
-    constructor(args) {
-        super('You blocked this user' + RPCError._fmtRequest(args.request));
-this.message = 'You blocked this user' + RPCError._fmtRequest(args.request);
-    }
-}
-
-
-const rpcErrorsObject = {
-    ABOUT_TOO_LONG: AboutTooLongError,
-    ACCESS_TOKEN_EXPIRED: AccessTokenExpiredError,
-    ACCESS_TOKEN_INVALID: AccessTokenInvalidError,
-    ACTIVE_USER_REQUIRED: ActiveUserRequiredError,
-    ADMINS_TOO_MUCH: AdminsTooMuchError,
-    ADMIN_RANK_EMOJI_NOT_ALLOWED: AdminRankEmojiNotAllowedError,
-    ADMIN_RANK_INVALID: AdminRankInvalidError,
-    API_ID_INVALID: ApiIdInvalidError,
-    API_ID_PUBLISHED_FLOOD: ApiIdPublishedFloodError,
-    ARTICLE_TITLE_EMPTY: ArticleTitleEmptyError,
-    AUTH_BYTES_INVALID: AuthBytesInvalidError,
-    AUTH_KEY_DUPLICATED: AuthKeyDuplicatedError,
-    AUTH_KEY_INVALID: AuthKeyInvalidError,
-    AUTH_KEY_PERM_EMPTY: AuthKeyPermEmptyError,
-    AUTH_KEY_UNREGISTERED: AuthKeyUnregisteredError,
-    AUTH_RESTART: AuthRestartError,
-    BANNED_RIGHTS_INVALID: BannedRightsInvalidError,
-    BOTS_TOO_MUCH: BotsTooMuchError,
-    BOT_CHANNELS_NA: BotChannelsNaError,
-    BOT_GROUPS_BLOCKED: BotGroupsBlockedError,
-    BOT_INLINE_DISABLED: BotInlineDisabledError,
-    BOT_INVALID: BotInvalidError,
-    BOT_METHOD_INVALID: BotMethodInvalidError,
-    BOT_MISSING: BotMissingError,
-    BOT_PAYMENTS_DISABLED: BotPaymentsDisabledError,
-    BOT_POLLS_DISABLED: BotPollsDisabledError,
-    BROADCAST_ID_INVALID: BroadcastIdInvalidError,
-    BUTTON_DATA_INVALID: ButtonDataInvalidError,
-    BUTTON_TYPE_INVALID: ButtonTypeInvalidError,
-    BUTTON_URL_INVALID: ButtonUrlInvalidError,
-    CALL_ALREADY_ACCEPTED: CallAlreadyAcceptedError,
-    CALL_ALREADY_DECLINED: CallAlreadyDeclinedError,
-    CALL_OCCUPY_FAILED: CallOccupyFailedError,
-    CALL_PEER_INVALID: CallPeerInvalidError,
-    CALL_PROTOCOL_FLAGS_INVALID: CallProtocolFlagsInvalidError,
-    CDN_METHOD_INVALID: CdnMethodInvalidError,
-    CHANNELS_ADMIN_PUBLIC_TOO_MUCH: ChannelsAdminPublicTooMuchError,
-    CHANNELS_TOO_MUCH: ChannelsTooMuchError,
-    CHANNEL_INVALID: ChannelInvalidError,
-    CHANNEL_PRIVATE: ChannelPrivateError,
-    CHANNEL_PUBLIC_GROUP_NA: ChannelPublicGroupNaError,
-    CHAT_ABOUT_NOT_MODIFIED: ChatAboutNotModifiedError,
-    CHAT_ABOUT_TOO_LONG: ChatAboutTooLongError,
-    CHAT_ADMIN_INVITE_REQUIRED: ChatAdminInviteRequiredError,
-    CHAT_ADMIN_REQUIRED: ChatAdminRequiredError,
-    CHAT_FORBIDDEN: ChatForbiddenError,
-    CHAT_ID_EMPTY: ChatIdEmptyError,
-    CHAT_ID_INVALID: ChatIdInvalidError,
-    CHAT_INVALID: ChatInvalidError,
-    CHAT_LINK_EXISTS: ChatLinkExistsError,
-    CHAT_NOT_MODIFIED: ChatNotModifiedError,
-    CHAT_RESTRICTED: ChatRestrictedError,
-    CHAT_SEND_GIFS_FORBIDDEN: ChatSendGifsForbiddenError,
-    CHAT_SEND_INLINE_FORBIDDEN: ChatSendInlineForbiddenError,
-    CHAT_SEND_MEDIA_FORBIDDEN: ChatSendMediaForbiddenError,
-    CHAT_SEND_STICKERS_FORBIDDEN: ChatSendStickersForbiddenError,
-    CHAT_TITLE_EMPTY: ChatTitleEmptyError,
-    CHAT_WRITE_FORBIDDEN: ChatWriteForbiddenError,
-    CODE_EMPTY: CodeEmptyError,
-    CODE_HASH_INVALID: CodeHashInvalidError,
-    CODE_INVALID: CodeInvalidError,
-    CONNECTION_API_ID_INVALID: ConnectionApiIdInvalidError,
-    CONNECTION_DEVICE_MODEL_EMPTY: ConnectionDeviceModelEmptyError,
-    CONNECTION_LANG_PACK_INVALID: ConnectionLangPackInvalidError,
-    CONNECTION_LAYER_INVALID: ConnectionLayerInvalidError,
-    CONNECTION_NOT_INITED: ConnectionNotInitedError,
-    CONNECTION_SYSTEM_EMPTY: ConnectionSystemEmptyError,
-    CONTACT_ID_INVALID: ContactIdInvalidError,
-    DATA_INVALID: DataInvalidError,
-    DATA_JSON_INVALID: DataJsonInvalidError,
-    DATE_EMPTY: DateEmptyError,
-    DC_ID_INVALID: DcIdInvalidError,
-    DH_G_A_INVALID: DhGAInvalidError,
-    EMAIL_HASH_EXPIRED: EmailHashExpiredError,
-    EMAIL_INVALID: EmailInvalidError,
-    EMOTICON_EMPTY: EmoticonEmptyError,
-    ENCRYPTED_MESSAGE_INVALID: EncryptedMessageInvalidError,
-    ENCRYPTION_ALREADY_ACCEPTED: EncryptionAlreadyAcceptedError,
-    ENCRYPTION_ALREADY_DECLINED: EncryptionAlreadyDeclinedError,
-    ENCRYPTION_DECLINED: EncryptionDeclinedError,
-    ENCRYPTION_ID_INVALID: EncryptionIdInvalidError,
-    ENCRYPTION_OCCUPY_FAILED: EncryptionOccupyFailedError,
-    ENTITIES_TOO_LONG: EntitiesTooLongError,
-    ENTITY_MENTION_USER_INVALID: EntityMentionUserInvalidError,
-    ERROR_TEXT_EMPTY: ErrorTextEmptyError,
-    EXPORT_CARD_INVALID: ExportCardInvalidError,
-    EXTERNAL_URL_INVALID: ExternalUrlInvalidError,
-    FIELD_NAME_EMPTY: FieldNameEmptyError,
-    FIELD_NAME_INVALID: FieldNameInvalidError,
-    FILE_ID_INVALID: FileIdInvalidError,
-    FILE_PARTS_INVALID: FilePartsInvalidError,
-    FILE_PART_0_MISSING: FilePart0MissingError,
-    FILE_PART_EMPTY: FilePartEmptyError,
-    FILE_PART_INVALID: FilePartInvalidError,
-    FILE_PART_LENGTH_INVALID: FilePartLengthInvalidError,
-    FILE_PART_SIZE_INVALID: FilePartSizeInvalidError,
-    FILEREF_UPGRADE_NEEDED: FilerefUpgradeNeededError,
-    FIRSTNAME_INVALID: FirstNameInvalidError,
-    FOLDER_ID_EMPTY: FolderIdEmptyError,
-    FOLDER_ID_INVALID: FolderIdInvalidError,
-    FRESH_RESET_AUTHORISATION_FORBIDDEN: FreshResetAuthorisationForbiddenError,
-    GIF_ID_INVALID: GifIdInvalidError,
-    GROUPED_MEDIA_INVALID: GroupedMediaInvalidError,
-    HASH_INVALID: HashInvalidError,
-    HISTORY_GET_FAILED: HistoryGetFailedError,
-    IMAGE_PROCESS_FAILED: ImageProcessFailedError,
-    INLINE_RESULT_EXPIRED: InlineResultExpiredError,
-    INPUT_CONSTRUCTOR_INVALID: InputConstructorInvalidError,
-    INPUT_FETCH_ERROR: InputFetchErrorError,
-    INPUT_FETCH_FAIL: InputFetchFailError,
-    INPUT_LAYER_INVALID: InputLayerInvalidError,
-    INPUT_METHOD_INVALID: InputMethodInvalidError,
-    INPUT_REQUEST_TOO_LONG: InputRequestTooLongError,
-    INPUT_USER_DEACTIVATED: InputUserDeactivatedError,
-    INVITE_HASH_EMPTY: InviteHashEmptyError,
-    INVITE_HASH_EXPIRED: InviteHashExpiredError,
-    INVITE_HASH_INVALID: InviteHashInvalidError,
-    LANG_PACK_INVALID: LangPackInvalidError,
-    LASTNAME_INVALID: LastnameInvalidError,
-    LIMIT_INVALID: LimitInvalidError,
-    LINK_NOT_MODIFIED: LinkNotModifiedError,
-    LOCATION_INVALID: LocationInvalidError,
-    MAX_ID_INVALID: MaxIdInvalidError,
-    MAX_QTS_INVALID: MaxQtsInvalidError,
-    MD5_CHECKSUM_INVALID: Md5ChecksumInvalidError,
-    MEDIA_CAPTION_TOO_LONG: MediaCaptionTooLongError,
-    MEDIA_EMPTY: MediaEmptyError,
-    MEDIA_INVALID: MediaInvalidError,
-    MEDIA_NEW_INVALID: MediaNewInvalidError,
-    MEDIA_PREV_INVALID: MediaPrevInvalidError,
-    MEGAGROUP_ID_INVALID: MegagroupIdInvalidError,
-    MEGAGROUP_PREHISTORY_HIDDEN: MegagroupPrehistoryHiddenError,
-    MEMBER_NO_LOCATION: MemberNoLocationError,
-    MEMBER_OCCUPY_PRIMARY_LOC_FAILED: MemberOccupyPrimaryLocFailedError,
-    MESSAGE_AUTHOR_REQUIRED: MessageAuthorRequiredError,
-    MESSAGE_DELETE_FORBIDDEN: MessageDeleteForbiddenError,
-    MESSAGE_EDIT_TIME_EXPIRED: MessageEditTimeExpiredError,
-    MESSAGE_EMPTY: MessageEmptyError,
-    MESSAGE_IDS_EMPTY: MessageIdsEmptyError,
-    MESSAGE_ID_INVALID: MessageIdInvalidError,
-    MESSAGE_NOT_MODIFIED: MessageNotModifiedError,
-    MESSAGE_TOO_LONG: MessageTooLongError,
-    MSG_WAIT_FAILED: MsgWaitFailedError,
-    MT_SEND_QUEUE_TOO_LONG: MtSendQueueTooLongError,
-    NEED_CHAT_INVALID: NeedChatInvalidError,
-    NEED_MEMBER_INVALID: NeedMemberInvalidError,
-    NEW_SALT_INVALID: NewSaltInvalidError,
-    NEW_SETTINGS_INVALID: NewSettingsInvalidError,
-    OFFSET_INVALID: OffsetInvalidError,
-    OFFSET_PEER_ID_INVALID: OffsetPeerIdInvalidError,
-    OPTIONS_TOO_MUCH: OptionsTooMuchError,
-    PACK_SHORT_NAME_INVALID: PackShortNameInvalidError,
-    PACK_SHORT_NAME_OCCUPIED: PackShortNameOccupiedError,
-    PARTICIPANTS_TOO_FEW: ParticipantsTooFewError,
-    PARTICIPANT_CALL_FAILED: ParticipantCallFailedError,
-    PARTICIPANT_VERSION_OUTDATED: ParticipantVersionOutdatedError,
-    PASSWORD_EMPTY: PasswordEmptyError,
-    PASSWORD_HASH_INVALID: PasswordHashInvalidError,
-    PASSWORD_REQUIRED: PasswordRequiredError,
-    PAYMENT_PROVIDER_INVALID: PaymentProviderInvalidError,
-    PEER_FLOOD: PeerFloodError,
-    PEER_ID_INVALID: PeerIdInvalidError,
-    PEER_ID_NOT_SUPPORTED: PeerIdNotSupportedError,
-    PERSISTENT_TIMESTAMP_EMPTY: PersistentTimestampEmptyError,
-    PERSISTENT_TIMESTAMP_INVALID: PersistentTimestampInvalidError,
-    PERSISTENT_TIMESTAMP_OUTDATED: PersistentTimestampOutdatedError,
-    PHONE_CODE_EMPTY: PhoneCodeEmptyError,
-    PHONE_CODE_EXPIRED: PhoneCodeExpiredError,
-    PHONE_CODE_HASH_EMPTY: PhoneCodeHashEmptyError,
-    PHONE_CODE_INVALID: PhoneCodeInvalidError,
-    PHONE_NUMBER_APP_SIGNUP_FORBIDDEN: PhoneNumberAppSignupForbiddenError,
-    PHONE_NUMBER_BANNED: PhoneNumberBannedError,
-    PHONE_NUMBER_FLOOD: PhoneNumberFloodError,
-    PHONE_NUMBER_INVALID: PhoneNumberInvalidError,
-    PHONE_NUMBER_OCCUPIED: PhoneNumberOccupiedError,
-    PHONE_NUMBER_UNOCCUPIED: PhoneNumberUnoccupiedError,
-    PHONE_PASSWORD_FLOOD: PhonePasswordFloodError,
-    PHONE_PASSWORD_PROTECTED: PhonePasswordProtectedError,
-    PHOTO_CONTENT_URL_EMPTY: PhotoContentUrlEmptyError,
-    PHOTO_CROP_SIZE_SMALL: PhotoCropSizeSmallError,
-    PHOTO_EXT_INVALID: PhotoExtInvalidError,
-    PHOTO_INVALID: PhotoInvalidError,
-    PHOTO_INVALID_DIMENSIONS: PhotoInvalidDimensionsError,
-    PHOTO_SAVE_FILE_INVALID: PhotoSaveFileInvalidError,
-    PHOTO_THUMB_URL_EMPTY: PhotoThumbUrlEmptyError,
-    PIN_RESTRICTED: PinRestrictedError,
-    POLL_OPTION_DUPLICATE: PollOptionDuplicateError,
-    POLL_UNSUPPORTED: PollUnsupportedError,
-    PRIVACY_KEY_INVALID: PrivacyKeyInvalidError,
-    PTS_CHANGE_EMPTY: PtsChangeEmptyError,
-    QUERY_ID_EMPTY: QueryIdEmptyError,
-    QUERY_ID_INVALID: QueryIdInvalidError,
-    QUERY_TOO_SHORT: QueryTooShortError,
-    RANDOM_ID_DUPLICATE: RandomIdDuplicateError,
-    RANDOM_ID_INVALID: RandomIdInvalidError,
-    RANDOM_LENGTH_INVALID: RandomLengthInvalidError,
-    RANGES_INVALID: RangesInvalidError,
-    REACTION_EMPTY: ReactionEmptyError,
-    REACTION_INVALID: ReactionInvalidError,
-    REG_ID_GENERATE_FAILED: RegIdGenerateFailedError,
-    REPLY_MARKUP_INVALID: ReplyMarkupInvalidError,
-    REPLY_MARKUP_TOO_LONG: ReplyMarkupTooLongError,
-    RESULT_ID_DUPLICATE: ResultIdDuplicateError,
-    RESULT_TYPE_INVALID: ResultTypeInvalidError,
-    RESULTS_TOO_MUCH: ResultsTooMuchError,
-    RIGHT_FORBIDDEN: RightForbiddenError,
-    RPC_CALL_FAIL: RpcCallFailError,
-    RPC_MCGET_FAIL: RpcMcgetFailError,
-    RSA_DECRYPT_FAILED: RsaDecryptFailedError,
-    SCHEDULE_DATE_TOO_LATE: ScheduleDateTooLateError,
-    SCHEDULE_TOO_MUCH: ScheduleTooMuchError,
-    SEARCH_QUERY_EMPTY: SearchQueryEmptyError,
-    SECONDS_INVALID: SecondsInvalidError,
-    SEND_MESSAGE_MEDIA_INVALID: SendMessageMediaInvalidError,
-    SEND_MESSAGE_TYPE_INVALID: SendMessageTypeInvalidError,
-    SESSION_EXPIRED: SessionExpiredError,
-    SESSION_PASSWORD_NEEDED: SessionPasswordNeededError,
-    SESSION_REVOKED: SessionRevokedError,
-    SHA256_HASH_INVALID: Sha256HashInvalidError,
-    SHORTNAME_OCCUPY_FAILED: ShortnameOccupyFailedError,
-    START_PARAM_EMPTY: StartParamEmptyError,
-    START_PARAM_INVALID: StartParamInvalidError,
-    STICKERSET_INVALID: StickersetInvalidError,
-    STICKERS_EMPTY: StickersEmptyError,
-    STICKER_EMOJI_INVALID: StickerEmojiInvalidError,
-    STICKER_FILE_INVALID: StickerFileInvalidError,
-    STICKER_ID_INVALID: StickerIdInvalidError,
-    STICKER_INVALID: StickerInvalidError,
-    STICKER_PNG_DIMENSIONS: StickerPngDimensionsError,
-    STORAGE_CHECK_FAILED: StorageCheckFailedError,
-    STORE_INVALID_SCALAR_TYPE: StoreInvalidScalarTypeError,
-    TAKEOUT_INVALID: TakeoutInvalidError,
-    TAKEOUT_REQUIRED: TakeoutRequiredError,
-    TEMP_AUTH_KEY_EMPTY: TempAuthKeyEmptyError,
-    Timeout: TimeoutError,
-    TMP_PASSWORD_DISABLED: TmpPasswordDisabledError,
-    TOKEN_INVALID: TokenInvalidError,
-    TTL_DAYS_INVALID: TtlDaysInvalidError,
-    TYPES_EMPTY: TypesEmptyError,
-    TYPE_CONSTRUCTOR_INVALID: TypeConstructorInvalidError,
-    UNKNOWN_METHOD: UnknownMethodError,
-    UNTIL_DATE_INVALID: UntilDateInvalidError,
-    URL_INVALID: UrlInvalidError,
-    USERNAME_INVALID: UsernameInvalidError,
-    USERNAME_NOT_MODIFIED: UsernameNotModifiedError,
-    USERNAME_NOT_OCCUPIED: UsernameNotOccupiedError,
-    USERNAME_OCCUPIED: UsernameOccupiedError,
-    USERS_TOO_FEW: UsersTooFewError,
-    USERS_TOO_MUCH: UsersTooMuchError,
-    USER_ADMIN_INVALID: UserAdminInvalidError,
-    USER_ALREADY_PARTICIPANT: UserAlreadyParticipantError,
-    USER_BANNED_IN_CHANNEL: UserBannedInChannelError,
-    USER_BLOCKED: UserBlockedError,
-    USER_BOT: UserBotError,
-    USER_BOT_INVALID: UserBotInvalidError,
-    USER_BOT_REQUIRED: UserBotRequiredError,
-    USER_CHANNELS_TOO_MUCH: UserChannelsTooMuchError,
-    USER_CREATOR: UserCreatorError,
-    USER_DEACTIVATED: UserDeactivatedError,
-    USER_DEACTIVATED_BAN: UserDeactivatedBanError,
-    USER_ID_INVALID: UserIdInvalidError,
-    USER_INVALID: UserInvalidError,
-    USER_IS_BLOCKED: UserIsBlockedError,
-    USER_IS_BOT: UserIsBotError,
-    USER_KICKED: UserKickedError,
-    USER_NOT_MUTUAL_CONTACT: UserNotMutualContactError,
-    USER_NOT_PARTICIPANT: UserNotParticipantError,
-    USER_PRIVACY_RESTRICTED: UserPrivacyRestrictedError,
-    USER_RESTRICTED: UserRestrictedError,
-    VIDEO_CONTENT_TYPE_INVALID: VideoContentTypeInvalidError,
-    WALLPAPER_FILE_INVALID: WallpaperFileInvalidError,
-    WALLPAPER_INVALID: WallpaperInvalidError,
-    WC_CONVERT_URL_INVALID: WcConvertUrlInvalidError,
-    WEBPAGE_CURL_FAILED: WebpageCurlFailedError,
-    WEBPAGE_MEDIA_EMPTY: WebpageMediaEmptyError,
-    WORKER_BUSY_TOO_LONG_RETRY: WorkerBusyTooLongRetryError,
-    YOU_BLOCKED_USER: YouBlockedUserError,
-};
-
 const rpcErrorRe = [
-    [/EMAIL_UNCONFIRMED_(\d+)/, EmailUnconfirmedError],
     [/FILE_MIGRATE_(\d+)/, FileMigrateError],
-    [/FILE_PART_(\d+)_MISSING/, FilePartMissingError],
     [/FLOOD_TEST_PHONE_WAIT_(\d+)/, FloodTestPhoneWaitError],
     [/FLOOD_WAIT_(\d+)/, FloodWaitError],
-    [/INTERDC_(\d+)_CALL_ERROR/, InterdcCallErrorError],
-    [/INTERDC_(\d+)_CALL_RICH_ERROR/, InterdcCallRichErrorError],
-    [/NETWORK_MIGRATE_(\d+)/, NetworkMigrateError],
     [/PHONE_MIGRATE_(\d+)/, PhoneMigrateError],
     [/SLOWMODE_WAIT_(\d+)/, SlowModeWaitError],
-    [/TAKEOUT_INIT_DELAY_(\d+)/, TakeoutInitDelayError],
     [/USER_MIGRATE_(\d+)/, UserMigrateError],
-];module.exports = {     EmailUnconfirmedError,
-     FileMigrateError,
-     FilePartMissingError,
-     FloodTestPhoneWaitError,
-     FloodWaitError,
-     InterdcCallErrorError,
-     InterdcCallRichErrorError,
-     NetworkMigrateError,
-     PhoneMigrateError,
-     SlowModeWaitError,
-     TakeoutInitDelayError,
-     UserMigrateError,
-     AboutTooLongError,
-     AccessTokenExpiredError,
-     AccessTokenInvalidError,
-     ActiveUserRequiredError,
-     AdminsTooMuchError,
-     AdminRankEmojiNotAllowedError,
-     AdminRankInvalidError,
-     ApiIdInvalidError,
-     ApiIdPublishedFloodError,
-     ArticleTitleEmptyError,
-     AuthBytesInvalidError,
-     AuthKeyDuplicatedError,
-     AuthKeyInvalidError,
-     AuthKeyPermEmptyError,
-     AuthKeyUnregisteredError,
-     AuthRestartError,
-     BannedRightsInvalidError,
-     BotsTooMuchError,
-     BotChannelsNaError,
-     BotGroupsBlockedError,
-     BotInlineDisabledError,
-     BotInvalidError,
-     BotMethodInvalidError,
-     BotMissingError,
-     BotPaymentsDisabledError,
-     BotPollsDisabledError,
-     BroadcastIdInvalidError,
-     ButtonDataInvalidError,
-     ButtonTypeInvalidError,
-     ButtonUrlInvalidError,
-     CallAlreadyAcceptedError,
-     CallAlreadyDeclinedError,
-     CallOccupyFailedError,
-     CallPeerInvalidError,
-     CallProtocolFlagsInvalidError,
-     CdnMethodInvalidError,
-     ChannelsAdminPublicTooMuchError,
-     ChannelsTooMuchError,
-     ChannelInvalidError,
-     ChannelPrivateError,
-     ChannelPublicGroupNaError,
-     ChatAboutNotModifiedError,
-     ChatAboutTooLongError,
-     ChatAdminInviteRequiredError,
-     ChatAdminRequiredError,
-     ChatForbiddenError,
-     ChatIdEmptyError,
-     ChatIdInvalidError,
-     ChatInvalidError,
-     ChatLinkExistsError,
-     ChatNotModifiedError,
-     ChatRestrictedError,
-     ChatSendGifsForbiddenError,
-     ChatSendInlineForbiddenError,
-     ChatSendMediaForbiddenError,
-     ChatSendStickersForbiddenError,
-     ChatTitleEmptyError,
-     ChatWriteForbiddenError,
-     CodeEmptyError,
-     CodeHashInvalidError,
-     CodeInvalidError,
-     ConnectionApiIdInvalidError,
-     ConnectionDeviceModelEmptyError,
-     ConnectionLangPackInvalidError,
-     ConnectionLayerInvalidError,
-     ConnectionNotInitedError,
-     ConnectionSystemEmptyError,
-     ContactIdInvalidError,
-     DataInvalidError,
-     DataJsonInvalidError,
-     DateEmptyError,
-     DcIdInvalidError,
-     DhGAInvalidError,
-     EmailHashExpiredError,
-     EmailInvalidError,
-     EmoticonEmptyError,
-     EncryptedMessageInvalidError,
-     EncryptionAlreadyAcceptedError,
-     EncryptionAlreadyDeclinedError,
-     EncryptionDeclinedError,
-     EncryptionIdInvalidError,
-     EncryptionOccupyFailedError,
-     EntitiesTooLongError,
-     EntityMentionUserInvalidError,
-     ErrorTextEmptyError,
-     ExportCardInvalidError,
-     ExternalUrlInvalidError,
-     FieldNameEmptyError,
-     FieldNameInvalidError,
-     FileIdInvalidError,
-     FilePartsInvalidError,
-     FilePart0MissingError,
-     FilePartEmptyError,
-     FilePartInvalidError,
-     FilePartLengthInvalidError,
-     FilePartSizeInvalidError,
-     FilerefUpgradeNeededError,
-     FirstNameInvalidError,
-     FolderIdEmptyError,
-     FolderIdInvalidError,
-     FreshResetAuthorisationForbiddenError,
-     GifIdInvalidError,
-     GroupedMediaInvalidError,
-     HashInvalidError,
-     HistoryGetFailedError,
-     ImageProcessFailedError,
-     InlineResultExpiredError,
-     InputConstructorInvalidError,
-     InputFetchErrorError,
-     InputFetchFailError,
-     InputLayerInvalidError,
-     InputMethodInvalidError,
-     InputRequestTooLongError,
-     InputUserDeactivatedError,
-     InviteHashEmptyError,
-     InviteHashExpiredError,
-     InviteHashInvalidError,
-     LangPackInvalidError,
-     LastnameInvalidError,
-     LimitInvalidError,
-     LinkNotModifiedError,
-     LocationInvalidError,
-     MaxIdInvalidError,
-     MaxQtsInvalidError,
-     Md5ChecksumInvalidError,
-     MediaCaptionTooLongError,
-     MediaEmptyError,
-     MediaInvalidError,
-     MediaNewInvalidError,
-     MediaPrevInvalidError,
-     MegagroupIdInvalidError,
-     MegagroupPrehistoryHiddenError,
-     MemberNoLocationError,
-     MemberOccupyPrimaryLocFailedError,
-     MessageAuthorRequiredError,
-     MessageDeleteForbiddenError,
-     MessageEditTimeExpiredError,
-     MessageEmptyError,
-     MessageIdsEmptyError,
-     MessageIdInvalidError,
-     MessageNotModifiedError,
-     MessageTooLongError,
-     MsgWaitFailedError,
-     MtSendQueueTooLongError,
-     NeedChatInvalidError,
-     NeedMemberInvalidError,
-     NewSaltInvalidError,
-     NewSettingsInvalidError,
-     OffsetInvalidError,
-     OffsetPeerIdInvalidError,
-     OptionsTooMuchError,
-     PackShortNameInvalidError,
-     PackShortNameOccupiedError,
-     ParticipantsTooFewError,
-     ParticipantCallFailedError,
-     ParticipantVersionOutdatedError,
-     PasswordEmptyError,
-     PasswordHashInvalidError,
-     PasswordRequiredError,
-     PaymentProviderInvalidError,
-     PeerFloodError,
-     PeerIdInvalidError,
-     PeerIdNotSupportedError,
-     PersistentTimestampEmptyError,
-     PersistentTimestampInvalidError,
-     PersistentTimestampOutdatedError,
-     PhoneCodeEmptyError,
-     PhoneCodeExpiredError,
-     PhoneCodeHashEmptyError,
-     PhoneCodeInvalidError,
-     PhoneNumberAppSignupForbiddenError,
-     PhoneNumberBannedError,
-     PhoneNumberFloodError,
-     PhoneNumberInvalidError,
-     PhoneNumberOccupiedError,
-     PhoneNumberUnoccupiedError,
-     PhonePasswordFloodError,
-     PhonePasswordProtectedError,
-     PhotoContentUrlEmptyError,
-     PhotoCropSizeSmallError,
-     PhotoExtInvalidError,
-     PhotoInvalidError,
-     PhotoInvalidDimensionsError,
-     PhotoSaveFileInvalidError,
-     PhotoThumbUrlEmptyError,
-     PinRestrictedError,
-     PollOptionDuplicateError,
-     PollUnsupportedError,
-     PrivacyKeyInvalidError,
-     PtsChangeEmptyError,
-     QueryIdEmptyError,
-     QueryIdInvalidError,
-     QueryTooShortError,
-     RandomIdDuplicateError,
-     RandomIdInvalidError,
-     RandomLengthInvalidError,
-     RangesInvalidError,
-     ReactionEmptyError,
-     ReactionInvalidError,
-     RegIdGenerateFailedError,
-     ReplyMarkupInvalidError,
-     ReplyMarkupTooLongError,
-     ResultIdDuplicateError,
-     ResultTypeInvalidError,
-     ResultsTooMuchError,
-     RightForbiddenError,
-     RpcCallFailError,
-     RpcMcgetFailError,
-     RsaDecryptFailedError,
-     ScheduleDateTooLateError,
-     ScheduleTooMuchError,
-     SearchQueryEmptyError,
-     SecondsInvalidError,
-     SendMessageMediaInvalidError,
-     SendMessageTypeInvalidError,
-     SessionExpiredError,
-     SessionPasswordNeededError,
-     SessionRevokedError,
-     Sha256HashInvalidError,
-     ShortnameOccupyFailedError,
-     StartParamEmptyError,
-     StartParamInvalidError,
-     StickersetInvalidError,
-     StickersEmptyError,
-     StickerEmojiInvalidError,
-     StickerFileInvalidError,
-     StickerIdInvalidError,
-     StickerInvalidError,
-     StickerPngDimensionsError,
-     StorageCheckFailedError,
-     StoreInvalidScalarTypeError,
-     TakeoutInvalidError,
-     TakeoutRequiredError,
-     TempAuthKeyEmptyError,
-     TimeoutError,
-     TmpPasswordDisabledError,
-     TokenInvalidError,
-     TtlDaysInvalidError,
-     TypesEmptyError,
-     TypeConstructorInvalidError,
-     UnknownMethodError,
-     UntilDateInvalidError,
-     UrlInvalidError,
-     UsernameInvalidError,
-     UsernameNotModifiedError,
-     UsernameNotOccupiedError,
-     UsernameOccupiedError,
-     UsersTooFewError,
-     UsersTooMuchError,
-     UserAdminInvalidError,
-     UserAlreadyParticipantError,
-     UserBannedInChannelError,
-     UserBlockedError,
-     UserBotError,
-     UserBotInvalidError,
-     UserBotRequiredError,
-     UserChannelsTooMuchError,
-     UserCreatorError,
-     UserDeactivatedError,
-     UserDeactivatedBanError,
-     UserIdInvalidError,
-     UserInvalidError,
-     UserIsBlockedError,
-     UserIsBotError,
-     UserKickedError,
-     UserNotMutualContactError,
-     UserNotParticipantError,
-     UserPrivacyRestrictedError,
-     UserRestrictedError,
-     VideoContentTypeInvalidError,
-     WallpaperFileInvalidError,
-     WallpaperInvalidError,
-     WcConvertUrlInvalidError,
-     WebpageCurlFailedError,
-     WebpageMediaEmptyError,
-     WorkerBusyTooLongRetryError,
-     YouBlockedUserError,
-     rpcErrorsObject,
-     rpcErrorRe,
+    [/NETWORK_MIGRATE_(\d+)/, NetworkMigrateError],
+
+]
+module.exports = {
+    rpcErrorRe,
+    FileMigrateError,
+    FloodTestPhoneWaitError,
+    FloodWaitError,
+    PhoneMigrateError,
+    SlowModeWaitError,
+    UserMigrateError,
+    NetworkMigrateError
 }

+ 27 - 0
src/lib/gramjs/errors/index.js

@@ -0,0 +1,27 @@
+/**
+ * Converts a Telegram's RPC Error to a Python error.
+ * @param rpcError the RPCError instance
+ * @param request the request that caused this error
+ * @constructor the RPCError as a Python exception that represents this error
+ */
+const { RPCError } = require("./RPCBaseErrors")
+const { rpcErrorRe } = require('./RPCErrorList')
+
+function RPCMessageToError(rpcError, request) {
+    for (const [msgRegex, Cls] of rpcErrorRe) {
+        const m = rpcError.errorMessage.match(msgRegex)
+        if (m) {
+            const capture = m.length === 2 ? parseInt(m[1]) : null
+            return new Cls({ request: request, capture: capture })
+        }
+    }
+    return new RPCError(request, rpcError)
+
+}
+
+module.exports = {
+    RPCMessageToError,
+    ...require('./Common'),
+    ...require('./RPCBaseErrors'),
+    ...require('./RPCErrorList'),
+}

+ 92 - 0
src/lib/gramjs/events/NewMessage.js

@@ -0,0 +1,92 @@
+const { EventBuilder, EventCommon } = require('./common')
+const { constructors } = require('../tl')
+
+class NewMessage extends EventBuilder {
+    constructor(args = {
+        chats: null,
+        func: null,
+    }) {
+        super(args)
+
+        this.chats = args.chats
+        this.func = args.func
+        this._noCheck = true
+    }
+
+    async _resolve(client) {
+        await super._resolve(client)
+        // this.fromUsers = await _intoIdSet(client, this.fromUsers)
+    }
+
+    build(update, others = null, thisId = null) {
+        let event
+        if (update instanceof constructors.UpdateNewMessage || update instanceof constructors.UpdateNewChannelMessage) {
+            if (!(update.message instanceof constructors.Message)) {
+                return
+            }
+            event = new Event(update.message)
+        } else if (update instanceof constructors.UpdateShortMessage) {
+            event = new Event(new constructors.Message({
+                out: update.out,
+                mentioned: update.mentioned,
+                mediaUnread: update.mediaUnread,
+                silent: update.silent,
+                id: update.id,
+                // Note that to_id/from_id complement each other in private
+                // messages, depending on whether the message was outgoing.
+                toId: new constructors.PeerUser(update.out ? update.userId : thisId),
+                fromId: update.out ? thisId : update.userId,
+                message: update.message,
+                date: update.date,
+                fwdFrom: update.fwdFrom,
+                viaBotId: update.viaBotId,
+                replyToMsgId: update.replyToMsgId,
+                entities: update.entities,
+            }))
+        } else if (update instanceof constructors.UpdateShortChatMessage) {
+            event = new this.Event(new constructors.Message({
+                out: update.out,
+                mentioned: update.mentioned,
+                mediaUnread: update.mediaUnread,
+                silent: update.silent,
+                id: update.id,
+                toId: new constructors.PeerChat(update.chatId),
+                fromId: update.fromId,
+                message: update.message,
+                date: update.date,
+                fwdFrom: update.fwdFrom,
+                viaBotId: update.viaBotId,
+                replyToMsgId: update.replyToMsgId,
+                entities: update.entities,
+            }))
+        } else {
+            return
+        }
+
+        // Make messages sent to ourselves outgoing unless they're forwarded.
+        // This makes it consistent with official client's appearance.
+        const ori = event.message
+        if (ori.toId instanceof constructors.PeerUser) {
+            if (ori.fromId === ori.toId.userId && !ori.fwdFrom) {
+                event.message.out = true
+            }
+        }
+        return event
+    }
+
+    filter(event) {
+        if (this._noCheck) {
+            return event
+        }
+        return event
+    }
+}
+
+class Event extends EventCommon {
+    constructor(message) {
+        super()
+        this.message = message
+    }
+}
+
+module.exports = NewMessage

+ 3 - 5
src/lib/gramjs/extensions/MessagePacker.js

@@ -1,6 +1,5 @@
 const MessageContainer = require('../tl/core/MessageContainer')
 const TLMessage = require('../tl/core/TLMessage')
-const { TLRequest } = require('../tl/tlobject')
 const BinaryWriter = require('../extensions/BinaryWriter')
 const struct = require('python-struct')
 
@@ -52,11 +51,10 @@ class MessagePacker {
                     afterId = state.after.msgId
                 }
                 state.msgId = await this._state.writeDataAsMessage(
-                    buffer, state.data, state.request instanceof TLRequest,
+                    buffer, state.data, state.request.classType==='request',
                     afterId,
                 )
-
-                this._log.debug(`Assigned msgId = ${state.msgId} to ${state.request.constructor.name}`)
+                this._log.debug(`Assigned msgId = ${state.msgId} to ${state.request.className || state.request.constructor.name}`)
                 batch.push(state)
                 continue
             }
@@ -64,7 +62,7 @@ class MessagePacker {
                 this._queue.unshift(state)
                 break
             }
-            this._log.warn(`Message payload for ${state.request.constructor.name} is too long ${state.data.length} and cannot be sent`)
+            this._log.warn(`Message payload for ${state.request.className || state.request.constructor.name} is too long ${state.data.length} and cannot be sent`)
             state.promise.reject('Request Payload is too big')
             size = 0
             continue

+ 22 - 0
src/lib/gramjs/index.d.ts

@@ -0,0 +1,22 @@
+export * from './tl/gramJsApi';
+export { default as gramJsApi } from './tl/gramJsApi';
+
+export { default as TelegramClient } from './client/TelegramClient';
+
+import connection from './network';
+import tl from './tl';
+import version from './Version';
+import events from './events';
+import utils from './Utils';
+import errors from './errors';
+import session from './sessions';
+
+export {
+    session,
+    connection,
+    tl,
+    version,
+    events,
+    utils,
+    errors,
+};

+ 6 - 1
src/lib/gramjs/index.js

@@ -1,7 +1,12 @@
+<<<<<<< HEAD
 require('regenerator-runtime/runtime')
 require('regenerator-runtime')
+=======
+const gramJsApi = require('./tl/gramJsApi')
+>>>>>>> f70d85dd... Gram JS: Replace generated `tl/*` contents with runtime logic; TypeScript typings
 
 const TelegramClient = require('./client/TelegramClient')
+
 const connection = require('./network')
 const tl = require('./tl')
 const version = require('./Version')
@@ -12,6 +17,6 @@ const session = require('./sessions')
 const extensions = require('./extensions')
 
 module.exports = {
-    TelegramClient, session, connection, extensions,
+    gramJsApi, TelegramClient, session, connection, extensions,
     tl, version, events, utils, errors,
 }

+ 17 - 28
src/lib/gramjs/network/Authenticator.js

@@ -1,23 +1,12 @@
-const BigInt = require('big-integer');
+const BigInt = require('big-integer')
 const AES = require('../crypto/AES')
 const AuthKey = require('../crypto/AuthKey')
 const Factorizator = require('../crypto/Factorizator')
 const RSA = require('../crypto/RSA')
 const Helpers = require('../Helpers')
-const { ServerDHParamsFail } = require('../tl/types')
-const { ServerDHParamsOk } = require('../tl/types')
-const { ReqDHParamsRequest } = require('../tl/functions')
-const { SecurityError } = require('../errors/Common')
-const { PQInnerData } = require('../tl/types')
+const { constructors, requests } = require('../tl')
 const BinaryReader = require('../extensions/BinaryReader')
-const { ClientDHInnerData } = require('../tl/types')
-const { DhGenFail } = require('../tl/types')
-const { DhGenRetry } = require('../tl/types')
-const { DhGenOk } = require('../tl/types')
-const { SetClientDHParamsRequest } = require('../tl/functions')
-const { ServerDHInnerData } = require('../tl/types')
-const { ResPQ } = require('../tl/types')
-const { ReqPqMultiRequest } = require('../tl/functions')
+const { SecurityError } = require("../errors/Common")
 
 /**
  * Executes the authentication process with the Telegram servers.
@@ -31,13 +20,13 @@ async function doAuthentication(sender, log) {
 
     const nonce = Helpers.readBigIntFromBuffer(bytes, false, true)
 
-    const resPQ = await sender.send(new ReqPqMultiRequest({ nonce: nonce }))
+    const resPQ = await sender.send(new requests.ReqPqMultiRequest({ nonce: nonce }))
     log.debug('Starting authKey generation step 1')
 
-    if (!(resPQ instanceof ResPQ)) {
+    if (!(resPQ instanceof constructors.ResPQ)) {
         throw new Error(`Step 1 answer was ${resPQ}`)
     }
-    if (resPQ.nonce.neq(nonce)){
+    if (resPQ.nonce.neq(nonce)) {
         throw new SecurityError('Step 1 invalid nonce from server')
     }
     const pq = Helpers.readBigIntFromBuffer(resPQ.pq, false, true)
@@ -53,7 +42,7 @@ async function doAuthentication(sender, log) {
     bytes = Helpers.generateRandomBytes(32)
     const newNonce = Helpers.readBigIntFromBuffer(bytes, true, true)
 
-    const pqInnerData = new PQInnerData({
+    const pqInnerData = new constructors.PQInnerData({
         pq: Helpers.getByteArray(pq), // unsigned
         p: p,
         q: q,
@@ -77,7 +66,7 @@ async function doAuthentication(sender, log) {
     }
 
     const serverDhParams = await sender.send(
-        new ReqDHParamsRequest({
+        new requests.ReqDHParamsRequest({
             nonce: resPQ.nonce,
             serverNonce: resPQ.serverNonce,
             p: p,
@@ -86,7 +75,7 @@ async function doAuthentication(sender, log) {
             encryptedData: cipherText,
         }),
     )
-    if (!(serverDhParams instanceof ServerDHParamsOk || serverDhParams instanceof ServerDHParamsFail)) {
+    if (!(serverDhParams instanceof constructors.ServerDHParamsOk || serverDhParams instanceof constructors.ServerDHParamsFail)) {
         throw new Error(`Step 2.1 answer was ${serverDhParams}`)
     }
     if (serverDhParams.nonce.neq(resPQ.nonce)) {
@@ -97,14 +86,14 @@ async function doAuthentication(sender, log) {
         throw new SecurityError('Step 2 invalid server nonce from server')
     }
 
-    if (serverDhParams instanceof ServerDHParamsFail) {
+    if (serverDhParams instanceof constructors.ServerDHParamsFail) {
         const sh = Helpers.sha1(Helpers.readBufferFromBigInt(newNonce, 32, true, true).slice(4, 20))
         const nnh = Helpers.readBigIntFromBuffer(sh, true, true)
         if (serverDhParams.newNonceHash.neq(nnh)) {
             throw new SecurityError('Step 2 invalid DH fail nonce from server')
         }
     }
-    if (!(serverDhParams instanceof ServerDHParamsOk)) {
+    if (!(serverDhParams instanceof constructors.ServerDHParamsOk)) {
         throw new Error(`Step 2.2 answer was ${serverDhParams}`)
     }
     log.debug('Finished authKey generation step 2')
@@ -120,7 +109,7 @@ async function doAuthentication(sender, log) {
     const reader = new BinaryReader(plainTextAnswer)
     reader.read(20) // hash sum
     const serverDhInner = reader.tgReadObject()
-    if (!(serverDhInner instanceof ServerDHInnerData)) {
+    if (!(serverDhInner instanceof constructors.ServerDHInnerData)) {
         throw new Error(`Step 3 answer was ${serverDhInner}`)
     }
 
@@ -138,24 +127,24 @@ async function doAuthentication(sender, log) {
     const gab = Helpers.modExp(ga, b, dhPrime)
 
     // Prepare client DH Inner Data
-    const clientDhInner = new ClientDHInnerData({
+    const clientDhInner = new constructors.ClientDHInnerData({
         nonce: resPQ.nonce,
         serverNonce: resPQ.serverNonce,
         retryId: 0, // TODO Actual retry ID
         gB: Helpers.getByteArray(gb, false),
     }).getBytes()
 
-    const clientDdhInnerHashed = Buffer.concat([ Helpers.sha1(clientDhInner), clientDhInner ])
+    const clientDdhInnerHashed = Buffer.concat([Helpers.sha1(clientDhInner), clientDhInner])
     // Encryption
     const clientDhEncrypted = AES.encryptIge(clientDdhInnerHashed, key, iv)
     const dhGen = await sender.send(
-        new SetClientDHParamsRequest({
+        new requests.SetClientDHParamsRequest({
             nonce: resPQ.nonce,
             serverNonce: resPQ.serverNonce,
             encryptedData: clientDhEncrypted,
         }),
     )
-    const nonceTypes = [ DhGenOk, DhGenRetry, DhGenFail ]
+    const nonceTypes = [constructors.DhGenOk, constructors.DhGenRetry, constructors.DhGenFail]
     if (!(dhGen instanceof nonceTypes[0] || dhGen instanceof nonceTypes[1] || dhGen instanceof nonceTypes[2])) {
         throw new Error(`Step 3.1 answer was ${dhGen}`)
     }
@@ -176,7 +165,7 @@ async function doAuthentication(sender, log) {
         throw new SecurityError('Step 3 invalid new nonce hash')
     }
 
-    if (!(dhGen instanceof DhGenOk)) {
+    if (!(dhGen instanceof constructors.DhGenOk)) {
         throw new Error(`Step 3.2 answer was ${dhGen}`)
     }
     log.debug('Finished authKey generation step 3')

+ 14 - 16
src/lib/gramjs/network/MTProtoSender.js

@@ -5,13 +5,13 @@ const AuthKey = require('../crypto/AuthKey')
 const doAuthentication = require('./Authenticator')
 const RPCResult = require('../tl/core/RPCResult')
 const MessageContainer = require('../tl/core/MessageContainer')
-const { TLRequest } = require('../tl/tlobject')
 const GZIPPacked = require('../tl/core/GZIPPacked')
 const RequestState = require('./RequestState')
 const format = require('string-format')
-const { MsgsAck, File, MsgsStateInfo, Pong } = require('../tl/types')
+const { MsgsAck, File, MsgsStateInfo, Pong } = require('../tl').constructors
 const MessagePacker = require('../extensions/MessagePacker')
 const BinaryReader = require('../extensions/BinaryReader')
+const { BadMessageError } = require("../errors/Common")
 const {
     BadServerSalt,
     BadMsgNotification,
@@ -22,14 +22,13 @@ const {
     MsgsStateReq,
     MsgResendReq,
     MsgsAllInfo,
-} = require('../tl/types')
+} = require('../tl').constructors
 const { SecurityError } = require('../errors/Common')
 const { InvalidBufferError } = require('../errors/Common')
-const { LogOutRequest } = require('../tl/functions/auth')
+const { LogOutRequest } = require('../tl').requests.auth
 const { RPCMessageToError } = require('../errors')
 const { TypeNotFoundError } = require('../errors/Common')
 
-// const { tlobjects } = require("../gramjs/tl/alltlobjects");
 format.extend(String.prototype, {})
 
 /**
@@ -300,7 +299,7 @@ class MTProtoSender {
             const batch = res.batch
             this._log.debug(`Encrypting ${batch.length} message(s) in ${data.length} bytes for sending`)
 
-            data = this._state.encryptMessageData(data)
+            data = await this._state.encryptMessageData(data)
 
             try {
                 await this._connection.send(data)
@@ -311,12 +310,12 @@ class MTProtoSender {
             }
             for (const state of batch) {
                 if (!Array.isArray(state)) {
-                    if (state.request instanceof TLRequest) {
+                    if (state.request.classType === 'request') {
                         this._pending_state[state.msgId] = state
                     }
                 } else {
                     for (const s of state) {
-                        if (s.request instanceof TLRequest) {
+                        if (s.request.classType === 'request') {
                             this._pending_state[s.msgId] = s
                         }
                     }
@@ -525,10 +524,10 @@ class MTProtoSender {
     async _handleUpdate(message) {
         if (message.obj.SUBCLASS_OF_ID !== 0x8af52aac) {
             // crc32(b'Updates')
-            this._log.warn(`Note: ${message.obj.constructor.name} is not an update, not dispatching it`)
+            this._log.warn(`Note: ${message.obj.className} is not an update, not dispatching it`)
             return
         }
-        this._log.debug('Handling update ' + message.obj.constructor.name)
+        this._log.debug('Handling update ' + message.obj.className)
         if (this._updateCallback) {
             this._updateCallback(message.obj)
         }
@@ -584,7 +583,7 @@ class MTProtoSender {
     async _handleBadNotification(message) {
         const badMsg = message.obj
         const states = this._popStates(badMsg.badMsgId)
-        this._log.debug(`Handling bad msg ${badMsg}`)
+        this._log.debug(`Handling bad msg ${JSON.stringify(badMsg)}`)
         if ([16, 17].includes(badMsg.errorCode)) {
             // Sent msg_id too low or too high (respectively).
             // Use the current msg_id to determine the right time offset.
@@ -598,11 +597,10 @@ class MTProtoSender {
             // msg_seqno too high never seems to happen but just in case
             this._state._sequence -= 16
         } else {
-            // for (const state of states) {
-            // TODO set errors;
-            /* state.future.set_exception(
-            BadMessageError(state.request, bad_msg.error_code))*/
-            // }
+
+            for (const state of states){
+                state.reject(new BadMessageError(state.request,badMsg.errorCode))
+            }
 
             return
         }

+ 9 - 8
src/lib/gramjs/network/MTProtoState.js

@@ -3,9 +3,9 @@ const Helpers = require('../Helpers')
 const AES = require('../crypto/AES')
 const BinaryReader = require('../extensions/BinaryReader')
 const GZIPPacked = require('../tl/core/GZIPPacked')
-const {TLMessage} = require('../tl/core')
-const {SecurityError, InvalidBufferError} = require('../errors/Common')
-const {InvokeAfterMsgRequest} = require('../tl/functions')
+const { TLMessage } = require('../tl/core')
+const { SecurityError, InvalidBufferError } = require('../errors/Common')
+const { InvokeAfterMsgRequest } = require('../tl').requests
 const BigInt = require('big-integer')
 
 class MTProtoState {
@@ -77,7 +77,7 @@ class MTProtoState {
 
         const key = Buffer.concat([sha256a.slice(0, 8), sha256b.slice(8, 24), sha256a.slice(24, 32)])
         const iv = Buffer.concat([sha256b.slice(0, 8), sha256a.slice(8, 24), sha256b.slice(24, 32)])
-        return {key, iv}
+        return { key, iv }
     }
 
     /**
@@ -95,7 +95,7 @@ class MTProtoState {
         if (!afterId) {
             body = await GZIPPacked.gzipIfSmaller(contentRelated, data)
         } else {
-            body = await GZIPPacked.gzipIfSmaller(contentRelated, new InvokeAfterMsgRequest(afterId, data).toBuffer())
+            body = await GZIPPacked.gzipIfSmaller(contentRelated, new InvokeAfterMsgRequest(afterId, data).getBytes())
         }
         buffer.write(struct.pack('<qii', msgId.toString(), seqNo, body.length))
         buffer.write(body)
@@ -107,7 +107,8 @@ class MTProtoState {
      * following MTProto 2.0 guidelines core.telegram.org/mtproto/description.
      * @param data
      */
-    encryptMessageData(data) {
+    async encryptMessageData(data) {
+        await this.authKey.waitForKey()
         data = Buffer.concat([struct.pack('<qq', this.salt.toString(), this.id.toString()), data])
         const padding = Helpers.generateRandomBytes(Helpers.mod(-(data.length + 12), 16) + 12)
         // Being substr(what, offset, length); x = 0 for client
@@ -116,7 +117,7 @@ class MTProtoState {
         // "msg_key = substr (msg_key_large, 8, 16)"
         const msgKey = msgKeyLarge.slice(8, 24)
 
-        const {iv, key} = this._calcKey(this.authKey.key, msgKey, true)
+        const { iv, key } = this._calcKey(this.authKey.key, msgKey, true)
 
         const keyId = Helpers.readBufferFromBigInt(this.authKey.keyId, 8)
         return Buffer.concat([keyId, msgKey, AES.encryptIge(Buffer.concat([data, padding]), key, iv)])
@@ -138,7 +139,7 @@ class MTProtoState {
         }
 
         const msgKey = body.slice(8, 24)
-        const {iv, key} = this._calcKey(this.authKey.key, msgKey, false)
+        const { iv, key } = this._calcKey(this.authKey.key, msgKey, false)
         body = AES.decryptIge(body.slice(24), key, iv)
 
         // https://core.telegram.org/mtproto/security_guidelines

+ 46 - 103
src/lib/gramjs/sessions/JSONSession.js → src/lib/gramjs/sessions/Memory.js

@@ -1,61 +1,31 @@
-const { generateRandomLong, getRandomInt } = require('../Helpers')
-const fs = require('fs').promises
-const { existsSync, readFileSync } = require('fs')
-const AuthKey = require('../crypto/AuthKey')
-const { TLObject } = require('../tl/tlobject')
 const utils = require('../Utils')
-const types = require('../tl/types')
-const BigInt = require('big-integer')
+const types = require('../tl').constructors
+const Session = require('./Abstract')
 
-BigInt.toJSON = function () {
-    return { fool: this.fool.toString('hex') }
-}
-BigInt.parseJson = function () {
-    return { fool: BigInt(this.fool, 16) }
-}
+class MemorySession extends Session {
+    constructor() {
+        super()
 
-class Session {
-    constructor(sessionUserId) {
-        this.sessionUserId = sessionUserId
         this._serverAddress = null
         this._dcId = 0
         this._port = null
-        // this.serverAddress = "localhost";
-        // this.port = 21;
-        this.authKey = undefined
-        this.id = generateRandomLong(false)
-        this.sequence = 0
-        this.salt = BigInt(0) // Unsigned long
-        this.timeOffset = BigInt(0)
-        this.lastMessageId = BigInt(0)
-        this.user = undefined
-        this._files = {}
+        this._authKey = null
+        this._takeoutId = null
+
         this._entities = new Set()
         this._updateStates = {}
     }
 
-    /**
-     * Saves the current session object as session_user_id.session
-     */
-    async save() {
-        if (this.sessionUserId) {
-            const str = JSON.stringify(this, function (key, value) {
-                if (value instanceof BigInt) {
-                    return value.toString() + 'n'
-                } else {
-                    return value
-                }
-            })
-            await fs.writeFile(`${this.sessionUserId}.session`, str)
-        }
-    }
-
     setDC(dcId, serverAddress, port) {
         this._dcId = dcId | 0
         this._serverAddress = serverAddress
         this._port = port
     }
 
+    get dcId() {
+        return this._dcId
+    }
+
     get serverAddress() {
         return this._serverAddress
     }
@@ -64,10 +34,23 @@ class Session {
         return this._port
     }
 
-    get dcId() {
-        return this._dcId
+    get authKey() {
+        return this._authKey
     }
 
+    set authKey(value) {
+        this._authKey = value
+    }
+
+    get takeoutId() {
+        return this._takeoutId
+    }
+
+    set takeoutId(value) {
+        this._takeoutId = value
+    }
+
+
     getUpdateState(entityId) {
         return this._updateStates[entityId]
     }
@@ -79,6 +62,9 @@ class Session {
     close() {
     }
 
+    save() {
+    }
+
     delete() {
     }
 
@@ -86,11 +72,11 @@ class Session {
         // While this is a simple implementation it might be overrode by,
         // other classes so they don't need to implement the plural form
         // of the method. Don't remove.
-        return [ id, hash, username, phone, name ]
+        return [id, hash, username, phone, name]
     }
 
     _entityToRow(e) {
-        if (!(e instanceof TLObject)) {
+        if (!(e.classType==="constructor")) {
             return
         }
         let p
@@ -125,7 +111,7 @@ class Session {
 
     _entitiesToRows(tlo) {
         let entities = []
-        if (tlo instanceof TLObject && utils.isListLike(tlo)) {
+        if (tlo.classType==="constructor" && utils.isListLike(tlo)) {
             // This may be a list of users already for instance
             entities = tlo
         } else {
@@ -149,49 +135,6 @@ class Session {
         return rows
     }
 
-
-    static tryLoadOrCreateNew(sessionUserId) {
-        if (sessionUserId === undefined) {
-            return new Session()
-        }
-        const filepath = `${sessionUserId}.session`
-
-
-        if (existsSync(filepath)) {
-            try {
-                const ob = JSON.parse(readFileSync(filepath, 'utf-8'), function (key, value) {
-                    if (typeof value == 'string' && value.match(/(\d+)n/)) {
-                        return BigInt(value.slice(0, -1))
-                    } else {
-                        return value
-                    }
-                })
-
-                const authKey = new AuthKey(Buffer.from(ob.authKey._key.data))
-                const session = new Session(ob.sessionUserId)
-                session._serverAddress = ob._serverAddress
-                session._port = ob._port
-                session._dcId = ob._dcId
-
-                // this.serverAddress = "localhost";
-                // this.port = 21;
-                session.authKey = authKey
-                session.id = ob.id
-                session.sequence = ob.sequence
-                session.salt = ob.salt // Unsigned long
-                session.timeOffset = ob.timeOffset
-                session.lastMessageId = ob.lastMessageId
-                session.user = ob.user
-                return session
-            } catch (e) {
-                return new Session(sessionUserId)
-            }
-        } else {
-            return new Session(sessionUserId)
-        }
-    }
-
-
     processEntities(tlo) {
         const entitiesSet = this._entitiesToRows(tlo)
         for (const e of entitiesSet) {
@@ -202,23 +145,23 @@ class Session {
     getEntityRowsByPhone(phone) {
         for (const e of this._entities) { // id, hash, username, phone, name
             if (e[3] === phone) {
-                return [ e[0], e[1] ]
+                return [e[0], e[1]]
             }
         }
     }
 
-    getEntityRowsByName(name) {
+    getEntityRowsByUsername(username) {
         for (const e of this._entities) { // id, hash, username, phone, name
-            if (e[4] === name) {
-                return [ e[0], e[1] ]
+            if (e[2] === username) {
+                return [e[0], e[1]]
             }
         }
     }
 
-    getEntityRowsByUsername(username) {
+    getEntityRowsByName(name) {
         for (const e of this._entities) { // id, hash, username, phone, name
-            if (e[2] === username) {
-                return [ e[0], e[1] ]
+            if (e[4] === name) {
+                return [e[0], e[1]]
             }
         }
     }
@@ -227,17 +170,17 @@ class Session {
         if (exact) {
             for (const e of this._entities) { // id, hash, username, phone, name
                 if (e[0] === id) {
-                    return [ e[0], e[1] ]
+                    return [e[0], e[1]]
                 }
             }
         } else {
-            const ids = [ utils.getPeerId(new types.PeerUser({ userId: id })),
+            const ids = [utils.getPeerId(new types.PeerUser({ userId: id })),
                 utils.getPeerId(new types.PeerChat({ chatId: id })),
                 utils.getPeerId(new types.PeerChannel({ channelId: id })),
             ]
             for (const e of this._entities) { // id, hash, username, phone, name
                 if (ids.includes(e[0])) {
-                    return [ e[0], e[1] ]
+                    return [e[0], e[1]]
                 }
             }
         }
@@ -246,7 +189,7 @@ class Session {
     getInputEntity(key) {
         let exact
         if (key.SUBCLASS_OF_ID !== undefined) {
-            if ([ 0xc91c90b6, 0xe669bf46, 0x40f202fd ].includes(key.SUBCLASS_OF_ID)) {
+            if ([0xc91c90b6, 0xe669bf46, 0x40f202fd].includes(key.SUBCLASS_OF_ID)) {
                 // hex(crc32(b'InputPeer', b'InputUser' and b'InputChannel'))
                 // We already have an Input version, so nothing else required
                 return key
@@ -255,7 +198,7 @@ class Session {
             return utils.getInputPeer(key)
         } else {
             // Not a TLObject or can't be cast into InputPeer
-            if (key instanceof TLObject) {
+            if (key.classType==='constructor') {
                 key = utils.getPeerId(key)
                 exact = true
             } else {
@@ -305,4 +248,4 @@ class Session {
     }
 }
 
-module.exports = Session
+module.exports = MemorySession

+ 6 - 0
src/lib/gramjs/sessions/index.js

@@ -0,0 +1,6 @@
+const Memory = require('./Memory')
+const StringSession = require('./StringSession')
+module.exports = {
+    Memory,
+    StringSession,
+}

+ 19 - 0
src/lib/gramjs/tl/AllTLObjects.js

@@ -0,0 +1,19 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+
+const { constructors, requests, patched } = require('./index');
+const LAYER = 105;
+const tlobjects = {}
+for (const tl of [...Object.values(constructors), ...Object.values(requests)]) {
+    if (tl.CONSTRUCTOR_ID) {
+        tlobjects[tl.CONSTRUCTOR_ID] = tl
+    } else {
+        for (const sub of Object.values(tl)) {
+            tlobjects[sub.CONSTRUCTOR_ID] = sub
+        }
+    }
+}
+
+module.exports = {
+    LAYER,
+    tlobjects
+};

+ 46 - 0
src/lib/gramjs/tl/core/GZIPPacked.js

@@ -0,0 +1,46 @@
+const struct = require('python-struct')
+const { serializeBytes } = require("../index")
+const { ungzip } = require('node-gzip')
+const { gzip } = require('node-gzip')
+
+class GZIPPacked {
+    static CONSTRUCTOR_ID = 0x3072cfa1;
+    static classType = "constructor"
+
+    constructor(data) {
+        this.data = data
+        this.CONSTRUCTOR_ID = 0x3072cfa1
+        this.classType = "constructor"
+    }
+
+    static async gzipIfSmaller(contentRelated, data) {
+        if (contentRelated && data.length > 512) {
+            const gzipped = await new GZIPPacked(data).toBytes()
+            if (gzipped.length < data.length) {
+                return gzipped
+            }
+        }
+        return data
+    }
+
+    async toBytes() {
+        return Buffer.concat([
+            struct.pack('<I', GZIPPacked.CONSTRUCTOR_ID),
+            serializeBytes(await gzip(this.data)),
+        ])
+    }
+
+    static async read(reader) {
+        const constructor = reader.readInt(false)
+        if (constructor !== GZIPPacked.CONSTRUCTOR_ID) {
+            throw new Error('not equal')
+        }
+        return await gzip(reader.tgReadBytes())
+    }
+
+    static async fromReader(reader) {
+        return new GZIPPacked(await ungzip(reader.tgReadBytes()))
+    }
+}
+
+module.exports = GZIPPacked

+ 45 - 0
src/lib/gramjs/tl/core/MessageContainer.js

@@ -0,0 +1,45 @@
+const TLMessage = require('./TLMessage')
+
+class MessageContainer {
+    static CONSTRUCTOR_ID = 0x73f1f8dc;
+    static classType = "constructor"
+    // Maximum size in bytes for the inner payload of the container.
+    // Telegram will close the connection if the payload is bigger.
+    // The overhead of the container itself is subtracted.
+    static MAXIMUM_SIZE = 1044456 - 8;
+
+    // Maximum amount of messages that can't be sent inside a single
+    // container, inclusive. Beyond this limit Telegram will respond
+    // with BAD_MESSAGE 64 (invalid container).
+    //
+    // This limit is not 100% accurate and may in some cases be higher.
+    // However, sending up to 100 requests at once in a single container
+    // is a reasonable conservative value, since it could also depend on
+    // other factors like size per request, but we cannot know this.
+    static MAXIMUM_LENGTH = 100;
+
+    constructor(messages) {
+
+        this.CONSTRUCTOR_ID = 0x73f1f8dc
+        this.messages = messages
+        this.classType = "constructor"
+    }
+
+    static async fromReader(reader) {
+        const messages = []
+        const length = reader.readInt()
+        for (let x = 0; x < length; x++) {
+            const msgId = reader.readLong()
+            const seqNo = reader.readInt()
+            const length = reader.readInt()
+            const before = reader.tellPosition()
+            const obj = reader.tgReadObject()
+            reader.setPosition(before + length)
+            const tlMessage = new TLMessage(msgId, seqNo, obj)
+            messages.push(tlMessage)
+        }
+        return new MessageContainer(messages)
+    }
+}
+
+module.exports = MessageContainer

+ 33 - 0
src/lib/gramjs/tl/core/RPCResult.js

@@ -0,0 +1,33 @@
+const { RpcError } = require('../index').constructors
+const GZIPPacked = require('./GZIPPacked')
+
+class RPCResult {
+    static CONSTRUCTOR_ID = 0xf35c6d01;
+    static classType = "constructor"
+
+    constructor(reqMsgId, body, error) {
+        this.CONSTRUCTOR_ID = 0xf35c6d01
+        this.reqMsgId = reqMsgId
+        this.body = body
+        this.error = error
+        this.classType = "constructor"
+    }
+
+    static async fromReader(reader) {
+        const msgId = reader.readLong()
+        const innerCode = reader.readInt(false)
+        if (innerCode === RpcError.CONSTRUCTOR_ID) {
+            return new RPCResult(msgId, null, RpcError.fromReader(reader))
+        }
+        if (innerCode === GZIPPacked.CONSTRUCTOR_ID) {
+            return new RPCResult(msgId, (await GZIPPacked.fromReader(reader)).data)
+        }
+        reader.seek(-4)
+        // This reader.read() will read more than necessary, but it's okay.
+        // We could make use of MessageContainer's length here, but since
+        // it's not necessary we don't need to care about it.
+        return new RPCResult(msgId, reader.read(), null)
+    }
+}
+
+module.exports = RPCResult

+ 14 - 0
src/lib/gramjs/tl/core/TLMessage.js

@@ -0,0 +1,14 @@
+
+class TLMessage {
+    static SIZE_OVERHEAD = 12;
+    static classType = "constructor"
+
+    constructor(msgId, seqNo, obj) {
+        this.msgId = msgId
+        this.seqNo = seqNo
+        this.obj = obj
+        this.classType = "constructor"
+    }
+}
+
+module.exports = TLMessage

+ 0 - 2333
src/lib/gramjs/tl/functions/account.js

@@ -1,2333 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class RegisterDeviceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x68976c6f;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x68976c6f;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.noMuted = args.noMuted || null;
-        this.tokenType = args.tokenType;
-        this.token = args.token;
-        this.appSandbox = args.appSandbox;
-        this.secret = args.secret;
-        this.otherUids = args.otherUids;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6f6c9768","hex"),
-            struct.pack('<I', (this.noMuted === undefined || this.noMuted === false || this.noMuted === null) ? 0 : 1),
-            struct.pack('<i', this.tokenType),
-            TLObject.serializeBytes(this.token),
-            this.appSandbox ? 0xb5757299 : 0x379779bc,
-            TLObject.serializeBytes(this.secret),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUids.length),Buffer.concat(this.otherUids.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _no_muted;
-        let _token_type;
-        let _token;
-        let _app_sandbox;
-        let _secret;
-        let _other_uids;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _no_muted = Boolean(flags & 1);
-        _token_type = reader.readInt();
-        _token = reader.tgReadString();
-        _app_sandbox = reader.tgReadBool();
-        _secret = reader.tgReadBytes();
-        reader.readInt();
-        _other_uids = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _other_uids.push(_x);
-            }
-            return new this({noMuted:_no_muted,
-	tokenType:_token_type,
-	token:_token,
-	appSandbox:_app_sandbox,
-	secret:_secret,
-	otherUids:_other_uids})
-        }
-    }
-
-
-class UnregisterDeviceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3076c4bf;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3076c4bf;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.tokenType = args.tokenType;
-        this.token = args.token;
-        this.otherUids = args.otherUids;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bfc47630","hex"),
-            struct.pack('<i', this.tokenType),
-            TLObject.serializeBytes(this.token),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUids.length),Buffer.concat(this.otherUids.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _token_type;
-        let _token;
-        let _other_uids;
-        let _x;
-        let len;
-        _token_type = reader.readInt();
-        _token = reader.tgReadString();
-        reader.readInt();
-        _other_uids = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _other_uids.push(_x);
-            }
-            return new this({tokenType:_token_type,
-	token:_token,
-	otherUids:_other_uids})
-        }
-    }
-
-
-class UpdateNotifySettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x84be5b93;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x84be5b93;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.settings = args.settings;
-    }
-    async resolve(client, utils) {
-        this.peer = await client._getInputNotify(this.peer)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("935bbe84","hex"),
-            this.peer.getBytes(),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _settings;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _settings = reader.tgReadObject();
-        return new this({peer:_peer,
-	settings:_settings})
-    }
-}
-
-
-class GetNotifySettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x12b3ad31;
-    static SUBCLASS_OF_ID = 0xcf20c074;
-
-    /**
-    :returns PeerNotifySettings: Instance of PeerNotifySettings
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x12b3ad31;
-        this.SUBCLASS_OF_ID = 0xcf20c074;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = await client._getInputNotify(this.peer)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("31adb312","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class ResetNotifySettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdb7e1747;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xdb7e1747;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("47177edb","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class UpdateProfileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x78515775;
-    static SUBCLASS_OF_ID = 0x2da17977;
-
-    /**
-    :returns User: Instance of either UserEmpty, User
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x78515775;
-        this.SUBCLASS_OF_ID = 0x2da17977;
-
-        this.firstName = args.firstName || null;
-        this.lastName = args.lastName || null;
-        this.about = args.about || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("75575178","hex"),
-            struct.pack('<I', (this.firstName === undefined || this.firstName === false || this.firstName === null) ? 0 : 1 | (this.lastName === undefined || this.lastName === false || this.lastName === null) ? 0 : 2 | (this.about === undefined || this.about === false || this.about === null) ? 0 : 4),
-            (this.firstName === undefined || this.firstName === false || this.firstName ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.firstName)],
-            (this.lastName === undefined || this.lastName === false || this.lastName ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.lastName)],
-            (this.about === undefined || this.about === false || this.about ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.about)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _first_name;
-        let _last_name;
-        let _about;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _first_name = reader.tgReadString();
-        }
-        else {
-            _first_name = null
-        }
-        if (flags & 2) {
-            _last_name = reader.tgReadString();
-        }
-        else {
-            _last_name = null
-        }
-        if (flags & 4) {
-            _about = reader.tgReadString();
-        }
-        else {
-            _about = null
-        }
-        return new this({firstName:_first_name,
-	lastName:_last_name,
-	about:_about})
-    }
-}
-
-
-class UpdateStatusRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6628562c;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6628562c;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.offline = args.offline;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2c562866","hex"),
-            this.offline ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _offline;
-        let _x;
-        let len;
-        _offline = reader.tgReadBool();
-        return new this({offline:_offline})
-    }
-}
-
-
-class GetWallPapersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xaabb1763;
-    static SUBCLASS_OF_ID = 0xa2c548fd;
-
-    /**
-    :returns account.WallPapers: Instance of either WallPapersNotModified, WallPapers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xaabb1763;
-        this.SUBCLASS_OF_ID = 0xa2c548fd;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6317bbaa","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class ReportPeerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xae189d5f;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xae189d5f;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.reason = args.reason;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5f9d18ae","hex"),
-            this.peer.getBytes(),
-            this.reason.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _reason;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _reason = reader.tgReadObject();
-        return new this({peer:_peer,
-	reason:_reason})
-    }
-}
-
-
-class CheckUsernameRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2714d86c;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2714d86c;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.username = args.username;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6cd81427","hex"),
-            TLObject.serializeBytes(this.username),
-            ])
-        }
-    static fromReader(reader) {
-        let _username;
-        let _x;
-        let len;
-        _username = reader.tgReadString();
-        return new this({username:_username})
-    }
-}
-
-
-class UpdateUsernameRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3e0bdd7c;
-    static SUBCLASS_OF_ID = 0x2da17977;
-
-    /**
-    :returns User: Instance of either UserEmpty, User
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3e0bdd7c;
-        this.SUBCLASS_OF_ID = 0x2da17977;
-
-        this.username = args.username;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7cdd0b3e","hex"),
-            TLObject.serializeBytes(this.username),
-            ])
-        }
-    static fromReader(reader) {
-        let _username;
-        let _x;
-        let len;
-        _username = reader.tgReadString();
-        return new this({username:_username})
-    }
-}
-
-
-class GetPrivacyRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdadbc950;
-    static SUBCLASS_OF_ID = 0xb55aba82;
-
-    /**
-    :returns account.PrivacyRules: Instance of PrivacyRules
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdadbc950;
-        this.SUBCLASS_OF_ID = 0xb55aba82;
-
-        this.key = args.key;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("50c9dbda","hex"),
-            this.key.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _key;
-        let _x;
-        let len;
-        _key = reader.tgReadObject();
-        return new this({key:_key})
-    }
-}
-
-
-class SetPrivacyRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc9f81ce8;
-    static SUBCLASS_OF_ID = 0xb55aba82;
-
-    /**
-    :returns account.PrivacyRules: Instance of PrivacyRules
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc9f81ce8;
-        this.SUBCLASS_OF_ID = 0xb55aba82;
-
-        this.key = args.key;
-        this.rules = args.rules;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e81cf8c9","hex"),
-            this.key.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.rules.length),Buffer.concat(this.rules.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _key;
-        let _rules;
-        let _x;
-        let len;
-        _key = reader.tgReadObject();
-        reader.readInt();
-        _rules = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _rules.push(_x);
-            }
-            return new this({key:_key,
-	rules:_rules})
-        }
-    }
-
-
-class DeleteAccountRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x418d4e0b;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x418d4e0b;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.reason = args.reason;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0b4e8d41","hex"),
-            TLObject.serializeBytes(this.reason),
-            ])
-        }
-    static fromReader(reader) {
-        let _reason;
-        let _x;
-        let len;
-        _reason = reader.tgReadString();
-        return new this({reason:_reason})
-    }
-}
-
-
-class GetAccountTTLRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x08fc711d;
-    static SUBCLASS_OF_ID = 0xbaa39d88;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x08fc711d;
-        this.SUBCLASS_OF_ID = 0xbaa39d88;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1d71fc08","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SetAccountTTLRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2442485e;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2442485e;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.ttl = args.ttl;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5e484224","hex"),
-            this.ttl.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _ttl;
-        let _x;
-        let len;
-        _ttl = reader.tgReadObject();
-        return new this({ttl:_ttl})
-    }
-}
-
-
-class SendChangePhoneCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x82574ae5;
-    static SUBCLASS_OF_ID = 0x6ce87081;
-
-    /**
-    :returns auth.SentCode: Instance of SentCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x82574ae5;
-        this.SUBCLASS_OF_ID = 0x6ce87081;
-
-        this.phoneNumber = args.phoneNumber;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e54a5782","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _settings;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _settings = reader.tgReadObject();
-        return new this({phoneNumber:_phone_number,
-	settings:_settings})
-    }
-}
-
-
-class ChangePhoneRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x70c32edb;
-    static SUBCLASS_OF_ID = 0x2da17977;
-
-    /**
-    :returns User: Instance of either UserEmpty, User
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x70c32edb;
-        this.SUBCLASS_OF_ID = 0x2da17977;
-
-        this.phoneNumber = args.phoneNumber;
-        this.phoneCodeHash = args.phoneCodeHash;
-        this.phoneCode = args.phoneCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("db2ec370","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            TLObject.serializeBytes(this.phoneCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _phone_code_hash;
-        let _phone_code;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _phone_code_hash = reader.tgReadString();
-        _phone_code = reader.tgReadString();
-        return new this({phoneNumber:_phone_number,
-	phoneCodeHash:_phone_code_hash,
-	phoneCode:_phone_code})
-    }
-}
-
-
-class UpdateDeviceLockedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x38df3532;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x38df3532;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.period = args.period;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3235df38","hex"),
-            struct.pack('<i', this.period),
-            ])
-        }
-    static fromReader(reader) {
-        let _period;
-        let _x;
-        let len;
-        _period = reader.readInt();
-        return new this({period:_period})
-    }
-}
-
-
-class GetAuthorizationsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe320c158;
-    static SUBCLASS_OF_ID = 0xbf5e0ff;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xe320c158;
-        this.SUBCLASS_OF_ID = 0xbf5e0ff;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("58c120e3","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ResetAuthorizationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdf77f3bc;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdf77f3bc;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bcf377df","hex"),
-            readBufferFromBigInt(this.hash,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readLong();
-        return new this({hash:_hash})
-    }
-}
-
-
-class GetPasswordRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x548a30f5;
-    static SUBCLASS_OF_ID = 0x53a211a3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x548a30f5;
-        this.SUBCLASS_OF_ID = 0x53a211a3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f5308a54","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetPasswordSettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9cd4eaf9;
-    static SUBCLASS_OF_ID = 0xd23fb078;
-
-    /**
-    :returns account.PasswordSettings: Instance of PasswordSettings
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9cd4eaf9;
-        this.SUBCLASS_OF_ID = 0xd23fb078;
-
-        this.password = args.password;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f9ead49c","hex"),
-            this.password.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _password;
-        let _x;
-        let len;
-        _password = reader.tgReadObject();
-        return new this({password:_password})
-    }
-}
-
-
-class UpdatePasswordSettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa59b102f;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa59b102f;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.password = args.password;
-        this.newSettings = args.newSettings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2f109ba5","hex"),
-            this.password.getBytes(),
-            this.newSettings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _password;
-        let _new_settings;
-        let _x;
-        let len;
-        _password = reader.tgReadObject();
-        _new_settings = reader.tgReadObject();
-        return new this({password:_password,
-	newSettings:_new_settings})
-    }
-}
-
-
-class SendConfirmPhoneCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1b3faa88;
-    static SUBCLASS_OF_ID = 0x6ce87081;
-
-    /**
-    :returns auth.SentCode: Instance of SentCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1b3faa88;
-        this.SUBCLASS_OF_ID = 0x6ce87081;
-
-        this.hash = args.hash;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("88aa3f1b","hex"),
-            TLObject.serializeBytes(this.hash),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _settings;
-        let _x;
-        let len;
-        _hash = reader.tgReadString();
-        _settings = reader.tgReadObject();
-        return new this({hash:_hash,
-	settings:_settings})
-    }
-}
-
-
-class ConfirmPhoneRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x5f2178c3;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5f2178c3;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.phoneCodeHash = args.phoneCodeHash;
-        this.phoneCode = args.phoneCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c378215f","hex"),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            TLObject.serializeBytes(this.phoneCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_code_hash;
-        let _phone_code;
-        let _x;
-        let len;
-        _phone_code_hash = reader.tgReadString();
-        _phone_code = reader.tgReadString();
-        return new this({phoneCodeHash:_phone_code_hash,
-	phoneCode:_phone_code})
-    }
-}
-
-
-class GetTmpPasswordRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x449e0b51;
-    static SUBCLASS_OF_ID = 0xb064992d;
-
-    /**
-    :returns account.TmpPassword: Instance of TmpPassword
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x449e0b51;
-        this.SUBCLASS_OF_ID = 0xb064992d;
-
-        this.password = args.password;
-        this.period = args.period;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("510b9e44","hex"),
-            this.password.getBytes(),
-            struct.pack('<i', this.period),
-            ])
-        }
-    static fromReader(reader) {
-        let _password;
-        let _period;
-        let _x;
-        let len;
-        _password = reader.tgReadObject();
-        _period = reader.readInt();
-        return new this({password:_password,
-	period:_period})
-    }
-}
-
-
-class GetWebAuthorizationsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x182e6d6f;
-    static SUBCLASS_OF_ID = 0x9a365b32;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x182e6d6f;
-        this.SUBCLASS_OF_ID = 0x9a365b32;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6f6d2e18","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ResetWebAuthorizationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2d01b9ef;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2d01b9ef;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("efb9012d","hex"),
-            readBufferFromBigInt(this.hash,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readLong();
-        return new this({hash:_hash})
-    }
-}
-
-
-class ResetWebAuthorizationsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x682d2594;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x682d2594;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("94252d68","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetAllSecureValuesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb288bc7d;
-    static SUBCLASS_OF_ID = 0xe82e4121;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xb288bc7d;
-        this.SUBCLASS_OF_ID = 0xe82e4121;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7dbc88b2","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetSecureValueRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x73665bc2;
-    static SUBCLASS_OF_ID = 0xe82e4121;
-
-    /**
-    :returns Vector<SecureValue>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x73665bc2;
-        this.SUBCLASS_OF_ID = 0xe82e4121;
-
-        this.types = args.types;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c25b6673","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.types.length),Buffer.concat(this.types.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _types;
-        let _x;
-        let len;
-        reader.readInt();
-        _types = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _types.push(_x);
-            }
-            return new this({types:_types})
-        }
-    }
-
-
-class SaveSecureValueRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x899fe31d;
-    static SUBCLASS_OF_ID = 0x51138ae;
-
-    /**
-    :returns SecureValue: Instance of SecureValue
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x899fe31d;
-        this.SUBCLASS_OF_ID = 0x51138ae;
-
-        this.value = args.value;
-        this.secureSecretId = args.secureSecretId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1de39f89","hex"),
-            this.value.getBytes(),
-            readBufferFromBigInt(this.secureSecretId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _value;
-        let _secure_secret_id;
-        let _x;
-        let len;
-        _value = reader.tgReadObject();
-        _secure_secret_id = reader.readLong();
-        return new this({value:_value,
-	secureSecretId:_secure_secret_id})
-    }
-}
-
-
-class DeleteSecureValueRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb880bc4b;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb880bc4b;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.types = args.types;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4bbc80b8","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.types.length),Buffer.concat(this.types.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _types;
-        let _x;
-        let len;
-        reader.readInt();
-        _types = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _types.push(_x);
-            }
-            return new this({types:_types})
-        }
-    }
-
-
-class GetAuthorizationFormRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb86ba8e1;
-    static SUBCLASS_OF_ID = 0x78049a94;
-
-    /**
-    :returns account.AuthorizationForm: Instance of AuthorizationForm
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb86ba8e1;
-        this.SUBCLASS_OF_ID = 0x78049a94;
-
-        this.botId = args.botId;
-        this.scope = args.scope;
-        this.publicKey = args.publicKey;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e1a86bb8","hex"),
-            struct.pack('<i', this.botId),
-            TLObject.serializeBytes(this.scope),
-            TLObject.serializeBytes(this.publicKey),
-            ])
-        }
-    static fromReader(reader) {
-        let _bot_id;
-        let _scope;
-        let _public_key;
-        let _x;
-        let len;
-        _bot_id = reader.readInt();
-        _scope = reader.tgReadString();
-        _public_key = reader.tgReadString();
-        return new this({botId:_bot_id,
-	scope:_scope,
-	publicKey:_public_key})
-    }
-}
-
-
-class AcceptAuthorizationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe7027c94;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe7027c94;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.botId = args.botId;
-        this.scope = args.scope;
-        this.publicKey = args.publicKey;
-        this.valueHashes = args.valueHashes;
-        this.credentials = args.credentials;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("947c02e7","hex"),
-            struct.pack('<i', this.botId),
-            TLObject.serializeBytes(this.scope),
-            TLObject.serializeBytes(this.publicKey),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.valueHashes.length),Buffer.concat(this.valueHashes.map(x => x.getBytes())),
-            this.credentials.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _bot_id;
-        let _scope;
-        let _public_key;
-        let _value_hashes;
-        let _credentials;
-        let _x;
-        let len;
-        _bot_id = reader.readInt();
-        _scope = reader.tgReadString();
-        _public_key = reader.tgReadString();
-        reader.readInt();
-        _value_hashes = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _value_hashes.push(_x);
-            }
-            _credentials = reader.tgReadObject();
-            return new this({botId:_bot_id,
-	scope:_scope,
-	publicKey:_public_key,
-	valueHashes:_value_hashes,
-	credentials:_credentials})
-        }
-    }
-
-
-class SendVerifyPhoneCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa5a356f9;
-    static SUBCLASS_OF_ID = 0x6ce87081;
-
-    /**
-    :returns auth.SentCode: Instance of SentCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa5a356f9;
-        this.SUBCLASS_OF_ID = 0x6ce87081;
-
-        this.phoneNumber = args.phoneNumber;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f956a3a5","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _settings;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _settings = reader.tgReadObject();
-        return new this({phoneNumber:_phone_number,
-	settings:_settings})
-    }
-}
-
-
-class VerifyPhoneRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4dd3a7f6;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4dd3a7f6;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.phoneNumber = args.phoneNumber;
-        this.phoneCodeHash = args.phoneCodeHash;
-        this.phoneCode = args.phoneCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f6a7d34d","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            TLObject.serializeBytes(this.phoneCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _phone_code_hash;
-        let _phone_code;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _phone_code_hash = reader.tgReadString();
-        _phone_code = reader.tgReadString();
-        return new this({phoneNumber:_phone_number,
-	phoneCodeHash:_phone_code_hash,
-	phoneCode:_phone_code})
-    }
-}
-
-
-class SendVerifyEmailCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x7011509f;
-    static SUBCLASS_OF_ID = 0x69f3c06e;
-
-    /**
-    :returns account.SentEmailCode: Instance of SentEmailCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x7011509f;
-        this.SUBCLASS_OF_ID = 0x69f3c06e;
-
-        this.email = args.email;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9f501170","hex"),
-            TLObject.serializeBytes(this.email),
-            ])
-        }
-    static fromReader(reader) {
-        let _email;
-        let _x;
-        let len;
-        _email = reader.tgReadString();
-        return new this({email:_email})
-    }
-}
-
-
-class VerifyEmailRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xecba39db;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xecba39db;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.email = args.email;
-        this.code = args.code;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("db39baec","hex"),
-            TLObject.serializeBytes(this.email),
-            TLObject.serializeBytes(this.code),
-            ])
-        }
-    static fromReader(reader) {
-        let _email;
-        let _code;
-        let _x;
-        let len;
-        _email = reader.tgReadString();
-        _code = reader.tgReadString();
-        return new this({email:_email,
-	code:_code})
-    }
-}
-
-
-class InitTakeoutSessionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf05b4804;
-    static SUBCLASS_OF_ID = 0x843ebe85;
-
-    /**
-    :returns account.Takeout: Instance of Takeout
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf05b4804;
-        this.SUBCLASS_OF_ID = 0x843ebe85;
-
-        this.contacts = args.contacts || null;
-        this.messageUsers = args.messageUsers || null;
-        this.messageChats = args.messageChats || null;
-        this.messageMegagroups = args.messageMegagroups || null;
-        this.messageChannels = args.messageChannels || null;
-        this.files = args.files || null;
-        this.fileMaxSize = args.fileMaxSize || null;
-    }
-    getBytes() {
-        if (!((this.files || this.files!==null && this.file_max_size || this.file_max_size!==null) && (this.files===null || this.files===false && this.file_max_size===null || this.file_max_size===false)))
-	 throw new Error('files, file_max_size paramaters must all be false-y or all true')
-        return Buffer.concat([
-            Buffer.from("04485bf0","hex"),
-            struct.pack('<I', (this.contacts === undefined || this.contacts === false || this.contacts === null) ? 0 : 1 | (this.messageUsers === undefined || this.messageUsers === false || this.messageUsers === null) ? 0 : 2 | (this.messageChats === undefined || this.messageChats === false || this.messageChats === null) ? 0 : 4 | (this.messageMegagroups === undefined || this.messageMegagroups === false || this.messageMegagroups === null) ? 0 : 8 | (this.messageChannels === undefined || this.messageChannels === false || this.messageChannels === null) ? 0 : 16 | (this.files === undefined || this.files === false || this.files === null) ? 0 : 32 | (this.fileMaxSize === undefined || this.fileMaxSize === false || this.fileMaxSize === null) ? 0 : 32),
-            (this.fileMaxSize === undefined || this.fileMaxSize === false || this.fileMaxSize ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.fileMaxSize)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _contacts;
-        let _message_users;
-        let _message_chats;
-        let _message_megagroups;
-        let _message_channels;
-        let _files;
-        let _file_max_size;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _contacts = Boolean(flags & 1);
-        _message_users = Boolean(flags & 2);
-        _message_chats = Boolean(flags & 4);
-        _message_megagroups = Boolean(flags & 8);
-        _message_channels = Boolean(flags & 16);
-        _files = Boolean(flags & 32);
-        if (flags & 32) {
-            _file_max_size = reader.readInt();
-        }
-        else {
-            _file_max_size = null
-        }
-        return new this({contacts:_contacts,
-	messageUsers:_message_users,
-	messageChats:_message_chats,
-	messageMegagroups:_message_megagroups,
-	messageChannels:_message_channels,
-	files:_files,
-	fileMaxSize:_file_max_size})
-    }
-}
-
-
-class FinishTakeoutSessionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1d2652ee;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1d2652ee;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.success = args.success || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ee52261d","hex"),
-            struct.pack('<I', (this.success === undefined || this.success === false || this.success === null) ? 0 : 1),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _success;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _success = Boolean(flags & 1);
-        return new this({success:_success})
-    }
-}
-
-
-class ConfirmPasswordEmailRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8fdf1920;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8fdf1920;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.code = args.code;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2019df8f","hex"),
-            TLObject.serializeBytes(this.code),
-            ])
-        }
-    static fromReader(reader) {
-        let _code;
-        let _x;
-        let len;
-        _code = reader.tgReadString();
-        return new this({code:_code})
-    }
-}
-
-
-class ResendPasswordEmailRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x7a7f2a15;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x7a7f2a15;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("152a7f7a","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class CancelPasswordEmailRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc1cbd5b6;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xc1cbd5b6;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b6d5cbc1","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetContactSignUpNotificationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9f07c728;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x9f07c728;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("28c7079f","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SetContactSignUpNotificationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcff43f61;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcff43f61;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.silent = args.silent;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("613ff4cf","hex"),
-            this.silent ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _silent;
-        let _x;
-        let len;
-        _silent = reader.tgReadBool();
-        return new this({silent:_silent})
-    }
-}
-
-
-class GetNotifyExceptionsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x53577479;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x53577479;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.compareSound = args.compareSound || null;
-        this.peer = args.peer || null;
-    }
-    async resolve(client, utils) {
-        if (this.peer) {
-            this.peer = await client._getInputNotify(this.peer)
-        }
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("79745753","hex"),
-            struct.pack('<I', (this.compareSound === undefined || this.compareSound === false || this.compareSound === null) ? 0 : 2 | (this.peer === undefined || this.peer === false || this.peer === null) ? 0 : 1),
-            (this.peer === undefined || this.peer === false || this.peer ===null) ? Buffer.alloc(0) : [this.peer.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _compare_sound;
-        let _peer;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _compare_sound = Boolean(flags & 2);
-        if (flags & 1) {
-            _peer = reader.tgReadObject();
-        }
-        else {
-            _peer = null
-        }
-        return new this({compareSound:_compare_sound,
-	peer:_peer})
-    }
-}
-
-
-class GetWallPaperRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xfc8ddbea;
-    static SUBCLASS_OF_ID = 0x96a2c98b;
-
-    /**
-    :returns WallPaper: Instance of WallPaper
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xfc8ddbea;
-        this.SUBCLASS_OF_ID = 0x96a2c98b;
-
-        this.wallpaper = args.wallpaper;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("eadb8dfc","hex"),
-            this.wallpaper.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _wallpaper;
-        let _x;
-        let len;
-        _wallpaper = reader.tgReadObject();
-        return new this({wallpaper:_wallpaper})
-    }
-}
-
-
-class UploadWallPaperRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdd853661;
-    static SUBCLASS_OF_ID = 0x96a2c98b;
-
-    /**
-    :returns WallPaper: Instance of WallPaper
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdd853661;
-        this.SUBCLASS_OF_ID = 0x96a2c98b;
-
-        this.file = args.file;
-        this.mimeType = args.mimeType;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("613685dd","hex"),
-            this.file.getBytes(),
-            TLObject.serializeBytes(this.mimeType),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _file;
-        let _mime_type;
-        let _settings;
-        let _x;
-        let len;
-        _file = reader.tgReadObject();
-        _mime_type = reader.tgReadString();
-        _settings = reader.tgReadObject();
-        return new this({file:_file,
-	mimeType:_mime_type,
-	settings:_settings})
-    }
-}
-
-
-class SaveWallPaperRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6c5a5b37;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6c5a5b37;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.wallpaper = args.wallpaper;
-        this.unsave = args.unsave;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("375b5a6c","hex"),
-            this.wallpaper.getBytes(),
-            this.unsave ? 0xb5757299 : 0x379779bc,
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _wallpaper;
-        let _unsave;
-        let _settings;
-        let _x;
-        let len;
-        _wallpaper = reader.tgReadObject();
-        _unsave = reader.tgReadBool();
-        _settings = reader.tgReadObject();
-        return new this({wallpaper:_wallpaper,
-	unsave:_unsave,
-	settings:_settings})
-    }
-}
-
-
-class InstallWallPaperRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xfeed5769;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xfeed5769;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.wallpaper = args.wallpaper;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6957edfe","hex"),
-            this.wallpaper.getBytes(),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _wallpaper;
-        let _settings;
-        let _x;
-        let len;
-        _wallpaper = reader.tgReadObject();
-        _settings = reader.tgReadObject();
-        return new this({wallpaper:_wallpaper,
-	settings:_settings})
-    }
-}
-
-
-class ResetWallPapersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbb3b9804;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xbb3b9804;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("04983bbb","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetAutoDownloadSettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x56da0b3f;
-    static SUBCLASS_OF_ID = 0x2fb85921;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x56da0b3f;
-        this.SUBCLASS_OF_ID = 0x2fb85921;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3f0bda56","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SaveAutoDownloadSettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x76f36233;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x76f36233;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.low = args.low || null;
-        this.high = args.high || null;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3362f376","hex"),
-            struct.pack('<I', (this.low === undefined || this.low === false || this.low === null) ? 0 : 1 | (this.high === undefined || this.high === false || this.high === null) ? 0 : 2),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _low;
-        let _high;
-        let _settings;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _low = Boolean(flags & 1);
-        _high = Boolean(flags & 2);
-        _settings = reader.tgReadObject();
-        return new this({low:_low,
-	high:_high,
-	settings:_settings})
-    }
-}
-
-
-class UploadThemeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1c3db333;
-    static SUBCLASS_OF_ID = 0x211fe820;
-
-    /**
-    :returns Document: Instance of either DocumentEmpty, Document
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1c3db333;
-        this.SUBCLASS_OF_ID = 0x211fe820;
-
-        this.file = args.file;
-        this.thumb = args.thumb || null;
-        this.fileName = args.fileName;
-        this.mimeType = args.mimeType;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("33b33d1c","hex"),
-            struct.pack('<I', (this.thumb === undefined || this.thumb === false || this.thumb === null) ? 0 : 1),
-            this.file.getBytes(),
-            (this.thumb === undefined || this.thumb === false || this.thumb ===null) ? Buffer.alloc(0) : [this.thumb.getBytes()],
-            TLObject.serializeBytes(this.fileName),
-            TLObject.serializeBytes(this.mimeType),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _file;
-        let _thumb;
-        let _file_name;
-        let _mime_type;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _file = reader.tgReadObject();
-        if (flags & 1) {
-            _thumb = reader.tgReadObject();
-        }
-        else {
-            _thumb = null
-        }
-        _file_name = reader.tgReadString();
-        _mime_type = reader.tgReadString();
-        return new this({file:_file,
-	thumb:_thumb,
-	fileName:_file_name,
-	mimeType:_mime_type})
-    }
-}
-
-
-class CreateThemeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2b7ffd7f;
-    static SUBCLASS_OF_ID = 0x56b4c80c;
-
-    /**
-    :returns Theme: Instance of either ThemeDocumentNotModified, Theme
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2b7ffd7f;
-        this.SUBCLASS_OF_ID = 0x56b4c80c;
-
-        this.slug = args.slug;
-        this.title = args.title;
-        this.document = args.document;
-    }
-    async resolve(client, utils) {
-        this.document = utils.getInputDocument(this.document)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7ffd7f2b","hex"),
-            TLObject.serializeBytes(this.slug),
-            TLObject.serializeBytes(this.title),
-            this.document.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _slug;
-        let _title;
-        let _document;
-        let _x;
-        let len;
-        _slug = reader.tgReadString();
-        _title = reader.tgReadString();
-        _document = reader.tgReadObject();
-        return new this({slug:_slug,
-	title:_title,
-	document:_document})
-    }
-}
-
-
-class UpdateThemeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3b8ea202;
-    static SUBCLASS_OF_ID = 0x56b4c80c;
-
-    /**
-    :returns Theme: Instance of either ThemeDocumentNotModified, Theme
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3b8ea202;
-        this.SUBCLASS_OF_ID = 0x56b4c80c;
-
-        this.format = args.format;
-        this.theme = args.theme;
-        this.slug = args.slug || null;
-        this.title = args.title || null;
-        this.document = args.document || null;
-    }
-    async resolve(client, utils) {
-        if (this.document) {
-            this.document = utils.getInputDocument(this.document)
-        }
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("02a28e3b","hex"),
-            struct.pack('<I', (this.slug === undefined || this.slug === false || this.slug === null) ? 0 : 1 | (this.title === undefined || this.title === false || this.title === null) ? 0 : 2 | (this.document === undefined || this.document === false || this.document === null) ? 0 : 4),
-            TLObject.serializeBytes(this.format),
-            this.theme.getBytes(),
-            (this.slug === undefined || this.slug === false || this.slug ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.slug)],
-            (this.title === undefined || this.title === false || this.title ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.title)],
-            (this.document === undefined || this.document === false || this.document ===null) ? Buffer.alloc(0) : [this.document.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _format;
-        let _theme;
-        let _slug;
-        let _title;
-        let _document;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _format = reader.tgReadString();
-        _theme = reader.tgReadObject();
-        if (flags & 1) {
-            _slug = reader.tgReadString();
-        }
-        else {
-            _slug = null
-        }
-        if (flags & 2) {
-            _title = reader.tgReadString();
-        }
-        else {
-            _title = null
-        }
-        if (flags & 4) {
-            _document = reader.tgReadObject();
-        }
-        else {
-            _document = null
-        }
-        return new this({format:_format,
-	theme:_theme,
-	slug:_slug,
-	title:_title,
-	document:_document})
-    }
-}
-
-
-class SaveThemeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf257106c;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf257106c;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.theme = args.theme;
-        this.unsave = args.unsave;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6c1057f2","hex"),
-            this.theme.getBytes(),
-            this.unsave ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _theme;
-        let _unsave;
-        let _x;
-        let len;
-        _theme = reader.tgReadObject();
-        _unsave = reader.tgReadBool();
-        return new this({theme:_theme,
-	unsave:_unsave})
-    }
-}
-
-
-class InstallThemeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x7ae43737;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x7ae43737;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.dark = args.dark || null;
-        this.format = args.format || null;
-        this.theme = args.theme || null;
-    }
-    getBytes() {
-        if (!((this.format || this.format!==null && this.theme || this.theme!==null) && (this.format===null || this.format===false && this.theme===null || this.theme===false)))
-	 throw new Error('format, theme paramaters must all be false-y or all true')
-        return Buffer.concat([
-            Buffer.from("3737e47a","hex"),
-            struct.pack('<I', (this.dark === undefined || this.dark === false || this.dark === null) ? 0 : 1 | (this.format === undefined || this.format === false || this.format === null) ? 0 : 2 | (this.theme === undefined || this.theme === false || this.theme === null) ? 0 : 2),
-            (this.format === undefined || this.format === false || this.format ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.format)],
-            (this.theme === undefined || this.theme === false || this.theme ===null) ? Buffer.alloc(0) : [this.theme.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _dark;
-        let _format;
-        let _theme;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _dark = Boolean(flags & 1);
-        if (flags & 2) {
-            _format = reader.tgReadString();
-        }
-        else {
-            _format = null
-        }
-        if (flags & 2) {
-            _theme = reader.tgReadObject();
-        }
-        else {
-            _theme = null
-        }
-        return new this({dark:_dark,
-	format:_format,
-	theme:_theme})
-    }
-}
-
-
-class GetThemeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8d9d742b;
-    static SUBCLASS_OF_ID = 0x56b4c80c;
-
-    /**
-    :returns Theme: Instance of either ThemeDocumentNotModified, Theme
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8d9d742b;
-        this.SUBCLASS_OF_ID = 0x56b4c80c;
-
-        this.format = args.format;
-        this.theme = args.theme;
-        this.documentId = args.documentId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2b749d8d","hex"),
-            TLObject.serializeBytes(this.format),
-            this.theme.getBytes(),
-            readBufferFromBigInt(this.documentId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _format;
-        let _theme;
-        let _document_id;
-        let _x;
-        let len;
-        _format = reader.tgReadString();
-        _theme = reader.tgReadObject();
-        _document_id = reader.readLong();
-        return new this({format:_format,
-	theme:_theme,
-	documentId:_document_id})
-    }
-}
-
-
-class GetThemesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x285946f8;
-    static SUBCLASS_OF_ID = 0x7fc52204;
-
-    /**
-    :returns account.Themes: Instance of either ThemesNotModified, Themes
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x285946f8;
-        this.SUBCLASS_OF_ID = 0x7fc52204;
-
-        this.format = args.format;
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f8465928","hex"),
-            TLObject.serializeBytes(this.format),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _format;
-        let _hash;
-        let _x;
-        let len;
-        _format = reader.tgReadString();
-        _hash = reader.readInt();
-        return new this({format:_format,
-	hash:_hash})
-    }
-}
-
-module.exports = {
-    RegisterDeviceRequest,
-    UnregisterDeviceRequest,
-    UpdateNotifySettingsRequest,
-    GetNotifySettingsRequest,
-    ResetNotifySettingsRequest,
-    UpdateProfileRequest,
-    UpdateStatusRequest,
-    GetWallPapersRequest,
-    ReportPeerRequest,
-    CheckUsernameRequest,
-    UpdateUsernameRequest,
-    GetPrivacyRequest,
-    SetPrivacyRequest,
-    DeleteAccountRequest,
-    GetAccountTTLRequest,
-    SetAccountTTLRequest,
-    SendChangePhoneCodeRequest,
-    ChangePhoneRequest,
-    UpdateDeviceLockedRequest,
-    GetAuthorizationsRequest,
-    ResetAuthorizationRequest,
-    GetPasswordRequest,
-    GetPasswordSettingsRequest,
-    UpdatePasswordSettingsRequest,
-    SendConfirmPhoneCodeRequest,
-    ConfirmPhoneRequest,
-    GetTmpPasswordRequest,
-    GetWebAuthorizationsRequest,
-    ResetWebAuthorizationRequest,
-    ResetWebAuthorizationsRequest,
-    GetAllSecureValuesRequest,
-    GetSecureValueRequest,
-    SaveSecureValueRequest,
-    DeleteSecureValueRequest,
-    GetAuthorizationFormRequest,
-    AcceptAuthorizationRequest,
-    SendVerifyPhoneCodeRequest,
-    VerifyPhoneRequest,
-    SendVerifyEmailCodeRequest,
-    VerifyEmailRequest,
-    InitTakeoutSessionRequest,
-    FinishTakeoutSessionRequest,
-    ConfirmPasswordEmailRequest,
-    ResendPasswordEmailRequest,
-    CancelPasswordEmailRequest,
-    GetContactSignUpNotificationRequest,
-    SetContactSignUpNotificationRequest,
-    GetNotifyExceptionsRequest,
-    GetWallPaperRequest,
-    UploadWallPaperRequest,
-    SaveWallPaperRequest,
-    InstallWallPaperRequest,
-    ResetWallPapersRequest,
-    GetAutoDownloadSettingsRequest,
-    SaveAutoDownloadSettingsRequest,
-    UploadThemeRequest,
-    CreateThemeRequest,
-    UpdateThemeRequest,
-    SaveThemeRequest,
-    InstallThemeRequest,
-    GetThemeRequest,
-    GetThemesRequest,
-};

+ 0 - 556
src/lib/gramjs/tl/functions/auth.js

@@ -1,556 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class SendCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa677244f;
-    static SUBCLASS_OF_ID = 0x6ce87081;
-
-    /**
-    :returns auth.SentCode: Instance of SentCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa677244f;
-        this.SUBCLASS_OF_ID = 0x6ce87081;
-
-        this.phoneNumber = args.phoneNumber;
-        this.apiId = args.apiId;
-        this.apiHash = args.apiHash;
-        this.settings = args.settings;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4f2477a6","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            struct.pack('<i', this.apiId),
-            TLObject.serializeBytes(this.apiHash),
-            this.settings.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _api_id;
-        let _api_hash;
-        let _settings;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _api_id = reader.readInt();
-        _api_hash = reader.tgReadString();
-        _settings = reader.tgReadObject();
-        return new this({phoneNumber:_phone_number,
-	apiId:_api_id,
-	apiHash:_api_hash,
-	settings:_settings})
-    }
-}
-
-
-class SignUpRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x80eee427;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x80eee427;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.phoneNumber = args.phoneNumber;
-        this.phoneCodeHash = args.phoneCodeHash;
-        this.firstName = args.firstName;
-        this.lastName = args.lastName;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("27e4ee80","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            TLObject.serializeBytes(this.firstName),
-            TLObject.serializeBytes(this.lastName),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _phone_code_hash;
-        let _first_name;
-        let _last_name;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _phone_code_hash = reader.tgReadString();
-        _first_name = reader.tgReadString();
-        _last_name = reader.tgReadString();
-        return new this({phoneNumber:_phone_number,
-	phoneCodeHash:_phone_code_hash,
-	firstName:_first_name,
-	lastName:_last_name})
-    }
-}
-
-
-class SignInRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbcd51581;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbcd51581;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.phoneNumber = args.phoneNumber;
-        this.phoneCodeHash = args.phoneCodeHash;
-        this.phoneCode = args.phoneCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8115d5bc","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            TLObject.serializeBytes(this.phoneCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _phone_code_hash;
-        let _phone_code;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _phone_code_hash = reader.tgReadString();
-        _phone_code = reader.tgReadString();
-        return new this({phoneNumber:_phone_number,
-	phoneCodeHash:_phone_code_hash,
-	phoneCode:_phone_code})
-    }
-}
-
-
-class LogOutRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x5717da40;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x5717da40;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("40da1757","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ResetAuthorizationsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9fab0d1a;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x9fab0d1a;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1a0dab9f","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ExportAuthorizationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe5bfffcd;
-    static SUBCLASS_OF_ID = 0x5fd1ec51;
-
-    /**
-    :returns auth.ExportedAuthorization: Instance of ExportedAuthorization
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe5bfffcd;
-        this.SUBCLASS_OF_ID = 0x5fd1ec51;
-
-        this.dcId = args.dcId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cdffbfe5","hex"),
-            struct.pack('<i', this.dcId),
-            ])
-        }
-    static fromReader(reader) {
-        let _dc_id;
-        let _x;
-        let len;
-        _dc_id = reader.readInt();
-        return new this({dcId:_dc_id})
-    }
-}
-
-
-class ImportAuthorizationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe3ef9613;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe3ef9613;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.id = args.id;
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1396efe3","hex"),
-            struct.pack('<i', this.id),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _bytes;
-        let _x;
-        let len;
-        _id = reader.readInt();
-        _bytes = reader.tgReadBytes();
-        return new this({id:_id,
-	bytes:_bytes})
-    }
-}
-
-
-class BindTempAuthKeyRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcdd42a05;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcdd42a05;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.permAuthKeyId = args.permAuthKeyId;
-        this.nonce = args.nonce;
-        this.expiresAt = args.expiresAt;
-        this.encryptedMessage = args.encryptedMessage;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("052ad4cd","hex"),
-            readBufferFromBigInt(this.permAuthKeyId,8,true,true),
-            readBufferFromBigInt(this.nonce,8,true,true),
-            struct.pack('<i', this.expiresAt),
-            TLObject.serializeBytes(this.encryptedMessage),
-            ])
-        }
-    static fromReader(reader) {
-        let _perm_auth_key_id;
-        let _nonce;
-        let _expires_at;
-        let _encrypted_message;
-        let _x;
-        let len;
-        _perm_auth_key_id = reader.readLong();
-        _nonce = reader.readLong();
-        _expires_at = reader.readInt();
-        _encrypted_message = reader.tgReadBytes();
-        return new this({permAuthKeyId:_perm_auth_key_id,
-	nonce:_nonce,
-	expiresAt:_expires_at,
-	encryptedMessage:_encrypted_message})
-    }
-}
-
-
-class ImportBotAuthorizationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x67a3ff2c;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x67a3ff2c;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.flags = args.flags;
-        this.apiId = args.apiId;
-        this.apiHash = args.apiHash;
-        this.botAuthToken = args.botAuthToken;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2cffa367","hex"),
-            struct.pack('<i', this.flags),
-            struct.pack('<i', this.apiId),
-            TLObject.serializeBytes(this.apiHash),
-            TLObject.serializeBytes(this.botAuthToken),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _api_id;
-        let _api_hash;
-        let _bot_auth_token;
-        let _x;
-        let len;
-        _flags = reader.readInt();
-        _api_id = reader.readInt();
-        _api_hash = reader.tgReadString();
-        _bot_auth_token = reader.tgReadString();
-        return new this({flags:_flags,
-	apiId:_api_id,
-	apiHash:_api_hash,
-	botAuthToken:_bot_auth_token})
-    }
-}
-
-
-class CheckPasswordRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd18b4d16;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd18b4d16;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.password = args.password;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("164d8bd1","hex"),
-            this.password.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _password;
-        let _x;
-        let len;
-        _password = reader.tgReadObject();
-        return new this({password:_password})
-    }
-}
-
-
-class RequestPasswordRecoveryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd897bc66;
-    static SUBCLASS_OF_ID = 0xfa72d43a;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xd897bc66;
-        this.SUBCLASS_OF_ID = 0xfa72d43a;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("66bc97d8","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class RecoverPasswordRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4ea56e92;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4ea56e92;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.code = args.code;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("926ea54e","hex"),
-            TLObject.serializeBytes(this.code),
-            ])
-        }
-    static fromReader(reader) {
-        let _code;
-        let _x;
-        let len;
-        _code = reader.tgReadString();
-        return new this({code:_code})
-    }
-}
-
-
-class ResendCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3ef1a9bf;
-    static SUBCLASS_OF_ID = 0x6ce87081;
-
-    /**
-    :returns auth.SentCode: Instance of SentCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3ef1a9bf;
-        this.SUBCLASS_OF_ID = 0x6ce87081;
-
-        this.phoneNumber = args.phoneNumber;
-        this.phoneCodeHash = args.phoneCodeHash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bfa9f13e","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _phone_code_hash;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _phone_code_hash = reader.tgReadString();
-        return new this({phoneNumber:_phone_number,
-	phoneCodeHash:_phone_code_hash})
-    }
-}
-
-
-class CancelCodeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1f040578;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1f040578;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.phoneNumber = args.phoneNumber;
-        this.phoneCodeHash = args.phoneCodeHash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7805041f","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _phone_code_hash;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _phone_code_hash = reader.tgReadString();
-        return new this({phoneNumber:_phone_number,
-	phoneCodeHash:_phone_code_hash})
-    }
-}
-
-
-class DropTempAuthKeysRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8e48a188;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8e48a188;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.exceptAuthKeys = args.exceptAuthKeys;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("88a1488e","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.exceptAuthKeys.length),Buffer.concat(this.exceptAuthKeys.map(x => readBufferFromBigInt(x,8,true,true))),
-            ])
-        }
-    static fromReader(reader) {
-        let _except_auth_keys;
-        let _x;
-        let len;
-        reader.readInt();
-        _except_auth_keys = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readLong();
-            _except_auth_keys.push(_x);
-            }
-            return new this({exceptAuthKeys:_except_auth_keys})
-        }
-    }
-
-module.exports = {
-    SendCodeRequest,
-    SignUpRequest,
-    SignInRequest,
-    LogOutRequest,
-    ResetAuthorizationsRequest,
-    ExportAuthorizationRequest,
-    ImportAuthorizationRequest,
-    BindTempAuthKeyRequest,
-    ImportBotAuthorizationRequest,
-    CheckPasswordRequest,
-    RequestPasswordRecoveryRequest,
-    RecoverPasswordRequest,
-    ResendCodeRequest,
-    CancelCodeRequest,
-    DropTempAuthKeysRequest,
-};

+ 0 - 83
src/lib/gramjs/tl/functions/bots.js

@@ -1,83 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class SendCustomRequestRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xaa2769ed;
-    static SUBCLASS_OF_ID = 0xad0352e8;
-
-    /**
-    :returns DataJSON: Instance of DataJSON
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xaa2769ed;
-        this.SUBCLASS_OF_ID = 0xad0352e8;
-
-        this.customMethod = args.customMethod;
-        this.params = args.params;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ed6927aa","hex"),
-            TLObject.serializeBytes(this.customMethod),
-            this.params.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _custom_method;
-        let _params;
-        let _x;
-        let len;
-        _custom_method = reader.tgReadString();
-        _params = reader.tgReadObject();
-        return new this({customMethod:_custom_method,
-	params:_params})
-    }
-}
-
-
-class AnswerWebhookJSONQueryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe6213f4d;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe6213f4d;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.queryId = args.queryId;
-        this.data = args.data;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4d3f21e6","hex"),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            this.data.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _query_id;
-        let _data;
-        let _x;
-        let len;
-        _query_id = reader.readLong();
-        _data = reader.tgReadObject();
-        return new this({queryId:_query_id,
-	data:_data})
-    }
-}
-
-module.exports = {
-    SendCustomRequestRequest,
-    AnswerWebhookJSONQueryRequest,
-};

+ 0 - 1506
src/lib/gramjs/tl/functions/channels.js

@@ -1,1506 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class ReadHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcc104937;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcc104937;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.maxId = args.maxId;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("374910cc","hex"),
-            this.channel.getBytes(),
-            struct.pack('<i', this.maxId),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _max_id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _max_id = reader.readInt();
-        return new this({channel:_channel,
-	maxId:_max_id})
-    }
-}
-
-
-class DeleteMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x84c1fd4e;
-    static SUBCLASS_OF_ID = 0xced3c06e;
-
-    /**
-    :returns messages.AffectedMessages: Instance of AffectedMessages
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x84c1fd4e;
-        this.SUBCLASS_OF_ID = 0xced3c06e;
-
-        this.channel = args.channel;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4efdc184","hex"),
-            this.channel.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({channel:_channel,
-	id:_id})
-        }
-    }
-
-
-class DeleteUserHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd10dd71b;
-    static SUBCLASS_OF_ID = 0x2c49c116;
-
-    /**
-    :returns messages.AffectedHistory: Instance of AffectedHistory
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd10dd71b;
-        this.SUBCLASS_OF_ID = 0x2c49c116;
-
-        this.channel = args.channel;
-        this.userId = args.userId;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1bd70dd1","hex"),
-            this.channel.getBytes(),
-            this.userId.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _user_id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        return new this({channel:_channel,
-	userId:_user_id})
-    }
-}
-
-
-class ReportSpamRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xfe087810;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xfe087810;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.userId = args.userId;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("107808fe","hex"),
-            this.channel.getBytes(),
-            this.userId.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _user_id;
-        let _id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({channel:_channel,
-	userId:_user_id,
-	id:_id})
-        }
-    }
-
-
-class GetMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xad8c9a23;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xad8c9a23;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.channel = args.channel;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        const _tmp = [];for (const _x of this.id) {
-            _tmp.push(utils.getInputMessage(_x));
-        }
-        this.id = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("239a8cad","hex"),
-            this.channel.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _id.push(_x);
-            }
-            return new this({channel:_channel,
-	id:_id})
-        }
-    }
-
-
-class GetParticipantsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x123e05e9;
-    static SUBCLASS_OF_ID = 0xe60a6e64;
-
-    /**
-    :returns channels.ChannelParticipants: Instance of either ChannelParticipants, ChannelParticipantsNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x123e05e9;
-        this.SUBCLASS_OF_ID = 0xe60a6e64;
-
-        this.channel = args.channel;
-        this.filter = args.filter;
-        this.offset = args.offset;
-        this.limit = args.limit;
-        this.hash = args.hash;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e9053e12","hex"),
-            this.channel.getBytes(),
-            this.filter.getBytes(),
-            struct.pack('<i', this.offset),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _filter;
-        let _offset;
-        let _limit;
-        let _hash;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _filter = reader.tgReadObject();
-        _offset = reader.readInt();
-        _limit = reader.readInt();
-        _hash = reader.readInt();
-        return new this({channel:_channel,
-	filter:_filter,
-	offset:_offset,
-	limit:_limit,
-	hash:_hash})
-    }
-}
-
-
-class GetParticipantRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x546dd7a6;
-    static SUBCLASS_OF_ID = 0x6658151a;
-
-    /**
-    :returns channels.ChannelParticipant: Instance of ChannelParticipant
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x546dd7a6;
-        this.SUBCLASS_OF_ID = 0x6658151a;
-
-        this.channel = args.channel;
-        this.userId = args.userId;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a6d76d54","hex"),
-            this.channel.getBytes(),
-            this.userId.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _user_id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        return new this({channel:_channel,
-	userId:_user_id})
-    }
-}
-
-
-class GetChannelsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0a7f6bbb;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    :returns messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0a7f6bbb;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.id) {
-            _tmp.push(utils.getInputChannel(await client.getInputEntity(_x)));
-        }
-        this.id = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bb6b7f0a","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class GetFullChannelRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x08736a09;
-    static SUBCLASS_OF_ID = 0x225a5109;
-
-    /**
-    :returns messages.ChatFull: Instance of ChatFull
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x08736a09;
-        this.SUBCLASS_OF_ID = 0x225a5109;
-
-        this.channel = args.channel;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("096a7308","hex"),
-            this.channel.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        return new this({channel:_channel})
-    }
-}
-
-
-class CreateChannelRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3d5fb10f;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3d5fb10f;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.broadcast = args.broadcast || null;
-        this.megagroup = args.megagroup || null;
-        this.title = args.title;
-        this.about = args.about;
-        this.geoPoint = args.geoPoint || null;
-        this.address = args.address || null;
-    }
-    getBytes() {
-        if (!((this.geo_point || this.geo_point!==null && this.address || this.address!==null) && (this.geo_point===null || this.geo_point===false && this.address===null || this.address===false)))
-	 throw new Error('geo_point, address paramaters must all be false-y or all true')
-        return Buffer.concat([
-            Buffer.from("0fb15f3d","hex"),
-            struct.pack('<I', (this.broadcast === undefined || this.broadcast === false || this.broadcast === null) ? 0 : 1 | (this.megagroup === undefined || this.megagroup === false || this.megagroup === null) ? 0 : 2 | (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint === null) ? 0 : 4 | (this.address === undefined || this.address === false || this.address === null) ? 0 : 4),
-            TLObject.serializeBytes(this.title),
-            TLObject.serializeBytes(this.about),
-            (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint ===null) ? Buffer.alloc(0) : [this.geoPoint.getBytes()],
-            (this.address === undefined || this.address === false || this.address ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.address)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _broadcast;
-        let _megagroup;
-        let _title;
-        let _about;
-        let _geo_point;
-        let _address;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _broadcast = Boolean(flags & 1);
-        _megagroup = Boolean(flags & 2);
-        _title = reader.tgReadString();
-        _about = reader.tgReadString();
-        if (flags & 4) {
-            _geo_point = reader.tgReadObject();
-        }
-        else {
-            _geo_point = null
-        }
-        if (flags & 4) {
-            _address = reader.tgReadString();
-        }
-        else {
-            _address = null
-        }
-        return new this({broadcast:_broadcast,
-	megagroup:_megagroup,
-	title:_title,
-	about:_about,
-	geoPoint:_geo_point,
-	address:_address})
-    }
-}
-
-
-class EditAdminRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd33c8902;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd33c8902;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.userId = args.userId;
-        this.adminRights = args.adminRights;
-        this.rank = args.rank;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("02893cd3","hex"),
-            this.channel.getBytes(),
-            this.userId.getBytes(),
-            this.adminRights.getBytes(),
-            TLObject.serializeBytes(this.rank),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _user_id;
-        let _admin_rights;
-        let _rank;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        _admin_rights = reader.tgReadObject();
-        _rank = reader.tgReadString();
-        return new this({channel:_channel,
-	userId:_user_id,
-	adminRights:_admin_rights,
-	rank:_rank})
-    }
-}
-
-
-class EditTitleRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x566decd0;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x566decd0;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.title = args.title;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d0ec6d56","hex"),
-            this.channel.getBytes(),
-            TLObject.serializeBytes(this.title),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _title;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _title = reader.tgReadString();
-        return new this({channel:_channel,
-	title:_title})
-    }
-}
-
-
-class EditPhotoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf12e57c9;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf12e57c9;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.photo = args.photo;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.photo = utils.getInputChatPhoto(this.photo)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c9572ef1","hex"),
-            this.channel.getBytes(),
-            this.photo.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _photo;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _photo = reader.tgReadObject();
-        return new this({channel:_channel,
-	photo:_photo})
-    }
-}
-
-
-class CheckUsernameRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x10e6bd2c;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x10e6bd2c;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.username = args.username;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2cbde610","hex"),
-            this.channel.getBytes(),
-            TLObject.serializeBytes(this.username),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _username;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _username = reader.tgReadString();
-        return new this({channel:_channel,
-	username:_username})
-    }
-}
-
-
-class UpdateUsernameRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3514b3de;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3514b3de;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.username = args.username;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("deb31435","hex"),
-            this.channel.getBytes(),
-            TLObject.serializeBytes(this.username),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _username;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _username = reader.tgReadString();
-        return new this({channel:_channel,
-	username:_username})
-    }
-}
-
-
-class JoinChannelRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x24b524c5;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x24b524c5;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c524b524","hex"),
-            this.channel.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        return new this({channel:_channel})
-    }
-}
-
-
-class LeaveChannelRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf836aa95;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf836aa95;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("95aa36f8","hex"),
-            this.channel.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        return new this({channel:_channel})
-    }
-}
-
-
-class InviteToChannelRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x199f3a6c;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x199f3a6c;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.users = args.users;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        const _tmp = [];for (const _x of this.users) {
-            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
-        }
-        this.users = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6c3a9f19","hex"),
-            this.channel.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _users;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            return new this({channel:_channel,
-	users:_users})
-        }
-    }
-
-
-class DeleteChannelRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc0111fe3;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc0111fe3;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e31f11c0","hex"),
-            this.channel.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        return new this({channel:_channel})
-    }
-}
-
-
-class ExportMessageLinkRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xceb77163;
-    static SUBCLASS_OF_ID = 0xdee644cc;
-
-    /**
-    :returns ExportedMessageLink: Instance of ExportedMessageLink
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xceb77163;
-        this.SUBCLASS_OF_ID = 0xdee644cc;
-
-        this.channel = args.channel;
-        this.id = args.id;
-        this.grouped = args.grouped;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6371b7ce","hex"),
-            this.channel.getBytes(),
-            struct.pack('<i', this.id),
-            this.grouped ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _id;
-        let _grouped;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _id = reader.readInt();
-        _grouped = reader.tgReadBool();
-        return new this({channel:_channel,
-	id:_id,
-	grouped:_grouped})
-    }
-}
-
-
-class ToggleSignaturesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1f69b606;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1f69b606;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.enabled = args.enabled;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("06b6691f","hex"),
-            this.channel.getBytes(),
-            this.enabled ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _enabled;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _enabled = reader.tgReadBool();
-        return new this({channel:_channel,
-	enabled:_enabled})
-    }
-}
-
-
-class GetAdminedPublicChannelsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf8b036af;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    :returns messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf8b036af;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.byLocation = args.byLocation || null;
-        this.checkLimit = args.checkLimit || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("af36b0f8","hex"),
-            struct.pack('<I', (this.byLocation === undefined || this.byLocation === false || this.byLocation === null) ? 0 : 1 | (this.checkLimit === undefined || this.checkLimit === false || this.checkLimit === null) ? 0 : 2),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _by_location;
-        let _check_limit;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _by_location = Boolean(flags & 1);
-        _check_limit = Boolean(flags & 2);
-        return new this({byLocation:_by_location,
-	checkLimit:_check_limit})
-    }
-}
-
-
-class EditBannedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x72796912;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x72796912;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.userId = args.userId;
-        this.bannedRights = args.bannedRights;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("12697972","hex"),
-            this.channel.getBytes(),
-            this.userId.getBytes(),
-            this.bannedRights.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _user_id;
-        let _banned_rights;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        _banned_rights = reader.tgReadObject();
-        return new this({channel:_channel,
-	userId:_user_id,
-	bannedRights:_banned_rights})
-    }
-}
-
-
-class GetAdminLogRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x33ddf480;
-    static SUBCLASS_OF_ID = 0x51f076bc;
-
-    /**
-    :returns channels.AdminLogResults: Instance of AdminLogResults
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x33ddf480;
-        this.SUBCLASS_OF_ID = 0x51f076bc;
-
-        this.channel = args.channel;
-        this.q = args.q;
-        this.eventsFilter = args.eventsFilter || null;
-        this.admins = args.admins || null;
-        this.maxId = args.maxId;
-        this.minId = args.minId;
-        this.limit = args.limit;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        if (this.admins) {
-            const _tmp = [];for (const _x of this.admins) {
-                _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
-            }
-            this.admins = _tmp;
-        }
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("80f4dd33","hex"),
-            struct.pack('<I', (this.eventsFilter === undefined || this.eventsFilter === false || this.eventsFilter === null) ? 0 : 1 | (this.admins === undefined || this.admins === false || this.admins === null) ? 0 : 2),
-            this.channel.getBytes(),
-            TLObject.serializeBytes(this.q),
-            (this.eventsFilter === undefined || this.eventsFilter === false || this.eventsFilter ===null) ? Buffer.alloc(0) : [this.eventsFilter.getBytes()],
-            (this.admins === undefined || this.admins === false || this.admins ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.admins.length),Buffer.concat(this.admins.map(x => x.getBytes()))]),
-            readBufferFromBigInt(this.maxId,8,true,true),
-            readBufferFromBigInt(this.minId,8,true,true),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _channel;
-        let _q;
-        let _events_filter;
-        let _admins;
-        let _max_id;
-        let _min_id;
-        let _limit;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _channel = reader.tgReadObject();
-        _q = reader.tgReadString();
-        if (flags & 1) {
-            _events_filter = reader.tgReadObject();
-        }
-        else {
-            _events_filter = null
-        }
-        if (flags & 2) {
-            reader.readInt();
-            _admins = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _admins.push(_x);
-                }
-            }
-            else {
-                _admins = null
-            }
-            _max_id = reader.readLong();
-            _min_id = reader.readLong();
-            _limit = reader.readInt();
-            return new this({channel:_channel,
-	q:_q,
-	eventsFilter:_events_filter,
-	admins:_admins,
-	maxId:_max_id,
-	minId:_min_id,
-	limit:_limit})
-        }
-    }
-
-
-class SetStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xea8ca4f9;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xea8ca4f9;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.stickerset = args.stickerset;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f9a48cea","hex"),
-            this.channel.getBytes(),
-            this.stickerset.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _stickerset;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _stickerset = reader.tgReadObject();
-        return new this({channel:_channel,
-	stickerset:_stickerset})
-    }
-}
-
-
-class ReadMessageContentsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xeab5dc38;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xeab5dc38;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("38dcb5ea","hex"),
-            this.channel.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({channel:_channel,
-	id:_id})
-        }
-    }
-
-
-class DeleteHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xaf369d42;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xaf369d42;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.maxId = args.maxId;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("429d36af","hex"),
-            this.channel.getBytes(),
-            struct.pack('<i', this.maxId),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _max_id;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _max_id = reader.readInt();
-        return new this({channel:_channel,
-	maxId:_max_id})
-    }
-}
-
-
-class TogglePreHistoryHiddenRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xeabbb94c;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xeabbb94c;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.enabled = args.enabled;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4cb9bbea","hex"),
-            this.channel.getBytes(),
-            this.enabled ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _enabled;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _enabled = reader.tgReadBool();
-        return new this({channel:_channel,
-	enabled:_enabled})
-    }
-}
-
-
-class GetLeftChannelsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8341ecc0;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    :returns messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8341ecc0;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.offset = args.offset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c0ec4183","hex"),
-            struct.pack('<i', this.offset),
-            ])
-        }
-    static fromReader(reader) {
-        let _offset;
-        let _x;
-        let len;
-        _offset = reader.readInt();
-        return new this({offset:_offset})
-    }
-}
-
-
-class GetGroupsForDiscussionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf5dad378;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xf5dad378;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("78d3daf5","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SetDiscussionGroupRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x40582bb2;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x40582bb2;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.broadcast = args.broadcast;
-        this.group = args.group;
-    }
-    async resolve(client, utils) {
-        this.broadcast = utils.getInputChannel(await client.getInputEntity(this.broadcast))
-        this.group = utils.getInputChannel(await client.getInputEntity(this.group))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b22b5840","hex"),
-            this.broadcast.getBytes(),
-            this.group.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _broadcast;
-        let _group;
-        let _x;
-        let len;
-        _broadcast = reader.tgReadObject();
-        _group = reader.tgReadObject();
-        return new this({broadcast:_broadcast,
-	group:_group})
-    }
-}
-
-
-class EditCreatorRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8f38cd1f;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8f38cd1f;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.userId = args.userId;
-        this.password = args.password;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1fcd388f","hex"),
-            this.channel.getBytes(),
-            this.userId.getBytes(),
-            this.password.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _user_id;
-        let _password;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        _password = reader.tgReadObject();
-        return new this({channel:_channel,
-	userId:_user_id,
-	password:_password})
-    }
-}
-
-
-class EditLocationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x58e63f6d;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x58e63f6d;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.channel = args.channel;
-        this.geoPoint = args.geoPoint;
-        this.address = args.address;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6d3fe658","hex"),
-            this.channel.getBytes(),
-            this.geoPoint.getBytes(),
-            TLObject.serializeBytes(this.address),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _geo_point;
-        let _address;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _geo_point = reader.tgReadObject();
-        _address = reader.tgReadString();
-        return new this({channel:_channel,
-	geoPoint:_geo_point,
-	address:_address})
-    }
-}
-
-
-class ToggleSlowModeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xedd49ef0;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xedd49ef0;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.channel = args.channel;
-        this.seconds = args.seconds;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f09ed4ed","hex"),
-            this.channel.getBytes(),
-            struct.pack('<i', this.seconds),
-            ])
-        }
-    static fromReader(reader) {
-        let _channel;
-        let _seconds;
-        let _x;
-        let len;
-        _channel = reader.tgReadObject();
-        _seconds = reader.readInt();
-        return new this({channel:_channel,
-	seconds:_seconds})
-    }
-}
-
-module.exports = {
-    ReadHistoryRequest,
-    DeleteMessagesRequest,
-    DeleteUserHistoryRequest,
-    ReportSpamRequest,
-    GetMessagesRequest,
-    GetParticipantsRequest,
-    GetParticipantRequest,
-    GetChannelsRequest,
-    GetFullChannelRequest,
-    CreateChannelRequest,
-    EditAdminRequest,
-    EditTitleRequest,
-    EditPhotoRequest,
-    CheckUsernameRequest,
-    UpdateUsernameRequest,
-    JoinChannelRequest,
-    LeaveChannelRequest,
-    InviteToChannelRequest,
-    DeleteChannelRequest,
-    ExportMessageLinkRequest,
-    ToggleSignaturesRequest,
-    GetAdminedPublicChannelsRequest,
-    EditBannedRequest,
-    GetAdminLogRequest,
-    SetStickersRequest,
-    ReadMessageContentsRequest,
-    DeleteHistoryRequest,
-    TogglePreHistoryHiddenRequest,
-    GetLeftChannelsRequest,
-    GetGroupsForDiscussionRequest,
-    SetDiscussionGroupRequest,
-    EditCreatorRequest,
-    EditLocationRequest,
-    ToggleSlowModeRequest,
-};

+ 0 - 725
src/lib/gramjs/tl/functions/contacts.js

@@ -1,725 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetContactIDsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2caa4a42;
-    static SUBCLASS_OF_ID = 0x5026710f;
-
-    /**
-    :returns Vector<int>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2caa4a42;
-        this.SUBCLASS_OF_ID = 0x5026710f;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("424aaa2c","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-    readResult(reader){
-        reader.readInt();  // Vector ID
-        let temp = [];
-        let len = reader.readInt(); //fix this
-        for (let i=0;i<len;i++){
-            temp.push(reader.readInt())
-        }
-        return temp
-    }
-}
-
-
-class GetStatusesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc4a353ee;
-    static SUBCLASS_OF_ID = 0xdf815c90;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xc4a353ee;
-        this.SUBCLASS_OF_ID = 0xdf815c90;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ee53a3c4","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetContactsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc023849f;
-    static SUBCLASS_OF_ID = 0x38be25f6;
-
-    /**
-    :returns contacts.Contacts: Instance of either ContactsNotModified, Contacts
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc023849f;
-        this.SUBCLASS_OF_ID = 0x38be25f6;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9f8423c0","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class ImportContactsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2c800be5;
-    static SUBCLASS_OF_ID = 0x8172ad93;
-
-    /**
-    :returns contacts.ImportedContacts: Instance of ImportedContacts
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2c800be5;
-        this.SUBCLASS_OF_ID = 0x8172ad93;
-
-        this.contacts = args.contacts;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e50b802c","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.contacts.length),Buffer.concat(this.contacts.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _contacts;
-        let _x;
-        let len;
-        reader.readInt();
-        _contacts = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _contacts.push(_x);
-            }
-            return new this({contacts:_contacts})
-        }
-    }
-
-
-class DeleteContactsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x096a0e00;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x096a0e00;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.id) {
-            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
-        }
-        this.id = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("000e6a09","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class DeleteByPhonesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1013fd9e;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1013fd9e;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.phones = args.phones;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9efd1310","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.phones.length),Buffer.concat(this.phones.map(x => TLObject.serializeBytes(x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _phones;
-        let _x;
-        let len;
-        reader.readInt();
-        _phones = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadString();
-            _phones.push(_x);
-            }
-            return new this({phones:_phones})
-        }
-    }
-
-
-class BlockRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x332b49fc;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x332b49fc;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputUser(await client.getInputEntity(this.id))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fc492b33","hex"),
-            this.id.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        return new this({id:_id})
-    }
-}
-
-
-class UnblockRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe54100bd;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe54100bd;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputUser(await client.getInputEntity(this.id))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bd0041e5","hex"),
-            this.id.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        return new this({id:_id})
-    }
-}
-
-
-class GetBlockedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf57c350f;
-    static SUBCLASS_OF_ID = 0xffba4f4f;
-
-    /**
-    :returns contacts.Blocked: Instance of either Blocked, BlockedSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf57c350f;
-        this.SUBCLASS_OF_ID = 0xffba4f4f;
-
-        this.offset = args.offset;
-        this.limit = args.limit;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0f357cf5","hex"),
-            struct.pack('<i', this.offset),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _offset;
-        let _limit;
-        let _x;
-        let len;
-        _offset = reader.readInt();
-        _limit = reader.readInt();
-        return new this({offset:_offset,
-	limit:_limit})
-    }
-}
-
-
-class SearchRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x11f812d8;
-    static SUBCLASS_OF_ID = 0x4386a2e3;
-
-    /**
-    :returns contacts.Found: Instance of Found
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x11f812d8;
-        this.SUBCLASS_OF_ID = 0x4386a2e3;
-
-        this.q = args.q;
-        this.limit = args.limit;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d812f811","hex"),
-            TLObject.serializeBytes(this.q),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _q;
-        let _limit;
-        let _x;
-        let len;
-        _q = reader.tgReadString();
-        _limit = reader.readInt();
-        return new this({q:_q,
-	limit:_limit})
-    }
-}
-
-
-class ResolveUsernameRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf93ccba3;
-    static SUBCLASS_OF_ID = 0xf065b3a8;
-
-    /**
-    :returns contacts.ResolvedPeer: Instance of ResolvedPeer
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf93ccba3;
-        this.SUBCLASS_OF_ID = 0xf065b3a8;
-
-        this.username = args.username;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a3cb3cf9","hex"),
-            TLObject.serializeBytes(this.username),
-            ])
-        }
-    static fromReader(reader) {
-        let _username;
-        let _x;
-        let len;
-        _username = reader.tgReadString();
-        return new this({username:_username})
-    }
-}
-
-
-class GetTopPeersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd4982db5;
-    static SUBCLASS_OF_ID = 0x9ee8bb88;
-
-    /**
-    :returns contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers, TopPeersDisabled
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd4982db5;
-        this.SUBCLASS_OF_ID = 0x9ee8bb88;
-
-        this.correspondents = args.correspondents || null;
-        this.botsPm = args.botsPm || null;
-        this.botsInline = args.botsInline || null;
-        this.phoneCalls = args.phoneCalls || null;
-        this.forwardUsers = args.forwardUsers || null;
-        this.forwardChats = args.forwardChats || null;
-        this.groups = args.groups || null;
-        this.channels = args.channels || null;
-        this.offset = args.offset;
-        this.limit = args.limit;
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b52d98d4","hex"),
-            struct.pack('<I', (this.correspondents === undefined || this.correspondents === false || this.correspondents === null) ? 0 : 1 | (this.botsPm === undefined || this.botsPm === false || this.botsPm === null) ? 0 : 2 | (this.botsInline === undefined || this.botsInline === false || this.botsInline === null) ? 0 : 4 | (this.phoneCalls === undefined || this.phoneCalls === false || this.phoneCalls === null) ? 0 : 8 | (this.forwardUsers === undefined || this.forwardUsers === false || this.forwardUsers === null) ? 0 : 16 | (this.forwardChats === undefined || this.forwardChats === false || this.forwardChats === null) ? 0 : 32 | (this.groups === undefined || this.groups === false || this.groups === null) ? 0 : 1024 | (this.channels === undefined || this.channels === false || this.channels === null) ? 0 : 32768),
-            struct.pack('<i', this.offset),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _correspondents;
-        let _bots_pm;
-        let _bots_inline;
-        let _phone_calls;
-        let _forward_users;
-        let _forward_chats;
-        let _groups;
-        let _channels;
-        let _offset;
-        let _limit;
-        let _hash;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _correspondents = Boolean(flags & 1);
-        _bots_pm = Boolean(flags & 2);
-        _bots_inline = Boolean(flags & 4);
-        _phone_calls = Boolean(flags & 8);
-        _forward_users = Boolean(flags & 16);
-        _forward_chats = Boolean(flags & 32);
-        _groups = Boolean(flags & 1024);
-        _channels = Boolean(flags & 32768);
-        _offset = reader.readInt();
-        _limit = reader.readInt();
-        _hash = reader.readInt();
-        return new this({correspondents:_correspondents,
-	botsPm:_bots_pm,
-	botsInline:_bots_inline,
-	phoneCalls:_phone_calls,
-	forwardUsers:_forward_users,
-	forwardChats:_forward_chats,
-	groups:_groups,
-	channels:_channels,
-	offset:_offset,
-	limit:_limit,
-	hash:_hash})
-    }
-}
-
-
-class ResetTopPeerRatingRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1ae373ac;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1ae373ac;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.category = args.category;
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ac73e31a","hex"),
-            this.category.getBytes(),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _category;
-        let _peer;
-        let _x;
-        let len;
-        _category = reader.tgReadObject();
-        _peer = reader.tgReadObject();
-        return new this({category:_category,
-	peer:_peer})
-    }
-}
-
-
-class ResetSavedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x879537f1;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x879537f1;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f1379587","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetSavedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x82f1e39f;
-    static SUBCLASS_OF_ID = 0x975dbef;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x82f1e39f;
-        this.SUBCLASS_OF_ID = 0x975dbef;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9fe3f182","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ToggleTopPeersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8514bdda;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8514bdda;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.enabled = args.enabled;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("dabd1485","hex"),
-            this.enabled ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _enabled;
-        let _x;
-        let len;
-        _enabled = reader.tgReadBool();
-        return new this({enabled:_enabled})
-    }
-}
-
-
-class AddContactRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe8f463d0;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe8f463d0;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.addPhonePrivacyException = args.addPhonePrivacyException || null;
-        this.id = args.id;
-        this.firstName = args.firstName;
-        this.lastName = args.lastName;
-        this.phone = args.phone;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputUser(await client.getInputEntity(this.id))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d063f4e8","hex"),
-            struct.pack('<I', (this.addPhonePrivacyException === undefined || this.addPhonePrivacyException === false || this.addPhonePrivacyException === null) ? 0 : 1),
-            this.id.getBytes(),
-            TLObject.serializeBytes(this.firstName),
-            TLObject.serializeBytes(this.lastName),
-            TLObject.serializeBytes(this.phone),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _add_phone_privacy_exception;
-        let _id;
-        let _first_name;
-        let _last_name;
-        let _phone;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _add_phone_privacy_exception = Boolean(flags & 1);
-        _id = reader.tgReadObject();
-        _first_name = reader.tgReadString();
-        _last_name = reader.tgReadString();
-        _phone = reader.tgReadString();
-        return new this({addPhonePrivacyException:_add_phone_privacy_exception,
-	id:_id,
-	firstName:_first_name,
-	lastName:_last_name,
-	phone:_phone})
-    }
-}
-
-
-class AcceptContactRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf831a20f;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf831a20f;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputUser(await client.getInputEntity(this.id))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0fa231f8","hex"),
-            this.id.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        return new this({id:_id})
-    }
-}
-
-
-class GetLocatedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0a356056;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0a356056;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.geoPoint = args.geoPoint;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5660350a","hex"),
-            this.geoPoint.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _geo_point;
-        let _x;
-        let len;
-        _geo_point = reader.tgReadObject();
-        return new this({geoPoint:_geo_point})
-    }
-}
-
-module.exports = {
-    GetContactIDsRequest,
-    GetStatusesRequest,
-    GetContactsRequest,
-    ImportContactsRequest,
-    DeleteContactsRequest,
-    DeleteByPhonesRequest,
-    BlockRequest,
-    UnblockRequest,
-    GetBlockedRequest,
-    SearchRequest,
-    ResolveUsernameRequest,
-    GetTopPeersRequest,
-    ResetTopPeerRatingRequest,
-    ResetSavedRequest,
-    GetSavedRequest,
-    ToggleTopPeersRequest,
-    AddContactRequest,
-    AcceptContactRequest,
-    GetLocatedRequest,
-};

+ 0 - 79
src/lib/gramjs/tl/functions/folders.js

@@ -1,79 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class EditPeerFoldersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6847d0ab;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6847d0ab;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.folderPeers = args.folderPeers;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("abd04768","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.folderPeers.length),Buffer.concat(this.folderPeers.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _folder_peers;
-        let _x;
-        let len;
-        reader.readInt();
-        _folder_peers = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _folder_peers.push(_x);
-            }
-            return new this({folderPeers:_folder_peers})
-        }
-    }
-
-
-class DeleteFolderRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1c295881;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1c295881;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.folderId = args.folderId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8158291c","hex"),
-            struct.pack('<i', this.folderId),
-            ])
-        }
-    static fromReader(reader) {
-        let _folder_id;
-        let _x;
-        let len;
-        _folder_id = reader.readInt();
-        return new this({folderId:_folder_id})
-    }
-}
-
-module.exports = {
-    EditPeerFoldersRequest,
-    DeleteFolderRequest,
-};

+ 0 - 578
src/lib/gramjs/tl/functions/help.js

@@ -1,578 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetConfigRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc4f9186b;
-    static SUBCLASS_OF_ID = 0xd3262a4a;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xc4f9186b;
-        this.SUBCLASS_OF_ID = 0xd3262a4a;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6b18f9c4","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetNearestDcRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1fb33026;
-    static SUBCLASS_OF_ID = 0x3877045f;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x1fb33026;
-        this.SUBCLASS_OF_ID = 0x3877045f;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2630b31f","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetAppUpdateRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x522d5a7d;
-    static SUBCLASS_OF_ID = 0x5897069e;
-
-    /**
-    :returns help.AppUpdate: Instance of either AppUpdate, NoAppUpdate
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x522d5a7d;
-        this.SUBCLASS_OF_ID = 0x5897069e;
-
-        this.source = args.source;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7d5a2d52","hex"),
-            TLObject.serializeBytes(this.source),
-            ])
-        }
-    static fromReader(reader) {
-        let _source;
-        let _x;
-        let len;
-        _source = reader.tgReadString();
-        return new this({source:_source})
-    }
-}
-
-
-class GetInviteTextRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4d392343;
-    static SUBCLASS_OF_ID = 0xcf70aa35;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x4d392343;
-        this.SUBCLASS_OF_ID = 0xcf70aa35;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4323394d","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetSupportRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9cdf08cd;
-    static SUBCLASS_OF_ID = 0x7159bceb;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x9cdf08cd;
-        this.SUBCLASS_OF_ID = 0x7159bceb;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cd08df9c","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetAppChangelogRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9010ef6f;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9010ef6f;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.prevAppVersion = args.prevAppVersion;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6fef1090","hex"),
-            TLObject.serializeBytes(this.prevAppVersion),
-            ])
-        }
-    static fromReader(reader) {
-        let _prev_app_version;
-        let _x;
-        let len;
-        _prev_app_version = reader.tgReadString();
-        return new this({prevAppVersion:_prev_app_version})
-    }
-}
-
-
-class SetBotUpdatesStatusRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xec22cfcd;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xec22cfcd;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.pendingUpdatesCount = args.pendingUpdatesCount;
-        this.message = args.message;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cdcf22ec","hex"),
-            struct.pack('<i', this.pendingUpdatesCount),
-            TLObject.serializeBytes(this.message),
-            ])
-        }
-    static fromReader(reader) {
-        let _pending_updates_count;
-        let _message;
-        let _x;
-        let len;
-        _pending_updates_count = reader.readInt();
-        _message = reader.tgReadString();
-        return new this({pendingUpdatesCount:_pending_updates_count,
-	message:_message})
-    }
-}
-
-
-class GetCdnConfigRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x52029342;
-    static SUBCLASS_OF_ID = 0xecda397c;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x52029342;
-        this.SUBCLASS_OF_ID = 0xecda397c;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("42930252","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetRecentMeUrlsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3dc0f114;
-    static SUBCLASS_OF_ID = 0xf269c477;
-
-    /**
-    :returns help.RecentMeUrls: Instance of RecentMeUrls
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3dc0f114;
-        this.SUBCLASS_OF_ID = 0xf269c477;
-
-        this.referer = args.referer;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("14f1c03d","hex"),
-            TLObject.serializeBytes(this.referer),
-            ])
-        }
-    static fromReader(reader) {
-        let _referer;
-        let _x;
-        let len;
-        _referer = reader.tgReadString();
-        return new this({referer:_referer})
-    }
-}
-
-
-class GetProxyDataRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3d7758e1;
-    static SUBCLASS_OF_ID = 0x21e2a448;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x3d7758e1;
-        this.SUBCLASS_OF_ID = 0x21e2a448;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e158773d","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetTermsOfServiceUpdateRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2ca51fd1;
-    static SUBCLASS_OF_ID = 0x293c2977;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x2ca51fd1;
-        this.SUBCLASS_OF_ID = 0x293c2977;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d11fa52c","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class AcceptTermsOfServiceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xee72f79a;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xee72f79a;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9af772ee","hex"),
-            this.id.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        return new this({id:_id})
-    }
-}
-
-
-class GetDeepLinkInfoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3fedc75f;
-    static SUBCLASS_OF_ID = 0x984aac38;
-
-    /**
-    :returns help.DeepLinkInfo: Instance of either DeepLinkInfoEmpty, DeepLinkInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3fedc75f;
-        this.SUBCLASS_OF_ID = 0x984aac38;
-
-        this.path = args.path;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5fc7ed3f","hex"),
-            TLObject.serializeBytes(this.path),
-            ])
-        }
-    static fromReader(reader) {
-        let _path;
-        let _x;
-        let len;
-        _path = reader.tgReadString();
-        return new this({path:_path})
-    }
-}
-
-
-class GetAppConfigRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x98914110;
-    static SUBCLASS_OF_ID = 0xeb9987b3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x98914110;
-        this.SUBCLASS_OF_ID = 0xeb9987b3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("10419198","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SaveAppLogRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6f02f748;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6f02f748;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.events = args.events;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("48f7026f","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.events.length),Buffer.concat(this.events.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _events;
-        let _x;
-        let len;
-        reader.readInt();
-        _events = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _events.push(_x);
-            }
-            return new this({events:_events})
-        }
-    }
-
-
-class GetPassportConfigRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc661ad08;
-    static SUBCLASS_OF_ID = 0xc666c0ad;
-
-    /**
-    :returns help.PassportConfig: Instance of either PassportConfigNotModified, PassportConfig
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc661ad08;
-        this.SUBCLASS_OF_ID = 0xc666c0ad;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("08ad61c6","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class GetSupportNameRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd360e72c;
-    static SUBCLASS_OF_ID = 0x7f50b7c2;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xd360e72c;
-        this.SUBCLASS_OF_ID = 0x7f50b7c2;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2ce760d3","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetUserInfoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x038a08d3;
-    static SUBCLASS_OF_ID = 0x5c53d7d8;
-
-    /**
-    :returns help.UserInfo: Instance of either UserInfoEmpty, UserInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x038a08d3;
-        this.SUBCLASS_OF_ID = 0x5c53d7d8;
-
-        this.userId = args.userId;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d3088a03","hex"),
-            this.userId.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _user_id;
-        let _x;
-        let len;
-        _user_id = reader.tgReadObject();
-        return new this({userId:_user_id})
-    }
-}
-
-
-class EditUserInfoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x66b91b70;
-    static SUBCLASS_OF_ID = 0x5c53d7d8;
-
-    /**
-    :returns help.UserInfo: Instance of either UserInfoEmpty, UserInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x66b91b70;
-        this.SUBCLASS_OF_ID = 0x5c53d7d8;
-
-        this.userId = args.userId;
-        this.message = args.message;
-        this.entities = args.entities;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("701bb966","hex"),
-            this.userId.getBytes(),
-            TLObject.serializeBytes(this.message),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _user_id;
-        let _message;
-        let _entities;
-        let _x;
-        let len;
-        _user_id = reader.tgReadObject();
-        _message = reader.tgReadString();
-        reader.readInt();
-        _entities = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _entities.push(_x);
-            }
-            return new this({userId:_user_id,
-	message:_message,
-	entities:_entities})
-        }
-    }
-
-module.exports = {
-    GetConfigRequest,
-    GetNearestDcRequest,
-    GetAppUpdateRequest,
-    GetInviteTextRequest,
-    GetSupportRequest,
-    GetAppChangelogRequest,
-    SetBotUpdatesStatusRequest,
-    GetCdnConfigRequest,
-    GetRecentMeUrlsRequest,
-    GetProxyDataRequest,
-    GetTermsOfServiceUpdateRequest,
-    AcceptTermsOfServiceRequest,
-    GetDeepLinkInfoRequest,
-    GetAppConfigRequest,
-    SaveAppLogRequest,
-    GetPassportConfigRequest,
-    GetSupportNameRequest,
-    GetUserInfoRequest,
-    EditUserInfoRequest,
-};

+ 0 - 704
src/lib/gramjs/tl/functions/index.js

@@ -1,704 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class InvokeAfterMsgRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcb9f372d;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcb9f372d;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.msgId = args.msgId;
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2d379fcb","hex"),
-            readBufferFromBigInt(this.msgId,8,true,true),
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _msg_id;
-        let _query;
-        let _x;
-        let len;
-        _msg_id = reader.readLong();
-        _query = reader.tgReadObject();
-        return new this({msgId:_msg_id,
-	query:_query})
-    }
-}
-
-
-class InvokeAfterMsgsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3dc4b4f0;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3dc4b4f0;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.msgIds = args.msgIds;
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f0b4c43d","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.msgIds.length),Buffer.concat(this.msgIds.map(x => readBufferFromBigInt(x,8,true,true))),
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _msg_ids;
-        let _query;
-        let _x;
-        let len;
-        reader.readInt();
-        _msg_ids = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readLong();
-            _msg_ids.push(_x);
-            }
-            _query = reader.tgReadObject();
-            return new this({msgIds:_msg_ids,
-	query:_query})
-        }
-    }
-
-
-class InitConnectionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x785188b8;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x785188b8;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.apiId = args.apiId;
-        this.deviceModel = args.deviceModel;
-        this.systemVersion = args.systemVersion;
-        this.appVersion = args.appVersion;
-        this.systemLangCode = args.systemLangCode;
-        this.langPack = args.langPack;
-        this.langCode = args.langCode;
-        this.proxy = args.proxy || null;
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b8885178","hex"),
-            struct.pack('<I', (this.proxy === undefined || this.proxy === false || this.proxy === null) ? 0 : 1),
-            struct.pack('<i', this.apiId),
-            TLObject.serializeBytes(this.deviceModel),
-            TLObject.serializeBytes(this.systemVersion),
-            TLObject.serializeBytes(this.appVersion),
-            TLObject.serializeBytes(this.systemLangCode),
-            TLObject.serializeBytes(this.langPack),
-            TLObject.serializeBytes(this.langCode),
-            (this.proxy === undefined || this.proxy === false || this.proxy ===null) ? Buffer.alloc(0) : [this.proxy.getBytes()],
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _flags;
-        let _api_id;
-        let _device_model;
-        let _system_version;
-        let _app_version;
-        let _system_lang_code;
-        let _lang_pack;
-        let _lang_code;
-        let _proxy;
-        let _query;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _api_id = reader.readInt();
-        _device_model = reader.tgReadString();
-        _system_version = reader.tgReadString();
-        _app_version = reader.tgReadString();
-        _system_lang_code = reader.tgReadString();
-        _lang_pack = reader.tgReadString();
-        _lang_code = reader.tgReadString();
-        if (flags & 1) {
-            _proxy = reader.tgReadObject();
-        }
-        else {
-            _proxy = null
-        }
-        _query = reader.tgReadObject();
-        return new this({apiId:_api_id,
-	deviceModel:_device_model,
-	systemVersion:_system_version,
-	appVersion:_app_version,
-	systemLangCode:_system_lang_code,
-	langPack:_lang_pack,
-	langCode:_lang_code,
-	proxy:_proxy,
-	query:_query})
-    }
-}
-
-
-class InvokeWithLayerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xda9b0d0d;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xda9b0d0d;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.layer = args.layer;
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0d0d9bda","hex"),
-            struct.pack('<i', this.layer),
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _layer;
-        let _query;
-        let _x;
-        let len;
-        _layer = reader.readInt();
-        _query = reader.tgReadObject();
-        return new this({layer:_layer,
-	query:_query})
-    }
-}
-
-
-class InvokeWithoutUpdatesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbf9459b7;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbf9459b7;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b75994bf","hex"),
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _query;
-        let _x;
-        let len;
-        _query = reader.tgReadObject();
-        return new this({query:_query})
-    }
-}
-
-
-class InvokeWithMessagesRangeRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x365275f2;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x365275f2;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.range = args.range;
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f2755236","hex"),
-            this.range.getBytes(),
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _range;
-        let _query;
-        let _x;
-        let len;
-        _range = reader.tgReadObject();
-        _query = reader.tgReadObject();
-        return new this({range:_range,
-	query:_query})
-    }
-}
-
-
-class InvokeWithTakeoutRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xaca9fd2e;
-    static SUBCLASS_OF_ID = 0xb7b2364b;
-
-    /**
-    :returns X: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xaca9fd2e;
-        this.SUBCLASS_OF_ID = 0xb7b2364b;
-
-        this.takeoutId = args.takeoutId;
-        this.query = args.query;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2efda9ac","hex"),
-            readBufferFromBigInt(this.takeoutId,8,true,true),
-            this.query.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _X;
-        let _takeout_id;
-        let _query;
-        let _x;
-        let len;
-        _takeout_id = reader.readLong();
-        _query = reader.tgReadObject();
-        return new this({takeoutId:_takeout_id,
-	query:_query})
-    }
-}
-
-
-class ReqPqRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x60469778;
-    static SUBCLASS_OF_ID = 0x786986b8;
-
-    /**
-    :returns ResPQ: Instance of ResPQ
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x60469778;
-        this.SUBCLASS_OF_ID = 0x786986b8;
-
-        this.nonce = args.nonce;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("78974660","hex"),
-            readBufferFromBigInt(this.nonce,16,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _nonce;
-        let _x;
-        let len;
-        _nonce = reader.readLargeInt(128);
-        return new this({nonce:_nonce})
-    }
-}
-
-
-class ReqPqMultiRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbe7e8ef1;
-    static SUBCLASS_OF_ID = 0x786986b8;
-
-    /**
-    :returns ResPQ: Instance of ResPQ
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbe7e8ef1;
-        this.SUBCLASS_OF_ID = 0x786986b8;
-
-        this.nonce = args.nonce;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f18e7ebe","hex"),
-            readBufferFromBigInt(this.nonce,16,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _nonce;
-        let _x;
-        let len;
-        _nonce = reader.readLargeInt(128);
-        return new this({nonce:_nonce})
-    }
-}
-
-
-class ReqDHParamsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd712e4be;
-    static SUBCLASS_OF_ID = 0xa6188d9e;
-
-    /**
-    :returns Server_DH_Params: Instance of either ServerDHParamsFail, ServerDHParamsOk
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd712e4be;
-        this.SUBCLASS_OF_ID = 0xa6188d9e;
-
-        this.nonce = args.nonce;
-        this.serverNonce = args.serverNonce;
-        this.p = args.p;
-        this.q = args.q;
-        this.publicKeyFingerprint = args.publicKeyFingerprint;
-        this.encryptedData = args.encryptedData;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bee412d7","hex"),
-            readBufferFromBigInt(this.nonce,16,true,true),
-            readBufferFromBigInt(this.serverNonce,16,true,true),
-            TLObject.serializeBytes(this.p),
-            TLObject.serializeBytes(this.q),
-            readBufferFromBigInt(this.publicKeyFingerprint,8,true,true),
-            TLObject.serializeBytes(this.encryptedData),
-            ])
-        }
-    static fromReader(reader) {
-        let _nonce;
-        let _server_nonce;
-        let _p;
-        let _q;
-        let _public_key_fingerprint;
-        let _encrypted_data;
-        let _x;
-        let len;
-        _nonce = reader.readLargeInt(128);
-        _server_nonce = reader.readLargeInt(128);
-        _p = reader.tgReadBytes();
-        _q = reader.tgReadBytes();
-        _public_key_fingerprint = reader.readLong();
-        _encrypted_data = reader.tgReadBytes();
-        return new this({nonce:_nonce,
-	serverNonce:_server_nonce,
-	p:_p,
-	q:_q,
-	publicKeyFingerprint:_public_key_fingerprint,
-	encryptedData:_encrypted_data})
-    }
-}
-
-
-class SetClientDHParamsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf5045f1f;
-    static SUBCLASS_OF_ID = 0x55dd6cdb;
-
-    /**
-    :returns Set_client_DH_params_answer: Instance of either DhGenOk, DhGenRetry, DhGenFail
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf5045f1f;
-        this.SUBCLASS_OF_ID = 0x55dd6cdb;
-
-        this.nonce = args.nonce;
-        this.serverNonce = args.serverNonce;
-        this.encryptedData = args.encryptedData;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1f5f04f5","hex"),
-            readBufferFromBigInt(this.nonce,16,true,true),
-            readBufferFromBigInt(this.serverNonce,16,true,true),
-            TLObject.serializeBytes(this.encryptedData),
-            ])
-        }
-    static fromReader(reader) {
-        let _nonce;
-        let _server_nonce;
-        let _encrypted_data;
-        let _x;
-        let len;
-        _nonce = reader.readLargeInt(128);
-        _server_nonce = reader.readLargeInt(128);
-        _encrypted_data = reader.tgReadBytes();
-        return new this({nonce:_nonce,
-	serverNonce:_server_nonce,
-	encryptedData:_encrypted_data})
-    }
-}
-
-
-class DestroyAuthKeyRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd1435160;
-    static SUBCLASS_OF_ID = 0x8291e68e;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xd1435160;
-        this.SUBCLASS_OF_ID = 0x8291e68e;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("605143d1","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class RpcDropAnswerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x58e4a740;
-    static SUBCLASS_OF_ID = 0x4bca7570;
-
-    /**
-    :returns RpcDropAnswer: Instance of either RpcAnswerUnknown, RpcAnswerDroppedRunning, RpcAnswerDropped
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x58e4a740;
-        this.SUBCLASS_OF_ID = 0x4bca7570;
-
-        this.reqMsgId = args.reqMsgId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("40a7e458","hex"),
-            readBufferFromBigInt(this.reqMsgId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _req_msg_id;
-        let _x;
-        let len;
-        _req_msg_id = reader.readLong();
-        return new this({reqMsgId:_req_msg_id})
-    }
-}
-
-
-class GetFutureSaltsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb921bd04;
-    static SUBCLASS_OF_ID = 0x1090f517;
-
-    /**
-    :returns FutureSalts: Instance of FutureSalts
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb921bd04;
-        this.SUBCLASS_OF_ID = 0x1090f517;
-
-        this.num = args.num;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("04bd21b9","hex"),
-            struct.pack('<i', this.num),
-            ])
-        }
-    static fromReader(reader) {
-        let _num;
-        let _x;
-        let len;
-        _num = reader.readInt();
-        return new this({num:_num})
-    }
-}
-
-
-class PingRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x7abe77ec;
-    static SUBCLASS_OF_ID = 0x816aee71;
-
-    /**
-    :returns Pong: Instance of Pong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x7abe77ec;
-        this.SUBCLASS_OF_ID = 0x816aee71;
-
-        this.pingId = args.pingId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ec77be7a","hex"),
-            readBufferFromBigInt(this.pingId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _ping_id;
-        let _x;
-        let len;
-        _ping_id = reader.readLong();
-        return new this({pingId:_ping_id})
-    }
-}
-
-
-class PingDelayDisconnectRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf3427b8c;
-    static SUBCLASS_OF_ID = 0x816aee71;
-
-    /**
-    :returns Pong: Instance of Pong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf3427b8c;
-        this.SUBCLASS_OF_ID = 0x816aee71;
-
-        this.pingId = args.pingId;
-        this.disconnectDelay = args.disconnectDelay;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8c7b42f3","hex"),
-            readBufferFromBigInt(this.pingId,8,true,true),
-            struct.pack('<i', this.disconnectDelay),
-            ])
-        }
-    static fromReader(reader) {
-        let _ping_id;
-        let _disconnect_delay;
-        let _x;
-        let len;
-        _ping_id = reader.readLong();
-        _disconnect_delay = reader.readInt();
-        return new this({pingId:_ping_id,
-	disconnectDelay:_disconnect_delay})
-    }
-}
-
-
-class DestroySessionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe7512126;
-    static SUBCLASS_OF_ID = 0xaf0ce7bd;
-
-    /**
-    :returns DestroySessionRes: Instance of either DestroySessionOk, DestroySessionNone
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe7512126;
-        this.SUBCLASS_OF_ID = 0xaf0ce7bd;
-
-        this.sessionId = args.sessionId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("262151e7","hex"),
-            readBufferFromBigInt(this.sessionId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _session_id;
-        let _x;
-        let len;
-        _session_id = reader.readLong();
-        return new this({sessionId:_session_id})
-    }
-}
-
-module.exports = {
-    InvokeAfterMsgRequest,
-    InvokeAfterMsgsRequest,
-    InitConnectionRequest,
-    InvokeWithLayerRequest,
-    InvokeWithoutUpdatesRequest,
-    InvokeWithMessagesRangeRequest,
-    InvokeWithTakeoutRequest,
-    ReqPqRequest,
-    ReqPqMultiRequest,
-    ReqDHParamsRequest,
-    SetClientDHParamsRequest,
-    DestroyAuthKeyRequest,
-    RpcDropAnswerRequest,
-    GetFutureSaltsRequest,
-    PingRequest,
-    PingDelayDisconnectRequest,
-    DestroySessionRequest,
-};
-let auth = require('./auth');
-let account = require('./account');
-let users = require('./users');
-let contacts = require('./contacts');
-let messages = require('./messages');
-let updates = require('./updates');
-let photos = require('./photos');
-let upload = require('./upload');
-let help = require('./help');
-let channels = require('./channels');
-let bots = require('./bots');
-let payments = require('./payments');
-let stickers = require('./stickers');
-let phone = require('./phone');
-let langpack = require('./langpack');
-let folders = require('./folders');
-module.exports.auth = auth;
-module.exports.account = account;
-module.exports.users = users;
-module.exports.contacts = contacts;
-module.exports.messages = messages;
-module.exports.updates = updates;
-module.exports.photos = photos;
-module.exports.upload = upload;
-module.exports.help = help;
-module.exports.channels = channels;
-module.exports.bots = bots;
-module.exports.payments = payments;
-module.exports.stickers = stickers;
-module.exports.phone = phone;
-module.exports.langpack = langpack;
-module.exports.folders = folders;

+ 0 - 205
src/lib/gramjs/tl/functions/langpack.js

@@ -1,205 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetLangPackRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf2f2330a;
-    static SUBCLASS_OF_ID = 0x52662d55;
-
-    /**
-    :returns LangPackDifference: Instance of LangPackDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf2f2330a;
-        this.SUBCLASS_OF_ID = 0x52662d55;
-
-        this.langPack = args.langPack;
-        this.langCode = args.langCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0a33f2f2","hex"),
-            TLObject.serializeBytes(this.langPack),
-            TLObject.serializeBytes(this.langCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_pack;
-        let _lang_code;
-        let _x;
-        let len;
-        _lang_pack = reader.tgReadString();
-        _lang_code = reader.tgReadString();
-        return new this({langPack:_lang_pack,
-	langCode:_lang_code})
-    }
-}
-
-
-class GetStringsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xefea3803;
-    static SUBCLASS_OF_ID = 0xc7b7353d;
-
-    /**
-    :returns Vector<LangPackString>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xefea3803;
-        this.SUBCLASS_OF_ID = 0xc7b7353d;
-
-        this.langPack = args.langPack;
-        this.langCode = args.langCode;
-        this.keys = args.keys;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0338eaef","hex"),
-            TLObject.serializeBytes(this.langPack),
-            TLObject.serializeBytes(this.langCode),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.keys.length),Buffer.concat(this.keys.map(x => TLObject.serializeBytes(x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_pack;
-        let _lang_code;
-        let _keys;
-        let _x;
-        let len;
-        _lang_pack = reader.tgReadString();
-        _lang_code = reader.tgReadString();
-        reader.readInt();
-        _keys = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadString();
-            _keys.push(_x);
-            }
-            return new this({langPack:_lang_pack,
-	langCode:_lang_code,
-	keys:_keys})
-        }
-    }
-
-
-class GetDifferenceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcd984aa5;
-    static SUBCLASS_OF_ID = 0x52662d55;
-
-    /**
-    :returns LangPackDifference: Instance of LangPackDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcd984aa5;
-        this.SUBCLASS_OF_ID = 0x52662d55;
-
-        this.langPack = args.langPack;
-        this.langCode = args.langCode;
-        this.fromVersion = args.fromVersion;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a54a98cd","hex"),
-            TLObject.serializeBytes(this.langPack),
-            TLObject.serializeBytes(this.langCode),
-            struct.pack('<i', this.fromVersion),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_pack;
-        let _lang_code;
-        let _from_version;
-        let _x;
-        let len;
-        _lang_pack = reader.tgReadString();
-        _lang_code = reader.tgReadString();
-        _from_version = reader.readInt();
-        return new this({langPack:_lang_pack,
-	langCode:_lang_code,
-	fromVersion:_from_version})
-    }
-}
-
-
-class GetLanguagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x42c6978f;
-    static SUBCLASS_OF_ID = 0x280912c9;
-
-    /**
-    :returns Vector<LangPackLanguage>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x42c6978f;
-        this.SUBCLASS_OF_ID = 0x280912c9;
-
-        this.langPack = args.langPack;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8f97c642","hex"),
-            TLObject.serializeBytes(this.langPack),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_pack;
-        let _x;
-        let len;
-        _lang_pack = reader.tgReadString();
-        return new this({langPack:_lang_pack})
-    }
-}
-
-
-class GetLanguageRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6a596502;
-    static SUBCLASS_OF_ID = 0xabac89b7;
-
-    /**
-    :returns LangPackLanguage: Instance of LangPackLanguage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6a596502;
-        this.SUBCLASS_OF_ID = 0xabac89b7;
-
-        this.langPack = args.langPack;
-        this.langCode = args.langCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0265596a","hex"),
-            TLObject.serializeBytes(this.langPack),
-            TLObject.serializeBytes(this.langCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_pack;
-        let _lang_code;
-        let _x;
-        let len;
-        _lang_pack = reader.tgReadString();
-        _lang_code = reader.tgReadString();
-        return new this({langPack:_lang_pack,
-	langCode:_lang_code})
-    }
-}
-
-module.exports = {
-    GetLangPackRequest,
-    GetStringsRequest,
-    GetDifferenceRequest,
-    GetLanguagesRequest,
-    GetLanguageRequest,
-};

+ 0 - 5464
src/lib/gramjs/tl/functions/messages.js

@@ -1,5464 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const {InputPeerEmpty} = require("../types")
-const { readBigIntFromBuffer,
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x63c66506;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x63c66506;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.id) {
-            _tmp.push(utils.getInputMessage(_x));
-        }
-        this.id = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0665c663","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class GetDialogsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa0ee3b73;
-    static SUBCLASS_OF_ID = 0xe1b52ee;
-
-    /**
-    :returns messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa0ee3b73;
-        this.SUBCLASS_OF_ID = 0xe1b52ee;
-
-        this.excludePinned = args.excludePinned || null;
-        this.folderId = args.folderId || null;
-        this.offsetDate = args.offsetDate;
-        this.offsetId = args.offsetId;
-        this.offsetPeer = args.offsetPeer || new InputPeerEmpty();
-        this.limit = args.limit;
-        this.hash = args.hash;
-    }
-    async resolve(client, utils) {
-        this.offset_peer = utils.getInputPeer(await client.getInputEntity(this.offsetPeer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("733beea0","hex"),
-            struct.pack('<I', (this.excludePinned === undefined || this.excludePinned === false || this.excludePinned === null) ? 0 : 1 | (this.folderId === undefined || this.folderId === false || this.folderId === null) ? 0 : 2),
-            (this.folderId === undefined || this.folderId === false || this.folderId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.folderId)],
-            struct.pack('<i', this.offsetDate),
-            struct.pack('<i', this.offsetId),
-            this.offsetPeer.getBytes(),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _exclude_pinned;
-        let _folder_id;
-        let _offset_date;
-        let _offset_id;
-        let _offset_peer;
-        let _limit;
-        let _hash;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _exclude_pinned = Boolean(flags & 1);
-        if (flags & 2) {
-            _folder_id = reader.readInt();
-        }
-        else {
-            _folder_id = null
-        }
-        _offset_date = reader.readInt();
-        _offset_id = reader.readInt();
-        _offset_peer = reader.tgReadObject();
-        _limit = reader.readInt();
-        _hash = reader.readInt();
-        return new this({excludePinned:_exclude_pinned,
-	folderId:_folder_id,
-	offsetDate:_offset_date,
-	offsetId:_offset_id,
-	offsetPeer:_offset_peer,
-	limit:_limit,
-	hash:_hash})
-    }
-}
-
-
-class GetHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdcbb8260;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdcbb8260;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.peer = args.peer;
-        this.offsetId = args.offsetId;
-        this.offsetDate = args.offsetDate;
-        this.addOffset = args.addOffset;
-        this.limit = args.limit;
-        this.maxId = args.maxId;
-        this.minId = args.minId;
-        this.hash = args.hash;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6082bbdc","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.offsetId),
-            struct.pack('<i', this.offsetDate),
-            struct.pack('<i', this.addOffset),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.maxId),
-            struct.pack('<i', this.minId),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _offset_id;
-        let _offset_date;
-        let _add_offset;
-        let _limit;
-        let _max_id;
-        let _min_id;
-        let _hash;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _offset_id = reader.readInt();
-        _offset_date = reader.readInt();
-        _add_offset = reader.readInt();
-        _limit = reader.readInt();
-        _max_id = reader.readInt();
-        _min_id = reader.readInt();
-        _hash = reader.readInt();
-        return new this({peer:_peer,
-	offsetId:_offset_id,
-	offsetDate:_offset_date,
-	addOffset:_add_offset,
-	limit:_limit,
-	maxId:_max_id,
-	minId:_min_id,
-	hash:_hash})
-    }
-}
-
-
-class SearchRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8614ef68;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8614ef68;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.peer = args.peer;
-        this.q = args.q;
-        this.fromId = args.fromId || null;
-        this.filter = args.filter;
-        this.minDate = args.minDate;
-        this.maxDate = args.maxDate;
-        this.offsetId = args.offsetId;
-        this.addOffset = args.addOffset;
-        this.limit = args.limit;
-        this.maxId = args.maxId;
-        this.minId = args.minId;
-        this.hash = args.hash;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-        if (this.fromId) {
-            this.from_id = utils.getInputUser(await client.getInputEntity(this.fromId))
-        }
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("68ef1486","hex"),
-            struct.pack('<I', (this.fromId === undefined || this.fromId === false || this.fromId === null) ? 0 : 1),
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.q),
-            (this.fromId === undefined || this.fromId === false || this.fromId ===null) ? Buffer.alloc(0) : [this.fromId.getBytes()],
-            this.filter.getBytes(),
-            struct.pack('<i', this.minDate),
-            struct.pack('<i', this.maxDate),
-            struct.pack('<i', this.offsetId),
-            struct.pack('<i', this.addOffset),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.maxId),
-            struct.pack('<i', this.minId),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _peer;
-        let _q;
-        let _from_id;
-        let _filter;
-        let _min_date;
-        let _max_date;
-        let _offset_id;
-        let _add_offset;
-        let _limit;
-        let _max_id;
-        let _min_id;
-        let _hash;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _peer = reader.tgReadObject();
-        _q = reader.tgReadString();
-        if (flags & 1) {
-            _from_id = reader.tgReadObject();
-        }
-        else {
-            _from_id = null
-        }
-        _filter = reader.tgReadObject();
-        _min_date = reader.readInt();
-        _max_date = reader.readInt();
-        _offset_id = reader.readInt();
-        _add_offset = reader.readInt();
-        _limit = reader.readInt();
-        _max_id = reader.readInt();
-        _min_id = reader.readInt();
-        _hash = reader.readInt();
-        return new this({peer:_peer,
-	q:_q,
-	fromId:_from_id,
-	filter:_filter,
-	minDate:_min_date,
-	maxDate:_max_date,
-	offsetId:_offset_id,
-	addOffset:_add_offset,
-	limit:_limit,
-	maxId:_max_id,
-	minId:_min_id,
-	hash:_hash})
-    }
-}
-
-
-class ReadHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0e306d3a;
-    static SUBCLASS_OF_ID = 0xced3c06e;
-
-    /**
-    :returns messages.AffectedMessages: Instance of AffectedMessages
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0e306d3a;
-        this.SUBCLASS_OF_ID = 0xced3c06e;
-
-        this.peer = args.peer;
-        this.maxId = args.maxId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3a6d300e","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.maxId),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _max_id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _max_id = reader.readInt();
-        return new this({peer:_peer,
-	maxId:_max_id})
-    }
-}
-
-
-class DeleteHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1c015b09;
-    static SUBCLASS_OF_ID = 0x2c49c116;
-
-    /**
-    :returns messages.AffectedHistory: Instance of AffectedHistory
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1c015b09;
-        this.SUBCLASS_OF_ID = 0x2c49c116;
-
-        this.justClear = args.justClear || null;
-        this.revoke = args.revoke || null;
-        this.peer = args.peer;
-        this.maxId = args.maxId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("095b011c","hex"),
-            struct.pack('<I', (this.justClear === undefined || this.justClear === false || this.justClear === null) ? 0 : 1 | (this.revoke === undefined || this.revoke === false || this.revoke === null) ? 0 : 2),
-            this.peer.getBytes(),
-            struct.pack('<i', this.maxId),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _just_clear;
-        let _revoke;
-        let _peer;
-        let _max_id;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _just_clear = Boolean(flags & 1);
-        _revoke = Boolean(flags & 2);
-        _peer = reader.tgReadObject();
-        _max_id = reader.readInt();
-        return new this({justClear:_just_clear,
-	revoke:_revoke,
-	peer:_peer,
-	maxId:_max_id})
-    }
-}
-
-
-class DeleteMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe58e95d2;
-    static SUBCLASS_OF_ID = 0xced3c06e;
-
-    /**
-    :returns messages.AffectedMessages: Instance of AffectedMessages
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe58e95d2;
-        this.SUBCLASS_OF_ID = 0xced3c06e;
-
-        this.revoke = args.revoke || null;
-        this.id = args.id;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d2958ee5","hex"),
-            struct.pack('<I', (this.revoke === undefined || this.revoke === false || this.revoke === null) ? 0 : 1),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _revoke;
-        let _id;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _revoke = Boolean(flags & 1);
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({revoke:_revoke,
-	id:_id})
-        }
-    }
-
-
-class ReceivedMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x05a954c0;
-    static SUBCLASS_OF_ID = 0x8565f897;
-
-    /**
-    :returns Vector<ReceivedNotifyMessage>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x05a954c0;
-        this.SUBCLASS_OF_ID = 0x8565f897;
-
-        this.maxId = args.maxId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c054a905","hex"),
-            struct.pack('<i', this.maxId),
-            ])
-        }
-    static fromReader(reader) {
-        let _max_id;
-        let _x;
-        let len;
-        _max_id = reader.readInt();
-        return new this({maxId:_max_id})
-    }
-}
-
-
-class SetTypingRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa3825e50;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa3825e50;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.action = args.action;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("505e82a3","hex"),
-            this.peer.getBytes(),
-            this.action.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _action;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _action = reader.tgReadObject();
-        return new this({peer:_peer,
-	action:_action})
-    }
-}
-
-
-class SendMessageRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x520c3870;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x520c3870;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.noWebpage = args.noWebpage || null;
-        this.silent = args.silent || null;
-        this.background = args.background || null;
-        this.clearDraft = args.clearDraft || null;
-        this.peer = args.peer;
-        this.replyToMsgId = args.replyToMsgId || null;
-        this.message = args.message;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.replyMarkup = args.replyMarkup || null;
-        this.entities = args.entities || null;
-        this.scheduleDate = args.scheduleDate || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("70380c52","hex"),
-            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
-            this.peer.getBytes(),
-            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
-            TLObject.serializeBytes(this.message),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _no_webpage;
-        let _silent;
-        let _background;
-        let _clear_draft;
-        let _peer;
-        let _reply_to_msg_id;
-        let _message;
-        let _random_id;
-        let _reply_markup;
-        let _entities;
-        let _schedule_date;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _no_webpage = Boolean(flags & 2);
-        _silent = Boolean(flags & 32);
-        _background = Boolean(flags & 64);
-        _clear_draft = Boolean(flags & 128);
-        _peer = reader.tgReadObject();
-        if (flags & 1) {
-            _reply_to_msg_id = reader.readInt();
-        }
-        else {
-            _reply_to_msg_id = null
-        }
-        _message = reader.tgReadString();
-        _random_id = reader.readLong();
-        if (flags & 4) {
-            _reply_markup = reader.tgReadObject();
-        }
-        else {
-            _reply_markup = null
-        }
-        if (flags & 8) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            if (flags & 1024) {
-                _schedule_date = reader.readInt();
-            }
-            else {
-                _schedule_date = null
-            }
-            return new this({noWebpage:_no_webpage,
-	silent:_silent,
-	background:_background,
-	clearDraft:_clear_draft,
-	peer:_peer,
-	replyToMsgId:_reply_to_msg_id,
-	message:_message,
-	randomId:_random_id,
-	replyMarkup:_reply_markup,
-	entities:_entities,
-	scheduleDate:_schedule_date})
-        }
-    }
-
-
-class SendMediaRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3491eba9;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3491eba9;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.silent = args.silent || null;
-        this.background = args.background || null;
-        this.clearDraft = args.clearDraft || null;
-        this.peer = args.peer;
-        this.replyToMsgId = args.replyToMsgId || null;
-        this.media = args.media;
-        this.message = args.message;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.replyMarkup = args.replyMarkup || null;
-        this.entities = args.entities || null;
-        this.scheduleDate = args.scheduleDate || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-        this.media = utils.getInputMedia(this.media)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a9eb9134","hex"),
-            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
-            this.peer.getBytes(),
-            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
-            this.media.getBytes(),
-            TLObject.serializeBytes(this.message),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _silent;
-        let _background;
-        let _clear_draft;
-        let _peer;
-        let _reply_to_msg_id;
-        let _media;
-        let _message;
-        let _random_id;
-        let _reply_markup;
-        let _entities;
-        let _schedule_date;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _silent = Boolean(flags & 32);
-        _background = Boolean(flags & 64);
-        _clear_draft = Boolean(flags & 128);
-        _peer = reader.tgReadObject();
-        if (flags & 1) {
-            _reply_to_msg_id = reader.readInt();
-        }
-        else {
-            _reply_to_msg_id = null
-        }
-        _media = reader.tgReadObject();
-        _message = reader.tgReadString();
-        _random_id = reader.readLong();
-        if (flags & 4) {
-            _reply_markup = reader.tgReadObject();
-        }
-        else {
-            _reply_markup = null
-        }
-        if (flags & 8) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            if (flags & 1024) {
-                _schedule_date = reader.readInt();
-            }
-            else {
-                _schedule_date = null
-            }
-            return new this({silent:_silent,
-	background:_background,
-	clearDraft:_clear_draft,
-	peer:_peer,
-	replyToMsgId:_reply_to_msg_id,
-	media:_media,
-	message:_message,
-	randomId:_random_id,
-	replyMarkup:_reply_markup,
-	entities:_entities,
-	scheduleDate:_schedule_date})
-        }
-    }
-
-
-class ForwardMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd9fee60e;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd9fee60e;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.silent = args.silent || null;
-        this.background = args.background || null;
-        this.withMyScore = args.withMyScore || null;
-        this.grouped = args.grouped || null;
-        this.fromPeer = args.fromPeer;
-        this.id = args.id;
-        this.randomId = args.randomId !== undefined ? args.randomId : new Array(id.length).fill().map(_ => readBigIntFromBuffer(generateRandomBytes(8),false,true));
-        this.toPeer = args.toPeer;
-        this.scheduleDate = args.scheduleDate || null;
-    }
-    async resolve(client, utils) {
-        this.from_peer = utils.getInputPeer(await client.getInputEntity(this.fromPeer))
-        this.to_peer = utils.getInputPeer(await client.getInputEntity(this.toPeer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0ee6fed9","hex"),
-            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.withMyScore === undefined || this.withMyScore === false || this.withMyScore === null) ? 0 : 256 | (this.grouped === undefined || this.grouped === false || this.grouped === null) ? 0 : 512 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
-            this.fromPeer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.randomId.length),Buffer.concat(this.randomId.map(x => readBufferFromBigInt(x,8,true,true))),
-            this.toPeer.getBytes(),
-            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _silent;
-        let _background;
-        let _with_my_score;
-        let _grouped;
-        let _from_peer;
-        let _id;
-        let _random_id;
-        let _to_peer;
-        let _schedule_date;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _silent = Boolean(flags & 32);
-        _background = Boolean(flags & 64);
-        _with_my_score = Boolean(flags & 256);
-        _grouped = Boolean(flags & 512);
-        _from_peer = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            reader.readInt();
-            _random_id = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.readLong();
-                _random_id.push(_x);
-                }
-                _to_peer = reader.tgReadObject();
-                if (flags & 1024) {
-                    _schedule_date = reader.readInt();
-                }
-                else {
-                    _schedule_date = null
-                }
-                return new this({silent:_silent,
-	background:_background,
-	withMyScore:_with_my_score,
-	grouped:_grouped,
-	fromPeer:_from_peer,
-	id:_id,
-	randomId:_random_id,
-	toPeer:_to_peer,
-	scheduleDate:_schedule_date})
-            }
-        }
-
-
-class ReportSpamRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcf1592db;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcf1592db;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("db9215cf","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class GetPeerSettingsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3672e09c;
-    static SUBCLASS_OF_ID = 0xf6a79f84;
-
-    /**
-    :returns PeerSettings: Instance of PeerSettings
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3672e09c;
-        this.SUBCLASS_OF_ID = 0xf6a79f84;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9ce07236","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class ReportRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbd82b658;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbd82b658;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.id = args.id;
-        this.reason = args.reason;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("58b682bd","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            this.reason.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _reason;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            _reason = reader.tgReadObject();
-            return new this({peer:_peer,
-	id:_id,
-	reason:_reason})
-        }
-    }
-
-
-class GetChatsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3c6aa187;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    :returns messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3c6aa187;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.id = args.id;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("87a16a3c","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class GetFullChatRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3b831c66;
-    static SUBCLASS_OF_ID = 0x225a5109;
-
-    /**
-    :returns messages.ChatFull: Instance of ChatFull
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3b831c66;
-        this.SUBCLASS_OF_ID = 0x225a5109;
-
-        this.chatId = args.chatId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("661c833b","hex"),
-            struct.pack('<i', this.chatId),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        return new this({chatId:_chat_id})
-    }
-}
-
-
-class EditChatTitleRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdc452855;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdc452855;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.chatId = args.chatId;
-        this.title = args.title;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("552845dc","hex"),
-            struct.pack('<i', this.chatId),
-            TLObject.serializeBytes(this.title),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _title;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        _title = reader.tgReadString();
-        return new this({chatId:_chat_id,
-	title:_title})
-    }
-}
-
-
-class EditChatPhotoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xca4c79d8;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xca4c79d8;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.chatId = args.chatId;
-        this.photo = args.photo;
-    }
-    async resolve(client, utils) {
-        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
-        this.photo = utils.getInputChatPhoto(this.photo)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d8794cca","hex"),
-            struct.pack('<i', this.chatId),
-            this.photo.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _photo;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        _photo = reader.tgReadObject();
-        return new this({chatId:_chat_id,
-	photo:_photo})
-    }
-}
-
-
-class AddChatUserRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf9a0aa09;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf9a0aa09;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.chatId = args.chatId;
-        this.userId = args.userId;
-        this.fwdLimit = args.fwdLimit;
-    }
-    async resolve(client, utils) {
-        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("09aaa0f9","hex"),
-            struct.pack('<i', this.chatId),
-            this.userId.getBytes(),
-            struct.pack('<i', this.fwdLimit),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _user_id;
-        let _fwd_limit;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        _user_id = reader.tgReadObject();
-        _fwd_limit = reader.readInt();
-        return new this({chatId:_chat_id,
-	userId:_user_id,
-	fwdLimit:_fwd_limit})
-    }
-}
-
-
-class DeleteChatUserRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe0611f16;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe0611f16;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.chatId = args.chatId;
-        this.userId = args.userId;
-    }
-    async resolve(client, utils) {
-        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("161f61e0","hex"),
-            struct.pack('<i', this.chatId),
-            this.userId.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _user_id;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        _user_id = reader.tgReadObject();
-        return new this({chatId:_chat_id,
-	userId:_user_id})
-    }
-}
-
-
-class CreateChatRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x09cb126e;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x09cb126e;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.users = args.users;
-        this.title = args.title;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.users) {
-            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
-        }
-        this.users = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6e12cb09","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            TLObject.serializeBytes(this.title),
-            ])
-        }
-    static fromReader(reader) {
-        let _users;
-        let _title;
-        let _x;
-        let len;
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            _title = reader.tgReadString();
-            return new this({users:_users,
-	title:_title})
-        }
-    }
-
-
-class GetDhConfigRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x26cf8950;
-    static SUBCLASS_OF_ID = 0xe488ed8b;
-
-    /**
-    :returns messages.DhConfig: Instance of either DhConfigNotModified, DhConfig
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x26cf8950;
-        this.SUBCLASS_OF_ID = 0xe488ed8b;
-
-        this.version = args.version;
-        this.randomLength = args.randomLength;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5089cf26","hex"),
-            struct.pack('<i', this.version),
-            struct.pack('<i', this.randomLength),
-            ])
-        }
-    static fromReader(reader) {
-        let _version;
-        let _random_length;
-        let _x;
-        let len;
-        _version = reader.readInt();
-        _random_length = reader.readInt();
-        return new this({version:_version,
-	randomLength:_random_length})
-    }
-}
-
-
-class RequestEncryptionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf64daf43;
-    static SUBCLASS_OF_ID = 0x6d28a37a;
-
-    /**
-    :returns EncryptedChat: Instance of either EncryptedChatEmpty, EncryptedChatWaiting, EncryptedChatRequested, EncryptedChat, EncryptedChatDiscarded
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf64daf43;
-        this.SUBCLASS_OF_ID = 0x6d28a37a;
-
-        this.userId = args.userId;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(4),false,true);
-        this.gA = args.gA;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("43af4df6","hex"),
-            this.userId.getBytes(),
-            struct.pack('<i', this.randomId),
-            TLObject.serializeBytes(this.gA),
-            ])
-        }
-    static fromReader(reader) {
-        let _user_id;
-        let _random_id;
-        let _g_a;
-        let _x;
-        let len;
-        _user_id = reader.tgReadObject();
-        _random_id = reader.readInt();
-        _g_a = reader.tgReadBytes();
-        return new this({userId:_user_id,
-	randomId:_random_id,
-	gA:_g_a})
-    }
-}
-
-
-class AcceptEncryptionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3dbc0415;
-    static SUBCLASS_OF_ID = 0x6d28a37a;
-
-    /**
-    :returns EncryptedChat: Instance of either EncryptedChatEmpty, EncryptedChatWaiting, EncryptedChatRequested, EncryptedChat, EncryptedChatDiscarded
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3dbc0415;
-        this.SUBCLASS_OF_ID = 0x6d28a37a;
-
-        this.peer = args.peer;
-        this.gB = args.gB;
-        this.keyFingerprint = args.keyFingerprint;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1504bc3d","hex"),
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.gB),
-            readBufferFromBigInt(this.keyFingerprint,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _g_b;
-        let _key_fingerprint;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _g_b = reader.tgReadBytes();
-        _key_fingerprint = reader.readLong();
-        return new this({peer:_peer,
-	gB:_g_b,
-	keyFingerprint:_key_fingerprint})
-    }
-}
-
-
-class DiscardEncryptionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xedd923c5;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xedd923c5;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.chatId = args.chatId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c523d9ed","hex"),
-            struct.pack('<i', this.chatId),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        return new this({chatId:_chat_id})
-    }
-}
-
-
-class SetEncryptedTypingRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x791451ed;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x791451ed;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.typing = args.typing;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ed511479","hex"),
-            this.peer.getBytes(),
-            this.typing ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _typing;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _typing = reader.tgReadBool();
-        return new this({peer:_peer,
-	typing:_typing})
-    }
-}
-
-
-class ReadEncryptedHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x7f4b690a;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x7f4b690a;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.maxDate = args.maxDate;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0a694b7f","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.maxDate),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _max_date;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _max_date = reader.readInt();
-        return new this({peer:_peer,
-	maxDate:_max_date})
-    }
-}
-
-
-class SendEncryptedRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa9776773;
-    static SUBCLASS_OF_ID = 0xc99e3e50;
-
-    /**
-    :returns messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa9776773;
-        this.SUBCLASS_OF_ID = 0xc99e3e50;
-
-        this.peer = args.peer;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.data = args.data;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("736777a9","hex"),
-            this.peer.getBytes(),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            TLObject.serializeBytes(this.data),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _random_id;
-        let _data;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _random_id = reader.readLong();
-        _data = reader.tgReadBytes();
-        return new this({peer:_peer,
-	randomId:_random_id,
-	data:_data})
-    }
-}
-
-
-class SendEncryptedFileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9a901b66;
-    static SUBCLASS_OF_ID = 0xc99e3e50;
-
-    /**
-    :returns messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9a901b66;
-        this.SUBCLASS_OF_ID = 0xc99e3e50;
-
-        this.peer = args.peer;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.data = args.data;
-        this.file = args.file;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("661b909a","hex"),
-            this.peer.getBytes(),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            TLObject.serializeBytes(this.data),
-            this.file.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _random_id;
-        let _data;
-        let _file;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _random_id = reader.readLong();
-        _data = reader.tgReadBytes();
-        _file = reader.tgReadObject();
-        return new this({peer:_peer,
-	randomId:_random_id,
-	data:_data,
-	file:_file})
-    }
-}
-
-
-class SendEncryptedServiceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x32d439a4;
-    static SUBCLASS_OF_ID = 0xc99e3e50;
-
-    /**
-    :returns messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x32d439a4;
-        this.SUBCLASS_OF_ID = 0xc99e3e50;
-
-        this.peer = args.peer;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.data = args.data;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a439d432","hex"),
-            this.peer.getBytes(),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            TLObject.serializeBytes(this.data),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _random_id;
-        let _data;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _random_id = reader.readLong();
-        _data = reader.tgReadBytes();
-        return new this({peer:_peer,
-	randomId:_random_id,
-	data:_data})
-    }
-}
-
-
-class ReceivedQueueRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x55a5bb66;
-    static SUBCLASS_OF_ID = 0x8918e168;
-
-    /**
-    :returns Vector<long>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x55a5bb66;
-        this.SUBCLASS_OF_ID = 0x8918e168;
-
-        this.maxQts = args.maxQts;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("66bba555","hex"),
-            struct.pack('<i', this.maxQts),
-            ])
-        }
-    static fromReader(reader) {
-        let _max_qts;
-        let _x;
-        let len;
-        _max_qts = reader.readInt();
-        return new this({maxQts:_max_qts})
-    }
-    readResult(reader){
-        reader.readInt();  // Vector ID
-        let temp = [];
-        let len = reader.readInt(); //fix this
-        for (let i=0;i<len;i++){
-            temp.push(reader.readLong())
-        }
-        return temp
-    }
-}
-
-
-class ReportEncryptedSpamRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4b0c8c0f;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4b0c8c0f;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0f8c0c4b","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class ReadMessageContentsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x36a73f77;
-    static SUBCLASS_OF_ID = 0xced3c06e;
-
-    /**
-    :returns messages.AffectedMessages: Instance of AffectedMessages
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x36a73f77;
-        this.SUBCLASS_OF_ID = 0xced3c06e;
-
-        this.id = args.id;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("773fa736","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class GetStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x043d4f2c;
-    static SUBCLASS_OF_ID = 0xd73bb9de;
-
-    /**
-    :returns messages.Stickers: Instance of either StickersNotModified, Stickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x043d4f2c;
-        this.SUBCLASS_OF_ID = 0xd73bb9de;
-
-        this.emoticon = args.emoticon;
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2c4f3d04","hex"),
-            TLObject.serializeBytes(this.emoticon),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _emoticon;
-        let _hash;
-        let _x;
-        let len;
-        _emoticon = reader.tgReadString();
-        _hash = reader.readInt();
-        return new this({emoticon:_emoticon,
-	hash:_hash})
-    }
-}
-
-
-class GetAllStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1c9618b1;
-    static SUBCLASS_OF_ID = 0x45834829;
-
-    /**
-    :returns messages.AllStickers: Instance of either AllStickersNotModified, AllStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1c9618b1;
-        this.SUBCLASS_OF_ID = 0x45834829;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b118961c","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class GetWebPagePreviewRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8b68b0cc;
-    static SUBCLASS_OF_ID = 0x476cbe32;
-
-    /**
-    :returns MessageMedia: Instance of either MessageMediaEmpty, MessageMediaPhoto, MessageMediaGeo, MessageMediaContact, MessageMediaUnsupported, MessageMediaDocument, MessageMediaWebPage, MessageMediaVenue, MessageMediaGame, MessageMediaInvoice, MessageMediaGeoLive, MessageMediaPoll
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8b68b0cc;
-        this.SUBCLASS_OF_ID = 0x476cbe32;
-
-        this.message = args.message;
-        this.entities = args.entities || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ccb0688b","hex"),
-            struct.pack('<I', (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8),
-            TLObject.serializeBytes(this.message),
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _message;
-        let _entities;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _message = reader.tgReadString();
-        if (flags & 8) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            return new this({message:_message,
-	entities:_entities})
-        }
-    }
-
-
-class ExportChatInviteRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0df7534c;
-    static SUBCLASS_OF_ID = 0xb4748a58;
-
-    /**
-    :returns ExportedChatInvite: Instance of either ChatInviteEmpty, ChatInviteExported
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0df7534c;
-        this.SUBCLASS_OF_ID = 0xb4748a58;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4c53f70d","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class CheckChatInviteRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3eadb1bb;
-    static SUBCLASS_OF_ID = 0x4561736;
-
-    /**
-    :returns ChatInvite: Instance of either ChatInviteAlready, ChatInvite
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3eadb1bb;
-        this.SUBCLASS_OF_ID = 0x4561736;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bbb1ad3e","hex"),
-            TLObject.serializeBytes(this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.tgReadString();
-        return new this({hash:_hash})
-    }
-}
-
-
-class ImportChatInviteRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6c50051c;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6c50051c;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1c05506c","hex"),
-            TLObject.serializeBytes(this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.tgReadString();
-        return new this({hash:_hash})
-    }
-}
-
-
-class GetStickerSetRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2619a90e;
-    static SUBCLASS_OF_ID = 0x9b704a5a;
-
-    /**
-    :returns messages.StickerSet: Instance of StickerSet
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2619a90e;
-        this.SUBCLASS_OF_ID = 0x9b704a5a;
-
-        this.stickerset = args.stickerset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0ea91926","hex"),
-            this.stickerset.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _stickerset;
-        let _x;
-        let len;
-        _stickerset = reader.tgReadObject();
-        return new this({stickerset:_stickerset})
-    }
-}
-
-
-class InstallStickerSetRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc78fe460;
-    static SUBCLASS_OF_ID = 0x67cb3fe8;
-
-    /**
-    :returns messages.StickerSetInstallResult: Instance of either StickerSetInstallResultSuccess, StickerSetInstallResultArchive
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc78fe460;
-        this.SUBCLASS_OF_ID = 0x67cb3fe8;
-
-        this.stickerset = args.stickerset;
-        this.archived = args.archived;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("60e48fc7","hex"),
-            this.stickerset.getBytes(),
-            this.archived ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _stickerset;
-        let _archived;
-        let _x;
-        let len;
-        _stickerset = reader.tgReadObject();
-        _archived = reader.tgReadBool();
-        return new this({stickerset:_stickerset,
-	archived:_archived})
-    }
-}
-
-
-class UninstallStickerSetRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf96e55de;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf96e55de;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.stickerset = args.stickerset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("de556ef9","hex"),
-            this.stickerset.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _stickerset;
-        let _x;
-        let len;
-        _stickerset = reader.tgReadObject();
-        return new this({stickerset:_stickerset})
-    }
-}
-
-
-class StartBotRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe6df7378;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe6df7378;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.bot = args.bot;
-        this.peer = args.peer;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.startParam = args.startParam;
-    }
-    async resolve(client, utils) {
-        this.bot = utils.getInputUser(await client.getInputEntity(this.bot))
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7873dfe6","hex"),
-            this.bot.getBytes(),
-            this.peer.getBytes(),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            TLObject.serializeBytes(this.startParam),
-            ])
-        }
-    static fromReader(reader) {
-        let _bot;
-        let _peer;
-        let _random_id;
-        let _start_param;
-        let _x;
-        let len;
-        _bot = reader.tgReadObject();
-        _peer = reader.tgReadObject();
-        _random_id = reader.readLong();
-        _start_param = reader.tgReadString();
-        return new this({bot:_bot,
-	peer:_peer,
-	randomId:_random_id,
-	startParam:_start_param})
-    }
-}
-
-
-class GetMessagesViewsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc4c8a55d;
-    static SUBCLASS_OF_ID = 0x5026710f;
-
-    /**
-    :returns Vector<int>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc4c8a55d;
-        this.SUBCLASS_OF_ID = 0x5026710f;
-
-        this.peer = args.peer;
-        this.id = args.id;
-        this.increment = args.increment;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5da5c8c4","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            this.increment ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _increment;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            _increment = reader.tgReadBool();
-            return new this({peer:_peer,
-	id:_id,
-	increment:_increment})
-        }
-        readResult(reader){
-            reader.readInt();  // Vector ID
-            let temp = [];
-            let len = reader.readInt(); //fix this
-            for (let i=0;i<len;i++){
-                temp.push(reader.readInt())
-            }
-            return temp
-        }
-    }
-
-
-class EditChatAdminRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa9e69f2e;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa9e69f2e;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.chatId = args.chatId;
-        this.userId = args.userId;
-        this.isAdmin = args.isAdmin;
-    }
-    async resolve(client, utils) {
-        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2e9fe6a9","hex"),
-            struct.pack('<i', this.chatId),
-            this.userId.getBytes(),
-            this.isAdmin ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _user_id;
-        let _is_admin;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        _user_id = reader.tgReadObject();
-        _is_admin = reader.tgReadBool();
-        return new this({chatId:_chat_id,
-	userId:_user_id,
-	isAdmin:_is_admin})
-    }
-}
-
-
-class MigrateChatRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x15a3b8e3;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x15a3b8e3;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.chatId = args.chatId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e3b8a315","hex"),
-            struct.pack('<i', this.chatId),
-            ])
-        }
-    static fromReader(reader) {
-        let _chat_id;
-        let _x;
-        let len;
-        _chat_id = reader.readInt();
-        return new this({chatId:_chat_id})
-    }
-}
-
-
-class SearchGlobalRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbf7225a4;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbf7225a4;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.folderId = args.folderId || null;
-        this.q = args.q;
-        this.offsetRate = args.offsetRate;
-        this.offsetPeer = args.offsetPeer;
-        this.offsetId = args.offsetId;
-        this.limit = args.limit;
-    }
-    async resolve(client, utils) {
-        this.offset_peer = utils.getInputPeer(await client.getInputEntity(this.offsetPeer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a42572bf","hex"),
-            struct.pack('<I', (this.folderId === undefined || this.folderId === false || this.folderId === null) ? 0 : 1),
-            (this.folderId === undefined || this.folderId === false || this.folderId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.folderId)],
-            TLObject.serializeBytes(this.q),
-            struct.pack('<i', this.offsetRate),
-            this.offsetPeer.getBytes(),
-            struct.pack('<i', this.offsetId),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _folder_id;
-        let _q;
-        let _offset_rate;
-        let _offset_peer;
-        let _offset_id;
-        let _limit;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _folder_id = reader.readInt();
-        }
-        else {
-            _folder_id = null
-        }
-        _q = reader.tgReadString();
-        _offset_rate = reader.readInt();
-        _offset_peer = reader.tgReadObject();
-        _offset_id = reader.readInt();
-        _limit = reader.readInt();
-        return new this({folderId:_folder_id,
-	q:_q,
-	offsetRate:_offset_rate,
-	offsetPeer:_offset_peer,
-	offsetId:_offset_id,
-	limit:_limit})
-    }
-}
-
-
-class ReorderStickerSetsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x78337739;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x78337739;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.masks = args.masks || null;
-        this.order = args.order;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("39773378","hex"),
-            struct.pack('<I', (this.masks === undefined || this.masks === false || this.masks === null) ? 0 : 1),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.order.length),Buffer.concat(this.order.map(x => readBufferFromBigInt(x,8,true,true))),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _masks;
-        let _order;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _masks = Boolean(flags & 1);
-        reader.readInt();
-        _order = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readLong();
-            _order.push(_x);
-            }
-            return new this({masks:_masks,
-	order:_order})
-        }
-    }
-
-
-class GetDocumentByHashRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x338e2464;
-    static SUBCLASS_OF_ID = 0x211fe820;
-
-    /**
-    :returns Document: Instance of either DocumentEmpty, Document
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x338e2464;
-        this.SUBCLASS_OF_ID = 0x211fe820;
-
-        this.sha256 = args.sha256;
-        this.size = args.size;
-        this.mimeType = args.mimeType;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("64248e33","hex"),
-            TLObject.serializeBytes(this.sha256),
-            struct.pack('<i', this.size),
-            TLObject.serializeBytes(this.mimeType),
-            ])
-        }
-    static fromReader(reader) {
-        let _sha256;
-        let _size;
-        let _mime_type;
-        let _x;
-        let len;
-        _sha256 = reader.tgReadBytes();
-        _size = reader.readInt();
-        _mime_type = reader.tgReadString();
-        return new this({sha256:_sha256,
-	size:_size,
-	mimeType:_mime_type})
-    }
-}
-
-
-class SearchGifsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbf9a776b;
-    static SUBCLASS_OF_ID = 0xe799ea7;
-
-    /**
-    :returns messages.FoundGifs: Instance of FoundGifs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbf9a776b;
-        this.SUBCLASS_OF_ID = 0xe799ea7;
-
-        this.q = args.q;
-        this.offset = args.offset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6b779abf","hex"),
-            TLObject.serializeBytes(this.q),
-            struct.pack('<i', this.offset),
-            ])
-        }
-    static fromReader(reader) {
-        let _q;
-        let _offset;
-        let _x;
-        let len;
-        _q = reader.tgReadString();
-        _offset = reader.readInt();
-        return new this({q:_q,
-	offset:_offset})
-    }
-}
-
-
-class GetSavedGifsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x83bf3d52;
-    static SUBCLASS_OF_ID = 0xa68b61f5;
-
-    /**
-    :returns messages.SavedGifs: Instance of either SavedGifsNotModified, SavedGifs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x83bf3d52;
-        this.SUBCLASS_OF_ID = 0xa68b61f5;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("523dbf83","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class SaveGifRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x327a30cb;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x327a30cb;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-        this.unsave = args.unsave;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputDocument(this.id)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cb307a32","hex"),
-            this.id.getBytes(),
-            this.unsave ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _unsave;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        _unsave = reader.tgReadBool();
-        return new this({id:_id,
-	unsave:_unsave})
-    }
-}
-
-
-class GetInlineBotResultsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x514e999d;
-    static SUBCLASS_OF_ID = 0x3ed4d9c9;
-
-    /**
-    :returns messages.BotResults: Instance of BotResults
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x514e999d;
-        this.SUBCLASS_OF_ID = 0x3ed4d9c9;
-
-        this.bot = args.bot;
-        this.peer = args.peer;
-        this.geoPoint = args.geoPoint || null;
-        this.query = args.query;
-        this.offset = args.offset;
-    }
-    async resolve(client, utils) {
-        this.bot = utils.getInputUser(await client.getInputEntity(this.bot))
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9d994e51","hex"),
-            struct.pack('<I', (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint === null) ? 0 : 1),
-            this.bot.getBytes(),
-            this.peer.getBytes(),
-            (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint ===null) ? Buffer.alloc(0) : [this.geoPoint.getBytes()],
-            TLObject.serializeBytes(this.query),
-            TLObject.serializeBytes(this.offset),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _bot;
-        let _peer;
-        let _geo_point;
-        let _query;
-        let _offset;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _bot = reader.tgReadObject();
-        _peer = reader.tgReadObject();
-        if (flags & 1) {
-            _geo_point = reader.tgReadObject();
-        }
-        else {
-            _geo_point = null
-        }
-        _query = reader.tgReadString();
-        _offset = reader.tgReadString();
-        return new this({bot:_bot,
-	peer:_peer,
-	geoPoint:_geo_point,
-	query:_query,
-	offset:_offset})
-    }
-}
-
-
-class SetInlineBotResultsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xeb5ea206;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xeb5ea206;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.gallery = args.gallery || null;
-        this.private = args.private || null;
-        this.queryId = args.queryId;
-        this.results = args.results;
-        this.cacheTime = args.cacheTime;
-        this.nextOffset = args.nextOffset || null;
-        this.switchPm = args.switchPm || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("06a25eeb","hex"),
-            struct.pack('<I', (this.gallery === undefined || this.gallery === false || this.gallery === null) ? 0 : 1 | (this.private === undefined || this.private === false || this.private === null) ? 0 : 2 | (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset === null) ? 0 : 4 | (this.switchPm === undefined || this.switchPm === false || this.switchPm === null) ? 0 : 8),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
-            struct.pack('<i', this.cacheTime),
-            (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.nextOffset)],
-            (this.switchPm === undefined || this.switchPm === false || this.switchPm ===null) ? Buffer.alloc(0) : [this.switchPm.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _gallery;
-        let _private;
-        let _query_id;
-        let _results;
-        let _cache_time;
-        let _next_offset;
-        let _switch_pm;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _gallery = Boolean(flags & 1);
-        _private = Boolean(flags & 2);
-        _query_id = reader.readLong();
-        reader.readInt();
-        _results = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _results.push(_x);
-            }
-            _cache_time = reader.readInt();
-            if (flags & 4) {
-                _next_offset = reader.tgReadString();
-            }
-            else {
-                _next_offset = null
-            }
-            if (flags & 8) {
-                _switch_pm = reader.tgReadObject();
-            }
-            else {
-                _switch_pm = null
-            }
-            return new this({gallery:_gallery,
-	private:_private,
-	queryId:_query_id,
-	results:_results,
-	cacheTime:_cache_time,
-	nextOffset:_next_offset,
-	switchPm:_switch_pm})
-        }
-    }
-
-
-class SendInlineBotResultRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x220815b0;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x220815b0;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.silent = args.silent || null;
-        this.background = args.background || null;
-        this.clearDraft = args.clearDraft || null;
-        this.hideVia = args.hideVia || null;
-        this.peer = args.peer;
-        this.replyToMsgId = args.replyToMsgId || null;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-        this.queryId = args.queryId;
-        this.id = args.id;
-        this.scheduleDate = args.scheduleDate || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b0150822","hex"),
-            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.hideVia === undefined || this.hideVia === false || this.hideVia === null) ? 0 : 2048 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
-            this.peer.getBytes(),
-            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
-            readBufferFromBigInt(this.randomId,8,true,true),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            TLObject.serializeBytes(this.id),
-            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _silent;
-        let _background;
-        let _clear_draft;
-        let _hide_via;
-        let _peer;
-        let _reply_to_msg_id;
-        let _random_id;
-        let _query_id;
-        let _id;
-        let _schedule_date;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _silent = Boolean(flags & 32);
-        _background = Boolean(flags & 64);
-        _clear_draft = Boolean(flags & 128);
-        _hide_via = Boolean(flags & 2048);
-        _peer = reader.tgReadObject();
-        if (flags & 1) {
-            _reply_to_msg_id = reader.readInt();
-        }
-        else {
-            _reply_to_msg_id = null
-        }
-        _random_id = reader.readLong();
-        _query_id = reader.readLong();
-        _id = reader.tgReadString();
-        if (flags & 1024) {
-            _schedule_date = reader.readInt();
-        }
-        else {
-            _schedule_date = null
-        }
-        return new this({silent:_silent,
-	background:_background,
-	clearDraft:_clear_draft,
-	hideVia:_hide_via,
-	peer:_peer,
-	replyToMsgId:_reply_to_msg_id,
-	randomId:_random_id,
-	queryId:_query_id,
-	id:_id,
-	scheduleDate:_schedule_date})
-    }
-}
-
-
-class GetMessageEditDataRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xfda68d36;
-    static SUBCLASS_OF_ID = 0xfb47949d;
-
-    /**
-    :returns messages.MessageEditData: Instance of MessageEditData
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xfda68d36;
-        this.SUBCLASS_OF_ID = 0xfb47949d;
-
-        this.peer = args.peer;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("368da6fd","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.id),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _id = reader.readInt();
-        return new this({peer:_peer,
-	id:_id})
-    }
-}
-
-
-class EditMessageRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x48f71778;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x48f71778;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.noWebpage = args.noWebpage || null;
-        this.peer = args.peer;
-        this.id = args.id;
-        this.message = args.message || null;
-        this.media = args.media || null;
-        this.replyMarkup = args.replyMarkup || null;
-        this.entities = args.entities || null;
-        this.scheduleDate = args.scheduleDate || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-        if (this.media) {
-            this.media = utils.getInputMedia(this.media)
-        }
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7817f748","hex"),
-            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 2048 | (this.media === undefined || this.media === false || this.media === null) ? 0 : 16384 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 32768),
-            this.peer.getBytes(),
-            struct.pack('<i', this.id),
-            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
-            (this.media === undefined || this.media === false || this.media ===null) ? Buffer.alloc(0) : [this.media.getBytes()],
-            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _no_webpage;
-        let _peer;
-        let _id;
-        let _message;
-        let _media;
-        let _reply_markup;
-        let _entities;
-        let _schedule_date;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _no_webpage = Boolean(flags & 2);
-        _peer = reader.tgReadObject();
-        _id = reader.readInt();
-        if (flags & 2048) {
-            _message = reader.tgReadString();
-        }
-        else {
-            _message = null
-        }
-        if (flags & 16384) {
-            _media = reader.tgReadObject();
-        }
-        else {
-            _media = null
-        }
-        if (flags & 4) {
-            _reply_markup = reader.tgReadObject();
-        }
-        else {
-            _reply_markup = null
-        }
-        if (flags & 8) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            if (flags & 32768) {
-                _schedule_date = reader.readInt();
-            }
-            else {
-                _schedule_date = null
-            }
-            return new this({noWebpage:_no_webpage,
-	peer:_peer,
-	id:_id,
-	message:_message,
-	media:_media,
-	replyMarkup:_reply_markup,
-	entities:_entities,
-	scheduleDate:_schedule_date})
-        }
-    }
-
-
-class EditInlineBotMessageRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x83557dba;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x83557dba;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.noWebpage = args.noWebpage || null;
-        this.id = args.id;
-        this.message = args.message || null;
-        this.media = args.media || null;
-        this.replyMarkup = args.replyMarkup || null;
-        this.entities = args.entities || null;
-    }
-    async resolve(client, utils) {
-        if (this.media) {
-            this.media = utils.getInputMedia(this.media)
-        }
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ba7d5583","hex"),
-            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 2048 | (this.media === undefined || this.media === false || this.media === null) ? 0 : 16384 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8),
-            this.id.getBytes(),
-            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
-            (this.media === undefined || this.media === false || this.media ===null) ? Buffer.alloc(0) : [this.media.getBytes()],
-            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _no_webpage;
-        let _id;
-        let _message;
-        let _media;
-        let _reply_markup;
-        let _entities;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _no_webpage = Boolean(flags & 2);
-        _id = reader.tgReadObject();
-        if (flags & 2048) {
-            _message = reader.tgReadString();
-        }
-        else {
-            _message = null
-        }
-        if (flags & 16384) {
-            _media = reader.tgReadObject();
-        }
-        else {
-            _media = null
-        }
-        if (flags & 4) {
-            _reply_markup = reader.tgReadObject();
-        }
-        else {
-            _reply_markup = null
-        }
-        if (flags & 8) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            return new this({noWebpage:_no_webpage,
-	id:_id,
-	message:_message,
-	media:_media,
-	replyMarkup:_reply_markup,
-	entities:_entities})
-        }
-    }
-
-
-class GetBotCallbackAnswerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x810a9fec;
-    static SUBCLASS_OF_ID = 0x6c4dd18c;
-
-    /**
-    :returns messages.BotCallbackAnswer: Instance of BotCallbackAnswer
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x810a9fec;
-        this.SUBCLASS_OF_ID = 0x6c4dd18c;
-
-        this.game = args.game || null;
-        this.peer = args.peer;
-        this.msgId = args.msgId;
-        this.data = args.data || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ec9f0a81","hex"),
-            struct.pack('<I', (this.game === undefined || this.game === false || this.game === null) ? 0 : 2 | (this.data === undefined || this.data === false || this.data === null) ? 0 : 1),
-            this.peer.getBytes(),
-            struct.pack('<i', this.msgId),
-            (this.data === undefined || this.data === false || this.data ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.data)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _game;
-        let _peer;
-        let _msg_id;
-        let _data;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _game = Boolean(flags & 2);
-        _peer = reader.tgReadObject();
-        _msg_id = reader.readInt();
-        if (flags & 1) {
-            _data = reader.tgReadBytes();
-        }
-        else {
-            _data = null
-        }
-        return new this({game:_game,
-	peer:_peer,
-	msgId:_msg_id,
-	data:_data})
-    }
-}
-
-
-class SetBotCallbackAnswerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd58f130a;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd58f130a;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.alert = args.alert || null;
-        this.queryId = args.queryId;
-        this.message = args.message || null;
-        this.url = args.url || null;
-        this.cacheTime = args.cacheTime;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0a138fd5","hex"),
-            struct.pack('<I', (this.alert === undefined || this.alert === false || this.alert === null) ? 0 : 2 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 1 | (this.url === undefined || this.url === false || this.url === null) ? 0 : 4),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
-            (this.url === undefined || this.url === false || this.url ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.url)],
-            struct.pack('<i', this.cacheTime),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _alert;
-        let _query_id;
-        let _message;
-        let _url;
-        let _cache_time;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _alert = Boolean(flags & 2);
-        _query_id = reader.readLong();
-        if (flags & 1) {
-            _message = reader.tgReadString();
-        }
-        else {
-            _message = null
-        }
-        if (flags & 4) {
-            _url = reader.tgReadString();
-        }
-        else {
-            _url = null
-        }
-        _cache_time = reader.readInt();
-        return new this({alert:_alert,
-	queryId:_query_id,
-	message:_message,
-	url:_url,
-	cacheTime:_cache_time})
-    }
-}
-
-
-class GetPeerDialogsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe470bcfd;
-    static SUBCLASS_OF_ID = 0x3ac70132;
-
-    /**
-    :returns messages.PeerDialogs: Instance of PeerDialogs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe470bcfd;
-        this.SUBCLASS_OF_ID = 0x3ac70132;
-
-        this.peers = args.peers;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.peers) {
-            _tmp.push(await client._getInputDialog(_x));
-        }
-        this.peers = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fdbc70e4","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.peers.length),Buffer.concat(this.peers.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _peers;
-        let _x;
-        let len;
-        reader.readInt();
-        _peers = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _peers.push(_x);
-            }
-            return new this({peers:_peers})
-        }
-    }
-
-
-class SaveDraftRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbc39e14b;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbc39e14b;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.noWebpage = args.noWebpage || null;
-        this.replyToMsgId = args.replyToMsgId || null;
-        this.peer = args.peer;
-        this.message = args.message;
-        this.entities = args.entities || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4be139bc","hex"),
-            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8),
-            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.message),
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _no_webpage;
-        let _reply_to_msg_id;
-        let _peer;
-        let _message;
-        let _entities;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _no_webpage = Boolean(flags & 2);
-        if (flags & 1) {
-            _reply_to_msg_id = reader.readInt();
-        }
-        else {
-            _reply_to_msg_id = null
-        }
-        _peer = reader.tgReadObject();
-        _message = reader.tgReadString();
-        if (flags & 8) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            return new this({noWebpage:_no_webpage,
-	replyToMsgId:_reply_to_msg_id,
-	peer:_peer,
-	message:_message,
-	entities:_entities})
-        }
-    }
-
-
-class GetAllDraftsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6a3f8d65;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x6a3f8d65;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("658d3f6a","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetFeaturedStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2dacca4f;
-    static SUBCLASS_OF_ID = 0x2614b722;
-
-    /**
-    :returns messages.FeaturedStickers: Instance of either FeaturedStickersNotModified, FeaturedStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2dacca4f;
-        this.SUBCLASS_OF_ID = 0x2614b722;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4fcaac2d","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class ReadFeaturedStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x5b118126;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5b118126;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2681115b","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => readBufferFromBigInt(x,8,true,true))),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readLong();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class GetRecentStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x5ea192c9;
-    static SUBCLASS_OF_ID = 0xf76f8683;
-
-    /**
-    :returns messages.RecentStickers: Instance of either RecentStickersNotModified, RecentStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5ea192c9;
-        this.SUBCLASS_OF_ID = 0xf76f8683;
-
-        this.attached = args.attached || null;
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c992a15e","hex"),
-            struct.pack('<I', (this.attached === undefined || this.attached === false || this.attached === null) ? 0 : 1),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _attached;
-        let _hash;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _attached = Boolean(flags & 1);
-        _hash = reader.readInt();
-        return new this({attached:_attached,
-	hash:_hash})
-    }
-}
-
-
-class SaveRecentStickerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x392718f8;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x392718f8;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.attached = args.attached || null;
-        this.id = args.id;
-        this.unsave = args.unsave;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputDocument(this.id)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f8182739","hex"),
-            struct.pack('<I', (this.attached === undefined || this.attached === false || this.attached === null) ? 0 : 1),
-            this.id.getBytes(),
-            this.unsave ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _attached;
-        let _id;
-        let _unsave;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _attached = Boolean(flags & 1);
-        _id = reader.tgReadObject();
-        _unsave = reader.tgReadBool();
-        return new this({attached:_attached,
-	id:_id,
-	unsave:_unsave})
-    }
-}
-
-
-class ClearRecentStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8999602d;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8999602d;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.attached = args.attached || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2d609989","hex"),
-            struct.pack('<I', (this.attached === undefined || this.attached === false || this.attached === null) ? 0 : 1),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _attached;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _attached = Boolean(flags & 1);
-        return new this({attached:_attached})
-    }
-}
-
-
-class GetArchivedStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x57f17692;
-    static SUBCLASS_OF_ID = 0x7296d771;
-
-    /**
-    :returns messages.ArchivedStickers: Instance of ArchivedStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x57f17692;
-        this.SUBCLASS_OF_ID = 0x7296d771;
-
-        this.masks = args.masks || null;
-        this.offsetId = args.offsetId;
-        this.limit = args.limit;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9276f157","hex"),
-            struct.pack('<I', (this.masks === undefined || this.masks === false || this.masks === null) ? 0 : 1),
-            readBufferFromBigInt(this.offsetId,8,true,true),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _masks;
-        let _offset_id;
-        let _limit;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _masks = Boolean(flags & 1);
-        _offset_id = reader.readLong();
-        _limit = reader.readInt();
-        return new this({masks:_masks,
-	offsetId:_offset_id,
-	limit:_limit})
-    }
-}
-
-
-class GetMaskStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x65b8c79f;
-    static SUBCLASS_OF_ID = 0x45834829;
-
-    /**
-    :returns messages.AllStickers: Instance of either AllStickersNotModified, AllStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x65b8c79f;
-        this.SUBCLASS_OF_ID = 0x45834829;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9fc7b865","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class GetAttachedStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcc5b67cc;
-    static SUBCLASS_OF_ID = 0xcc125f6b;
-
-    /**
-    :returns Vector<StickerSetCovered>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcc5b67cc;
-        this.SUBCLASS_OF_ID = 0xcc125f6b;
-
-        this.media = args.media;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cc675bcc","hex"),
-            this.media.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _media;
-        let _x;
-        let len;
-        _media = reader.tgReadObject();
-        return new this({media:_media})
-    }
-}
-
-
-class SetGameScoreRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8ef8ecc0;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8ef8ecc0;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.editMessage = args.editMessage || null;
-        this.force = args.force || null;
-        this.peer = args.peer;
-        this.id = args.id;
-        this.userId = args.userId;
-        this.score = args.score;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c0ecf88e","hex"),
-            struct.pack('<I', (this.editMessage === undefined || this.editMessage === false || this.editMessage === null) ? 0 : 1 | (this.force === undefined || this.force === false || this.force === null) ? 0 : 2),
-            this.peer.getBytes(),
-            struct.pack('<i', this.id),
-            this.userId.getBytes(),
-            struct.pack('<i', this.score),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _edit_message;
-        let _force;
-        let _peer;
-        let _id;
-        let _user_id;
-        let _score;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _edit_message = Boolean(flags & 1);
-        _force = Boolean(flags & 2);
-        _peer = reader.tgReadObject();
-        _id = reader.readInt();
-        _user_id = reader.tgReadObject();
-        _score = reader.readInt();
-        return new this({editMessage:_edit_message,
-	force:_force,
-	peer:_peer,
-	id:_id,
-	userId:_user_id,
-	score:_score})
-    }
-}
-
-
-class SetInlineGameScoreRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x15ad9f64;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x15ad9f64;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.editMessage = args.editMessage || null;
-        this.force = args.force || null;
-        this.id = args.id;
-        this.userId = args.userId;
-        this.score = args.score;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("649fad15","hex"),
-            struct.pack('<I', (this.editMessage === undefined || this.editMessage === false || this.editMessage === null) ? 0 : 1 | (this.force === undefined || this.force === false || this.force === null) ? 0 : 2),
-            this.id.getBytes(),
-            this.userId.getBytes(),
-            struct.pack('<i', this.score),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _edit_message;
-        let _force;
-        let _id;
-        let _user_id;
-        let _score;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _edit_message = Boolean(flags & 1);
-        _force = Boolean(flags & 2);
-        _id = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        _score = reader.readInt();
-        return new this({editMessage:_edit_message,
-	force:_force,
-	id:_id,
-	userId:_user_id,
-	score:_score})
-    }
-}
-
-
-class GetGameHighScoresRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe822649d;
-    static SUBCLASS_OF_ID = 0x6ccd95fd;
-
-    /**
-    :returns messages.HighScores: Instance of HighScores
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe822649d;
-        this.SUBCLASS_OF_ID = 0x6ccd95fd;
-
-        this.peer = args.peer;
-        this.id = args.id;
-        this.userId = args.userId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9d6422e8","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.id),
-            this.userId.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _user_id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _id = reader.readInt();
-        _user_id = reader.tgReadObject();
-        return new this({peer:_peer,
-	id:_id,
-	userId:_user_id})
-    }
-}
-
-
-class GetInlineGameHighScoresRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0f635e1b;
-    static SUBCLASS_OF_ID = 0x6ccd95fd;
-
-    /**
-    :returns messages.HighScores: Instance of HighScores
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0f635e1b;
-        this.SUBCLASS_OF_ID = 0x6ccd95fd;
-
-        this.id = args.id;
-        this.userId = args.userId;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1b5e630f","hex"),
-            this.id.getBytes(),
-            this.userId.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _user_id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        _user_id = reader.tgReadObject();
-        return new this({id:_id,
-	userId:_user_id})
-    }
-}
-
-
-class GetCommonChatsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0d0a48c4;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    :returns messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0d0a48c4;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.userId = args.userId;
-        this.maxId = args.maxId;
-        this.limit = args.limit;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c4480a0d","hex"),
-            this.userId.getBytes(),
-            struct.pack('<i', this.maxId),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _user_id;
-        let _max_id;
-        let _limit;
-        let _x;
-        let len;
-        _user_id = reader.tgReadObject();
-        _max_id = reader.readInt();
-        _limit = reader.readInt();
-        return new this({userId:_user_id,
-	maxId:_max_id,
-	limit:_limit})
-    }
-}
-
-
-class GetAllChatsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xeba80ff0;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    :returns messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xeba80ff0;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.exceptIds = args.exceptIds;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f00fa8eb","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.exceptIds.length),Buffer.concat(this.exceptIds.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _except_ids;
-        let _x;
-        let len;
-        reader.readInt();
-        _except_ids = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _except_ids.push(_x);
-            }
-            return new this({exceptIds:_except_ids})
-        }
-    }
-
-
-class GetWebPageRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x32ca8f91;
-    static SUBCLASS_OF_ID = 0x55a97481;
-
-    /**
-    :returns WebPage: Instance of either WebPageEmpty, WebPagePending, WebPage, WebPageNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x32ca8f91;
-        this.SUBCLASS_OF_ID = 0x55a97481;
-
-        this.url = args.url;
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("918fca32","hex"),
-            TLObject.serializeBytes(this.url),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _url;
-        let _hash;
-        let _x;
-        let len;
-        _url = reader.tgReadString();
-        _hash = reader.readInt();
-        return new this({url:_url,
-	hash:_hash})
-    }
-}
-
-
-class ToggleDialogPinRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa731e257;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa731e257;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.pinned = args.pinned || null;
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = await client._getInputDialog(this.peer)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("57e231a7","hex"),
-            struct.pack('<I', (this.pinned === undefined || this.pinned === false || this.pinned === null) ? 0 : 1),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _pinned;
-        let _peer;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _pinned = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        return new this({pinned:_pinned,
-	peer:_peer})
-    }
-}
-
-
-class ReorderPinnedDialogsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3b1adf37;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3b1adf37;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.force = args.force || null;
-        this.folderId = args.folderId;
-        this.order = args.order;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.order) {
-            _tmp.push(await client._getInputDialog(_x));
-        }
-        this.order = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("37df1a3b","hex"),
-            struct.pack('<I', (this.force === undefined || this.force === false || this.force === null) ? 0 : 1),
-            struct.pack('<i', this.folderId),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.order.length),Buffer.concat(this.order.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _force;
-        let _folder_id;
-        let _order;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _force = Boolean(flags & 1);
-        _folder_id = reader.readInt();
-        reader.readInt();
-        _order = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _order.push(_x);
-            }
-            return new this({force:_force,
-	folderId:_folder_id,
-	order:_order})
-        }
-    }
-
-
-class GetPinnedDialogsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd6b94df2;
-    static SUBCLASS_OF_ID = 0x3ac70132;
-
-    /**
-    :returns messages.PeerDialogs: Instance of PeerDialogs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd6b94df2;
-        this.SUBCLASS_OF_ID = 0x3ac70132;
-
-        this.folderId = args.folderId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f24db9d6","hex"),
-            struct.pack('<i', this.folderId),
-            ])
-        }
-    static fromReader(reader) {
-        let _folder_id;
-        let _x;
-        let len;
-        _folder_id = reader.readInt();
-        return new this({folderId:_folder_id})
-    }
-}
-
-
-class SetBotShippingResultsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe5f672fa;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe5f672fa;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.queryId = args.queryId;
-        this.error = args.error || null;
-        this.shippingOptions = args.shippingOptions || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fa72f6e5","hex"),
-            struct.pack('<I', (this.error === undefined || this.error === false || this.error === null) ? 0 : 1 | (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions === null) ? 0 : 2),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            (this.error === undefined || this.error === false || this.error ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.error)],
-            (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.shippingOptions.length),Buffer.concat(this.shippingOptions.map(x => x.getBytes()))]),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _query_id;
-        let _error;
-        let _shipping_options;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _query_id = reader.readLong();
-        if (flags & 1) {
-            _error = reader.tgReadString();
-        }
-        else {
-            _error = null
-        }
-        if (flags & 2) {
-            reader.readInt();
-            _shipping_options = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _shipping_options.push(_x);
-                }
-            }
-            else {
-                _shipping_options = null
-            }
-            return new this({queryId:_query_id,
-	error:_error,
-	shippingOptions:_shipping_options})
-        }
-    }
-
-
-class SetBotPrecheckoutResultsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x09c2dd95;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x09c2dd95;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.success = args.success || null;
-        this.queryId = args.queryId;
-        this.error = args.error || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("95ddc209","hex"),
-            struct.pack('<I', (this.success === undefined || this.success === false || this.success === null) ? 0 : 2 | (this.error === undefined || this.error === false || this.error === null) ? 0 : 1),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            (this.error === undefined || this.error === false || this.error ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.error)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _success;
-        let _query_id;
-        let _error;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _success = Boolean(flags & 2);
-        _query_id = reader.readLong();
-        if (flags & 1) {
-            _error = reader.tgReadString();
-        }
-        else {
-            _error = null
-        }
-        return new this({success:_success,
-	queryId:_query_id,
-	error:_error})
-    }
-}
-
-
-class UploadMediaRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x519bc2b1;
-    static SUBCLASS_OF_ID = 0x476cbe32;
-
-    /**
-    :returns MessageMedia: Instance of either MessageMediaEmpty, MessageMediaPhoto, MessageMediaGeo, MessageMediaContact, MessageMediaUnsupported, MessageMediaDocument, MessageMediaWebPage, MessageMediaVenue, MessageMediaGame, MessageMediaInvoice, MessageMediaGeoLive, MessageMediaPoll
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x519bc2b1;
-        this.SUBCLASS_OF_ID = 0x476cbe32;
-
-        this.peer = args.peer;
-        this.media = args.media;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-        this.media = utils.getInputMedia(this.media)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b1c29b51","hex"),
-            this.peer.getBytes(),
-            this.media.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _media;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _media = reader.tgReadObject();
-        return new this({peer:_peer,
-	media:_media})
-    }
-}
-
-
-class SendScreenshotNotificationRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc97df020;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc97df020;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.peer = args.peer;
-        this.replyToMsgId = args.replyToMsgId;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("20f07dc9","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.replyToMsgId),
-            readBufferFromBigInt(this.randomId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _reply_to_msg_id;
-        let _random_id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _reply_to_msg_id = reader.readInt();
-        _random_id = reader.readLong();
-        return new this({peer:_peer,
-	replyToMsgId:_reply_to_msg_id,
-	randomId:_random_id})
-    }
-}
-
-
-class GetFavedStickersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x21ce0b0e;
-    static SUBCLASS_OF_ID = 0x8e736fb9;
-
-    /**
-    :returns messages.FavedStickers: Instance of either FavedStickersNotModified, FavedStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x21ce0b0e;
-        this.SUBCLASS_OF_ID = 0x8e736fb9;
-
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0e0bce21","hex"),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        return new this({hash:_hash})
-    }
-}
-
-
-class FaveStickerRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb9ffc55b;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb9ffc55b;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-        this.unfave = args.unfave;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputDocument(this.id)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5bc5ffb9","hex"),
-            this.id.getBytes(),
-            this.unfave ? 0xb5757299 : 0x379779bc,
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _unfave;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        _unfave = reader.tgReadBool();
-        return new this({id:_id,
-	unfave:_unfave})
-    }
-}
-
-
-class GetUnreadMentionsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x46578472;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x46578472;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.peer = args.peer;
-        this.offsetId = args.offsetId;
-        this.addOffset = args.addOffset;
-        this.limit = args.limit;
-        this.maxId = args.maxId;
-        this.minId = args.minId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("72845746","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.offsetId),
-            struct.pack('<i', this.addOffset),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.maxId),
-            struct.pack('<i', this.minId),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _offset_id;
-        let _add_offset;
-        let _limit;
-        let _max_id;
-        let _min_id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _offset_id = reader.readInt();
-        _add_offset = reader.readInt();
-        _limit = reader.readInt();
-        _max_id = reader.readInt();
-        _min_id = reader.readInt();
-        return new this({peer:_peer,
-	offsetId:_offset_id,
-	addOffset:_add_offset,
-	limit:_limit,
-	maxId:_max_id,
-	minId:_min_id})
-    }
-}
-
-
-class ReadMentionsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0f0189d3;
-    static SUBCLASS_OF_ID = 0x2c49c116;
-
-    /**
-    :returns messages.AffectedHistory: Instance of AffectedHistory
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0f0189d3;
-        this.SUBCLASS_OF_ID = 0x2c49c116;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d389010f","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class GetRecentLocationsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbbc45b09;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbbc45b09;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.peer = args.peer;
-        this.limit = args.limit;
-        this.hash = args.hash;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("095bc4bb","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.limit),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _limit;
-        let _hash;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _limit = reader.readInt();
-        _hash = reader.readInt();
-        return new this({peer:_peer,
-	limit:_limit,
-	hash:_hash})
-    }
-}
-
-
-class SendMultiMediaRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xcc0110cb;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcc0110cb;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.silent = args.silent || null;
-        this.background = args.background || null;
-        this.clearDraft = args.clearDraft || null;
-        this.peer = args.peer;
-        this.replyToMsgId = args.replyToMsgId || null;
-        this.multiMedia = args.multiMedia;
-        this.scheduleDate = args.scheduleDate || null;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cb1001cc","hex"),
-            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
-            this.peer.getBytes(),
-            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.multiMedia.length),Buffer.concat(this.multiMedia.map(x => x.getBytes())),
-            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _silent;
-        let _background;
-        let _clear_draft;
-        let _peer;
-        let _reply_to_msg_id;
-        let _multi_media;
-        let _schedule_date;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _silent = Boolean(flags & 32);
-        _background = Boolean(flags & 64);
-        _clear_draft = Boolean(flags & 128);
-        _peer = reader.tgReadObject();
-        if (flags & 1) {
-            _reply_to_msg_id = reader.readInt();
-        }
-        else {
-            _reply_to_msg_id = null
-        }
-        reader.readInt();
-        _multi_media = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _multi_media.push(_x);
-            }
-            if (flags & 1024) {
-                _schedule_date = reader.readInt();
-            }
-            else {
-                _schedule_date = null
-            }
-            return new this({silent:_silent,
-	background:_background,
-	clearDraft:_clear_draft,
-	peer:_peer,
-	replyToMsgId:_reply_to_msg_id,
-	multiMedia:_multi_media,
-	scheduleDate:_schedule_date})
-        }
-    }
-
-
-class UploadEncryptedFileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x5057c497;
-    static SUBCLASS_OF_ID = 0x842a67c0;
-
-    /**
-    :returns EncryptedFile: Instance of either EncryptedFileEmpty, EncryptedFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5057c497;
-        this.SUBCLASS_OF_ID = 0x842a67c0;
-
-        this.peer = args.peer;
-        this.file = args.file;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("97c45750","hex"),
-            this.peer.getBytes(),
-            this.file.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _file;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _file = reader.tgReadObject();
-        return new this({peer:_peer,
-	file:_file})
-    }
-}
-
-
-class SearchStickerSetsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc2b7d08b;
-    static SUBCLASS_OF_ID = 0x40df361;
-
-    /**
-    :returns messages.FoundStickerSets: Instance of either FoundStickerSetsNotModified, FoundStickerSets
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc2b7d08b;
-        this.SUBCLASS_OF_ID = 0x40df361;
-
-        this.excludeFeatured = args.excludeFeatured || null;
-        this.q = args.q;
-        this.hash = args.hash;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8bd0b7c2","hex"),
-            struct.pack('<I', (this.excludeFeatured === undefined || this.excludeFeatured === false || this.excludeFeatured === null) ? 0 : 1),
-            TLObject.serializeBytes(this.q),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _exclude_featured;
-        let _q;
-        let _hash;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _exclude_featured = Boolean(flags & 1);
-        _q = reader.tgReadString();
-        _hash = reader.readInt();
-        return new this({excludeFeatured:_exclude_featured,
-	q:_q,
-	hash:_hash})
-    }
-}
-
-
-class GetSplitRangesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1cff7e08;
-    static SUBCLASS_OF_ID = 0x5ba52504;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x1cff7e08;
-        this.SUBCLASS_OF_ID = 0x5ba52504;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("087eff1c","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class MarkDialogUnreadRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc286d98f;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc286d98f;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.unread = args.unread || null;
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = await client._getInputDialog(this.peer)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8fd986c2","hex"),
-            struct.pack('<I', (this.unread === undefined || this.unread === false || this.unread === null) ? 0 : 1),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _unread;
-        let _peer;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _unread = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        return new this({unread:_unread,
-	peer:_peer})
-    }
-}
-
-
-class GetDialogUnreadMarksRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x22e24e22;
-    static SUBCLASS_OF_ID = 0xbec64ad9;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x22e24e22;
-        this.SUBCLASS_OF_ID = 0xbec64ad9;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("224ee222","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ClearAllDraftsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x7e58ee9c;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x7e58ee9c;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9cee587e","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class UpdatePinnedMessageRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd2aaf7ec;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd2aaf7ec;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.silent = args.silent || null;
-        this.peer = args.peer;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ecf7aad2","hex"),
-            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 1),
-            this.peer.getBytes(),
-            struct.pack('<i', this.id),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _silent;
-        let _peer;
-        let _id;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _silent = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        _id = reader.readInt();
-        return new this({silent:_silent,
-	peer:_peer,
-	id:_id})
-    }
-}
-
-
-class SendVoteRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x10ea6184;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x10ea6184;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.peer = args.peer;
-        this.msgId = args.msgId;
-        this.options = args.options;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8461ea10","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.msgId),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.options.length),Buffer.concat(this.options.map(x => TLObject.serializeBytes(x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _msg_id;
-        let _options;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _msg_id = reader.readInt();
-        reader.readInt();
-        _options = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadBytes();
-            _options.push(_x);
-            }
-            return new this({peer:_peer,
-	msgId:_msg_id,
-	options:_options})
-        }
-    }
-
-
-class GetPollResultsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x73bb643b;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x73bb643b;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.peer = args.peer;
-        this.msgId = args.msgId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3b64bb73","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.msgId),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _msg_id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _msg_id = reader.readInt();
-        return new this({peer:_peer,
-	msgId:_msg_id})
-    }
-}
-
-
-class GetOnlinesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x6e2be050;
-    static SUBCLASS_OF_ID = 0x8c81903a;
-
-    /**
-    :returns ChatOnlines: Instance of ChatOnlines
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6e2be050;
-        this.SUBCLASS_OF_ID = 0x8c81903a;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("50e02b6e","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class GetStatsURLRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x812c2ae6;
-    static SUBCLASS_OF_ID = 0x8d4c94c0;
-
-    /**
-    :returns StatsURL: Instance of StatsURL
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x812c2ae6;
-        this.SUBCLASS_OF_ID = 0x8d4c94c0;
-
-        this.dark = args.dark || null;
-        this.peer = args.peer;
-        this.params = args.params;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e62a2c81","hex"),
-            struct.pack('<I', (this.dark === undefined || this.dark === false || this.dark === null) ? 0 : 1),
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.params),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _dark;
-        let _peer;
-        let _params;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _dark = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        _params = reader.tgReadString();
-        return new this({dark:_dark,
-	peer:_peer,
-	params:_params})
-    }
-}
-
-
-class EditChatAboutRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xdef60797;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdef60797;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.about = args.about;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9707f6de","hex"),
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.about),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _about;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _about = reader.tgReadString();
-        return new this({peer:_peer,
-	about:_about})
-    }
-}
-
-
-class EditChatDefaultBannedRightsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa5866b41;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa5866b41;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.peer = args.peer;
-        this.bannedRights = args.bannedRights;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("416b86a5","hex"),
-            this.peer.getBytes(),
-            this.bannedRights.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _banned_rights;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _banned_rights = reader.tgReadObject();
-        return new this({peer:_peer,
-	bannedRights:_banned_rights})
-    }
-}
-
-
-class GetEmojiKeywordsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x35a0e062;
-    static SUBCLASS_OF_ID = 0xd279c672;
-
-    /**
-    :returns EmojiKeywordsDifference: Instance of EmojiKeywordsDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x35a0e062;
-        this.SUBCLASS_OF_ID = 0xd279c672;
-
-        this.langCode = args.langCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("62e0a035","hex"),
-            TLObject.serializeBytes(this.langCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_code;
-        let _x;
-        let len;
-        _lang_code = reader.tgReadString();
-        return new this({langCode:_lang_code})
-    }
-}
-
-
-class GetEmojiKeywordsDifferenceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x1508b6af;
-    static SUBCLASS_OF_ID = 0xd279c672;
-
-    /**
-    :returns EmojiKeywordsDifference: Instance of EmojiKeywordsDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1508b6af;
-        this.SUBCLASS_OF_ID = 0xd279c672;
-
-        this.langCode = args.langCode;
-        this.fromVersion = args.fromVersion;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("afb60815","hex"),
-            TLObject.serializeBytes(this.langCode),
-            struct.pack('<i', this.fromVersion),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_code;
-        let _from_version;
-        let _x;
-        let len;
-        _lang_code = reader.tgReadString();
-        _from_version = reader.readInt();
-        return new this({langCode:_lang_code,
-	fromVersion:_from_version})
-    }
-}
-
-
-class GetEmojiKeywordsLanguagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4e9963b2;
-    static SUBCLASS_OF_ID = 0xe795d387;
-
-    /**
-    :returns Vector<EmojiLanguage>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4e9963b2;
-        this.SUBCLASS_OF_ID = 0xe795d387;
-
-        this.langCodes = args.langCodes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b263994e","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.langCodes.length),Buffer.concat(this.langCodes.map(x => TLObject.serializeBytes(x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_codes;
-        let _x;
-        let len;
-        reader.readInt();
-        _lang_codes = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadString();
-            _lang_codes.push(_x);
-            }
-            return new this({langCodes:_lang_codes})
-        }
-    }
-
-
-class GetEmojiURLRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd5b10c26;
-    static SUBCLASS_OF_ID = 0x1fa08a19;
-
-    /**
-    :returns EmojiURL: Instance of EmojiURL
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd5b10c26;
-        this.SUBCLASS_OF_ID = 0x1fa08a19;
-
-        this.langCode = args.langCode;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("260cb1d5","hex"),
-            TLObject.serializeBytes(this.langCode),
-            ])
-        }
-    static fromReader(reader) {
-        let _lang_code;
-        let _x;
-        let len;
-        _lang_code = reader.tgReadString();
-        return new this({langCode:_lang_code})
-    }
-}
-
-
-class GetSearchCountersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x732eef00;
-    static SUBCLASS_OF_ID = 0x6bde3c6e;
-
-    /**
-    :returns Vector<messages.SearchCounter>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x732eef00;
-        this.SUBCLASS_OF_ID = 0x6bde3c6e;
-
-        this.peer = args.peer;
-        this.filters = args.filters;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("00ef2e73","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.filters.length),Buffer.concat(this.filters.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _filters;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _filters = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _filters.push(_x);
-            }
-            return new this({peer:_peer,
-	filters:_filters})
-        }
-    }
-
-
-class RequestUrlAuthRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe33f5613;
-    static SUBCLASS_OF_ID = 0x7765cb1e;
-
-    /**
-    :returns UrlAuthResult: Instance of either UrlAuthResultRequest, UrlAuthResultAccepted, UrlAuthResultDefault
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe33f5613;
-        this.SUBCLASS_OF_ID = 0x7765cb1e;
-
-        this.peer = args.peer;
-        this.msgId = args.msgId;
-        this.buttonId = args.buttonId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("13563fe3","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.msgId),
-            struct.pack('<i', this.buttonId),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _msg_id;
-        let _button_id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _msg_id = reader.readInt();
-        _button_id = reader.readInt();
-        return new this({peer:_peer,
-	msgId:_msg_id,
-	buttonId:_button_id})
-    }
-}
-
-
-class AcceptUrlAuthRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf729ea98;
-    static SUBCLASS_OF_ID = 0x7765cb1e;
-
-    /**
-    :returns UrlAuthResult: Instance of either UrlAuthResultRequest, UrlAuthResultAccepted, UrlAuthResultDefault
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf729ea98;
-        this.SUBCLASS_OF_ID = 0x7765cb1e;
-
-        this.writeAllowed = args.writeAllowed || null;
-        this.peer = args.peer;
-        this.msgId = args.msgId;
-        this.buttonId = args.buttonId;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("98ea29f7","hex"),
-            struct.pack('<I', (this.writeAllowed === undefined || this.writeAllowed === false || this.writeAllowed === null) ? 0 : 1),
-            this.peer.getBytes(),
-            struct.pack('<i', this.msgId),
-            struct.pack('<i', this.buttonId),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _write_allowed;
-        let _peer;
-        let _msg_id;
-        let _button_id;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _write_allowed = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        _msg_id = reader.readInt();
-        _button_id = reader.readInt();
-        return new this({writeAllowed:_write_allowed,
-	peer:_peer,
-	msgId:_msg_id,
-	buttonId:_button_id})
-    }
-}
-
-
-class HidePeerSettingsBarRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4facb138;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4facb138;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("38b1ac4f","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class GetScheduledHistoryRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xe2c2685b;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe2c2685b;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.peer = args.peer;
-        this.hash = args.hash;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5b68c2e2","hex"),
-            this.peer.getBytes(),
-            struct.pack('<i', this.hash),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _hash;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _hash = reader.readInt();
-        return new this({peer:_peer,
-	hash:_hash})
-    }
-}
-
-
-class GetScheduledMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbdbb0464;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbdbb0464;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.peer = args.peer;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6404bbbd","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({peer:_peer,
-	id:_id})
-        }
-    }
-
-
-class SendScheduledMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xbd38850a;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xbd38850a;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.peer = args.peer;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0a8538bd","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({peer:_peer,
-	id:_id})
-        }
-    }
-
-
-class DeleteScheduledMessagesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x59ae2b16;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x59ae2b16;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.peer = args.peer;
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("162bae59","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _id;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.readInt();
-            _id.push(_x);
-            }
-            return new this({peer:_peer,
-	id:_id})
-        }
-    }
-
-module.exports = {
-    GetMessagesRequest,
-    GetDialogsRequest,
-    GetHistoryRequest,
-    SearchRequest,
-    ReadHistoryRequest,
-    DeleteHistoryRequest,
-    DeleteMessagesRequest,
-    ReceivedMessagesRequest,
-    SetTypingRequest,
-    SendMessageRequest,
-    SendMediaRequest,
-    ForwardMessagesRequest,
-    ReportSpamRequest,
-    GetPeerSettingsRequest,
-    ReportRequest,
-    GetChatsRequest,
-    GetFullChatRequest,
-    EditChatTitleRequest,
-    EditChatPhotoRequest,
-    AddChatUserRequest,
-    DeleteChatUserRequest,
-    CreateChatRequest,
-    GetDhConfigRequest,
-    RequestEncryptionRequest,
-    AcceptEncryptionRequest,
-    DiscardEncryptionRequest,
-    SetEncryptedTypingRequest,
-    ReadEncryptedHistoryRequest,
-    SendEncryptedRequest,
-    SendEncryptedFileRequest,
-    SendEncryptedServiceRequest,
-    ReceivedQueueRequest,
-    ReportEncryptedSpamRequest,
-    ReadMessageContentsRequest,
-    GetStickersRequest,
-    GetAllStickersRequest,
-    GetWebPagePreviewRequest,
-    ExportChatInviteRequest,
-    CheckChatInviteRequest,
-    ImportChatInviteRequest,
-    GetStickerSetRequest,
-    InstallStickerSetRequest,
-    UninstallStickerSetRequest,
-    StartBotRequest,
-    GetMessagesViewsRequest,
-    EditChatAdminRequest,
-    MigrateChatRequest,
-    SearchGlobalRequest,
-    ReorderStickerSetsRequest,
-    GetDocumentByHashRequest,
-    SearchGifsRequest,
-    GetSavedGifsRequest,
-    SaveGifRequest,
-    GetInlineBotResultsRequest,
-    SetInlineBotResultsRequest,
-    SendInlineBotResultRequest,
-    GetMessageEditDataRequest,
-    EditMessageRequest,
-    EditInlineBotMessageRequest,
-    GetBotCallbackAnswerRequest,
-    SetBotCallbackAnswerRequest,
-    GetPeerDialogsRequest,
-    SaveDraftRequest,
-    GetAllDraftsRequest,
-    GetFeaturedStickersRequest,
-    ReadFeaturedStickersRequest,
-    GetRecentStickersRequest,
-    SaveRecentStickerRequest,
-    ClearRecentStickersRequest,
-    GetArchivedStickersRequest,
-    GetMaskStickersRequest,
-    GetAttachedStickersRequest,
-    SetGameScoreRequest,
-    SetInlineGameScoreRequest,
-    GetGameHighScoresRequest,
-    GetInlineGameHighScoresRequest,
-    GetCommonChatsRequest,
-    GetAllChatsRequest,
-    GetWebPageRequest,
-    ToggleDialogPinRequest,
-    ReorderPinnedDialogsRequest,
-    GetPinnedDialogsRequest,
-    SetBotShippingResultsRequest,
-    SetBotPrecheckoutResultsRequest,
-    UploadMediaRequest,
-    SendScreenshotNotificationRequest,
-    GetFavedStickersRequest,
-    FaveStickerRequest,
-    GetUnreadMentionsRequest,
-    ReadMentionsRequest,
-    GetRecentLocationsRequest,
-    SendMultiMediaRequest,
-    UploadEncryptedFileRequest,
-    SearchStickerSetsRequest,
-    GetSplitRangesRequest,
-    MarkDialogUnreadRequest,
-    GetDialogUnreadMarksRequest,
-    ClearAllDraftsRequest,
-    UpdatePinnedMessageRequest,
-    SendVoteRequest,
-    GetPollResultsRequest,
-    GetOnlinesRequest,
-    GetStatsURLRequest,
-    EditChatAboutRequest,
-    EditChatDefaultBannedRightsRequest,
-    GetEmojiKeywordsRequest,
-    GetEmojiKeywordsDifferenceRequest,
-    GetEmojiKeywordsLanguagesRequest,
-    GetEmojiURLRequest,
-    GetSearchCountersRequest,
-    RequestUrlAuthRequest,
-    AcceptUrlAuthRequest,
-    HidePeerSettingsBarRequest,
-    GetScheduledHistoryRequest,
-    GetScheduledMessagesRequest,
-    SendScheduledMessagesRequest,
-    DeleteScheduledMessagesRequest,
-};

+ 0 - 242
src/lib/gramjs/tl/functions/payments.js

@@ -1,242 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetPaymentFormRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x99f09745;
-    static SUBCLASS_OF_ID = 0xa0483f19;
-
-    /**
-    :returns payments.PaymentForm: Instance of PaymentForm
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x99f09745;
-        this.SUBCLASS_OF_ID = 0xa0483f19;
-
-        this.msgId = args.msgId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4597f099","hex"),
-            struct.pack('<i', this.msgId),
-            ])
-        }
-    static fromReader(reader) {
-        let _msg_id;
-        let _x;
-        let len;
-        _msg_id = reader.readInt();
-        return new this({msgId:_msg_id})
-    }
-}
-
-
-class GetPaymentReceiptRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xa092a980;
-    static SUBCLASS_OF_ID = 0x590093c9;
-
-    /**
-    :returns payments.PaymentReceipt: Instance of PaymentReceipt
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa092a980;
-        this.SUBCLASS_OF_ID = 0x590093c9;
-
-        this.msgId = args.msgId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("80a992a0","hex"),
-            struct.pack('<i', this.msgId),
-            ])
-        }
-    static fromReader(reader) {
-        let _msg_id;
-        let _x;
-        let len;
-        _msg_id = reader.readInt();
-        return new this({msgId:_msg_id})
-    }
-}
-
-
-class ValidateRequestedInfoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x770a8e74;
-    static SUBCLASS_OF_ID = 0x8f8044b7;
-
-    /**
-    :returns payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x770a8e74;
-        this.SUBCLASS_OF_ID = 0x8f8044b7;
-
-        this.save = args.save || null;
-        this.msgId = args.msgId;
-        this.info = args.info;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("748e0a77","hex"),
-            struct.pack('<I', (this.save === undefined || this.save === false || this.save === null) ? 0 : 1),
-            struct.pack('<i', this.msgId),
-            this.info.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _save;
-        let _msg_id;
-        let _info;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _save = Boolean(flags & 1);
-        _msg_id = reader.readInt();
-        _info = reader.tgReadObject();
-        return new this({save:_save,
-	msgId:_msg_id,
-	info:_info})
-    }
-}
-
-
-class SendPaymentFormRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2b8879b3;
-    static SUBCLASS_OF_ID = 0x8ae16a9d;
-
-    /**
-    :returns payments.PaymentResult: Instance of either PaymentResult, PaymentVerificationNeeded
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2b8879b3;
-        this.SUBCLASS_OF_ID = 0x8ae16a9d;
-
-        this.msgId = args.msgId;
-        this.requestedInfoId = args.requestedInfoId || null;
-        this.shippingOptionId = args.shippingOptionId || null;
-        this.credentials = args.credentials;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b379882b","hex"),
-            struct.pack('<I', (this.requestedInfoId === undefined || this.requestedInfoId === false || this.requestedInfoId === null) ? 0 : 1 | (this.shippingOptionId === undefined || this.shippingOptionId === false || this.shippingOptionId === null) ? 0 : 2),
-            struct.pack('<i', this.msgId),
-            (this.requestedInfoId === undefined || this.requestedInfoId === false || this.requestedInfoId ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.requestedInfoId)],
-            (this.shippingOptionId === undefined || this.shippingOptionId === false || this.shippingOptionId ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.shippingOptionId)],
-            this.credentials.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _msg_id;
-        let _requested_info_id;
-        let _shipping_option_id;
-        let _credentials;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _msg_id = reader.readInt();
-        if (flags & 1) {
-            _requested_info_id = reader.tgReadString();
-        }
-        else {
-            _requested_info_id = null
-        }
-        if (flags & 2) {
-            _shipping_option_id = reader.tgReadString();
-        }
-        else {
-            _shipping_option_id = null
-        }
-        _credentials = reader.tgReadObject();
-        return new this({msgId:_msg_id,
-	requestedInfoId:_requested_info_id,
-	shippingOptionId:_shipping_option_id,
-	credentials:_credentials})
-    }
-}
-
-
-class GetSavedInfoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x227d824b;
-    static SUBCLASS_OF_ID = 0xad3cf146;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x227d824b;
-        this.SUBCLASS_OF_ID = 0xad3cf146;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4b827d22","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ClearSavedInfoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xd83d70c1;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd83d70c1;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.credentials = args.credentials || null;
-        this.info = args.info || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c1703dd8","hex"),
-            struct.pack('<I', (this.credentials === undefined || this.credentials === false || this.credentials === null) ? 0 : 1 | (this.info === undefined || this.info === false || this.info === null) ? 0 : 2),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _credentials;
-        let _info;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _credentials = Boolean(flags & 1);
-        _info = Boolean(flags & 2);
-        return new this({credentials:_credentials,
-	info:_info})
-    }
-}
-
-module.exports = {
-    GetPaymentFormRequest,
-    GetPaymentReceiptRequest,
-    ValidateRequestedInfoRequest,
-    SendPaymentFormRequest,
-    GetSavedInfoRequest,
-    ClearSavedInfoRequest,
-};

+ 0 - 354
src/lib/gramjs/tl/functions/phone.js

@@ -1,354 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetCallConfigRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x55451fa9;
-    static SUBCLASS_OF_ID = 0xad0352e8;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x55451fa9;
-        this.SUBCLASS_OF_ID = 0xad0352e8;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a91f4555","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class RequestCallRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x42ff96ed;
-    static SUBCLASS_OF_ID = 0xd48afe4f;
-
-    /**
-    :returns phone.PhoneCall: Instance of PhoneCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x42ff96ed;
-        this.SUBCLASS_OF_ID = 0xd48afe4f;
-
-        this.video = args.video || null;
-        this.userId = args.userId;
-        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(4),false,true);
-        this.gAHash = args.gAHash;
-        this.protocol = args.protocol;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ed96ff42","hex"),
-            struct.pack('<I', (this.video === undefined || this.video === false || this.video === null) ? 0 : 1),
-            this.userId.getBytes(),
-            struct.pack('<i', this.randomId),
-            TLObject.serializeBytes(this.gAHash),
-            this.protocol.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _video;
-        let _user_id;
-        let _random_id;
-        let _g_a_hash;
-        let _protocol;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _video = Boolean(flags & 1);
-        _user_id = reader.tgReadObject();
-        _random_id = reader.readInt();
-        _g_a_hash = reader.tgReadBytes();
-        _protocol = reader.tgReadObject();
-        return new this({video:_video,
-	userId:_user_id,
-	randomId:_random_id,
-	gAHash:_g_a_hash,
-	protocol:_protocol})
-    }
-}
-
-
-class AcceptCallRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x3bd2b4a0;
-    static SUBCLASS_OF_ID = 0xd48afe4f;
-
-    /**
-    :returns phone.PhoneCall: Instance of PhoneCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3bd2b4a0;
-        this.SUBCLASS_OF_ID = 0xd48afe4f;
-
-        this.peer = args.peer;
-        this.gB = args.gB;
-        this.protocol = args.protocol;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a0b4d23b","hex"),
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.gB),
-            this.protocol.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _g_b;
-        let _protocol;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _g_b = reader.tgReadBytes();
-        _protocol = reader.tgReadObject();
-        return new this({peer:_peer,
-	gB:_g_b,
-	protocol:_protocol})
-    }
-}
-
-
-class ConfirmCallRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2efe1722;
-    static SUBCLASS_OF_ID = 0xd48afe4f;
-
-    /**
-    :returns phone.PhoneCall: Instance of PhoneCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2efe1722;
-        this.SUBCLASS_OF_ID = 0xd48afe4f;
-
-        this.peer = args.peer;
-        this.gA = args.gA;
-        this.keyFingerprint = args.keyFingerprint;
-        this.protocol = args.protocol;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2217fe2e","hex"),
-            this.peer.getBytes(),
-            TLObject.serializeBytes(this.gA),
-            readBufferFromBigInt(this.keyFingerprint,8,true,true),
-            this.protocol.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _g_a;
-        let _key_fingerprint;
-        let _protocol;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _g_a = reader.tgReadBytes();
-        _key_fingerprint = reader.readLong();
-        _protocol = reader.tgReadObject();
-        return new this({peer:_peer,
-	gA:_g_a,
-	keyFingerprint:_key_fingerprint,
-	protocol:_protocol})
-    }
-}
-
-
-class ReceivedCallRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x17d54f61;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x17d54f61;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("614fd517","hex"),
-            this.peer.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        return new this({peer:_peer})
-    }
-}
-
-
-class DiscardCallRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb2cbc1c0;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb2cbc1c0;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.video = args.video || null;
-        this.peer = args.peer;
-        this.duration = args.duration;
-        this.reason = args.reason;
-        this.connectionId = args.connectionId;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c0c1cbb2","hex"),
-            struct.pack('<I', (this.video === undefined || this.video === false || this.video === null) ? 0 : 1),
-            this.peer.getBytes(),
-            struct.pack('<i', this.duration),
-            this.reason.getBytes(),
-            readBufferFromBigInt(this.connectionId,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _video;
-        let _peer;
-        let _duration;
-        let _reason;
-        let _connection_id;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _video = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        _duration = reader.readInt();
-        _reason = reader.tgReadObject();
-        _connection_id = reader.readLong();
-        return new this({video:_video,
-	peer:_peer,
-	duration:_duration,
-	reason:_reason,
-	connectionId:_connection_id})
-    }
-}
-
-
-class SetCallRatingRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x59ead627;
-    static SUBCLASS_OF_ID = 0x8af52aac;
-
-    /**
-    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x59ead627;
-        this.SUBCLASS_OF_ID = 0x8af52aac;
-
-        this.userInitiative = args.userInitiative || null;
-        this.peer = args.peer;
-        this.rating = args.rating;
-        this.comment = args.comment;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("27d6ea59","hex"),
-            struct.pack('<I', (this.userInitiative === undefined || this.userInitiative === false || this.userInitiative === null) ? 0 : 1),
-            this.peer.getBytes(),
-            struct.pack('<i', this.rating),
-            TLObject.serializeBytes(this.comment),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _user_initiative;
-        let _peer;
-        let _rating;
-        let _comment;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _user_initiative = Boolean(flags & 1);
-        _peer = reader.tgReadObject();
-        _rating = reader.readInt();
-        _comment = reader.tgReadString();
-        return new this({userInitiative:_user_initiative,
-	peer:_peer,
-	rating:_rating,
-	comment:_comment})
-    }
-}
-
-
-class SaveCallDebugRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x277add7e;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x277add7e;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.peer = args.peer;
-        this.debug = args.debug;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7edd7a27","hex"),
-            this.peer.getBytes(),
-            this.debug.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _debug;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        _debug = reader.tgReadObject();
-        return new this({peer:_peer,
-	debug:_debug})
-    }
-}
-
-module.exports = {
-    GetCallConfigRequest,
-    RequestCallRequest,
-    AcceptCallRequest,
-    ConfirmCallRequest,
-    ReceivedCallRequest,
-    DiscardCallRequest,
-    SetCallRatingRequest,
-    SaveCallDebugRequest,
-};

+ 0 - 179
src/lib/gramjs/tl/functions/photos.js

@@ -1,179 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class UpdateProfilePhotoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf0bb5152;
-    static SUBCLASS_OF_ID = 0xc6338f7d;
-
-    /**
-    :returns UserProfilePhoto: Instance of either UserProfilePhotoEmpty, UserProfilePhoto
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf0bb5152;
-        this.SUBCLASS_OF_ID = 0xc6338f7d;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputPhoto(this.id)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5251bbf0","hex"),
-            this.id.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        return new this({id:_id})
-    }
-}
-
-
-class UploadProfilePhotoRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4f32c098;
-    static SUBCLASS_OF_ID = 0xc292bd24;
-
-    /**
-    :returns photos.Photo: Instance of Photo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4f32c098;
-        this.SUBCLASS_OF_ID = 0xc292bd24;
-
-        this.file = args.file;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("98c0324f","hex"),
-            this.file.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _file;
-        let _x;
-        let len;
-        _file = reader.tgReadObject();
-        return new this({file:_file})
-    }
-}
-
-
-class DeletePhotosRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x87cf7f2f;
-    static SUBCLASS_OF_ID = 0x8918e168;
-
-    /**
-    :returns Vector<long>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x87cf7f2f;
-        this.SUBCLASS_OF_ID = 0x8918e168;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.id) {
-            _tmp.push(utils.getInputPhoto(_x));
-        }
-        this.id = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2f7fcf87","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-        readResult(reader){
-            reader.readInt();  // Vector ID
-            let temp = [];
-            let len = reader.readInt(); //fix this
-            for (let i=0;i<len;i++){
-                temp.push(reader.readLong())
-            }
-            return temp
-        }
-    }
-
-
-class GetUserPhotosRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x91cd32a8;
-    static SUBCLASS_OF_ID = 0x27cfb967;
-
-    /**
-    :returns photos.Photos: Instance of either Photos, PhotosSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x91cd32a8;
-        this.SUBCLASS_OF_ID = 0x27cfb967;
-
-        this.userId = args.userId;
-        this.offset = args.offset;
-        this.maxId = args.maxId;
-        this.limit = args.limit;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a832cd91","hex"),
-            this.userId.getBytes(),
-            struct.pack('<i', this.offset),
-            readBufferFromBigInt(this.maxId,8,true,true),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _user_id;
-        let _offset;
-        let _max_id;
-        let _limit;
-        let _x;
-        let len;
-        _user_id = reader.tgReadObject();
-        _offset = reader.readInt();
-        _max_id = reader.readLong();
-        _limit = reader.readInt();
-        return new this({userId:_user_id,
-	offset:_offset,
-	maxId:_max_id,
-	limit:_limit})
-    }
-}
-
-module.exports = {
-    UpdateProfilePhotoRequest,
-    UploadProfilePhotoRequest,
-    DeletePhotosRequest,
-    GetUserPhotosRequest,
-};

+ 0 - 185
src/lib/gramjs/tl/functions/stickers.js

@@ -1,185 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class CreateStickerSetRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9bd86e6a;
-    static SUBCLASS_OF_ID = 0x9b704a5a;
-
-    /**
-    :returns messages.StickerSet: Instance of StickerSet
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9bd86e6a;
-        this.SUBCLASS_OF_ID = 0x9b704a5a;
-
-        this.masks = args.masks || null;
-        this.userId = args.userId;
-        this.title = args.title;
-        this.shortName = args.shortName;
-        this.stickers = args.stickers;
-    }
-    async resolve(client, utils) {
-        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6a6ed89b","hex"),
-            struct.pack('<I', (this.masks === undefined || this.masks === false || this.masks === null) ? 0 : 1),
-            this.userId.getBytes(),
-            TLObject.serializeBytes(this.title),
-            TLObject.serializeBytes(this.shortName),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _masks;
-        let _user_id;
-        let _title;
-        let _short_name;
-        let _stickers;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _masks = Boolean(flags & 1);
-        _user_id = reader.tgReadObject();
-        _title = reader.tgReadString();
-        _short_name = reader.tgReadString();
-        reader.readInt();
-        _stickers = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _stickers.push(_x);
-            }
-            return new this({masks:_masks,
-	userId:_user_id,
-	title:_title,
-	shortName:_short_name,
-	stickers:_stickers})
-        }
-    }
-
-
-class RemoveStickerFromSetRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xf7760f51;
-    static SUBCLASS_OF_ID = 0x9b704a5a;
-
-    /**
-    :returns messages.StickerSet: Instance of StickerSet
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf7760f51;
-        this.SUBCLASS_OF_ID = 0x9b704a5a;
-
-        this.sticker = args.sticker;
-    }
-    async resolve(client, utils) {
-        this.sticker = utils.getInputDocument(this.sticker)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("510f76f7","hex"),
-            this.sticker.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _sticker;
-        let _x;
-        let len;
-        _sticker = reader.tgReadObject();
-        return new this({sticker:_sticker})
-    }
-}
-
-
-class ChangeStickerPositionRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xffb6d4ca;
-    static SUBCLASS_OF_ID = 0x9b704a5a;
-
-    /**
-    :returns messages.StickerSet: Instance of StickerSet
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xffb6d4ca;
-        this.SUBCLASS_OF_ID = 0x9b704a5a;
-
-        this.sticker = args.sticker;
-        this.position = args.position;
-    }
-    async resolve(client, utils) {
-        this.sticker = utils.getInputDocument(this.sticker)
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cad4b6ff","hex"),
-            this.sticker.getBytes(),
-            struct.pack('<i', this.position),
-            ])
-        }
-    static fromReader(reader) {
-        let _sticker;
-        let _position;
-        let _x;
-        let len;
-        _sticker = reader.tgReadObject();
-        _position = reader.readInt();
-        return new this({sticker:_sticker,
-	position:_position})
-    }
-}
-
-
-class AddStickerToSetRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x8653febe;
-    static SUBCLASS_OF_ID = 0x9b704a5a;
-
-    /**
-    :returns messages.StickerSet: Instance of StickerSet
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8653febe;
-        this.SUBCLASS_OF_ID = 0x9b704a5a;
-
-        this.stickerset = args.stickerset;
-        this.sticker = args.sticker;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("befe5386","hex"),
-            this.stickerset.getBytes(),
-            this.sticker.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _stickerset;
-        let _sticker;
-        let _x;
-        let len;
-        _stickerset = reader.tgReadObject();
-        _sticker = reader.tgReadObject();
-        return new this({stickerset:_stickerset,
-	sticker:_sticker})
-    }
-}
-
-module.exports = {
-    CreateStickerSetRequest,
-    RemoveStickerFromSetRequest,
-    ChangeStickerPositionRequest,
-    AddStickerToSetRequest,
-};

+ 0 - 147
src/lib/gramjs/tl/functions/updates.js

@@ -1,147 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetStateRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xedd4882a;
-    static SUBCLASS_OF_ID = 0x23df1a01;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xedd4882a;
-        this.SUBCLASS_OF_ID = 0x23df1a01;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2a88d4ed","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class GetDifferenceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x25939651;
-    static SUBCLASS_OF_ID = 0x20482874;
-
-    /**
-    :returns updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x25939651;
-        this.SUBCLASS_OF_ID = 0x20482874;
-
-        this.pts = args.pts;
-        this.ptsTotalLimit = args.ptsTotalLimit || null;
-        this.date = args.date;
-        this.qts = args.qts;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("51969325","hex"),
-            struct.pack('<I', (this.ptsTotalLimit === undefined || this.ptsTotalLimit === false || this.ptsTotalLimit === null) ? 0 : 1),
-            struct.pack('<i', this.pts),
-            (this.ptsTotalLimit === undefined || this.ptsTotalLimit === false || this.ptsTotalLimit ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.ptsTotalLimit)],
-            struct.pack('<i', this.date),
-            struct.pack('<i', this.qts),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _pts;
-        let _pts_total_limit;
-        let _date;
-        let _qts;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _pts = reader.readInt();
-        if (flags & 1) {
-            _pts_total_limit = reader.readInt();
-        }
-        else {
-            _pts_total_limit = null
-        }
-        _date = reader.readInt();
-        _qts = reader.readInt();
-        return new this({pts:_pts,
-	ptsTotalLimit:_pts_total_limit,
-	date:_date,
-	qts:_qts})
-    }
-}
-
-
-class GetChannelDifferenceRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x03173d78;
-    static SUBCLASS_OF_ID = 0x29896f5d;
-
-    /**
-    :returns updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x03173d78;
-        this.SUBCLASS_OF_ID = 0x29896f5d;
-
-        this.force = args.force || null;
-        this.channel = args.channel;
-        this.filter = args.filter;
-        this.pts = args.pts;
-        this.limit = args.limit;
-    }
-    async resolve(client, utils) {
-        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("783d1703","hex"),
-            struct.pack('<I', (this.force === undefined || this.force === false || this.force === null) ? 0 : 1),
-            this.channel.getBytes(),
-            this.filter.getBytes(),
-            struct.pack('<i', this.pts),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _force;
-        let _channel;
-        let _filter;
-        let _pts;
-        let _limit;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _force = Boolean(flags & 1);
-        _channel = reader.tgReadObject();
-        _filter = reader.tgReadObject();
-        _pts = reader.readInt();
-        _limit = reader.readInt();
-        return new this({force:_force,
-	channel:_channel,
-	filter:_filter,
-	pts:_pts,
-	limit:_limit})
-    }
-}
-
-module.exports = {
-    GetStateRequest,
-    GetDifferenceRequest,
-    GetChannelDifferenceRequest,
-};

+ 0 - 343
src/lib/gramjs/tl/functions/upload.js

@@ -1,343 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class SaveFilePartRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb304a621;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb304a621;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.fileId = args.fileId;
-        this.filePart = args.filePart;
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("21a604b3","hex"),
-            readBufferFromBigInt(this.fileId,8,true,true),
-            struct.pack('<i', this.filePart),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _file_id;
-        let _file_part;
-        let _bytes;
-        let _x;
-        let len;
-        _file_id = reader.readLong();
-        _file_part = reader.readInt();
-        _bytes = reader.tgReadBytes();
-        return new this({fileId:_file_id,
-	filePart:_file_part,
-	bytes:_bytes})
-    }
-}
-
-
-class GetFileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xb15a9afc;
-    static SUBCLASS_OF_ID = 0x6c9bd728;
-
-    /**
-    :returns upload.File: Instance of either File, FileCdnRedirect
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb15a9afc;
-        this.SUBCLASS_OF_ID = 0x6c9bd728;
-
-        this.precise = args.precise || null;
-        this.location = args.location;
-        this.offset = args.offset;
-        this.limit = args.limit;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fc9a5ab1","hex"),
-            struct.pack('<I', (this.precise === undefined || this.precise === false || this.precise === null) ? 0 : 1),
-            this.location.getBytes(),
-            struct.pack('<i', this.offset),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _precise;
-        let _location;
-        let _offset;
-        let _limit;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _precise = Boolean(flags & 1);
-        _location = reader.tgReadObject();
-        _offset = reader.readInt();
-        _limit = reader.readInt();
-        return new this({precise:_precise,
-	location:_location,
-	offset:_offset,
-	limit:_limit})
-    }
-}
-
-
-class SaveBigFilePartRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xde7b673d;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xde7b673d;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.fileId = args.fileId;
-        this.filePart = args.filePart;
-        this.fileTotalParts = args.fileTotalParts;
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3d677bde","hex"),
-            readBufferFromBigInt(this.fileId,8,true,true),
-            struct.pack('<i', this.filePart),
-            struct.pack('<i', this.fileTotalParts),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _file_id;
-        let _file_part;
-        let _file_total_parts;
-        let _bytes;
-        let _x;
-        let len;
-        _file_id = reader.readLong();
-        _file_part = reader.readInt();
-        _file_total_parts = reader.readInt();
-        _bytes = reader.tgReadBytes();
-        return new this({fileId:_file_id,
-	filePart:_file_part,
-	fileTotalParts:_file_total_parts,
-	bytes:_bytes})
-    }
-}
-
-
-class GetWebFileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x24e6818d;
-    static SUBCLASS_OF_ID = 0x68f17f51;
-
-    /**
-    :returns upload.WebFile: Instance of WebFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x24e6818d;
-        this.SUBCLASS_OF_ID = 0x68f17f51;
-
-        this.location = args.location;
-        this.offset = args.offset;
-        this.limit = args.limit;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8d81e624","hex"),
-            this.location.getBytes(),
-            struct.pack('<i', this.offset),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _location;
-        let _offset;
-        let _limit;
-        let _x;
-        let len;
-        _location = reader.tgReadObject();
-        _offset = reader.readInt();
-        _limit = reader.readInt();
-        return new this({location:_location,
-	offset:_offset,
-	limit:_limit})
-    }
-}
-
-
-class GetCdnFileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x2000bcc3;
-    static SUBCLASS_OF_ID = 0xf5ccf928;
-
-    /**
-    :returns upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2000bcc3;
-        this.SUBCLASS_OF_ID = 0xf5ccf928;
-
-        this.fileToken = args.fileToken;
-        this.offset = args.offset;
-        this.limit = args.limit;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c3bc0020","hex"),
-            TLObject.serializeBytes(this.fileToken),
-            struct.pack('<i', this.offset),
-            struct.pack('<i', this.limit),
-            ])
-        }
-    static fromReader(reader) {
-        let _file_token;
-        let _offset;
-        let _limit;
-        let _x;
-        let len;
-        _file_token = reader.tgReadBytes();
-        _offset = reader.readInt();
-        _limit = reader.readInt();
-        return new this({fileToken:_file_token,
-	offset:_offset,
-	limit:_limit})
-    }
-}
-
-
-class ReuploadCdnFileRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x9b2754a8;
-    static SUBCLASS_OF_ID = 0xa5940726;
-
-    /**
-    :returns Vector<FileHash>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9b2754a8;
-        this.SUBCLASS_OF_ID = 0xa5940726;
-
-        this.fileToken = args.fileToken;
-        this.requestToken = args.requestToken;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a854279b","hex"),
-            TLObject.serializeBytes(this.fileToken),
-            TLObject.serializeBytes(this.requestToken),
-            ])
-        }
-    static fromReader(reader) {
-        let _file_token;
-        let _request_token;
-        let _x;
-        let len;
-        _file_token = reader.tgReadBytes();
-        _request_token = reader.tgReadBytes();
-        return new this({fileToken:_file_token,
-	requestToken:_request_token})
-    }
-}
-
-
-class GetCdnFileHashesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x4da54231;
-    static SUBCLASS_OF_ID = 0xa5940726;
-
-    /**
-    :returns Vector<FileHash>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4da54231;
-        this.SUBCLASS_OF_ID = 0xa5940726;
-
-        this.fileToken = args.fileToken;
-        this.offset = args.offset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3142a54d","hex"),
-            TLObject.serializeBytes(this.fileToken),
-            struct.pack('<i', this.offset),
-            ])
-        }
-    static fromReader(reader) {
-        let _file_token;
-        let _offset;
-        let _x;
-        let len;
-        _file_token = reader.tgReadBytes();
-        _offset = reader.readInt();
-        return new this({fileToken:_file_token,
-	offset:_offset})
-    }
-}
-
-
-class GetFileHashesRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xc7025931;
-    static SUBCLASS_OF_ID = 0xa5940726;
-
-    /**
-    :returns Vector<FileHash>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc7025931;
-        this.SUBCLASS_OF_ID = 0xa5940726;
-
-        this.location = args.location;
-        this.offset = args.offset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("315902c7","hex"),
-            this.location.getBytes(),
-            struct.pack('<i', this.offset),
-            ])
-        }
-    static fromReader(reader) {
-        let _location;
-        let _offset;
-        let _x;
-        let len;
-        _location = reader.tgReadObject();
-        _offset = reader.readInt();
-        return new this({location:_location,
-	offset:_offset})
-    }
-}
-
-module.exports = {
-    SaveFilePartRequest,
-    GetFileRequest,
-    SaveBigFilePartRequest,
-    GetWebFileRequest,
-    GetCdnFileRequest,
-    ReuploadCdnFileRequest,
-    GetCdnFileHashesRequest,
-    GetFileHashesRequest,
-};

+ 0 - 134
src/lib/gramjs/tl/functions/users.js

@@ -1,134 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const { TLRequest } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class GetUsersRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x0d91a548;
-    static SUBCLASS_OF_ID = 0x406da4d;
-
-    /**
-    :returns Vector<User>: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0d91a548;
-        this.SUBCLASS_OF_ID = 0x406da4d;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        const _tmp = [];for (const _x of this.id) {
-            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
-        }
-        this.id = _tmp;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("48a5910d","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        reader.readInt();
-        _id = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _id.push(_x);
-            }
-            return new this({id:_id})
-        }
-    }
-
-
-class GetFullUserRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0xca30a5b1;
-    static SUBCLASS_OF_ID = 0x1f4661b9;
-
-    /**
-    :returns UserFull: Instance of UserFull
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xca30a5b1;
-        this.SUBCLASS_OF_ID = 0x1f4661b9;
-
-        this.id = args.id;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputUser(await client.getInputEntity(this.id))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b1a530ca","hex"),
-            this.id.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        return new this({id:_id})
-    }
-}
-
-
-class SetSecureValueErrorsRequest extends TLRequest {
-    static CONSTRUCTOR_ID = 0x90c894b5;
-    static SUBCLASS_OF_ID = 0xf5b399ac;
-
-    /**
-    :returns Bool: This type has no constructors.
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x90c894b5;
-        this.SUBCLASS_OF_ID = 0xf5b399ac;
-
-        this.id = args.id;
-        this.errors = args.errors;
-    }
-    async resolve(client, utils) {
-        this.id = utils.getInputUser(await client.getInputEntity(this.id))
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b594c890","hex"),
-            this.id.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.errors.length),Buffer.concat(this.errors.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _errors;
-        let _x;
-        let len;
-        _id = reader.tgReadObject();
-        reader.readInt();
-        _errors = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _errors.push(_x);
-            }
-            return new this({id:_id,
-	errors:_errors})
-        }
-    }
-
-module.exports = {
-    GetUsersRequest,
-    GetFullUserRequest,
-    SetSecureValueErrorsRequest,
-};

+ 336 - 0
src/lib/gramjs/tl/generationHelpers.js

@@ -0,0 +1,336 @@
+const {crc32} = require('crc');
+const snakeToCamelCase = (name) => {
+  const result = name.replace(/(?:^|_)([a-z])/g, (_, g) => g.toUpperCase())
+  return result.replace(/_/g, '')
+}
+const variableSnakeToCamelCase = (str) => str.replace(
+  /([-_][a-z])/g,
+  (group) => group.toUpperCase()
+    .replace('-', '')
+    .replace('_', '')
+)
+
+
+const CORE_TYPES = new Set([
+  0xbc799737, // boolFalse#bc799737 = Bool;
+  0x997275b5, // boolTrue#997275b5 = Bool;
+  0x3fedd339, // true#3fedd339 = True;
+  0xc4b9f9bb, // error#c4b9f9bb code:int text:string = Error;
+  0x56730bcc, // null#56730bcc = Null;
+]);
+const AUTH_KEY_TYPES = new Set([
+  0x05162463, // resPQ,
+  0x83c95aec, // p_q_inner_data
+  0xa9f55f95, // p_q_inner_data_dc
+  0x3c6a84d4, // p_q_inner_data_temp
+  0x56fddf88, // p_q_inner_data_temp_dc
+  0xd0e8075c, // server_DH_params_ok
+  0xb5890dba, // server_DH_inner_data
+  0x6643b654, // client_DH_inner_data
+  0xd712e4be, // req_DH_params
+  0xf5045f1f, // set_client_DH_params
+  0x3072cfa1, // gzip_packed
+]);
+
+
+const fromLine = (line, isFunction, methodInfo, layer) => {
+  const match = line.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/);
+  if (!match) {
+    // Probably "vector#1cb5c415 {t:Type} # [ t ] = Vector t;"
+    throw new Error(`Cannot parse TLObject ${line}`)
+  }
+
+  const argsMatch = findAll(/({)?(\w+):([\w\d<>#.?!]+)}?/, line);
+  const currentConfig = {
+    name: match[1],
+    constructorId: parseInt(match[2], 16),
+    argsConfig: {},
+    subclassOfId: crc32(match[3]),
+    result: match[3],
+    isFunction: isFunction,
+    layer: layer,
+    namespace: null
+  }
+  if (!currentConfig.constructorId) {
+
+    let hexId = ''
+    let args
+
+
+    if (Object.values(currentConfig.argsConfig).length) {
+      args = ` ${Object.keys(currentConfig.argsConfig).map((arg) => arg.toString()).join(' ')}`
+    } else {
+      args = ''
+    }
+
+
+    const representation = `${currentConfig.name}${hexId}${args} = ${currentConfig.result}`
+      .replace(/(:|\?)bytes /g, '$1string ')
+      .replace(/</g, ' ')
+      .replace(/>|{|}/g, '')
+      .replace(/ \w+:flags\.\d+\?true/g, '')
+
+    if (currentConfig.name === 'inputMediaInvoice') {
+      // eslint-disable-next-line no-empty
+      if (currentConfig.name === 'inputMediaInvoice') {
+      }
+    }
+
+    currentConfig.constructorId = crc32(Buffer.from(representation, 'utf8'))
+  }
+  for (const [brace, name, argType] of argsMatch) {
+    if (brace===undefined){
+    currentConfig.argsConfig[variableSnakeToCamelCase(name)] = buildArgConfig(name, argType)
+    }
+  }
+  if (currentConfig.name.includes('.')) {
+    [currentConfig.namespace, currentConfig.name] = currentConfig.name.split(/\.(.+)/)
+  }
+  currentConfig.name = snakeToCamelCase(currentConfig.name)
+  if (currentConfig.isFunction){
+    currentConfig.name+="Request"
+  }
+  /*
+  for (const arg in currentConfig.argsConfig){
+    if (currentConfig.argsConfig.hasOwnProperty(arg)){
+      if (currentConfig.argsConfig[arg].flagIndicator){
+        delete  currentConfig.argsConfig[arg]
+      }
+    }
+  }*/
+  return currentConfig
+};
+
+function buildArgConfig(name, argType) {
+  name = name === 'self' ? 'is_self' : name;
+  // Default values
+  const currentConfig = {
+    isVector: false,
+    isFlag: false,
+    skipConstructorId: false,
+    flagIndex: -1,
+    cls: null,
+    flagIndicator: true,
+    isGeneric: false,
+    type: null,
+    useVectorId: null
+  }
+
+  // Special case: some types can be inferred, which makes it
+  // less annoying to type. Currently the only type that can
+  // be inferred is if the name is 'random_id', to which a
+  // random ID will be assigned if left as None (the default)
+  let canBeInferred = name === 'random_id';
+
+  // The type can be an indicator that other arguments will be flags
+  if (argType !== '#') {
+    currentConfig.flagIndicator = false;
+    currentConfig.isGeneric = argType.startsWith('!');
+    // Strip the exclamation mark always to have only the name
+    currentConfig.type = argType.replace(/^!+/, '');
+
+    // The type may be a flag (flags.IDX?REAL_TYPE)
+    // Note that 'flags' is NOT the flags name; this
+    // is determined by a previous argument
+    // However, we assume that the argument will always be called 'flags'
+    // @ts-ignore
+    const flagMatch = currentConfig.type.match(/flags.(\d+)\?([\w<>.]+)/);
+
+    if (flagMatch) {
+      currentConfig.isFlag = true;
+      currentConfig.flagIndex = Number(flagMatch[1]);
+      // Update the type to match the exact type, not the "flagged" one
+      [, , currentConfig.type] = flagMatch
+    }
+
+    // Then check if the type is a Vector<REAL_TYPE>
+    // @ts-ignore
+    const vectorMatch = currentConfig.type.match(/[Vv]ector<([\w\d.]+)>/);
+
+    if (vectorMatch) {
+      currentConfig.isVector = true;
+
+      // If the type's first letter is not uppercase, then
+      // it is a constructor and we use (read/write) its ID.
+      // @ts-ignore
+      currentConfig.useVectorId = currentConfig.type.charAt(0) === 'V';
+
+      // Update the type to match the one inside the vector
+      [, currentConfig.type] = vectorMatch
+    }
+
+    // See use_vector_id. An example of such case is ipPort in
+    // help.configSpecial
+    // @ts-ignore
+    if (/^[a-z]$/.test(currentConfig.type.split('.')
+      .pop()
+      .charAt(0),
+    )
+    ) {
+      currentConfig.skipConstructorId = true
+    }
+
+    // The name may contain "date" in it, if this is the case and
+    // the type is "int", we can safely assume that this should be
+    // treated as a "date" object. Note that this is not a valid
+    // Telegram object, but it's easier to work with
+    // if (
+    //     this.type === 'int' &&
+    //     (/(\b|_)([dr]ate|until|since)(\b|_)/.test(name) ||
+    //         ['expires', 'expires_at', 'was_online'].includes(name))
+    // ) {
+    //     this.type = 'date';
+    // }
+  }
+  return currentConfig
+}
+
+
+const parseTl = function* (content, layer, methods = [], ignoreIds = CORE_TYPES) {
+  const methodInfo = (methods || []).reduce((o, m) => ({...o, [m.name]: m}), {});
+  const objAll = [];
+  const objByName = {};
+  const objByType = {};
+
+  const file = content;
+
+  let isFunction = false;
+
+  for (let line of file.split('\n')) {
+    const commentIndex = line.indexOf('//');
+
+    if (commentIndex !== -1) {
+      line = line.slice(0, commentIndex)
+    }
+
+    line = line.trim();
+
+    if (!line) {
+      continue
+    }
+
+    const match = line.match(/---(\w+)---/);
+
+    if (match) {
+      const [, followingTypes] = match;
+      isFunction = followingTypes === 'functions';
+      continue
+    }
+
+    try {
+      const result = fromLine(line, isFunction, methodInfo, layer);
+
+      if (ignoreIds.has(result.constructorId)) {
+        continue
+      }
+
+      objAll.push(result);
+
+      if (!result.isFunction) {
+        if (!objByType[result.result]) {
+          objByType[result.result] = []
+        }
+
+        objByName[result.name] = result;
+        objByType[result.result].push(result)
+      }
+    } catch (e) {
+      if (!e.toString().includes('vector#1cb5c415')) {
+        throw e
+      }
+    }
+  }
+
+  // Once all objects have been parsed, replace the
+  // string type from the arguments with references
+  for (const obj of objAll) {
+    //console.log(obj)
+    if (AUTH_KEY_TYPES.has(obj.constructorId)) {
+      for (const arg in obj.argsConfig) {
+        if (obj.argsConfig[arg].type === 'string') {
+          obj.argsConfig[arg].type = 'bytes'
+        }
+      }
+    }
+
+    for (const arg in obj.argsConfig) {
+      obj.argsConfig[arg].cls = objByType[obj.argsConfig[arg].type] || (obj.argsConfig[arg].type in objByName ? [objByName[obj.argsConfig[arg].type]] : [])
+    }
+  }
+
+  for (const obj of objAll) {
+    yield obj
+  }
+
+};
+
+const findAll = (regex, str, matches = []) => {
+  if (!regex.flags.includes(`g`)) {
+    regex = new RegExp(regex.source, `g`)
+  }
+
+  const res = regex.exec(str);
+
+  if (res) {
+    matches.push(res.slice(1));
+    findAll(regex, str, matches)
+  }
+
+  return matches
+};
+function serializeBytes(data) {
+  if (!(data instanceof Buffer)) {
+    if (typeof data == 'string') {
+      data = Buffer.from(data)
+    } else {
+      throw Error(`Bytes or str expected, not ${data.constructor.name}`)
+    }
+  }
+  const r = []
+  let padding
+  if (data.length < 254) {
+    padding = (data.length + 1) % 4
+    if (padding !== 0) {
+      padding = 4 - padding
+    }
+    r.push(Buffer.from([data.length]))
+    r.push(data)
+  } else {
+    padding = data.length % 4
+    if (padding !== 0) {
+      padding = 4 - padding
+    }
+    r.push(Buffer.from([254, data.length % 256, (data.length >> 8) % 256, (data.length >> 16) % 256]))
+    r.push(data)
+  }
+  r.push(Buffer.alloc(padding)
+      .fill(0))
+
+  return Buffer.concat(r)
+
+}
+
+function serializeDate(dt) {
+  if (!dt) {
+    return Buffer.alloc(4)
+        .fill(0)
+  }
+  if (dt instanceof Date) {
+    dt = Math.floor((Date.now() - dt.getTime()) / 1000)
+  }
+  if (typeof dt == 'number') {
+    return struct.pack('<i', dt)
+  }
+  throw Error(`Cannot interpret "${dt}" as a date`)
+}
+module.exports = {
+  findAll,
+  parseTl,
+  buildArgConfig,
+  fromLine,
+  CORE_TYPES,
+  serializeDate,
+  serializeBytes,
+  snakeToCamelCase,
+  variableSnakeToCamelCase,
+};

+ 8139 - 0
src/lib/gramjs/tl/gramJsApi.d.ts

@@ -0,0 +1,8139 @@
+
+// This file is autogenerated. All changes will be overwritten.
+
+import { BigInteger } from 'big-integer';
+
+interface GramJsInstance {
+  CONSTRUCTOR_ID: number;
+  SUBCLASS_OF_ID: number;
+
+  getBytes(): Buffer;
+}
+
+type ToArgs<T> = Omit<T, 'CONSTRUCTOR_ID' | 'SUBCLASS_OF_ID' | 'getBytes'>
+
+export namespace MTProto {
+
+  type AnyClass = new (...args: any[]) => any;
+  type AnyLiteral = Record<string, any>;
+  type Buffer = Uint8Array;
+
+  type Reader = any; // To be defined.
+  type Client = any; // To be defined.
+  type Utils = any; // To be defined.
+
+  type X = unknown; // TODO Verify this.
+  type Type = unknown; // TODO Verify this.
+  type Bool = boolean;
+  type int128 = number;
+  type int256 = number;
+  type long = number[] | string | BigInteger;
+  type bytes = string | Uint8Array;
+
+  interface inputPeerEmpty extends GramJsInstance {
+    
+  }
+  interface inputPeerSelf extends GramJsInstance {
+    
+  }
+  interface inputPeerChat extends GramJsInstance {
+    chatId: int;
+  }
+  interface inputPeerUser extends GramJsInstance {
+    userId: int;
+    accessHash: long;
+  }
+  interface inputPeerChannel extends GramJsInstance {
+    channelId: int;
+    accessHash: long;
+  }
+  interface inputPeerUserFromMessage extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+    userId: int;
+  }
+  interface inputPeerChannelFromMessage extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+    channelId: int;
+  }
+  interface inputUserEmpty extends GramJsInstance {
+    
+  }
+  interface inputUserSelf extends GramJsInstance {
+    
+  }
+  interface inputUser extends GramJsInstance {
+    userId: int;
+    accessHash: long;
+  }
+  interface inputUserFromMessage extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+    userId: int;
+  }
+  interface inputPhoneContact extends GramJsInstance {
+    clientId: long;
+    phone: string;
+    firstName: string;
+    lastName: string;
+  }
+  interface inputFile extends GramJsInstance {
+    id: long;
+    parts: int;
+    name: string;
+    md5Checksum: string;
+  }
+  interface inputFileBig extends GramJsInstance {
+    id: long;
+    parts: int;
+    name: string;
+  }
+  interface inputMediaEmpty extends GramJsInstance {
+    
+  }
+  interface inputMediaUploadedPhoto extends GramJsInstance {
+    // flags: null;
+    file: InputFile;
+    stickers?: InputDocument[];
+    ttlSeconds?: int;
+  }
+  interface inputMediaPhoto extends GramJsInstance {
+    // flags: null;
+    id: InputPhoto;
+    ttlSeconds?: int;
+  }
+  interface inputMediaGeoPoint extends GramJsInstance {
+    geoPoint: InputGeoPoint;
+  }
+  interface inputMediaContact extends GramJsInstance {
+    phoneNumber: string;
+    firstName: string;
+    lastName: string;
+    vcard: string;
+  }
+  interface inputMediaUploadedDocument extends GramJsInstance {
+    // flags: null;
+    nosoundVideo?: true;
+    file: InputFile;
+    thumb?: InputFile;
+    mimeType: string;
+    attributes: DocumentAttribute[];
+    stickers?: InputDocument[];
+    ttlSeconds?: int;
+  }
+  interface inputMediaDocument extends GramJsInstance {
+    // flags: null;
+    id: InputDocument;
+    ttlSeconds?: int;
+  }
+  interface inputMediaVenue extends GramJsInstance {
+    geoPoint: InputGeoPoint;
+    title: string;
+    address: string;
+    provider: string;
+    venueId: string;
+    venueType: string;
+  }
+  interface inputMediaGifExternal extends GramJsInstance {
+    url: string;
+    q: string;
+  }
+  interface inputMediaPhotoExternal extends GramJsInstance {
+    // flags: null;
+    url: string;
+    ttlSeconds?: int;
+  }
+  interface inputMediaDocumentExternal extends GramJsInstance {
+    // flags: null;
+    url: string;
+    ttlSeconds?: int;
+  }
+  interface inputMediaGame extends GramJsInstance {
+    id: InputGame;
+  }
+  interface inputMediaInvoice extends GramJsInstance {
+    // flags: null;
+    title: string;
+    description: string;
+    photo?: InputWebDocument;
+    invoice: Invoice;
+    payload: bytes;
+    provider: string;
+    providerData: DataJSON;
+    startParam: string;
+  }
+  interface inputMediaGeoLive extends GramJsInstance {
+    // flags: null;
+    stopped?: true;
+    geoPoint: InputGeoPoint;
+    period?: int;
+  }
+  interface inputMediaPoll extends GramJsInstance {
+    poll: Poll;
+  }
+  interface inputChatPhotoEmpty extends GramJsInstance {
+    
+  }
+  interface inputChatUploadedPhoto extends GramJsInstance {
+    file: InputFile;
+  }
+  interface inputChatPhoto extends GramJsInstance {
+    id: InputPhoto;
+  }
+  interface inputGeoPointEmpty extends GramJsInstance {
+    
+  }
+  interface inputGeoPoint extends GramJsInstance {
+    lat: double;
+    long: double;
+  }
+  interface inputPhotoEmpty extends GramJsInstance {
+    
+  }
+  interface inputPhoto extends GramJsInstance {
+    id: long;
+    accessHash: long;
+    fileReference: bytes;
+  }
+  interface inputFileLocation extends GramJsInstance {
+    volumeId: long;
+    localId: int;
+    secret: long;
+    fileReference: bytes;
+  }
+  interface inputEncryptedFileLocation extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputDocumentFileLocation extends GramJsInstance {
+    id: long;
+    accessHash: long;
+    fileReference: bytes;
+    thumbSize: string;
+  }
+  interface inputSecureFileLocation extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputTakeoutFileLocation extends GramJsInstance {
+    
+  }
+  interface inputPhotoFileLocation extends GramJsInstance {
+    id: long;
+    accessHash: long;
+    fileReference: bytes;
+    thumbSize: string;
+  }
+  interface inputPeerPhotoFileLocation extends GramJsInstance {
+    // flags: null;
+    big?: true;
+    peer: InputPeer;
+    volumeId: long;
+    localId: int;
+  }
+  interface inputStickerSetThumb extends GramJsInstance {
+    stickerset: InputStickerSet;
+    volumeId: long;
+    localId: int;
+  }
+  interface peerUser extends GramJsInstance {
+    userId: int;
+  }
+  interface peerChat extends GramJsInstance {
+    chatId: int;
+  }
+  interface peerChannel extends GramJsInstance {
+    channelId: int;
+  }
+  interface storage_fileUnknown extends GramJsInstance {
+    
+  }
+  interface storage_filePartial extends GramJsInstance {
+    
+  }
+  interface storage_fileJpeg extends GramJsInstance {
+    
+  }
+  interface storage_fileGif extends GramJsInstance {
+    
+  }
+  interface storage_filePng extends GramJsInstance {
+    
+  }
+  interface storage_filePdf extends GramJsInstance {
+    
+  }
+  interface storage_fileMp3 extends GramJsInstance {
+    
+  }
+  interface storage_fileMov extends GramJsInstance {
+    
+  }
+  interface storage_fileMp4 extends GramJsInstance {
+    
+  }
+  interface storage_fileWebp extends GramJsInstance {
+    
+  }
+  interface userEmpty extends GramJsInstance {
+    id: int;
+  }
+  interface user extends GramJsInstance {
+    // flags: null;
+    self?: true;
+    contact?: true;
+    mutualContact?: true;
+    deleted?: true;
+    bot?: true;
+    botChatHistory?: true;
+    botNochats?: true;
+    verified?: true;
+    restricted?: true;
+    min?: true;
+    botInlineGeo?: true;
+    support?: true;
+    scam?: true;
+    id: int;
+    accessHash?: long;
+    firstName?: string;
+    lastName?: string;
+    username?: string;
+    phone?: string;
+    photo?: UserProfilePhoto;
+    status?: UserStatus;
+    botInfoVersion?: int;
+    restrictionReason?: RestrictionReason[];
+    botInlinePlaceholder?: string;
+    langCode?: string;
+  }
+  interface userProfilePhotoEmpty extends GramJsInstance {
+    
+  }
+  interface userProfilePhoto extends GramJsInstance {
+    photoId: long;
+    photoSmall: FileLocation;
+    photoBig: FileLocation;
+    dcId: int;
+  }
+  interface userStatusEmpty extends GramJsInstance {
+    
+  }
+  interface userStatusOnline extends GramJsInstance {
+    expires: int;
+  }
+  interface userStatusOffline extends GramJsInstance {
+    wasOnline: int;
+  }
+  interface userStatusRecently extends GramJsInstance {
+    
+  }
+  interface userStatusLastWeek extends GramJsInstance {
+    
+  }
+  interface userStatusLastMonth extends GramJsInstance {
+    
+  }
+  interface chatEmpty extends GramJsInstance {
+    id: int;
+  }
+  interface chat extends GramJsInstance {
+    // flags: null;
+    creator?: true;
+    kicked?: true;
+    left?: true;
+    deactivated?: true;
+    id: int;
+    title: string;
+    photo: ChatPhoto;
+    participantsCount: int;
+    date: int;
+    version: int;
+    migratedTo?: InputChannel;
+    adminRights?: ChatAdminRights;
+    defaultBannedRights?: ChatBannedRights;
+  }
+  interface chatForbidden extends GramJsInstance {
+    id: int;
+    title: string;
+  }
+  interface channel extends GramJsInstance {
+    // flags: null;
+    creator?: true;
+    left?: true;
+    broadcast?: true;
+    verified?: true;
+    megagroup?: true;
+    restricted?: true;
+    signatures?: true;
+    min?: true;
+    scam?: true;
+    hasLink?: true;
+    hasGeo?: true;
+    slowmodeEnabled?: true;
+    id: int;
+    accessHash?: long;
+    title: string;
+    username?: string;
+    photo: ChatPhoto;
+    date: int;
+    version: int;
+    restrictionReason?: RestrictionReason[];
+    adminRights?: ChatAdminRights;
+    bannedRights?: ChatBannedRights;
+    defaultBannedRights?: ChatBannedRights;
+    participantsCount?: int;
+  }
+  interface channelForbidden extends GramJsInstance {
+    // flags: null;
+    broadcast?: true;
+    megagroup?: true;
+    id: int;
+    accessHash: long;
+    title: string;
+    untilDate?: int;
+  }
+  interface chatFull extends GramJsInstance {
+    // flags: null;
+    canSetUsername?: true;
+    hasScheduled?: true;
+    id: int;
+    about: string;
+    participants: ChatParticipants;
+    chatPhoto?: Photo;
+    notifySettings: PeerNotifySettings;
+    exportedInvite: ExportedChatInvite;
+    botInfo?: BotInfo[];
+    pinnedMsgId?: int;
+    folderId?: int;
+  }
+  interface channelFull extends GramJsInstance {
+    // flags: null;
+    canViewParticipants?: true;
+    canSetUsername?: true;
+    canSetStickers?: true;
+    hiddenPrehistory?: true;
+    canViewStats?: true;
+    canSetLocation?: true;
+    hasScheduled?: true;
+    id: int;
+    about: string;
+    participantsCount?: int;
+    adminsCount?: int;
+    kickedCount?: int;
+    bannedCount?: int;
+    onlineCount?: int;
+    readInboxMaxId: int;
+    readOutboxMaxId: int;
+    unreadCount: int;
+    chatPhoto: Photo;
+    notifySettings: PeerNotifySettings;
+    exportedInvite: ExportedChatInvite;
+    botInfo: BotInfo[];
+    migratedFromChatId?: int;
+    migratedFromMaxId?: int;
+    pinnedMsgId?: int;
+    stickerset?: StickerSet;
+    availableMinId?: int;
+    folderId?: int;
+    linkedChatId?: int;
+    location?: ChannelLocation;
+    slowmodeSeconds?: int;
+    slowmodeNextSendDate?: int;
+    pts: int;
+  }
+  interface chatParticipant extends GramJsInstance {
+    userId: int;
+    inviterId: int;
+    date: int;
+  }
+  interface chatParticipantCreator extends GramJsInstance {
+    userId: int;
+  }
+  interface chatParticipantAdmin extends GramJsInstance {
+    userId: int;
+    inviterId: int;
+    date: int;
+  }
+  interface chatParticipantsForbidden extends GramJsInstance {
+    // flags: null;
+    chatId: int;
+    selfParticipant?: ChatParticipant;
+  }
+  interface chatParticipants extends GramJsInstance {
+    chatId: int;
+    participants: ChatParticipant[];
+    version: int;
+  }
+  interface chatPhotoEmpty extends GramJsInstance {
+    
+  }
+  interface chatPhoto extends GramJsInstance {
+    photoSmall: FileLocation;
+    photoBig: FileLocation;
+    dcId: int;
+  }
+  interface messageEmpty extends GramJsInstance {
+    id: int;
+  }
+  interface message extends GramJsInstance {
+    // flags: null;
+    out?: true;
+    mentioned?: true;
+    mediaUnread?: true;
+    silent?: true;
+    post?: true;
+    fromScheduled?: true;
+    legacy?: true;
+    editHide?: true;
+    id: int;
+    fromId?: int;
+    toId: Peer;
+    fwdFrom?: MessageFwdHeader;
+    viaBotId?: int;
+    replyToMsgId?: int;
+    date: int;
+    message: string;
+    media?: MessageMedia;
+    replyMarkup?: ReplyMarkup;
+    entities?: MessageEntity[];
+    views?: int;
+    editDate?: int;
+    postAuthor?: string;
+    groupedId?: long;
+    restrictionReason?: RestrictionReason[];
+  }
+  interface messageService extends GramJsInstance {
+    // flags: null;
+    out?: true;
+    mentioned?: true;
+    mediaUnread?: true;
+    silent?: true;
+    post?: true;
+    legacy?: true;
+    id: int;
+    fromId?: int;
+    toId: Peer;
+    replyToMsgId?: int;
+    date: int;
+    action: MessageAction;
+  }
+  interface messageMediaEmpty extends GramJsInstance {
+    
+  }
+  interface messageMediaPhoto extends GramJsInstance {
+    // flags: null;
+    photo?: Photo;
+    ttlSeconds?: int;
+  }
+  interface messageMediaGeo extends GramJsInstance {
+    geo: GeoPoint;
+  }
+  interface messageMediaContact extends GramJsInstance {
+    phoneNumber: string;
+    firstName: string;
+    lastName: string;
+    vcard: string;
+    userId: int;
+  }
+  interface messageMediaUnsupported extends GramJsInstance {
+    
+  }
+  interface messageMediaDocument extends GramJsInstance {
+    // flags: null;
+    document?: Document;
+    ttlSeconds?: int;
+  }
+  interface messageMediaWebPage extends GramJsInstance {
+    webpage: WebPage;
+  }
+  interface messageMediaVenue extends GramJsInstance {
+    geo: GeoPoint;
+    title: string;
+    address: string;
+    provider: string;
+    venueId: string;
+    venueType: string;
+  }
+  interface messageMediaGame extends GramJsInstance {
+    game: Game;
+  }
+  interface messageMediaInvoice extends GramJsInstance {
+    // flags: null;
+    shippingAddressRequested?: true;
+    test?: true;
+    title: string;
+    description: string;
+    photo?: WebDocument;
+    receiptMsgId?: int;
+    currency: string;
+    totalAmount: long;
+    startParam: string;
+  }
+  interface messageMediaGeoLive extends GramJsInstance {
+    geo: GeoPoint;
+    period: int;
+  }
+  interface messageMediaPoll extends GramJsInstance {
+    poll: Poll;
+    results: PollResults;
+  }
+  interface messageActionEmpty extends GramJsInstance {
+    
+  }
+  interface messageActionChatCreate extends GramJsInstance {
+    title: string;
+    users: int[];
+  }
+  interface messageActionChatEditTitle extends GramJsInstance {
+    title: string;
+  }
+  interface messageActionChatEditPhoto extends GramJsInstance {
+    photo: Photo;
+  }
+  interface messageActionChatDeletePhoto extends GramJsInstance {
+    
+  }
+  interface messageActionChatAddUser extends GramJsInstance {
+    users: int[];
+  }
+  interface messageActionChatDeleteUser extends GramJsInstance {
+    userId: int;
+  }
+  interface messageActionChatJoinedByLink extends GramJsInstance {
+    inviterId: int;
+  }
+  interface messageActionChannelCreate extends GramJsInstance {
+    title: string;
+  }
+  interface messageActionChatMigrateTo extends GramJsInstance {
+    channelId: int;
+  }
+  interface messageActionChannelMigrateFrom extends GramJsInstance {
+    title: string;
+    chatId: int;
+  }
+  interface messageActionPinMessage extends GramJsInstance {
+    
+  }
+  interface messageActionHistoryClear extends GramJsInstance {
+    
+  }
+  interface messageActionGameScore extends GramJsInstance {
+    gameId: long;
+    score: int;
+  }
+  interface messageActionPaymentSentMe extends GramJsInstance {
+    // flags: null;
+    currency: string;
+    totalAmount: long;
+    payload: bytes;
+    info?: PaymentRequestedInfo;
+    shippingOptionId?: string;
+    charge: PaymentCharge;
+  }
+  interface messageActionPaymentSent extends GramJsInstance {
+    currency: string;
+    totalAmount: long;
+  }
+  interface messageActionPhoneCall extends GramJsInstance {
+    // flags: null;
+    video?: true;
+    callId: long;
+    reason?: PhoneCallDiscardReason;
+    duration?: int;
+  }
+  interface messageActionScreenshotTaken extends GramJsInstance {
+    
+  }
+  interface messageActionCustomAction extends GramJsInstance {
+    message: string;
+  }
+  interface messageActionBotAllowed extends GramJsInstance {
+    domain: string;
+  }
+  interface messageActionSecureValuesSentMe extends GramJsInstance {
+    values: SecureValue[];
+    credentials: SecureCredentialsEncrypted;
+  }
+  interface messageActionSecureValuesSent extends GramJsInstance {
+    types: SecureValueType[];
+  }
+  interface messageActionContactSignUp extends GramJsInstance {
+    
+  }
+  interface dialog extends GramJsInstance {
+    // flags: null;
+    pinned?: true;
+    unreadMark?: true;
+    peer: Peer;
+    topMessage: int;
+    readInboxMaxId: int;
+    readOutboxMaxId: int;
+    unreadCount: int;
+    unreadMentionsCount: int;
+    notifySettings: PeerNotifySettings;
+    pts?: int;
+    draft?: DraftMessage;
+    folderId?: int;
+  }
+  interface dialogFolder extends GramJsInstance {
+    // flags: null;
+    pinned?: true;
+    folder: Folder;
+    peer: Peer;
+    topMessage: int;
+    unreadMutedPeersCount: int;
+    unreadUnmutedPeersCount: int;
+    unreadMutedMessagesCount: int;
+    unreadUnmutedMessagesCount: int;
+  }
+  interface photoEmpty extends GramJsInstance {
+    id: long;
+  }
+  interface photo extends GramJsInstance {
+    // flags: null;
+    hasStickers?: true;
+    id: long;
+    accessHash: long;
+    fileReference: bytes;
+    date: int;
+    sizes: PhotoSize[];
+    dcId: int;
+  }
+  interface photoSizeEmpty extends GramJsInstance {
+    type: string;
+  }
+  interface photoSize extends GramJsInstance {
+    type: string;
+    location: FileLocation;
+    w: int;
+    h: int;
+    size: int;
+  }
+  interface photoCachedSize extends GramJsInstance {
+    type: string;
+    location: FileLocation;
+    w: int;
+    h: int;
+    bytes: bytes;
+  }
+  interface photoStrippedSize extends GramJsInstance {
+    type: string;
+    bytes: bytes;
+  }
+  interface geoPointEmpty extends GramJsInstance {
+    
+  }
+  interface geoPoint extends GramJsInstance {
+    long: double;
+    lat: double;
+    accessHash: long;
+  }
+  interface auth_sentCode extends GramJsInstance {
+    // flags: null;
+    type: auth_SentCodeType;
+    phoneCodeHash: string;
+    nextType?: auth_CodeType;
+    timeout?: int;
+  }
+  interface auth_authorization extends GramJsInstance {
+    // flags: null;
+    tmpSessions?: int;
+    user: User;
+  }
+  interface auth_authorizationSignUpRequired extends GramJsInstance {
+    // flags: null;
+    termsOfService?: help_TermsOfService;
+  }
+  interface auth_exportedAuthorization extends GramJsInstance {
+    id: int;
+    bytes: bytes;
+  }
+  interface inputNotifyPeer extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface inputNotifyUsers extends GramJsInstance {
+    
+  }
+  interface inputNotifyChats extends GramJsInstance {
+    
+  }
+  interface inputNotifyBroadcasts extends GramJsInstance {
+    
+  }
+  interface inputPeerNotifySettings extends GramJsInstance {
+    // flags: null;
+    showPreviews?: Bool;
+    silent?: Bool;
+    muteUntil?: int;
+    sound?: string;
+  }
+  interface peerNotifySettings extends GramJsInstance {
+    // flags: null;
+    showPreviews?: Bool;
+    silent?: Bool;
+    muteUntil?: int;
+    sound?: string;
+  }
+  interface peerSettings extends GramJsInstance {
+    // flags: null;
+    reportSpam?: true;
+    addContact?: true;
+    blockContact?: true;
+    shareContact?: true;
+    needContactsException?: true;
+    reportGeo?: true;
+  }
+  interface wallPaper extends GramJsInstance {
+    id: long;
+    // flags: null;
+    creator?: true;
+    default?: true;
+    pattern?: true;
+    dark?: true;
+    accessHash: long;
+    slug: string;
+    document: Document;
+    settings?: WallPaperSettings;
+  }
+  interface inputReportReasonSpam extends GramJsInstance {
+    
+  }
+  interface inputReportReasonViolence extends GramJsInstance {
+    
+  }
+  interface inputReportReasonPornography extends GramJsInstance {
+    
+  }
+  interface inputReportReasonChildAbuse extends GramJsInstance {
+    
+  }
+  interface inputReportReasonOther extends GramJsInstance {
+    text: string;
+  }
+  interface inputReportReasonCopyright extends GramJsInstance {
+    
+  }
+  interface inputReportReasonGeoIrrelevant extends GramJsInstance {
+    
+  }
+  interface userFull extends GramJsInstance {
+    // flags: null;
+    blocked?: true;
+    phoneCallsAvailable?: true;
+    phoneCallsPrivate?: true;
+    canPinMessage?: true;
+    hasScheduled?: true;
+    user: User;
+    about?: string;
+    settings: PeerSettings;
+    profilePhoto?: Photo;
+    notifySettings: PeerNotifySettings;
+    botInfo?: BotInfo;
+    pinnedMsgId?: int;
+    commonChatsCount: int;
+    folderId?: int;
+  }
+  interface contact extends GramJsInstance {
+    userId: int;
+    mutual: Bool;
+  }
+  interface importedContact extends GramJsInstance {
+    userId: int;
+    clientId: long;
+  }
+  interface contactBlocked extends GramJsInstance {
+    userId: int;
+    date: int;
+  }
+  interface contactStatus extends GramJsInstance {
+    userId: int;
+    status: UserStatus;
+  }
+  interface contacts_contactsNotModified extends GramJsInstance {
+    
+  }
+  interface contacts_contacts extends GramJsInstance {
+    contacts: Contact[];
+    savedCount: int;
+    users: User[];
+  }
+  interface contacts_importedContacts extends GramJsInstance {
+    imported: ImportedContact[];
+    popularInvites: PopularContact[];
+    retryContacts: long[];
+    users: User[];
+  }
+  interface contacts_blocked extends GramJsInstance {
+    blocked: ContactBlocked[];
+    users: User[];
+  }
+  interface contacts_blockedSlice extends GramJsInstance {
+    count: int;
+    blocked: ContactBlocked[];
+    users: User[];
+  }
+  interface messages_dialogs extends GramJsInstance {
+    dialogs: Dialog[];
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface messages_dialogsSlice extends GramJsInstance {
+    count: int;
+    dialogs: Dialog[];
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface messages_dialogsNotModified extends GramJsInstance {
+    count: int;
+  }
+  interface messages_messages extends GramJsInstance {
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface messages_messagesSlice extends GramJsInstance {
+    // flags: null;
+    inexact?: true;
+    count: int;
+    nextRate?: int;
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface messages_channelMessages extends GramJsInstance {
+    // flags: null;
+    inexact?: true;
+    pts: int;
+    count: int;
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface messages_messagesNotModified extends GramJsInstance {
+    count: int;
+  }
+  interface messages_chats extends GramJsInstance {
+    chats: Chat[];
+  }
+  interface messages_chatsSlice extends GramJsInstance {
+    count: int;
+    chats: Chat[];
+  }
+  interface messages_chatFull extends GramJsInstance {
+    fullChat: ChatFull;
+    chats: Chat[];
+    users: User[];
+  }
+  interface messages_affectedHistory extends GramJsInstance {
+    pts: int;
+    ptsCount: int;
+    offset: int;
+  }
+  interface inputMessagesFilterEmpty extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterPhotos extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterVideo extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterPhotoVideo extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterDocument extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterUrl extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterGif extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterVoice extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterMusic extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterChatPhotos extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterPhoneCalls extends GramJsInstance {
+    // flags: null;
+    missed?: true;
+  }
+  interface inputMessagesFilterRoundVoice extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterRoundVideo extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterMyMentions extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterGeo extends GramJsInstance {
+    
+  }
+  interface inputMessagesFilterContacts extends GramJsInstance {
+    
+  }
+  interface updateNewMessage extends GramJsInstance {
+    message: Message;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateMessageID extends GramJsInstance {
+    id: int;
+    randomId: long;
+  }
+  interface updateDeleteMessages extends GramJsInstance {
+    messages: int[];
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateUserTyping extends GramJsInstance {
+    userId: int;
+    action: SendMessageAction;
+  }
+  interface updateChatUserTyping extends GramJsInstance {
+    chatId: int;
+    userId: int;
+    action: SendMessageAction;
+  }
+  interface updateChatParticipants extends GramJsInstance {
+    participants: ChatParticipants;
+  }
+  interface updateUserStatus extends GramJsInstance {
+    userId: int;
+    status: UserStatus;
+  }
+  interface updateUserName extends GramJsInstance {
+    userId: int;
+    firstName: string;
+    lastName: string;
+    username: string;
+  }
+  interface updateUserPhoto extends GramJsInstance {
+    userId: int;
+    date: int;
+    photo: UserProfilePhoto;
+    previous: Bool;
+  }
+  interface updateNewEncryptedMessage extends GramJsInstance {
+    message: EncryptedMessage;
+    qts: int;
+  }
+  interface updateEncryptedChatTyping extends GramJsInstance {
+    chatId: int;
+  }
+  interface updateEncryption extends GramJsInstance {
+    chat: EncryptedChat;
+    date: int;
+  }
+  interface updateEncryptedMessagesRead extends GramJsInstance {
+    chatId: int;
+    maxDate: int;
+    date: int;
+  }
+  interface updateChatParticipantAdd extends GramJsInstance {
+    chatId: int;
+    userId: int;
+    inviterId: int;
+    date: int;
+    version: int;
+  }
+  interface updateChatParticipantDelete extends GramJsInstance {
+    chatId: int;
+    userId: int;
+    version: int;
+  }
+  interface updateDcOptions extends GramJsInstance {
+    dcOptions: DcOption[];
+  }
+  interface updateUserBlocked extends GramJsInstance {
+    userId: int;
+    blocked: Bool;
+  }
+  interface updateNotifySettings extends GramJsInstance {
+    peer: NotifyPeer;
+    notifySettings: PeerNotifySettings;
+  }
+  interface updateServiceNotification extends GramJsInstance {
+    // flags: null;
+    popup?: true;
+    inboxDate?: int;
+    type: string;
+    message: string;
+    media: MessageMedia;
+    entities: MessageEntity[];
+  }
+  interface updatePrivacy extends GramJsInstance {
+    key: PrivacyKey;
+    rules: PrivacyRule[];
+  }
+  interface updateUserPhone extends GramJsInstance {
+    userId: int;
+    phone: string;
+  }
+  interface updateReadHistoryInbox extends GramJsInstance {
+    // flags: null;
+    folderId?: int;
+    peer: Peer;
+    maxId: int;
+    stillUnreadCount: int;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateReadHistoryOutbox extends GramJsInstance {
+    peer: Peer;
+    maxId: int;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateWebPage extends GramJsInstance {
+    webpage: WebPage;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateReadMessagesContents extends GramJsInstance {
+    messages: int[];
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateChannelTooLong extends GramJsInstance {
+    // flags: null;
+    channelId: int;
+    pts?: int;
+  }
+  interface updateChannel extends GramJsInstance {
+    channelId: int;
+  }
+  interface updateNewChannelMessage extends GramJsInstance {
+    message: Message;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateReadChannelInbox extends GramJsInstance {
+    // flags: null;
+    folderId?: int;
+    channelId: int;
+    maxId: int;
+    stillUnreadCount: int;
+    pts: int;
+  }
+  interface updateDeleteChannelMessages extends GramJsInstance {
+    channelId: int;
+    messages: int[];
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateChannelMessageViews extends GramJsInstance {
+    channelId: int;
+    id: int;
+    views: int;
+  }
+  interface updateChatParticipantAdmin extends GramJsInstance {
+    chatId: int;
+    userId: int;
+    isAdmin: Bool;
+    version: int;
+  }
+  interface updateNewStickerSet extends GramJsInstance {
+    stickerset: messages_StickerSet;
+  }
+  interface updateStickerSetsOrder extends GramJsInstance {
+    // flags: null;
+    masks?: true;
+    order: long[];
+  }
+  interface updateStickerSets extends GramJsInstance {
+    
+  }
+  interface updateSavedGifs extends GramJsInstance {
+    
+  }
+  interface updateBotInlineQuery extends GramJsInstance {
+    // flags: null;
+    queryId: long;
+    userId: int;
+    query: string;
+    geo?: GeoPoint;
+    offset: string;
+  }
+  interface updateBotInlineSend extends GramJsInstance {
+    // flags: null;
+    userId: int;
+    query: string;
+    geo?: GeoPoint;
+    id: string;
+    msgId?: InputBotInlineMessageID;
+  }
+  interface updateEditChannelMessage extends GramJsInstance {
+    message: Message;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateChannelPinnedMessage extends GramJsInstance {
+    channelId: int;
+    id: int;
+  }
+  interface updateBotCallbackQuery extends GramJsInstance {
+    // flags: null;
+    queryId: long;
+    userId: int;
+    peer: Peer;
+    msgId: int;
+    chatInstance: long;
+    data?: bytes;
+    gameShortName?: string;
+  }
+  interface updateEditMessage extends GramJsInstance {
+    message: Message;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateInlineBotCallbackQuery extends GramJsInstance {
+    // flags: null;
+    queryId: long;
+    userId: int;
+    msgId: InputBotInlineMessageID;
+    chatInstance: long;
+    data?: bytes;
+    gameShortName?: string;
+  }
+  interface updateReadChannelOutbox extends GramJsInstance {
+    channelId: int;
+    maxId: int;
+  }
+  interface updateDraftMessage extends GramJsInstance {
+    peer: Peer;
+    draft: DraftMessage;
+  }
+  interface updateReadFeaturedStickers extends GramJsInstance {
+    
+  }
+  interface updateRecentStickers extends GramJsInstance {
+    
+  }
+  interface updateConfig extends GramJsInstance {
+    
+  }
+  interface updatePtsChanged extends GramJsInstance {
+    
+  }
+  interface updateChannelWebPage extends GramJsInstance {
+    channelId: int;
+    webpage: WebPage;
+    pts: int;
+    ptsCount: int;
+  }
+  interface updateDialogPinned extends GramJsInstance {
+    // flags: null;
+    pinned?: true;
+    folderId?: int;
+    peer: DialogPeer;
+  }
+  interface updatePinnedDialogs extends GramJsInstance {
+    // flags: null;
+    folderId?: int;
+    order?: DialogPeer[];
+  }
+  interface updateBotWebhookJSON extends GramJsInstance {
+    data: DataJSON;
+  }
+  interface updateBotWebhookJSONQuery extends GramJsInstance {
+    queryId: long;
+    data: DataJSON;
+    timeout: int;
+  }
+  interface updateBotShippingQuery extends GramJsInstance {
+    queryId: long;
+    userId: int;
+    payload: bytes;
+    shippingAddress: PostAddress;
+  }
+  interface updateBotPrecheckoutQuery extends GramJsInstance {
+    // flags: null;
+    queryId: long;
+    userId: int;
+    payload: bytes;
+    info?: PaymentRequestedInfo;
+    shippingOptionId?: string;
+    currency: string;
+    totalAmount: long;
+  }
+  interface updatePhoneCall extends GramJsInstance {
+    phoneCall: PhoneCall;
+  }
+  interface updateLangPackTooLong extends GramJsInstance {
+    langCode: string;
+  }
+  interface updateLangPack extends GramJsInstance {
+    difference: LangPackDifference;
+  }
+  interface updateFavedStickers extends GramJsInstance {
+    
+  }
+  interface updateChannelReadMessagesContents extends GramJsInstance {
+    channelId: int;
+    messages: int[];
+  }
+  interface updateContactsReset extends GramJsInstance {
+    
+  }
+  interface updateChannelAvailableMessages extends GramJsInstance {
+    channelId: int;
+    availableMinId: int;
+  }
+  interface updateDialogUnreadMark extends GramJsInstance {
+    // flags: null;
+    unread?: true;
+    peer: DialogPeer;
+  }
+  interface updateUserPinnedMessage extends GramJsInstance {
+    userId: int;
+    id: int;
+  }
+  interface updateChatPinnedMessage extends GramJsInstance {
+    chatId: int;
+    id: int;
+    version: int;
+  }
+  interface updateMessagePoll extends GramJsInstance {
+    // flags: null;
+    pollId: long;
+    poll?: Poll;
+    results: PollResults;
+  }
+  interface updateChatDefaultBannedRights extends GramJsInstance {
+    peer: Peer;
+    defaultBannedRights: ChatBannedRights;
+    version: int;
+  }
+  interface updateFolderPeers extends GramJsInstance {
+    folderPeers: FolderPeer[];
+    pts: int;
+    ptsCount: int;
+  }
+  interface updatePeerSettings extends GramJsInstance {
+    peer: Peer;
+    settings: PeerSettings;
+  }
+  interface updatePeerLocated extends GramJsInstance {
+    peers: PeerLocated[];
+  }
+  interface updateNewScheduledMessage extends GramJsInstance {
+    message: Message;
+  }
+  interface updateDeleteScheduledMessages extends GramJsInstance {
+    peer: Peer;
+    messages: int[];
+  }
+  interface updateTheme extends GramJsInstance {
+    theme: Theme;
+  }
+  interface updates_state extends GramJsInstance {
+    pts: int;
+    qts: int;
+    date: int;
+    seq: int;
+    unreadCount: int;
+  }
+  interface updates_differenceEmpty extends GramJsInstance {
+    date: int;
+    seq: int;
+  }
+  interface updates_difference extends GramJsInstance {
+    newMessages: Message[];
+    newEncryptedMessages: EncryptedMessage[];
+    otherUpdates: Update[];
+    chats: Chat[];
+    users: User[];
+    state: updates_State;
+  }
+  interface updates_differenceSlice extends GramJsInstance {
+    newMessages: Message[];
+    newEncryptedMessages: EncryptedMessage[];
+    otherUpdates: Update[];
+    chats: Chat[];
+    users: User[];
+    intermediateState: updates_State;
+  }
+  interface updates_differenceTooLong extends GramJsInstance {
+    pts: int;
+  }
+  interface updatesTooLong extends GramJsInstance {
+    
+  }
+  interface updateShortMessage extends GramJsInstance {
+    // flags: null;
+    out?: true;
+    mentioned?: true;
+    mediaUnread?: true;
+    silent?: true;
+    id: int;
+    userId: int;
+    message: string;
+    pts: int;
+    ptsCount: int;
+    date: int;
+    fwdFrom?: MessageFwdHeader;
+    viaBotId?: int;
+    replyToMsgId?: int;
+    entities?: MessageEntity[];
+  }
+  interface updateShortChatMessage extends GramJsInstance {
+    // flags: null;
+    out?: true;
+    mentioned?: true;
+    mediaUnread?: true;
+    silent?: true;
+    id: int;
+    fromId: int;
+    chatId: int;
+    message: string;
+    pts: int;
+    ptsCount: int;
+    date: int;
+    fwdFrom?: MessageFwdHeader;
+    viaBotId?: int;
+    replyToMsgId?: int;
+    entities?: MessageEntity[];
+  }
+  interface updateShort extends GramJsInstance {
+    update: Update;
+    date: int;
+  }
+  interface updatesCombined extends GramJsInstance {
+    updates: Update[];
+    users: User[];
+    chats: Chat[];
+    date: int;
+    seqStart: int;
+    seq: int;
+  }
+  interface updates extends GramJsInstance {
+    updates: Update[];
+    users: User[];
+    chats: Chat[];
+    date: int;
+    seq: int;
+  }
+  interface updateShortSentMessage extends GramJsInstance {
+    // flags: null;
+    out?: true;
+    id: int;
+    pts: int;
+    ptsCount: int;
+    date: int;
+    media?: MessageMedia;
+    entities?: MessageEntity[];
+  }
+  interface photos_photos extends GramJsInstance {
+    photos: Photo[];
+    users: User[];
+  }
+  interface photos_photosSlice extends GramJsInstance {
+    count: int;
+    photos: Photo[];
+    users: User[];
+  }
+  interface photos_photo extends GramJsInstance {
+    photo: Photo;
+    users: User[];
+  }
+  interface upload_file extends GramJsInstance {
+    type: storage_FileType;
+    mtime: int;
+    bytes: bytes;
+  }
+  interface upload_fileCdnRedirect extends GramJsInstance {
+    dcId: int;
+    fileToken: bytes;
+    encryptionKey: bytes;
+    encryptionIv: bytes;
+    fileHashes: FileHash[];
+  }
+  interface dcOption extends GramJsInstance {
+    // flags: null;
+    ipv6?: true;
+    mediaOnly?: true;
+    tcpoOnly?: true;
+    cdn?: true;
+    static?: true;
+    id: int;
+    ipAddress: string;
+    port: int;
+    secret?: bytes;
+  }
+  interface config extends GramJsInstance {
+    // flags: null;
+    phonecallsEnabled?: true;
+    defaultP2pContacts?: true;
+    preloadFeaturedStickers?: true;
+    ignorePhoneEntities?: true;
+    revokePmInbox?: true;
+    blockedMode?: true;
+    pfsEnabled?: true;
+    date: int;
+    expires: int;
+    testMode: Bool;
+    thisDc: int;
+    dcOptions: DcOption[];
+    dcTxtDomainName: string;
+    chatSizeMax: int;
+    megagroupSizeMax: int;
+    forwardedCountMax: int;
+    onlineUpdatePeriodMs: int;
+    offlineBlurTimeoutMs: int;
+    offlineIdleTimeoutMs: int;
+    onlineCloudTimeoutMs: int;
+    notifyCloudDelayMs: int;
+    notifyDefaultDelayMs: int;
+    pushChatPeriodMs: int;
+    pushChatLimit: int;
+    savedGifsLimit: int;
+    editTimeLimit: int;
+    revokeTimeLimit: int;
+    revokePmTimeLimit: int;
+    ratingEDecay: int;
+    stickersRecentLimit: int;
+    stickersFavedLimit: int;
+    channelsReadMediaPeriod: int;
+    tmpSessions?: int;
+    pinnedDialogsCountMax: int;
+    pinnedInfolderCountMax: int;
+    callReceiveTimeoutMs: int;
+    callRingTimeoutMs: int;
+    callConnectTimeoutMs: int;
+    callPacketTimeoutMs: int;
+    meUrlPrefix: string;
+    autoupdateUrlPrefix?: string;
+    gifSearchUsername?: string;
+    venueSearchUsername?: string;
+    imgSearchUsername?: string;
+    staticMapsProvider?: string;
+    captionLengthMax: int;
+    messageLengthMax: int;
+    webfileDcId: int;
+    suggestedLangCode?: string;
+    langPackVersion?: int;
+    baseLangPackVersion?: int;
+  }
+  interface nearestDc extends GramJsInstance {
+    country: string;
+    thisDc: int;
+    nearestDc: int;
+  }
+  interface help_appUpdate extends GramJsInstance {
+    // flags: null;
+    canNotSkip?: true;
+    id: int;
+    version: string;
+    text: string;
+    entities: MessageEntity[];
+    document?: Document;
+    url?: string;
+  }
+  interface help_noAppUpdate extends GramJsInstance {
+    
+  }
+  interface help_inviteText extends GramJsInstance {
+    message: string;
+  }
+  interface encryptedChatEmpty extends GramJsInstance {
+    id: int;
+  }
+  interface encryptedChatWaiting extends GramJsInstance {
+    id: int;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+  }
+  interface encryptedChatRequested extends GramJsInstance {
+    id: int;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+    gA: bytes;
+  }
+  interface encryptedChat extends GramJsInstance {
+    id: int;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+    gAOrB: bytes;
+    keyFingerprint: long;
+  }
+  interface encryptedChatDiscarded extends GramJsInstance {
+    id: int;
+  }
+  interface inputEncryptedChat extends GramJsInstance {
+    chatId: int;
+    accessHash: long;
+  }
+  interface encryptedFileEmpty extends GramJsInstance {
+    
+  }
+  interface encryptedFile extends GramJsInstance {
+    id: long;
+    accessHash: long;
+    size: int;
+    dcId: int;
+    keyFingerprint: int;
+  }
+  interface inputEncryptedFileEmpty extends GramJsInstance {
+    
+  }
+  interface inputEncryptedFileUploaded extends GramJsInstance {
+    id: long;
+    parts: int;
+    md5Checksum: string;
+    keyFingerprint: int;
+  }
+  interface inputEncryptedFile extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputEncryptedFileBigUploaded extends GramJsInstance {
+    id: long;
+    parts: int;
+    keyFingerprint: int;
+  }
+  interface encryptedMessage extends GramJsInstance {
+    randomId: long;
+    chatId: int;
+    date: int;
+    bytes: bytes;
+    file: EncryptedFile;
+  }
+  interface encryptedMessageService extends GramJsInstance {
+    randomId: long;
+    chatId: int;
+    date: int;
+    bytes: bytes;
+  }
+  interface messages_dhConfigNotModified extends GramJsInstance {
+    random: bytes;
+  }
+  interface messages_dhConfig extends GramJsInstance {
+    g: int;
+    p: bytes;
+    version: int;
+    random: bytes;
+  }
+  interface messages_sentEncryptedMessage extends GramJsInstance {
+    date: int;
+  }
+  interface messages_sentEncryptedFile extends GramJsInstance {
+    date: int;
+    file: EncryptedFile;
+  }
+  interface inputDocumentEmpty extends GramJsInstance {
+    
+  }
+  interface inputDocument extends GramJsInstance {
+    id: long;
+    accessHash: long;
+    fileReference: bytes;
+  }
+  interface documentEmpty extends GramJsInstance {
+    id: long;
+  }
+  interface document extends GramJsInstance {
+    // flags: null;
+    id: long;
+    accessHash: long;
+    fileReference: bytes;
+    date: int;
+    mimeType: string;
+    size: int;
+    thumbs?: PhotoSize[];
+    dcId: int;
+    attributes: DocumentAttribute[];
+  }
+  interface help_support extends GramJsInstance {
+    phoneNumber: string;
+    user: User;
+  }
+  interface notifyPeer extends GramJsInstance {
+    peer: Peer;
+  }
+  interface notifyUsers extends GramJsInstance {
+    
+  }
+  interface notifyChats extends GramJsInstance {
+    
+  }
+  interface notifyBroadcasts extends GramJsInstance {
+    
+  }
+  interface sendMessageTypingAction extends GramJsInstance {
+    
+  }
+  interface sendMessageCancelAction extends GramJsInstance {
+    
+  }
+  interface sendMessageRecordVideoAction extends GramJsInstance {
+    
+  }
+  interface sendMessageUploadVideoAction extends GramJsInstance {
+    progress: int;
+  }
+  interface sendMessageRecordAudioAction extends GramJsInstance {
+    
+  }
+  interface sendMessageUploadAudioAction extends GramJsInstance {
+    progress: int;
+  }
+  interface sendMessageUploadPhotoAction extends GramJsInstance {
+    progress: int;
+  }
+  interface sendMessageUploadDocumentAction extends GramJsInstance {
+    progress: int;
+  }
+  interface sendMessageGeoLocationAction extends GramJsInstance {
+    
+  }
+  interface sendMessageChooseContactAction extends GramJsInstance {
+    
+  }
+  interface sendMessageGamePlayAction extends GramJsInstance {
+    
+  }
+  interface sendMessageRecordRoundAction extends GramJsInstance {
+    
+  }
+  interface sendMessageUploadRoundAction extends GramJsInstance {
+    progress: int;
+  }
+  interface contacts_found extends GramJsInstance {
+    myResults: Peer[];
+    results: Peer[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface inputPrivacyKeyStatusTimestamp extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyChatInvite extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyPhoneCall extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyPhoneP2P extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyForwards extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyProfilePhoto extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyPhoneNumber extends GramJsInstance {
+    
+  }
+  interface inputPrivacyKeyAddedByPhone extends GramJsInstance {
+    
+  }
+  interface privacyKeyStatusTimestamp extends GramJsInstance {
+    
+  }
+  interface privacyKeyChatInvite extends GramJsInstance {
+    
+  }
+  interface privacyKeyPhoneCall extends GramJsInstance {
+    
+  }
+  interface privacyKeyPhoneP2P extends GramJsInstance {
+    
+  }
+  interface privacyKeyForwards extends GramJsInstance {
+    
+  }
+  interface privacyKeyProfilePhoto extends GramJsInstance {
+    
+  }
+  interface privacyKeyPhoneNumber extends GramJsInstance {
+    
+  }
+  interface privacyKeyAddedByPhone extends GramJsInstance {
+    
+  }
+  interface inputPrivacyValueAllowContacts extends GramJsInstance {
+    
+  }
+  interface inputPrivacyValueAllowAll extends GramJsInstance {
+    
+  }
+  interface inputPrivacyValueAllowUsers extends GramJsInstance {
+    users: InputUser[];
+  }
+  interface inputPrivacyValueDisallowContacts extends GramJsInstance {
+    
+  }
+  interface inputPrivacyValueDisallowAll extends GramJsInstance {
+    
+  }
+  interface inputPrivacyValueDisallowUsers extends GramJsInstance {
+    users: InputUser[];
+  }
+  interface inputPrivacyValueAllowChatParticipants extends GramJsInstance {
+    chats: int[];
+  }
+  interface inputPrivacyValueDisallowChatParticipants extends GramJsInstance {
+    chats: int[];
+  }
+  interface privacyValueAllowContacts extends GramJsInstance {
+    
+  }
+  interface privacyValueAllowAll extends GramJsInstance {
+    
+  }
+  interface privacyValueAllowUsers extends GramJsInstance {
+    users: int[];
+  }
+  interface privacyValueDisallowContacts extends GramJsInstance {
+    
+  }
+  interface privacyValueDisallowAll extends GramJsInstance {
+    
+  }
+  interface privacyValueDisallowUsers extends GramJsInstance {
+    users: int[];
+  }
+  interface privacyValueAllowChatParticipants extends GramJsInstance {
+    chats: int[];
+  }
+  interface privacyValueDisallowChatParticipants extends GramJsInstance {
+    chats: int[];
+  }
+  interface account_privacyRules extends GramJsInstance {
+    rules: PrivacyRule[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface accountDaysTTL extends GramJsInstance {
+    days: int;
+  }
+  interface documentAttributeImageSize extends GramJsInstance {
+    w: int;
+    h: int;
+  }
+  interface documentAttributeAnimated extends GramJsInstance {
+    
+  }
+  interface documentAttributeSticker extends GramJsInstance {
+    // flags: null;
+    mask?: true;
+    alt: string;
+    stickerset: InputStickerSet;
+    maskCoords?: MaskCoords;
+  }
+  interface documentAttributeVideo extends GramJsInstance {
+    // flags: null;
+    roundMessage?: true;
+    supportsStreaming?: true;
+    duration: int;
+    w: int;
+    h: int;
+  }
+  interface documentAttributeAudio extends GramJsInstance {
+    // flags: null;
+    voice?: true;
+    duration: int;
+    title?: string;
+    performer?: string;
+    waveform?: bytes;
+  }
+  interface documentAttributeFilename extends GramJsInstance {
+    fileName: string;
+  }
+  interface documentAttributeHasStickers extends GramJsInstance {
+    
+  }
+  interface messages_stickersNotModified extends GramJsInstance {
+    
+  }
+  interface messages_stickers extends GramJsInstance {
+    hash: int;
+    stickers: Document[];
+  }
+  interface stickerPack extends GramJsInstance {
+    emoticon: string;
+    documents: long[];
+  }
+  interface messages_allStickersNotModified extends GramJsInstance {
+    
+  }
+  interface messages_allStickers extends GramJsInstance {
+    hash: int;
+    sets: StickerSet[];
+  }
+  interface messages_affectedMessages extends GramJsInstance {
+    pts: int;
+    ptsCount: int;
+  }
+  interface webPageEmpty extends GramJsInstance {
+    id: long;
+  }
+  interface webPagePending extends GramJsInstance {
+    id: long;
+    date: int;
+  }
+  interface webPage extends GramJsInstance {
+    // flags: null;
+    id: long;
+    url: string;
+    displayUrl: string;
+    hash: int;
+    type?: string;
+    siteName?: string;
+    title?: string;
+    description?: string;
+    photo?: Photo;
+    embedUrl?: string;
+    embedType?: string;
+    embedWidth?: int;
+    embedHeight?: int;
+    duration?: int;
+    author?: string;
+    document?: Document;
+    documents?: Document[];
+    cachedPage?: Page;
+  }
+  interface webPageNotModified extends GramJsInstance {
+    
+  }
+  interface authorization extends GramJsInstance {
+    // flags: null;
+    current?: true;
+    officialApp?: true;
+    passwordPending?: true;
+    hash: long;
+    deviceModel: string;
+    platform: string;
+    systemVersion: string;
+    apiId: int;
+    appName: string;
+    appVersion: string;
+    dateCreated: int;
+    dateActive: int;
+    ip: string;
+    country: string;
+    region: string;
+  }
+  interface account_authorizations extends GramJsInstance {
+    authorizations: Authorization[];
+  }
+  interface account_password extends GramJsInstance {
+    // flags: null;
+    hasRecovery?: true;
+    hasSecureValues?: true;
+    hasPassword?: true;
+    currentAlgo?: PasswordKdfAlgo;
+    srp_B?: bytes;
+    srpId?: long;
+    hint?: string;
+    emailUnconfirmedPattern?: string;
+    newAlgo: PasswordKdfAlgo;
+    newSecureAlgo: SecurePasswordKdfAlgo;
+    secureRandom: bytes;
+  }
+  interface account_passwordSettings extends GramJsInstance {
+    // flags: null;
+    email?: string;
+    secureSettings?: SecureSecretSettings;
+  }
+  interface account_passwordInputSettings extends GramJsInstance {
+    // flags: null;
+    newAlgo?: PasswordKdfAlgo;
+    newPasswordHash?: bytes;
+    hint?: string;
+    email?: string;
+    newSecureSettings?: SecureSecretSettings;
+  }
+  interface auth_passwordRecovery extends GramJsInstance {
+    emailPattern: string;
+  }
+  interface receivedNotifyMessage extends GramJsInstance {
+    id: int;
+    // flags: int;
+  }
+  interface chatInviteEmpty extends GramJsInstance {
+    
+  }
+  interface chatInviteExported extends GramJsInstance {
+    link: string;
+  }
+  interface chatInviteAlready extends GramJsInstance {
+    chat: Chat;
+  }
+  interface chatInvite extends GramJsInstance {
+    // flags: null;
+    channel?: true;
+    broadcast?: true;
+    public?: true;
+    megagroup?: true;
+    title: string;
+    photo: Photo;
+    participantsCount: int;
+    participants?: User[];
+  }
+  interface inputStickerSetEmpty extends GramJsInstance {
+    
+  }
+  interface inputStickerSetID extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputStickerSetShortName extends GramJsInstance {
+    shortName: string;
+  }
+  interface inputStickerSetAnimatedEmoji extends GramJsInstance {
+    
+  }
+  interface stickerSet extends GramJsInstance {
+    // flags: null;
+    archived?: true;
+    official?: true;
+    masks?: true;
+    animated?: true;
+    installedDate?: int;
+    id: long;
+    accessHash: long;
+    title: string;
+    shortName: string;
+    thumb?: PhotoSize;
+    thumbDcId?: int;
+    count: int;
+    hash: int;
+  }
+  interface messages_stickerSet extends GramJsInstance {
+    set: StickerSet;
+    packs: StickerPack[];
+    documents: Document[];
+  }
+  interface botCommand extends GramJsInstance {
+    command: string;
+    description: string;
+  }
+  interface botInfo extends GramJsInstance {
+    userId: int;
+    description: string;
+    commands: BotCommand[];
+  }
+  interface keyboardButton extends GramJsInstance {
+    text: string;
+  }
+  interface keyboardButtonUrl extends GramJsInstance {
+    text: string;
+    url: string;
+  }
+  interface keyboardButtonCallback extends GramJsInstance {
+    text: string;
+    data: bytes;
+  }
+  interface keyboardButtonRequestPhone extends GramJsInstance {
+    text: string;
+  }
+  interface keyboardButtonRequestGeoLocation extends GramJsInstance {
+    text: string;
+  }
+  interface keyboardButtonSwitchInline extends GramJsInstance {
+    // flags: null;
+    samePeer?: true;
+    text: string;
+    query: string;
+  }
+  interface keyboardButtonGame extends GramJsInstance {
+    text: string;
+  }
+  interface keyboardButtonBuy extends GramJsInstance {
+    text: string;
+  }
+  interface keyboardButtonUrlAuth extends GramJsInstance {
+    // flags: null;
+    text: string;
+    fwdText?: string;
+    url: string;
+    buttonId: int;
+  }
+  interface inputKeyboardButtonUrlAuth extends GramJsInstance {
+    // flags: null;
+    requestWriteAccess?: true;
+    text: string;
+    fwdText?: string;
+    url: string;
+    bot: InputUser;
+  }
+  interface keyboardButtonRow extends GramJsInstance {
+    buttons: KeyboardButton[];
+  }
+  interface replyKeyboardHide extends GramJsInstance {
+    // flags: null;
+    selective?: true;
+  }
+  interface replyKeyboardForceReply extends GramJsInstance {
+    // flags: null;
+    singleUse?: true;
+    selective?: true;
+  }
+  interface replyKeyboardMarkup extends GramJsInstance {
+    // flags: null;
+    resize?: true;
+    singleUse?: true;
+    selective?: true;
+    rows: KeyboardButtonRow[];
+  }
+  interface replyInlineMarkup extends GramJsInstance {
+    rows: KeyboardButtonRow[];
+  }
+  interface messageEntityUnknown extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityMention extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityHashtag extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityBotCommand extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityUrl extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityEmail extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityBold extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityItalic extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityCode extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityPre extends GramJsInstance {
+    offset: int;
+    length: int;
+    language: string;
+  }
+  interface messageEntityTextUrl extends GramJsInstance {
+    offset: int;
+    length: int;
+    url: string;
+  }
+  interface messageEntityMentionName extends GramJsInstance {
+    offset: int;
+    length: int;
+    userId: int;
+  }
+  interface inputMessageEntityMentionName extends GramJsInstance {
+    offset: int;
+    length: int;
+    userId: InputUser;
+  }
+  interface messageEntityPhone extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityCashtag extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityUnderline extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityStrike extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface messageEntityBlockquote extends GramJsInstance {
+    offset: int;
+    length: int;
+  }
+  interface inputChannelEmpty extends GramJsInstance {
+    
+  }
+  interface inputChannel extends GramJsInstance {
+    channelId: int;
+    accessHash: long;
+  }
+  interface inputChannelFromMessage extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+    channelId: int;
+  }
+  interface contacts_resolvedPeer extends GramJsInstance {
+    peer: Peer;
+    chats: Chat[];
+    users: User[];
+  }
+  interface messageRange extends GramJsInstance {
+    minId: int;
+    maxId: int;
+  }
+  interface updates_channelDifferenceEmpty extends GramJsInstance {
+    // flags: null;
+    final?: true;
+    pts: int;
+    timeout?: int;
+  }
+  interface updates_channelDifferenceTooLong extends GramJsInstance {
+    // flags: null;
+    final?: true;
+    timeout?: int;
+    dialog: Dialog;
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface updates_channelDifference extends GramJsInstance {
+    // flags: null;
+    final?: true;
+    pts: int;
+    timeout?: int;
+    newMessages: Message[];
+    otherUpdates: Update[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface channelMessagesFilterEmpty extends GramJsInstance {
+    
+  }
+  interface channelMessagesFilter extends GramJsInstance {
+    // flags: null;
+    excludeNewMessages?: true;
+    ranges: MessageRange[];
+  }
+  interface channelParticipant extends GramJsInstance {
+    userId: int;
+    date: int;
+  }
+  interface channelParticipantSelf extends GramJsInstance {
+    userId: int;
+    inviterId: int;
+    date: int;
+  }
+  interface channelParticipantCreator extends GramJsInstance {
+    // flags: null;
+    userId: int;
+    rank?: string;
+  }
+  interface channelParticipantAdmin extends GramJsInstance {
+    // flags: null;
+    canEdit?: true;
+    self?: true;
+    userId: int;
+    inviterId?: int;
+    promotedBy: int;
+    date: int;
+    adminRights: ChatAdminRights;
+    rank?: string;
+  }
+  interface channelParticipantBanned extends GramJsInstance {
+    // flags: null;
+    left?: true;
+    userId: int;
+    kickedBy: int;
+    date: int;
+    bannedRights: ChatBannedRights;
+  }
+  interface channelParticipantsRecent extends GramJsInstance {
+    
+  }
+  interface channelParticipantsAdmins extends GramJsInstance {
+    
+  }
+  interface channelParticipantsKicked extends GramJsInstance {
+    q: string;
+  }
+  interface channelParticipantsBots extends GramJsInstance {
+    
+  }
+  interface channelParticipantsBanned extends GramJsInstance {
+    q: string;
+  }
+  interface channelParticipantsSearch extends GramJsInstance {
+    q: string;
+  }
+  interface channelParticipantsContacts extends GramJsInstance {
+    q: string;
+  }
+  interface channels_channelParticipants extends GramJsInstance {
+    count: int;
+    participants: ChannelParticipant[];
+    users: User[];
+  }
+  interface channels_channelParticipantsNotModified extends GramJsInstance {
+    
+  }
+  interface channels_channelParticipant extends GramJsInstance {
+    participant: ChannelParticipant;
+    users: User[];
+  }
+  interface help_termsOfService extends GramJsInstance {
+    // flags: null;
+    popup?: true;
+    id: DataJSON;
+    text: string;
+    entities: MessageEntity[];
+    minAgeConfirm?: int;
+  }
+  interface foundGif extends GramJsInstance {
+    url: string;
+    thumbUrl: string;
+    contentUrl: string;
+    contentType: string;
+    w: int;
+    h: int;
+  }
+  interface foundGifCached extends GramJsInstance {
+    url: string;
+    photo: Photo;
+    document: Document;
+  }
+  interface messages_foundGifs extends GramJsInstance {
+    nextOffset: int;
+    results: FoundGif[];
+  }
+  interface messages_savedGifsNotModified extends GramJsInstance {
+    
+  }
+  interface messages_savedGifs extends GramJsInstance {
+    hash: int;
+    gifs: Document[];
+  }
+  interface inputBotInlineMessageMediaAuto extends GramJsInstance {
+    // flags: null;
+    message: string;
+    entities?: MessageEntity[];
+    replyMarkup?: ReplyMarkup;
+  }
+  interface inputBotInlineMessageText extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    message: string;
+    entities?: MessageEntity[];
+    replyMarkup?: ReplyMarkup;
+  }
+  interface inputBotInlineMessageMediaGeo extends GramJsInstance {
+    // flags: null;
+    geoPoint: InputGeoPoint;
+    period: int;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface inputBotInlineMessageMediaVenue extends GramJsInstance {
+    // flags: null;
+    geoPoint: InputGeoPoint;
+    title: string;
+    address: string;
+    provider: string;
+    venueId: string;
+    venueType: string;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface inputBotInlineMessageMediaContact extends GramJsInstance {
+    // flags: null;
+    phoneNumber: string;
+    firstName: string;
+    lastName: string;
+    vcard: string;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface inputBotInlineMessageGame extends GramJsInstance {
+    // flags: null;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface inputBotInlineResult extends GramJsInstance {
+    // flags: null;
+    id: string;
+    type: string;
+    title?: string;
+    description?: string;
+    url?: string;
+    thumb?: InputWebDocument;
+    content?: InputWebDocument;
+    sendMessage: InputBotInlineMessage;
+  }
+  interface inputBotInlineResultPhoto extends GramJsInstance {
+    id: string;
+    type: string;
+    photo: InputPhoto;
+    sendMessage: InputBotInlineMessage;
+  }
+  interface inputBotInlineResultDocument extends GramJsInstance {
+    // flags: null;
+    id: string;
+    type: string;
+    title?: string;
+    description?: string;
+    document: InputDocument;
+    sendMessage: InputBotInlineMessage;
+  }
+  interface inputBotInlineResultGame extends GramJsInstance {
+    id: string;
+    shortName: string;
+    sendMessage: InputBotInlineMessage;
+  }
+  interface botInlineMessageMediaAuto extends GramJsInstance {
+    // flags: null;
+    message: string;
+    entities?: MessageEntity[];
+    replyMarkup?: ReplyMarkup;
+  }
+  interface botInlineMessageText extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    message: string;
+    entities?: MessageEntity[];
+    replyMarkup?: ReplyMarkup;
+  }
+  interface botInlineMessageMediaGeo extends GramJsInstance {
+    // flags: null;
+    geo: GeoPoint;
+    period: int;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface botInlineMessageMediaVenue extends GramJsInstance {
+    // flags: null;
+    geo: GeoPoint;
+    title: string;
+    address: string;
+    provider: string;
+    venueId: string;
+    venueType: string;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface botInlineMessageMediaContact extends GramJsInstance {
+    // flags: null;
+    phoneNumber: string;
+    firstName: string;
+    lastName: string;
+    vcard: string;
+    replyMarkup?: ReplyMarkup;
+  }
+  interface botInlineResult extends GramJsInstance {
+    // flags: null;
+    id: string;
+    type: string;
+    title?: string;
+    description?: string;
+    url?: string;
+    thumb?: WebDocument;
+    content?: WebDocument;
+    sendMessage: BotInlineMessage;
+  }
+  interface botInlineMediaResult extends GramJsInstance {
+    // flags: null;
+    id: string;
+    type: string;
+    photo?: Photo;
+    document?: Document;
+    title?: string;
+    description?: string;
+    sendMessage: BotInlineMessage;
+  }
+  interface messages_botResults extends GramJsInstance {
+    // flags: null;
+    gallery?: true;
+    queryId: long;
+    nextOffset?: string;
+    switchPm?: InlineBotSwitchPM;
+    results: BotInlineResult[];
+    cacheTime: int;
+    users: User[];
+  }
+  interface exportedMessageLink extends GramJsInstance {
+    link: string;
+    html: string;
+  }
+  interface messageFwdHeader extends GramJsInstance {
+    // flags: null;
+    fromId?: int;
+    fromName?: string;
+    date: int;
+    channelId?: int;
+    channelPost?: int;
+    postAuthor?: string;
+    savedFromPeer?: Peer;
+    savedFromMsgId?: int;
+  }
+  interface auth_codeTypeSms extends GramJsInstance {
+    
+  }
+  interface auth_codeTypeCall extends GramJsInstance {
+    
+  }
+  interface auth_codeTypeFlashCall extends GramJsInstance {
+    
+  }
+  interface auth_sentCodeTypeApp extends GramJsInstance {
+    length: int;
+  }
+  interface auth_sentCodeTypeSms extends GramJsInstance {
+    length: int;
+  }
+  interface auth_sentCodeTypeCall extends GramJsInstance {
+    length: int;
+  }
+  interface auth_sentCodeTypeFlashCall extends GramJsInstance {
+    pattern: string;
+  }
+  interface messages_botCallbackAnswer extends GramJsInstance {
+    // flags: null;
+    alert?: true;
+    hasUrl?: true;
+    nativeUi?: true;
+    message?: string;
+    url?: string;
+    cacheTime: int;
+  }
+  interface messages_messageEditData extends GramJsInstance {
+    // flags: null;
+    caption?: true;
+  }
+  interface inputBotInlineMessageID extends GramJsInstance {
+    dcId: int;
+    id: long;
+    accessHash: long;
+  }
+  interface inlineBotSwitchPM extends GramJsInstance {
+    text: string;
+    startParam: string;
+  }
+  interface messages_peerDialogs extends GramJsInstance {
+    dialogs: Dialog[];
+    messages: Message[];
+    chats: Chat[];
+    users: User[];
+    state: updates_State;
+  }
+  interface topPeer extends GramJsInstance {
+    peer: Peer;
+    rating: double;
+  }
+  interface topPeerCategoryBotsPM extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryBotsInline extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryCorrespondents extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryGroups extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryChannels extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryPhoneCalls extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryForwardUsers extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryForwardChats extends GramJsInstance {
+    
+  }
+  interface topPeerCategoryPeers extends GramJsInstance {
+    category: TopPeerCategory;
+    count: int;
+    peers: TopPeer[];
+  }
+  interface contacts_topPeersNotModified extends GramJsInstance {
+    
+  }
+  interface contacts_topPeers extends GramJsInstance {
+    categories: TopPeerCategoryPeers[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface contacts_topPeersDisabled extends GramJsInstance {
+    
+  }
+  interface draftMessageEmpty extends GramJsInstance {
+    // flags: null;
+    date?: int;
+  }
+  interface draftMessage extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    replyToMsgId?: int;
+    message: string;
+    entities?: MessageEntity[];
+    date: int;
+  }
+  interface messages_featuredStickersNotModified extends GramJsInstance {
+    
+  }
+  interface messages_featuredStickers extends GramJsInstance {
+    hash: int;
+    sets: StickerSetCovered[];
+    unread: long[];
+  }
+  interface messages_recentStickersNotModified extends GramJsInstance {
+    
+  }
+  interface messages_recentStickers extends GramJsInstance {
+    hash: int;
+    packs: StickerPack[];
+    stickers: Document[];
+    dates: int[];
+  }
+  interface messages_archivedStickers extends GramJsInstance {
+    count: int;
+    sets: StickerSetCovered[];
+  }
+  interface messages_stickerSetInstallResultSuccess extends GramJsInstance {
+    
+  }
+  interface messages_stickerSetInstallResultArchive extends GramJsInstance {
+    sets: StickerSetCovered[];
+  }
+  interface stickerSetCovered extends GramJsInstance {
+    set: StickerSet;
+    cover: Document;
+  }
+  interface stickerSetMultiCovered extends GramJsInstance {
+    set: StickerSet;
+    covers: Document[];
+  }
+  interface maskCoords extends GramJsInstance {
+    n: int;
+    x: double;
+    y: double;
+    zoom: double;
+  }
+  interface inputStickeredMediaPhoto extends GramJsInstance {
+    id: InputPhoto;
+  }
+  interface inputStickeredMediaDocument extends GramJsInstance {
+    id: InputDocument;
+  }
+  interface game extends GramJsInstance {
+    // flags: null;
+    id: long;
+    accessHash: long;
+    shortName: string;
+    title: string;
+    description: string;
+    photo: Photo;
+    document?: Document;
+  }
+  interface inputGameID extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputGameShortName extends GramJsInstance {
+    botId: InputUser;
+    shortName: string;
+  }
+  interface highScore extends GramJsInstance {
+    pos: int;
+    userId: int;
+    score: int;
+  }
+  interface messages_highScores extends GramJsInstance {
+    scores: HighScore[];
+    users: User[];
+  }
+  interface textEmpty extends GramJsInstance {
+    
+  }
+  interface textPlain extends GramJsInstance {
+    text: string;
+  }
+  interface textBold extends GramJsInstance {
+    text: RichText;
+  }
+  interface textItalic extends GramJsInstance {
+    text: RichText;
+  }
+  interface textUnderline extends GramJsInstance {
+    text: RichText;
+  }
+  interface textStrike extends GramJsInstance {
+    text: RichText;
+  }
+  interface textFixed extends GramJsInstance {
+    text: RichText;
+  }
+  interface textUrl extends GramJsInstance {
+    text: RichText;
+    url: string;
+    webpageId: long;
+  }
+  interface textEmail extends GramJsInstance {
+    text: RichText;
+    email: string;
+  }
+  interface textConcat extends GramJsInstance {
+    texts: RichText[];
+  }
+  interface textSubscript extends GramJsInstance {
+    text: RichText;
+  }
+  interface textSuperscript extends GramJsInstance {
+    text: RichText;
+  }
+  interface textMarked extends GramJsInstance {
+    text: RichText;
+  }
+  interface textPhone extends GramJsInstance {
+    text: RichText;
+    phone: string;
+  }
+  interface textImage extends GramJsInstance {
+    documentId: long;
+    w: int;
+    h: int;
+  }
+  interface textAnchor extends GramJsInstance {
+    text: RichText;
+    name: string;
+  }
+  interface pageBlockUnsupported extends GramJsInstance {
+    
+  }
+  interface pageBlockTitle extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockSubtitle extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockAuthorDate extends GramJsInstance {
+    author: RichText;
+    publishedDate: int;
+  }
+  interface pageBlockHeader extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockSubheader extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockParagraph extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockPreformatted extends GramJsInstance {
+    text: RichText;
+    language: string;
+  }
+  interface pageBlockFooter extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockDivider extends GramJsInstance {
+    
+  }
+  interface pageBlockAnchor extends GramJsInstance {
+    name: string;
+  }
+  interface pageBlockList extends GramJsInstance {
+    items: PageListItem[];
+  }
+  interface pageBlockBlockquote extends GramJsInstance {
+    text: RichText;
+    caption: RichText;
+  }
+  interface pageBlockPullquote extends GramJsInstance {
+    text: RichText;
+    caption: RichText;
+  }
+  interface pageBlockPhoto extends GramJsInstance {
+    // flags: null;
+    photoId: long;
+    caption: PageCaption;
+    url?: string;
+    webpageId?: long;
+  }
+  interface pageBlockVideo extends GramJsInstance {
+    // flags: null;
+    autoplay?: true;
+    loop?: true;
+    videoId: long;
+    caption: PageCaption;
+  }
+  interface pageBlockCover extends GramJsInstance {
+    cover: PageBlock;
+  }
+  interface pageBlockEmbed extends GramJsInstance {
+    // flags: null;
+    fullWidth?: true;
+    allowScrolling?: true;
+    url?: string;
+    html?: string;
+    posterPhotoId?: long;
+    w?: int;
+    h?: int;
+    caption: PageCaption;
+  }
+  interface pageBlockEmbedPost extends GramJsInstance {
+    url: string;
+    webpageId: long;
+    authorPhotoId: long;
+    author: string;
+    date: int;
+    blocks: PageBlock[];
+    caption: PageCaption;
+  }
+  interface pageBlockCollage extends GramJsInstance {
+    items: PageBlock[];
+    caption: PageCaption;
+  }
+  interface pageBlockSlideshow extends GramJsInstance {
+    items: PageBlock[];
+    caption: PageCaption;
+  }
+  interface pageBlockChannel extends GramJsInstance {
+    channel: Chat;
+  }
+  interface pageBlockAudio extends GramJsInstance {
+    audioId: long;
+    caption: PageCaption;
+  }
+  interface pageBlockKicker extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageBlockTable extends GramJsInstance {
+    // flags: null;
+    bordered?: true;
+    striped?: true;
+    title: RichText;
+    rows: PageTableRow[];
+  }
+  interface pageBlockOrderedList extends GramJsInstance {
+    items: PageListOrderedItem[];
+  }
+  interface pageBlockDetails extends GramJsInstance {
+    // flags: null;
+    open?: true;
+    blocks: PageBlock[];
+    title: RichText;
+  }
+  interface pageBlockRelatedArticles extends GramJsInstance {
+    title: RichText;
+    articles: PageRelatedArticle[];
+  }
+  interface pageBlockMap extends GramJsInstance {
+    geo: GeoPoint;
+    zoom: int;
+    w: int;
+    h: int;
+    caption: PageCaption;
+  }
+  interface phoneCallDiscardReasonMissed extends GramJsInstance {
+    
+  }
+  interface phoneCallDiscardReasonDisconnect extends GramJsInstance {
+    
+  }
+  interface phoneCallDiscardReasonHangup extends GramJsInstance {
+    
+  }
+  interface phoneCallDiscardReasonBusy extends GramJsInstance {
+    
+  }
+  interface dataJSON extends GramJsInstance {
+    data: string;
+  }
+  interface labeledPrice extends GramJsInstance {
+    label: string;
+    amount: long;
+  }
+  interface invoice extends GramJsInstance {
+    // flags: null;
+    test?: true;
+    nameRequested?: true;
+    phoneRequested?: true;
+    emailRequested?: true;
+    shippingAddressRequested?: true;
+    flexible?: true;
+    phoneToProvider?: true;
+    emailToProvider?: true;
+    currency: string;
+    prices: LabeledPrice[];
+  }
+  interface paymentCharge extends GramJsInstance {
+    id: string;
+    providerChargeId: string;
+  }
+  interface postAddress extends GramJsInstance {
+    streetLine1: string;
+    streetLine2: string;
+    city: string;
+    state: string;
+    countryIso2: string;
+    postCode: string;
+  }
+  interface paymentRequestedInfo extends GramJsInstance {
+    // flags: null;
+    name?: string;
+    phone?: string;
+    email?: string;
+    shippingAddress?: PostAddress;
+  }
+  interface paymentSavedCredentialsCard extends GramJsInstance {
+    id: string;
+    title: string;
+  }
+  interface webDocument extends GramJsInstance {
+    url: string;
+    accessHash: long;
+    size: int;
+    mimeType: string;
+    attributes: DocumentAttribute[];
+  }
+  interface webDocumentNoProxy extends GramJsInstance {
+    url: string;
+    size: int;
+    mimeType: string;
+    attributes: DocumentAttribute[];
+  }
+  interface inputWebDocument extends GramJsInstance {
+    url: string;
+    size: int;
+    mimeType: string;
+    attributes: DocumentAttribute[];
+  }
+  interface inputWebFileLocation extends GramJsInstance {
+    url: string;
+    accessHash: long;
+  }
+  interface inputWebFileGeoPointLocation extends GramJsInstance {
+    geoPoint: InputGeoPoint;
+    accessHash: long;
+    w: int;
+    h: int;
+    zoom: int;
+    scale: int;
+  }
+  interface upload_webFile extends GramJsInstance {
+    size: int;
+    mimeType: string;
+    fileType: storage_FileType;
+    mtime: int;
+    bytes: bytes;
+  }
+  interface payments_paymentForm extends GramJsInstance {
+    // flags: null;
+    canSaveCredentials?: true;
+    passwordMissing?: true;
+    botId: int;
+    invoice: Invoice;
+    providerId: int;
+    url: string;
+    nativeProvider?: string;
+    nativeParams?: DataJSON;
+    savedInfo?: PaymentRequestedInfo;
+    savedCredentials?: PaymentSavedCredentials;
+    users: User[];
+  }
+  interface payments_validatedRequestedInfo extends GramJsInstance {
+    // flags: null;
+    id?: string;
+    shippingOptions?: ShippingOption[];
+  }
+  interface payments_paymentResult extends GramJsInstance {
+    updates: Updates;
+  }
+  interface payments_paymentVerificationNeeded extends GramJsInstance {
+    url: string;
+  }
+  interface payments_paymentReceipt extends GramJsInstance {
+    // flags: null;
+    date: int;
+    botId: int;
+    invoice: Invoice;
+    providerId: int;
+    info?: PaymentRequestedInfo;
+    shipping?: ShippingOption;
+    currency: string;
+    totalAmount: long;
+    credentialsTitle: string;
+    users: User[];
+  }
+  interface payments_savedInfo extends GramJsInstance {
+    // flags: null;
+    hasSavedCredentials?: true;
+    savedInfo?: PaymentRequestedInfo;
+  }
+  interface inputPaymentCredentialsSaved extends GramJsInstance {
+    id: string;
+    tmpPassword: bytes;
+  }
+  interface inputPaymentCredentials extends GramJsInstance {
+    // flags: null;
+    save?: true;
+    data: DataJSON;
+  }
+  interface inputPaymentCredentialsApplePay extends GramJsInstance {
+    paymentData: DataJSON;
+  }
+  interface inputPaymentCredentialsAndroidPay extends GramJsInstance {
+    paymentToken: DataJSON;
+    googleTransactionId: string;
+  }
+  interface account_tmpPassword extends GramJsInstance {
+    tmpPassword: bytes;
+    validUntil: int;
+  }
+  interface shippingOption extends GramJsInstance {
+    id: string;
+    title: string;
+    prices: LabeledPrice[];
+  }
+  interface inputStickerSetItem extends GramJsInstance {
+    // flags: null;
+    document: InputDocument;
+    emoji: string;
+    maskCoords?: MaskCoords;
+  }
+  interface inputPhoneCall extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface phoneCallEmpty extends GramJsInstance {
+    id: long;
+  }
+  interface phoneCallWaiting extends GramJsInstance {
+    // flags: null;
+    video?: true;
+    id: long;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+    protocol: PhoneCallProtocol;
+    receiveDate?: int;
+  }
+  interface phoneCallRequested extends GramJsInstance {
+    // flags: null;
+    video?: true;
+    id: long;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+    gAHash: bytes;
+    protocol: PhoneCallProtocol;
+  }
+  interface phoneCallAccepted extends GramJsInstance {
+    // flags: null;
+    video?: true;
+    id: long;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+    gB: bytes;
+    protocol: PhoneCallProtocol;
+  }
+  interface phoneCall extends GramJsInstance {
+    // flags: null;
+    p2pAllowed?: true;
+    id: long;
+    accessHash: long;
+    date: int;
+    adminId: int;
+    participantId: int;
+    gAOrB: bytes;
+    keyFingerprint: long;
+    protocol: PhoneCallProtocol;
+    connections: PhoneConnection[];
+    startDate: int;
+  }
+  interface phoneCallDiscarded extends GramJsInstance {
+    // flags: null;
+    needRating?: true;
+    needDebug?: true;
+    video?: true;
+    id: long;
+    reason?: PhoneCallDiscardReason;
+    duration?: int;
+  }
+  interface phoneConnection extends GramJsInstance {
+    id: long;
+    ip: string;
+    ipv6: string;
+    port: int;
+    peerTag: bytes;
+  }
+  interface phoneCallProtocol extends GramJsInstance {
+    // flags: null;
+    udpP2p?: true;
+    udpReflector?: true;
+    minLayer: int;
+    maxLayer: int;
+  }
+  interface phone_phoneCall extends GramJsInstance {
+    phoneCall: PhoneCall;
+    users: User[];
+  }
+  interface upload_cdnFileReuploadNeeded extends GramJsInstance {
+    requestToken: bytes;
+  }
+  interface upload_cdnFile extends GramJsInstance {
+    bytes: bytes;
+  }
+  interface cdnPublicKey extends GramJsInstance {
+    dcId: int;
+    publicKey: string;
+  }
+  interface cdnConfig extends GramJsInstance {
+    publicKeys: CdnPublicKey[];
+  }
+  interface langPackString extends GramJsInstance {
+    key: string;
+    value: string;
+  }
+  interface langPackStringPluralized extends GramJsInstance {
+    // flags: null;
+    key: string;
+    zeroValue?: string;
+    oneValue?: string;
+    twoValue?: string;
+    fewValue?: string;
+    manyValue?: string;
+    otherValue: string;
+  }
+  interface langPackStringDeleted extends GramJsInstance {
+    key: string;
+  }
+  interface langPackDifference extends GramJsInstance {
+    langCode: string;
+    fromVersion: int;
+    version: int;
+    strings: LangPackString[];
+  }
+  interface langPackLanguage extends GramJsInstance {
+    // flags: null;
+    official?: true;
+    rtl?: true;
+    beta?: true;
+    name: string;
+    nativeName: string;
+    langCode: string;
+    baseLangCode?: string;
+    pluralCode: string;
+    stringsCount: int;
+    translatedCount: int;
+    translationsUrl: string;
+  }
+  interface channelAdminLogEventActionChangeTitle extends GramJsInstance {
+    prevValue: string;
+    newValue: string;
+  }
+  interface channelAdminLogEventActionChangeAbout extends GramJsInstance {
+    prevValue: string;
+    newValue: string;
+  }
+  interface channelAdminLogEventActionChangeUsername extends GramJsInstance {
+    prevValue: string;
+    newValue: string;
+  }
+  interface channelAdminLogEventActionChangePhoto extends GramJsInstance {
+    prevPhoto: Photo;
+    newPhoto: Photo;
+  }
+  interface channelAdminLogEventActionToggleInvites extends GramJsInstance {
+    newValue: Bool;
+  }
+  interface channelAdminLogEventActionToggleSignatures extends GramJsInstance {
+    newValue: Bool;
+  }
+  interface channelAdminLogEventActionUpdatePinned extends GramJsInstance {
+    message: Message;
+  }
+  interface channelAdminLogEventActionEditMessage extends GramJsInstance {
+    prevMessage: Message;
+    newMessage: Message;
+  }
+  interface channelAdminLogEventActionDeleteMessage extends GramJsInstance {
+    message: Message;
+  }
+  interface channelAdminLogEventActionParticipantJoin extends GramJsInstance {
+    
+  }
+  interface channelAdminLogEventActionParticipantLeave extends GramJsInstance {
+    
+  }
+  interface channelAdminLogEventActionParticipantInvite extends GramJsInstance {
+    participant: ChannelParticipant;
+  }
+  interface channelAdminLogEventActionParticipantToggleBan extends GramJsInstance {
+    prevParticipant: ChannelParticipant;
+    newParticipant: ChannelParticipant;
+  }
+  interface channelAdminLogEventActionParticipantToggleAdmin extends GramJsInstance {
+    prevParticipant: ChannelParticipant;
+    newParticipant: ChannelParticipant;
+  }
+  interface channelAdminLogEventActionChangeStickerSet extends GramJsInstance {
+    prevStickerset: InputStickerSet;
+    newStickerset: InputStickerSet;
+  }
+  interface channelAdminLogEventActionTogglePreHistoryHidden extends GramJsInstance {
+    newValue: Bool;
+  }
+  interface channelAdminLogEventActionDefaultBannedRights extends GramJsInstance {
+    prevBannedRights: ChatBannedRights;
+    newBannedRights: ChatBannedRights;
+  }
+  interface channelAdminLogEventActionStopPoll extends GramJsInstance {
+    message: Message;
+  }
+  interface channelAdminLogEventActionChangeLinkedChat extends GramJsInstance {
+    prevValue: int;
+    newValue: int;
+  }
+  interface channelAdminLogEventActionChangeLocation extends GramJsInstance {
+    prevValue: ChannelLocation;
+    newValue: ChannelLocation;
+  }
+  interface channelAdminLogEventActionToggleSlowMode extends GramJsInstance {
+    prevValue: int;
+    newValue: int;
+  }
+  interface channelAdminLogEvent extends GramJsInstance {
+    id: long;
+    date: int;
+    userId: int;
+    action: ChannelAdminLogEventAction;
+  }
+  interface channels_adminLogResults extends GramJsInstance {
+    events: ChannelAdminLogEvent[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface channelAdminLogEventsFilter extends GramJsInstance {
+    // flags: null;
+    join?: true;
+    leave?: true;
+    invite?: true;
+    ban?: true;
+    unban?: true;
+    kick?: true;
+    unkick?: true;
+    promote?: true;
+    demote?: true;
+    info?: true;
+    settings?: true;
+    pinned?: true;
+    edit?: true;
+    delete?: true;
+  }
+  interface popularContact extends GramJsInstance {
+    clientId: long;
+    importers: int;
+  }
+  interface messages_favedStickersNotModified extends GramJsInstance {
+    
+  }
+  interface messages_favedStickers extends GramJsInstance {
+    hash: int;
+    packs: StickerPack[];
+    stickers: Document[];
+  }
+  interface recentMeUrlUnknown extends GramJsInstance {
+    url: string;
+  }
+  interface recentMeUrlUser extends GramJsInstance {
+    url: string;
+    userId: int;
+  }
+  interface recentMeUrlChat extends GramJsInstance {
+    url: string;
+    chatId: int;
+  }
+  interface recentMeUrlChatInvite extends GramJsInstance {
+    url: string;
+    chatInvite: ChatInvite;
+  }
+  interface recentMeUrlStickerSet extends GramJsInstance {
+    url: string;
+    set: StickerSetCovered;
+  }
+  interface help_recentMeUrls extends GramJsInstance {
+    urls: RecentMeUrl[];
+    chats: Chat[];
+    users: User[];
+  }
+  interface inputSingleMedia extends GramJsInstance {
+    // flags: null;
+    media: InputMedia;
+    randomId: long;
+    message: string;
+    entities?: MessageEntity[];
+  }
+  interface webAuthorization extends GramJsInstance {
+    hash: long;
+    botId: int;
+    domain: string;
+    browser: string;
+    platform: string;
+    dateCreated: int;
+    dateActive: int;
+    ip: string;
+    region: string;
+  }
+  interface account_webAuthorizations extends GramJsInstance {
+    authorizations: WebAuthorization[];
+    users: User[];
+  }
+  interface inputMessageID extends GramJsInstance {
+    id: int;
+  }
+  interface inputMessageReplyTo extends GramJsInstance {
+    id: int;
+  }
+  interface inputMessagePinned extends GramJsInstance {
+    
+  }
+  interface inputDialogPeer extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface inputDialogPeerFolder extends GramJsInstance {
+    folderId: int;
+  }
+  interface dialogPeer extends GramJsInstance {
+    peer: Peer;
+  }
+  interface dialogPeerFolder extends GramJsInstance {
+    folderId: int;
+  }
+  interface messages_foundStickerSetsNotModified extends GramJsInstance {
+    
+  }
+  interface messages_foundStickerSets extends GramJsInstance {
+    hash: int;
+    sets: StickerSetCovered[];
+  }
+  interface fileHash extends GramJsInstance {
+    offset: int;
+    limit: int;
+    hash: bytes;
+  }
+  interface inputClientProxy extends GramJsInstance {
+    address: string;
+    port: int;
+  }
+  interface help_proxyDataEmpty extends GramJsInstance {
+    expires: int;
+  }
+  interface help_proxyDataPromo extends GramJsInstance {
+    expires: int;
+    peer: Peer;
+    chats: Chat[];
+    users: User[];
+  }
+  interface help_termsOfServiceUpdateEmpty extends GramJsInstance {
+    expires: int;
+  }
+  interface help_termsOfServiceUpdate extends GramJsInstance {
+    expires: int;
+    termsOfService: help_TermsOfService;
+  }
+  interface inputSecureFileUploaded extends GramJsInstance {
+    id: long;
+    parts: int;
+    md5Checksum: string;
+    fileHash: bytes;
+    secret: bytes;
+  }
+  interface inputSecureFile extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface secureFileEmpty extends GramJsInstance {
+    
+  }
+  interface secureFile extends GramJsInstance {
+    id: long;
+    accessHash: long;
+    size: int;
+    dcId: int;
+    date: int;
+    fileHash: bytes;
+    secret: bytes;
+  }
+  interface secureData extends GramJsInstance {
+    data: bytes;
+    dataHash: bytes;
+    secret: bytes;
+  }
+  interface securePlainPhone extends GramJsInstance {
+    phone: string;
+  }
+  interface securePlainEmail extends GramJsInstance {
+    email: string;
+  }
+  interface secureValueTypePersonalDetails extends GramJsInstance {
+    
+  }
+  interface secureValueTypePassport extends GramJsInstance {
+    
+  }
+  interface secureValueTypeDriverLicense extends GramJsInstance {
+    
+  }
+  interface secureValueTypeIdentityCard extends GramJsInstance {
+    
+  }
+  interface secureValueTypeInternalPassport extends GramJsInstance {
+    
+  }
+  interface secureValueTypeAddress extends GramJsInstance {
+    
+  }
+  interface secureValueTypeUtilityBill extends GramJsInstance {
+    
+  }
+  interface secureValueTypeBankStatement extends GramJsInstance {
+    
+  }
+  interface secureValueTypeRentalAgreement extends GramJsInstance {
+    
+  }
+  interface secureValueTypePassportRegistration extends GramJsInstance {
+    
+  }
+  interface secureValueTypeTemporaryRegistration extends GramJsInstance {
+    
+  }
+  interface secureValueTypePhone extends GramJsInstance {
+    
+  }
+  interface secureValueTypeEmail extends GramJsInstance {
+    
+  }
+  interface secureValue extends GramJsInstance {
+    // flags: null;
+    type: SecureValueType;
+    data?: SecureData;
+    frontSide?: SecureFile;
+    reverseSide?: SecureFile;
+    selfie?: SecureFile;
+    translation?: SecureFile[];
+    files?: SecureFile[];
+    plainData?: SecurePlainData;
+    hash: bytes;
+  }
+  interface inputSecureValue extends GramJsInstance {
+    // flags: null;
+    type: SecureValueType;
+    data?: SecureData;
+    frontSide?: InputSecureFile;
+    reverseSide?: InputSecureFile;
+    selfie?: InputSecureFile;
+    translation?: InputSecureFile[];
+    files?: InputSecureFile[];
+    plainData?: SecurePlainData;
+  }
+  interface secureValueHash extends GramJsInstance {
+    type: SecureValueType;
+    hash: bytes;
+  }
+  interface secureValueErrorData extends GramJsInstance {
+    type: SecureValueType;
+    dataHash: bytes;
+    field: string;
+    text: string;
+  }
+  interface secureValueErrorFrontSide extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes;
+    text: string;
+  }
+  interface secureValueErrorReverseSide extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes;
+    text: string;
+  }
+  interface secureValueErrorSelfie extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes;
+    text: string;
+  }
+  interface secureValueErrorFile extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes;
+    text: string;
+  }
+  interface secureValueErrorFiles extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes[];
+    text: string;
+  }
+  interface secureValueError extends GramJsInstance {
+    type: SecureValueType;
+    hash: bytes;
+    text: string;
+  }
+  interface secureValueErrorTranslationFile extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes;
+    text: string;
+  }
+  interface secureValueErrorTranslationFiles extends GramJsInstance {
+    type: SecureValueType;
+    fileHash: bytes[];
+    text: string;
+  }
+  interface secureCredentialsEncrypted extends GramJsInstance {
+    data: bytes;
+    hash: bytes;
+    secret: bytes;
+  }
+  interface account_authorizationForm extends GramJsInstance {
+    // flags: null;
+    requiredTypes: SecureRequiredType[];
+    values: SecureValue[];
+    errors: SecureValueError[];
+    users: User[];
+    privacyPolicyUrl?: string;
+  }
+  interface account_sentEmailCode extends GramJsInstance {
+    emailPattern: string;
+    length: int;
+  }
+  interface help_deepLinkInfoEmpty extends GramJsInstance {
+    
+  }
+  interface help_deepLinkInfo extends GramJsInstance {
+    // flags: null;
+    updateApp?: true;
+    message: string;
+    entities?: MessageEntity[];
+  }
+  interface savedPhoneContact extends GramJsInstance {
+    phone: string;
+    firstName: string;
+    lastName: string;
+    date: int;
+  }
+  interface account_takeout extends GramJsInstance {
+    id: long;
+  }
+  interface passwordKdfAlgoUnknown extends GramJsInstance {
+    
+  }
+  interface passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow extends GramJsInstance {
+    salt1: bytes;
+    salt2: bytes;
+    g: int;
+    p: bytes;
+  }
+  interface securePasswordKdfAlgoUnknown extends GramJsInstance {
+    
+  }
+  interface securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 extends GramJsInstance {
+    salt: bytes;
+  }
+  interface securePasswordKdfAlgoSHA512 extends GramJsInstance {
+    salt: bytes;
+  }
+  interface secureSecretSettings extends GramJsInstance {
+    secureAlgo: SecurePasswordKdfAlgo;
+    secureSecret: bytes;
+    secureSecretId: long;
+  }
+  interface inputCheckPasswordEmpty extends GramJsInstance {
+    
+  }
+  interface inputCheckPasswordSRP extends GramJsInstance {
+    srpId: long;
+    A: bytes;
+    M1: bytes;
+  }
+  interface secureRequiredType extends GramJsInstance {
+    // flags: null;
+    nativeNames?: true;
+    selfieRequired?: true;
+    translationRequired?: true;
+    type: SecureValueType;
+  }
+  interface secureRequiredTypeOneOf extends GramJsInstance {
+    types: SecureRequiredType[];
+  }
+  interface help_passportConfigNotModified extends GramJsInstance {
+    
+  }
+  interface help_passportConfig extends GramJsInstance {
+    hash: int;
+    countriesLangs: DataJSON;
+  }
+  interface inputAppEvent extends GramJsInstance {
+    time: double;
+    type: string;
+    peer: long;
+    data: JSONValue;
+  }
+  interface jsonObjectValue extends GramJsInstance {
+    key: string;
+    value: JSONValue;
+  }
+  interface jsonNull extends GramJsInstance {
+    
+  }
+  interface jsonBool extends GramJsInstance {
+    value: Bool;
+  }
+  interface jsonNumber extends GramJsInstance {
+    value: double;
+  }
+  interface jsonString extends GramJsInstance {
+    value: string;
+  }
+  interface jsonArray extends GramJsInstance {
+    value: JSONValue[];
+  }
+  interface jsonObject extends GramJsInstance {
+    value: JSONObjectValue[];
+  }
+  interface pageTableCell extends GramJsInstance {
+    // flags: null;
+    header?: true;
+    alignCenter?: true;
+    alignRight?: true;
+    valignMiddle?: true;
+    valignBottom?: true;
+    text?: RichText;
+    colspan?: int;
+    rowspan?: int;
+  }
+  interface pageTableRow extends GramJsInstance {
+    cells: PageTableCell[];
+  }
+  interface pageCaption extends GramJsInstance {
+    text: RichText;
+    credit: RichText;
+  }
+  interface pageListItemText extends GramJsInstance {
+    text: RichText;
+  }
+  interface pageListItemBlocks extends GramJsInstance {
+    blocks: PageBlock[];
+  }
+  interface pageListOrderedItemText extends GramJsInstance {
+    num: string;
+    text: RichText;
+  }
+  interface pageListOrderedItemBlocks extends GramJsInstance {
+    num: string;
+    blocks: PageBlock[];
+  }
+  interface pageRelatedArticle extends GramJsInstance {
+    // flags: null;
+    url: string;
+    webpageId: long;
+    title?: string;
+    description?: string;
+    photoId?: long;
+    author?: string;
+    publishedDate?: int;
+  }
+  interface page extends GramJsInstance {
+    // flags: null;
+    part?: true;
+    rtl?: true;
+    v2?: true;
+    url: string;
+    blocks: PageBlock[];
+    photos: Photo[];
+    documents: Document[];
+  }
+  interface help_supportName extends GramJsInstance {
+    name: string;
+  }
+  interface help_userInfoEmpty extends GramJsInstance {
+    
+  }
+  interface help_userInfo extends GramJsInstance {
+    message: string;
+    entities: MessageEntity[];
+    author: string;
+    date: int;
+  }
+  interface pollAnswer extends GramJsInstance {
+    text: string;
+    option: bytes;
+  }
+  interface poll extends GramJsInstance {
+    id: long;
+    // flags: null;
+    closed?: true;
+    question: string;
+    answers: PollAnswer[];
+  }
+  interface pollAnswerVoters extends GramJsInstance {
+    // flags: null;
+    chosen?: true;
+    option: bytes;
+    voters: int;
+  }
+  interface pollResults extends GramJsInstance {
+    // flags: null;
+    min?: true;
+    results?: PollAnswerVoters[];
+    totalVoters?: int;
+  }
+  interface chatOnlines extends GramJsInstance {
+    onlines: int;
+  }
+  interface statsURL extends GramJsInstance {
+    url: string;
+  }
+  interface chatAdminRights extends GramJsInstance {
+    // flags: null;
+    changeInfo?: true;
+    postMessages?: true;
+    editMessages?: true;
+    deleteMessages?: true;
+    banUsers?: true;
+    inviteUsers?: true;
+    pinMessages?: true;
+    addAdmins?: true;
+  }
+  interface chatBannedRights extends GramJsInstance {
+    // flags: null;
+    viewMessages?: true;
+    sendMessages?: true;
+    sendMedia?: true;
+    sendStickers?: true;
+    sendGifs?: true;
+    sendGames?: true;
+    sendInline?: true;
+    embedLinks?: true;
+    sendPolls?: true;
+    changeInfo?: true;
+    inviteUsers?: true;
+    pinMessages?: true;
+    untilDate: int;
+  }
+  interface inputWallPaper extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputWallPaperSlug extends GramJsInstance {
+    slug: string;
+  }
+  interface account_wallPapersNotModified extends GramJsInstance {
+    
+  }
+  interface account_wallPapers extends GramJsInstance {
+    hash: int;
+    wallpapers: WallPaper[];
+  }
+  interface codeSettings extends GramJsInstance {
+    // flags: null;
+    allowFlashcall?: true;
+    currentNumber?: true;
+    allowAppHash?: true;
+  }
+  interface wallPaperSettings extends GramJsInstance {
+    // flags: null;
+    blur?: true;
+    motion?: true;
+    backgroundColor?: int;
+    intensity?: int;
+  }
+  interface autoDownloadSettings extends GramJsInstance {
+    // flags: null;
+    disabled?: true;
+    videoPreloadLarge?: true;
+    audioPreloadNext?: true;
+    phonecallsLessData?: true;
+    photoSizeMax: int;
+    videoSizeMax: int;
+    fileSizeMax: int;
+  }
+  interface account_autoDownloadSettings extends GramJsInstance {
+    low: AutoDownloadSettings;
+    medium: AutoDownloadSettings;
+    high: AutoDownloadSettings;
+  }
+  interface emojiKeyword extends GramJsInstance {
+    keyword: string;
+    emoticons: string[];
+  }
+  interface emojiKeywordDeleted extends GramJsInstance {
+    keyword: string;
+    emoticons: string[];
+  }
+  interface emojiKeywordsDifference extends GramJsInstance {
+    langCode: string;
+    fromVersion: int;
+    version: int;
+    keywords: EmojiKeyword[];
+  }
+  interface emojiURL extends GramJsInstance {
+    url: string;
+  }
+  interface emojiLanguage extends GramJsInstance {
+    langCode: string;
+  }
+  interface fileLocationToBeDeprecated extends GramJsInstance {
+    volumeId: long;
+    localId: int;
+  }
+  interface folder extends GramJsInstance {
+    // flags: null;
+    autofillNewBroadcasts?: true;
+    autofillPublicGroups?: true;
+    autofillNewCorrespondents?: true;
+    id: int;
+    title: string;
+    photo?: ChatPhoto;
+  }
+  interface inputFolderPeer extends GramJsInstance {
+    peer: InputPeer;
+    folderId: int;
+  }
+  interface folderPeer extends GramJsInstance {
+    peer: Peer;
+    folderId: int;
+  }
+  interface messages_searchCounter extends GramJsInstance {
+    // flags: null;
+    inexact?: true;
+    filter: MessagesFilter;
+    count: int;
+  }
+  interface urlAuthResultRequest extends GramJsInstance {
+    // flags: null;
+    requestWriteAccess?: true;
+    bot: User;
+    domain: string;
+  }
+  interface urlAuthResultAccepted extends GramJsInstance {
+    url: string;
+  }
+  interface urlAuthResultDefault extends GramJsInstance {
+    
+  }
+  interface channelLocationEmpty extends GramJsInstance {
+    
+  }
+  interface channelLocation extends GramJsInstance {
+    geoPoint: GeoPoint;
+    address: string;
+  }
+  interface peerLocated extends GramJsInstance {
+    peer: Peer;
+    expires: int;
+    distance: int;
+  }
+  interface restrictionReason extends GramJsInstance {
+    platform: string;
+    reason: string;
+    text: string;
+  }
+  interface inputTheme extends GramJsInstance {
+    id: long;
+    accessHash: long;
+  }
+  interface inputThemeSlug extends GramJsInstance {
+    slug: string;
+  }
+  interface themeDocumentNotModified extends GramJsInstance {
+    
+  }
+  interface theme extends GramJsInstance {
+    // flags: null;
+    creator?: true;
+    default?: true;
+    id: long;
+    accessHash: long;
+    slug: string;
+    title: string;
+    document?: Document;
+    installsCount: int;
+  }
+  interface account_themesNotModified extends GramJsInstance {
+    
+  }
+  interface account_themes extends GramJsInstance {
+    hash: int;
+    themes: Theme[];
+  }
+  interface resPQ extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    pq: bytes;
+    serverPublicKeyFingerprints: long[];
+  }
+  interface pQInnerData extends GramJsInstance {
+    pq: bytes;
+    p: bytes;
+    q: bytes;
+    nonce: int128;
+    serverNonce: int128;
+    newNonce: int256;
+  }
+  interface pQInnerDataDc extends GramJsInstance {
+    pq: bytes;
+    p: bytes;
+    q: bytes;
+    nonce: int128;
+    serverNonce: int128;
+    newNonce: int256;
+    dc: int;
+  }
+  interface pQInnerDataTemp extends GramJsInstance {
+    pq: bytes;
+    p: bytes;
+    q: bytes;
+    nonce: int128;
+    serverNonce: int128;
+    newNonce: int256;
+    expiresIn: int;
+  }
+  interface pQInnerDataTempDc extends GramJsInstance {
+    pq: bytes;
+    p: bytes;
+    q: bytes;
+    nonce: int128;
+    serverNonce: int128;
+    newNonce: int256;
+    dc: int;
+    expiresIn: int;
+  }
+  interface serverDHParamsFail extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    newNonceHash: int128;
+  }
+  interface serverDHParamsOk extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    encryptedAnswer: bytes;
+  }
+  interface serverDHInnerData extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    g: int;
+    dhPrime: bytes;
+    gA: bytes;
+    serverTime: int;
+  }
+  interface clientDHInnerData extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    retryId: long;
+    gB: bytes;
+  }
+  interface dhGenOk extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    newNonceHash1: int128;
+  }
+  interface dhGenRetry extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    newNonceHash2: int128;
+  }
+  interface dhGenFail extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    newNonceHash3: int128;
+  }
+  interface destroyAuthKeyOk extends GramJsInstance {
+    
+  }
+  interface destroyAuthKeyNone extends GramJsInstance {
+    
+  }
+  interface destroyAuthKeyFail extends GramJsInstance {
+    
+  }
+  interface msgsAck extends GramJsInstance {
+    msgIds: long[];
+  }
+  interface badMsgNotification extends GramJsInstance {
+    badMsgId: long;
+    badMsgSeqno: int;
+    errorCode: int;
+  }
+  interface badServerSalt extends GramJsInstance {
+    badMsgId: long;
+    badMsgSeqno: int;
+    errorCode: int;
+    newServerSalt: long;
+  }
+  interface msgsStateReq extends GramJsInstance {
+    msgIds: long[];
+  }
+  interface msgsStateInfo extends GramJsInstance {
+    reqMsgId: long;
+    info: string;
+  }
+  interface msgsAllInfo extends GramJsInstance {
+    msgIds: long[];
+    info: string;
+  }
+  interface msgDetailedInfo extends GramJsInstance {
+    msgId: long;
+    answerMsgId: long;
+    bytes: int;
+    status: int;
+  }
+  interface msgNewDetailedInfo extends GramJsInstance {
+    answerMsgId: long;
+    bytes: int;
+    status: int;
+  }
+  interface msgResendReq extends GramJsInstance {
+    msgIds: long[];
+  }
+  interface rpcError extends GramJsInstance {
+    errorCode: int;
+    errorMessage: string;
+  }
+  interface rpcAnswerUnknown extends GramJsInstance {
+    
+  }
+  interface rpcAnswerDroppedRunning extends GramJsInstance {
+    
+  }
+  interface rpcAnswerDropped extends GramJsInstance {
+    msgId: long;
+    seqNo: int;
+    bytes: int;
+  }
+  interface futureSalt extends GramJsInstance {
+    validSince: int;
+    validUntil: int;
+    salt: long;
+  }
+  interface futureSalts extends GramJsInstance {
+    reqMsgId: long;
+    now: int;
+    salts: future_salt[];
+  }
+  interface pong extends GramJsInstance {
+    msgId: long;
+    pingId: long;
+  }
+  interface destroySessionOk extends GramJsInstance {
+    sessionId: long;
+  }
+  interface destroySessionNone extends GramJsInstance {
+    sessionId: long;
+  }
+  interface newSessionCreated extends GramJsInstance {
+    firstMsgId: long;
+    uniqueId: long;
+    serverSalt: long;
+  }
+  interface httpWait extends GramJsInstance {
+    maxDelay: int;
+    waitAfter: int;
+    maxWait: int;
+  }
+  interface ipPort extends GramJsInstance {
+    ipv4: int;
+    port: int;
+  }
+  interface ipPortSecret extends GramJsInstance {
+    ipv4: int;
+    port: int;
+    secret: bytes;
+  }
+  interface accessPointRule extends GramJsInstance {
+    phonePrefixRules: string;
+    dcId: int;
+    ips: IpPort[];
+  }
+  interface help_configSimple extends GramJsInstance {
+    date: int;
+    expires: int;
+    rules: AccessPointRule[];
+  }
+  interface tlsClientHello extends GramJsInstance {
+    blocks: TlsBlock[];
+  }
+  interface tlsBlockString extends GramJsInstance {
+    data: string;
+  }
+  interface tlsBlockRandom extends GramJsInstance {
+    length: int;
+  }
+  interface tlsBlockZero extends GramJsInstance {
+    length: int;
+  }
+  interface tlsBlockDomain extends GramJsInstance {
+    
+  }
+  interface tlsBlockGrease extends GramJsInstance {
+    seed: int;
+  }
+  interface tlsBlockScope extends GramJsInstance {
+    entries: TlsBlock[];
+  }
+
+  type InputPeer = inputPeerEmpty | inputPeerSelf | inputPeerChat | inputPeerUser | inputPeerChannel | inputPeerUserFromMessage | inputPeerChannelFromMessage;
+  type InputUser = inputUserEmpty | inputUserSelf | inputUser | inputUserFromMessage;
+  type InputContact = inputPhoneContact;
+  type InputFile = inputFile | inputFileBig;
+  type InputMedia = inputMediaEmpty | inputMediaUploadedPhoto | inputMediaPhoto | inputMediaGeoPoint | inputMediaContact | inputMediaUploadedDocument | inputMediaDocument | inputMediaVenue | inputMediaGifExternal | inputMediaPhotoExternal | inputMediaDocumentExternal | inputMediaGame | inputMediaInvoice | inputMediaGeoLive | inputMediaPoll;
+  type InputChatPhoto = inputChatPhotoEmpty | inputChatUploadedPhoto | inputChatPhoto;
+  type InputGeoPoint = inputGeoPointEmpty | inputGeoPoint;
+  type InputPhoto = inputPhotoEmpty | inputPhoto;
+  type InputFileLocation = inputFileLocation | inputEncryptedFileLocation | inputDocumentFileLocation | inputSecureFileLocation | inputTakeoutFileLocation | inputPhotoFileLocation | inputPeerPhotoFileLocation | inputStickerSetThumb;
+  type Peer = peerUser | peerChat | peerChannel;
+  type storage_FileType = storage_fileUnknown | storage_filePartial | storage_fileJpeg | storage_fileGif | storage_filePng | storage_filePdf | storage_fileMp3 | storage_fileMov | storage_fileMp4 | storage_fileWebp;
+  type User = userEmpty | user;
+  type UserProfilePhoto = userProfilePhotoEmpty | userProfilePhoto;
+  type UserStatus = userStatusEmpty | userStatusOnline | userStatusOffline | userStatusRecently | userStatusLastWeek | userStatusLastMonth;
+  type Chat = chatEmpty | chat | chatForbidden | channel | channelForbidden;
+  type ChatFull = chatFull | channelFull;
+  type ChatParticipant = chatParticipant | chatParticipantCreator | chatParticipantAdmin;
+  type ChatParticipants = chatParticipantsForbidden | chatParticipants;
+  type ChatPhoto = chatPhotoEmpty | chatPhoto;
+  type Message = messageEmpty | message | messageService;
+  type MessageMedia = messageMediaEmpty | messageMediaPhoto | messageMediaGeo | messageMediaContact | messageMediaUnsupported | messageMediaDocument | messageMediaWebPage | messageMediaVenue | messageMediaGame | messageMediaInvoice | messageMediaGeoLive | messageMediaPoll;
+  type MessageAction = messageActionEmpty | messageActionChatCreate | messageActionChatEditTitle | messageActionChatEditPhoto | messageActionChatDeletePhoto | messageActionChatAddUser | messageActionChatDeleteUser | messageActionChatJoinedByLink | messageActionChannelCreate | messageActionChatMigrateTo | messageActionChannelMigrateFrom | messageActionPinMessage | messageActionHistoryClear | messageActionGameScore | messageActionPaymentSentMe | messageActionPaymentSent | messageActionPhoneCall | messageActionScreenshotTaken | messageActionCustomAction | messageActionBotAllowed | messageActionSecureValuesSentMe | messageActionSecureValuesSent | messageActionContactSignUp;
+  type Dialog = dialog | dialogFolder;
+  type Photo = photoEmpty | photo;
+  type PhotoSize = photoSizeEmpty | photoSize | photoCachedSize | photoStrippedSize;
+  type GeoPoint = geoPointEmpty | geoPoint;
+  type auth_SentCode = auth_sentCode;
+  type auth_Authorization = auth_authorization | auth_authorizationSignUpRequired;
+  type auth_ExportedAuthorization = auth_exportedAuthorization;
+  type InputNotifyPeer = inputNotifyPeer | inputNotifyUsers | inputNotifyChats | inputNotifyBroadcasts;
+  type InputPeerNotifySettings = inputPeerNotifySettings;
+  type PeerNotifySettings = peerNotifySettings;
+  type PeerSettings = peerSettings;
+  type WallPaper = wallPaper;
+  type ReportReason = inputReportReasonSpam | inputReportReasonViolence | inputReportReasonPornography | inputReportReasonChildAbuse | inputReportReasonOther | inputReportReasonCopyright | inputReportReasonGeoIrrelevant;
+  type UserFull = userFull;
+  type Contact = contact;
+  type ImportedContact = importedContact;
+  type ContactBlocked = contactBlocked;
+  type ContactStatus = contactStatus;
+  type contacts_Contacts = contacts_contactsNotModified | contacts_contacts;
+  type contacts_ImportedContacts = contacts_importedContacts;
+  type contacts_Blocked = contacts_blocked | contacts_blockedSlice;
+  type messages_Dialogs = messages_dialogs | messages_dialogsSlice | messages_dialogsNotModified;
+  type messages_Messages = messages_messages | messages_messagesSlice | messages_channelMessages | messages_messagesNotModified;
+  type messages_Chats = messages_chats | messages_chatsSlice;
+  type messages_ChatFull = messages_chatFull;
+  type messages_AffectedHistory = messages_affectedHistory;
+  type MessagesFilter = inputMessagesFilterEmpty | inputMessagesFilterPhotos | inputMessagesFilterVideo | inputMessagesFilterPhotoVideo | inputMessagesFilterDocument | inputMessagesFilterUrl | inputMessagesFilterGif | inputMessagesFilterVoice | inputMessagesFilterMusic | inputMessagesFilterChatPhotos | inputMessagesFilterPhoneCalls | inputMessagesFilterRoundVoice | inputMessagesFilterRoundVideo | inputMessagesFilterMyMentions | inputMessagesFilterGeo | inputMessagesFilterContacts;
+  type Update = updateNewMessage | updateMessageID | updateDeleteMessages | updateUserTyping | updateChatUserTyping | updateChatParticipants | updateUserStatus | updateUserName | updateUserPhoto | updateNewEncryptedMessage | updateEncryptedChatTyping | updateEncryption | updateEncryptedMessagesRead | updateChatParticipantAdd | updateChatParticipantDelete | updateDcOptions | updateUserBlocked | updateNotifySettings | updateServiceNotification | updatePrivacy | updateUserPhone | updateReadHistoryInbox | updateReadHistoryOutbox | updateWebPage | updateReadMessagesContents | updateChannelTooLong | updateChannel | updateNewChannelMessage | updateReadChannelInbox | updateDeleteChannelMessages | updateChannelMessageViews | updateChatParticipantAdmin | updateNewStickerSet | updateStickerSetsOrder | updateStickerSets | updateSavedGifs | updateBotInlineQuery | updateBotInlineSend | updateEditChannelMessage | updateChannelPinnedMessage | updateBotCallbackQuery | updateEditMessage | updateInlineBotCallbackQuery | updateReadChannelOutbox | updateDraftMessage | updateReadFeaturedStickers | updateRecentStickers | updateConfig | updatePtsChanged | updateChannelWebPage | updateDialogPinned | updatePinnedDialogs | updateBotWebhookJSON | updateBotWebhookJSONQuery | updateBotShippingQuery | updateBotPrecheckoutQuery | updatePhoneCall | updateLangPackTooLong | updateLangPack | updateFavedStickers | updateChannelReadMessagesContents | updateContactsReset | updateChannelAvailableMessages | updateDialogUnreadMark | updateUserPinnedMessage | updateChatPinnedMessage | updateMessagePoll | updateChatDefaultBannedRights | updateFolderPeers | updatePeerSettings | updatePeerLocated | updateNewScheduledMessage | updateDeleteScheduledMessages | updateTheme;
+  type updates_State = updates_state;
+  type updates_Difference = updates_differenceEmpty | updates_difference | updates_differenceSlice | updates_differenceTooLong;
+  type Updates = updatesTooLong | updateShortMessage | updateShortChatMessage | updateShort | updatesCombined | updates | updateShortSentMessage;
+  type photos_Photos = photos_photos | photos_photosSlice;
+  type photos_Photo = photos_photo;
+  type upload_File = upload_file | upload_fileCdnRedirect;
+  type DcOption = dcOption;
+  type Config = config;
+  type NearestDc = nearestDc;
+  type help_AppUpdate = help_appUpdate | help_noAppUpdate;
+  type help_InviteText = help_inviteText;
+  type EncryptedChat = encryptedChatEmpty | encryptedChatWaiting | encryptedChatRequested | encryptedChat | encryptedChatDiscarded;
+  type InputEncryptedChat = inputEncryptedChat;
+  type EncryptedFile = encryptedFileEmpty | encryptedFile;
+  type InputEncryptedFile = inputEncryptedFileEmpty | inputEncryptedFileUploaded | inputEncryptedFile | inputEncryptedFileBigUploaded;
+  type EncryptedMessage = encryptedMessage | encryptedMessageService;
+  type messages_DhConfig = messages_dhConfigNotModified | messages_dhConfig;
+  type messages_SentEncryptedMessage = messages_sentEncryptedMessage | messages_sentEncryptedFile;
+  type InputDocument = inputDocumentEmpty | inputDocument;
+  type Document = documentEmpty | document;
+  type help_Support = help_support;
+  type NotifyPeer = notifyPeer | notifyUsers | notifyChats | notifyBroadcasts;
+  type SendMessageAction = sendMessageTypingAction | sendMessageCancelAction | sendMessageRecordVideoAction | sendMessageUploadVideoAction | sendMessageRecordAudioAction | sendMessageUploadAudioAction | sendMessageUploadPhotoAction | sendMessageUploadDocumentAction | sendMessageGeoLocationAction | sendMessageChooseContactAction | sendMessageGamePlayAction | sendMessageRecordRoundAction | sendMessageUploadRoundAction;
+  type contacts_Found = contacts_found;
+  type InputPrivacyKey = inputPrivacyKeyStatusTimestamp | inputPrivacyKeyChatInvite | inputPrivacyKeyPhoneCall | inputPrivacyKeyPhoneP2P | inputPrivacyKeyForwards | inputPrivacyKeyProfilePhoto | inputPrivacyKeyPhoneNumber | inputPrivacyKeyAddedByPhone;
+  type PrivacyKey = privacyKeyStatusTimestamp | privacyKeyChatInvite | privacyKeyPhoneCall | privacyKeyPhoneP2P | privacyKeyForwards | privacyKeyProfilePhoto | privacyKeyPhoneNumber | privacyKeyAddedByPhone;
+  type InputPrivacyRule = inputPrivacyValueAllowContacts | inputPrivacyValueAllowAll | inputPrivacyValueAllowUsers | inputPrivacyValueDisallowContacts | inputPrivacyValueDisallowAll | inputPrivacyValueDisallowUsers | inputPrivacyValueAllowChatParticipants | inputPrivacyValueDisallowChatParticipants;
+  type PrivacyRule = privacyValueAllowContacts | privacyValueAllowAll | privacyValueAllowUsers | privacyValueDisallowContacts | privacyValueDisallowAll | privacyValueDisallowUsers | privacyValueAllowChatParticipants | privacyValueDisallowChatParticipants;
+  type account_PrivacyRules = account_privacyRules;
+  type AccountDaysTTL = accountDaysTTL;
+  type DocumentAttribute = documentAttributeImageSize | documentAttributeAnimated | documentAttributeSticker | documentAttributeVideo | documentAttributeAudio | documentAttributeFilename | documentAttributeHasStickers;
+  type messages_Stickers = messages_stickersNotModified | messages_stickers;
+  type StickerPack = stickerPack;
+  type messages_AllStickers = messages_allStickersNotModified | messages_allStickers;
+  type messages_AffectedMessages = messages_affectedMessages;
+  type WebPage = webPageEmpty | webPagePending | webPage | webPageNotModified;
+  type Authorization = authorization;
+  type account_Authorizations = account_authorizations;
+  type account_Password = account_password;
+  type account_PasswordSettings = account_passwordSettings;
+  type account_PasswordInputSettings = account_passwordInputSettings;
+  type auth_PasswordRecovery = auth_passwordRecovery;
+  type ReceivedNotifyMessage = receivedNotifyMessage;
+  type ExportedChatInvite = chatInviteEmpty | chatInviteExported;
+  type ChatInvite = chatInviteAlready | chatInvite;
+  type InputStickerSet = inputStickerSetEmpty | inputStickerSetID | inputStickerSetShortName | inputStickerSetAnimatedEmoji;
+  type StickerSet = stickerSet;
+  type messages_StickerSet = messages_stickerSet;
+  type BotCommand = botCommand;
+  type BotInfo = botInfo;
+  type KeyboardButton = keyboardButton | keyboardButtonUrl | keyboardButtonCallback | keyboardButtonRequestPhone | keyboardButtonRequestGeoLocation | keyboardButtonSwitchInline | keyboardButtonGame | keyboardButtonBuy | keyboardButtonUrlAuth | inputKeyboardButtonUrlAuth;
+  type KeyboardButtonRow = keyboardButtonRow;
+  type ReplyMarkup = replyKeyboardHide | replyKeyboardForceReply | replyKeyboardMarkup | replyInlineMarkup;
+  type MessageEntity = messageEntityUnknown | messageEntityMention | messageEntityHashtag | messageEntityBotCommand | messageEntityUrl | messageEntityEmail | messageEntityBold | messageEntityItalic | messageEntityCode | messageEntityPre | messageEntityTextUrl | messageEntityMentionName | inputMessageEntityMentionName | messageEntityPhone | messageEntityCashtag | messageEntityUnderline | messageEntityStrike | messageEntityBlockquote;
+  type InputChannel = inputChannelEmpty | inputChannel | inputChannelFromMessage;
+  type contacts_ResolvedPeer = contacts_resolvedPeer;
+  type MessageRange = messageRange;
+  type updates_ChannelDifference = updates_channelDifferenceEmpty | updates_channelDifferenceTooLong | updates_channelDifference;
+  type ChannelMessagesFilter = channelMessagesFilterEmpty | channelMessagesFilter;
+  type ChannelParticipant = channelParticipant | channelParticipantSelf | channelParticipantCreator | channelParticipantAdmin | channelParticipantBanned;
+  type ChannelParticipantsFilter = channelParticipantsRecent | channelParticipantsAdmins | channelParticipantsKicked | channelParticipantsBots | channelParticipantsBanned | channelParticipantsSearch | channelParticipantsContacts;
+  type channels_ChannelParticipants = channels_channelParticipants | channels_channelParticipantsNotModified;
+  type channels_ChannelParticipant = channels_channelParticipant;
+  type help_TermsOfService = help_termsOfService;
+  type FoundGif = foundGif | foundGifCached;
+  type messages_FoundGifs = messages_foundGifs;
+  type messages_SavedGifs = messages_savedGifsNotModified | messages_savedGifs;
+  type InputBotInlineMessage = inputBotInlineMessageMediaAuto | inputBotInlineMessageText | inputBotInlineMessageMediaGeo | inputBotInlineMessageMediaVenue | inputBotInlineMessageMediaContact | inputBotInlineMessageGame;
+  type InputBotInlineResult = inputBotInlineResult | inputBotInlineResultPhoto | inputBotInlineResultDocument | inputBotInlineResultGame;
+  type BotInlineMessage = botInlineMessageMediaAuto | botInlineMessageText | botInlineMessageMediaGeo | botInlineMessageMediaVenue | botInlineMessageMediaContact;
+  type BotInlineResult = botInlineResult | botInlineMediaResult;
+  type messages_BotResults = messages_botResults;
+  type ExportedMessageLink = exportedMessageLink;
+  type MessageFwdHeader = messageFwdHeader;
+  type auth_CodeType = auth_codeTypeSms | auth_codeTypeCall | auth_codeTypeFlashCall;
+  type auth_SentCodeType = auth_sentCodeTypeApp | auth_sentCodeTypeSms | auth_sentCodeTypeCall | auth_sentCodeTypeFlashCall;
+  type messages_BotCallbackAnswer = messages_botCallbackAnswer;
+  type messages_MessageEditData = messages_messageEditData;
+  type InputBotInlineMessageID = inputBotInlineMessageID;
+  type InlineBotSwitchPM = inlineBotSwitchPM;
+  type messages_PeerDialogs = messages_peerDialogs;
+  type TopPeer = topPeer;
+  type TopPeerCategory = topPeerCategoryBotsPM | topPeerCategoryBotsInline | topPeerCategoryCorrespondents | topPeerCategoryGroups | topPeerCategoryChannels | topPeerCategoryPhoneCalls | topPeerCategoryForwardUsers | topPeerCategoryForwardChats;
+  type TopPeerCategoryPeers = topPeerCategoryPeers;
+  type contacts_TopPeers = contacts_topPeersNotModified | contacts_topPeers | contacts_topPeersDisabled;
+  type DraftMessage = draftMessageEmpty | draftMessage;
+  type messages_FeaturedStickers = messages_featuredStickersNotModified | messages_featuredStickers;
+  type messages_RecentStickers = messages_recentStickersNotModified | messages_recentStickers;
+  type messages_ArchivedStickers = messages_archivedStickers;
+  type messages_StickerSetInstallResult = messages_stickerSetInstallResultSuccess | messages_stickerSetInstallResultArchive;
+  type StickerSetCovered = stickerSetCovered | stickerSetMultiCovered;
+  type MaskCoords = maskCoords;
+  type InputStickeredMedia = inputStickeredMediaPhoto | inputStickeredMediaDocument;
+  type Game = game;
+  type InputGame = inputGameID | inputGameShortName;
+  type HighScore = highScore;
+  type messages_HighScores = messages_highScores;
+  type RichText = textEmpty | textPlain | textBold | textItalic | textUnderline | textStrike | textFixed | textUrl | textEmail | textConcat | textSubscript | textSuperscript | textMarked | textPhone | textImage | textAnchor;
+  type PageBlock = pageBlockUnsupported | pageBlockTitle | pageBlockSubtitle | pageBlockAuthorDate | pageBlockHeader | pageBlockSubheader | pageBlockParagraph | pageBlockPreformatted | pageBlockFooter | pageBlockDivider | pageBlockAnchor | pageBlockList | pageBlockBlockquote | pageBlockPullquote | pageBlockPhoto | pageBlockVideo | pageBlockCover | pageBlockEmbed | pageBlockEmbedPost | pageBlockCollage | pageBlockSlideshow | pageBlockChannel | pageBlockAudio | pageBlockKicker | pageBlockTable | pageBlockOrderedList | pageBlockDetails | pageBlockRelatedArticles | pageBlockMap;
+  type PhoneCallDiscardReason = phoneCallDiscardReasonMissed | phoneCallDiscardReasonDisconnect | phoneCallDiscardReasonHangup | phoneCallDiscardReasonBusy;
+  type DataJSON = dataJSON;
+  type LabeledPrice = labeledPrice;
+  type Invoice = invoice;
+  type PaymentCharge = paymentCharge;
+  type PostAddress = postAddress;
+  type PaymentRequestedInfo = paymentRequestedInfo;
+  type PaymentSavedCredentials = paymentSavedCredentialsCard;
+  type WebDocument = webDocument | webDocumentNoProxy;
+  type InputWebDocument = inputWebDocument;
+  type InputWebFileLocation = inputWebFileLocation | inputWebFileGeoPointLocation;
+  type upload_WebFile = upload_webFile;
+  type payments_PaymentForm = payments_paymentForm;
+  type payments_ValidatedRequestedInfo = payments_validatedRequestedInfo;
+  type payments_PaymentResult = payments_paymentResult | payments_paymentVerificationNeeded;
+  type payments_PaymentReceipt = payments_paymentReceipt;
+  type payments_SavedInfo = payments_savedInfo;
+  type InputPaymentCredentials = inputPaymentCredentialsSaved | inputPaymentCredentials | inputPaymentCredentialsApplePay | inputPaymentCredentialsAndroidPay;
+  type account_TmpPassword = account_tmpPassword;
+  type ShippingOption = shippingOption;
+  type InputStickerSetItem = inputStickerSetItem;
+  type InputPhoneCall = inputPhoneCall;
+  type PhoneCall = phoneCallEmpty | phoneCallWaiting | phoneCallRequested | phoneCallAccepted | phoneCall | phoneCallDiscarded;
+  type PhoneConnection = phoneConnection;
+  type PhoneCallProtocol = phoneCallProtocol;
+  type phone_PhoneCall = phone_phoneCall;
+  type upload_CdnFile = upload_cdnFileReuploadNeeded | upload_cdnFile;
+  type CdnPublicKey = cdnPublicKey;
+  type CdnConfig = cdnConfig;
+  type LangPackString = langPackString | langPackStringPluralized | langPackStringDeleted;
+  type LangPackDifference = langPackDifference;
+  type LangPackLanguage = langPackLanguage;
+  type ChannelAdminLogEventAction = channelAdminLogEventActionChangeTitle | channelAdminLogEventActionChangeAbout | channelAdminLogEventActionChangeUsername | channelAdminLogEventActionChangePhoto | channelAdminLogEventActionToggleInvites | channelAdminLogEventActionToggleSignatures | channelAdminLogEventActionUpdatePinned | channelAdminLogEventActionEditMessage | channelAdminLogEventActionDeleteMessage | channelAdminLogEventActionParticipantJoin | channelAdminLogEventActionParticipantLeave | channelAdminLogEventActionParticipantInvite | channelAdminLogEventActionParticipantToggleBan | channelAdminLogEventActionParticipantToggleAdmin | channelAdminLogEventActionChangeStickerSet | channelAdminLogEventActionTogglePreHistoryHidden | channelAdminLogEventActionDefaultBannedRights | channelAdminLogEventActionStopPoll | channelAdminLogEventActionChangeLinkedChat | channelAdminLogEventActionChangeLocation | channelAdminLogEventActionToggleSlowMode;
+  type ChannelAdminLogEvent = channelAdminLogEvent;
+  type channels_AdminLogResults = channels_adminLogResults;
+  type ChannelAdminLogEventsFilter = channelAdminLogEventsFilter;
+  type PopularContact = popularContact;
+  type messages_FavedStickers = messages_favedStickersNotModified | messages_favedStickers;
+  type RecentMeUrl = recentMeUrlUnknown | recentMeUrlUser | recentMeUrlChat | recentMeUrlChatInvite | recentMeUrlStickerSet;
+  type help_RecentMeUrls = help_recentMeUrls;
+  type InputSingleMedia = inputSingleMedia;
+  type WebAuthorization = webAuthorization;
+  type account_WebAuthorizations = account_webAuthorizations;
+  type InputMessage = inputMessageID | inputMessageReplyTo | inputMessagePinned;
+  type InputDialogPeer = inputDialogPeer | inputDialogPeerFolder;
+  type DialogPeer = dialogPeer | dialogPeerFolder;
+  type messages_FoundStickerSets = messages_foundStickerSetsNotModified | messages_foundStickerSets;
+  type FileHash = fileHash;
+  type InputClientProxy = inputClientProxy;
+  type help_ProxyData = help_proxyDataEmpty | help_proxyDataPromo;
+  type help_TermsOfServiceUpdate = help_termsOfServiceUpdateEmpty | help_termsOfServiceUpdate;
+  type InputSecureFile = inputSecureFileUploaded | inputSecureFile;
+  type SecureFile = secureFileEmpty | secureFile;
+  type SecureData = secureData;
+  type SecurePlainData = securePlainPhone | securePlainEmail;
+  type SecureValueType = secureValueTypePersonalDetails | secureValueTypePassport | secureValueTypeDriverLicense | secureValueTypeIdentityCard | secureValueTypeInternalPassport | secureValueTypeAddress | secureValueTypeUtilityBill | secureValueTypeBankStatement | secureValueTypeRentalAgreement | secureValueTypePassportRegistration | secureValueTypeTemporaryRegistration | secureValueTypePhone | secureValueTypeEmail;
+  type SecureValue = secureValue;
+  type InputSecureValue = inputSecureValue;
+  type SecureValueHash = secureValueHash;
+  type SecureValueError = secureValueErrorData | secureValueErrorFrontSide | secureValueErrorReverseSide | secureValueErrorSelfie | secureValueErrorFile | secureValueErrorFiles | secureValueError | secureValueErrorTranslationFile | secureValueErrorTranslationFiles;
+  type SecureCredentialsEncrypted = secureCredentialsEncrypted;
+  type account_AuthorizationForm = account_authorizationForm;
+  type account_SentEmailCode = account_sentEmailCode;
+  type help_DeepLinkInfo = help_deepLinkInfoEmpty | help_deepLinkInfo;
+  type SavedContact = savedPhoneContact;
+  type account_Takeout = account_takeout;
+  type PasswordKdfAlgo = passwordKdfAlgoUnknown | passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
+  type SecurePasswordKdfAlgo = securePasswordKdfAlgoUnknown | securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 | securePasswordKdfAlgoSHA512;
+  type SecureSecretSettings = secureSecretSettings;
+  type InputCheckPasswordSRP = inputCheckPasswordEmpty | inputCheckPasswordSRP;
+  type SecureRequiredType = secureRequiredType | secureRequiredTypeOneOf;
+  type help_PassportConfig = help_passportConfigNotModified | help_passportConfig;
+  type InputAppEvent = inputAppEvent;
+  type JSONObjectValue = jsonObjectValue;
+  type JSONValue = jsonNull | jsonBool | jsonNumber | jsonString | jsonArray | jsonObject;
+  type PageTableCell = pageTableCell;
+  type PageTableRow = pageTableRow;
+  type PageCaption = pageCaption;
+  type PageListItem = pageListItemText | pageListItemBlocks;
+  type PageListOrderedItem = pageListOrderedItemText | pageListOrderedItemBlocks;
+  type PageRelatedArticle = pageRelatedArticle;
+  type Page = page;
+  type help_SupportName = help_supportName;
+  type help_UserInfo = help_userInfoEmpty | help_userInfo;
+  type PollAnswer = pollAnswer;
+  type Poll = poll;
+  type PollAnswerVoters = pollAnswerVoters;
+  type PollResults = pollResults;
+  type ChatOnlines = chatOnlines;
+  type StatsURL = statsURL;
+  type ChatAdminRights = chatAdminRights;
+  type ChatBannedRights = chatBannedRights;
+  type InputWallPaper = inputWallPaper | inputWallPaperSlug;
+  type account_WallPapers = account_wallPapersNotModified | account_wallPapers;
+  type CodeSettings = codeSettings;
+  type WallPaperSettings = wallPaperSettings;
+  type AutoDownloadSettings = autoDownloadSettings;
+  type account_AutoDownloadSettings = account_autoDownloadSettings;
+  type EmojiKeyword = emojiKeyword | emojiKeywordDeleted;
+  type EmojiKeywordsDifference = emojiKeywordsDifference;
+  type EmojiURL = emojiURL;
+  type EmojiLanguage = emojiLanguage;
+  type FileLocation = fileLocationToBeDeprecated;
+  type Folder = folder;
+  type InputFolderPeer = inputFolderPeer;
+  type FolderPeer = folderPeer;
+  type messages_SearchCounter = messages_searchCounter;
+  type UrlAuthResult = urlAuthResultRequest | urlAuthResultAccepted | urlAuthResultDefault;
+  type ChannelLocation = channelLocationEmpty | channelLocation;
+  type PeerLocated = peerLocated;
+  type RestrictionReason = restrictionReason;
+  type InputTheme = inputTheme | inputThemeSlug;
+  type Theme = themeDocumentNotModified | theme;
+  type account_Themes = account_themesNotModified | account_themes;
+  type ResPQ = resPQ;
+  type P_Q_inner_data = pQInnerData | pQInnerDataDc | pQInnerDataTemp | pQInnerDataTempDc;
+  type Server_DH_Params = serverDHParamsFail | serverDHParamsOk;
+  type Server_DH_inner_data = serverDHInnerData;
+  type Client_DH_Inner_Data = clientDHInnerData;
+  type Set_client_DH_params_answer = dhGenOk | dhGenRetry | dhGenFail;
+  type DestroyAuthKeyRes = destroyAuthKeyOk | destroyAuthKeyNone | destroyAuthKeyFail;
+  type MsgsAck = msgsAck;
+  type BadMsgNotification = badMsgNotification | badServerSalt;
+  type MsgsStateReq = msgsStateReq;
+  type MsgsStateInfo = msgsStateInfo;
+  type MsgsAllInfo = msgsAllInfo;
+  type MsgDetailedInfo = msgDetailedInfo | msgNewDetailedInfo;
+  type MsgResendReq = msgResendReq;
+  type RpcError = rpcError;
+  type RpcDropAnswer = rpcAnswerUnknown | rpcAnswerDroppedRunning | rpcAnswerDropped;
+  type FutureSalt = futureSalt;
+  type FutureSalts = futureSalts;
+  type Pong = pong;
+  type DestroySessionRes = destroySessionOk | destroySessionNone;
+  type NewSession = newSessionCreated;
+  type HttpWait = httpWait;
+  type IpPort = ipPort | ipPortSecret;
+  type AccessPointRule = accessPointRule;
+  type help_ConfigSimple = help_configSimple;
+  type TlsClientHello = tlsClientHello;
+  type TlsBlock = tlsBlockString | tlsBlockRandom | tlsBlockZero | tlsBlockDomain | tlsBlockGrease | tlsBlockScope;
+
+  interface invokeAfterMsgRequest extends GramJsInstance {
+    msgId: long;
+    query: X;
+  }
+  interface invokeAfterMsgsRequest extends GramJsInstance {
+    msgIds: long[];
+    query: X;
+  }
+  interface initConnectionRequest extends GramJsInstance {
+    // flags: null;
+    apiId: int;
+    deviceModel: string;
+    systemVersion: string;
+    appVersion: string;
+    systemLangCode: string;
+    langPack: string;
+    langCode: string;
+    proxy?: InputClientProxy;
+    query: X;
+  }
+  interface invokeWithLayerRequest extends GramJsInstance {
+    layer: int;
+    query: X;
+  }
+  interface invokeWithoutUpdatesRequest extends GramJsInstance {
+    query: X;
+  }
+  interface invokeWithMessagesRangeRequest extends GramJsInstance {
+    range: MessageRange;
+    query: X;
+  }
+  interface invokeWithTakeoutRequest extends GramJsInstance {
+    takeoutId: long;
+    query: X;
+  }
+  interface auth_sendCodeRequest extends GramJsInstance {
+    phoneNumber: string;
+    apiId: int;
+    apiHash: string;
+    settings: CodeSettings;
+  }
+  interface auth_signUpRequest extends GramJsInstance {
+    phoneNumber: string;
+    phoneCodeHash: string;
+    firstName: string;
+    lastName: string;
+  }
+  interface auth_signInRequest extends GramJsInstance {
+    phoneNumber: string;
+    phoneCodeHash: string;
+    phoneCode: string;
+  }
+  interface auth_logOutRequest extends GramJsInstance {
+    
+  }
+  interface auth_resetAuthorizationsRequest extends GramJsInstance {
+    
+  }
+  interface auth_exportAuthorizationRequest extends GramJsInstance {
+    dcId: int;
+  }
+  interface auth_importAuthorizationRequest extends GramJsInstance {
+    id: int;
+    bytes: bytes;
+  }
+  interface auth_bindTempAuthKeyRequest extends GramJsInstance {
+    permAuthKeyId: long;
+    nonce: long;
+    expiresAt: int;
+    encryptedMessage: bytes;
+  }
+  interface auth_importBotAuthorizationRequest extends GramJsInstance {
+    // flags: int;
+    apiId: int;
+    apiHash: string;
+    botAuthToken: string;
+  }
+  interface auth_checkPasswordRequest extends GramJsInstance {
+    password: InputCheckPasswordSRP;
+  }
+  interface auth_requestPasswordRecoveryRequest extends GramJsInstance {
+    
+  }
+  interface auth_recoverPasswordRequest extends GramJsInstance {
+    code: string;
+  }
+  interface auth_resendCodeRequest extends GramJsInstance {
+    phoneNumber: string;
+    phoneCodeHash: string;
+  }
+  interface auth_cancelCodeRequest extends GramJsInstance {
+    phoneNumber: string;
+    phoneCodeHash: string;
+  }
+  interface auth_dropTempAuthKeysRequest extends GramJsInstance {
+    exceptAuthKeys: long[];
+  }
+  interface account_registerDeviceRequest extends GramJsInstance {
+    // flags: null;
+    noMuted?: true;
+    tokenType: int;
+    token: string;
+    appSandbox: Bool;
+    secret: bytes;
+    otherUids: int[];
+  }
+  interface account_unregisterDeviceRequest extends GramJsInstance {
+    tokenType: int;
+    token: string;
+    otherUids: int[];
+  }
+  interface account_updateNotifySettingsRequest extends GramJsInstance {
+    peer: InputNotifyPeer;
+    settings: InputPeerNotifySettings;
+  }
+  interface account_getNotifySettingsRequest extends GramJsInstance {
+    peer: InputNotifyPeer;
+  }
+  interface account_resetNotifySettingsRequest extends GramJsInstance {
+    
+  }
+  interface account_updateProfileRequest extends GramJsInstance {
+    // flags: null;
+    firstName?: string;
+    lastName?: string;
+    about?: string;
+  }
+  interface account_updateStatusRequest extends GramJsInstance {
+    offline: Bool;
+  }
+  interface account_getWallPapersRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface account_reportPeerRequest extends GramJsInstance {
+    peer: InputPeer;
+    reason: ReportReason;
+  }
+  interface account_checkUsernameRequest extends GramJsInstance {
+    username: string;
+  }
+  interface account_updateUsernameRequest extends GramJsInstance {
+    username: string;
+  }
+  interface account_getPrivacyRequest extends GramJsInstance {
+    key: InputPrivacyKey;
+  }
+  interface account_setPrivacyRequest extends GramJsInstance {
+    key: InputPrivacyKey;
+    rules: InputPrivacyRule[];
+  }
+  interface account_deleteAccountRequest extends GramJsInstance {
+    reason: string;
+  }
+  interface account_getAccountTTLRequest extends GramJsInstance {
+    
+  }
+  interface account_setAccountTTLRequest extends GramJsInstance {
+    ttl: AccountDaysTTL;
+  }
+  interface account_sendChangePhoneCodeRequest extends GramJsInstance {
+    phoneNumber: string;
+    settings: CodeSettings;
+  }
+  interface account_changePhoneRequest extends GramJsInstance {
+    phoneNumber: string;
+    phoneCodeHash: string;
+    phoneCode: string;
+  }
+  interface account_updateDeviceLockedRequest extends GramJsInstance {
+    period: int;
+  }
+  interface account_getAuthorizationsRequest extends GramJsInstance {
+    
+  }
+  interface account_resetAuthorizationRequest extends GramJsInstance {
+    hash: long;
+  }
+  interface account_getPasswordRequest extends GramJsInstance {
+    
+  }
+  interface account_getPasswordSettingsRequest extends GramJsInstance {
+    password: InputCheckPasswordSRP;
+  }
+  interface account_updatePasswordSettingsRequest extends GramJsInstance {
+    password: InputCheckPasswordSRP;
+    newSettings: account_PasswordInputSettings;
+  }
+  interface account_sendConfirmPhoneCodeRequest extends GramJsInstance {
+    hash: string;
+    settings: CodeSettings;
+  }
+  interface account_confirmPhoneRequest extends GramJsInstance {
+    phoneCodeHash: string;
+    phoneCode: string;
+  }
+  interface account_getTmpPasswordRequest extends GramJsInstance {
+    password: InputCheckPasswordSRP;
+    period: int;
+  }
+  interface account_getWebAuthorizationsRequest extends GramJsInstance {
+    
+  }
+  interface account_resetWebAuthorizationRequest extends GramJsInstance {
+    hash: long;
+  }
+  interface account_resetWebAuthorizationsRequest extends GramJsInstance {
+    
+  }
+  interface account_getAllSecureValuesRequest extends GramJsInstance {
+    
+  }
+  interface account_getSecureValueRequest extends GramJsInstance {
+    types: SecureValueType[];
+  }
+  interface account_saveSecureValueRequest extends GramJsInstance {
+    value: InputSecureValue;
+    secureSecretId: long;
+  }
+  interface account_deleteSecureValueRequest extends GramJsInstance {
+    types: SecureValueType[];
+  }
+  interface account_getAuthorizationFormRequest extends GramJsInstance {
+    botId: int;
+    scope: string;
+    publicKey: string;
+  }
+  interface account_acceptAuthorizationRequest extends GramJsInstance {
+    botId: int;
+    scope: string;
+    publicKey: string;
+    valueHashes: SecureValueHash[];
+    credentials: SecureCredentialsEncrypted;
+  }
+  interface account_sendVerifyPhoneCodeRequest extends GramJsInstance {
+    phoneNumber: string;
+    settings: CodeSettings;
+  }
+  interface account_verifyPhoneRequest extends GramJsInstance {
+    phoneNumber: string;
+    phoneCodeHash: string;
+    phoneCode: string;
+  }
+  interface account_sendVerifyEmailCodeRequest extends GramJsInstance {
+    email: string;
+  }
+  interface account_verifyEmailRequest extends GramJsInstance {
+    email: string;
+    code: string;
+  }
+  interface account_initTakeoutSessionRequest extends GramJsInstance {
+    // flags: null;
+    contacts?: true;
+    messageUsers?: true;
+    messageChats?: true;
+    messageMegagroups?: true;
+    messageChannels?: true;
+    files?: true;
+    fileMaxSize?: int;
+  }
+  interface account_finishTakeoutSessionRequest extends GramJsInstance {
+    // flags: null;
+    success?: true;
+  }
+  interface account_confirmPasswordEmailRequest extends GramJsInstance {
+    code: string;
+  }
+  interface account_resendPasswordEmailRequest extends GramJsInstance {
+    
+  }
+  interface account_cancelPasswordEmailRequest extends GramJsInstance {
+    
+  }
+  interface account_getContactSignUpNotificationRequest extends GramJsInstance {
+    
+  }
+  interface account_setContactSignUpNotificationRequest extends GramJsInstance {
+    silent: Bool;
+  }
+  interface account_getNotifyExceptionsRequest extends GramJsInstance {
+    // flags: null;
+    compareSound?: true;
+    peer?: InputNotifyPeer;
+  }
+  interface account_getWallPaperRequest extends GramJsInstance {
+    wallpaper: InputWallPaper;
+  }
+  interface account_uploadWallPaperRequest extends GramJsInstance {
+    file: InputFile;
+    mimeType: string;
+    settings: WallPaperSettings;
+  }
+  interface account_saveWallPaperRequest extends GramJsInstance {
+    wallpaper: InputWallPaper;
+    unsave: Bool;
+    settings: WallPaperSettings;
+  }
+  interface account_installWallPaperRequest extends GramJsInstance {
+    wallpaper: InputWallPaper;
+    settings: WallPaperSettings;
+  }
+  interface account_resetWallPapersRequest extends GramJsInstance {
+    
+  }
+  interface account_getAutoDownloadSettingsRequest extends GramJsInstance {
+    
+  }
+  interface account_saveAutoDownloadSettingsRequest extends GramJsInstance {
+    // flags: null;
+    low?: true;
+    high?: true;
+    settings: AutoDownloadSettings;
+  }
+  interface account_uploadThemeRequest extends GramJsInstance {
+    // flags: null;
+    file: InputFile;
+    thumb?: InputFile;
+    fileName: string;
+    mimeType: string;
+  }
+  interface account_createThemeRequest extends GramJsInstance {
+    slug: string;
+    title: string;
+    document: InputDocument;
+  }
+  interface account_updateThemeRequest extends GramJsInstance {
+    // flags: null;
+    format: string;
+    theme: InputTheme;
+    slug?: string;
+    title?: string;
+    document?: InputDocument;
+  }
+  interface account_saveThemeRequest extends GramJsInstance {
+    theme: InputTheme;
+    unsave: Bool;
+  }
+  interface account_installThemeRequest extends GramJsInstance {
+    // flags: null;
+    dark?: true;
+    format?: string;
+    theme?: InputTheme;
+  }
+  interface account_getThemeRequest extends GramJsInstance {
+    format: string;
+    theme: InputTheme;
+    documentId: long;
+  }
+  interface account_getThemesRequest extends GramJsInstance {
+    format: string;
+    hash: int;
+  }
+  interface users_getUsersRequest extends GramJsInstance {
+    id: InputUser[];
+  }
+  interface users_getFullUserRequest extends GramJsInstance {
+    id: InputUser;
+  }
+  interface users_setSecureValueErrorsRequest extends GramJsInstance {
+    id: InputUser;
+    errors: SecureValueError[];
+  }
+  interface contacts_getContactIDsRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface contacts_getStatusesRequest extends GramJsInstance {
+    
+  }
+  interface contacts_getContactsRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface contacts_importContactsRequest extends GramJsInstance {
+    contacts: InputContact[];
+  }
+  interface contacts_deleteContactsRequest extends GramJsInstance {
+    id: InputUser[];
+  }
+  interface contacts_deleteByPhonesRequest extends GramJsInstance {
+    phones: string[];
+  }
+  interface contacts_blockRequest extends GramJsInstance {
+    id: InputUser;
+  }
+  interface contacts_unblockRequest extends GramJsInstance {
+    id: InputUser;
+  }
+  interface contacts_getBlockedRequest extends GramJsInstance {
+    offset: int;
+    limit: int;
+  }
+  interface contacts_searchRequest extends GramJsInstance {
+    q: string;
+    limit: int;
+  }
+  interface contacts_resolveUsernameRequest extends GramJsInstance {
+    username: string;
+  }
+  interface contacts_getTopPeersRequest extends GramJsInstance {
+    // flags: null;
+    correspondents?: true;
+    botsPm?: true;
+    botsInline?: true;
+    phoneCalls?: true;
+    forwardUsers?: true;
+    forwardChats?: true;
+    groups?: true;
+    channels?: true;
+    offset: int;
+    limit: int;
+    hash: int;
+  }
+  interface contacts_resetTopPeerRatingRequest extends GramJsInstance {
+    category: TopPeerCategory;
+    peer: InputPeer;
+  }
+  interface contacts_resetSavedRequest extends GramJsInstance {
+    
+  }
+  interface contacts_getSavedRequest extends GramJsInstance {
+    
+  }
+  interface contacts_toggleTopPeersRequest extends GramJsInstance {
+    enabled: Bool;
+  }
+  interface contacts_addContactRequest extends GramJsInstance {
+    // flags: null;
+    addPhonePrivacyException?: true;
+    id: InputUser;
+    firstName: string;
+    lastName: string;
+    phone: string;
+  }
+  interface contacts_acceptContactRequest extends GramJsInstance {
+    id: InputUser;
+  }
+  interface contacts_getLocatedRequest extends GramJsInstance {
+    geoPoint: InputGeoPoint;
+  }
+  interface messages_getMessagesRequest extends GramJsInstance {
+    id: InputMessage[];
+  }
+  interface messages_getDialogsRequest extends GramJsInstance {
+    // flags: null;
+    excludePinned?: true;
+    folderId?: int;
+    offsetDate: int;
+    offsetId: int;
+    offsetPeer: InputPeer;
+    limit: int;
+    hash: int;
+  }
+  interface messages_getHistoryRequest extends GramJsInstance {
+    peer: InputPeer;
+    offsetId: int;
+    offsetDate: int;
+    addOffset: int;
+    limit: int;
+    maxId: int;
+    minId: int;
+    hash: int;
+  }
+  interface messages_searchRequest extends GramJsInstance {
+    // flags: null;
+    peer: InputPeer;
+    q: string;
+    fromId?: InputUser;
+    filter: MessagesFilter;
+    minDate: int;
+    maxDate: int;
+    offsetId: int;
+    addOffset: int;
+    limit: int;
+    maxId: int;
+    minId: int;
+    hash: int;
+  }
+  interface messages_readHistoryRequest extends GramJsInstance {
+    peer: InputPeer;
+    maxId: int;
+  }
+  interface messages_deleteHistoryRequest extends GramJsInstance {
+    // flags: null;
+    justClear?: true;
+    revoke?: true;
+    peer: InputPeer;
+    maxId: int;
+  }
+  interface messages_deleteMessagesRequest extends GramJsInstance {
+    // flags: null;
+    revoke?: true;
+    id: int[];
+  }
+  interface messages_receivedMessagesRequest extends GramJsInstance {
+    maxId: int;
+  }
+  interface messages_setTypingRequest extends GramJsInstance {
+    peer: InputPeer;
+    action: SendMessageAction;
+  }
+  interface messages_sendMessageRequest extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    silent?: true;
+    background?: true;
+    clearDraft?: true;
+    peer: InputPeer;
+    replyToMsgId?: int;
+    message: string;
+    randomId: long;
+    replyMarkup?: ReplyMarkup;
+    entities?: MessageEntity[];
+    scheduleDate?: int;
+  }
+  interface messages_sendMediaRequest extends GramJsInstance {
+    // flags: null;
+    silent?: true;
+    background?: true;
+    clearDraft?: true;
+    peer: InputPeer;
+    replyToMsgId?: int;
+    media: InputMedia;
+    message: string;
+    randomId: long;
+    replyMarkup?: ReplyMarkup;
+    entities?: MessageEntity[];
+    scheduleDate?: int;
+  }
+  interface messages_forwardMessagesRequest extends GramJsInstance {
+    // flags: null;
+    silent?: true;
+    background?: true;
+    withMyScore?: true;
+    grouped?: true;
+    fromPeer: InputPeer;
+    id: int[];
+    randomId: long[];
+    toPeer: InputPeer;
+    scheduleDate?: int;
+  }
+  interface messages_reportSpamRequest extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface messages_getPeerSettingsRequest extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface messages_reportRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int[];
+    reason: ReportReason;
+  }
+  interface messages_getChatsRequest extends GramJsInstance {
+    id: int[];
+  }
+  interface messages_getFullChatRequest extends GramJsInstance {
+    chatId: int;
+  }
+  interface messages_editChatTitleRequest extends GramJsInstance {
+    chatId: int;
+    title: string;
+  }
+  interface messages_editChatPhotoRequest extends GramJsInstance {
+    chatId: int;
+    photo: InputChatPhoto;
+  }
+  interface messages_addChatUserRequest extends GramJsInstance {
+    chatId: int;
+    userId: InputUser;
+    fwdLimit: int;
+  }
+  interface messages_deleteChatUserRequest extends GramJsInstance {
+    chatId: int;
+    userId: InputUser;
+  }
+  interface messages_createChatRequest extends GramJsInstance {
+    users: InputUser[];
+    title: string;
+  }
+  interface messages_getDhConfigRequest extends GramJsInstance {
+    version: int;
+    randomLength: int;
+  }
+  interface messages_requestEncryptionRequest extends GramJsInstance {
+    userId: InputUser;
+    randomId: int;
+    gA: bytes;
+  }
+  interface messages_acceptEncryptionRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    gB: bytes;
+    keyFingerprint: long;
+  }
+  interface messages_discardEncryptionRequest extends GramJsInstance {
+    chatId: int;
+  }
+  interface messages_setEncryptedTypingRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    typing: Bool;
+  }
+  interface messages_readEncryptedHistoryRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    maxDate: int;
+  }
+  interface messages_sendEncryptedRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    randomId: long;
+    data: bytes;
+  }
+  interface messages_sendEncryptedFileRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    randomId: long;
+    data: bytes;
+    file: InputEncryptedFile;
+  }
+  interface messages_sendEncryptedServiceRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    randomId: long;
+    data: bytes;
+  }
+  interface messages_receivedQueueRequest extends GramJsInstance {
+    maxQts: int;
+  }
+  interface messages_reportEncryptedSpamRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+  }
+  interface messages_readMessageContentsRequest extends GramJsInstance {
+    id: int[];
+  }
+  interface messages_getStickersRequest extends GramJsInstance {
+    emoticon: string;
+    hash: int;
+  }
+  interface messages_getAllStickersRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface messages_getWebPagePreviewRequest extends GramJsInstance {
+    // flags: null;
+    message: string;
+    entities?: MessageEntity[];
+  }
+  interface messages_exportChatInviteRequest extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface messages_checkChatInviteRequest extends GramJsInstance {
+    hash: string;
+  }
+  interface messages_importChatInviteRequest extends GramJsInstance {
+    hash: string;
+  }
+  interface messages_getStickerSetRequest extends GramJsInstance {
+    stickerset: InputStickerSet;
+  }
+  interface messages_installStickerSetRequest extends GramJsInstance {
+    stickerset: InputStickerSet;
+    archived: Bool;
+  }
+  interface messages_uninstallStickerSetRequest extends GramJsInstance {
+    stickerset: InputStickerSet;
+  }
+  interface messages_startBotRequest extends GramJsInstance {
+    bot: InputUser;
+    peer: InputPeer;
+    randomId: long;
+    startParam: string;
+  }
+  interface messages_getMessagesViewsRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int[];
+    increment: Bool;
+  }
+  interface messages_editChatAdminRequest extends GramJsInstance {
+    chatId: int;
+    userId: InputUser;
+    isAdmin: Bool;
+  }
+  interface messages_migrateChatRequest extends GramJsInstance {
+    chatId: int;
+  }
+  interface messages_searchGlobalRequest extends GramJsInstance {
+    // flags: null;
+    folderId?: int;
+    q: string;
+    offsetRate: int;
+    offsetPeer: InputPeer;
+    offsetId: int;
+    limit: int;
+  }
+  interface messages_reorderStickerSetsRequest extends GramJsInstance {
+    // flags: null;
+    masks?: true;
+    order: long[];
+  }
+  interface messages_getDocumentByHashRequest extends GramJsInstance {
+    sha256: bytes;
+    size: int;
+    mimeType: string;
+  }
+  interface messages_searchGifsRequest extends GramJsInstance {
+    q: string;
+    offset: int;
+  }
+  interface messages_getSavedGifsRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface messages_saveGifRequest extends GramJsInstance {
+    id: InputDocument;
+    unsave: Bool;
+  }
+  interface messages_getInlineBotResultsRequest extends GramJsInstance {
+    // flags: null;
+    bot: InputUser;
+    peer: InputPeer;
+    geoPoint?: InputGeoPoint;
+    query: string;
+    offset: string;
+  }
+  interface messages_setInlineBotResultsRequest extends GramJsInstance {
+    // flags: null;
+    gallery?: true;
+    private?: true;
+    queryId: long;
+    results: InputBotInlineResult[];
+    cacheTime: int;
+    nextOffset?: string;
+    switchPm?: InlineBotSwitchPM;
+  }
+  interface messages_sendInlineBotResultRequest extends GramJsInstance {
+    // flags: null;
+    silent?: true;
+    background?: true;
+    clearDraft?: true;
+    hideVia?: true;
+    peer: InputPeer;
+    replyToMsgId?: int;
+    randomId: long;
+    queryId: long;
+    id: string;
+    scheduleDate?: int;
+  }
+  interface messages_getMessageEditDataRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int;
+  }
+  interface messages_editMessageRequest extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    peer: InputPeer;
+    id: int;
+    message?: string;
+    media?: InputMedia;
+    replyMarkup?: ReplyMarkup;
+    entities?: MessageEntity[];
+    scheduleDate?: int;
+  }
+  interface messages_editInlineBotMessageRequest extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    id: InputBotInlineMessageID;
+    message?: string;
+    media?: InputMedia;
+    replyMarkup?: ReplyMarkup;
+    entities?: MessageEntity[];
+  }
+  interface messages_getBotCallbackAnswerRequest extends GramJsInstance {
+    // flags: null;
+    game?: true;
+    peer: InputPeer;
+    msgId: int;
+    data?: bytes;
+  }
+  interface messages_setBotCallbackAnswerRequest extends GramJsInstance {
+    // flags: null;
+    alert?: true;
+    queryId: long;
+    message?: string;
+    url?: string;
+    cacheTime: int;
+  }
+  interface messages_getPeerDialogsRequest extends GramJsInstance {
+    peers: InputDialogPeer[];
+  }
+  interface messages_saveDraftRequest extends GramJsInstance {
+    // flags: null;
+    noWebpage?: true;
+    replyToMsgId?: int;
+    peer: InputPeer;
+    message: string;
+    entities?: MessageEntity[];
+  }
+  interface messages_getAllDraftsRequest extends GramJsInstance {
+    
+  }
+  interface messages_getFeaturedStickersRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface messages_readFeaturedStickersRequest extends GramJsInstance {
+    id: long[];
+  }
+  interface messages_getRecentStickersRequest extends GramJsInstance {
+    // flags: null;
+    attached?: true;
+    hash: int;
+  }
+  interface messages_saveRecentStickerRequest extends GramJsInstance {
+    // flags: null;
+    attached?: true;
+    id: InputDocument;
+    unsave: Bool;
+  }
+  interface messages_clearRecentStickersRequest extends GramJsInstance {
+    // flags: null;
+    attached?: true;
+  }
+  interface messages_getArchivedStickersRequest extends GramJsInstance {
+    // flags: null;
+    masks?: true;
+    offsetId: long;
+    limit: int;
+  }
+  interface messages_getMaskStickersRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface messages_getAttachedStickersRequest extends GramJsInstance {
+    media: InputStickeredMedia;
+  }
+  interface messages_setGameScoreRequest extends GramJsInstance {
+    // flags: null;
+    editMessage?: true;
+    force?: true;
+    peer: InputPeer;
+    id: int;
+    userId: InputUser;
+    score: int;
+  }
+  interface messages_setInlineGameScoreRequest extends GramJsInstance {
+    // flags: null;
+    editMessage?: true;
+    force?: true;
+    id: InputBotInlineMessageID;
+    userId: InputUser;
+    score: int;
+  }
+  interface messages_getGameHighScoresRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int;
+    userId: InputUser;
+  }
+  interface messages_getInlineGameHighScoresRequest extends GramJsInstance {
+    id: InputBotInlineMessageID;
+    userId: InputUser;
+  }
+  interface messages_getCommonChatsRequest extends GramJsInstance {
+    userId: InputUser;
+    maxId: int;
+    limit: int;
+  }
+  interface messages_getAllChatsRequest extends GramJsInstance {
+    exceptIds: int[];
+  }
+  interface messages_getWebPageRequest extends GramJsInstance {
+    url: string;
+    hash: int;
+  }
+  interface messages_toggleDialogPinRequest extends GramJsInstance {
+    // flags: null;
+    pinned?: true;
+    peer: InputDialogPeer;
+  }
+  interface messages_reorderPinnedDialogsRequest extends GramJsInstance {
+    // flags: null;
+    force?: true;
+    folderId: int;
+    order: InputDialogPeer[];
+  }
+  interface messages_getPinnedDialogsRequest extends GramJsInstance {
+    folderId: int;
+  }
+  interface messages_setBotShippingResultsRequest extends GramJsInstance {
+    // flags: null;
+    queryId: long;
+    error?: string;
+    shippingOptions?: ShippingOption[];
+  }
+  interface messages_setBotPrecheckoutResultsRequest extends GramJsInstance {
+    // flags: null;
+    success?: true;
+    queryId: long;
+    error?: string;
+  }
+  interface messages_uploadMediaRequest extends GramJsInstance {
+    peer: InputPeer;
+    media: InputMedia;
+  }
+  interface messages_sendScreenshotNotificationRequest extends GramJsInstance {
+    peer: InputPeer;
+    replyToMsgId: int;
+    randomId: long;
+  }
+  interface messages_getFavedStickersRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface messages_faveStickerRequest extends GramJsInstance {
+    id: InputDocument;
+    unfave: Bool;
+  }
+  interface messages_getUnreadMentionsRequest extends GramJsInstance {
+    peer: InputPeer;
+    offsetId: int;
+    addOffset: int;
+    limit: int;
+    maxId: int;
+    minId: int;
+  }
+  interface messages_readMentionsRequest extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface messages_getRecentLocationsRequest extends GramJsInstance {
+    peer: InputPeer;
+    limit: int;
+    hash: int;
+  }
+  interface messages_sendMultiMediaRequest extends GramJsInstance {
+    // flags: null;
+    silent?: true;
+    background?: true;
+    clearDraft?: true;
+    peer: InputPeer;
+    replyToMsgId?: int;
+    multiMedia: InputSingleMedia[];
+    scheduleDate?: int;
+  }
+  interface messages_uploadEncryptedFileRequest extends GramJsInstance {
+    peer: InputEncryptedChat;
+    file: InputEncryptedFile;
+  }
+  interface messages_searchStickerSetsRequest extends GramJsInstance {
+    // flags: null;
+    excludeFeatured?: true;
+    q: string;
+    hash: int;
+  }
+  interface messages_getSplitRangesRequest extends GramJsInstance {
+    
+  }
+  interface messages_markDialogUnreadRequest extends GramJsInstance {
+    // flags: null;
+    unread?: true;
+    peer: InputDialogPeer;
+  }
+  interface messages_getDialogUnreadMarksRequest extends GramJsInstance {
+    
+  }
+  interface messages_clearAllDraftsRequest extends GramJsInstance {
+    
+  }
+  interface messages_updatePinnedMessageRequest extends GramJsInstance {
+    // flags: null;
+    silent?: true;
+    peer: InputPeer;
+    id: int;
+  }
+  interface messages_sendVoteRequest extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+    options: bytes[];
+  }
+  interface messages_getPollResultsRequest extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+  }
+  interface messages_getOnlinesRequest extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface messages_getStatsURLRequest extends GramJsInstance {
+    // flags: null;
+    dark?: true;
+    peer: InputPeer;
+    params: string;
+  }
+  interface messages_editChatAboutRequest extends GramJsInstance {
+    peer: InputPeer;
+    about: string;
+  }
+  interface messages_editChatDefaultBannedRightsRequest extends GramJsInstance {
+    peer: InputPeer;
+    bannedRights: ChatBannedRights;
+  }
+  interface messages_getEmojiKeywordsRequest extends GramJsInstance {
+    langCode: string;
+  }
+  interface messages_getEmojiKeywordsDifferenceRequest extends GramJsInstance {
+    langCode: string;
+    fromVersion: int;
+  }
+  interface messages_getEmojiKeywordsLanguagesRequest extends GramJsInstance {
+    langCodes: string[];
+  }
+  interface messages_getEmojiURLRequest extends GramJsInstance {
+    langCode: string;
+  }
+  interface messages_getSearchCountersRequest extends GramJsInstance {
+    peer: InputPeer;
+    filters: MessagesFilter[];
+  }
+  interface messages_requestUrlAuthRequest extends GramJsInstance {
+    peer: InputPeer;
+    msgId: int;
+    buttonId: int;
+  }
+  interface messages_acceptUrlAuthRequest extends GramJsInstance {
+    // flags: null;
+    writeAllowed?: true;
+    peer: InputPeer;
+    msgId: int;
+    buttonId: int;
+  }
+  interface messages_hidePeerSettingsBarRequest extends GramJsInstance {
+    peer: InputPeer;
+  }
+  interface messages_getScheduledHistoryRequest extends GramJsInstance {
+    peer: InputPeer;
+    hash: int;
+  }
+  interface messages_getScheduledMessagesRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int[];
+  }
+  interface messages_sendScheduledMessagesRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int[];
+  }
+  interface messages_deleteScheduledMessagesRequest extends GramJsInstance {
+    peer: InputPeer;
+    id: int[];
+  }
+  interface updates_getStateRequest extends GramJsInstance {
+    
+  }
+  interface updates_getDifferenceRequest extends GramJsInstance {
+    // flags: null;
+    pts: int;
+    ptsTotalLimit?: int;
+    date: int;
+    qts: int;
+  }
+  interface updates_getChannelDifferenceRequest extends GramJsInstance {
+    // flags: null;
+    force?: true;
+    channel: InputChannel;
+    filter: ChannelMessagesFilter;
+    pts: int;
+    limit: int;
+  }
+  interface photos_updateProfilePhotoRequest extends GramJsInstance {
+    id: InputPhoto;
+  }
+  interface photos_uploadProfilePhotoRequest extends GramJsInstance {
+    file: InputFile;
+  }
+  interface photos_deletePhotosRequest extends GramJsInstance {
+    id: InputPhoto[];
+  }
+  interface photos_getUserPhotosRequest extends GramJsInstance {
+    userId: InputUser;
+    offset: int;
+    maxId: long;
+    limit: int;
+  }
+  interface upload_saveFilePartRequest extends GramJsInstance {
+    fileId: long;
+    filePart: int;
+    bytes: bytes;
+  }
+  interface upload_getFileRequest extends GramJsInstance {
+    // flags: null;
+    precise?: true;
+    location: InputFileLocation;
+    offset: int;
+    limit: int;
+  }
+  interface upload_saveBigFilePartRequest extends GramJsInstance {
+    fileId: long;
+    filePart: int;
+    fileTotalParts: int;
+    bytes: bytes;
+  }
+  interface upload_getWebFileRequest extends GramJsInstance {
+    location: InputWebFileLocation;
+    offset: int;
+    limit: int;
+  }
+  interface upload_getCdnFileRequest extends GramJsInstance {
+    fileToken: bytes;
+    offset: int;
+    limit: int;
+  }
+  interface upload_reuploadCdnFileRequest extends GramJsInstance {
+    fileToken: bytes;
+    requestToken: bytes;
+  }
+  interface upload_getCdnFileHashesRequest extends GramJsInstance {
+    fileToken: bytes;
+    offset: int;
+  }
+  interface upload_getFileHashesRequest extends GramJsInstance {
+    location: InputFileLocation;
+    offset: int;
+  }
+  interface help_getConfigRequest extends GramJsInstance {
+    
+  }
+  interface help_getNearestDcRequest extends GramJsInstance {
+    
+  }
+  interface help_getAppUpdateRequest extends GramJsInstance {
+    source: string;
+  }
+  interface help_getInviteTextRequest extends GramJsInstance {
+    
+  }
+  interface help_getSupportRequest extends GramJsInstance {
+    
+  }
+  interface help_getAppChangelogRequest extends GramJsInstance {
+    prevAppVersion: string;
+  }
+  interface help_setBotUpdatesStatusRequest extends GramJsInstance {
+    pendingUpdatesCount: int;
+    message: string;
+  }
+  interface help_getCdnConfigRequest extends GramJsInstance {
+    
+  }
+  interface help_getRecentMeUrlsRequest extends GramJsInstance {
+    referer: string;
+  }
+  interface help_getProxyDataRequest extends GramJsInstance {
+    
+  }
+  interface help_getTermsOfServiceUpdateRequest extends GramJsInstance {
+    
+  }
+  interface help_acceptTermsOfServiceRequest extends GramJsInstance {
+    id: DataJSON;
+  }
+  interface help_getDeepLinkInfoRequest extends GramJsInstance {
+    path: string;
+  }
+  interface help_getAppConfigRequest extends GramJsInstance {
+    
+  }
+  interface help_saveAppLogRequest extends GramJsInstance {
+    events: InputAppEvent[];
+  }
+  interface help_getPassportConfigRequest extends GramJsInstance {
+    hash: int;
+  }
+  interface help_getSupportNameRequest extends GramJsInstance {
+    
+  }
+  interface help_getUserInfoRequest extends GramJsInstance {
+    userId: InputUser;
+  }
+  interface help_editUserInfoRequest extends GramJsInstance {
+    userId: InputUser;
+    message: string;
+    entities: MessageEntity[];
+  }
+  interface channels_readHistoryRequest extends GramJsInstance {
+    channel: InputChannel;
+    maxId: int;
+  }
+  interface channels_deleteMessagesRequest extends GramJsInstance {
+    channel: InputChannel;
+    id: int[];
+  }
+  interface channels_deleteUserHistoryRequest extends GramJsInstance {
+    channel: InputChannel;
+    userId: InputUser;
+  }
+  interface channels_reportSpamRequest extends GramJsInstance {
+    channel: InputChannel;
+    userId: InputUser;
+    id: int[];
+  }
+  interface channels_getMessagesRequest extends GramJsInstance {
+    channel: InputChannel;
+    id: InputMessage[];
+  }
+  interface channels_getParticipantsRequest extends GramJsInstance {
+    channel: InputChannel;
+    filter: ChannelParticipantsFilter;
+    offset: int;
+    limit: int;
+    hash: int;
+  }
+  interface channels_getParticipantRequest extends GramJsInstance {
+    channel: InputChannel;
+    userId: InputUser;
+  }
+  interface channels_getChannelsRequest extends GramJsInstance {
+    id: InputChannel[];
+  }
+  interface channels_getFullChannelRequest extends GramJsInstance {
+    channel: InputChannel;
+  }
+  interface channels_createChannelRequest extends GramJsInstance {
+    // flags: null;
+    broadcast?: true;
+    megagroup?: true;
+    title: string;
+    about: string;
+    geoPoint?: InputGeoPoint;
+    address?: string;
+  }
+  interface channels_editAdminRequest extends GramJsInstance {
+    channel: InputChannel;
+    userId: InputUser;
+    adminRights: ChatAdminRights;
+    rank: string;
+  }
+  interface channels_editTitleRequest extends GramJsInstance {
+    channel: InputChannel;
+    title: string;
+  }
+  interface channels_editPhotoRequest extends GramJsInstance {
+    channel: InputChannel;
+    photo: InputChatPhoto;
+  }
+  interface channels_checkUsernameRequest extends GramJsInstance {
+    channel: InputChannel;
+    username: string;
+  }
+  interface channels_updateUsernameRequest extends GramJsInstance {
+    channel: InputChannel;
+    username: string;
+  }
+  interface channels_joinChannelRequest extends GramJsInstance {
+    channel: InputChannel;
+  }
+  interface channels_leaveChannelRequest extends GramJsInstance {
+    channel: InputChannel;
+  }
+  interface channels_inviteToChannelRequest extends GramJsInstance {
+    channel: InputChannel;
+    users: InputUser[];
+  }
+  interface channels_deleteChannelRequest extends GramJsInstance {
+    channel: InputChannel;
+  }
+  interface channels_exportMessageLinkRequest extends GramJsInstance {
+    channel: InputChannel;
+    id: int;
+    grouped: Bool;
+  }
+  interface channels_toggleSignaturesRequest extends GramJsInstance {
+    channel: InputChannel;
+    enabled: Bool;
+  }
+  interface channels_getAdminedPublicChannelsRequest extends GramJsInstance {
+    // flags: null;
+    byLocation?: true;
+    checkLimit?: true;
+  }
+  interface channels_editBannedRequest extends GramJsInstance {
+    channel: InputChannel;
+    userId: InputUser;
+    bannedRights: ChatBannedRights;
+  }
+  interface channels_getAdminLogRequest extends GramJsInstance {
+    // flags: null;
+    channel: InputChannel;
+    q: string;
+    eventsFilter?: ChannelAdminLogEventsFilter;
+    admins?: InputUser[];
+    maxId: long;
+    minId: long;
+    limit: int;
+  }
+  interface channels_setStickersRequest extends GramJsInstance {
+    channel: InputChannel;
+    stickerset: InputStickerSet;
+  }
+  interface channels_readMessageContentsRequest extends GramJsInstance {
+    channel: InputChannel;
+    id: int[];
+  }
+  interface channels_deleteHistoryRequest extends GramJsInstance {
+    channel: InputChannel;
+    maxId: int;
+  }
+  interface channels_togglePreHistoryHiddenRequest extends GramJsInstance {
+    channel: InputChannel;
+    enabled: Bool;
+  }
+  interface channels_getLeftChannelsRequest extends GramJsInstance {
+    offset: int;
+  }
+  interface channels_getGroupsForDiscussionRequest extends GramJsInstance {
+    
+  }
+  interface channels_setDiscussionGroupRequest extends GramJsInstance {
+    broadcast: InputChannel;
+    group: InputChannel;
+  }
+  interface channels_editCreatorRequest extends GramJsInstance {
+    channel: InputChannel;
+    userId: InputUser;
+    password: InputCheckPasswordSRP;
+  }
+  interface channels_editLocationRequest extends GramJsInstance {
+    channel: InputChannel;
+    geoPoint: InputGeoPoint;
+    address: string;
+  }
+  interface channels_toggleSlowModeRequest extends GramJsInstance {
+    channel: InputChannel;
+    seconds: int;
+  }
+  interface bots_sendCustomRequestRequest extends GramJsInstance {
+    customMethod: string;
+    params: DataJSON;
+  }
+  interface bots_answerWebhookJSONQueryRequest extends GramJsInstance {
+    queryId: long;
+    data: DataJSON;
+  }
+  interface payments_getPaymentFormRequest extends GramJsInstance {
+    msgId: int;
+  }
+  interface payments_getPaymentReceiptRequest extends GramJsInstance {
+    msgId: int;
+  }
+  interface payments_validateRequestedInfoRequest extends GramJsInstance {
+    // flags: null;
+    save?: true;
+    msgId: int;
+    info: PaymentRequestedInfo;
+  }
+  interface payments_sendPaymentFormRequest extends GramJsInstance {
+    // flags: null;
+    msgId: int;
+    requestedInfoId?: string;
+    shippingOptionId?: string;
+    credentials: InputPaymentCredentials;
+  }
+  interface payments_getSavedInfoRequest extends GramJsInstance {
+    
+  }
+  interface payments_clearSavedInfoRequest extends GramJsInstance {
+    // flags: null;
+    credentials?: true;
+    info?: true;
+  }
+  interface stickers_createStickerSetRequest extends GramJsInstance {
+    // flags: null;
+    masks?: true;
+    userId: InputUser;
+    title: string;
+    shortName: string;
+    stickers: InputStickerSetItem[];
+  }
+  interface stickers_removeStickerFromSetRequest extends GramJsInstance {
+    sticker: InputDocument;
+  }
+  interface stickers_changeStickerPositionRequest extends GramJsInstance {
+    sticker: InputDocument;
+    position: int;
+  }
+  interface stickers_addStickerToSetRequest extends GramJsInstance {
+    stickerset: InputStickerSet;
+    sticker: InputStickerSetItem;
+  }
+  interface phone_getCallConfigRequest extends GramJsInstance {
+    
+  }
+  interface phone_requestCallRequest extends GramJsInstance {
+    // flags: null;
+    video?: true;
+    userId: InputUser;
+    randomId: int;
+    gAHash: bytes;
+    protocol: PhoneCallProtocol;
+  }
+  interface phone_acceptCallRequest extends GramJsInstance {
+    peer: InputPhoneCall;
+    gB: bytes;
+    protocol: PhoneCallProtocol;
+  }
+  interface phone_confirmCallRequest extends GramJsInstance {
+    peer: InputPhoneCall;
+    gA: bytes;
+    keyFingerprint: long;
+    protocol: PhoneCallProtocol;
+  }
+  interface phone_receivedCallRequest extends GramJsInstance {
+    peer: InputPhoneCall;
+  }
+  interface phone_discardCallRequest extends GramJsInstance {
+    // flags: null;
+    video?: true;
+    peer: InputPhoneCall;
+    duration: int;
+    reason: PhoneCallDiscardReason;
+    connectionId: long;
+  }
+  interface phone_setCallRatingRequest extends GramJsInstance {
+    // flags: null;
+    userInitiative?: true;
+    peer: InputPhoneCall;
+    rating: int;
+    comment: string;
+  }
+  interface phone_saveCallDebugRequest extends GramJsInstance {
+    peer: InputPhoneCall;
+    debug: DataJSON;
+  }
+  interface langpack_getLangPackRequest extends GramJsInstance {
+    langPack: string;
+    langCode: string;
+  }
+  interface langpack_getStringsRequest extends GramJsInstance {
+    langPack: string;
+    langCode: string;
+    keys: string[];
+  }
+  interface langpack_getDifferenceRequest extends GramJsInstance {
+    langPack: string;
+    langCode: string;
+    fromVersion: int;
+  }
+  interface langpack_getLanguagesRequest extends GramJsInstance {
+    langPack: string;
+  }
+  interface langpack_getLanguageRequest extends GramJsInstance {
+    langPack: string;
+    langCode: string;
+  }
+  interface folders_editPeerFoldersRequest extends GramJsInstance {
+    folderPeers: InputFolderPeer[];
+  }
+  interface folders_deleteFolderRequest extends GramJsInstance {
+    folderId: int;
+  }
+  interface reqPqRequest extends GramJsInstance {
+    nonce: int128;
+  }
+  interface reqPqMultiRequest extends GramJsInstance {
+    nonce: int128;
+  }
+  interface reqDHParamsRequest extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    p: bytes;
+    q: bytes;
+    publicKeyFingerprint: long;
+    encryptedData: bytes;
+  }
+  interface setClientDHParamsRequest extends GramJsInstance {
+    nonce: int128;
+    serverNonce: int128;
+    encryptedData: bytes;
+  }
+  interface destroyAuthKeyRequest extends GramJsInstance {
+    
+  }
+  interface rpcDropAnswerRequest extends GramJsInstance {
+    reqMsgId: long;
+  }
+  interface getFutureSaltsRequest extends GramJsInstance {
+    num: int;
+  }
+  interface pingRequest extends GramJsInstance {
+    pingId: long;
+  }
+  interface pingDelayDisconnectRequest extends GramJsInstance {
+    pingId: long;
+    disconnectDelay: int;
+  }
+  interface destroySessionRequest extends GramJsInstance {
+    sessionId: long;
+  }
+
+}
+
+// For some reason when `interface TlRequest extends TlConstructor`,
+// the `InstanceType<TlRequest>` refers to the parent class (`TlConstructor`) instance.
+interface TlCommon<Args extends AnyLiteral> {
+  serializeBytes(data: Buffer | string): Buffer;
+
+  serializeDate(date: Date | number): Buffer;
+
+  fromReader(reader: Reader): GramJsInstance & Args;
+}
+
+interface TlConstructor<Args> extends TlCommon<Args> {
+  new(args: Args): GramJsInstance & Args;
+}
+
+interface TlRequest<Args, Response> extends TlCommon<Args> {
+  new(args: Args): GramJsInstance & Args & {
+    className: string;
+    classType: 'request';
+
+    __response: Response;
+  };
+
+  className: string;
+  classType: 'request';
+
+  readResult(reader: Reader): Buffer;
+
+  resolve(client: Client, utils: Utils): Promise<void>;
+}
+
+interface Constructors {
+  InputPeerEmpty: TlConstructor<ToArgs<MTProto.inputPeerEmpty>>
+  InputPeerSelf: TlConstructor<ToArgs<MTProto.inputPeerSelf>>
+  InputPeerChat: TlConstructor<ToArgs<MTProto.inputPeerChat>>
+  InputPeerUser: TlConstructor<ToArgs<MTProto.inputPeerUser>>
+  InputPeerChannel: TlConstructor<ToArgs<MTProto.inputPeerChannel>>
+  InputPeerUserFromMessage: TlConstructor<ToArgs<MTProto.inputPeerUserFromMessage>>
+  InputPeerChannelFromMessage: TlConstructor<ToArgs<MTProto.inputPeerChannelFromMessage>>
+  InputUserEmpty: TlConstructor<ToArgs<MTProto.inputUserEmpty>>
+  InputUserSelf: TlConstructor<ToArgs<MTProto.inputUserSelf>>
+  InputUser: TlConstructor<ToArgs<MTProto.inputUser>>
+  InputUserFromMessage: TlConstructor<ToArgs<MTProto.inputUserFromMessage>>
+  InputPhoneContact: TlConstructor<ToArgs<MTProto.inputPhoneContact>>
+  InputFile: TlConstructor<ToArgs<MTProto.inputFile>>
+  InputFileBig: TlConstructor<ToArgs<MTProto.inputFileBig>>
+  InputMediaEmpty: TlConstructor<ToArgs<MTProto.inputMediaEmpty>>
+  InputMediaUploadedPhoto: TlConstructor<ToArgs<MTProto.inputMediaUploadedPhoto>>
+  InputMediaPhoto: TlConstructor<ToArgs<MTProto.inputMediaPhoto>>
+  InputMediaGeoPoint: TlConstructor<ToArgs<MTProto.inputMediaGeoPoint>>
+  InputMediaContact: TlConstructor<ToArgs<MTProto.inputMediaContact>>
+  InputMediaUploadedDocument: TlConstructor<ToArgs<MTProto.inputMediaUploadedDocument>>
+  InputMediaDocument: TlConstructor<ToArgs<MTProto.inputMediaDocument>>
+  InputMediaVenue: TlConstructor<ToArgs<MTProto.inputMediaVenue>>
+  InputMediaGifExternal: TlConstructor<ToArgs<MTProto.inputMediaGifExternal>>
+  InputMediaPhotoExternal: TlConstructor<ToArgs<MTProto.inputMediaPhotoExternal>>
+  InputMediaDocumentExternal: TlConstructor<ToArgs<MTProto.inputMediaDocumentExternal>>
+  InputMediaGame: TlConstructor<ToArgs<MTProto.inputMediaGame>>
+  InputMediaInvoice: TlConstructor<ToArgs<MTProto.inputMediaInvoice>>
+  InputMediaGeoLive: TlConstructor<ToArgs<MTProto.inputMediaGeoLive>>
+  InputMediaPoll: TlConstructor<ToArgs<MTProto.inputMediaPoll>>
+  InputChatPhotoEmpty: TlConstructor<ToArgs<MTProto.inputChatPhotoEmpty>>
+  InputChatUploadedPhoto: TlConstructor<ToArgs<MTProto.inputChatUploadedPhoto>>
+  InputChatPhoto: TlConstructor<ToArgs<MTProto.inputChatPhoto>>
+  InputGeoPointEmpty: TlConstructor<ToArgs<MTProto.inputGeoPointEmpty>>
+  InputGeoPoint: TlConstructor<ToArgs<MTProto.inputGeoPoint>>
+  InputPhotoEmpty: TlConstructor<ToArgs<MTProto.inputPhotoEmpty>>
+  InputPhoto: TlConstructor<ToArgs<MTProto.inputPhoto>>
+  InputFileLocation: TlConstructor<ToArgs<MTProto.inputFileLocation>>
+  InputEncryptedFileLocation: TlConstructor<ToArgs<MTProto.inputEncryptedFileLocation>>
+  InputDocumentFileLocation: TlConstructor<ToArgs<MTProto.inputDocumentFileLocation>>
+  InputSecureFileLocation: TlConstructor<ToArgs<MTProto.inputSecureFileLocation>>
+  InputTakeoutFileLocation: TlConstructor<ToArgs<MTProto.inputTakeoutFileLocation>>
+  InputPhotoFileLocation: TlConstructor<ToArgs<MTProto.inputPhotoFileLocation>>
+  InputPeerPhotoFileLocation: TlConstructor<ToArgs<MTProto.inputPeerPhotoFileLocation>>
+  InputStickerSetThumb: TlConstructor<ToArgs<MTProto.inputStickerSetThumb>>
+  PeerUser: TlConstructor<ToArgs<MTProto.peerUser>>
+  PeerChat: TlConstructor<ToArgs<MTProto.peerChat>>
+  PeerChannel: TlConstructor<ToArgs<MTProto.peerChannel>>
+  UserEmpty: TlConstructor<ToArgs<MTProto.userEmpty>>
+  User: TlConstructor<ToArgs<MTProto.user>>
+  UserProfilePhotoEmpty: TlConstructor<ToArgs<MTProto.userProfilePhotoEmpty>>
+  UserProfilePhoto: TlConstructor<ToArgs<MTProto.userProfilePhoto>>
+  UserStatusEmpty: TlConstructor<ToArgs<MTProto.userStatusEmpty>>
+  UserStatusOnline: TlConstructor<ToArgs<MTProto.userStatusOnline>>
+  UserStatusOffline: TlConstructor<ToArgs<MTProto.userStatusOffline>>
+  UserStatusRecently: TlConstructor<ToArgs<MTProto.userStatusRecently>>
+  UserStatusLastWeek: TlConstructor<ToArgs<MTProto.userStatusLastWeek>>
+  UserStatusLastMonth: TlConstructor<ToArgs<MTProto.userStatusLastMonth>>
+  ChatEmpty: TlConstructor<ToArgs<MTProto.chatEmpty>>
+  Chat: TlConstructor<ToArgs<MTProto.chat>>
+  ChatForbidden: TlConstructor<ToArgs<MTProto.chatForbidden>>
+  Channel: TlConstructor<ToArgs<MTProto.channel>>
+  ChannelForbidden: TlConstructor<ToArgs<MTProto.channelForbidden>>
+  ChatFull: TlConstructor<ToArgs<MTProto.chatFull>>
+  ChannelFull: TlConstructor<ToArgs<MTProto.channelFull>>
+  ChatParticipant: TlConstructor<ToArgs<MTProto.chatParticipant>>
+  ChatParticipantCreator: TlConstructor<ToArgs<MTProto.chatParticipantCreator>>
+  ChatParticipantAdmin: TlConstructor<ToArgs<MTProto.chatParticipantAdmin>>
+  ChatParticipantsForbidden: TlConstructor<ToArgs<MTProto.chatParticipantsForbidden>>
+  ChatParticipants: TlConstructor<ToArgs<MTProto.chatParticipants>>
+  ChatPhotoEmpty: TlConstructor<ToArgs<MTProto.chatPhotoEmpty>>
+  ChatPhoto: TlConstructor<ToArgs<MTProto.chatPhoto>>
+  MessageEmpty: TlConstructor<ToArgs<MTProto.messageEmpty>>
+  Message: TlConstructor<ToArgs<MTProto.message>>
+  MessageService: TlConstructor<ToArgs<MTProto.messageService>>
+  MessageMediaEmpty: TlConstructor<ToArgs<MTProto.messageMediaEmpty>>
+  MessageMediaPhoto: TlConstructor<ToArgs<MTProto.messageMediaPhoto>>
+  MessageMediaGeo: TlConstructor<ToArgs<MTProto.messageMediaGeo>>
+  MessageMediaContact: TlConstructor<ToArgs<MTProto.messageMediaContact>>
+  MessageMediaUnsupported: TlConstructor<ToArgs<MTProto.messageMediaUnsupported>>
+  MessageMediaDocument: TlConstructor<ToArgs<MTProto.messageMediaDocument>>
+  MessageMediaWebPage: TlConstructor<ToArgs<MTProto.messageMediaWebPage>>
+  MessageMediaVenue: TlConstructor<ToArgs<MTProto.messageMediaVenue>>
+  MessageMediaGame: TlConstructor<ToArgs<MTProto.messageMediaGame>>
+  MessageMediaInvoice: TlConstructor<ToArgs<MTProto.messageMediaInvoice>>
+  MessageMediaGeoLive: TlConstructor<ToArgs<MTProto.messageMediaGeoLive>>
+  MessageMediaPoll: TlConstructor<ToArgs<MTProto.messageMediaPoll>>
+  MessageActionEmpty: TlConstructor<ToArgs<MTProto.messageActionEmpty>>
+  MessageActionChatCreate: TlConstructor<ToArgs<MTProto.messageActionChatCreate>>
+  MessageActionChatEditTitle: TlConstructor<ToArgs<MTProto.messageActionChatEditTitle>>
+  MessageActionChatEditPhoto: TlConstructor<ToArgs<MTProto.messageActionChatEditPhoto>>
+  MessageActionChatDeletePhoto: TlConstructor<ToArgs<MTProto.messageActionChatDeletePhoto>>
+  MessageActionChatAddUser: TlConstructor<ToArgs<MTProto.messageActionChatAddUser>>
+  MessageActionChatDeleteUser: TlConstructor<ToArgs<MTProto.messageActionChatDeleteUser>>
+  MessageActionChatJoinedByLink: TlConstructor<ToArgs<MTProto.messageActionChatJoinedByLink>>
+  MessageActionChannelCreate: TlConstructor<ToArgs<MTProto.messageActionChannelCreate>>
+  MessageActionChatMigrateTo: TlConstructor<ToArgs<MTProto.messageActionChatMigrateTo>>
+  MessageActionChannelMigrateFrom: TlConstructor<ToArgs<MTProto.messageActionChannelMigrateFrom>>
+  MessageActionPinMessage: TlConstructor<ToArgs<MTProto.messageActionPinMessage>>
+  MessageActionHistoryClear: TlConstructor<ToArgs<MTProto.messageActionHistoryClear>>
+  MessageActionGameScore: TlConstructor<ToArgs<MTProto.messageActionGameScore>>
+  MessageActionPaymentSentMe: TlConstructor<ToArgs<MTProto.messageActionPaymentSentMe>>
+  MessageActionPaymentSent: TlConstructor<ToArgs<MTProto.messageActionPaymentSent>>
+  MessageActionPhoneCall: TlConstructor<ToArgs<MTProto.messageActionPhoneCall>>
+  MessageActionScreenshotTaken: TlConstructor<ToArgs<MTProto.messageActionScreenshotTaken>>
+  MessageActionCustomAction: TlConstructor<ToArgs<MTProto.messageActionCustomAction>>
+  MessageActionBotAllowed: TlConstructor<ToArgs<MTProto.messageActionBotAllowed>>
+  MessageActionSecureValuesSentMe: TlConstructor<ToArgs<MTProto.messageActionSecureValuesSentMe>>
+  MessageActionSecureValuesSent: TlConstructor<ToArgs<MTProto.messageActionSecureValuesSent>>
+  MessageActionContactSignUp: TlConstructor<ToArgs<MTProto.messageActionContactSignUp>>
+  Dialog: TlConstructor<ToArgs<MTProto.dialog>>
+  DialogFolder: TlConstructor<ToArgs<MTProto.dialogFolder>>
+  PhotoEmpty: TlConstructor<ToArgs<MTProto.photoEmpty>>
+  Photo: TlConstructor<ToArgs<MTProto.photo>>
+  PhotoSizeEmpty: TlConstructor<ToArgs<MTProto.photoSizeEmpty>>
+  PhotoSize: TlConstructor<ToArgs<MTProto.photoSize>>
+  PhotoCachedSize: TlConstructor<ToArgs<MTProto.photoCachedSize>>
+  PhotoStrippedSize: TlConstructor<ToArgs<MTProto.photoStrippedSize>>
+  GeoPointEmpty: TlConstructor<ToArgs<MTProto.geoPointEmpty>>
+  GeoPoint: TlConstructor<ToArgs<MTProto.geoPoint>>
+  InputNotifyPeer: TlConstructor<ToArgs<MTProto.inputNotifyPeer>>
+  InputNotifyUsers: TlConstructor<ToArgs<MTProto.inputNotifyUsers>>
+  InputNotifyChats: TlConstructor<ToArgs<MTProto.inputNotifyChats>>
+  InputNotifyBroadcasts: TlConstructor<ToArgs<MTProto.inputNotifyBroadcasts>>
+  InputPeerNotifySettings: TlConstructor<ToArgs<MTProto.inputPeerNotifySettings>>
+  PeerNotifySettings: TlConstructor<ToArgs<MTProto.peerNotifySettings>>
+  PeerSettings: TlConstructor<ToArgs<MTProto.peerSettings>>
+  WallPaper: TlConstructor<ToArgs<MTProto.wallPaper>>
+  InputReportReasonSpam: TlConstructor<ToArgs<MTProto.inputReportReasonSpam>>
+  InputReportReasonViolence: TlConstructor<ToArgs<MTProto.inputReportReasonViolence>>
+  InputReportReasonPornography: TlConstructor<ToArgs<MTProto.inputReportReasonPornography>>
+  InputReportReasonChildAbuse: TlConstructor<ToArgs<MTProto.inputReportReasonChildAbuse>>
+  InputReportReasonOther: TlConstructor<ToArgs<MTProto.inputReportReasonOther>>
+  InputReportReasonCopyright: TlConstructor<ToArgs<MTProto.inputReportReasonCopyright>>
+  InputReportReasonGeoIrrelevant: TlConstructor<ToArgs<MTProto.inputReportReasonGeoIrrelevant>>
+  UserFull: TlConstructor<ToArgs<MTProto.userFull>>
+  Contact: TlConstructor<ToArgs<MTProto.contact>>
+  ImportedContact: TlConstructor<ToArgs<MTProto.importedContact>>
+  ContactBlocked: TlConstructor<ToArgs<MTProto.contactBlocked>>
+  ContactStatus: TlConstructor<ToArgs<MTProto.contactStatus>>
+  InputMessagesFilterEmpty: TlConstructor<ToArgs<MTProto.inputMessagesFilterEmpty>>
+  InputMessagesFilterPhotos: TlConstructor<ToArgs<MTProto.inputMessagesFilterPhotos>>
+  InputMessagesFilterVideo: TlConstructor<ToArgs<MTProto.inputMessagesFilterVideo>>
+  InputMessagesFilterPhotoVideo: TlConstructor<ToArgs<MTProto.inputMessagesFilterPhotoVideo>>
+  InputMessagesFilterDocument: TlConstructor<ToArgs<MTProto.inputMessagesFilterDocument>>
+  InputMessagesFilterUrl: TlConstructor<ToArgs<MTProto.inputMessagesFilterUrl>>
+  InputMessagesFilterGif: TlConstructor<ToArgs<MTProto.inputMessagesFilterGif>>
+  InputMessagesFilterVoice: TlConstructor<ToArgs<MTProto.inputMessagesFilterVoice>>
+  InputMessagesFilterMusic: TlConstructor<ToArgs<MTProto.inputMessagesFilterMusic>>
+  InputMessagesFilterChatPhotos: TlConstructor<ToArgs<MTProto.inputMessagesFilterChatPhotos>>
+  InputMessagesFilterPhoneCalls: TlConstructor<ToArgs<MTProto.inputMessagesFilterPhoneCalls>>
+  InputMessagesFilterRoundVoice: TlConstructor<ToArgs<MTProto.inputMessagesFilterRoundVoice>>
+  InputMessagesFilterRoundVideo: TlConstructor<ToArgs<MTProto.inputMessagesFilterRoundVideo>>
+  InputMessagesFilterMyMentions: TlConstructor<ToArgs<MTProto.inputMessagesFilterMyMentions>>
+  InputMessagesFilterGeo: TlConstructor<ToArgs<MTProto.inputMessagesFilterGeo>>
+  InputMessagesFilterContacts: TlConstructor<ToArgs<MTProto.inputMessagesFilterContacts>>
+  UpdateNewMessage: TlConstructor<ToArgs<MTProto.updateNewMessage>>
+  UpdateMessageID: TlConstructor<ToArgs<MTProto.updateMessageID>>
+  UpdateDeleteMessages: TlConstructor<ToArgs<MTProto.updateDeleteMessages>>
+  UpdateUserTyping: TlConstructor<ToArgs<MTProto.updateUserTyping>>
+  UpdateChatUserTyping: TlConstructor<ToArgs<MTProto.updateChatUserTyping>>
+  UpdateChatParticipants: TlConstructor<ToArgs<MTProto.updateChatParticipants>>
+  UpdateUserStatus: TlConstructor<ToArgs<MTProto.updateUserStatus>>
+  UpdateUserName: TlConstructor<ToArgs<MTProto.updateUserName>>
+  UpdateUserPhoto: TlConstructor<ToArgs<MTProto.updateUserPhoto>>
+  UpdateNewEncryptedMessage: TlConstructor<ToArgs<MTProto.updateNewEncryptedMessage>>
+  UpdateEncryptedChatTyping: TlConstructor<ToArgs<MTProto.updateEncryptedChatTyping>>
+  UpdateEncryption: TlConstructor<ToArgs<MTProto.updateEncryption>>
+  UpdateEncryptedMessagesRead: TlConstructor<ToArgs<MTProto.updateEncryptedMessagesRead>>
+  UpdateChatParticipantAdd: TlConstructor<ToArgs<MTProto.updateChatParticipantAdd>>
+  UpdateChatParticipantDelete: TlConstructor<ToArgs<MTProto.updateChatParticipantDelete>>
+  UpdateDcOptions: TlConstructor<ToArgs<MTProto.updateDcOptions>>
+  UpdateUserBlocked: TlConstructor<ToArgs<MTProto.updateUserBlocked>>
+  UpdateNotifySettings: TlConstructor<ToArgs<MTProto.updateNotifySettings>>
+  UpdateServiceNotification: TlConstructor<ToArgs<MTProto.updateServiceNotification>>
+  UpdatePrivacy: TlConstructor<ToArgs<MTProto.updatePrivacy>>
+  UpdateUserPhone: TlConstructor<ToArgs<MTProto.updateUserPhone>>
+  UpdateReadHistoryInbox: TlConstructor<ToArgs<MTProto.updateReadHistoryInbox>>
+  UpdateReadHistoryOutbox: TlConstructor<ToArgs<MTProto.updateReadHistoryOutbox>>
+  UpdateWebPage: TlConstructor<ToArgs<MTProto.updateWebPage>>
+  UpdateReadMessagesContents: TlConstructor<ToArgs<MTProto.updateReadMessagesContents>>
+  UpdateChannelTooLong: TlConstructor<ToArgs<MTProto.updateChannelTooLong>>
+  UpdateChannel: TlConstructor<ToArgs<MTProto.updateChannel>>
+  UpdateNewChannelMessage: TlConstructor<ToArgs<MTProto.updateNewChannelMessage>>
+  UpdateReadChannelInbox: TlConstructor<ToArgs<MTProto.updateReadChannelInbox>>
+  UpdateDeleteChannelMessages: TlConstructor<ToArgs<MTProto.updateDeleteChannelMessages>>
+  UpdateChannelMessageViews: TlConstructor<ToArgs<MTProto.updateChannelMessageViews>>
+  UpdateChatParticipantAdmin: TlConstructor<ToArgs<MTProto.updateChatParticipantAdmin>>
+  UpdateNewStickerSet: TlConstructor<ToArgs<MTProto.updateNewStickerSet>>
+  UpdateStickerSetsOrder: TlConstructor<ToArgs<MTProto.updateStickerSetsOrder>>
+  UpdateStickerSets: TlConstructor<ToArgs<MTProto.updateStickerSets>>
+  UpdateSavedGifs: TlConstructor<ToArgs<MTProto.updateSavedGifs>>
+  UpdateBotInlineQuery: TlConstructor<ToArgs<MTProto.updateBotInlineQuery>>
+  UpdateBotInlineSend: TlConstructor<ToArgs<MTProto.updateBotInlineSend>>
+  UpdateEditChannelMessage: TlConstructor<ToArgs<MTProto.updateEditChannelMessage>>
+  UpdateChannelPinnedMessage: TlConstructor<ToArgs<MTProto.updateChannelPinnedMessage>>
+  UpdateBotCallbackQuery: TlConstructor<ToArgs<MTProto.updateBotCallbackQuery>>
+  UpdateEditMessage: TlConstructor<ToArgs<MTProto.updateEditMessage>>
+  UpdateInlineBotCallbackQuery: TlConstructor<ToArgs<MTProto.updateInlineBotCallbackQuery>>
+  UpdateReadChannelOutbox: TlConstructor<ToArgs<MTProto.updateReadChannelOutbox>>
+  UpdateDraftMessage: TlConstructor<ToArgs<MTProto.updateDraftMessage>>
+  UpdateReadFeaturedStickers: TlConstructor<ToArgs<MTProto.updateReadFeaturedStickers>>
+  UpdateRecentStickers: TlConstructor<ToArgs<MTProto.updateRecentStickers>>
+  UpdateConfig: TlConstructor<ToArgs<MTProto.updateConfig>>
+  UpdatePtsChanged: TlConstructor<ToArgs<MTProto.updatePtsChanged>>
+  UpdateChannelWebPage: TlConstructor<ToArgs<MTProto.updateChannelWebPage>>
+  UpdateDialogPinned: TlConstructor<ToArgs<MTProto.updateDialogPinned>>
+  UpdatePinnedDialogs: TlConstructor<ToArgs<MTProto.updatePinnedDialogs>>
+  UpdateBotWebhookJSON: TlConstructor<ToArgs<MTProto.updateBotWebhookJSON>>
+  UpdateBotWebhookJSONQuery: TlConstructor<ToArgs<MTProto.updateBotWebhookJSONQuery>>
+  UpdateBotShippingQuery: TlConstructor<ToArgs<MTProto.updateBotShippingQuery>>
+  UpdateBotPrecheckoutQuery: TlConstructor<ToArgs<MTProto.updateBotPrecheckoutQuery>>
+  UpdatePhoneCall: TlConstructor<ToArgs<MTProto.updatePhoneCall>>
+  UpdateLangPackTooLong: TlConstructor<ToArgs<MTProto.updateLangPackTooLong>>
+  UpdateLangPack: TlConstructor<ToArgs<MTProto.updateLangPack>>
+  UpdateFavedStickers: TlConstructor<ToArgs<MTProto.updateFavedStickers>>
+  UpdateChannelReadMessagesContents: TlConstructor<ToArgs<MTProto.updateChannelReadMessagesContents>>
+  UpdateContactsReset: TlConstructor<ToArgs<MTProto.updateContactsReset>>
+  UpdateChannelAvailableMessages: TlConstructor<ToArgs<MTProto.updateChannelAvailableMessages>>
+  UpdateDialogUnreadMark: TlConstructor<ToArgs<MTProto.updateDialogUnreadMark>>
+  UpdateUserPinnedMessage: TlConstructor<ToArgs<MTProto.updateUserPinnedMessage>>
+  UpdateChatPinnedMessage: TlConstructor<ToArgs<MTProto.updateChatPinnedMessage>>
+  UpdateMessagePoll: TlConstructor<ToArgs<MTProto.updateMessagePoll>>
+  UpdateChatDefaultBannedRights: TlConstructor<ToArgs<MTProto.updateChatDefaultBannedRights>>
+  UpdateFolderPeers: TlConstructor<ToArgs<MTProto.updateFolderPeers>>
+  UpdatePeerSettings: TlConstructor<ToArgs<MTProto.updatePeerSettings>>
+  UpdatePeerLocated: TlConstructor<ToArgs<MTProto.updatePeerLocated>>
+  UpdateNewScheduledMessage: TlConstructor<ToArgs<MTProto.updateNewScheduledMessage>>
+  UpdateDeleteScheduledMessages: TlConstructor<ToArgs<MTProto.updateDeleteScheduledMessages>>
+  UpdateTheme: TlConstructor<ToArgs<MTProto.updateTheme>>
+  UpdatesTooLong: TlConstructor<ToArgs<MTProto.updatesTooLong>>
+  UpdateShortMessage: TlConstructor<ToArgs<MTProto.updateShortMessage>>
+  UpdateShortChatMessage: TlConstructor<ToArgs<MTProto.updateShortChatMessage>>
+  UpdateShort: TlConstructor<ToArgs<MTProto.updateShort>>
+  UpdatesCombined: TlConstructor<ToArgs<MTProto.updatesCombined>>
+  Updates: TlConstructor<ToArgs<MTProto.updates>>
+  UpdateShortSentMessage: TlConstructor<ToArgs<MTProto.updateShortSentMessage>>
+  DcOption: TlConstructor<ToArgs<MTProto.dcOption>>
+  Config: TlConstructor<ToArgs<MTProto.config>>
+  NearestDc: TlConstructor<ToArgs<MTProto.nearestDc>>
+  EncryptedChatEmpty: TlConstructor<ToArgs<MTProto.encryptedChatEmpty>>
+  EncryptedChatWaiting: TlConstructor<ToArgs<MTProto.encryptedChatWaiting>>
+  EncryptedChatRequested: TlConstructor<ToArgs<MTProto.encryptedChatRequested>>
+  EncryptedChat: TlConstructor<ToArgs<MTProto.encryptedChat>>
+  EncryptedChatDiscarded: TlConstructor<ToArgs<MTProto.encryptedChatDiscarded>>
+  InputEncryptedChat: TlConstructor<ToArgs<MTProto.inputEncryptedChat>>
+  EncryptedFileEmpty: TlConstructor<ToArgs<MTProto.encryptedFileEmpty>>
+  EncryptedFile: TlConstructor<ToArgs<MTProto.encryptedFile>>
+  InputEncryptedFileEmpty: TlConstructor<ToArgs<MTProto.inputEncryptedFileEmpty>>
+  InputEncryptedFileUploaded: TlConstructor<ToArgs<MTProto.inputEncryptedFileUploaded>>
+  InputEncryptedFile: TlConstructor<ToArgs<MTProto.inputEncryptedFile>>
+  InputEncryptedFileBigUploaded: TlConstructor<ToArgs<MTProto.inputEncryptedFileBigUploaded>>
+  EncryptedMessage: TlConstructor<ToArgs<MTProto.encryptedMessage>>
+  EncryptedMessageService: TlConstructor<ToArgs<MTProto.encryptedMessageService>>
+  InputDocumentEmpty: TlConstructor<ToArgs<MTProto.inputDocumentEmpty>>
+  InputDocument: TlConstructor<ToArgs<MTProto.inputDocument>>
+  DocumentEmpty: TlConstructor<ToArgs<MTProto.documentEmpty>>
+  Document: TlConstructor<ToArgs<MTProto.document>>
+  NotifyPeer: TlConstructor<ToArgs<MTProto.notifyPeer>>
+  NotifyUsers: TlConstructor<ToArgs<MTProto.notifyUsers>>
+  NotifyChats: TlConstructor<ToArgs<MTProto.notifyChats>>
+  NotifyBroadcasts: TlConstructor<ToArgs<MTProto.notifyBroadcasts>>
+  SendMessageTypingAction: TlConstructor<ToArgs<MTProto.sendMessageTypingAction>>
+  SendMessageCancelAction: TlConstructor<ToArgs<MTProto.sendMessageCancelAction>>
+  SendMessageRecordVideoAction: TlConstructor<ToArgs<MTProto.sendMessageRecordVideoAction>>
+  SendMessageUploadVideoAction: TlConstructor<ToArgs<MTProto.sendMessageUploadVideoAction>>
+  SendMessageRecordAudioAction: TlConstructor<ToArgs<MTProto.sendMessageRecordAudioAction>>
+  SendMessageUploadAudioAction: TlConstructor<ToArgs<MTProto.sendMessageUploadAudioAction>>
+  SendMessageUploadPhotoAction: TlConstructor<ToArgs<MTProto.sendMessageUploadPhotoAction>>
+  SendMessageUploadDocumentAction: TlConstructor<ToArgs<MTProto.sendMessageUploadDocumentAction>>
+  SendMessageGeoLocationAction: TlConstructor<ToArgs<MTProto.sendMessageGeoLocationAction>>
+  SendMessageChooseContactAction: TlConstructor<ToArgs<MTProto.sendMessageChooseContactAction>>
+  SendMessageGamePlayAction: TlConstructor<ToArgs<MTProto.sendMessageGamePlayAction>>
+  SendMessageRecordRoundAction: TlConstructor<ToArgs<MTProto.sendMessageRecordRoundAction>>
+  SendMessageUploadRoundAction: TlConstructor<ToArgs<MTProto.sendMessageUploadRoundAction>>
+  InputPrivacyKeyStatusTimestamp: TlConstructor<ToArgs<MTProto.inputPrivacyKeyStatusTimestamp>>
+  InputPrivacyKeyChatInvite: TlConstructor<ToArgs<MTProto.inputPrivacyKeyChatInvite>>
+  InputPrivacyKeyPhoneCall: TlConstructor<ToArgs<MTProto.inputPrivacyKeyPhoneCall>>
+  InputPrivacyKeyPhoneP2P: TlConstructor<ToArgs<MTProto.inputPrivacyKeyPhoneP2P>>
+  InputPrivacyKeyForwards: TlConstructor<ToArgs<MTProto.inputPrivacyKeyForwards>>
+  InputPrivacyKeyProfilePhoto: TlConstructor<ToArgs<MTProto.inputPrivacyKeyProfilePhoto>>
+  InputPrivacyKeyPhoneNumber: TlConstructor<ToArgs<MTProto.inputPrivacyKeyPhoneNumber>>
+  InputPrivacyKeyAddedByPhone: TlConstructor<ToArgs<MTProto.inputPrivacyKeyAddedByPhone>>
+  PrivacyKeyStatusTimestamp: TlConstructor<ToArgs<MTProto.privacyKeyStatusTimestamp>>
+  PrivacyKeyChatInvite: TlConstructor<ToArgs<MTProto.privacyKeyChatInvite>>
+  PrivacyKeyPhoneCall: TlConstructor<ToArgs<MTProto.privacyKeyPhoneCall>>
+  PrivacyKeyPhoneP2P: TlConstructor<ToArgs<MTProto.privacyKeyPhoneP2P>>
+  PrivacyKeyForwards: TlConstructor<ToArgs<MTProto.privacyKeyForwards>>
+  PrivacyKeyProfilePhoto: TlConstructor<ToArgs<MTProto.privacyKeyProfilePhoto>>
+  PrivacyKeyPhoneNumber: TlConstructor<ToArgs<MTProto.privacyKeyPhoneNumber>>
+  PrivacyKeyAddedByPhone: TlConstructor<ToArgs<MTProto.privacyKeyAddedByPhone>>
+  InputPrivacyValueAllowContacts: TlConstructor<ToArgs<MTProto.inputPrivacyValueAllowContacts>>
+  InputPrivacyValueAllowAll: TlConstructor<ToArgs<MTProto.inputPrivacyValueAllowAll>>
+  InputPrivacyValueAllowUsers: TlConstructor<ToArgs<MTProto.inputPrivacyValueAllowUsers>>
+  InputPrivacyValueDisallowContacts: TlConstructor<ToArgs<MTProto.inputPrivacyValueDisallowContacts>>
+  InputPrivacyValueDisallowAll: TlConstructor<ToArgs<MTProto.inputPrivacyValueDisallowAll>>
+  InputPrivacyValueDisallowUsers: TlConstructor<ToArgs<MTProto.inputPrivacyValueDisallowUsers>>
+  InputPrivacyValueAllowChatParticipants: TlConstructor<ToArgs<MTProto.inputPrivacyValueAllowChatParticipants>>
+  InputPrivacyValueDisallowChatParticipants: TlConstructor<ToArgs<MTProto.inputPrivacyValueDisallowChatParticipants>>
+  PrivacyValueAllowContacts: TlConstructor<ToArgs<MTProto.privacyValueAllowContacts>>
+  PrivacyValueAllowAll: TlConstructor<ToArgs<MTProto.privacyValueAllowAll>>
+  PrivacyValueAllowUsers: TlConstructor<ToArgs<MTProto.privacyValueAllowUsers>>
+  PrivacyValueDisallowContacts: TlConstructor<ToArgs<MTProto.privacyValueDisallowContacts>>
+  PrivacyValueDisallowAll: TlConstructor<ToArgs<MTProto.privacyValueDisallowAll>>
+  PrivacyValueDisallowUsers: TlConstructor<ToArgs<MTProto.privacyValueDisallowUsers>>
+  PrivacyValueAllowChatParticipants: TlConstructor<ToArgs<MTProto.privacyValueAllowChatParticipants>>
+  PrivacyValueDisallowChatParticipants: TlConstructor<ToArgs<MTProto.privacyValueDisallowChatParticipants>>
+  AccountDaysTTL: TlConstructor<ToArgs<MTProto.accountDaysTTL>>
+  DocumentAttributeImageSize: TlConstructor<ToArgs<MTProto.documentAttributeImageSize>>
+  DocumentAttributeAnimated: TlConstructor<ToArgs<MTProto.documentAttributeAnimated>>
+  DocumentAttributeSticker: TlConstructor<ToArgs<MTProto.documentAttributeSticker>>
+  DocumentAttributeVideo: TlConstructor<ToArgs<MTProto.documentAttributeVideo>>
+  DocumentAttributeAudio: TlConstructor<ToArgs<MTProto.documentAttributeAudio>>
+  DocumentAttributeFilename: TlConstructor<ToArgs<MTProto.documentAttributeFilename>>
+  DocumentAttributeHasStickers: TlConstructor<ToArgs<MTProto.documentAttributeHasStickers>>
+  StickerPack: TlConstructor<ToArgs<MTProto.stickerPack>>
+  WebPageEmpty: TlConstructor<ToArgs<MTProto.webPageEmpty>>
+  WebPagePending: TlConstructor<ToArgs<MTProto.webPagePending>>
+  WebPage: TlConstructor<ToArgs<MTProto.webPage>>
+  WebPageNotModified: TlConstructor<ToArgs<MTProto.webPageNotModified>>
+  Authorization: TlConstructor<ToArgs<MTProto.authorization>>
+  ReceivedNotifyMessage: TlConstructor<ToArgs<MTProto.receivedNotifyMessage>>
+  ChatInviteEmpty: TlConstructor<ToArgs<MTProto.chatInviteEmpty>>
+  ChatInviteExported: TlConstructor<ToArgs<MTProto.chatInviteExported>>
+  ChatInviteAlready: TlConstructor<ToArgs<MTProto.chatInviteAlready>>
+  ChatInvite: TlConstructor<ToArgs<MTProto.chatInvite>>
+  InputStickerSetEmpty: TlConstructor<ToArgs<MTProto.inputStickerSetEmpty>>
+  InputStickerSetID: TlConstructor<ToArgs<MTProto.inputStickerSetID>>
+  InputStickerSetShortName: TlConstructor<ToArgs<MTProto.inputStickerSetShortName>>
+  InputStickerSetAnimatedEmoji: TlConstructor<ToArgs<MTProto.inputStickerSetAnimatedEmoji>>
+  StickerSet: TlConstructor<ToArgs<MTProto.stickerSet>>
+  BotCommand: TlConstructor<ToArgs<MTProto.botCommand>>
+  BotInfo: TlConstructor<ToArgs<MTProto.botInfo>>
+  KeyboardButton: TlConstructor<ToArgs<MTProto.keyboardButton>>
+  KeyboardButtonUrl: TlConstructor<ToArgs<MTProto.keyboardButtonUrl>>
+  KeyboardButtonCallback: TlConstructor<ToArgs<MTProto.keyboardButtonCallback>>
+  KeyboardButtonRequestPhone: TlConstructor<ToArgs<MTProto.keyboardButtonRequestPhone>>
+  KeyboardButtonRequestGeoLocation: TlConstructor<ToArgs<MTProto.keyboardButtonRequestGeoLocation>>
+  KeyboardButtonSwitchInline: TlConstructor<ToArgs<MTProto.keyboardButtonSwitchInline>>
+  KeyboardButtonGame: TlConstructor<ToArgs<MTProto.keyboardButtonGame>>
+  KeyboardButtonBuy: TlConstructor<ToArgs<MTProto.keyboardButtonBuy>>
+  KeyboardButtonUrlAuth: TlConstructor<ToArgs<MTProto.keyboardButtonUrlAuth>>
+  InputKeyboardButtonUrlAuth: TlConstructor<ToArgs<MTProto.inputKeyboardButtonUrlAuth>>
+  KeyboardButtonRow: TlConstructor<ToArgs<MTProto.keyboardButtonRow>>
+  ReplyKeyboardHide: TlConstructor<ToArgs<MTProto.replyKeyboardHide>>
+  ReplyKeyboardForceReply: TlConstructor<ToArgs<MTProto.replyKeyboardForceReply>>
+  ReplyKeyboardMarkup: TlConstructor<ToArgs<MTProto.replyKeyboardMarkup>>
+  ReplyInlineMarkup: TlConstructor<ToArgs<MTProto.replyInlineMarkup>>
+  MessageEntityUnknown: TlConstructor<ToArgs<MTProto.messageEntityUnknown>>
+  MessageEntityMention: TlConstructor<ToArgs<MTProto.messageEntityMention>>
+  MessageEntityHashtag: TlConstructor<ToArgs<MTProto.messageEntityHashtag>>
+  MessageEntityBotCommand: TlConstructor<ToArgs<MTProto.messageEntityBotCommand>>
+  MessageEntityUrl: TlConstructor<ToArgs<MTProto.messageEntityUrl>>
+  MessageEntityEmail: TlConstructor<ToArgs<MTProto.messageEntityEmail>>
+  MessageEntityBold: TlConstructor<ToArgs<MTProto.messageEntityBold>>
+  MessageEntityItalic: TlConstructor<ToArgs<MTProto.messageEntityItalic>>
+  MessageEntityCode: TlConstructor<ToArgs<MTProto.messageEntityCode>>
+  MessageEntityPre: TlConstructor<ToArgs<MTProto.messageEntityPre>>
+  MessageEntityTextUrl: TlConstructor<ToArgs<MTProto.messageEntityTextUrl>>
+  MessageEntityMentionName: TlConstructor<ToArgs<MTProto.messageEntityMentionName>>
+  InputMessageEntityMentionName: TlConstructor<ToArgs<MTProto.inputMessageEntityMentionName>>
+  MessageEntityPhone: TlConstructor<ToArgs<MTProto.messageEntityPhone>>
+  MessageEntityCashtag: TlConstructor<ToArgs<MTProto.messageEntityCashtag>>
+  MessageEntityUnderline: TlConstructor<ToArgs<MTProto.messageEntityUnderline>>
+  MessageEntityStrike: TlConstructor<ToArgs<MTProto.messageEntityStrike>>
+  MessageEntityBlockquote: TlConstructor<ToArgs<MTProto.messageEntityBlockquote>>
+  InputChannelEmpty: TlConstructor<ToArgs<MTProto.inputChannelEmpty>>
+  InputChannel: TlConstructor<ToArgs<MTProto.inputChannel>>
+  InputChannelFromMessage: TlConstructor<ToArgs<MTProto.inputChannelFromMessage>>
+  MessageRange: TlConstructor<ToArgs<MTProto.messageRange>>
+  ChannelMessagesFilterEmpty: TlConstructor<ToArgs<MTProto.channelMessagesFilterEmpty>>
+  ChannelMessagesFilter: TlConstructor<ToArgs<MTProto.channelMessagesFilter>>
+  ChannelParticipant: TlConstructor<ToArgs<MTProto.channelParticipant>>
+  ChannelParticipantSelf: TlConstructor<ToArgs<MTProto.channelParticipantSelf>>
+  ChannelParticipantCreator: TlConstructor<ToArgs<MTProto.channelParticipantCreator>>
+  ChannelParticipantAdmin: TlConstructor<ToArgs<MTProto.channelParticipantAdmin>>
+  ChannelParticipantBanned: TlConstructor<ToArgs<MTProto.channelParticipantBanned>>
+  ChannelParticipantsRecent: TlConstructor<ToArgs<MTProto.channelParticipantsRecent>>
+  ChannelParticipantsAdmins: TlConstructor<ToArgs<MTProto.channelParticipantsAdmins>>
+  ChannelParticipantsKicked: TlConstructor<ToArgs<MTProto.channelParticipantsKicked>>
+  ChannelParticipantsBots: TlConstructor<ToArgs<MTProto.channelParticipantsBots>>
+  ChannelParticipantsBanned: TlConstructor<ToArgs<MTProto.channelParticipantsBanned>>
+  ChannelParticipantsSearch: TlConstructor<ToArgs<MTProto.channelParticipantsSearch>>
+  ChannelParticipantsContacts: TlConstructor<ToArgs<MTProto.channelParticipantsContacts>>
+  FoundGif: TlConstructor<ToArgs<MTProto.foundGif>>
+  FoundGifCached: TlConstructor<ToArgs<MTProto.foundGifCached>>
+  InputBotInlineMessageMediaAuto: TlConstructor<ToArgs<MTProto.inputBotInlineMessageMediaAuto>>
+  InputBotInlineMessageText: TlConstructor<ToArgs<MTProto.inputBotInlineMessageText>>
+  InputBotInlineMessageMediaGeo: TlConstructor<ToArgs<MTProto.inputBotInlineMessageMediaGeo>>
+  InputBotInlineMessageMediaVenue: TlConstructor<ToArgs<MTProto.inputBotInlineMessageMediaVenue>>
+  InputBotInlineMessageMediaContact: TlConstructor<ToArgs<MTProto.inputBotInlineMessageMediaContact>>
+  InputBotInlineMessageGame: TlConstructor<ToArgs<MTProto.inputBotInlineMessageGame>>
+  InputBotInlineResult: TlConstructor<ToArgs<MTProto.inputBotInlineResult>>
+  InputBotInlineResultPhoto: TlConstructor<ToArgs<MTProto.inputBotInlineResultPhoto>>
+  InputBotInlineResultDocument: TlConstructor<ToArgs<MTProto.inputBotInlineResultDocument>>
+  InputBotInlineResultGame: TlConstructor<ToArgs<MTProto.inputBotInlineResultGame>>
+  BotInlineMessageMediaAuto: TlConstructor<ToArgs<MTProto.botInlineMessageMediaAuto>>
+  BotInlineMessageText: TlConstructor<ToArgs<MTProto.botInlineMessageText>>
+  BotInlineMessageMediaGeo: TlConstructor<ToArgs<MTProto.botInlineMessageMediaGeo>>
+  BotInlineMessageMediaVenue: TlConstructor<ToArgs<MTProto.botInlineMessageMediaVenue>>
+  BotInlineMessageMediaContact: TlConstructor<ToArgs<MTProto.botInlineMessageMediaContact>>
+  BotInlineResult: TlConstructor<ToArgs<MTProto.botInlineResult>>
+  BotInlineMediaResult: TlConstructor<ToArgs<MTProto.botInlineMediaResult>>
+  ExportedMessageLink: TlConstructor<ToArgs<MTProto.exportedMessageLink>>
+  MessageFwdHeader: TlConstructor<ToArgs<MTProto.messageFwdHeader>>
+  InputBotInlineMessageID: TlConstructor<ToArgs<MTProto.inputBotInlineMessageID>>
+  InlineBotSwitchPM: TlConstructor<ToArgs<MTProto.inlineBotSwitchPM>>
+  TopPeer: TlConstructor<ToArgs<MTProto.topPeer>>
+  TopPeerCategoryBotsPM: TlConstructor<ToArgs<MTProto.topPeerCategoryBotsPM>>
+  TopPeerCategoryBotsInline: TlConstructor<ToArgs<MTProto.topPeerCategoryBotsInline>>
+  TopPeerCategoryCorrespondents: TlConstructor<ToArgs<MTProto.topPeerCategoryCorrespondents>>
+  TopPeerCategoryGroups: TlConstructor<ToArgs<MTProto.topPeerCategoryGroups>>
+  TopPeerCategoryChannels: TlConstructor<ToArgs<MTProto.topPeerCategoryChannels>>
+  TopPeerCategoryPhoneCalls: TlConstructor<ToArgs<MTProto.topPeerCategoryPhoneCalls>>
+  TopPeerCategoryForwardUsers: TlConstructor<ToArgs<MTProto.topPeerCategoryForwardUsers>>
+  TopPeerCategoryForwardChats: TlConstructor<ToArgs<MTProto.topPeerCategoryForwardChats>>
+  TopPeerCategoryPeers: TlConstructor<ToArgs<MTProto.topPeerCategoryPeers>>
+  DraftMessageEmpty: TlConstructor<ToArgs<MTProto.draftMessageEmpty>>
+  DraftMessage: TlConstructor<ToArgs<MTProto.draftMessage>>
+  StickerSetCovered: TlConstructor<ToArgs<MTProto.stickerSetCovered>>
+  StickerSetMultiCovered: TlConstructor<ToArgs<MTProto.stickerSetMultiCovered>>
+  MaskCoords: TlConstructor<ToArgs<MTProto.maskCoords>>
+  InputStickeredMediaPhoto: TlConstructor<ToArgs<MTProto.inputStickeredMediaPhoto>>
+  InputStickeredMediaDocument: TlConstructor<ToArgs<MTProto.inputStickeredMediaDocument>>
+  Game: TlConstructor<ToArgs<MTProto.game>>
+  InputGameID: TlConstructor<ToArgs<MTProto.inputGameID>>
+  InputGameShortName: TlConstructor<ToArgs<MTProto.inputGameShortName>>
+  HighScore: TlConstructor<ToArgs<MTProto.highScore>>
+  TextEmpty: TlConstructor<ToArgs<MTProto.textEmpty>>
+  TextPlain: TlConstructor<ToArgs<MTProto.textPlain>>
+  TextBold: TlConstructor<ToArgs<MTProto.textBold>>
+  TextItalic: TlConstructor<ToArgs<MTProto.textItalic>>
+  TextUnderline: TlConstructor<ToArgs<MTProto.textUnderline>>
+  TextStrike: TlConstructor<ToArgs<MTProto.textStrike>>
+  TextFixed: TlConstructor<ToArgs<MTProto.textFixed>>
+  TextUrl: TlConstructor<ToArgs<MTProto.textUrl>>
+  TextEmail: TlConstructor<ToArgs<MTProto.textEmail>>
+  TextConcat: TlConstructor<ToArgs<MTProto.textConcat>>
+  TextSubscript: TlConstructor<ToArgs<MTProto.textSubscript>>
+  TextSuperscript: TlConstructor<ToArgs<MTProto.textSuperscript>>
+  TextMarked: TlConstructor<ToArgs<MTProto.textMarked>>
+  TextPhone: TlConstructor<ToArgs<MTProto.textPhone>>
+  TextImage: TlConstructor<ToArgs<MTProto.textImage>>
+  TextAnchor: TlConstructor<ToArgs<MTProto.textAnchor>>
+  PageBlockUnsupported: TlConstructor<ToArgs<MTProto.pageBlockUnsupported>>
+  PageBlockTitle: TlConstructor<ToArgs<MTProto.pageBlockTitle>>
+  PageBlockSubtitle: TlConstructor<ToArgs<MTProto.pageBlockSubtitle>>
+  PageBlockAuthorDate: TlConstructor<ToArgs<MTProto.pageBlockAuthorDate>>
+  PageBlockHeader: TlConstructor<ToArgs<MTProto.pageBlockHeader>>
+  PageBlockSubheader: TlConstructor<ToArgs<MTProto.pageBlockSubheader>>
+  PageBlockParagraph: TlConstructor<ToArgs<MTProto.pageBlockParagraph>>
+  PageBlockPreformatted: TlConstructor<ToArgs<MTProto.pageBlockPreformatted>>
+  PageBlockFooter: TlConstructor<ToArgs<MTProto.pageBlockFooter>>
+  PageBlockDivider: TlConstructor<ToArgs<MTProto.pageBlockDivider>>
+  PageBlockAnchor: TlConstructor<ToArgs<MTProto.pageBlockAnchor>>
+  PageBlockList: TlConstructor<ToArgs<MTProto.pageBlockList>>
+  PageBlockBlockquote: TlConstructor<ToArgs<MTProto.pageBlockBlockquote>>
+  PageBlockPullquote: TlConstructor<ToArgs<MTProto.pageBlockPullquote>>
+  PageBlockPhoto: TlConstructor<ToArgs<MTProto.pageBlockPhoto>>
+  PageBlockVideo: TlConstructor<ToArgs<MTProto.pageBlockVideo>>
+  PageBlockCover: TlConstructor<ToArgs<MTProto.pageBlockCover>>
+  PageBlockEmbed: TlConstructor<ToArgs<MTProto.pageBlockEmbed>>
+  PageBlockEmbedPost: TlConstructor<ToArgs<MTProto.pageBlockEmbedPost>>
+  PageBlockCollage: TlConstructor<ToArgs<MTProto.pageBlockCollage>>
+  PageBlockSlideshow: TlConstructor<ToArgs<MTProto.pageBlockSlideshow>>
+  PageBlockChannel: TlConstructor<ToArgs<MTProto.pageBlockChannel>>
+  PageBlockAudio: TlConstructor<ToArgs<MTProto.pageBlockAudio>>
+  PageBlockKicker: TlConstructor<ToArgs<MTProto.pageBlockKicker>>
+  PageBlockTable: TlConstructor<ToArgs<MTProto.pageBlockTable>>
+  PageBlockOrderedList: TlConstructor<ToArgs<MTProto.pageBlockOrderedList>>
+  PageBlockDetails: TlConstructor<ToArgs<MTProto.pageBlockDetails>>
+  PageBlockRelatedArticles: TlConstructor<ToArgs<MTProto.pageBlockRelatedArticles>>
+  PageBlockMap: TlConstructor<ToArgs<MTProto.pageBlockMap>>
+  PhoneCallDiscardReasonMissed: TlConstructor<ToArgs<MTProto.phoneCallDiscardReasonMissed>>
+  PhoneCallDiscardReasonDisconnect: TlConstructor<ToArgs<MTProto.phoneCallDiscardReasonDisconnect>>
+  PhoneCallDiscardReasonHangup: TlConstructor<ToArgs<MTProto.phoneCallDiscardReasonHangup>>
+  PhoneCallDiscardReasonBusy: TlConstructor<ToArgs<MTProto.phoneCallDiscardReasonBusy>>
+  DataJSON: TlConstructor<ToArgs<MTProto.dataJSON>>
+  LabeledPrice: TlConstructor<ToArgs<MTProto.labeledPrice>>
+  Invoice: TlConstructor<ToArgs<MTProto.invoice>>
+  PaymentCharge: TlConstructor<ToArgs<MTProto.paymentCharge>>
+  PostAddress: TlConstructor<ToArgs<MTProto.postAddress>>
+  PaymentRequestedInfo: TlConstructor<ToArgs<MTProto.paymentRequestedInfo>>
+  PaymentSavedCredentialsCard: TlConstructor<ToArgs<MTProto.paymentSavedCredentialsCard>>
+  WebDocument: TlConstructor<ToArgs<MTProto.webDocument>>
+  WebDocumentNoProxy: TlConstructor<ToArgs<MTProto.webDocumentNoProxy>>
+  InputWebDocument: TlConstructor<ToArgs<MTProto.inputWebDocument>>
+  InputWebFileLocation: TlConstructor<ToArgs<MTProto.inputWebFileLocation>>
+  InputWebFileGeoPointLocation: TlConstructor<ToArgs<MTProto.inputWebFileGeoPointLocation>>
+  InputPaymentCredentialsSaved: TlConstructor<ToArgs<MTProto.inputPaymentCredentialsSaved>>
+  InputPaymentCredentials: TlConstructor<ToArgs<MTProto.inputPaymentCredentials>>
+  InputPaymentCredentialsApplePay: TlConstructor<ToArgs<MTProto.inputPaymentCredentialsApplePay>>
+  InputPaymentCredentialsAndroidPay: TlConstructor<ToArgs<MTProto.inputPaymentCredentialsAndroidPay>>
+  ShippingOption: TlConstructor<ToArgs<MTProto.shippingOption>>
+  InputStickerSetItem: TlConstructor<ToArgs<MTProto.inputStickerSetItem>>
+  InputPhoneCall: TlConstructor<ToArgs<MTProto.inputPhoneCall>>
+  PhoneCallEmpty: TlConstructor<ToArgs<MTProto.phoneCallEmpty>>
+  PhoneCallWaiting: TlConstructor<ToArgs<MTProto.phoneCallWaiting>>
+  PhoneCallRequested: TlConstructor<ToArgs<MTProto.phoneCallRequested>>
+  PhoneCallAccepted: TlConstructor<ToArgs<MTProto.phoneCallAccepted>>
+  PhoneCall: TlConstructor<ToArgs<MTProto.phoneCall>>
+  PhoneCallDiscarded: TlConstructor<ToArgs<MTProto.phoneCallDiscarded>>
+  PhoneConnection: TlConstructor<ToArgs<MTProto.phoneConnection>>
+  PhoneCallProtocol: TlConstructor<ToArgs<MTProto.phoneCallProtocol>>
+  CdnPublicKey: TlConstructor<ToArgs<MTProto.cdnPublicKey>>
+  CdnConfig: TlConstructor<ToArgs<MTProto.cdnConfig>>
+  LangPackString: TlConstructor<ToArgs<MTProto.langPackString>>
+  LangPackStringPluralized: TlConstructor<ToArgs<MTProto.langPackStringPluralized>>
+  LangPackStringDeleted: TlConstructor<ToArgs<MTProto.langPackStringDeleted>>
+  LangPackDifference: TlConstructor<ToArgs<MTProto.langPackDifference>>
+  LangPackLanguage: TlConstructor<ToArgs<MTProto.langPackLanguage>>
+  ChannelAdminLogEventActionChangeTitle: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangeTitle>>
+  ChannelAdminLogEventActionChangeAbout: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangeAbout>>
+  ChannelAdminLogEventActionChangeUsername: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangeUsername>>
+  ChannelAdminLogEventActionChangePhoto: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangePhoto>>
+  ChannelAdminLogEventActionToggleInvites: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionToggleInvites>>
+  ChannelAdminLogEventActionToggleSignatures: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionToggleSignatures>>
+  ChannelAdminLogEventActionUpdatePinned: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionUpdatePinned>>
+  ChannelAdminLogEventActionEditMessage: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionEditMessage>>
+  ChannelAdminLogEventActionDeleteMessage: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionDeleteMessage>>
+  ChannelAdminLogEventActionParticipantJoin: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionParticipantJoin>>
+  ChannelAdminLogEventActionParticipantLeave: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionParticipantLeave>>
+  ChannelAdminLogEventActionParticipantInvite: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionParticipantInvite>>
+  ChannelAdminLogEventActionParticipantToggleBan: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionParticipantToggleBan>>
+  ChannelAdminLogEventActionParticipantToggleAdmin: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionParticipantToggleAdmin>>
+  ChannelAdminLogEventActionChangeStickerSet: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangeStickerSet>>
+  ChannelAdminLogEventActionTogglePreHistoryHidden: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionTogglePreHistoryHidden>>
+  ChannelAdminLogEventActionDefaultBannedRights: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionDefaultBannedRights>>
+  ChannelAdminLogEventActionStopPoll: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionStopPoll>>
+  ChannelAdminLogEventActionChangeLinkedChat: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangeLinkedChat>>
+  ChannelAdminLogEventActionChangeLocation: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionChangeLocation>>
+  ChannelAdminLogEventActionToggleSlowMode: TlConstructor<ToArgs<MTProto.channelAdminLogEventActionToggleSlowMode>>
+  ChannelAdminLogEvent: TlConstructor<ToArgs<MTProto.channelAdminLogEvent>>
+  ChannelAdminLogEventsFilter: TlConstructor<ToArgs<MTProto.channelAdminLogEventsFilter>>
+  PopularContact: TlConstructor<ToArgs<MTProto.popularContact>>
+  RecentMeUrlUnknown: TlConstructor<ToArgs<MTProto.recentMeUrlUnknown>>
+  RecentMeUrlUser: TlConstructor<ToArgs<MTProto.recentMeUrlUser>>
+  RecentMeUrlChat: TlConstructor<ToArgs<MTProto.recentMeUrlChat>>
+  RecentMeUrlChatInvite: TlConstructor<ToArgs<MTProto.recentMeUrlChatInvite>>
+  RecentMeUrlStickerSet: TlConstructor<ToArgs<MTProto.recentMeUrlStickerSet>>
+  InputSingleMedia: TlConstructor<ToArgs<MTProto.inputSingleMedia>>
+  WebAuthorization: TlConstructor<ToArgs<MTProto.webAuthorization>>
+  InputMessageID: TlConstructor<ToArgs<MTProto.inputMessageID>>
+  InputMessageReplyTo: TlConstructor<ToArgs<MTProto.inputMessageReplyTo>>
+  InputMessagePinned: TlConstructor<ToArgs<MTProto.inputMessagePinned>>
+  InputDialogPeer: TlConstructor<ToArgs<MTProto.inputDialogPeer>>
+  InputDialogPeerFolder: TlConstructor<ToArgs<MTProto.inputDialogPeerFolder>>
+  DialogPeer: TlConstructor<ToArgs<MTProto.dialogPeer>>
+  DialogPeerFolder: TlConstructor<ToArgs<MTProto.dialogPeerFolder>>
+  FileHash: TlConstructor<ToArgs<MTProto.fileHash>>
+  InputClientProxy: TlConstructor<ToArgs<MTProto.inputClientProxy>>
+  InputSecureFileUploaded: TlConstructor<ToArgs<MTProto.inputSecureFileUploaded>>
+  InputSecureFile: TlConstructor<ToArgs<MTProto.inputSecureFile>>
+  SecureFileEmpty: TlConstructor<ToArgs<MTProto.secureFileEmpty>>
+  SecureFile: TlConstructor<ToArgs<MTProto.secureFile>>
+  SecureData: TlConstructor<ToArgs<MTProto.secureData>>
+  SecurePlainPhone: TlConstructor<ToArgs<MTProto.securePlainPhone>>
+  SecurePlainEmail: TlConstructor<ToArgs<MTProto.securePlainEmail>>
+  SecureValueTypePersonalDetails: TlConstructor<ToArgs<MTProto.secureValueTypePersonalDetails>>
+  SecureValueTypePassport: TlConstructor<ToArgs<MTProto.secureValueTypePassport>>
+  SecureValueTypeDriverLicense: TlConstructor<ToArgs<MTProto.secureValueTypeDriverLicense>>
+  SecureValueTypeIdentityCard: TlConstructor<ToArgs<MTProto.secureValueTypeIdentityCard>>
+  SecureValueTypeInternalPassport: TlConstructor<ToArgs<MTProto.secureValueTypeInternalPassport>>
+  SecureValueTypeAddress: TlConstructor<ToArgs<MTProto.secureValueTypeAddress>>
+  SecureValueTypeUtilityBill: TlConstructor<ToArgs<MTProto.secureValueTypeUtilityBill>>
+  SecureValueTypeBankStatement: TlConstructor<ToArgs<MTProto.secureValueTypeBankStatement>>
+  SecureValueTypeRentalAgreement: TlConstructor<ToArgs<MTProto.secureValueTypeRentalAgreement>>
+  SecureValueTypePassportRegistration: TlConstructor<ToArgs<MTProto.secureValueTypePassportRegistration>>
+  SecureValueTypeTemporaryRegistration: TlConstructor<ToArgs<MTProto.secureValueTypeTemporaryRegistration>>
+  SecureValueTypePhone: TlConstructor<ToArgs<MTProto.secureValueTypePhone>>
+  SecureValueTypeEmail: TlConstructor<ToArgs<MTProto.secureValueTypeEmail>>
+  SecureValue: TlConstructor<ToArgs<MTProto.secureValue>>
+  InputSecureValue: TlConstructor<ToArgs<MTProto.inputSecureValue>>
+  SecureValueHash: TlConstructor<ToArgs<MTProto.secureValueHash>>
+  SecureValueErrorData: TlConstructor<ToArgs<MTProto.secureValueErrorData>>
+  SecureValueErrorFrontSide: TlConstructor<ToArgs<MTProto.secureValueErrorFrontSide>>
+  SecureValueErrorReverseSide: TlConstructor<ToArgs<MTProto.secureValueErrorReverseSide>>
+  SecureValueErrorSelfie: TlConstructor<ToArgs<MTProto.secureValueErrorSelfie>>
+  SecureValueErrorFile: TlConstructor<ToArgs<MTProto.secureValueErrorFile>>
+  SecureValueErrorFiles: TlConstructor<ToArgs<MTProto.secureValueErrorFiles>>
+  SecureValueError: TlConstructor<ToArgs<MTProto.secureValueError>>
+  SecureValueErrorTranslationFile: TlConstructor<ToArgs<MTProto.secureValueErrorTranslationFile>>
+  SecureValueErrorTranslationFiles: TlConstructor<ToArgs<MTProto.secureValueErrorTranslationFiles>>
+  SecureCredentialsEncrypted: TlConstructor<ToArgs<MTProto.secureCredentialsEncrypted>>
+  SavedPhoneContact: TlConstructor<ToArgs<MTProto.savedPhoneContact>>
+  PasswordKdfAlgoUnknown: TlConstructor<ToArgs<MTProto.passwordKdfAlgoUnknown>>
+  PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow: TlConstructor<ToArgs<MTProto.passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow>>
+  SecurePasswordKdfAlgoUnknown: TlConstructor<ToArgs<MTProto.securePasswordKdfAlgoUnknown>>
+  SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000: TlConstructor<ToArgs<MTProto.securePasswordKdfAlgoPBKDF2HMACSHA512iter100000>>
+  SecurePasswordKdfAlgoSHA512: TlConstructor<ToArgs<MTProto.securePasswordKdfAlgoSHA512>>
+  SecureSecretSettings: TlConstructor<ToArgs<MTProto.secureSecretSettings>>
+  InputCheckPasswordEmpty: TlConstructor<ToArgs<MTProto.inputCheckPasswordEmpty>>
+  InputCheckPasswordSRP: TlConstructor<ToArgs<MTProto.inputCheckPasswordSRP>>
+  SecureRequiredType: TlConstructor<ToArgs<MTProto.secureRequiredType>>
+  SecureRequiredTypeOneOf: TlConstructor<ToArgs<MTProto.secureRequiredTypeOneOf>>
+  InputAppEvent: TlConstructor<ToArgs<MTProto.inputAppEvent>>
+  JsonObjectValue: TlConstructor<ToArgs<MTProto.jsonObjectValue>>
+  JsonNull: TlConstructor<ToArgs<MTProto.jsonNull>>
+  JsonBool: TlConstructor<ToArgs<MTProto.jsonBool>>
+  JsonNumber: TlConstructor<ToArgs<MTProto.jsonNumber>>
+  JsonString: TlConstructor<ToArgs<MTProto.jsonString>>
+  JsonArray: TlConstructor<ToArgs<MTProto.jsonArray>>
+  JsonObject: TlConstructor<ToArgs<MTProto.jsonObject>>
+  PageTableCell: TlConstructor<ToArgs<MTProto.pageTableCell>>
+  PageTableRow: TlConstructor<ToArgs<MTProto.pageTableRow>>
+  PageCaption: TlConstructor<ToArgs<MTProto.pageCaption>>
+  PageListItemText: TlConstructor<ToArgs<MTProto.pageListItemText>>
+  PageListItemBlocks: TlConstructor<ToArgs<MTProto.pageListItemBlocks>>
+  PageListOrderedItemText: TlConstructor<ToArgs<MTProto.pageListOrderedItemText>>
+  PageListOrderedItemBlocks: TlConstructor<ToArgs<MTProto.pageListOrderedItemBlocks>>
+  PageRelatedArticle: TlConstructor<ToArgs<MTProto.pageRelatedArticle>>
+  Page: TlConstructor<ToArgs<MTProto.page>>
+  PollAnswer: TlConstructor<ToArgs<MTProto.pollAnswer>>
+  Poll: TlConstructor<ToArgs<MTProto.poll>>
+  PollAnswerVoters: TlConstructor<ToArgs<MTProto.pollAnswerVoters>>
+  PollResults: TlConstructor<ToArgs<MTProto.pollResults>>
+  ChatOnlines: TlConstructor<ToArgs<MTProto.chatOnlines>>
+  StatsURL: TlConstructor<ToArgs<MTProto.statsURL>>
+  ChatAdminRights: TlConstructor<ToArgs<MTProto.chatAdminRights>>
+  ChatBannedRights: TlConstructor<ToArgs<MTProto.chatBannedRights>>
+  InputWallPaper: TlConstructor<ToArgs<MTProto.inputWallPaper>>
+  InputWallPaperSlug: TlConstructor<ToArgs<MTProto.inputWallPaperSlug>>
+  CodeSettings: TlConstructor<ToArgs<MTProto.codeSettings>>
+  WallPaperSettings: TlConstructor<ToArgs<MTProto.wallPaperSettings>>
+  AutoDownloadSettings: TlConstructor<ToArgs<MTProto.autoDownloadSettings>>
+  EmojiKeyword: TlConstructor<ToArgs<MTProto.emojiKeyword>>
+  EmojiKeywordDeleted: TlConstructor<ToArgs<MTProto.emojiKeywordDeleted>>
+  EmojiKeywordsDifference: TlConstructor<ToArgs<MTProto.emojiKeywordsDifference>>
+  EmojiURL: TlConstructor<ToArgs<MTProto.emojiURL>>
+  EmojiLanguage: TlConstructor<ToArgs<MTProto.emojiLanguage>>
+  FileLocationToBeDeprecated: TlConstructor<ToArgs<MTProto.fileLocationToBeDeprecated>>
+  Folder: TlConstructor<ToArgs<MTProto.folder>>
+  InputFolderPeer: TlConstructor<ToArgs<MTProto.inputFolderPeer>>
+  FolderPeer: TlConstructor<ToArgs<MTProto.folderPeer>>
+  UrlAuthResultRequest: TlConstructor<ToArgs<MTProto.urlAuthResultRequest>>
+  UrlAuthResultAccepted: TlConstructor<ToArgs<MTProto.urlAuthResultAccepted>>
+  UrlAuthResultDefault: TlConstructor<ToArgs<MTProto.urlAuthResultDefault>>
+  ChannelLocationEmpty: TlConstructor<ToArgs<MTProto.channelLocationEmpty>>
+  ChannelLocation: TlConstructor<ToArgs<MTProto.channelLocation>>
+  PeerLocated: TlConstructor<ToArgs<MTProto.peerLocated>>
+  RestrictionReason: TlConstructor<ToArgs<MTProto.restrictionReason>>
+  InputTheme: TlConstructor<ToArgs<MTProto.inputTheme>>
+  InputThemeSlug: TlConstructor<ToArgs<MTProto.inputThemeSlug>>
+  ThemeDocumentNotModified: TlConstructor<ToArgs<MTProto.themeDocumentNotModified>>
+  Theme: TlConstructor<ToArgs<MTProto.theme>>
+  ResPQ: TlConstructor<ToArgs<MTProto.resPQ>>
+  PQInnerData: TlConstructor<ToArgs<MTProto.pQInnerData>>
+  PQInnerDataDc: TlConstructor<ToArgs<MTProto.pQInnerDataDc>>
+  PQInnerDataTemp: TlConstructor<ToArgs<MTProto.pQInnerDataTemp>>
+  PQInnerDataTempDc: TlConstructor<ToArgs<MTProto.pQInnerDataTempDc>>
+  ServerDHParamsFail: TlConstructor<ToArgs<MTProto.serverDHParamsFail>>
+  ServerDHParamsOk: TlConstructor<ToArgs<MTProto.serverDHParamsOk>>
+  ServerDHInnerData: TlConstructor<ToArgs<MTProto.serverDHInnerData>>
+  ClientDHInnerData: TlConstructor<ToArgs<MTProto.clientDHInnerData>>
+  DhGenOk: TlConstructor<ToArgs<MTProto.dhGenOk>>
+  DhGenRetry: TlConstructor<ToArgs<MTProto.dhGenRetry>>
+  DhGenFail: TlConstructor<ToArgs<MTProto.dhGenFail>>
+  DestroyAuthKeyOk: TlConstructor<ToArgs<MTProto.destroyAuthKeyOk>>
+  DestroyAuthKeyNone: TlConstructor<ToArgs<MTProto.destroyAuthKeyNone>>
+  DestroyAuthKeyFail: TlConstructor<ToArgs<MTProto.destroyAuthKeyFail>>
+  MsgsAck: TlConstructor<ToArgs<MTProto.msgsAck>>
+  BadMsgNotification: TlConstructor<ToArgs<MTProto.badMsgNotification>>
+  BadServerSalt: TlConstructor<ToArgs<MTProto.badServerSalt>>
+  MsgsStateReq: TlConstructor<ToArgs<MTProto.msgsStateReq>>
+  MsgsStateInfo: TlConstructor<ToArgs<MTProto.msgsStateInfo>>
+  MsgsAllInfo: TlConstructor<ToArgs<MTProto.msgsAllInfo>>
+  MsgDetailedInfo: TlConstructor<ToArgs<MTProto.msgDetailedInfo>>
+  MsgNewDetailedInfo: TlConstructor<ToArgs<MTProto.msgNewDetailedInfo>>
+  MsgResendReq: TlConstructor<ToArgs<MTProto.msgResendReq>>
+  RpcError: TlConstructor<ToArgs<MTProto.rpcError>>
+  RpcAnswerUnknown: TlConstructor<ToArgs<MTProto.rpcAnswerUnknown>>
+  RpcAnswerDroppedRunning: TlConstructor<ToArgs<MTProto.rpcAnswerDroppedRunning>>
+  RpcAnswerDropped: TlConstructor<ToArgs<MTProto.rpcAnswerDropped>>
+  FutureSalt: TlConstructor<ToArgs<MTProto.futureSalt>>
+  FutureSalts: TlConstructor<ToArgs<MTProto.futureSalts>>
+  Pong: TlConstructor<ToArgs<MTProto.pong>>
+  DestroySessionOk: TlConstructor<ToArgs<MTProto.destroySessionOk>>
+  DestroySessionNone: TlConstructor<ToArgs<MTProto.destroySessionNone>>
+  NewSessionCreated: TlConstructor<ToArgs<MTProto.newSessionCreated>>
+  HttpWait: TlConstructor<ToArgs<MTProto.httpWait>>
+  IpPort: TlConstructor<ToArgs<MTProto.ipPort>>
+  IpPortSecret: TlConstructor<ToArgs<MTProto.ipPortSecret>>
+  AccessPointRule: TlConstructor<ToArgs<MTProto.accessPointRule>>
+  TlsClientHello: TlConstructor<ToArgs<MTProto.tlsClientHello>>
+  TlsBlockString: TlConstructor<ToArgs<MTProto.tlsBlockString>>
+  TlsBlockRandom: TlConstructor<ToArgs<MTProto.tlsBlockRandom>>
+  TlsBlockZero: TlConstructor<ToArgs<MTProto.tlsBlockZero>>
+  TlsBlockDomain: TlConstructor<ToArgs<MTProto.tlsBlockDomain>>
+  TlsBlockGrease: TlConstructor<ToArgs<MTProto.tlsBlockGrease>>
+  TlsBlockScope: TlConstructor<ToArgs<MTProto.tlsBlockScope>>
+  
+
+  storage: {
+    FileUnknown: TlConstructor<ToArgs<MTProto.storage_fileUnknown>>
+    FilePartial: TlConstructor<ToArgs<MTProto.storage_filePartial>>
+    FileJpeg: TlConstructor<ToArgs<MTProto.storage_fileJpeg>>
+    FileGif: TlConstructor<ToArgs<MTProto.storage_fileGif>>
+    FilePng: TlConstructor<ToArgs<MTProto.storage_filePng>>
+    FilePdf: TlConstructor<ToArgs<MTProto.storage_filePdf>>
+    FileMp3: TlConstructor<ToArgs<MTProto.storage_fileMp3>>
+    FileMov: TlConstructor<ToArgs<MTProto.storage_fileMov>>
+    FileMp4: TlConstructor<ToArgs<MTProto.storage_fileMp4>>
+    FileWebp: TlConstructor<ToArgs<MTProto.storage_fileWebp>>
+  }
+
+  auth: {
+    SentCode: TlConstructor<ToArgs<MTProto.auth_sentCode>>
+    Authorization: TlConstructor<ToArgs<MTProto.auth_authorization>>
+    AuthorizationSignUpRequired: TlConstructor<ToArgs<MTProto.auth_authorizationSignUpRequired>>
+    ExportedAuthorization: TlConstructor<ToArgs<MTProto.auth_exportedAuthorization>>
+    PasswordRecovery: TlConstructor<ToArgs<MTProto.auth_passwordRecovery>>
+    CodeTypeSms: TlConstructor<ToArgs<MTProto.auth_codeTypeSms>>
+    CodeTypeCall: TlConstructor<ToArgs<MTProto.auth_codeTypeCall>>
+    CodeTypeFlashCall: TlConstructor<ToArgs<MTProto.auth_codeTypeFlashCall>>
+    SentCodeTypeApp: TlConstructor<ToArgs<MTProto.auth_sentCodeTypeApp>>
+    SentCodeTypeSms: TlConstructor<ToArgs<MTProto.auth_sentCodeTypeSms>>
+    SentCodeTypeCall: TlConstructor<ToArgs<MTProto.auth_sentCodeTypeCall>>
+    SentCodeTypeFlashCall: TlConstructor<ToArgs<MTProto.auth_sentCodeTypeFlashCall>>
+  }
+
+  contacts: {
+    ContactsNotModified: TlConstructor<ToArgs<MTProto.contacts_contactsNotModified>>
+    Contacts: TlConstructor<ToArgs<MTProto.contacts_contacts>>
+    ImportedContacts: TlConstructor<ToArgs<MTProto.contacts_importedContacts>>
+    Blocked: TlConstructor<ToArgs<MTProto.contacts_blocked>>
+    BlockedSlice: TlConstructor<ToArgs<MTProto.contacts_blockedSlice>>
+    Found: TlConstructor<ToArgs<MTProto.contacts_found>>
+    ResolvedPeer: TlConstructor<ToArgs<MTProto.contacts_resolvedPeer>>
+    TopPeersNotModified: TlConstructor<ToArgs<MTProto.contacts_topPeersNotModified>>
+    TopPeers: TlConstructor<ToArgs<MTProto.contacts_topPeers>>
+    TopPeersDisabled: TlConstructor<ToArgs<MTProto.contacts_topPeersDisabled>>
+  }
+
+  messages: {
+    Dialogs: TlConstructor<ToArgs<MTProto.messages_dialogs>>
+    DialogsSlice: TlConstructor<ToArgs<MTProto.messages_dialogsSlice>>
+    DialogsNotModified: TlConstructor<ToArgs<MTProto.messages_dialogsNotModified>>
+    Messages: TlConstructor<ToArgs<MTProto.messages_messages>>
+    MessagesSlice: TlConstructor<ToArgs<MTProto.messages_messagesSlice>>
+    ChannelMessages: TlConstructor<ToArgs<MTProto.messages_channelMessages>>
+    MessagesNotModified: TlConstructor<ToArgs<MTProto.messages_messagesNotModified>>
+    Chats: TlConstructor<ToArgs<MTProto.messages_chats>>
+    ChatsSlice: TlConstructor<ToArgs<MTProto.messages_chatsSlice>>
+    ChatFull: TlConstructor<ToArgs<MTProto.messages_chatFull>>
+    AffectedHistory: TlConstructor<ToArgs<MTProto.messages_affectedHistory>>
+    DhConfigNotModified: TlConstructor<ToArgs<MTProto.messages_dhConfigNotModified>>
+    DhConfig: TlConstructor<ToArgs<MTProto.messages_dhConfig>>
+    SentEncryptedMessage: TlConstructor<ToArgs<MTProto.messages_sentEncryptedMessage>>
+    SentEncryptedFile: TlConstructor<ToArgs<MTProto.messages_sentEncryptedFile>>
+    StickersNotModified: TlConstructor<ToArgs<MTProto.messages_stickersNotModified>>
+    Stickers: TlConstructor<ToArgs<MTProto.messages_stickers>>
+    AllStickersNotModified: TlConstructor<ToArgs<MTProto.messages_allStickersNotModified>>
+    AllStickers: TlConstructor<ToArgs<MTProto.messages_allStickers>>
+    AffectedMessages: TlConstructor<ToArgs<MTProto.messages_affectedMessages>>
+    StickerSet: TlConstructor<ToArgs<MTProto.messages_stickerSet>>
+    FoundGifs: TlConstructor<ToArgs<MTProto.messages_foundGifs>>
+    SavedGifsNotModified: TlConstructor<ToArgs<MTProto.messages_savedGifsNotModified>>
+    SavedGifs: TlConstructor<ToArgs<MTProto.messages_savedGifs>>
+    BotResults: TlConstructor<ToArgs<MTProto.messages_botResults>>
+    BotCallbackAnswer: TlConstructor<ToArgs<MTProto.messages_botCallbackAnswer>>
+    MessageEditData: TlConstructor<ToArgs<MTProto.messages_messageEditData>>
+    PeerDialogs: TlConstructor<ToArgs<MTProto.messages_peerDialogs>>
+    FeaturedStickersNotModified: TlConstructor<ToArgs<MTProto.messages_featuredStickersNotModified>>
+    FeaturedStickers: TlConstructor<ToArgs<MTProto.messages_featuredStickers>>
+    RecentStickersNotModified: TlConstructor<ToArgs<MTProto.messages_recentStickersNotModified>>
+    RecentStickers: TlConstructor<ToArgs<MTProto.messages_recentStickers>>
+    ArchivedStickers: TlConstructor<ToArgs<MTProto.messages_archivedStickers>>
+    StickerSetInstallResultSuccess: TlConstructor<ToArgs<MTProto.messages_stickerSetInstallResultSuccess>>
+    StickerSetInstallResultArchive: TlConstructor<ToArgs<MTProto.messages_stickerSetInstallResultArchive>>
+    HighScores: TlConstructor<ToArgs<MTProto.messages_highScores>>
+    FavedStickersNotModified: TlConstructor<ToArgs<MTProto.messages_favedStickersNotModified>>
+    FavedStickers: TlConstructor<ToArgs<MTProto.messages_favedStickers>>
+    FoundStickerSetsNotModified: TlConstructor<ToArgs<MTProto.messages_foundStickerSetsNotModified>>
+    FoundStickerSets: TlConstructor<ToArgs<MTProto.messages_foundStickerSets>>
+    SearchCounter: TlConstructor<ToArgs<MTProto.messages_searchCounter>>
+  }
+
+  updates: {
+    State: TlConstructor<ToArgs<MTProto.updates_state>>
+    DifferenceEmpty: TlConstructor<ToArgs<MTProto.updates_differenceEmpty>>
+    Difference: TlConstructor<ToArgs<MTProto.updates_difference>>
+    DifferenceSlice: TlConstructor<ToArgs<MTProto.updates_differenceSlice>>
+    DifferenceTooLong: TlConstructor<ToArgs<MTProto.updates_differenceTooLong>>
+    ChannelDifferenceEmpty: TlConstructor<ToArgs<MTProto.updates_channelDifferenceEmpty>>
+    ChannelDifferenceTooLong: TlConstructor<ToArgs<MTProto.updates_channelDifferenceTooLong>>
+    ChannelDifference: TlConstructor<ToArgs<MTProto.updates_channelDifference>>
+  }
+
+  photos: {
+    Photos: TlConstructor<ToArgs<MTProto.photos_photos>>
+    PhotosSlice: TlConstructor<ToArgs<MTProto.photos_photosSlice>>
+    Photo: TlConstructor<ToArgs<MTProto.photos_photo>>
+  }
+
+  upload: {
+    File: TlConstructor<ToArgs<MTProto.upload_file>>
+    FileCdnRedirect: TlConstructor<ToArgs<MTProto.upload_fileCdnRedirect>>
+    WebFile: TlConstructor<ToArgs<MTProto.upload_webFile>>
+    CdnFileReuploadNeeded: TlConstructor<ToArgs<MTProto.upload_cdnFileReuploadNeeded>>
+    CdnFile: TlConstructor<ToArgs<MTProto.upload_cdnFile>>
+  }
+
+  help: {
+    AppUpdate: TlConstructor<ToArgs<MTProto.help_appUpdate>>
+    NoAppUpdate: TlConstructor<ToArgs<MTProto.help_noAppUpdate>>
+    InviteText: TlConstructor<ToArgs<MTProto.help_inviteText>>
+    Support: TlConstructor<ToArgs<MTProto.help_support>>
+    TermsOfService: TlConstructor<ToArgs<MTProto.help_termsOfService>>
+    RecentMeUrls: TlConstructor<ToArgs<MTProto.help_recentMeUrls>>
+    ProxyDataEmpty: TlConstructor<ToArgs<MTProto.help_proxyDataEmpty>>
+    ProxyDataPromo: TlConstructor<ToArgs<MTProto.help_proxyDataPromo>>
+    TermsOfServiceUpdateEmpty: TlConstructor<ToArgs<MTProto.help_termsOfServiceUpdateEmpty>>
+    TermsOfServiceUpdate: TlConstructor<ToArgs<MTProto.help_termsOfServiceUpdate>>
+    DeepLinkInfoEmpty: TlConstructor<ToArgs<MTProto.help_deepLinkInfoEmpty>>
+    DeepLinkInfo: TlConstructor<ToArgs<MTProto.help_deepLinkInfo>>
+    PassportConfigNotModified: TlConstructor<ToArgs<MTProto.help_passportConfigNotModified>>
+    PassportConfig: TlConstructor<ToArgs<MTProto.help_passportConfig>>
+    SupportName: TlConstructor<ToArgs<MTProto.help_supportName>>
+    UserInfoEmpty: TlConstructor<ToArgs<MTProto.help_userInfoEmpty>>
+    UserInfo: TlConstructor<ToArgs<MTProto.help_userInfo>>
+    ConfigSimple: TlConstructor<ToArgs<MTProto.help_configSimple>>
+  }
+
+  account: {
+    PrivacyRules: TlConstructor<ToArgs<MTProto.account_privacyRules>>
+    Authorizations: TlConstructor<ToArgs<MTProto.account_authorizations>>
+    Password: TlConstructor<ToArgs<MTProto.account_password>>
+    PasswordSettings: TlConstructor<ToArgs<MTProto.account_passwordSettings>>
+    PasswordInputSettings: TlConstructor<ToArgs<MTProto.account_passwordInputSettings>>
+    TmpPassword: TlConstructor<ToArgs<MTProto.account_tmpPassword>>
+    WebAuthorizations: TlConstructor<ToArgs<MTProto.account_webAuthorizations>>
+    AuthorizationForm: TlConstructor<ToArgs<MTProto.account_authorizationForm>>
+    SentEmailCode: TlConstructor<ToArgs<MTProto.account_sentEmailCode>>
+    Takeout: TlConstructor<ToArgs<MTProto.account_takeout>>
+    WallPapersNotModified: TlConstructor<ToArgs<MTProto.account_wallPapersNotModified>>
+    WallPapers: TlConstructor<ToArgs<MTProto.account_wallPapers>>
+    AutoDownloadSettings: TlConstructor<ToArgs<MTProto.account_autoDownloadSettings>>
+    ThemesNotModified: TlConstructor<ToArgs<MTProto.account_themesNotModified>>
+    Themes: TlConstructor<ToArgs<MTProto.account_themes>>
+  }
+
+  channels: {
+    ChannelParticipants: TlConstructor<ToArgs<MTProto.channels_channelParticipants>>
+    ChannelParticipantsNotModified: TlConstructor<ToArgs<MTProto.channels_channelParticipantsNotModified>>
+    ChannelParticipant: TlConstructor<ToArgs<MTProto.channels_channelParticipant>>
+    AdminLogResults: TlConstructor<ToArgs<MTProto.channels_adminLogResults>>
+  }
+
+  payments: {
+    PaymentForm: TlConstructor<ToArgs<MTProto.payments_paymentForm>>
+    ValidatedRequestedInfo: TlConstructor<ToArgs<MTProto.payments_validatedRequestedInfo>>
+    PaymentResult: TlConstructor<ToArgs<MTProto.payments_paymentResult>>
+    PaymentVerificationNeeded: TlConstructor<ToArgs<MTProto.payments_paymentVerificationNeeded>>
+    PaymentReceipt: TlConstructor<ToArgs<MTProto.payments_paymentReceipt>>
+    SavedInfo: TlConstructor<ToArgs<MTProto.payments_savedInfo>>
+  }
+
+  phone: {
+    PhoneCall: TlConstructor<ToArgs<MTProto.phone_phoneCall>>
+  }
+}
+
+interface Requests {
+  InvokeAfterMsgRequest: TlRequest<
+    Partial<MTProto.invokeAfterMsgRequest>,
+    MTProto.X
+  >
+  InvokeAfterMsgsRequest: TlRequest<
+    Partial<MTProto.invokeAfterMsgsRequest>,
+    MTProto.X
+  >
+  InitConnectionRequest: TlRequest<
+    Partial<MTProto.initConnectionRequest>,
+    MTProto.X
+  >
+  InvokeWithLayerRequest: TlRequest<
+    Partial<MTProto.invokeWithLayerRequest>,
+    MTProto.X
+  >
+  InvokeWithoutUpdatesRequest: TlRequest<
+    Partial<MTProto.invokeWithoutUpdatesRequest>,
+    MTProto.X
+  >
+  InvokeWithMessagesRangeRequest: TlRequest<
+    Partial<MTProto.invokeWithMessagesRangeRequest>,
+    MTProto.X
+  >
+  InvokeWithTakeoutRequest: TlRequest<
+    Partial<MTProto.invokeWithTakeoutRequest>,
+    MTProto.X
+  >
+  ReqPqRequest: TlRequest<
+    Partial<MTProto.reqPqRequest>,
+    MTProto.ResPQ
+  >
+  ReqPqMultiRequest: TlRequest<
+    Partial<MTProto.reqPqMultiRequest>,
+    MTProto.ResPQ
+  >
+  ReqDHParamsRequest: TlRequest<
+    Partial<MTProto.reqDHParamsRequest>,
+    MTProto.Server_DH_Params
+  >
+  SetClientDHParamsRequest: TlRequest<
+    Partial<MTProto.setClientDHParamsRequest>,
+    MTProto.Set_client_DH_params_answer
+  >
+  DestroyAuthKeyRequest: TlRequest<
+    Partial<MTProto.destroyAuthKeyRequest>,
+    MTProto.DestroyAuthKeyRes
+  >
+  RpcDropAnswerRequest: TlRequest<
+    Partial<MTProto.rpcDropAnswerRequest>,
+    MTProto.RpcDropAnswer
+  >
+  GetFutureSaltsRequest: TlRequest<
+    Partial<MTProto.getFutureSaltsRequest>,
+    MTProto.FutureSalts
+  >
+  PingRequest: TlRequest<
+    Partial<MTProto.pingRequest>,
+    MTProto.Pong
+  >
+  PingDelayDisconnectRequest: TlRequest<
+    Partial<MTProto.pingDelayDisconnectRequest>,
+    MTProto.Pong
+  >
+  DestroySessionRequest: TlRequest<
+    Partial<MTProto.destroySessionRequest>,
+    MTProto.DestroySessionRes
+  >
+  
+
+  auth: {
+    SendCodeRequest: TlRequest<
+      Partial<MTProto.auth_sendCodeRequest>,
+      MTProto.auth_SentCode
+    >
+    SignUpRequest: TlRequest<
+      Partial<MTProto.auth_signUpRequest>,
+      MTProto.auth_Authorization
+    >
+    SignInRequest: TlRequest<
+      Partial<MTProto.auth_signInRequest>,
+      MTProto.auth_Authorization
+    >
+    LogOutRequest: TlRequest<
+      Partial<MTProto.auth_logOutRequest>,
+      MTProto.Bool
+    >
+    ResetAuthorizationsRequest: TlRequest<
+      Partial<MTProto.auth_resetAuthorizationsRequest>,
+      MTProto.Bool
+    >
+    ExportAuthorizationRequest: TlRequest<
+      Partial<MTProto.auth_exportAuthorizationRequest>,
+      MTProto.auth_ExportedAuthorization
+    >
+    ImportAuthorizationRequest: TlRequest<
+      Partial<MTProto.auth_importAuthorizationRequest>,
+      MTProto.auth_Authorization
+    >
+    BindTempAuthKeyRequest: TlRequest<
+      Partial<MTProto.auth_bindTempAuthKeyRequest>,
+      MTProto.Bool
+    >
+    ImportBotAuthorizationRequest: TlRequest<
+      Partial<MTProto.auth_importBotAuthorizationRequest>,
+      MTProto.auth_Authorization
+    >
+    CheckPasswordRequest: TlRequest<
+      Partial<MTProto.auth_checkPasswordRequest>,
+      MTProto.auth_Authorization
+    >
+    RequestPasswordRecoveryRequest: TlRequest<
+      Partial<MTProto.auth_requestPasswordRecoveryRequest>,
+      MTProto.auth_PasswordRecovery
+    >
+    RecoverPasswordRequest: TlRequest<
+      Partial<MTProto.auth_recoverPasswordRequest>,
+      MTProto.auth_Authorization
+    >
+    ResendCodeRequest: TlRequest<
+      Partial<MTProto.auth_resendCodeRequest>,
+      MTProto.auth_SentCode
+    >
+    CancelCodeRequest: TlRequest<
+      Partial<MTProto.auth_cancelCodeRequest>,
+      MTProto.Bool
+    >
+    DropTempAuthKeysRequest: TlRequest<
+      Partial<MTProto.auth_dropTempAuthKeysRequest>,
+      MTProto.Bool
+    >
+  }
+
+  account: {
+    RegisterDeviceRequest: TlRequest<
+      Partial<MTProto.account_registerDeviceRequest>,
+      MTProto.Bool
+    >
+    UnregisterDeviceRequest: TlRequest<
+      Partial<MTProto.account_unregisterDeviceRequest>,
+      MTProto.Bool
+    >
+    UpdateNotifySettingsRequest: TlRequest<
+      Partial<MTProto.account_updateNotifySettingsRequest>,
+      MTProto.Bool
+    >
+    GetNotifySettingsRequest: TlRequest<
+      Partial<MTProto.account_getNotifySettingsRequest>,
+      MTProto.PeerNotifySettings
+    >
+    ResetNotifySettingsRequest: TlRequest<
+      Partial<MTProto.account_resetNotifySettingsRequest>,
+      MTProto.Bool
+    >
+    UpdateProfileRequest: TlRequest<
+      Partial<MTProto.account_updateProfileRequest>,
+      MTProto.User
+    >
+    UpdateStatusRequest: TlRequest<
+      Partial<MTProto.account_updateStatusRequest>,
+      MTProto.Bool
+    >
+    GetWallPapersRequest: TlRequest<
+      Partial<MTProto.account_getWallPapersRequest>,
+      MTProto.account_WallPapers
+    >
+    ReportPeerRequest: TlRequest<
+      Partial<MTProto.account_reportPeerRequest>,
+      MTProto.Bool
+    >
+    CheckUsernameRequest: TlRequest<
+      Partial<MTProto.account_checkUsernameRequest>,
+      MTProto.Bool
+    >
+    UpdateUsernameRequest: TlRequest<
+      Partial<MTProto.account_updateUsernameRequest>,
+      MTProto.User
+    >
+    GetPrivacyRequest: TlRequest<
+      Partial<MTProto.account_getPrivacyRequest>,
+      MTProto.account_PrivacyRules
+    >
+    SetPrivacyRequest: TlRequest<
+      Partial<MTProto.account_setPrivacyRequest>,
+      MTProto.account_PrivacyRules
+    >
+    DeleteAccountRequest: TlRequest<
+      Partial<MTProto.account_deleteAccountRequest>,
+      MTProto.Bool
+    >
+    GetAccountTTLRequest: TlRequest<
+      Partial<MTProto.account_getAccountTTLRequest>,
+      MTProto.AccountDaysTTL
+    >
+    SetAccountTTLRequest: TlRequest<
+      Partial<MTProto.account_setAccountTTLRequest>,
+      MTProto.Bool
+    >
+    SendChangePhoneCodeRequest: TlRequest<
+      Partial<MTProto.account_sendChangePhoneCodeRequest>,
+      MTProto.auth_SentCode
+    >
+    ChangePhoneRequest: TlRequest<
+      Partial<MTProto.account_changePhoneRequest>,
+      MTProto.User
+    >
+    UpdateDeviceLockedRequest: TlRequest<
+      Partial<MTProto.account_updateDeviceLockedRequest>,
+      MTProto.Bool
+    >
+    GetAuthorizationsRequest: TlRequest<
+      Partial<MTProto.account_getAuthorizationsRequest>,
+      MTProto.account_Authorizations
+    >
+    ResetAuthorizationRequest: TlRequest<
+      Partial<MTProto.account_resetAuthorizationRequest>,
+      MTProto.Bool
+    >
+    GetPasswordRequest: TlRequest<
+      Partial<MTProto.account_getPasswordRequest>,
+      MTProto.account_Password
+    >
+    GetPasswordSettingsRequest: TlRequest<
+      Partial<MTProto.account_getPasswordSettingsRequest>,
+      MTProto.account_PasswordSettings
+    >
+    UpdatePasswordSettingsRequest: TlRequest<
+      Partial<MTProto.account_updatePasswordSettingsRequest>,
+      MTProto.Bool
+    >
+    SendConfirmPhoneCodeRequest: TlRequest<
+      Partial<MTProto.account_sendConfirmPhoneCodeRequest>,
+      MTProto.auth_SentCode
+    >
+    ConfirmPhoneRequest: TlRequest<
+      Partial<MTProto.account_confirmPhoneRequest>,
+      MTProto.Bool
+    >
+    GetTmpPasswordRequest: TlRequest<
+      Partial<MTProto.account_getTmpPasswordRequest>,
+      MTProto.account_TmpPassword
+    >
+    GetWebAuthorizationsRequest: TlRequest<
+      Partial<MTProto.account_getWebAuthorizationsRequest>,
+      MTProto.account_WebAuthorizations
+    >
+    ResetWebAuthorizationRequest: TlRequest<
+      Partial<MTProto.account_resetWebAuthorizationRequest>,
+      MTProto.Bool
+    >
+    ResetWebAuthorizationsRequest: TlRequest<
+      Partial<MTProto.account_resetWebAuthorizationsRequest>,
+      MTProto.Bool
+    >
+    GetAllSecureValuesRequest: TlRequest<
+      Partial<MTProto.account_getAllSecureValuesRequest>,
+      MTProto.SecureValue[]
+    >
+    GetSecureValueRequest: TlRequest<
+      Partial<MTProto.account_getSecureValueRequest>,
+      MTProto.SecureValue[]
+    >
+    SaveSecureValueRequest: TlRequest<
+      Partial<MTProto.account_saveSecureValueRequest>,
+      MTProto.SecureValue
+    >
+    DeleteSecureValueRequest: TlRequest<
+      Partial<MTProto.account_deleteSecureValueRequest>,
+      MTProto.Bool
+    >
+    GetAuthorizationFormRequest: TlRequest<
+      Partial<MTProto.account_getAuthorizationFormRequest>,
+      MTProto.account_AuthorizationForm
+    >
+    AcceptAuthorizationRequest: TlRequest<
+      Partial<MTProto.account_acceptAuthorizationRequest>,
+      MTProto.Bool
+    >
+    SendVerifyPhoneCodeRequest: TlRequest<
+      Partial<MTProto.account_sendVerifyPhoneCodeRequest>,
+      MTProto.auth_SentCode
+    >
+    VerifyPhoneRequest: TlRequest<
+      Partial<MTProto.account_verifyPhoneRequest>,
+      MTProto.Bool
+    >
+    SendVerifyEmailCodeRequest: TlRequest<
+      Partial<MTProto.account_sendVerifyEmailCodeRequest>,
+      MTProto.account_SentEmailCode
+    >
+    VerifyEmailRequest: TlRequest<
+      Partial<MTProto.account_verifyEmailRequest>,
+      MTProto.Bool
+    >
+    InitTakeoutSessionRequest: TlRequest<
+      Partial<MTProto.account_initTakeoutSessionRequest>,
+      MTProto.account_Takeout
+    >
+    FinishTakeoutSessionRequest: TlRequest<
+      Partial<MTProto.account_finishTakeoutSessionRequest>,
+      MTProto.Bool
+    >
+    ConfirmPasswordEmailRequest: TlRequest<
+      Partial<MTProto.account_confirmPasswordEmailRequest>,
+      MTProto.Bool
+    >
+    ResendPasswordEmailRequest: TlRequest<
+      Partial<MTProto.account_resendPasswordEmailRequest>,
+      MTProto.Bool
+    >
+    CancelPasswordEmailRequest: TlRequest<
+      Partial<MTProto.account_cancelPasswordEmailRequest>,
+      MTProto.Bool
+    >
+    GetContactSignUpNotificationRequest: TlRequest<
+      Partial<MTProto.account_getContactSignUpNotificationRequest>,
+      MTProto.Bool
+    >
+    SetContactSignUpNotificationRequest: TlRequest<
+      Partial<MTProto.account_setContactSignUpNotificationRequest>,
+      MTProto.Bool
+    >
+    GetNotifyExceptionsRequest: TlRequest<
+      Partial<MTProto.account_getNotifyExceptionsRequest>,
+      MTProto.Updates
+    >
+    GetWallPaperRequest: TlRequest<
+      Partial<MTProto.account_getWallPaperRequest>,
+      MTProto.WallPaper
+    >
+    UploadWallPaperRequest: TlRequest<
+      Partial<MTProto.account_uploadWallPaperRequest>,
+      MTProto.WallPaper
+    >
+    SaveWallPaperRequest: TlRequest<
+      Partial<MTProto.account_saveWallPaperRequest>,
+      MTProto.Bool
+    >
+    InstallWallPaperRequest: TlRequest<
+      Partial<MTProto.account_installWallPaperRequest>,
+      MTProto.Bool
+    >
+    ResetWallPapersRequest: TlRequest<
+      Partial<MTProto.account_resetWallPapersRequest>,
+      MTProto.Bool
+    >
+    GetAutoDownloadSettingsRequest: TlRequest<
+      Partial<MTProto.account_getAutoDownloadSettingsRequest>,
+      MTProto.account_AutoDownloadSettings
+    >
+    SaveAutoDownloadSettingsRequest: TlRequest<
+      Partial<MTProto.account_saveAutoDownloadSettingsRequest>,
+      MTProto.Bool
+    >
+    UploadThemeRequest: TlRequest<
+      Partial<MTProto.account_uploadThemeRequest>,
+      MTProto.Document
+    >
+    CreateThemeRequest: TlRequest<
+      Partial<MTProto.account_createThemeRequest>,
+      MTProto.Theme
+    >
+    UpdateThemeRequest: TlRequest<
+      Partial<MTProto.account_updateThemeRequest>,
+      MTProto.Theme
+    >
+    SaveThemeRequest: TlRequest<
+      Partial<MTProto.account_saveThemeRequest>,
+      MTProto.Bool
+    >
+    InstallThemeRequest: TlRequest<
+      Partial<MTProto.account_installThemeRequest>,
+      MTProto.Bool
+    >
+    GetThemeRequest: TlRequest<
+      Partial<MTProto.account_getThemeRequest>,
+      MTProto.Theme
+    >
+    GetThemesRequest: TlRequest<
+      Partial<MTProto.account_getThemesRequest>,
+      MTProto.account_Themes
+    >
+  }
+
+  users: {
+    GetUsersRequest: TlRequest<
+      Partial<MTProto.users_getUsersRequest>,
+      MTProto.User[]
+    >
+    GetFullUserRequest: TlRequest<
+      Partial<MTProto.users_getFullUserRequest>,
+      MTProto.UserFull
+    >
+    SetSecureValueErrorsRequest: TlRequest<
+      Partial<MTProto.users_setSecureValueErrorsRequest>,
+      MTProto.Bool
+    >
+  }
+
+  contacts: {
+    GetContactIDsRequest: TlRequest<
+      Partial<MTProto.contacts_getContactIDsRequest>,
+      MTProto.int[]
+    >
+    GetStatusesRequest: TlRequest<
+      Partial<MTProto.contacts_getStatusesRequest>,
+      MTProto.ContactStatus[]
+    >
+    GetContactsRequest: TlRequest<
+      Partial<MTProto.contacts_getContactsRequest>,
+      MTProto.contacts_Contacts
+    >
+    ImportContactsRequest: TlRequest<
+      Partial<MTProto.contacts_importContactsRequest>,
+      MTProto.contacts_ImportedContacts
+    >
+    DeleteContactsRequest: TlRequest<
+      Partial<MTProto.contacts_deleteContactsRequest>,
+      MTProto.Updates
+    >
+    DeleteByPhonesRequest: TlRequest<
+      Partial<MTProto.contacts_deleteByPhonesRequest>,
+      MTProto.Bool
+    >
+    BlockRequest: TlRequest<
+      Partial<MTProto.contacts_blockRequest>,
+      MTProto.Bool
+    >
+    UnblockRequest: TlRequest<
+      Partial<MTProto.contacts_unblockRequest>,
+      MTProto.Bool
+    >
+    GetBlockedRequest: TlRequest<
+      Partial<MTProto.contacts_getBlockedRequest>,
+      MTProto.contacts_Blocked
+    >
+    SearchRequest: TlRequest<
+      Partial<MTProto.contacts_searchRequest>,
+      MTProto.contacts_Found
+    >
+    ResolveUsernameRequest: TlRequest<
+      Partial<MTProto.contacts_resolveUsernameRequest>,
+      MTProto.contacts_ResolvedPeer
+    >
+    GetTopPeersRequest: TlRequest<
+      Partial<MTProto.contacts_getTopPeersRequest>,
+      MTProto.contacts_TopPeers
+    >
+    ResetTopPeerRatingRequest: TlRequest<
+      Partial<MTProto.contacts_resetTopPeerRatingRequest>,
+      MTProto.Bool
+    >
+    ResetSavedRequest: TlRequest<
+      Partial<MTProto.contacts_resetSavedRequest>,
+      MTProto.Bool
+    >
+    GetSavedRequest: TlRequest<
+      Partial<MTProto.contacts_getSavedRequest>,
+      MTProto.SavedContact[]
+    >
+    ToggleTopPeersRequest: TlRequest<
+      Partial<MTProto.contacts_toggleTopPeersRequest>,
+      MTProto.Bool
+    >
+    AddContactRequest: TlRequest<
+      Partial<MTProto.contacts_addContactRequest>,
+      MTProto.Updates
+    >
+    AcceptContactRequest: TlRequest<
+      Partial<MTProto.contacts_acceptContactRequest>,
+      MTProto.Updates
+    >
+    GetLocatedRequest: TlRequest<
+      Partial<MTProto.contacts_getLocatedRequest>,
+      MTProto.Updates
+    >
+  }
+
+  messages: {
+    GetMessagesRequest: TlRequest<
+      Partial<MTProto.messages_getMessagesRequest>,
+      MTProto.messages_Messages
+    >
+    GetDialogsRequest: TlRequest<
+      Partial<MTProto.messages_getDialogsRequest>,
+      MTProto.messages_Dialogs
+    >
+    GetHistoryRequest: TlRequest<
+      Partial<MTProto.messages_getHistoryRequest>,
+      MTProto.messages_Messages
+    >
+    SearchRequest: TlRequest<
+      Partial<MTProto.messages_searchRequest>,
+      MTProto.messages_Messages
+    >
+    ReadHistoryRequest: TlRequest<
+      Partial<MTProto.messages_readHistoryRequest>,
+      MTProto.messages_AffectedMessages
+    >
+    DeleteHistoryRequest: TlRequest<
+      Partial<MTProto.messages_deleteHistoryRequest>,
+      MTProto.messages_AffectedHistory
+    >
+    DeleteMessagesRequest: TlRequest<
+      Partial<MTProto.messages_deleteMessagesRequest>,
+      MTProto.messages_AffectedMessages
+    >
+    ReceivedMessagesRequest: TlRequest<
+      Partial<MTProto.messages_receivedMessagesRequest>,
+      MTProto.ReceivedNotifyMessage[]
+    >
+    SetTypingRequest: TlRequest<
+      Partial<MTProto.messages_setTypingRequest>,
+      MTProto.Bool
+    >
+    SendMessageRequest: TlRequest<
+      Partial<MTProto.messages_sendMessageRequest>,
+      MTProto.Updates
+    >
+    SendMediaRequest: TlRequest<
+      Partial<MTProto.messages_sendMediaRequest>,
+      MTProto.Updates
+    >
+    ForwardMessagesRequest: TlRequest<
+      Partial<MTProto.messages_forwardMessagesRequest>,
+      MTProto.Updates
+    >
+    ReportSpamRequest: TlRequest<
+      Partial<MTProto.messages_reportSpamRequest>,
+      MTProto.Bool
+    >
+    GetPeerSettingsRequest: TlRequest<
+      Partial<MTProto.messages_getPeerSettingsRequest>,
+      MTProto.PeerSettings
+    >
+    ReportRequest: TlRequest<
+      Partial<MTProto.messages_reportRequest>,
+      MTProto.Bool
+    >
+    GetChatsRequest: TlRequest<
+      Partial<MTProto.messages_getChatsRequest>,
+      MTProto.messages_Chats
+    >
+    GetFullChatRequest: TlRequest<
+      Partial<MTProto.messages_getFullChatRequest>,
+      MTProto.messages_ChatFull
+    >
+    EditChatTitleRequest: TlRequest<
+      Partial<MTProto.messages_editChatTitleRequest>,
+      MTProto.Updates
+    >
+    EditChatPhotoRequest: TlRequest<
+      Partial<MTProto.messages_editChatPhotoRequest>,
+      MTProto.Updates
+    >
+    AddChatUserRequest: TlRequest<
+      Partial<MTProto.messages_addChatUserRequest>,
+      MTProto.Updates
+    >
+    DeleteChatUserRequest: TlRequest<
+      Partial<MTProto.messages_deleteChatUserRequest>,
+      MTProto.Updates
+    >
+    CreateChatRequest: TlRequest<
+      Partial<MTProto.messages_createChatRequest>,
+      MTProto.Updates
+    >
+    GetDhConfigRequest: TlRequest<
+      Partial<MTProto.messages_getDhConfigRequest>,
+      MTProto.messages_DhConfig
+    >
+    RequestEncryptionRequest: TlRequest<
+      Partial<MTProto.messages_requestEncryptionRequest>,
+      MTProto.EncryptedChat
+    >
+    AcceptEncryptionRequest: TlRequest<
+      Partial<MTProto.messages_acceptEncryptionRequest>,
+      MTProto.EncryptedChat
+    >
+    DiscardEncryptionRequest: TlRequest<
+      Partial<MTProto.messages_discardEncryptionRequest>,
+      MTProto.Bool
+    >
+    SetEncryptedTypingRequest: TlRequest<
+      Partial<MTProto.messages_setEncryptedTypingRequest>,
+      MTProto.Bool
+    >
+    ReadEncryptedHistoryRequest: TlRequest<
+      Partial<MTProto.messages_readEncryptedHistoryRequest>,
+      MTProto.Bool
+    >
+    SendEncryptedRequest: TlRequest<
+      Partial<MTProto.messages_sendEncryptedRequest>,
+      MTProto.messages_SentEncryptedMessage
+    >
+    SendEncryptedFileRequest: TlRequest<
+      Partial<MTProto.messages_sendEncryptedFileRequest>,
+      MTProto.messages_SentEncryptedMessage
+    >
+    SendEncryptedServiceRequest: TlRequest<
+      Partial<MTProto.messages_sendEncryptedServiceRequest>,
+      MTProto.messages_SentEncryptedMessage
+    >
+    ReceivedQueueRequest: TlRequest<
+      Partial<MTProto.messages_receivedQueueRequest>,
+      MTProto.long[]
+    >
+    ReportEncryptedSpamRequest: TlRequest<
+      Partial<MTProto.messages_reportEncryptedSpamRequest>,
+      MTProto.Bool
+    >
+    ReadMessageContentsRequest: TlRequest<
+      Partial<MTProto.messages_readMessageContentsRequest>,
+      MTProto.messages_AffectedMessages
+    >
+    GetStickersRequest: TlRequest<
+      Partial<MTProto.messages_getStickersRequest>,
+      MTProto.messages_Stickers
+    >
+    GetAllStickersRequest: TlRequest<
+      Partial<MTProto.messages_getAllStickersRequest>,
+      MTProto.messages_AllStickers
+    >
+    GetWebPagePreviewRequest: TlRequest<
+      Partial<MTProto.messages_getWebPagePreviewRequest>,
+      MTProto.MessageMedia
+    >
+    ExportChatInviteRequest: TlRequest<
+      Partial<MTProto.messages_exportChatInviteRequest>,
+      MTProto.ExportedChatInvite
+    >
+    CheckChatInviteRequest: TlRequest<
+      Partial<MTProto.messages_checkChatInviteRequest>,
+      MTProto.ChatInvite
+    >
+    ImportChatInviteRequest: TlRequest<
+      Partial<MTProto.messages_importChatInviteRequest>,
+      MTProto.Updates
+    >
+    GetStickerSetRequest: TlRequest<
+      Partial<MTProto.messages_getStickerSetRequest>,
+      MTProto.messages_StickerSet
+    >
+    InstallStickerSetRequest: TlRequest<
+      Partial<MTProto.messages_installStickerSetRequest>,
+      MTProto.messages_StickerSetInstallResult
+    >
+    UninstallStickerSetRequest: TlRequest<
+      Partial<MTProto.messages_uninstallStickerSetRequest>,
+      MTProto.Bool
+    >
+    StartBotRequest: TlRequest<
+      Partial<MTProto.messages_startBotRequest>,
+      MTProto.Updates
+    >
+    GetMessagesViewsRequest: TlRequest<
+      Partial<MTProto.messages_getMessagesViewsRequest>,
+      MTProto.int[]
+    >
+    EditChatAdminRequest: TlRequest<
+      Partial<MTProto.messages_editChatAdminRequest>,
+      MTProto.Bool
+    >
+    MigrateChatRequest: TlRequest<
+      Partial<MTProto.messages_migrateChatRequest>,
+      MTProto.Updates
+    >
+    SearchGlobalRequest: TlRequest<
+      Partial<MTProto.messages_searchGlobalRequest>,
+      MTProto.messages_Messages
+    >
+    ReorderStickerSetsRequest: TlRequest<
+      Partial<MTProto.messages_reorderStickerSetsRequest>,
+      MTProto.Bool
+    >
+    GetDocumentByHashRequest: TlRequest<
+      Partial<MTProto.messages_getDocumentByHashRequest>,
+      MTProto.Document
+    >
+    SearchGifsRequest: TlRequest<
+      Partial<MTProto.messages_searchGifsRequest>,
+      MTProto.messages_FoundGifs
+    >
+    GetSavedGifsRequest: TlRequest<
+      Partial<MTProto.messages_getSavedGifsRequest>,
+      MTProto.messages_SavedGifs
+    >
+    SaveGifRequest: TlRequest<
+      Partial<MTProto.messages_saveGifRequest>,
+      MTProto.Bool
+    >
+    GetInlineBotResultsRequest: TlRequest<
+      Partial<MTProto.messages_getInlineBotResultsRequest>,
+      MTProto.messages_BotResults
+    >
+    SetInlineBotResultsRequest: TlRequest<
+      Partial<MTProto.messages_setInlineBotResultsRequest>,
+      MTProto.Bool
+    >
+    SendInlineBotResultRequest: TlRequest<
+      Partial<MTProto.messages_sendInlineBotResultRequest>,
+      MTProto.Updates
+    >
+    GetMessageEditDataRequest: TlRequest<
+      Partial<MTProto.messages_getMessageEditDataRequest>,
+      MTProto.messages_MessageEditData
+    >
+    EditMessageRequest: TlRequest<
+      Partial<MTProto.messages_editMessageRequest>,
+      MTProto.Updates
+    >
+    EditInlineBotMessageRequest: TlRequest<
+      Partial<MTProto.messages_editInlineBotMessageRequest>,
+      MTProto.Bool
+    >
+    GetBotCallbackAnswerRequest: TlRequest<
+      Partial<MTProto.messages_getBotCallbackAnswerRequest>,
+      MTProto.messages_BotCallbackAnswer
+    >
+    SetBotCallbackAnswerRequest: TlRequest<
+      Partial<MTProto.messages_setBotCallbackAnswerRequest>,
+      MTProto.Bool
+    >
+    GetPeerDialogsRequest: TlRequest<
+      Partial<MTProto.messages_getPeerDialogsRequest>,
+      MTProto.messages_PeerDialogs
+    >
+    SaveDraftRequest: TlRequest<
+      Partial<MTProto.messages_saveDraftRequest>,
+      MTProto.Bool
+    >
+    GetAllDraftsRequest: TlRequest<
+      Partial<MTProto.messages_getAllDraftsRequest>,
+      MTProto.Updates
+    >
+    GetFeaturedStickersRequest: TlRequest<
+      Partial<MTProto.messages_getFeaturedStickersRequest>,
+      MTProto.messages_FeaturedStickers
+    >
+    ReadFeaturedStickersRequest: TlRequest<
+      Partial<MTProto.messages_readFeaturedStickersRequest>,
+      MTProto.Bool
+    >
+    GetRecentStickersRequest: TlRequest<
+      Partial<MTProto.messages_getRecentStickersRequest>,
+      MTProto.messages_RecentStickers
+    >
+    SaveRecentStickerRequest: TlRequest<
+      Partial<MTProto.messages_saveRecentStickerRequest>,
+      MTProto.Bool
+    >
+    ClearRecentStickersRequest: TlRequest<
+      Partial<MTProto.messages_clearRecentStickersRequest>,
+      MTProto.Bool
+    >
+    GetArchivedStickersRequest: TlRequest<
+      Partial<MTProto.messages_getArchivedStickersRequest>,
+      MTProto.messages_ArchivedStickers
+    >
+    GetMaskStickersRequest: TlRequest<
+      Partial<MTProto.messages_getMaskStickersRequest>,
+      MTProto.messages_AllStickers
+    >
+    GetAttachedStickersRequest: TlRequest<
+      Partial<MTProto.messages_getAttachedStickersRequest>,
+      MTProto.StickerSetCovered[]
+    >
+    SetGameScoreRequest: TlRequest<
+      Partial<MTProto.messages_setGameScoreRequest>,
+      MTProto.Updates
+    >
+    SetInlineGameScoreRequest: TlRequest<
+      Partial<MTProto.messages_setInlineGameScoreRequest>,
+      MTProto.Bool
+    >
+    GetGameHighScoresRequest: TlRequest<
+      Partial<MTProto.messages_getGameHighScoresRequest>,
+      MTProto.messages_HighScores
+    >
+    GetInlineGameHighScoresRequest: TlRequest<
+      Partial<MTProto.messages_getInlineGameHighScoresRequest>,
+      MTProto.messages_HighScores
+    >
+    GetCommonChatsRequest: TlRequest<
+      Partial<MTProto.messages_getCommonChatsRequest>,
+      MTProto.messages_Chats
+    >
+    GetAllChatsRequest: TlRequest<
+      Partial<MTProto.messages_getAllChatsRequest>,
+      MTProto.messages_Chats
+    >
+    GetWebPageRequest: TlRequest<
+      Partial<MTProto.messages_getWebPageRequest>,
+      MTProto.WebPage
+    >
+    ToggleDialogPinRequest: TlRequest<
+      Partial<MTProto.messages_toggleDialogPinRequest>,
+      MTProto.Bool
+    >
+    ReorderPinnedDialogsRequest: TlRequest<
+      Partial<MTProto.messages_reorderPinnedDialogsRequest>,
+      MTProto.Bool
+    >
+    GetPinnedDialogsRequest: TlRequest<
+      Partial<MTProto.messages_getPinnedDialogsRequest>,
+      MTProto.messages_PeerDialogs
+    >
+    SetBotShippingResultsRequest: TlRequest<
+      Partial<MTProto.messages_setBotShippingResultsRequest>,
+      MTProto.Bool
+    >
+    SetBotPrecheckoutResultsRequest: TlRequest<
+      Partial<MTProto.messages_setBotPrecheckoutResultsRequest>,
+      MTProto.Bool
+    >
+    UploadMediaRequest: TlRequest<
+      Partial<MTProto.messages_uploadMediaRequest>,
+      MTProto.MessageMedia
+    >
+    SendScreenshotNotificationRequest: TlRequest<
+      Partial<MTProto.messages_sendScreenshotNotificationRequest>,
+      MTProto.Updates
+    >
+    GetFavedStickersRequest: TlRequest<
+      Partial<MTProto.messages_getFavedStickersRequest>,
+      MTProto.messages_FavedStickers
+    >
+    FaveStickerRequest: TlRequest<
+      Partial<MTProto.messages_faveStickerRequest>,
+      MTProto.Bool
+    >
+    GetUnreadMentionsRequest: TlRequest<
+      Partial<MTProto.messages_getUnreadMentionsRequest>,
+      MTProto.messages_Messages
+    >
+    ReadMentionsRequest: TlRequest<
+      Partial<MTProto.messages_readMentionsRequest>,
+      MTProto.messages_AffectedHistory
+    >
+    GetRecentLocationsRequest: TlRequest<
+      Partial<MTProto.messages_getRecentLocationsRequest>,
+      MTProto.messages_Messages
+    >
+    SendMultiMediaRequest: TlRequest<
+      Partial<MTProto.messages_sendMultiMediaRequest>,
+      MTProto.Updates
+    >
+    UploadEncryptedFileRequest: TlRequest<
+      Partial<MTProto.messages_uploadEncryptedFileRequest>,
+      MTProto.EncryptedFile
+    >
+    SearchStickerSetsRequest: TlRequest<
+      Partial<MTProto.messages_searchStickerSetsRequest>,
+      MTProto.messages_FoundStickerSets
+    >
+    GetSplitRangesRequest: TlRequest<
+      Partial<MTProto.messages_getSplitRangesRequest>,
+      MTProto.MessageRange[]
+    >
+    MarkDialogUnreadRequest: TlRequest<
+      Partial<MTProto.messages_markDialogUnreadRequest>,
+      MTProto.Bool
+    >
+    GetDialogUnreadMarksRequest: TlRequest<
+      Partial<MTProto.messages_getDialogUnreadMarksRequest>,
+      MTProto.DialogPeer[]
+    >
+    ClearAllDraftsRequest: TlRequest<
+      Partial<MTProto.messages_clearAllDraftsRequest>,
+      MTProto.Bool
+    >
+    UpdatePinnedMessageRequest: TlRequest<
+      Partial<MTProto.messages_updatePinnedMessageRequest>,
+      MTProto.Updates
+    >
+    SendVoteRequest: TlRequest<
+      Partial<MTProto.messages_sendVoteRequest>,
+      MTProto.Updates
+    >
+    GetPollResultsRequest: TlRequest<
+      Partial<MTProto.messages_getPollResultsRequest>,
+      MTProto.Updates
+    >
+    GetOnlinesRequest: TlRequest<
+      Partial<MTProto.messages_getOnlinesRequest>,
+      MTProto.ChatOnlines
+    >
+    GetStatsURLRequest: TlRequest<
+      Partial<MTProto.messages_getStatsURLRequest>,
+      MTProto.StatsURL
+    >
+    EditChatAboutRequest: TlRequest<
+      Partial<MTProto.messages_editChatAboutRequest>,
+      MTProto.Bool
+    >
+    EditChatDefaultBannedRightsRequest: TlRequest<
+      Partial<MTProto.messages_editChatDefaultBannedRightsRequest>,
+      MTProto.Updates
+    >
+    GetEmojiKeywordsRequest: TlRequest<
+      Partial<MTProto.messages_getEmojiKeywordsRequest>,
+      MTProto.EmojiKeywordsDifference
+    >
+    GetEmojiKeywordsDifferenceRequest: TlRequest<
+      Partial<MTProto.messages_getEmojiKeywordsDifferenceRequest>,
+      MTProto.EmojiKeywordsDifference
+    >
+    GetEmojiKeywordsLanguagesRequest: TlRequest<
+      Partial<MTProto.messages_getEmojiKeywordsLanguagesRequest>,
+      MTProto.EmojiLanguage[]
+    >
+    GetEmojiURLRequest: TlRequest<
+      Partial<MTProto.messages_getEmojiURLRequest>,
+      MTProto.EmojiURL
+    >
+    GetSearchCountersRequest: TlRequest<
+      Partial<MTProto.messages_getSearchCountersRequest>,
+      MTProto.messages_SearchCounter[]
+    >
+    RequestUrlAuthRequest: TlRequest<
+      Partial<MTProto.messages_requestUrlAuthRequest>,
+      MTProto.UrlAuthResult
+    >
+    AcceptUrlAuthRequest: TlRequest<
+      Partial<MTProto.messages_acceptUrlAuthRequest>,
+      MTProto.UrlAuthResult
+    >
+    HidePeerSettingsBarRequest: TlRequest<
+      Partial<MTProto.messages_hidePeerSettingsBarRequest>,
+      MTProto.Bool
+    >
+    GetScheduledHistoryRequest: TlRequest<
+      Partial<MTProto.messages_getScheduledHistoryRequest>,
+      MTProto.messages_Messages
+    >
+    GetScheduledMessagesRequest: TlRequest<
+      Partial<MTProto.messages_getScheduledMessagesRequest>,
+      MTProto.messages_Messages
+    >
+    SendScheduledMessagesRequest: TlRequest<
+      Partial<MTProto.messages_sendScheduledMessagesRequest>,
+      MTProto.Updates
+    >
+    DeleteScheduledMessagesRequest: TlRequest<
+      Partial<MTProto.messages_deleteScheduledMessagesRequest>,
+      MTProto.Updates
+    >
+  }
+
+  updates: {
+    GetStateRequest: TlRequest<
+      Partial<MTProto.updates_getStateRequest>,
+      MTProto.updates_State
+    >
+    GetDifferenceRequest: TlRequest<
+      Partial<MTProto.updates_getDifferenceRequest>,
+      MTProto.updates_Difference
+    >
+    GetChannelDifferenceRequest: TlRequest<
+      Partial<MTProto.updates_getChannelDifferenceRequest>,
+      MTProto.updates_ChannelDifference
+    >
+  }
+
+  photos: {
+    UpdateProfilePhotoRequest: TlRequest<
+      Partial<MTProto.photos_updateProfilePhotoRequest>,
+      MTProto.UserProfilePhoto
+    >
+    UploadProfilePhotoRequest: TlRequest<
+      Partial<MTProto.photos_uploadProfilePhotoRequest>,
+      MTProto.photos_Photo
+    >
+    DeletePhotosRequest: TlRequest<
+      Partial<MTProto.photos_deletePhotosRequest>,
+      MTProto.long[]
+    >
+    GetUserPhotosRequest: TlRequest<
+      Partial<MTProto.photos_getUserPhotosRequest>,
+      MTProto.photos_Photos
+    >
+  }
+
+  upload: {
+    SaveFilePartRequest: TlRequest<
+      Partial<MTProto.upload_saveFilePartRequest>,
+      MTProto.Bool
+    >
+    GetFileRequest: TlRequest<
+      Partial<MTProto.upload_getFileRequest>,
+      MTProto.upload_File
+    >
+    SaveBigFilePartRequest: TlRequest<
+      Partial<MTProto.upload_saveBigFilePartRequest>,
+      MTProto.Bool
+    >
+    GetWebFileRequest: TlRequest<
+      Partial<MTProto.upload_getWebFileRequest>,
+      MTProto.upload_WebFile
+    >
+    GetCdnFileRequest: TlRequest<
+      Partial<MTProto.upload_getCdnFileRequest>,
+      MTProto.upload_CdnFile
+    >
+    ReuploadCdnFileRequest: TlRequest<
+      Partial<MTProto.upload_reuploadCdnFileRequest>,
+      MTProto.FileHash[]
+    >
+    GetCdnFileHashesRequest: TlRequest<
+      Partial<MTProto.upload_getCdnFileHashesRequest>,
+      MTProto.FileHash[]
+    >
+    GetFileHashesRequest: TlRequest<
+      Partial<MTProto.upload_getFileHashesRequest>,
+      MTProto.FileHash[]
+    >
+  }
+
+  help: {
+    GetConfigRequest: TlRequest<
+      Partial<MTProto.help_getConfigRequest>,
+      MTProto.Config
+    >
+    GetNearestDcRequest: TlRequest<
+      Partial<MTProto.help_getNearestDcRequest>,
+      MTProto.NearestDc
+    >
+    GetAppUpdateRequest: TlRequest<
+      Partial<MTProto.help_getAppUpdateRequest>,
+      MTProto.help_AppUpdate
+    >
+    GetInviteTextRequest: TlRequest<
+      Partial<MTProto.help_getInviteTextRequest>,
+      MTProto.help_InviteText
+    >
+    GetSupportRequest: TlRequest<
+      Partial<MTProto.help_getSupportRequest>,
+      MTProto.help_Support
+    >
+    GetAppChangelogRequest: TlRequest<
+      Partial<MTProto.help_getAppChangelogRequest>,
+      MTProto.Updates
+    >
+    SetBotUpdatesStatusRequest: TlRequest<
+      Partial<MTProto.help_setBotUpdatesStatusRequest>,
+      MTProto.Bool
+    >
+    GetCdnConfigRequest: TlRequest<
+      Partial<MTProto.help_getCdnConfigRequest>,
+      MTProto.CdnConfig
+    >
+    GetRecentMeUrlsRequest: TlRequest<
+      Partial<MTProto.help_getRecentMeUrlsRequest>,
+      MTProto.help_RecentMeUrls
+    >
+    GetProxyDataRequest: TlRequest<
+      Partial<MTProto.help_getProxyDataRequest>,
+      MTProto.help_ProxyData
+    >
+    GetTermsOfServiceUpdateRequest: TlRequest<
+      Partial<MTProto.help_getTermsOfServiceUpdateRequest>,
+      MTProto.help_TermsOfServiceUpdate
+    >
+    AcceptTermsOfServiceRequest: TlRequest<
+      Partial<MTProto.help_acceptTermsOfServiceRequest>,
+      MTProto.Bool
+    >
+    GetDeepLinkInfoRequest: TlRequest<
+      Partial<MTProto.help_getDeepLinkInfoRequest>,
+      MTProto.help_DeepLinkInfo
+    >
+    GetAppConfigRequest: TlRequest<
+      Partial<MTProto.help_getAppConfigRequest>,
+      MTProto.JSONValue
+    >
+    SaveAppLogRequest: TlRequest<
+      Partial<MTProto.help_saveAppLogRequest>,
+      MTProto.Bool
+    >
+    GetPassportConfigRequest: TlRequest<
+      Partial<MTProto.help_getPassportConfigRequest>,
+      MTProto.help_PassportConfig
+    >
+    GetSupportNameRequest: TlRequest<
+      Partial<MTProto.help_getSupportNameRequest>,
+      MTProto.help_SupportName
+    >
+    GetUserInfoRequest: TlRequest<
+      Partial<MTProto.help_getUserInfoRequest>,
+      MTProto.help_UserInfo
+    >
+    EditUserInfoRequest: TlRequest<
+      Partial<MTProto.help_editUserInfoRequest>,
+      MTProto.help_UserInfo
+    >
+  }
+
+  channels: {
+    ReadHistoryRequest: TlRequest<
+      Partial<MTProto.channels_readHistoryRequest>,
+      MTProto.Bool
+    >
+    DeleteMessagesRequest: TlRequest<
+      Partial<MTProto.channels_deleteMessagesRequest>,
+      MTProto.messages_AffectedMessages
+    >
+    DeleteUserHistoryRequest: TlRequest<
+      Partial<MTProto.channels_deleteUserHistoryRequest>,
+      MTProto.messages_AffectedHistory
+    >
+    ReportSpamRequest: TlRequest<
+      Partial<MTProto.channels_reportSpamRequest>,
+      MTProto.Bool
+    >
+    GetMessagesRequest: TlRequest<
+      Partial<MTProto.channels_getMessagesRequest>,
+      MTProto.messages_Messages
+    >
+    GetParticipantsRequest: TlRequest<
+      Partial<MTProto.channels_getParticipantsRequest>,
+      MTProto.channels_ChannelParticipants
+    >
+    GetParticipantRequest: TlRequest<
+      Partial<MTProto.channels_getParticipantRequest>,
+      MTProto.channels_ChannelParticipant
+    >
+    GetChannelsRequest: TlRequest<
+      Partial<MTProto.channels_getChannelsRequest>,
+      MTProto.messages_Chats
+    >
+    GetFullChannelRequest: TlRequest<
+      Partial<MTProto.channels_getFullChannelRequest>,
+      MTProto.messages_ChatFull
+    >
+    CreateChannelRequest: TlRequest<
+      Partial<MTProto.channels_createChannelRequest>,
+      MTProto.Updates
+    >
+    EditAdminRequest: TlRequest<
+      Partial<MTProto.channels_editAdminRequest>,
+      MTProto.Updates
+    >
+    EditTitleRequest: TlRequest<
+      Partial<MTProto.channels_editTitleRequest>,
+      MTProto.Updates
+    >
+    EditPhotoRequest: TlRequest<
+      Partial<MTProto.channels_editPhotoRequest>,
+      MTProto.Updates
+    >
+    CheckUsernameRequest: TlRequest<
+      Partial<MTProto.channels_checkUsernameRequest>,
+      MTProto.Bool
+    >
+    UpdateUsernameRequest: TlRequest<
+      Partial<MTProto.channels_updateUsernameRequest>,
+      MTProto.Bool
+    >
+    JoinChannelRequest: TlRequest<
+      Partial<MTProto.channels_joinChannelRequest>,
+      MTProto.Updates
+    >
+    LeaveChannelRequest: TlRequest<
+      Partial<MTProto.channels_leaveChannelRequest>,
+      MTProto.Updates
+    >
+    InviteToChannelRequest: TlRequest<
+      Partial<MTProto.channels_inviteToChannelRequest>,
+      MTProto.Updates
+    >
+    DeleteChannelRequest: TlRequest<
+      Partial<MTProto.channels_deleteChannelRequest>,
+      MTProto.Updates
+    >
+    ExportMessageLinkRequest: TlRequest<
+      Partial<MTProto.channels_exportMessageLinkRequest>,
+      MTProto.ExportedMessageLink
+    >
+    ToggleSignaturesRequest: TlRequest<
+      Partial<MTProto.channels_toggleSignaturesRequest>,
+      MTProto.Updates
+    >
+    GetAdminedPublicChannelsRequest: TlRequest<
+      Partial<MTProto.channels_getAdminedPublicChannelsRequest>,
+      MTProto.messages_Chats
+    >
+    EditBannedRequest: TlRequest<
+      Partial<MTProto.channels_editBannedRequest>,
+      MTProto.Updates
+    >
+    GetAdminLogRequest: TlRequest<
+      Partial<MTProto.channels_getAdminLogRequest>,
+      MTProto.channels_AdminLogResults
+    >
+    SetStickersRequest: TlRequest<
+      Partial<MTProto.channels_setStickersRequest>,
+      MTProto.Bool
+    >
+    ReadMessageContentsRequest: TlRequest<
+      Partial<MTProto.channels_readMessageContentsRequest>,
+      MTProto.Bool
+    >
+    DeleteHistoryRequest: TlRequest<
+      Partial<MTProto.channels_deleteHistoryRequest>,
+      MTProto.Bool
+    >
+    TogglePreHistoryHiddenRequest: TlRequest<
+      Partial<MTProto.channels_togglePreHistoryHiddenRequest>,
+      MTProto.Updates
+    >
+    GetLeftChannelsRequest: TlRequest<
+      Partial<MTProto.channels_getLeftChannelsRequest>,
+      MTProto.messages_Chats
+    >
+    GetGroupsForDiscussionRequest: TlRequest<
+      Partial<MTProto.channels_getGroupsForDiscussionRequest>,
+      MTProto.messages_Chats
+    >
+    SetDiscussionGroupRequest: TlRequest<
+      Partial<MTProto.channels_setDiscussionGroupRequest>,
+      MTProto.Bool
+    >
+    EditCreatorRequest: TlRequest<
+      Partial<MTProto.channels_editCreatorRequest>,
+      MTProto.Updates
+    >
+    EditLocationRequest: TlRequest<
+      Partial<MTProto.channels_editLocationRequest>,
+      MTProto.Bool
+    >
+    ToggleSlowModeRequest: TlRequest<
+      Partial<MTProto.channels_toggleSlowModeRequest>,
+      MTProto.Updates
+    >
+  }
+
+  bots: {
+    SendCustomRequestRequest: TlRequest<
+      Partial<MTProto.bots_sendCustomRequestRequest>,
+      MTProto.DataJSON
+    >
+    AnswerWebhookJSONQueryRequest: TlRequest<
+      Partial<MTProto.bots_answerWebhookJSONQueryRequest>,
+      MTProto.Bool
+    >
+  }
+
+  payments: {
+    GetPaymentFormRequest: TlRequest<
+      Partial<MTProto.payments_getPaymentFormRequest>,
+      MTProto.payments_PaymentForm
+    >
+    GetPaymentReceiptRequest: TlRequest<
+      Partial<MTProto.payments_getPaymentReceiptRequest>,
+      MTProto.payments_PaymentReceipt
+    >
+    ValidateRequestedInfoRequest: TlRequest<
+      Partial<MTProto.payments_validateRequestedInfoRequest>,
+      MTProto.payments_ValidatedRequestedInfo
+    >
+    SendPaymentFormRequest: TlRequest<
+      Partial<MTProto.payments_sendPaymentFormRequest>,
+      MTProto.payments_PaymentResult
+    >
+    GetSavedInfoRequest: TlRequest<
+      Partial<MTProto.payments_getSavedInfoRequest>,
+      MTProto.payments_SavedInfo
+    >
+    ClearSavedInfoRequest: TlRequest<
+      Partial<MTProto.payments_clearSavedInfoRequest>,
+      MTProto.Bool
+    >
+  }
+
+  stickers: {
+    CreateStickerSetRequest: TlRequest<
+      Partial<MTProto.stickers_createStickerSetRequest>,
+      MTProto.messages_StickerSet
+    >
+    RemoveStickerFromSetRequest: TlRequest<
+      Partial<MTProto.stickers_removeStickerFromSetRequest>,
+      MTProto.messages_StickerSet
+    >
+    ChangeStickerPositionRequest: TlRequest<
+      Partial<MTProto.stickers_changeStickerPositionRequest>,
+      MTProto.messages_StickerSet
+    >
+    AddStickerToSetRequest: TlRequest<
+      Partial<MTProto.stickers_addStickerToSetRequest>,
+      MTProto.messages_StickerSet
+    >
+  }
+
+  phone: {
+    GetCallConfigRequest: TlRequest<
+      Partial<MTProto.phone_getCallConfigRequest>,
+      MTProto.DataJSON
+    >
+    RequestCallRequest: TlRequest<
+      Partial<MTProto.phone_requestCallRequest>,
+      MTProto.phone_PhoneCall
+    >
+    AcceptCallRequest: TlRequest<
+      Partial<MTProto.phone_acceptCallRequest>,
+      MTProto.phone_PhoneCall
+    >
+    ConfirmCallRequest: TlRequest<
+      Partial<MTProto.phone_confirmCallRequest>,
+      MTProto.phone_PhoneCall
+    >
+    ReceivedCallRequest: TlRequest<
+      Partial<MTProto.phone_receivedCallRequest>,
+      MTProto.Bool
+    >
+    DiscardCallRequest: TlRequest<
+      Partial<MTProto.phone_discardCallRequest>,
+      MTProto.Updates
+    >
+    SetCallRatingRequest: TlRequest<
+      Partial<MTProto.phone_setCallRatingRequest>,
+      MTProto.Updates
+    >
+    SaveCallDebugRequest: TlRequest<
+      Partial<MTProto.phone_saveCallDebugRequest>,
+      MTProto.Bool
+    >
+  }
+
+  langpack: {
+    GetLangPackRequest: TlRequest<
+      Partial<MTProto.langpack_getLangPackRequest>,
+      MTProto.LangPackDifference
+    >
+    GetStringsRequest: TlRequest<
+      Partial<MTProto.langpack_getStringsRequest>,
+      MTProto.LangPackString[]
+    >
+    GetDifferenceRequest: TlRequest<
+      Partial<MTProto.langpack_getDifferenceRequest>,
+      MTProto.LangPackDifference
+    >
+    GetLanguagesRequest: TlRequest<
+      Partial<MTProto.langpack_getLanguagesRequest>,
+      MTProto.LangPackLanguage[]
+    >
+    GetLanguageRequest: TlRequest<
+      Partial<MTProto.langpack_getLanguageRequest>,
+      MTProto.LangPackLanguage
+    >
+  }
+
+  folders: {
+    EditPeerFoldersRequest: TlRequest<
+      Partial<MTProto.folders_editPeerFoldersRequest>,
+      MTProto.Updates
+    >
+    DeleteFolderRequest: TlRequest<
+      Partial<MTProto.folders_deleteFolderRequest>,
+      MTProto.Updates
+    >
+  }
+}
+
+type ValuesOf<T> = T[keyof T];
+
+export namespace GramJsApi {
+  type AnyRequest = Requests['InvokeAfterMsgRequest'] | Requests['InvokeAfterMsgsRequest'] | Requests['InitConnectionRequest'] | Requests['InvokeWithLayerRequest'] | Requests['InvokeWithoutUpdatesRequest'] | Requests['InvokeWithMessagesRangeRequest'] | Requests['InvokeWithTakeoutRequest'] | Requests['ReqPqRequest'] | Requests['ReqPqMultiRequest'] | Requests['ReqDHParamsRequest'] | Requests['SetClientDHParamsRequest'] | Requests['DestroyAuthKeyRequest'] | Requests['RpcDropAnswerRequest'] | Requests['GetFutureSaltsRequest'] | Requests['PingRequest'] | Requests['PingDelayDisconnectRequest'] | Requests['DestroySessionRequest'] |
+    ValuesOf<Requests['auth']> | ValuesOf<Requests['account']> | ValuesOf<Requests['users']> | ValuesOf<Requests['contacts']> | ValuesOf<Requests['messages']> | ValuesOf<Requests['updates']> | ValuesOf<Requests['photos']> | ValuesOf<Requests['upload']> | ValuesOf<Requests['help']> | ValuesOf<Requests['channels']> | ValuesOf<Requests['bots']> | ValuesOf<Requests['payments']> | ValuesOf<Requests['stickers']> | ValuesOf<Requests['phone']> | ValuesOf<Requests['langpack']> | ValuesOf<Requests['folders']>;
+}
+
+declare const gramJsApi: {
+  constructors: Constructors;
+  requests: Requests;
+};
+
+export default gramJsApi;

+ 377 - 0
src/lib/gramjs/tl/gramJsApi.js

@@ -0,0 +1,377 @@
+//const { readFileSync } = require('fs')
+import { readFileSync } from 'fs'
+
+
+const {
+    parseTl,
+    serializeBytes,
+    serializeDate
+} = require('./generationHelpers')
+
+const NAMED_AUTO_CASTS = new Set([
+    'chatId,int'
+])
+const NAMED_BLACKLIST = new Set([
+    'discardEncryption'
+])
+const AUTO_CASTS = new Set([
+    'InputPeer',
+    'InputChannel',
+    'InputUser',
+    'InputDialogPeer',
+    'InputNotifyPeer',
+    'InputMedia',
+    'InputPhoto',
+    'InputMessage',
+    'InputDocument',
+    'InputChatPhoto',
+])
+const struct = require('python-struct')
+
+const { readBufferFromBigInt } = require('../Helpers')
+
+function buildApiFromTlSchema() {
+    const tlContent = readFileSync('./static/api.tl', 'utf-8')
+    const [constructorParamsApi, functionParamsApi] = extractParams(tlContent)
+    const schemeContent = readFileSync('./static/schema.tl', 'utf-8')
+    const [constructorParamsSchema, functionParamsSchema] = extractParams(schemeContent)
+    const constructors = [...constructorParamsApi, ...constructorParamsSchema]
+    const requests = [...functionParamsApi, ...functionParamsSchema]
+    return {
+        constructors: createClasses('constructor', constructors),
+        requests: createClasses('request', requests),
+    }
+}
+
+
+function extractParams(fileContent) {
+    const f = parseTl(fileContent, 105)
+    const constructors = []
+    const functions = []
+    for (const d of f) {
+        d.isFunction ? functions.push(d) : constructors.push(d)
+    }
+    return [constructors, functions]
+}
+
+
+function argToBytes(x, type) {
+    switch (type) {
+        case 'int':
+            return (struct.pack('<i', x))
+        case 'long':
+            return (readBufferFromBigInt(x, 8, true, true))
+        case 'int128':
+            return (readBufferFromBigInt(x, 16, true, true))
+        case 'int256':
+            return (readBufferFromBigInt(x, 32, true, true))
+        case 'double':
+            return (struct.pack('<d', x.toString()))
+        case 'string':
+            return serializeBytes(x)
+        case 'Bool':
+            return (x ? Buffer.from('b5757299', 'hex') : Buffer.from('379779bc', 'hex'))
+        case 'true':
+            return Buffer.alloc(0)
+        case 'bytes':
+            return serializeBytes(x)
+        case 'date':
+            return serializeDate(x)
+        default:
+            throw new Error("unsupported")
+    }
+}
+
+async function getInputFromResolve(utils, client, peer, peerType) {
+    switch (peerType) {
+        case 'InputPeer':
+            return utils.getInputPeer(await client.getInputEntity(peer))
+        case 'InputChannel':
+            return utils.getInputChannel(await client.getInputEntity(peer))
+        case 'InputUser':
+            return utils.getInputUser(await client.getInputEntity(peer))
+        case 'InputDialogPeer':
+            return await client._getInputDialog(peer)
+        case 'InputNotifyPeer':
+            return await client._getInputNotify(peer)
+        case 'InputMedia':
+            return utils.getInputMedia(peer)
+        case 'InputPhoto':
+            return utils.getInputPhoto(peer)
+        case 'InputMessage':
+            return utils.getInputMessage(peer)
+        case 'InputDocument':
+            return utils.getInputDocument(peer)
+        case 'InputChatPhoto':
+            return utils.getInputChatPhoto(peer)
+        case 'chatId,int' :
+            return await client.getPeerId(peer, false)
+        default:
+            throw new Error('unsupported peer type : ' + peerType)
+
+    }
+
+}
+
+function getArgFromReader(reader, arg) {
+    if (arg.isVector) {
+        if (arg.useVectorId) {
+            reader.readInt()
+        }
+        const temp = []
+        const len = reader.readInt()
+        arg.isVector = false
+        for (let i = 0; i < len; i++) {
+            temp.push(getArgFromReader(reader, arg))
+        }
+        arg.isVector = true
+        return temp
+    } else if (arg.flagIndicator) {
+        return reader.readInt()
+    } else {
+        switch (arg.type) {
+            case 'int':
+                return reader.readInt()
+            case 'long':
+                return reader.readLong()
+            case 'int128':
+                return reader.readLargeInt(128)
+            case 'int256':
+                return reader.readLargeInt(256)
+            case 'double':
+                return reader.readDouble()
+            case 'string':
+                return reader.tgReadString()
+            case 'Bool':
+                return reader.tgReadBool()
+            case 'true':
+                return true
+            case 'bytes':
+                return reader.tgReadBytes()
+            case 'date':
+                return reader.tgReadDate()
+            default:
+
+                if (!arg.skipConstructorId) {
+                    return reader.tgReadObject()
+                } else {
+                    return gramJsApi.constructors[arg.type].fromReader(reader)
+                }
+        }
+    }
+
+}
+
+function createClasses(classesType, params) {
+    const classes = {}
+    for (const classParams of params) {
+        const { name, constructorId, subclassOfId, argsConfig, namespace ,result} = classParams
+
+        class VirtualClass {
+            static CONSTRUCTOR_ID = constructorId
+            static SUBCLASS_OF_ID = subclassOfId
+            static className = name
+            static classType = classesType
+
+            CONSTRUCTOR_ID = constructorId
+            SUBCLASS_OF_ID = subclassOfId
+            className = name
+            classType = classesType
+
+            constructor(args) {
+                args = args || {}
+                Object.keys(args)
+                    .forEach((argName) => {
+                        this[argName] = args[argName]
+                    })
+            }
+
+            static fromReader(reader) {
+
+                const args = {}
+
+                for (const argName in argsConfig) {
+                    if (argsConfig.hasOwnProperty(argName)) {
+                        const arg = argsConfig[argName]
+                        if (arg.isFlag) {
+                            if (arg.type === 'true') {
+                                args[argName] = Boolean(args['flags'] & 1 << arg.flagIndex)
+                                continue
+                            }
+                            if (args['flags'] & 1 << arg.flagIndex) {
+                                args[argName] = getArgFromReader(reader, arg)
+                            } else {
+                                args[argName] = null
+                            }
+                        } else {
+                            if (arg.flagIndicator) {
+                                arg.name = 'flags'
+                            }
+                            args[argName] = getArgFromReader(reader, arg)
+                        }
+                    }
+                }
+                return new VirtualClass(args)
+            }
+
+            getBytes() {
+                // The next is pseudo-code:
+                const idForBytes = this.CONSTRUCTOR_ID
+                const buffers = [struct.pack('<I', idForBytes)]
+                for (const arg in argsConfig) {
+                    if (argsConfig.hasOwnProperty(arg)) {
+                        if (argsConfig[arg].isFlag) {
+                            const tempBuffers = []
+                            if (argsConfig[arg] === 'true') {
+
+                            } else if (argsConfig[arg].isVector) {
+                                if (argsConfig[arg].useVectorId) {
+                                    tempBuffers.push(Buffer.from('15c4b51c', 'hex'))
+                                }
+                                buffers.push((!this[arg] ? Buffer.alloc(0) : Buffer.concat([...tempBuffers,
+                                    struct.pack('<i', this[arg].length), Buffer.concat(this[arg].map(x => argToBytes(x, argsConfig[arg].type)))])))
+                            }
+                        } else if (argsConfig[arg].isVector && !argsConfig[arg].isFlag) {
+                            if (argsConfig[arg].isVector) {
+                                buffers.push(Buffer.from('15c4b51c', 'hex'))
+                            }
+                            buffers.push(struct.pack('<i', this[arg].length), Buffer.concat(this[arg].map(x => argToBytes(x, argsConfig[arg].type))))
+                        } else if (argsConfig[arg].flagIndicator) {
+                            // @ts-ignore
+                            if (!Object.values(argsConfig)
+                                .some((f) => f.isFlag)) {
+                                buffers.push(Buffer.alloc(4))
+                            } else {
+                                let flagCalculate = 0
+                                for (const f of Object.values(argsConfig)) {
+                                    if (f.isFlag) {
+                                        if (!this[f.name]) {
+                                            flagCalculate |= 0
+                                        } else {
+                                            flagCalculate |= f.flagIndex
+                                        }
+                                    }
+                                }
+                                buffers.push(struct.pack('<I', flagCalculate))
+                            }
+                        } else {
+
+                            switch (argsConfig[arg].type) {
+                                case 'int':
+                                    buffers.push(struct.pack('<i', this[arg]))
+                                    break
+                                case 'long':
+                                    buffers.push(readBufferFromBigInt(this[arg], 8, true, true))
+                                    break
+                                case 'int128':
+                                    buffers.push(readBufferFromBigInt(this[arg], 16, true, true))
+                                    break
+                                case 'int256':
+                                    buffers.push(readBufferFromBigInt(this[arg], 32, true, true))
+                                    break
+                                case 'double':
+                                    buffers.push(struct.pack('<d', this[arg].toString()))
+                                    break
+                                case 'string':
+                                    buffers.push(serializeBytes(this[arg]))
+                                    break
+                                case 'Bool':
+                                    buffers.push(this[arg] ? Buffer.from('b5757299', 'hex') : Buffer.from('379779bc', 'hex'))
+                                    break
+                                case 'true':
+                                    break
+                                case 'bytes':
+                                    buffers.push(serializeBytes(this[arg]))
+                                    break
+                                case 'date':
+                                    buffers.push(serializeDate(this[arg]))
+                                    break
+                                default:
+                                    buffers.push(this[arg].getBytes())
+                                    let boxed = (argsConfig[arg].type.charAt(argsConfig[arg].type.indexOf('.') + 1))
+                                    boxed = boxed === boxed.toUpperCase()
+                                    if (!boxed) {
+                                        buffers.shift()
+                                    }
+                            }
+                        }
+                    }
+
+                }
+                return Buffer.concat(buffers)
+            }
+
+            readResult(reader) {
+                if (classesType !== 'request') {
+                    throw new Error('`readResult()` called for non-request instance')
+                }
+
+                const m = result.match(/Vector<(int|long)>/)
+                if (m) {
+                    reader.readInt()
+                    let temp = []
+                    let len = reader.readInt()
+                    if (m[1] === 'int') {
+                        for (let i = 0; i < len; i++) {
+                            temp.push(reader.readInt())
+                        }
+                    } else {
+                        for (let i = 0; i < len; i++) {
+                            temp.push(reader.readLong())
+                        }
+                    }
+                    return temp
+                } else {
+                    return reader.tgReadObject()
+                }
+            }
+
+            async resolve(client, utils) {
+                if (classesType !== 'request') {
+                    throw new Error('`resolve()` called for non-request instance')
+                }
+
+                for (const arg in argsConfig) {
+                    if (argsConfig.hasOwnProperty(arg)) {
+                        if (!AUTO_CASTS.has(argsConfig[arg].type)) {
+                            if (!NAMED_AUTO_CASTS.has(`${argsConfig[arg].name},${argsConfig[arg].type}`)) {
+                                continue
+                            }
+                        }
+                        if (argsConfig[arg].isFlag) {
+                            if (!this[arg]) {
+                                continue
+                            }
+                        }
+                        if (argsConfig[arg].isVector) {
+                            const temp = []
+                            for (const x of this[arg]) {
+                                temp.push(await getInputFromResolve(utils, client, this[arg], argsConfig[arg].type))
+                            }
+                            this[arg] = temp
+                        } else {
+                            this[arg] =await getInputFromResolve(utils, client, this[arg], argsConfig[arg].type)
+                        }
+                    }
+                }
+            }
+        }
+
+        if (namespace) {
+            if (!classes[namespace]) {
+                // @ts-ignore
+                classes[namespace] = {}
+            }
+            classes[namespace][name] = VirtualClass
+
+        } else {
+            classes[name] = VirtualClass
+
+        }
+    }
+
+    return classes
+}
+
+const gramJsApi = buildApiFromTlSchema()
+module.exports = gramJsApi

+ 11 - 0
src/lib/gramjs/tl/index.js

@@ -0,0 +1,11 @@
+const { constructors, requests } = require('./gramJsApi')
+const { serializeBytes, serializeDate } = require('./generationHelpers')
+const patched = null
+
+module.exports = {
+    constructors,
+    requests,
+    patched,
+    serializeBytes,
+    serializeDate
+}

+ 1418 - 0
src/lib/gramjs/tl/static/api.tl

@@ -0,0 +1,1418 @@
+///////////////////////////////
+/////////////////// Layer cons
+///////////////////////////////
+
+//invokeAfterMsg#cb9f372d msg_id:long query:!X = X;
+//invokeAfterMsgs#3dc4b4f0 msg_ids:Vector<long> query:!X = X;
+//invokeWithLayer1#53835315 query:!X = X;
+//invokeWithLayer2#289dd1f6 query:!X = X;
+//invokeWithLayer3#b7475268 query:!X = X;
+//invokeWithLayer4#dea0d430 query:!X = X;
+//invokeWithLayer5#417a57ae query:!X = X;
+//invokeWithLayer6#3a64d54d query:!X = X;
+//invokeWithLayer7#a5be56d3 query:!X = X;
+//invokeWithLayer8#e9abd9fd query:!X = X;
+//invokeWithLayer9#76715a63 query:!X = X;
+//invokeWithLayer10#39620c41 query:!X = X;
+//invokeWithLayer11#a6b88fdf query:!X = X;
+//invokeWithLayer12#dda60d3c query:!X = X;
+//invokeWithLayer13#427c8ea2 query:!X = X;
+//invokeWithLayer14#2b9b08fa query:!X = X;
+//invokeWithLayer15#b4418b64 query:!X = X;
+//invokeWithLayer16#cf5f0987 query:!X = X;
+//invokeWithLayer17#50858a19 query:!X = X;
+//invokeWithLayer18#1c900537 query:!X = X;
+//invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer
+
+///////////////////////////////
+///////// Main application API
+///////////////////////////////
+
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+true#3fedd339 = True;
+
+vector#1cb5c415 {t:Type} # [ t ] = Vector t;
+
+error#c4b9f9bb code:int text:string = Error;
+
+null#56730bcc = Null;
+
+inputPeerEmpty#7f3b18ea = InputPeer;
+inputPeerSelf#7da07ec9 = InputPeer;
+inputPeerChat#179be863 chat_id:int = InputPeer;
+inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer;
+inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer;
+inputPeerUserFromMessage#17bae2e6 peer:InputPeer msg_id:int user_id:int = InputPeer;
+inputPeerChannelFromMessage#9c95f7bb peer:InputPeer msg_id:int channel_id:int = InputPeer;
+
+inputUserEmpty#b98886cf = InputUser;
+inputUserSelf#f7c1b13f = InputUser;
+inputUser#d8292816 user_id:int access_hash:long = InputUser;
+inputUserFromMessage#2d117597 peer:InputPeer msg_id:int user_id:int = InputUser;
+
+inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;
+
+inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
+inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;
+
+inputMediaEmpty#9664f57f = InputMedia;
+inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
+inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
+inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia;
+inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;
+inputMediaGifExternal#4843b0fd url:string q:string = InputMedia;
+inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaGame#d33f43f3 id:InputGame = InputMedia;
+inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
+inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia;
+inputMediaPoll#6b3765b poll:Poll = InputMedia;
+
+inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
+inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto;
+inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;
+
+inputGeoPointEmpty#e4c123d6 = InputGeoPoint;
+inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint;
+
+inputPhotoEmpty#1cd7bf0d = InputPhoto;
+inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;
+
+inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;
+inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;
+inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
+inputTakeoutFileLocation#29be5899 = InputFileLocation;
+inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;
+inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation;
+
+peerUser#9db1bc6d user_id:int = Peer;
+peerChat#bad0e5bb chat_id:int = Peer;
+peerChannel#bddde532 channel_id:int = Peer;
+
+storage.fileUnknown#aa963b05 = storage.FileType;
+storage.filePartial#40bc6f52 = storage.FileType;
+storage.fileJpeg#7efe0e = storage.FileType;
+storage.fileGif#cae1aadf = storage.FileType;
+storage.filePng#a4f63c0 = storage.FileType;
+storage.filePdf#ae1e508d = storage.FileType;
+storage.fileMp3#528a0677 = storage.FileType;
+storage.fileMov#4b09ebbc = storage.FileType;
+storage.fileMp4#b3cea0e4 = storage.FileType;
+storage.fileWebp#1081464c = storage.FileType;
+
+userEmpty#200250ba id:int = User;
+user#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+
+userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
+userProfilePhoto#ecd75d8c photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto;
+
+userStatusEmpty#9d05049 = UserStatus;
+userStatusOnline#edb93949 expires:int = UserStatus;
+userStatusOffline#8c703f was_online:int = UserStatus;
+userStatusRecently#e26f42f1 = UserStatus;
+userStatusLastWeek#7bf09fc = UserStatus;
+userStatusLastMonth#77ebc742 = UserStatus;
+
+chatEmpty#9ba2d800 id:int = Chat;
+chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
+chatForbidden#7328bdb id:int title:string = Chat;
+channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
+
+chatFull#1b7c9db3 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull;
+channelFull#2d895c74 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true can_set_location:flags.16?true has_scheduled:flags.19?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int pts:int = ChatFull;
+
+chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
+chatParticipantCreator#da13538a user_id:int = ChatParticipant;
+chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant;
+
+chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants;
+chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;
+
+chatPhotoEmpty#37c1011c = ChatPhoto;
+chatPhoto#475cdbd5 photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
+
+messageEmpty#83e5de54 id:int = Message;
+message#452c0e65 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> = Message;
+messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message;
+
+messageMediaEmpty#3ded6320 = MessageMedia;
+messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
+messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
+messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia;
+messageMediaUnsupported#9f84f49e = MessageMedia;
+messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
+messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
+messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
+messageMediaGame#fdb19008 game:Game = MessageMedia;
+messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
+messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia;
+messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
+
+messageActionEmpty#b6aef7b0 = MessageAction;
+messageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction;
+messageActionChatEditTitle#b5a1ce5a title:string = MessageAction;
+messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction;
+messageActionChatDeletePhoto#95e3fbef = MessageAction;
+messageActionChatAddUser#488a7337 users:Vector<int> = MessageAction;
+messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;
+messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;
+messageActionChannelCreate#95d2ac92 title:string = MessageAction;
+messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction;
+messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction;
+messageActionPinMessage#94bd38ed = MessageAction;
+messageActionHistoryClear#9fbab604 = MessageAction;
+messageActionGameScore#92a72876 game_id:long score:int = MessageAction;
+messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction;
+messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction;
+messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;
+messageActionScreenshotTaken#4792929b = MessageAction;
+messageActionCustomAction#fae69f56 message:string = MessageAction;
+messageActionBotAllowed#abe9affe domain:string = MessageAction;
+messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;
+messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;
+messageActionContactSignUp#f3f25f76 = MessageAction;
+
+dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
+dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
+
+photoEmpty#2331b22d id:long = Photo;
+photo#d07504a5 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> dc_id:int = Photo;
+
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
+photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
+photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
+
+geoPointEmpty#1117dd5f = GeoPoint;
+geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
+
+auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
+
+auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
+auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
+
+auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization;
+
+inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer;
+inputNotifyUsers#193b4417 = InputNotifyPeer;
+inputNotifyChats#4a95e84e = InputNotifyPeer;
+inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;
+
+inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings;
+
+peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;
+
+peerSettings#818426cd flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true = PeerSettings;
+
+wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
+
+inputReportReasonSpam#58dbcab8 = ReportReason;
+inputReportReasonViolence#1e22c78d = ReportReason;
+inputReportReasonPornography#2e59d922 = ReportReason;
+inputReportReasonChildAbuse#adf44ee3 = ReportReason;
+inputReportReasonOther#e1746d0a text:string = ReportReason;
+inputReportReasonCopyright#9b89f93a = ReportReason;
+inputReportReasonGeoIrrelevant#dbd4feed = ReportReason;
+
+userFull#edf17c12 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int = UserFull;
+
+contact#f911c994 user_id:int mutual:Bool = Contact;
+
+importedContact#d0028438 user_id:int client_id:long = ImportedContact;
+
+contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
+
+contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;
+
+contacts.contactsNotModified#b74ba9d2 = contacts.Contacts;
+contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts;
+
+contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;
+
+contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
+contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
+
+messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
+messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
+messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;
+
+messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.messagesSlice#c8edce1e flags:# inexact:flags.1?true count:int next_rate:flags.0?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.messagesNotModified#74535f21 count:int = messages.Messages;
+
+messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
+messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats;
+
+messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull;
+
+messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory;
+
+inputMessagesFilterEmpty#57e2f66c = MessagesFilter;
+inputMessagesFilterPhotos#9609a51c = MessagesFilter;
+inputMessagesFilterVideo#9fc00e65 = MessagesFilter;
+inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;
+inputMessagesFilterDocument#9eddf188 = MessagesFilter;
+inputMessagesFilterUrl#7ef0dd87 = MessagesFilter;
+inputMessagesFilterGif#ffc86587 = MessagesFilter;
+inputMessagesFilterVoice#50f5c392 = MessagesFilter;
+inputMessagesFilterMusic#3751b49e = MessagesFilter;
+inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter;
+inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter;
+inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter;
+inputMessagesFilterRoundVideo#b549da53 = MessagesFilter;
+inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter;
+inputMessagesFilterGeo#e7026d0d = MessagesFilter;
+inputMessagesFilterContacts#e062db83 = MessagesFilter;
+
+updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
+updateMessageID#4e90bfd6 id:int random_id:long = Update;
+updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update;
+updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update;
+updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update;
+updateChatParticipants#7761198 participants:ChatParticipants = Update;
+updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update;
+updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update;
+updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;
+updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
+updateEncryptedChatTyping#1710f156 chat_id:int = Update;
+updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update;
+updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;
+updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update;
+updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update;
+updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;
+updateUserBlocked#80ece81a user_id:int blocked:Bool = Update;
+updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
+updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
+updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
+updateUserPhone#12b9417b user_id:int phone:string = Update;
+updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update;
+updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update;
+updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;
+updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
+updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update;
+updateChannel#b6d45656 channel_id:int = Update;
+updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
+updateReadChannelInbox#330b5424 flags:# folder_id:flags.0?int channel_id:int max_id:int still_unread_count:int pts:int = Update;
+updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update;
+updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;
+updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update;
+updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
+updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
+updateStickerSets#43ae3dec = Update;
+updateSavedGifs#9375341e = Update;
+updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update;
+updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
+updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
+updateChannelPinnedMessage#98592475 channel_id:int id:int = Update;
+updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;
+updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update;
+updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update;
+updateReadFeaturedStickers#571d2742 = Update;
+updateRecentStickers#9a422c20 = Update;
+updateConfig#a229dd06 = Update;
+updatePtsChanged#3354678f = Update;
+updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update;
+updateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update;
+updatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update;
+updateBotWebhookJSON#8317c0c3 data:DataJSON = Update;
+updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update;
+updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update;
+updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update;
+updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update;
+updateLangPackTooLong#46560264 lang_code:string = Update;
+updateLangPack#56022f4d difference:LangPackDifference = Update;
+updateFavedStickers#e511996d = Update;
+updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update;
+updateContactsReset#7084a7be = Update;
+updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;
+updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;
+updateUserPinnedMessage#4c43da18 user_id:int id:int = Update;
+updateChatPinnedMessage#e10db349 chat_id:int id:int version:int = Update;
+updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
+updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
+updateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update;
+updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update;
+updatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update;
+updateNewScheduledMessage#39a51dfb message:Message = Update;
+updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;
+updateTheme#8216fba3 theme:Theme = Update;
+
+updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
+
+updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;
+updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference;
+updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;
+updates.differenceTooLong#4afe8f6d pts:int = updates.Difference;
+
+updatesTooLong#e317af7e = Updates;
+updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
+updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
+updateShort#78d4dec1 update:Update date:int = Updates;
+updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
+updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
+updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates;
+
+photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos;
+photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos;
+
+photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
+
+upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
+upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
+
+dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
+
+config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
+
+nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
+
+help.appUpdate#1da7158f flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string = help.AppUpdate;
+help.noAppUpdate#c45a6536 = help.AppUpdate;
+
+help.inviteText#18cb9f78 message:string = help.InviteText;
+
+encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat;
+encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat;
+encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat;
+encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat;
+encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat;
+
+inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat;
+
+encryptedFileEmpty#c21f497e = EncryptedFile;
+encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;
+
+inputEncryptedFileEmpty#1837c364 = InputEncryptedFile;
+inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;
+inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile;
+inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile;
+
+encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;
+encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;
+
+messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig;
+messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig;
+
+messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage;
+messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage;
+
+inputDocumentEmpty#72f0eaae = InputDocument;
+inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;
+
+documentEmpty#36f8c871 id:long = Document;
+document#9ba29cc1 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+
+help.support#17c6b5f6 phone_number:string user:User = help.Support;
+
+notifyPeer#9fd40bd8 peer:Peer = NotifyPeer;
+notifyUsers#b4c83b4c = NotifyPeer;
+notifyChats#c007cec3 = NotifyPeer;
+notifyBroadcasts#d612e8ef = NotifyPeer;
+
+sendMessageTypingAction#16bf744e = SendMessageAction;
+sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
+sendMessageRecordVideoAction#a187d66f = SendMessageAction;
+sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction;
+sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
+sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction;
+sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;
+sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;
+sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
+sendMessageChooseContactAction#628cbc6f = SendMessageAction;
+sendMessageGamePlayAction#dd6a8f48 = SendMessageAction;
+sendMessageRecordRoundAction#88f27fbc = SendMessageAction;
+sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction;
+
+contacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found;
+
+inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;
+inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey;
+inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey;
+inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey;
+inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey;
+inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey;
+inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey;
+inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey;
+
+privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;
+privacyKeyChatInvite#500e6dfa = PrivacyKey;
+privacyKeyPhoneCall#3d662b7b = PrivacyKey;
+privacyKeyPhoneP2P#39491cc8 = PrivacyKey;
+privacyKeyForwards#69ec56a3 = PrivacyKey;
+privacyKeyProfilePhoto#96151fed = PrivacyKey;
+privacyKeyPhoneNumber#d19ae46d = PrivacyKey;
+privacyKeyAddedByPhone#42ffd42b = PrivacyKey;
+
+inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;
+inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
+inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule;
+inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;
+inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueAllowChatParticipants#4c81c1ba chats:Vector<int> = InputPrivacyRule;
+inputPrivacyValueDisallowChatParticipants#d82363af chats:Vector<int> = InputPrivacyRule;
+
+privacyValueAllowContacts#fffe1bac = PrivacyRule;
+privacyValueAllowAll#65427b82 = PrivacyRule;
+privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule;
+privacyValueDisallowContacts#f888fa1a = PrivacyRule;
+privacyValueDisallowAll#8b73e763 = PrivacyRule;
+privacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule;
+privacyValueAllowChatParticipants#18be796b chats:Vector<int> = PrivacyRule;
+privacyValueDisallowChatParticipants#acae0690 chats:Vector<int> = PrivacyRule;
+
+account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;
+
+accountDaysTTL#b8d0afdf days:int = AccountDaysTTL;
+
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute;
+documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
+documentAttributeHasStickers#9801d2f7 = DocumentAttribute;
+
+messages.stickersNotModified#f1749a22 = messages.Stickers;
+messages.stickers#e4599bbd hash:int stickers:Vector<Document> = messages.Stickers;
+
+stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
+
+messages.allStickersNotModified#e86602c3 = messages.AllStickers;
+messages.allStickers#edfd405f hash:int sets:Vector<StickerSet> = messages.AllStickers;
+
+messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages;
+
+webPageEmpty#eb1477e8 id:long = WebPage;
+webPagePending#c586da1c id:long date:int = WebPage;
+webPage#fa64e172 flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document documents:flags.11?Vector<Document> cached_page:flags.10?Page = WebPage;
+webPageNotModified#85849473 = WebPage;
+
+authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;
+
+account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations;
+
+account.password#ad2641f8 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes = account.Password;
+
+account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;
+
+account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings;
+
+auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;
+
+receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage;
+
+chatInviteEmpty#69df3769 = ExportedChatInvite;
+chatInviteExported#fc2e05bc link:string = ExportedChatInvite;
+
+chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
+chatInvite#dfc2f58e flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:Photo participants_count:int participants:flags.4?Vector<User> = ChatInvite;
+
+inputStickerSetEmpty#ffb62b95 = InputStickerSet;
+inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
+inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
+inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
+
+stickerSet#eeb46f27 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize thumb_dc_id:flags.4?int count:int hash:int = StickerSet;
+
+messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
+
+botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+botInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = BotInfo;
+
+keyboardButton#a2fa4880 text:string = KeyboardButton;
+keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
+keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton;
+keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;
+keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;
+keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton;
+keyboardButtonGame#50f41ccf text:string = KeyboardButton;
+keyboardButtonBuy#afd93fbb text:string = KeyboardButton;
+keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;
+inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;
+
+keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
+
+replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;
+replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup;
+replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = ReplyMarkup;
+replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup;
+
+messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;
+messageEntityMention#fa04579d offset:int length:int = MessageEntity;
+messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;
+messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;
+messageEntityUrl#6ed02538 offset:int length:int = MessageEntity;
+messageEntityEmail#64e475c2 offset:int length:int = MessageEntity;
+messageEntityBold#bd610bc9 offset:int length:int = MessageEntity;
+messageEntityItalic#826f8b60 offset:int length:int = MessageEntity;
+messageEntityCode#28a20571 offset:int length:int = MessageEntity;
+messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;
+messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
+messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity;
+inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity;
+messageEntityPhone#9b69e34b offset:int length:int = MessageEntity;
+messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;
+messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;
+messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;
+messageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;
+
+inputChannelEmpty#ee8c1e86 = InputChannel;
+inputChannel#afeb712e channel_id:int access_hash:long = InputChannel;
+inputChannelFromMessage#2a286531 peer:InputPeer msg_id:int channel_id:int = InputChannel;
+
+contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer;
+
+messageRange#ae30253 min_id:int max_id:int = MessageRange;
+
+updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference;
+updates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
+updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
+
+channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;
+channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter;
+
+channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
+channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
+channelParticipantCreator#808d15a4 flags:# user_id:int rank:flags.0?string = ChannelParticipant;
+channelParticipantAdmin#ccbebbaf flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;
+channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
+
+channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
+channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;
+channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter;
+channelParticipantsBots#b0d1865b = ChannelParticipantsFilter;
+channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter;
+channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter;
+channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter;
+
+channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants;
+channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;
+
+channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant;
+
+help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService;
+
+foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif;
+foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif;
+
+messages.foundGifs#450a1c0a next_offset:int results:Vector<FoundGif> = messages.FoundGifs;
+
+messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs;
+messages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs;
+
+inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+
+inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;
+
+botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+
+botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;
+botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;
+
+messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;
+
+exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
+
+messageFwdHeader#ec338270 flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader;
+
+auth.codeTypeSms#72a3158c = auth.CodeType;
+auth.codeTypeCall#741cd3e3 = auth.CodeType;
+auth.codeTypeFlashCall#226ccefb = auth.CodeType;
+
+auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;
+auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
+auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
+auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
+
+messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
+
+messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;
+
+inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;
+
+inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM;
+
+messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs;
+
+topPeer#edcdc05b peer:Peer rating:double = TopPeer;
+
+topPeerCategoryBotsPM#ab661b5b = TopPeerCategory;
+topPeerCategoryBotsInline#148677e2 = TopPeerCategory;
+topPeerCategoryCorrespondents#637b7ed = TopPeerCategory;
+topPeerCategoryGroups#bd17a14a = TopPeerCategory;
+topPeerCategoryChannels#161d9628 = TopPeerCategory;
+topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory;
+topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory;
+topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory;
+
+topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers;
+
+contacts.topPeersNotModified#de266ef5 = contacts.TopPeers;
+contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;
+contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
+
+draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;
+draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;
+
+messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers;
+messages.featuredStickers#f89d88e5 hash:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;
+
+messages.recentStickersNotModified#b17f890 = messages.RecentStickers;
+messages.recentStickers#22f3afb3 hash:int packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers;
+
+messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers;
+
+messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult;
+messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult;
+
+stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered;
+stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered;
+
+maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords;
+
+inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia;
+inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia;
+
+game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game;
+
+inputGameID#32c3e77 id:long access_hash:long = InputGame;
+inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame;
+
+highScore#58fffcd0 pos:int user_id:int score:int = HighScore;
+
+messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores;
+
+textEmpty#dc3d824f = RichText;
+textPlain#744694e0 text:string = RichText;
+textBold#6724abc4 text:RichText = RichText;
+textItalic#d912a59c text:RichText = RichText;
+textUnderline#c12622c4 text:RichText = RichText;
+textStrike#9bf8bb95 text:RichText = RichText;
+textFixed#6c3f19b9 text:RichText = RichText;
+textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText;
+textEmail#de5a0dd6 text:RichText email:string = RichText;
+textConcat#7e6260d7 texts:Vector<RichText> = RichText;
+textSubscript#ed6a8504 text:RichText = RichText;
+textSuperscript#c7fb5e01 text:RichText = RichText;
+textMarked#34b8621 text:RichText = RichText;
+textPhone#1ccb966a text:RichText phone:string = RichText;
+textImage#81ccf4f document_id:long w:int h:int = RichText;
+textAnchor#35553762 text:RichText name:string = RichText;
+
+pageBlockUnsupported#13567e8a = PageBlock;
+pageBlockTitle#70abc3fd text:RichText = PageBlock;
+pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock;
+pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock;
+pageBlockHeader#bfd064ec text:RichText = PageBlock;
+pageBlockSubheader#f12bb6e1 text:RichText = PageBlock;
+pageBlockParagraph#467a0766 text:RichText = PageBlock;
+pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock;
+pageBlockFooter#48870999 text:RichText = PageBlock;
+pageBlockDivider#db20b188 = PageBlock;
+pageBlockAnchor#ce0d37b0 name:string = PageBlock;
+pageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock;
+pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock;
+pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock;
+pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock;
+pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock;
+pageBlockCover#39f23300 cover:PageBlock = PageBlock;
+pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock;
+pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockChannel#ef1751b5 channel:Chat = PageBlock;
+pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock;
+pageBlockKicker#1e148390 text:RichText = PageBlock;
+pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock;
+pageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock;
+pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock;
+pageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock;
+pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock;
+
+phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;
+phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;
+phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;
+phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;
+
+dataJSON#7d748d04 data:string = DataJSON;
+
+labeledPrice#cb296bf8 label:string amount:long = LabeledPrice;
+
+invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> = Invoice;
+
+paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge;
+
+postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress;
+
+paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo;
+
+paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials;
+
+webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+
+inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument;
+
+inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;
+inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;
+
+upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;
+
+payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;
+
+payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;
+
+payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;
+payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;
+
+payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;
+
+payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo;
+
+inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials;
+inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials;
+inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials;
+inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials;
+
+account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword;
+
+shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption;
+
+inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem;
+
+inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall;
+
+phoneCallEmpty#5366c915 id:long = PhoneCall;
+phoneCallWaiting#1b8f4ad1 flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;
+phoneCallRequested#87eabb53 flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCallAccepted#997c454a flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCall#8742ae7f flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;
+phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.5?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
+
+phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
+
+phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol;
+
+phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;
+
+upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile;
+upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile;
+
+cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey;
+
+cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig;
+
+langPackString#cad181f6 key:string value:string = LangPackString;
+langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString;
+langPackStringDeleted#2979eeb2 key:string = LangPackString;
+
+langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference;
+
+langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;
+
+channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;
+channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction;
+channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;
+
+channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
+
+channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults;
+
+channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter;
+
+popularContact#5ce14175 client_id:long importers:int = PopularContact;
+
+messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers;
+messages.favedStickers#f37f2f16 hash:int packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers;
+
+recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl;
+recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl;
+recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl;
+recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl;
+recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl;
+
+help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls;
+
+inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia;
+
+webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization;
+
+account.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations;
+
+inputMessageID#a676a322 id:int = InputMessage;
+inputMessageReplyTo#bad88395 id:int = InputMessage;
+inputMessagePinned#86872538 = InputMessage;
+
+inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;
+inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer;
+
+dialogPeer#e56dbf05 peer:Peer = DialogPeer;
+dialogPeerFolder#514519e2 folder_id:int = DialogPeer;
+
+messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;
+messages.foundStickerSets#5108d648 hash:int sets:Vector<StickerSetCovered> = messages.FoundStickerSets;
+
+fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
+
+inputClientProxy#75588b3f address:string port:int = InputClientProxy;
+
+help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData;
+help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector<Chat> users:Vector<User> = help.ProxyData;
+
+help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
+help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
+
+inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile;
+inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile;
+
+secureFileEmpty#64199744 = SecureFile;
+secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;
+
+secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;
+
+securePlainPhone#7d6099dd phone:string = SecurePlainData;
+securePlainEmail#21ec5a5f email:string = SecurePlainData;
+
+secureValueTypePersonalDetails#9d2a81e3 = SecureValueType;
+secureValueTypePassport#3dac6a00 = SecureValueType;
+secureValueTypeDriverLicense#6e425c4 = SecureValueType;
+secureValueTypeIdentityCard#a0d0744b = SecureValueType;
+secureValueTypeInternalPassport#99a48f23 = SecureValueType;
+secureValueTypeAddress#cbe31e26 = SecureValueType;
+secureValueTypeUtilityBill#fc36954e = SecureValueType;
+secureValueTypeBankStatement#89137c0d = SecureValueType;
+secureValueTypeRentalAgreement#8b883488 = SecureValueType;
+secureValueTypePassportRegistration#99e3806a = SecureValueType;
+secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType;
+secureValueTypePhone#b320aadb = SecureValueType;
+secureValueTypeEmail#8e3ca7ee = SecureValueType;
+
+secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;
+
+inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue;
+
+secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash;
+
+secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;
+secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
+secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;
+secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
+
+secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;
+
+account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;
+
+account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;
+
+help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo;
+help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo;
+
+savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact;
+
+account.takeout#4dba4501 id:long = account.Takeout;
+
+passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo;
+passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo;
+
+securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo;
+securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo;
+securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo;
+
+secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings;
+
+inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP;
+inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP;
+
+secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType;
+secureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType;
+
+help.passportConfigNotModified#bfb9f457 = help.PassportConfig;
+help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig;
+
+inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent;
+
+jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;
+
+jsonNull#3f6d7b68 = JSONValue;
+jsonBool#c7345e6a value:Bool = JSONValue;
+jsonNumber#2be0dfa4 value:double = JSONValue;
+jsonString#b71e767a value:string = JSONValue;
+jsonArray#f7444763 value:Vector<JSONValue> = JSONValue;
+jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;
+
+pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell;
+
+pageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow;
+
+pageCaption#6f747657 text:RichText credit:RichText = PageCaption;
+
+pageListItemText#b92fb6cd text:RichText = PageListItem;
+pageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem;
+
+pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem;
+pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem;
+
+pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle;
+
+page#ae891bec flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page;
+
+help.supportName#8c05f1c9 name:string = help.SupportName;
+
+help.userInfoEmpty#f3ae2eed = help.UserInfo;
+help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;
+
+pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;
+
+poll#d5529d06 id:long flags:# closed:flags.0?true question:string answers:Vector<PollAnswer> = Poll;
+
+pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true option:bytes voters:int = PollAnswerVoters;
+
+pollResults#5755785a flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int = PollResults;
+
+chatOnlines#f041e250 onlines:int = ChatOnlines;
+
+statsURL#47a971e0 url:string = StatsURL;
+
+chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true = ChatAdminRights;
+
+chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;
+
+inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper;
+inputWallPaperSlug#72091c80 slug:string = InputWallPaper;
+
+account.wallPapersNotModified#1c199183 = account.WallPapers;
+account.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.WallPapers;
+
+codeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings;
+
+wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings;
+
+autoDownloadSettings#d246fd47 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int = AutoDownloadSettings;
+
+account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings;
+
+emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword;
+emojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword;
+
+emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference;
+
+emojiURL#a575739d url:string = EmojiURL;
+
+emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage;
+
+fileLocationToBeDeprecated#bc7fc6cd volume_id:long local_id:int = FileLocation;
+
+folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder;
+
+inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer;
+
+folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;
+
+messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;
+
+urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult;
+urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult;
+urlAuthResultDefault#a9d6db1f = UrlAuthResult;
+
+channelLocationEmpty#bfb5ad8b = ChannelLocation;
+channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation;
+
+peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated;
+
+restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason;
+
+inputTheme#3c5693e9 id:long access_hash:long = InputTheme;
+inputThemeSlug#f5890df1 slug:string = InputTheme;
+
+themeDocumentNotModified#483d270c = Theme;
+theme#f7d90ce0 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document installs_count:int = Theme;
+
+account.themesNotModified#f41eb622 = account.Themes;
+account.themes#7f676421 hash:int themes:Vector<Theme> = account.Themes;
+
+---functions---
+
+invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
+invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
+initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
+invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
+invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
+invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
+invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
+
+auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
+auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
+auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
+auth.logOut#5717da40 = Bool;
+auth.resetAuthorizations#9fab0d1a = Bool;
+auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
+auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization;
+auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;
+auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;
+auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization;
+auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;
+auth.recoverPassword#4ea56e92 code:string = auth.Authorization;
+auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;
+auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;
+auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;
+
+account.registerDevice#68976c6f flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<int> = Bool;
+account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = Bool;
+account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;
+account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings;
+account.resetNotifySettings#db7e1747 = Bool;
+account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User;
+account.updateStatus#6628562c offline:Bool = Bool;
+account.getWallPapers#aabb1763 hash:int = account.WallPapers;
+account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool;
+account.checkUsername#2714d86c username:string = Bool;
+account.updateUsername#3e0bdd7c username:string = User;
+account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;
+account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
+account.deleteAccount#418d4e0b reason:string = Bool;
+account.getAccountTTL#8fc711d = AccountDaysTTL;
+account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool;
+account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode;
+account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User;
+account.updateDeviceLocked#38df3532 period:int = Bool;
+account.getAuthorizations#e320c158 = account.Authorizations;
+account.resetAuthorization#df77f3bc hash:long = Bool;
+account.getPassword#548a30f5 = account.Password;
+account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings;
+account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool;
+account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode;
+account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool;
+account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;
+account.getWebAuthorizations#182e6d6f = account.WebAuthorizations;
+account.resetWebAuthorization#2d01b9ef hash:long = Bool;
+account.resetWebAuthorizations#682d2594 = Bool;
+account.getAllSecureValues#b288bc7d = Vector<SecureValue>;
+account.getSecureValue#73665bc2 types:Vector<SecureValueType> = Vector<SecureValue>;
+account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue;
+account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool;
+account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm;
+account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
+account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;
+account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool;
+account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
+account.verifyEmail#ecba39db email:string code:string = Bool;
+account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout;
+account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
+account.confirmPasswordEmail#8fdf1920 code:string = Bool;
+account.resendPasswordEmail#7a7f2a15 = Bool;
+account.cancelPasswordEmail#c1cbd5b6 = Bool;
+account.getContactSignUpNotification#9f07c728 = Bool;
+account.setContactSignUpNotification#cff43f61 silent:Bool = Bool;
+account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates;
+account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper;
+account.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;
+account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool;
+account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool;
+account.resetWallPapers#bb3b9804 = Bool;
+account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings;
+account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool;
+account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document;
+account.createTheme#2b7ffd7f slug:string title:string document:InputDocument = Theme;
+account.updateTheme#3b8ea202 flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument = Theme;
+account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool;
+account.installTheme#7ae43737 flags:# dark:flags.0?true format:flags.1?string theme:flags.1?InputTheme = Bool;
+account.getTheme#8d9d742b format:string theme:InputTheme document_id:long = Theme;
+account.getThemes#285946f8 format:string hash:int = account.Themes;
+
+users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
+users.getFullUser#ca30a5b1 id:InputUser = UserFull;
+users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool;
+
+contacts.getContactIDs#2caa4a42 hash:int = Vector<int>;
+contacts.getStatuses#c4a353ee = Vector<ContactStatus>;
+contacts.getContacts#c023849f hash:int = contacts.Contacts;
+contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;
+contacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates;
+contacts.deleteByPhones#1013fd9e phones:Vector<string> = Bool;
+contacts.block#332b49fc id:InputUser = Bool;
+contacts.unblock#e54100bd id:InputUser = Bool;
+contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;
+contacts.search#11f812d8 q:string limit:int = contacts.Found;
+contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
+contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers;
+contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool;
+contacts.resetSaved#879537f1 = Bool;
+contacts.getSaved#82f1e39f = Vector<SavedContact>;
+contacts.toggleTopPeers#8514bdda enabled:Bool = Bool;
+contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
+contacts.acceptContact#f831a20f id:InputUser = Updates;
+contacts.getLocated#a356056 geo_point:InputGeoPoint = Updates;
+
+messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
+messages.getDialogs#a0ee3b73 flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs;
+messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
+messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
+messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
+messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;
+messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
+messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
+messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
+messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;
+messages.reportSpam#cf1592db peer:InputPeer = Bool;
+messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings;
+messages.report#bd82b658 peer:InputPeer id:Vector<int> reason:ReportReason = Bool;
+messages.getChats#3c6aa187 id:Vector<int> = messages.Chats;
+messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;
+messages.editChatTitle#dc452855 chat_id:int title:string = Updates;
+messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates;
+messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates;
+messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates;
+messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;
+messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig;
+messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat;
+messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat;
+messages.discardEncryption#edd923c5 chat_id:int = Bool;
+messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool;
+messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool;
+messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
+messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>;
+messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool;
+messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;
+messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers;
+messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers;
+messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia;
+messages.exportChatInvite#df7534c peer:InputPeer = ExportedChatInvite;
+messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
+messages.importChatInvite#6c50051c hash:string = Updates;
+messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
+messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult;
+messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
+messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;
+messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>;
+messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool;
+messages.migrateChat#15a3b8e3 chat_id:int = Updates;
+messages.searchGlobal#bf7225a4 flags:# folder_id:flags.0?int q:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
+messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool;
+messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document;
+messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs;
+messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs;
+messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;
+messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
+messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool;
+messages.sendInlineBotResult#220815b0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string schedule_date:flags.10?int = Updates;
+messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData;
+messages.editMessage#48f71778 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int = Updates;
+messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool;
+messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer;
+messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool;
+messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs;
+messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool;
+messages.getAllDrafts#6a3f8d65 = Updates;
+messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers;
+messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool;
+messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers;
+messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool;
+messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool;
+messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers;
+messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers;
+messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>;
+messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates;
+messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool;
+messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores;
+messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores;
+messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats;
+messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats;
+messages.getWebPage#32ca8f91 url:string hash:int = WebPage;
+messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;
+messages.reorderPinnedDialogs#3b1adf37 flags:# force:flags.0?true folder_id:int order:Vector<InputDialogPeer> = Bool;
+messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs;
+messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool;
+messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool;
+messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;
+messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates;
+messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers;
+messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
+messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
+messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory;
+messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages;
+messages.sendMultiMedia#cc0110cb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int = Updates;
+messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
+messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets;
+messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
+messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool;
+messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>;
+messages.clearAllDrafts#7e58ee9c = Bool;
+messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true peer:InputPeer id:int = Updates;
+messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
+messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
+messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
+messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL;
+messages.editChatAbout#def60797 peer:InputPeer about:string = Bool;
+messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;
+messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference;
+messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference;
+messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector<string> = Vector<EmojiLanguage>;
+messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL;
+messages.getSearchCounters#732eef00 peer:InputPeer filters:Vector<MessagesFilter> = Vector<messages.SearchCounter>;
+messages.requestUrlAuth#e33f5613 peer:InputPeer msg_id:int button_id:int = UrlAuthResult;
+messages.acceptUrlAuth#f729ea98 flags:# write_allowed:flags.0?true peer:InputPeer msg_id:int button_id:int = UrlAuthResult;
+messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool;
+messages.getScheduledHistory#e2c2685b peer:InputPeer hash:int = messages.Messages;
+messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector<int> = messages.Messages;
+messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates;
+messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates;
+
+updates.getState#edd4882a = updates.State;
+updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
+updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;
+
+photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto;
+photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo;
+photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>;
+photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;
+
+upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;
+upload.getFile#b15a9afc flags:# precise:flags.0?true location:InputFileLocation offset:int limit:int = upload.File;
+upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
+upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;
+upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile;
+upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector<FileHash>;
+upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector<FileHash>;
+upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector<FileHash>;
+
+help.getConfig#c4f9186b = Config;
+help.getNearestDc#1fb33026 = NearestDc;
+help.getAppUpdate#522d5a7d source:string = help.AppUpdate;
+help.getInviteText#4d392343 = help.InviteText;
+help.getSupport#9cdf08cd = help.Support;
+help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
+help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
+help.getCdnConfig#52029342 = CdnConfig;
+help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
+help.getProxyData#3d7758e1 = help.ProxyData;
+help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
+help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
+help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
+help.getAppConfig#98914110 = JSONValue;
+help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
+help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
+help.getSupportName#d360e72c = help.SupportName;
+help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
+help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
+
+channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
+channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
+channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory;
+channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool;
+channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;
+channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants;
+channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant;
+channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
+channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
+channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;
+channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;
+channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
+channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
+channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
+channels.updateUsername#3514b3de channel:InputChannel username:string = Bool;
+channels.joinChannel#24b524c5 channel:InputChannel = Updates;
+channels.leaveChannel#f836aa95 channel:InputChannel = Updates;
+channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
+channels.deleteChannel#c0111fe3 channel:InputChannel = Updates;
+channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink;
+channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;
+channels.getAdminedPublicChannels#f8b036af flags:# by_location:flags.0?true check_limit:flags.1?true = messages.Chats;
+channels.editBanned#72796912 channel:InputChannel user_id:InputUser banned_rights:ChatBannedRights = Updates;
+channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults;
+channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool;
+channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;
+channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool;
+channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;
+channels.getLeftChannels#8341ecc0 offset:int = messages.Chats;
+channels.getGroupsForDiscussion#f5dad378 = messages.Chats;
+channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
+channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates;
+channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool;
+channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates;
+
+bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
+bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
+
+payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm;
+payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt;
+payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;
+payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult;
+payments.getSavedInfo#227d824b = payments.SavedInfo;
+payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
+
+stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet;
+stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
+stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
+stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet;
+
+phone.getCallConfig#55451fa9 = DataJSON;
+phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
+phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;
+phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;
+phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
+
+langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
+langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
+langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference;
+langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;
+langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage;
+
+folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
+folders.deleteFolder#1c295881 folder_id:int = Updates;
+
+// LAYER 105

+ 113 - 0
src/lib/gramjs/tl/static/schema.tl

@@ -0,0 +1,113 @@
+// Core types (no need to gen)
+
+//vector#1cb5c415 {t:Type} # [ t ] = Vector t;
+
+///////////////////////////////
+/// Authorization key creation
+///////////////////////////////
+
+resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ;
+
+p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data;
+p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;
+p_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data;
+p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;
+
+server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;
+server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;
+
+server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;
+
+client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;
+
+dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
+dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;
+dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;
+
+destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes;
+destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes;
+destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;
+
+---functions---
+
+req_pq#60469778 nonce:int128 = ResPQ;
+req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
+
+req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;
+
+set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;
+
+destroy_auth_key#d1435160 = DestroyAuthKeyRes;
+
+///////////////////////////////
+////////////// System messages
+///////////////////////////////
+
+---types---
+
+msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck;
+
+bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification;
+bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification;
+
+msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq;
+msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo;
+msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo;
+
+msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+
+msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq;
+
+//rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually
+
+rpc_error#2144ca19 error_code:int error_message:string = RpcError;
+
+rpc_answer_unknown#5e2ad36e = RpcDropAnswer;
+rpc_answer_dropped_running#cd78e586 = RpcDropAnswer;
+rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer;
+
+future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;
+future_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts;
+
+pong#347773c5 msg_id:long ping_id:long = Pong;
+
+destroy_session_ok#e22045fc session_id:long = DestroySessionRes;
+destroy_session_none#62d350c9 session_id:long = DestroySessionRes;
+
+new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession;
+
+//message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually
+//msg_container#73f1f8dc messages:vector<message> = MessageContainer; // parsed manually
+//msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container
+//gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually
+
+http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait;
+
+//ipPort ipv4:int port:int = IpPort;
+//help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector<ipPort> = help.ConfigSimple;
+
+ipPort#d433ad73 ipv4:int port:int = IpPort;
+ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort;
+accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector<IpPort> = AccessPointRule;
+help.configSimple#5a592a6c date:int expires:int rules:vector<AccessPointRule> = help.ConfigSimple;
+
+tlsClientHello blocks:vector<TlsBlock> = TlsClientHello;
+
+tlsBlockString data:string = TlsBlock;
+tlsBlockRandom length:int = TlsBlock;
+tlsBlockZero length:int = TlsBlock;
+tlsBlockDomain = TlsBlock;
+tlsBlockGrease seed:int = TlsBlock;
+tlsBlockScope entries:Vector<TlsBlock> = TlsBlock;
+
+---functions---
+
+rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer;
+
+get_future_salts#b921bd04 num:int = FutureSalts;
+
+ping#7abe77ec ping_id:long = Pong;
+ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;
+
+destroy_session#e7512126 session_id:long = DestroySessionRes;

+ 59 - 0
src/lib/gramjs/tl/types-generator/generate.js

@@ -0,0 +1,59 @@
+const path = require('path');
+const fs = require('fs');
+
+const { parseTl } = require('../generationHelpers');
+const templateFn = require('./template');
+
+
+
+const INPUT_FILE = path.resolve(__dirname, '../static/api.tl');
+const SCHEMA_FILE = path.resolve(__dirname, '../static/schema.tl');
+
+const OUTPUT_FILE = path.resolve(__dirname, '../gramJsApi.d.ts');
+
+function main() {
+  const tlContent = fs.readFileSync(INPUT_FILE, 'utf-8')
+  const apiConfig = extractParams(tlContent);
+  const schemeContent = fs.readFileSync(SCHEMA_FILE, 'utf-8');
+  const schemeConfig = extractParams(schemeContent);
+  const types = [...apiConfig.types,...schemeConfig.types]
+  const functions = [...apiConfig.functions,...schemeConfig.functions]
+  const constructors = [...apiConfig.constructors,...schemeConfig.constructors]
+  const generated = templateFn({types:types,functions:functions,constructors:constructors});
+
+  fs.writeFileSync(OUTPUT_FILE, generated);
+}
+
+function extractParams(fileContent) {
+  const defInterator = parseTl(fileContent, 105);
+  const types = {};
+  const constructors = [];
+  const functions = [];
+
+  for (const def of defInterator) {
+    if (def.isFunction) {
+      functions.push(def);
+    } else {
+      if (!types[def.result]) {
+        let [namespace, name] = def.result.includes('.') ? def.result.split('.') : [undefined, def.result];
+
+        types[def.result] = {
+          namespace,
+          name,
+          constructors: []
+        };
+      }
+
+      types[def.result].constructors.push(def.namespace ? `${def.namespace}.${def.name}` : def.name);
+      constructors.push(def);
+    }
+  }
+
+  return {
+    types: Object.values(types),
+    constructors,
+    functions
+  };
+}
+
+main();

+ 236 - 0
src/lib/gramjs/tl/types-generator/template.js

@@ -0,0 +1,236 @@
+// Not sure what they are for.
+const WEIRD_TYPES = new Set(['Bool', 'X', 'Type']);
+
+module.exports = ({ types, constructors, functions }) => {
+  function groupByKey(collection, key) {
+    return collection.reduce((byKey, member) => {
+      const keyValue = member[key] || '_';
+
+      if (!byKey[keyValue]) {
+        byKey[keyValue] = [member];
+      } else {
+        byKey[keyValue].push(member);
+      }
+
+      return byKey;
+    }, {});
+  }
+
+  function renderMtpConstructors(constructors, indent) {
+    return constructors.map(({ namespace, name, argsConfig }) => `
+      interface ${namespace ? `${namespace}_` : ''}${lowerCase(name)} extends GramJsInstance {
+${indent}  ${Object.keys(argsConfig)
+      .map((argName) => `
+        ${renderArg(argName, argsConfig[argName])};
+      `.trim())
+      .join(`\n${indent}  `)}
+${indent}}
+    `.trim())
+      .join(`\n${indent}`);
+  }
+
+  function renderMtpTypes(types, indent) {
+    return types.map(({ namespace, name, constructors }) => `
+      ${!constructors.length ? '// ' : ''}type ${namespace ? `${namespace}_` : ''}${name} = ${constructors.map(renderMtpCtorName)
+      .join(' | ')};
+    `.trim())
+      .join(`\n${indent}`);
+  }
+
+  function renderMtpMethods(functions, indent) {
+    return functions.map(({ namespace, name, argsConfig }) => `
+      interface ${namespace ? `${namespace}_` : ''}${lowerCase(name)} extends GramJsInstance {
+${indent}  ${Object.keys(argsConfig)
+      .map((argName) => `
+        ${renderArg(argName, argsConfig[argName])};
+      `.trim())
+      .join(`\n${indent}  `)}
+${indent}}
+    `.trim())
+      .join(`\n${indent}`);
+  }
+
+  function renderGramJsConstructors(constructors, indent) {
+    return constructors.map(({ namespace, name }) => `
+      ${name}: TlConstructor<ToArgs<MTProto.${namespace ? `${namespace}_` : ''}${lowerCase(name)}>>
+    `.trim())
+      .join(`\n${indent}`);
+  }
+
+  function renderGramJsRequests(requests, indent) {
+    return requests.map(({ namespace, name, result }) => `
+      ${name}: TlRequest<
+${indent}  Partial<MTProto.${namespace ? `${namespace}_` : ''}${lowerCase(name)}>,
+${indent}  MTProto.${renderRequestResult(result)}
+${indent}>`.trim())
+      .join(`\n${indent}`);
+  }
+
+  function renderRequestResult(result) {
+    const vectorMatch = result.match(/[Vv]ector<([\w\d.]+)>/);
+    const isVector = Boolean(vectorMatch);
+    const scalarValue = isVector ? vectorMatch[1] : result;
+    const isTlType = Boolean(scalarValue.match(/^[A-Z]/)) || scalarValue.includes('.');
+
+    return renderValueType(scalarValue, isVector, isTlType);
+  }
+
+  function renderArg(argName, argConfig, forceOptional) {
+    const {
+      isVector, isFlag, skipConstructorId, type
+    } = argConfig;
+
+    const valueType = renderValueType(type, isVector, !skipConstructorId);
+
+    return `${argName === 'flags' ? '// ' : ''}${argName}${isFlag || forceOptional ? '?' : ''}: ${valueType}`;
+  }
+
+  function renderValueType(type, isVector, isTlType) {
+    if (WEIRD_TYPES.has(type)) {
+      return type;
+    }
+
+    let resType;
+
+    if (typeof type === 'string' && isTlType) {
+      resType = renderMtpTypeName(type);
+    } else {
+      resType = type;
+    }
+
+    if (isVector) {
+      resType = `${resType}[]`;
+    }
+
+    return resType;
+  }
+
+  function renderMtpCtorName(fullName) {
+    let [namespace, name] = fullName.includes('.') ? fullName.split('.') : [undefined, fullName];
+
+    return `${namespace ? `${namespace}_` : ''}${lowerCase(name)}`;
+  }
+
+  function renderMtpTypeName(fullName) {
+    let [namespace, name] = fullName.includes('.') ? fullName.split('.') : [undefined, fullName];
+
+    return `${namespace ? `${namespace}_` : ''}${name}`;
+  }
+
+  function lowerCase(str) {
+    return `${str[0].toLowerCase()}${str.slice(1)}`;
+  }
+
+  const constructorsByNs = groupByKey(constructors, 'namespace');
+  const requestsByNs = groupByKey(functions, 'namespace');
+
+  // language=TypeScript
+  return `
+// This file is autogenerated. All changes will be overwritten.
+
+import { BigInteger } from 'big-integer';
+
+interface GramJsInstance {
+  CONSTRUCTOR_ID: number;
+  SUBCLASS_OF_ID: number;
+
+  getBytes(): Buffer;
+}
+
+type ToArgs<T> = Omit<T, 'CONSTRUCTOR_ID' | 'SUBCLASS_OF_ID' | 'getBytes'>
+
+export namespace MTProto {
+
+  type AnyClass = new (...args: any[]) => any;
+  type AnyLiteral = Record<string, any>;
+  type Buffer = Uint8Array;
+
+  type Reader = any; // To be defined.
+  type Client = any; // To be defined.
+  type Utils = any; // To be defined.
+
+  type X = unknown; // TODO Verify this.
+  type Type = unknown; // TODO Verify this.
+  type Bool = boolean;
+  type int128 = number;
+  type int256 = number;
+  type long = number[] | string | BigInteger;
+  type bytes = string | Uint8Array;
+
+  ${renderMtpConstructors(constructors, '  ')}
+
+  ${renderMtpTypes(types, '  ')}
+
+  ${renderMtpMethods(functions, '  ')}
+
+}
+
+// For some reason when \`interface TlRequest extends TlConstructor\`,
+// the \`InstanceType<TlRequest>\` refers to the parent class (\`TlConstructor\`) instance.
+interface TlCommon<Args extends AnyLiteral> {
+  serializeBytes(data: Buffer | string): Buffer;
+
+  serializeDate(date: Date | number): Buffer;
+
+  fromReader(reader: Reader): GramJsInstance & Args;
+}
+
+interface TlConstructor<Args> extends TlCommon<Args> {
+  new(args: Args): GramJsInstance & Args;
+}
+
+interface TlRequest<Args, Response> extends TlCommon<Args> {
+  new(args: Args): GramJsInstance & Args & {
+    className: string;
+    classType: 'request';
+
+    __response: Response;
+  };
+
+  className: string;
+  classType: 'request';
+
+  readResult(reader: Reader): Buffer;
+
+  resolve(client: Client, utils: Utils): Promise<void>;
+}
+
+interface Constructors {
+  ${renderGramJsConstructors(constructorsByNs._, '  ')}
+  ${Object.keys(constructorsByNs)
+    .map(namespace => namespace !== '_' ? `
+  ${namespace}: {
+    ${renderGramJsConstructors(constructorsByNs[namespace], '    ')}
+  }` : '')
+    .join('\n')}
+}
+
+interface Requests {
+  ${renderGramJsRequests(requestsByNs._, '  ')}
+  ${Object.keys(requestsByNs)
+    .map(namespace => namespace !== '_' ? `
+  ${namespace}: {
+    ${renderGramJsRequests(requestsByNs[namespace], '    ')}
+  }` : '')
+    .join('\n')}
+}
+
+type ValuesOf<T> = T[keyof T];
+
+export namespace GramJsApi {
+  type AnyRequest = ${requestsByNs._.map(({ name }) => `Requests['${name}']`)
+    .join(' | ')} |
+    ${Object.keys(requestsByNs)
+    .filter(ns => ns !== '_')
+    .map(ns => `ValuesOf<Requests['${ns}']>`)
+    .join(' | ')};
+}
+
+declare const gramJsApi: {
+  constructors: Constructors;
+  requests: Requests;
+};
+
+export default gramJsApi;
+`;
+};

+ 0 - 766
src/lib/gramjs/tl/types/account.js

@@ -1,766 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class PrivacyRules extends TLObject {
-    static CONSTRUCTOR_ID = 0x50a04e45;
-    static SUBCLASS_OF_ID = 0xb55aba82;
-
-    /**
-    Constructor for account.PrivacyRules: Instance of PrivacyRules
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x50a04e45;
-        this.SUBCLASS_OF_ID = 0xb55aba82;
-
-        this.rules = args.rules;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("454ea050","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.rules.length),Buffer.concat(this.rules.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _rules;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _rules = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _rules.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({rules:_rules,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class Authorizations extends TLObject {
-    static CONSTRUCTOR_ID = 0x1250abde;
-    static SUBCLASS_OF_ID = 0xbf5e0ff;
-
-    /**
-    Constructor for account.Authorizations: Instance of Authorizations
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1250abde;
-        this.SUBCLASS_OF_ID = 0xbf5e0ff;
-
-        this.authorizations = args.authorizations;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("deab5012","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.authorizations.length),Buffer.concat(this.authorizations.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _authorizations;
-        let _x;
-        let len;
-        reader.readInt();
-        _authorizations = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _authorizations.push(_x);
-            }
-            return new this({authorizations:_authorizations})
-        }
-    }
-
-
-class Password extends TLObject {
-    static CONSTRUCTOR_ID = 0xad2641f8;
-    static SUBCLASS_OF_ID = 0x53a211a3;
-
-    /**
-    Constructor for account.Password: Instance of Password
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xad2641f8;
-        this.SUBCLASS_OF_ID = 0x53a211a3;
-
-        this.hasRecovery = args.hasRecovery || null;
-        this.hasSecureValues = args.hasSecureValues || null;
-        this.hasPassword = args.hasPassword || null;
-        this.currentAlgo = args.currentAlgo || null;
-        this.srp_B = args.srp_B || null;
-        this.srpId = args.srpId || null;
-        this.hint = args.hint || null;
-        this.emailUnconfirmedPattern = args.emailUnconfirmedPattern || null;
-        this.newAlgo = args.newAlgo;
-        this.newSecureAlgo = args.newSecureAlgo;
-        this.secureRandom = args.secureRandom;
-    }
-    getBytes() {
-        if (!((this.has_password || this.has_password!==null && this.current_algo || this.current_algo!==null && this.srp_B || this.srp_B!==null && this.srp_id || this.srp_id!==null) && (this.has_password===null || this.has_password===false && this.current_algo===null || this.current_algo===false && this.srp_B===null || this.srp_B===false && this.srp_id===null || this.srp_id===false)))
-	 throw new Error('has_password, current_algo, srp_B, srp_id paramaters must all be false-y or all true')
-        return Buffer.concat([
-            Buffer.from("f84126ad","hex"),
-            struct.pack('<I', (this.hasRecovery === undefined || this.hasRecovery === false || this.hasRecovery === null) ? 0 : 1 | (this.hasSecureValues === undefined || this.hasSecureValues === false || this.hasSecureValues === null) ? 0 : 2 | (this.hasPassword === undefined || this.hasPassword === false || this.hasPassword === null) ? 0 : 4 | (this.currentAlgo === undefined || this.currentAlgo === false || this.currentAlgo === null) ? 0 : 4 | (this.srp_B === undefined || this.srp_B === false || this.srp_B === null) ? 0 : 4 | (this.srpId === undefined || this.srpId === false || this.srpId === null) ? 0 : 4 | (this.hint === undefined || this.hint === false || this.hint === null) ? 0 : 8 | (this.emailUnconfirmedPattern === undefined || this.emailUnconfirmedPattern === false || this.emailUnconfirmedPattern === null) ? 0 : 16),
-            (this.currentAlgo === undefined || this.currentAlgo === false || this.currentAlgo ===null) ? Buffer.alloc(0) : [this.currentAlgo.getBytes()],
-            (this.srp_B === undefined || this.srp_B === false || this.srp_B ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.srp_B)],
-            (this.srpId === undefined || this.srpId === false || this.srpId ===null) ? Buffer.alloc(0) : [readBufferFromBigInt(this.srpId,8,true,true)],
-            (this.hint === undefined || this.hint === false || this.hint ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.hint)],
-            (this.emailUnconfirmedPattern === undefined || this.emailUnconfirmedPattern === false || this.emailUnconfirmedPattern ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.emailUnconfirmedPattern)],
-            this.newAlgo.getBytes(),
-            this.newSecureAlgo.getBytes(),
-            TLObject.serializeBytes(this.secureRandom),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _has_recovery;
-        let _has_secure_values;
-        let _has_password;
-        let _current_algo;
-        let _srp_B;
-        let _srp_id;
-        let _hint;
-        let _email_unconfirmed_pattern;
-        let _new_algo;
-        let _new_secure_algo;
-        let _secure_random;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _has_recovery = Boolean(flags & 1);
-        _has_secure_values = Boolean(flags & 2);
-        _has_password = Boolean(flags & 4);
-        if (flags & 4) {
-            _current_algo = reader.tgReadObject();
-        }
-        else {
-            _current_algo = null
-        }
-        if (flags & 4) {
-            _srp_B = reader.tgReadBytes();
-        }
-        else {
-            _srp_B = null
-        }
-        if (flags & 4) {
-            _srp_id = reader.readLong();
-        }
-        else {
-            _srp_id = null
-        }
-        if (flags & 8) {
-            _hint = reader.tgReadString();
-        }
-        else {
-            _hint = null
-        }
-        if (flags & 16) {
-            _email_unconfirmed_pattern = reader.tgReadString();
-        }
-        else {
-            _email_unconfirmed_pattern = null
-        }
-        _new_algo = reader.tgReadObject();
-        _new_secure_algo = reader.tgReadObject();
-        _secure_random = reader.tgReadBytes();
-        return new this({hasRecovery:_has_recovery,
-	hasSecureValues:_has_secure_values,
-	hasPassword:_has_password,
-	currentAlgo:_current_algo,
-	srp_B:_srp_B,
-	srpId:_srp_id,
-	hint:_hint,
-	emailUnconfirmedPattern:_email_unconfirmed_pattern,
-	newAlgo:_new_algo,
-	newSecureAlgo:_new_secure_algo,
-	secureRandom:_secure_random})
-    }
-}
-
-
-class PasswordSettings extends TLObject {
-    static CONSTRUCTOR_ID = 0x9a5c33e5;
-    static SUBCLASS_OF_ID = 0xd23fb078;
-
-    /**
-    Constructor for account.PasswordSettings: Instance of PasswordSettings
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9a5c33e5;
-        this.SUBCLASS_OF_ID = 0xd23fb078;
-
-        this.email = args.email || null;
-        this.secureSettings = args.secureSettings || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e5335c9a","hex"),
-            struct.pack('<I', (this.email === undefined || this.email === false || this.email === null) ? 0 : 1 | (this.secureSettings === undefined || this.secureSettings === false || this.secureSettings === null) ? 0 : 2),
-            (this.email === undefined || this.email === false || this.email ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.email)],
-            (this.secureSettings === undefined || this.secureSettings === false || this.secureSettings ===null) ? Buffer.alloc(0) : [this.secureSettings.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _email;
-        let _secure_settings;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _email = reader.tgReadString();
-        }
-        else {
-            _email = null
-        }
-        if (flags & 2) {
-            _secure_settings = reader.tgReadObject();
-        }
-        else {
-            _secure_settings = null
-        }
-        return new this({email:_email,
-	secureSettings:_secure_settings})
-    }
-}
-
-
-class PasswordInputSettings extends TLObject {
-    static CONSTRUCTOR_ID = 0xc23727c9;
-    static SUBCLASS_OF_ID = 0xc426ca6;
-
-    /**
-    Constructor for account.PasswordInputSettings: Instance of PasswordInputSettings
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc23727c9;
-        this.SUBCLASS_OF_ID = 0xc426ca6;
-
-        this.newAlgo = args.newAlgo || null;
-        this.newPasswordHash = args.newPasswordHash || null;
-        this.hint = args.hint || null;
-        this.email = args.email || null;
-        this.newSecureSettings = args.newSecureSettings || null;
-    }
-    getBytes() {
-        if (!((this.new_algo || this.new_algo!==null && this.new_password_hash || this.new_password_hash!==null && this.hint || this.hint!==null) && (this.new_algo===null || this.new_algo===false && this.new_password_hash===null || this.new_password_hash===false && this.hint===null || this.hint===false)))
-	 throw new Error('new_algo, new_password_hash, hint paramaters must all be false-y or all true')
-        return Buffer.concat([
-            Buffer.from("c92737c2","hex"),
-            struct.pack('<I', (this.newAlgo === undefined || this.newAlgo === false || this.newAlgo === null) ? 0 : 1 | (this.newPasswordHash === undefined || this.newPasswordHash === false || this.newPasswordHash === null) ? 0 : 1 | (this.hint === undefined || this.hint === false || this.hint === null) ? 0 : 1 | (this.email === undefined || this.email === false || this.email === null) ? 0 : 2 | (this.newSecureSettings === undefined || this.newSecureSettings === false || this.newSecureSettings === null) ? 0 : 4),
-            (this.newAlgo === undefined || this.newAlgo === false || this.newAlgo ===null) ? Buffer.alloc(0) : [this.newAlgo.getBytes()],
-            (this.newPasswordHash === undefined || this.newPasswordHash === false || this.newPasswordHash ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.newPasswordHash)],
-            (this.hint === undefined || this.hint === false || this.hint ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.hint)],
-            (this.email === undefined || this.email === false || this.email ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.email)],
-            (this.newSecureSettings === undefined || this.newSecureSettings === false || this.newSecureSettings ===null) ? Buffer.alloc(0) : [this.newSecureSettings.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _new_algo;
-        let _new_password_hash;
-        let _hint;
-        let _email;
-        let _new_secure_settings;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _new_algo = reader.tgReadObject();
-        }
-        else {
-            _new_algo = null
-        }
-        if (flags & 1) {
-            _new_password_hash = reader.tgReadBytes();
-        }
-        else {
-            _new_password_hash = null
-        }
-        if (flags & 1) {
-            _hint = reader.tgReadString();
-        }
-        else {
-            _hint = null
-        }
-        if (flags & 2) {
-            _email = reader.tgReadString();
-        }
-        else {
-            _email = null
-        }
-        if (flags & 4) {
-            _new_secure_settings = reader.tgReadObject();
-        }
-        else {
-            _new_secure_settings = null
-        }
-        return new this({newAlgo:_new_algo,
-	newPasswordHash:_new_password_hash,
-	hint:_hint,
-	email:_email,
-	newSecureSettings:_new_secure_settings})
-    }
-}
-
-
-class TmpPassword extends TLObject {
-    static CONSTRUCTOR_ID = 0xdb64fd34;
-    static SUBCLASS_OF_ID = 0xb064992d;
-
-    /**
-    Constructor for account.TmpPassword: Instance of TmpPassword
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdb64fd34;
-        this.SUBCLASS_OF_ID = 0xb064992d;
-
-        this.tmpPassword = args.tmpPassword;
-        this.validUntil = args.validUntil;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("34fd64db","hex"),
-            TLObject.serializeBytes(this.tmpPassword),
-            struct.pack('<i', this.validUntil),
-            ])
-        }
-    static fromReader(reader) {
-        let _tmp_password;
-        let _valid_until;
-        let _x;
-        let len;
-        _tmp_password = reader.tgReadBytes();
-        _valid_until = reader.readInt();
-        return new this({tmpPassword:_tmp_password,
-	validUntil:_valid_until})
-    }
-}
-
-
-class WebAuthorizations extends TLObject {
-    static CONSTRUCTOR_ID = 0xed56c9fc;
-    static SUBCLASS_OF_ID = 0x9a365b32;
-
-    /**
-    Constructor for account.WebAuthorizations: Instance of WebAuthorizations
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xed56c9fc;
-        this.SUBCLASS_OF_ID = 0x9a365b32;
-
-        this.authorizations = args.authorizations;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fcc956ed","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.authorizations.length),Buffer.concat(this.authorizations.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _authorizations;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _authorizations = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _authorizations.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({authorizations:_authorizations,
-	users:_users})
-            }
-        }
-
-
-class AuthorizationForm extends TLObject {
-    static CONSTRUCTOR_ID = 0xad2e1cd8;
-    static SUBCLASS_OF_ID = 0x78049a94;
-
-    /**
-    Constructor for account.AuthorizationForm: Instance of AuthorizationForm
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xad2e1cd8;
-        this.SUBCLASS_OF_ID = 0x78049a94;
-
-        this.requiredTypes = args.requiredTypes;
-        this.values = args.values;
-        this.errors = args.errors;
-        this.users = args.users;
-        this.privacyPolicyUrl = args.privacyPolicyUrl || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d81c2ead","hex"),
-            struct.pack('<I', (this.privacyPolicyUrl === undefined || this.privacyPolicyUrl === false || this.privacyPolicyUrl === null) ? 0 : 1),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.requiredTypes.length),Buffer.concat(this.requiredTypes.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.values.length),Buffer.concat(this.values.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.errors.length),Buffer.concat(this.errors.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            (this.privacyPolicyUrl === undefined || this.privacyPolicyUrl === false || this.privacyPolicyUrl ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.privacyPolicyUrl)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _required_types;
-        let _values;
-        let _errors;
-        let _users;
-        let _privacy_policy_url;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        reader.readInt();
-        _required_types = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _required_types.push(_x);
-            }
-            reader.readInt();
-            _values = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _values.push(_x);
-                }
-                reader.readInt();
-                _errors = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _errors.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        if (flags & 1) {
-                            _privacy_policy_url = reader.tgReadString();
-                        }
-                        else {
-                            _privacy_policy_url = null
-                        }
-                        return new this({requiredTypes:_required_types,
-	values:_values,
-	errors:_errors,
-	users:_users,
-	privacyPolicyUrl:_privacy_policy_url})
-                    }
-                }
-
-
-class SentEmailCode extends TLObject {
-    static CONSTRUCTOR_ID = 0x811f854f;
-    static SUBCLASS_OF_ID = 0x69f3c06e;
-
-    /**
-    Constructor for account.SentEmailCode: Instance of SentEmailCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x811f854f;
-        this.SUBCLASS_OF_ID = 0x69f3c06e;
-
-        this.emailPattern = args.emailPattern;
-        this.length = args.length;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4f851f81","hex"),
-            TLObject.serializeBytes(this.emailPattern),
-            struct.pack('<i', this.length),
-            ])
-        }
-    static fromReader(reader) {
-        let _email_pattern;
-        let _length;
-        let _x;
-        let len;
-        _email_pattern = reader.tgReadString();
-        _length = reader.readInt();
-        return new this({emailPattern:_email_pattern,
-	length:_length})
-    }
-}
-
-
-class Takeout extends TLObject {
-    static CONSTRUCTOR_ID = 0x4dba4501;
-    static SUBCLASS_OF_ID = 0x843ebe85;
-
-    /**
-    Constructor for account.Takeout: Instance of Takeout
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4dba4501;
-        this.SUBCLASS_OF_ID = 0x843ebe85;
-
-        this.id = args.id;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0145ba4d","hex"),
-            readBufferFromBigInt(this.id,8,true,true),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _x;
-        let len;
-        _id = reader.readLong();
-        return new this({id:_id})
-    }
-}
-
-
-class WallPapersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0x1c199183;
-    static SUBCLASS_OF_ID = 0xa2c548fd;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x1c199183;
-        this.SUBCLASS_OF_ID = 0xa2c548fd;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8391191c","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class WallPapers extends TLObject {
-    static CONSTRUCTOR_ID = 0x702b65a9;
-    static SUBCLASS_OF_ID = 0xa2c548fd;
-
-    /**
-    Constructor for account.WallPapers: Instance of either WallPapersNotModified, WallPapers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x702b65a9;
-        this.SUBCLASS_OF_ID = 0xa2c548fd;
-
-        this.hash = args.hash;
-        this.wallpapers = args.wallpapers;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a9652b70","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.wallpapers.length),Buffer.concat(this.wallpapers.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _wallpapers;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _wallpapers = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _wallpapers.push(_x);
-            }
-            return new this({hash:_hash,
-	wallpapers:_wallpapers})
-        }
-    }
-
-
-class AutoDownloadSettings extends TLObject {
-    static CONSTRUCTOR_ID = 0x63cacf26;
-    static SUBCLASS_OF_ID = 0x2fb85921;
-
-    /**
-    Constructor for account.AutoDownloadSettings: Instance of AutoDownloadSettings
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x63cacf26;
-        this.SUBCLASS_OF_ID = 0x2fb85921;
-
-        this.low = args.low;
-        this.medium = args.medium;
-        this.high = args.high;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("26cfca63","hex"),
-            this.low.getBytes(),
-            this.medium.getBytes(),
-            this.high.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _low;
-        let _medium;
-        let _high;
-        let _x;
-        let len;
-        _low = reader.tgReadObject();
-        _medium = reader.tgReadObject();
-        _high = reader.tgReadObject();
-        return new this({low:_low,
-	medium:_medium,
-	high:_high})
-    }
-}
-
-
-class ThemesNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xf41eb622;
-    static SUBCLASS_OF_ID = 0x7fc52204;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xf41eb622;
-        this.SUBCLASS_OF_ID = 0x7fc52204;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("22b61ef4","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class Themes extends TLObject {
-    static CONSTRUCTOR_ID = 0x7f676421;
-    static SUBCLASS_OF_ID = 0x7fc52204;
-
-    /**
-    Constructor for account.Themes: Instance of either ThemesNotModified, Themes
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x7f676421;
-        this.SUBCLASS_OF_ID = 0x7fc52204;
-
-        this.hash = args.hash;
-        this.themes = args.themes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2164677f","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.themes.length),Buffer.concat(this.themes.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _themes;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _themes = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _themes.push(_x);
-            }
-            return new this({hash:_hash,
-	themes:_themes})
-        }
-    }
-
-module.exports = {
-    PrivacyRules,
-    Authorizations,
-    Password,
-    PasswordSettings,
-    PasswordInputSettings,
-    TmpPassword,
-    WebAuthorizations,
-    AuthorizationForm,
-    SentEmailCode,
-    Takeout,
-    WallPapersNotModified,
-    WallPapers,
-    AutoDownloadSettings,
-    ThemesNotModified,
-    Themes,
-};

+ 0 - 425
src/lib/gramjs/tl/types/auth.js

@@ -1,425 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class SentCode extends TLObject {
-    static CONSTRUCTOR_ID = 0x5e002502;
-    static SUBCLASS_OF_ID = 0x6ce87081;
-
-    /**
-    Constructor for auth.SentCode: Instance of SentCode
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5e002502;
-        this.SUBCLASS_OF_ID = 0x6ce87081;
-
-        this.type = args.type;
-        this.phoneCodeHash = args.phoneCodeHash;
-        this.nextType = args.nextType || null;
-        this.timeout = args.timeout || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0225005e","hex"),
-            struct.pack('<I', (this.nextType === undefined || this.nextType === false || this.nextType === null) ? 0 : 2 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 4),
-            this.type.getBytes(),
-            TLObject.serializeBytes(this.phoneCodeHash),
-            (this.nextType === undefined || this.nextType === false || this.nextType ===null) ? Buffer.alloc(0) : [this.nextType.getBytes()],
-            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _type;
-        let _phone_code_hash;
-        let _next_type;
-        let _timeout;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _type = reader.tgReadObject();
-        _phone_code_hash = reader.tgReadString();
-        if (flags & 2) {
-            _next_type = reader.tgReadObject();
-        }
-        else {
-            _next_type = null
-        }
-        if (flags & 4) {
-            _timeout = reader.readInt();
-        }
-        else {
-            _timeout = null
-        }
-        return new this({type:_type,
-	phoneCodeHash:_phone_code_hash,
-	nextType:_next_type,
-	timeout:_timeout})
-    }
-}
-
-
-class Authorization extends TLObject {
-    static CONSTRUCTOR_ID = 0xcd050916;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    Constructor for auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xcd050916;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.tmpSessions = args.tmpSessions || null;
-        this.user = args.user;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("160905cd","hex"),
-            struct.pack('<I', (this.tmpSessions === undefined || this.tmpSessions === false || this.tmpSessions === null) ? 0 : 1),
-            (this.tmpSessions === undefined || this.tmpSessions === false || this.tmpSessions ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.tmpSessions)],
-            this.user.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _tmp_sessions;
-        let _user;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _tmp_sessions = reader.readInt();
-        }
-        else {
-            _tmp_sessions = null
-        }
-        _user = reader.tgReadObject();
-        return new this({tmpSessions:_tmp_sessions,
-	user:_user})
-    }
-}
-
-
-class AuthorizationSignUpRequired extends TLObject {
-    static CONSTRUCTOR_ID = 0x44747e9a;
-    static SUBCLASS_OF_ID = 0xb9e04e39;
-
-    /**
-    Constructor for auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x44747e9a;
-        this.SUBCLASS_OF_ID = 0xb9e04e39;
-
-        this.termsOfService = args.termsOfService || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9a7e7444","hex"),
-            struct.pack('<I', (this.termsOfService === undefined || this.termsOfService === false || this.termsOfService === null) ? 0 : 1),
-            (this.termsOfService === undefined || this.termsOfService === false || this.termsOfService ===null) ? Buffer.alloc(0) : [this.termsOfService.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _terms_of_service;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _terms_of_service = reader.tgReadObject();
-        }
-        else {
-            _terms_of_service = null
-        }
-        return new this({termsOfService:_terms_of_service})
-    }
-}
-
-
-class ExportedAuthorization extends TLObject {
-    static CONSTRUCTOR_ID = 0xdf969c2d;
-    static SUBCLASS_OF_ID = 0x5fd1ec51;
-
-    /**
-    Constructor for auth.ExportedAuthorization: Instance of ExportedAuthorization
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xdf969c2d;
-        this.SUBCLASS_OF_ID = 0x5fd1ec51;
-
-        this.id = args.id;
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("2d9c96df","hex"),
-            struct.pack('<i', this.id),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _id;
-        let _bytes;
-        let _x;
-        let len;
-        _id = reader.readInt();
-        _bytes = reader.tgReadBytes();
-        return new this({id:_id,
-	bytes:_bytes})
-    }
-}
-
-
-class PasswordRecovery extends TLObject {
-    static CONSTRUCTOR_ID = 0x137948a5;
-    static SUBCLASS_OF_ID = 0xfa72d43a;
-
-    /**
-    Constructor for auth.PasswordRecovery: Instance of PasswordRecovery
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x137948a5;
-        this.SUBCLASS_OF_ID = 0xfa72d43a;
-
-        this.emailPattern = args.emailPattern;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a5487913","hex"),
-            TLObject.serializeBytes(this.emailPattern),
-            ])
-        }
-    static fromReader(reader) {
-        let _email_pattern;
-        let _x;
-        let len;
-        _email_pattern = reader.tgReadString();
-        return new this({emailPattern:_email_pattern})
-    }
-}
-
-
-class CodeTypeSms extends TLObject {
-    static CONSTRUCTOR_ID = 0x72a3158c;
-    static SUBCLASS_OF_ID = 0xb3f3e401;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x72a3158c;
-        this.SUBCLASS_OF_ID = 0xb3f3e401;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8c15a372","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class CodeTypeCall extends TLObject {
-    static CONSTRUCTOR_ID = 0x741cd3e3;
-    static SUBCLASS_OF_ID = 0xb3f3e401;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x741cd3e3;
-        this.SUBCLASS_OF_ID = 0xb3f3e401;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e3d31c74","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class CodeTypeFlashCall extends TLObject {
-    static CONSTRUCTOR_ID = 0x226ccefb;
-    static SUBCLASS_OF_ID = 0xb3f3e401;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x226ccefb;
-        this.SUBCLASS_OF_ID = 0xb3f3e401;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fbce6c22","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SentCodeTypeApp extends TLObject {
-    static CONSTRUCTOR_ID = 0x3dbb5986;
-    static SUBCLASS_OF_ID = 0xff5b158e;
-
-    /**
-    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3dbb5986;
-        this.SUBCLASS_OF_ID = 0xff5b158e;
-
-        this.length = args.length;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8659bb3d","hex"),
-            struct.pack('<i', this.length),
-            ])
-        }
-    static fromReader(reader) {
-        let _length;
-        let _x;
-        let len;
-        _length = reader.readInt();
-        return new this({length:_length})
-    }
-}
-
-
-class SentCodeTypeSms extends TLObject {
-    static CONSTRUCTOR_ID = 0xc000bba2;
-    static SUBCLASS_OF_ID = 0xff5b158e;
-
-    /**
-    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc000bba2;
-        this.SUBCLASS_OF_ID = 0xff5b158e;
-
-        this.length = args.length;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a2bb00c0","hex"),
-            struct.pack('<i', this.length),
-            ])
-        }
-    static fromReader(reader) {
-        let _length;
-        let _x;
-        let len;
-        _length = reader.readInt();
-        return new this({length:_length})
-    }
-}
-
-
-class SentCodeTypeCall extends TLObject {
-    static CONSTRUCTOR_ID = 0x5353e5a7;
-    static SUBCLASS_OF_ID = 0xff5b158e;
-
-    /**
-    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5353e5a7;
-        this.SUBCLASS_OF_ID = 0xff5b158e;
-
-        this.length = args.length;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a7e55353","hex"),
-            struct.pack('<i', this.length),
-            ])
-        }
-    static fromReader(reader) {
-        let _length;
-        let _x;
-        let len;
-        _length = reader.readInt();
-        return new this({length:_length})
-    }
-}
-
-
-class SentCodeTypeFlashCall extends TLObject {
-    static CONSTRUCTOR_ID = 0xab03c6d9;
-    static SUBCLASS_OF_ID = 0xff5b158e;
-
-    /**
-    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xab03c6d9;
-        this.SUBCLASS_OF_ID = 0xff5b158e;
-
-        this.pattern = args.pattern;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d9c603ab","hex"),
-            TLObject.serializeBytes(this.pattern),
-            ])
-        }
-    static fromReader(reader) {
-        let _pattern;
-        let _x;
-        let len;
-        _pattern = reader.tgReadString();
-        return new this({pattern:_pattern})
-    }
-}
-
-module.exports = {
-    SentCode,
-    Authorization,
-    AuthorizationSignUpRequired,
-    ExportedAuthorization,
-    PasswordRecovery,
-    CodeTypeSms,
-    CodeTypeCall,
-    CodeTypeFlashCall,
-    SentCodeTypeApp,
-    SentCodeTypeSms,
-    SentCodeTypeCall,
-    SentCodeTypeFlashCall,
-};

+ 0 - 189
src/lib/gramjs/tl/types/channels.js

@@ -1,189 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class ChannelParticipants extends TLObject {
-    static CONSTRUCTOR_ID = 0xf56ee2a8;
-    static SUBCLASS_OF_ID = 0xe60a6e64;
-
-    /**
-    Constructor for channels.ChannelParticipants: Instance of either ChannelParticipants, ChannelParticipantsNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf56ee2a8;
-        this.SUBCLASS_OF_ID = 0xe60a6e64;
-
-        this.count = args.count;
-        this.participants = args.participants;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a8e26ef5","hex"),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.participants.length),Buffer.concat(this.participants.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _participants;
-        let _users;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        reader.readInt();
-        _participants = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _participants.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({count:_count,
-	participants:_participants,
-	users:_users})
-            }
-        }
-
-
-class ChannelParticipantsNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xf0173fe9;
-    static SUBCLASS_OF_ID = 0xe60a6e64;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xf0173fe9;
-        this.SUBCLASS_OF_ID = 0xe60a6e64;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e93f17f0","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class ChannelParticipant extends TLObject {
-    static CONSTRUCTOR_ID = 0xd0d9b163;
-    static SUBCLASS_OF_ID = 0x6658151a;
-
-    /**
-    Constructor for channels.ChannelParticipant: Instance of ChannelParticipant
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd0d9b163;
-        this.SUBCLASS_OF_ID = 0x6658151a;
-
-        this.participant = args.participant;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("63b1d9d0","hex"),
-            this.participant.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _participant;
-        let _users;
-        let _x;
-        let len;
-        _participant = reader.tgReadObject();
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            return new this({participant:_participant,
-	users:_users})
-        }
-    }
-
-
-class AdminLogResults extends TLObject {
-    static CONSTRUCTOR_ID = 0xed8af74d;
-    static SUBCLASS_OF_ID = 0x51f076bc;
-
-    /**
-    Constructor for channels.AdminLogResults: Instance of AdminLogResults
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xed8af74d;
-        this.SUBCLASS_OF_ID = 0x51f076bc;
-
-        this.events = args.events;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4df78aed","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.events.length),Buffer.concat(this.events.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _events;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _events = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _events.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({events:_events,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-module.exports = {
-    ChannelParticipants,
-    ChannelParticipantsNotModified,
-    ChannelParticipant,
-    AdminLogResults,
-};

+ 0 - 493
src/lib/gramjs/tl/types/contacts.js

@@ -1,493 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class ContactsNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xb74ba9d2;
-    static SUBCLASS_OF_ID = 0x38be25f6;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xb74ba9d2;
-        this.SUBCLASS_OF_ID = 0x38be25f6;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d2a94bb7","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class Contacts extends TLObject {
-    static CONSTRUCTOR_ID = 0xeae87e42;
-    static SUBCLASS_OF_ID = 0x38be25f6;
-
-    /**
-    Constructor for contacts.Contacts: Instance of either ContactsNotModified, Contacts
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xeae87e42;
-        this.SUBCLASS_OF_ID = 0x38be25f6;
-
-        this.contacts = args.contacts;
-        this.savedCount = args.savedCount;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("427ee8ea","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.contacts.length),Buffer.concat(this.contacts.map(x => x.getBytes())),
-            struct.pack('<i', this.savedCount),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _contacts;
-        let _saved_count;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _contacts = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _contacts.push(_x);
-            }
-            _saved_count = reader.readInt();
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({contacts:_contacts,
-	savedCount:_saved_count,
-	users:_users})
-            }
-        }
-
-
-class ImportedContacts extends TLObject {
-    static CONSTRUCTOR_ID = 0x77d01c3b;
-    static SUBCLASS_OF_ID = 0x8172ad93;
-
-    /**
-    Constructor for contacts.ImportedContacts: Instance of ImportedContacts
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x77d01c3b;
-        this.SUBCLASS_OF_ID = 0x8172ad93;
-
-        this.imported = args.imported;
-        this.popularInvites = args.popularInvites;
-        this.retryContacts = args.retryContacts;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3b1cd077","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.imported.length),Buffer.concat(this.imported.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.popularInvites.length),Buffer.concat(this.popularInvites.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.retryContacts.length),Buffer.concat(this.retryContacts.map(x => readBufferFromBigInt(x,8,true,true))),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _imported;
-        let _popular_invites;
-        let _retry_contacts;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _imported = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _imported.push(_x);
-            }
-            reader.readInt();
-            _popular_invites = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _popular_invites.push(_x);
-                }
-                reader.readInt();
-                _retry_contacts = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.readLong();
-                    _retry_contacts.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        return new this({imported:_imported,
-	popularInvites:_popular_invites,
-	retryContacts:_retry_contacts,
-	users:_users})
-                    }
-                }
-
-
-class Blocked extends TLObject {
-    static CONSTRUCTOR_ID = 0x1c138d15;
-    static SUBCLASS_OF_ID = 0xffba4f4f;
-
-    /**
-    Constructor for contacts.Blocked: Instance of either Blocked, BlockedSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1c138d15;
-        this.SUBCLASS_OF_ID = 0xffba4f4f;
-
-        this.blocked = args.blocked;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("158d131c","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.blocked.length),Buffer.concat(this.blocked.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _blocked;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _blocked = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _blocked.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({blocked:_blocked,
-	users:_users})
-            }
-        }
-
-
-class BlockedSlice extends TLObject {
-    static CONSTRUCTOR_ID = 0x900802a1;
-    static SUBCLASS_OF_ID = 0xffba4f4f;
-
-    /**
-    Constructor for contacts.Blocked: Instance of either Blocked, BlockedSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x900802a1;
-        this.SUBCLASS_OF_ID = 0xffba4f4f;
-
-        this.count = args.count;
-        this.blocked = args.blocked;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a1020890","hex"),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.blocked.length),Buffer.concat(this.blocked.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _blocked;
-        let _users;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        reader.readInt();
-        _blocked = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _blocked.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({count:_count,
-	blocked:_blocked,
-	users:_users})
-            }
-        }
-
-
-class Found extends TLObject {
-    static CONSTRUCTOR_ID = 0xb3134d9d;
-    static SUBCLASS_OF_ID = 0x4386a2e3;
-
-    /**
-    Constructor for contacts.Found: Instance of Found
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb3134d9d;
-        this.SUBCLASS_OF_ID = 0x4386a2e3;
-
-        this.myResults = args.myResults;
-        this.results = args.results;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9d4d13b3","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.myResults.length),Buffer.concat(this.myResults.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _my_results;
-        let _results;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _my_results = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _my_results.push(_x);
-            }
-            reader.readInt();
-            _results = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _results.push(_x);
-                }
-                reader.readInt();
-                _chats = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _chats.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        return new this({myResults:_my_results,
-	results:_results,
-	chats:_chats,
-	users:_users})
-                    }
-                }
-
-
-class ResolvedPeer extends TLObject {
-    static CONSTRUCTOR_ID = 0x7f077ad9;
-    static SUBCLASS_OF_ID = 0xf065b3a8;
-
-    /**
-    Constructor for contacts.ResolvedPeer: Instance of ResolvedPeer
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x7f077ad9;
-        this.SUBCLASS_OF_ID = 0xf065b3a8;
-
-        this.peer = args.peer;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d97a077f","hex"),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _peer;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _chats = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _chats.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({peer:_peer,
-	chats:_chats,
-	users:_users})
-            }
-        }
-
-
-class TopPeersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xde266ef5;
-    static SUBCLASS_OF_ID = 0x9ee8bb88;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xde266ef5;
-        this.SUBCLASS_OF_ID = 0x9ee8bb88;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f56e26de","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class TopPeers extends TLObject {
-    static CONSTRUCTOR_ID = 0x70b772a8;
-    static SUBCLASS_OF_ID = 0x9ee8bb88;
-
-    /**
-    Constructor for contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers, TopPeersDisabled
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x70b772a8;
-        this.SUBCLASS_OF_ID = 0x9ee8bb88;
-
-        this.categories = args.categories;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a872b770","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.categories.length),Buffer.concat(this.categories.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _categories;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _categories = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _categories.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({categories:_categories,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class TopPeersDisabled extends TLObject {
-    static CONSTRUCTOR_ID = 0xb52c939d;
-    static SUBCLASS_OF_ID = 0x9ee8bb88;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xb52c939d;
-        this.SUBCLASS_OF_ID = 0x9ee8bb88;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9d932cb5","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-module.exports = {
-    ContactsNotModified,
-    Contacts,
-    ImportedContacts,
-    Blocked,
-    BlockedSlice,
-    Found,
-    ResolvedPeer,
-    TopPeersNotModified,
-    TopPeers,
-    TopPeersDisabled,
-};

+ 0 - 765
src/lib/gramjs/tl/types/help.js

@@ -1,765 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class AppUpdate extends TLObject {
-    static CONSTRUCTOR_ID = 0x1da7158f;
-    static SUBCLASS_OF_ID = 0x5897069e;
-
-    /**
-    Constructor for help.AppUpdate: Instance of either AppUpdate, NoAppUpdate
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x1da7158f;
-        this.SUBCLASS_OF_ID = 0x5897069e;
-
-        this.canNotSkip = args.canNotSkip || null;
-        this.id = args.id;
-        this.version = args.version;
-        this.text = args.text;
-        this.entities = args.entities;
-        this.document = args.document || null;
-        this.url = args.url || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8f15a71d","hex"),
-            struct.pack('<I', (this.canNotSkip === undefined || this.canNotSkip === false || this.canNotSkip === null) ? 0 : 1 | (this.document === undefined || this.document === false || this.document === null) ? 0 : 2 | (this.url === undefined || this.url === false || this.url === null) ? 0 : 4),
-            struct.pack('<i', this.id),
-            TLObject.serializeBytes(this.version),
-            TLObject.serializeBytes(this.text),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
-            (this.document === undefined || this.document === false || this.document ===null) ? Buffer.alloc(0) : [this.document.getBytes()],
-            (this.url === undefined || this.url === false || this.url ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.url)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _can_not_skip;
-        let _id;
-        let _version;
-        let _text;
-        let _entities;
-        let _document;
-        let _url;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _can_not_skip = Boolean(flags & 1);
-        _id = reader.readInt();
-        _version = reader.tgReadString();
-        _text = reader.tgReadString();
-        reader.readInt();
-        _entities = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _entities.push(_x);
-            }
-            if (flags & 2) {
-                _document = reader.tgReadObject();
-            }
-            else {
-                _document = null
-            }
-            if (flags & 4) {
-                _url = reader.tgReadString();
-            }
-            else {
-                _url = null
-            }
-            return new this({canNotSkip:_can_not_skip,
-	id:_id,
-	version:_version,
-	text:_text,
-	entities:_entities,
-	document:_document,
-	url:_url})
-        }
-    }
-
-
-class NoAppUpdate extends TLObject {
-    static CONSTRUCTOR_ID = 0xc45a6536;
-    static SUBCLASS_OF_ID = 0x5897069e;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xc45a6536;
-        this.SUBCLASS_OF_ID = 0x5897069e;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("36655ac4","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class InviteText extends TLObject {
-    static CONSTRUCTOR_ID = 0x18cb9f78;
-    static SUBCLASS_OF_ID = 0xcf70aa35;
-
-    /**
-    Constructor for help.InviteText: Instance of InviteText
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x18cb9f78;
-        this.SUBCLASS_OF_ID = 0xcf70aa35;
-
-        this.message = args.message;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("789fcb18","hex"),
-            TLObject.serializeBytes(this.message),
-            ])
-        }
-    static fromReader(reader) {
-        let _message;
-        let _x;
-        let len;
-        _message = reader.tgReadString();
-        return new this({message:_message})
-    }
-}
-
-
-class Support extends TLObject {
-    static CONSTRUCTOR_ID = 0x17c6b5f6;
-    static SUBCLASS_OF_ID = 0x7159bceb;
-
-    /**
-    Constructor for help.Support: Instance of Support
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x17c6b5f6;
-        this.SUBCLASS_OF_ID = 0x7159bceb;
-
-        this.phoneNumber = args.phoneNumber;
-        this.user = args.user;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f6b5c617","hex"),
-            TLObject.serializeBytes(this.phoneNumber),
-            this.user.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_number;
-        let _user;
-        let _x;
-        let len;
-        _phone_number = reader.tgReadString();
-        _user = reader.tgReadObject();
-        return new this({phoneNumber:_phone_number,
-	user:_user})
-    }
-}
-
-
-class TermsOfService extends TLObject {
-    static CONSTRUCTOR_ID = 0x780a0310;
-    static SUBCLASS_OF_ID = 0x20ee8312;
-
-    /**
-    Constructor for help.TermsOfService: Instance of TermsOfService
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x780a0310;
-        this.SUBCLASS_OF_ID = 0x20ee8312;
-
-        this.popup = args.popup || null;
-        this.id = args.id;
-        this.text = args.text;
-        this.entities = args.entities;
-        this.minAgeConfirm = args.minAgeConfirm || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("10030a78","hex"),
-            struct.pack('<I', (this.popup === undefined || this.popup === false || this.popup === null) ? 0 : 1 | (this.minAgeConfirm === undefined || this.minAgeConfirm === false || this.minAgeConfirm === null) ? 0 : 2),
-            this.id.getBytes(),
-            TLObject.serializeBytes(this.text),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
-            (this.minAgeConfirm === undefined || this.minAgeConfirm === false || this.minAgeConfirm ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.minAgeConfirm)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _popup;
-        let _id;
-        let _text;
-        let _entities;
-        let _min_age_confirm;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _popup = Boolean(flags & 1);
-        _id = reader.tgReadObject();
-        _text = reader.tgReadString();
-        reader.readInt();
-        _entities = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _entities.push(_x);
-            }
-            if (flags & 2) {
-                _min_age_confirm = reader.readInt();
-            }
-            else {
-                _min_age_confirm = null
-            }
-            return new this({popup:_popup,
-	id:_id,
-	text:_text,
-	entities:_entities,
-	minAgeConfirm:_min_age_confirm})
-        }
-    }
-
-
-class RecentMeUrls extends TLObject {
-    static CONSTRUCTOR_ID = 0x0e0310d7;
-    static SUBCLASS_OF_ID = 0xf269c477;
-
-    /**
-    Constructor for help.RecentMeUrls: Instance of RecentMeUrls
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x0e0310d7;
-        this.SUBCLASS_OF_ID = 0xf269c477;
-
-        this.urls = args.urls;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d710030e","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.urls.length),Buffer.concat(this.urls.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _urls;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _urls = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _urls.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({urls:_urls,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class ProxyDataEmpty extends TLObject {
-    static CONSTRUCTOR_ID = 0xe09e1fb8;
-    static SUBCLASS_OF_ID = 0x21e2a448;
-
-    /**
-    Constructor for help.ProxyData: Instance of either ProxyDataEmpty, ProxyDataPromo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe09e1fb8;
-        this.SUBCLASS_OF_ID = 0x21e2a448;
-
-        this.expires = args.expires;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b81f9ee0","hex"),
-            struct.pack('<i', this.expires),
-            ])
-        }
-    static fromReader(reader) {
-        let _expires;
-        let _x;
-        let len;
-        _expires = reader.readInt();
-        return new this({expires:_expires})
-    }
-}
-
-
-class ProxyDataPromo extends TLObject {
-    static CONSTRUCTOR_ID = 0x2bf7ee23;
-    static SUBCLASS_OF_ID = 0x21e2a448;
-
-    /**
-    Constructor for help.ProxyData: Instance of either ProxyDataEmpty, ProxyDataPromo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2bf7ee23;
-        this.SUBCLASS_OF_ID = 0x21e2a448;
-
-        this.expires = args.expires;
-        this.peer = args.peer;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("23eef72b","hex"),
-            struct.pack('<i', this.expires),
-            this.peer.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _expires;
-        let _peer;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        _expires = reader.readInt();
-        _peer = reader.tgReadObject();
-        reader.readInt();
-        _chats = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _chats.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({expires:_expires,
-	peer:_peer,
-	chats:_chats,
-	users:_users})
-            }
-        }
-
-
-class TermsOfServiceUpdateEmpty extends TLObject {
-    static CONSTRUCTOR_ID = 0xe3309f7f;
-    static SUBCLASS_OF_ID = 0x293c2977;
-
-    /**
-    Constructor for help.TermsOfServiceUpdate: Instance of either TermsOfServiceUpdateEmpty, TermsOfServiceUpdate
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe3309f7f;
-        this.SUBCLASS_OF_ID = 0x293c2977;
-
-        this.expires = args.expires;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("7f9f30e3","hex"),
-            struct.pack('<i', this.expires),
-            ])
-        }
-    static fromReader(reader) {
-        let _expires;
-        let _x;
-        let len;
-        _expires = reader.readInt();
-        return new this({expires:_expires})
-    }
-}
-
-
-class TermsOfServiceUpdate extends TLObject {
-    static CONSTRUCTOR_ID = 0x28ecf961;
-    static SUBCLASS_OF_ID = 0x293c2977;
-
-    /**
-    Constructor for help.TermsOfServiceUpdate: Instance of either TermsOfServiceUpdateEmpty, TermsOfServiceUpdate
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x28ecf961;
-        this.SUBCLASS_OF_ID = 0x293c2977;
-
-        this.expires = args.expires;
-        this.termsOfService = args.termsOfService;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("61f9ec28","hex"),
-            struct.pack('<i', this.expires),
-            this.termsOfService.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _expires;
-        let _terms_of_service;
-        let _x;
-        let len;
-        _expires = reader.readInt();
-        _terms_of_service = reader.tgReadObject();
-        return new this({expires:_expires,
-	termsOfService:_terms_of_service})
-    }
-}
-
-
-class DeepLinkInfoEmpty extends TLObject {
-    static CONSTRUCTOR_ID = 0x66afa166;
-    static SUBCLASS_OF_ID = 0x984aac38;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x66afa166;
-        this.SUBCLASS_OF_ID = 0x984aac38;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("66a1af66","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class DeepLinkInfo extends TLObject {
-    static CONSTRUCTOR_ID = 0x6a4ee832;
-    static SUBCLASS_OF_ID = 0x984aac38;
-
-    /**
-    Constructor for help.DeepLinkInfo: Instance of either DeepLinkInfoEmpty, DeepLinkInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x6a4ee832;
-        this.SUBCLASS_OF_ID = 0x984aac38;
-
-        this.updateApp = args.updateApp || null;
-        this.message = args.message;
-        this.entities = args.entities || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("32e84e6a","hex"),
-            struct.pack('<I', (this.updateApp === undefined || this.updateApp === false || this.updateApp === null) ? 0 : 1 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 2),
-            TLObject.serializeBytes(this.message),
-            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _update_app;
-        let _message;
-        let _entities;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _update_app = Boolean(flags & 1);
-        _message = reader.tgReadString();
-        if (flags & 2) {
-            reader.readInt();
-            _entities = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _entities.push(_x);
-                }
-            }
-            else {
-                _entities = null
-            }
-            return new this({updateApp:_update_app,
-	message:_message,
-	entities:_entities})
-        }
-    }
-
-
-class PassportConfigNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xbfb9f457;
-    static SUBCLASS_OF_ID = 0xc666c0ad;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xbfb9f457;
-        this.SUBCLASS_OF_ID = 0xc666c0ad;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("57f4b9bf","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class PassportConfig extends TLObject {
-    static CONSTRUCTOR_ID = 0xa098d6af;
-    static SUBCLASS_OF_ID = 0xc666c0ad;
-
-    /**
-    Constructor for help.PassportConfig: Instance of either PassportConfigNotModified, PassportConfig
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa098d6af;
-        this.SUBCLASS_OF_ID = 0xc666c0ad;
-
-        this.hash = args.hash;
-        this.countriesLangs = args.countriesLangs;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("afd698a0","hex"),
-            struct.pack('<i', this.hash),
-            this.countriesLangs.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _countries_langs;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        _countries_langs = reader.tgReadObject();
-        return new this({hash:_hash,
-	countriesLangs:_countries_langs})
-    }
-}
-
-
-class SupportName extends TLObject {
-    static CONSTRUCTOR_ID = 0x8c05f1c9;
-    static SUBCLASS_OF_ID = 0x7f50b7c2;
-
-    /**
-    Constructor for help.SupportName: Instance of SupportName
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8c05f1c9;
-        this.SUBCLASS_OF_ID = 0x7f50b7c2;
-
-        this.name = args.name;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c9f1058c","hex"),
-            TLObject.serializeBytes(this.name),
-            ])
-        }
-    static fromReader(reader) {
-        let _name;
-        let _x;
-        let len;
-        _name = reader.tgReadString();
-        return new this({name:_name})
-    }
-}
-
-
-class UserInfoEmpty extends TLObject {
-    static CONSTRUCTOR_ID = 0xf3ae2eed;
-    static SUBCLASS_OF_ID = 0x5c53d7d8;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xf3ae2eed;
-        this.SUBCLASS_OF_ID = 0x5c53d7d8;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ed2eaef3","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class UserInfo extends TLObject {
-    static CONSTRUCTOR_ID = 0x01eb3758;
-    static SUBCLASS_OF_ID = 0x5c53d7d8;
-
-    /**
-    Constructor for help.UserInfo: Instance of either UserInfoEmpty, UserInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x01eb3758;
-        this.SUBCLASS_OF_ID = 0x5c53d7d8;
-
-        this.message = args.message;
-        this.entities = args.entities;
-        this.author = args.author;
-        this.date = args.date;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5837eb01","hex"),
-            TLObject.serializeBytes(this.message),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
-            TLObject.serializeBytes(this.author),
-            struct.pack('<i', this.date),
-            ])
-        }
-    static fromReader(reader) {
-        let _message;
-        let _entities;
-        let _author;
-        let _date;
-        let _x;
-        let len;
-        _message = reader.tgReadString();
-        reader.readInt();
-        _entities = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _entities.push(_x);
-            }
-            _author = reader.tgReadString();
-            _date = reader.readInt();
-            return new this({message:_message,
-	entities:_entities,
-	author:_author,
-	date:_date})
-        }
-    }
-
-
-class ConfigSimple extends TLObject {
-    static CONSTRUCTOR_ID = 0x5a592a6c;
-    static SUBCLASS_OF_ID = 0x29183ac4;
-
-    /**
-    Constructor for help.ConfigSimple: Instance of ConfigSimple
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5a592a6c;
-        this.SUBCLASS_OF_ID = 0x29183ac4;
-
-        this.date = args.date;
-        this.expires = args.expires;
-        this.rules = args.rules;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6c2a595a","hex"),
-            struct.pack('<i', this.date),
-            struct.pack('<i', this.expires),
-            struct.pack('<i', this.rules.length),Buffer.concat(this.rules.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _date;
-        let _expires;
-        let _rules;
-        let _x;
-        let len;
-        _date = reader.readInt();
-        _expires = reader.readInt();
-        _rules = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _rules.push(_x);
-            }
-            return new this({date:_date,
-	expires:_expires,
-	rules:_rules})
-        }
-    }
-
-module.exports = {
-    AppUpdate,
-    NoAppUpdate,
-    InviteText,
-    Support,
-    TermsOfService,
-    RecentMeUrls,
-    ProxyDataEmpty,
-    ProxyDataPromo,
-    TermsOfServiceUpdateEmpty,
-    TermsOfServiceUpdate,
-    DeepLinkInfoEmpty,
-    DeepLinkInfo,
-    PassportConfigNotModified,
-    PassportConfig,
-    SupportName,
-    UserInfoEmpty,
-    UserInfo,
-    ConfigSimple,
-};

File diff ditekan karena terlalu besar
+ 0 - 1905
src/lib/gramjs/tl/types/index.js


+ 0 - 1877
src/lib/gramjs/tl/types/messages.js

@@ -1,1877 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class Dialogs extends TLObject {
-    static CONSTRUCTOR_ID = 0x15ba6c40;
-    static SUBCLASS_OF_ID = 0xe1b52ee;
-
-    /**
-    Constructor for messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x15ba6c40;
-        this.SUBCLASS_OF_ID = 0xe1b52ee;
-
-        this.dialogs = args.dialogs;
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("406cba15","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dialogs.length),Buffer.concat(this.dialogs.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _dialogs;
-        let _messages;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _dialogs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _dialogs.push(_x);
-            }
-            reader.readInt();
-            _messages = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _messages.push(_x);
-                }
-                reader.readInt();
-                _chats = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _chats.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        return new this({dialogs:_dialogs,
-	messages:_messages,
-	chats:_chats,
-	users:_users})
-                    }
-                }
-
-
-class DialogsSlice extends TLObject {
-    static CONSTRUCTOR_ID = 0x71e094f3;
-    static SUBCLASS_OF_ID = 0xe1b52ee;
-
-    /**
-    Constructor for messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x71e094f3;
-        this.SUBCLASS_OF_ID = 0xe1b52ee;
-
-        this.count = args.count;
-        this.dialogs = args.dialogs;
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("f394e071","hex"),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dialogs.length),Buffer.concat(this.dialogs.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _dialogs;
-        let _messages;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        reader.readInt();
-        _dialogs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _dialogs.push(_x);
-            }
-            reader.readInt();
-            _messages = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _messages.push(_x);
-                }
-                reader.readInt();
-                _chats = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _chats.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        return new this({count:_count,
-	dialogs:_dialogs,
-	messages:_messages,
-	chats:_chats,
-	users:_users})
-                    }
-                }
-
-
-class DialogsNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xf0e3e596;
-    static SUBCLASS_OF_ID = 0xe1b52ee;
-
-    /**
-    Constructor for messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf0e3e596;
-        this.SUBCLASS_OF_ID = 0xe1b52ee;
-
-        this.count = args.count;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("96e5e3f0","hex"),
-            struct.pack('<i', this.count),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        return new this({count:_count})
-    }
-}
-
-
-class Messages extends TLObject {
-    static CONSTRUCTOR_ID = 0x8c718e87;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8c718e87;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("878e718c","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _messages;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _messages.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({messages:_messages,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class MessagesSlice extends TLObject {
-    static CONSTRUCTOR_ID = 0xc8edce1e;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc8edce1e;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.inexact = args.inexact || null;
-        this.count = args.count;
-        this.nextRate = args.nextRate || null;
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("1eceedc8","hex"),
-            struct.pack('<I', (this.inexact === undefined || this.inexact === false || this.inexact === null) ? 0 : 2 | (this.nextRate === undefined || this.nextRate === false || this.nextRate === null) ? 0 : 1),
-            struct.pack('<i', this.count),
-            (this.nextRate === undefined || this.nextRate === false || this.nextRate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.nextRate)],
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _inexact;
-        let _count;
-        let _next_rate;
-        let _messages;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _inexact = Boolean(flags & 2);
-        _count = reader.readInt();
-        if (flags & 1) {
-            _next_rate = reader.readInt();
-        }
-        else {
-            _next_rate = null
-        }
-        reader.readInt();
-        _messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _messages.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({inexact:_inexact,
-	count:_count,
-	nextRate:_next_rate,
-	messages:_messages,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class ChannelMessages extends TLObject {
-    static CONSTRUCTOR_ID = 0x99262e37;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x99262e37;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.inexact = args.inexact || null;
-        this.pts = args.pts;
-        this.count = args.count;
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("372e2699","hex"),
-            struct.pack('<I', (this.inexact === undefined || this.inexact === false || this.inexact === null) ? 0 : 2),
-            struct.pack('<i', this.pts),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _inexact;
-        let _pts;
-        let _count;
-        let _messages;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _inexact = Boolean(flags & 2);
-        _pts = reader.readInt();
-        _count = reader.readInt();
-        reader.readInt();
-        _messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _messages.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({inexact:_inexact,
-	pts:_pts,
-	count:_count,
-	messages:_messages,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class MessagesNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0x74535f21;
-    static SUBCLASS_OF_ID = 0xd4b40b5e;
-
-    /**
-    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x74535f21;
-        this.SUBCLASS_OF_ID = 0xd4b40b5e;
-
-        this.count = args.count;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("215f5374","hex"),
-            struct.pack('<i', this.count),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        return new this({count:_count})
-    }
-}
-
-
-class Chats extends TLObject {
-    static CONSTRUCTOR_ID = 0x64ff9fd5;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    Constructor for messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x64ff9fd5;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.chats = args.chats;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d59fff64","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _chats;
-        let _x;
-        let len;
-        reader.readInt();
-        _chats = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _chats.push(_x);
-            }
-            return new this({chats:_chats})
-        }
-    }
-
-
-class ChatsSlice extends TLObject {
-    static CONSTRUCTOR_ID = 0x9cd81144;
-    static SUBCLASS_OF_ID = 0x99d5cb14;
-
-    /**
-    Constructor for messages.Chats: Instance of either Chats, ChatsSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9cd81144;
-        this.SUBCLASS_OF_ID = 0x99d5cb14;
-
-        this.count = args.count;
-        this.chats = args.chats;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4411d89c","hex"),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _chats;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        reader.readInt();
-        _chats = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _chats.push(_x);
-            }
-            return new this({count:_count,
-	chats:_chats})
-        }
-    }
-
-
-class ChatFull extends TLObject {
-    static CONSTRUCTOR_ID = 0xe5d7d19c;
-    static SUBCLASS_OF_ID = 0x225a5109;
-
-    /**
-    Constructor for messages.ChatFull: Instance of ChatFull
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe5d7d19c;
-        this.SUBCLASS_OF_ID = 0x225a5109;
-
-        this.fullChat = args.fullChat;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("9cd1d7e5","hex"),
-            this.fullChat.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _full_chat;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        _full_chat = reader.tgReadObject();
-        reader.readInt();
-        _chats = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _chats.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({fullChat:_full_chat,
-	chats:_chats,
-	users:_users})
-            }
-        }
-
-
-class AffectedHistory extends TLObject {
-    static CONSTRUCTOR_ID = 0xb45c69d1;
-    static SUBCLASS_OF_ID = 0x2c49c116;
-
-    /**
-    Constructor for messages.AffectedHistory: Instance of AffectedHistory
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb45c69d1;
-        this.SUBCLASS_OF_ID = 0x2c49c116;
-
-        this.pts = args.pts;
-        this.ptsCount = args.ptsCount;
-        this.offset = args.offset;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d1695cb4","hex"),
-            struct.pack('<i', this.pts),
-            struct.pack('<i', this.ptsCount),
-            struct.pack('<i', this.offset),
-            ])
-        }
-    static fromReader(reader) {
-        let _pts;
-        let _pts_count;
-        let _offset;
-        let _x;
-        let len;
-        _pts = reader.readInt();
-        _pts_count = reader.readInt();
-        _offset = reader.readInt();
-        return new this({pts:_pts,
-	ptsCount:_pts_count,
-	offset:_offset})
-    }
-}
-
-
-class DhConfigNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xc0e24635;
-    static SUBCLASS_OF_ID = 0xe488ed8b;
-
-    /**
-    Constructor for messages.DhConfig: Instance of either DhConfigNotModified, DhConfig
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xc0e24635;
-        this.SUBCLASS_OF_ID = 0xe488ed8b;
-
-        this.random = args.random;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3546e2c0","hex"),
-            TLObject.serializeBytes(this.random),
-            ])
-        }
-    static fromReader(reader) {
-        let _random;
-        let _x;
-        let len;
-        _random = reader.tgReadBytes();
-        return new this({random:_random})
-    }
-}
-
-
-class DhConfig extends TLObject {
-    static CONSTRUCTOR_ID = 0x2c221edd;
-    static SUBCLASS_OF_ID = 0xe488ed8b;
-
-    /**
-    Constructor for messages.DhConfig: Instance of either DhConfigNotModified, DhConfig
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2c221edd;
-        this.SUBCLASS_OF_ID = 0xe488ed8b;
-
-        this.g = args.g;
-        this.p = args.p;
-        this.version = args.version;
-        this.random = args.random;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("dd1e222c","hex"),
-            struct.pack('<i', this.g),
-            TLObject.serializeBytes(this.p),
-            struct.pack('<i', this.version),
-            TLObject.serializeBytes(this.random),
-            ])
-        }
-    static fromReader(reader) {
-        let _g;
-        let _p;
-        let _version;
-        let _random;
-        let _x;
-        let len;
-        _g = reader.readInt();
-        _p = reader.tgReadBytes();
-        _version = reader.readInt();
-        _random = reader.tgReadBytes();
-        return new this({g:_g,
-	p:_p,
-	version:_version,
-	random:_random})
-    }
-}
-
-
-class SentEncryptedMessage extends TLObject {
-    static CONSTRUCTOR_ID = 0x560f8935;
-    static SUBCLASS_OF_ID = 0xc99e3e50;
-
-    /**
-    Constructor for messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x560f8935;
-        this.SUBCLASS_OF_ID = 0xc99e3e50;
-
-        this.date = args.date;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("35890f56","hex"),
-            struct.pack('<i', this.date),
-            ])
-        }
-    static fromReader(reader) {
-        let _date;
-        let _x;
-        let len;
-        _date = reader.readInt();
-        return new this({date:_date})
-    }
-}
-
-
-class SentEncryptedFile extends TLObject {
-    static CONSTRUCTOR_ID = 0x9493ff32;
-    static SUBCLASS_OF_ID = 0xc99e3e50;
-
-    /**
-    Constructor for messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9493ff32;
-        this.SUBCLASS_OF_ID = 0xc99e3e50;
-
-        this.date = args.date;
-        this.file = args.file;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("32ff9394","hex"),
-            struct.pack('<i', this.date),
-            this.file.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _date;
-        let _file;
-        let _x;
-        let len;
-        _date = reader.readInt();
-        _file = reader.tgReadObject();
-        return new this({date:_date,
-	file:_file})
-    }
-}
-
-
-class StickersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xf1749a22;
-    static SUBCLASS_OF_ID = 0xd73bb9de;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xf1749a22;
-        this.SUBCLASS_OF_ID = 0xd73bb9de;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("229a74f1","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class Stickers extends TLObject {
-    static CONSTRUCTOR_ID = 0xe4599bbd;
-    static SUBCLASS_OF_ID = 0xd73bb9de;
-
-    /**
-    Constructor for messages.Stickers: Instance of either StickersNotModified, Stickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe4599bbd;
-        this.SUBCLASS_OF_ID = 0xd73bb9de;
-
-        this.hash = args.hash;
-        this.stickers = args.stickers;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bd9b59e4","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _stickers;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _stickers = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _stickers.push(_x);
-            }
-            return new this({hash:_hash,
-	stickers:_stickers})
-        }
-    }
-
-
-class AllStickersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xe86602c3;
-    static SUBCLASS_OF_ID = 0x45834829;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xe86602c3;
-        this.SUBCLASS_OF_ID = 0x45834829;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c30266e8","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class AllStickers extends TLObject {
-    static CONSTRUCTOR_ID = 0xedfd405f;
-    static SUBCLASS_OF_ID = 0x45834829;
-
-    /**
-    Constructor for messages.AllStickers: Instance of either AllStickersNotModified, AllStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xedfd405f;
-        this.SUBCLASS_OF_ID = 0x45834829;
-
-        this.hash = args.hash;
-        this.sets = args.sets;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5f40fded","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _sets;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _sets = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _sets.push(_x);
-            }
-            return new this({hash:_hash,
-	sets:_sets})
-        }
-    }
-
-
-class AffectedMessages extends TLObject {
-    static CONSTRUCTOR_ID = 0x84d19185;
-    static SUBCLASS_OF_ID = 0xced3c06e;
-
-    /**
-    Constructor for messages.AffectedMessages: Instance of AffectedMessages
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x84d19185;
-        this.SUBCLASS_OF_ID = 0xced3c06e;
-
-        this.pts = args.pts;
-        this.ptsCount = args.ptsCount;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8591d184","hex"),
-            struct.pack('<i', this.pts),
-            struct.pack('<i', this.ptsCount),
-            ])
-        }
-    static fromReader(reader) {
-        let _pts;
-        let _pts_count;
-        let _x;
-        let len;
-        _pts = reader.readInt();
-        _pts_count = reader.readInt();
-        return new this({pts:_pts,
-	ptsCount:_pts_count})
-    }
-}
-
-
-class StickerSet extends TLObject {
-    static CONSTRUCTOR_ID = 0xb60a24a6;
-    static SUBCLASS_OF_ID = 0x9b704a5a;
-
-    /**
-    Constructor for messages.StickerSet: Instance of StickerSet
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xb60a24a6;
-        this.SUBCLASS_OF_ID = 0x9b704a5a;
-
-        this.set = args.set;
-        this.packs = args.packs;
-        this.documents = args.documents;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a6240ab6","hex"),
-            this.set.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.packs.length),Buffer.concat(this.packs.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.documents.length),Buffer.concat(this.documents.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _set;
-        let _packs;
-        let _documents;
-        let _x;
-        let len;
-        _set = reader.tgReadObject();
-        reader.readInt();
-        _packs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _packs.push(_x);
-            }
-            reader.readInt();
-            _documents = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _documents.push(_x);
-                }
-                return new this({set:_set,
-	packs:_packs,
-	documents:_documents})
-            }
-        }
-
-
-class FoundGifs extends TLObject {
-    static CONSTRUCTOR_ID = 0x450a1c0a;
-    static SUBCLASS_OF_ID = 0xe799ea7;
-
-    /**
-    Constructor for messages.FoundGifs: Instance of FoundGifs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x450a1c0a;
-        this.SUBCLASS_OF_ID = 0xe799ea7;
-
-        this.nextOffset = args.nextOffset;
-        this.results = args.results;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0a1c0a45","hex"),
-            struct.pack('<i', this.nextOffset),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _next_offset;
-        let _results;
-        let _x;
-        let len;
-        _next_offset = reader.readInt();
-        reader.readInt();
-        _results = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _results.push(_x);
-            }
-            return new this({nextOffset:_next_offset,
-	results:_results})
-        }
-    }
-
-
-class SavedGifsNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0xe8025ca2;
-    static SUBCLASS_OF_ID = 0xa68b61f5;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xe8025ca2;
-        this.SUBCLASS_OF_ID = 0xa68b61f5;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a25c02e8","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class SavedGifs extends TLObject {
-    static CONSTRUCTOR_ID = 0x2e0709a5;
-    static SUBCLASS_OF_ID = 0xa68b61f5;
-
-    /**
-    Constructor for messages.SavedGifs: Instance of either SavedGifsNotModified, SavedGifs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2e0709a5;
-        this.SUBCLASS_OF_ID = 0xa68b61f5;
-
-        this.hash = args.hash;
-        this.gifs = args.gifs;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a509072e","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.gifs.length),Buffer.concat(this.gifs.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _gifs;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _gifs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _gifs.push(_x);
-            }
-            return new this({hash:_hash,
-	gifs:_gifs})
-        }
-    }
-
-
-class BotResults extends TLObject {
-    static CONSTRUCTOR_ID = 0x947ca848;
-    static SUBCLASS_OF_ID = 0x3ed4d9c9;
-
-    /**
-    Constructor for messages.BotResults: Instance of BotResults
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x947ca848;
-        this.SUBCLASS_OF_ID = 0x3ed4d9c9;
-
-        this.gallery = args.gallery || null;
-        this.queryId = args.queryId;
-        this.nextOffset = args.nextOffset || null;
-        this.switchPm = args.switchPm || null;
-        this.results = args.results;
-        this.cacheTime = args.cacheTime;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("48a87c94","hex"),
-            struct.pack('<I', (this.gallery === undefined || this.gallery === false || this.gallery === null) ? 0 : 1 | (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset === null) ? 0 : 2 | (this.switchPm === undefined || this.switchPm === false || this.switchPm === null) ? 0 : 4),
-            readBufferFromBigInt(this.queryId,8,true,true),
-            (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.nextOffset)],
-            (this.switchPm === undefined || this.switchPm === false || this.switchPm ===null) ? Buffer.alloc(0) : [this.switchPm.getBytes()],
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
-            struct.pack('<i', this.cacheTime),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _gallery;
-        let _query_id;
-        let _next_offset;
-        let _switch_pm;
-        let _results;
-        let _cache_time;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _gallery = Boolean(flags & 1);
-        _query_id = reader.readLong();
-        if (flags & 2) {
-            _next_offset = reader.tgReadString();
-        }
-        else {
-            _next_offset = null
-        }
-        if (flags & 4) {
-            _switch_pm = reader.tgReadObject();
-        }
-        else {
-            _switch_pm = null
-        }
-        reader.readInt();
-        _results = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _results.push(_x);
-            }
-            _cache_time = reader.readInt();
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({gallery:_gallery,
-	queryId:_query_id,
-	nextOffset:_next_offset,
-	switchPm:_switch_pm,
-	results:_results,
-	cacheTime:_cache_time,
-	users:_users})
-            }
-        }
-
-
-class BotCallbackAnswer extends TLObject {
-    static CONSTRUCTOR_ID = 0x36585ea4;
-    static SUBCLASS_OF_ID = 0x6c4dd18c;
-
-    /**
-    Constructor for messages.BotCallbackAnswer: Instance of BotCallbackAnswer
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x36585ea4;
-        this.SUBCLASS_OF_ID = 0x6c4dd18c;
-
-        this.alert = args.alert || null;
-        this.hasUrl = args.hasUrl || null;
-        this.nativeUi = args.nativeUi || null;
-        this.message = args.message || null;
-        this.url = args.url || null;
-        this.cacheTime = args.cacheTime;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a45e5836","hex"),
-            struct.pack('<I', (this.alert === undefined || this.alert === false || this.alert === null) ? 0 : 2 | (this.hasUrl === undefined || this.hasUrl === false || this.hasUrl === null) ? 0 : 8 | (this.nativeUi === undefined || this.nativeUi === false || this.nativeUi === null) ? 0 : 16 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 1 | (this.url === undefined || this.url === false || this.url === null) ? 0 : 4),
-            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
-            (this.url === undefined || this.url === false || this.url ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.url)],
-            struct.pack('<i', this.cacheTime),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _alert;
-        let _has_url;
-        let _native_ui;
-        let _message;
-        let _url;
-        let _cache_time;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _alert = Boolean(flags & 2);
-        _has_url = Boolean(flags & 8);
-        _native_ui = Boolean(flags & 16);
-        if (flags & 1) {
-            _message = reader.tgReadString();
-        }
-        else {
-            _message = null
-        }
-        if (flags & 4) {
-            _url = reader.tgReadString();
-        }
-        else {
-            _url = null
-        }
-        _cache_time = reader.readInt();
-        return new this({alert:_alert,
-	hasUrl:_has_url,
-	nativeUi:_native_ui,
-	message:_message,
-	url:_url,
-	cacheTime:_cache_time})
-    }
-}
-
-
-class MessageEditData extends TLObject {
-    static CONSTRUCTOR_ID = 0x26b5dde6;
-    static SUBCLASS_OF_ID = 0xfb47949d;
-
-    /**
-    Constructor for messages.MessageEditData: Instance of MessageEditData
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x26b5dde6;
-        this.SUBCLASS_OF_ID = 0xfb47949d;
-
-        this.caption = args.caption || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e6ddb526","hex"),
-            struct.pack('<I', (this.caption === undefined || this.caption === false || this.caption === null) ? 0 : 1),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _caption;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _caption = Boolean(flags & 1);
-        return new this({caption:_caption})
-    }
-}
-
-
-class PeerDialogs extends TLObject {
-    static CONSTRUCTOR_ID = 0x3371c354;
-    static SUBCLASS_OF_ID = 0x3ac70132;
-
-    /**
-    Constructor for messages.PeerDialogs: Instance of PeerDialogs
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3371c354;
-        this.SUBCLASS_OF_ID = 0x3ac70132;
-
-        this.dialogs = args.dialogs;
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-        this.state = args.state;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("54c37133","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dialogs.length),Buffer.concat(this.dialogs.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            this.state.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _dialogs;
-        let _messages;
-        let _chats;
-        let _users;
-        let _state;
-        let _x;
-        let len;
-        reader.readInt();
-        _dialogs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _dialogs.push(_x);
-            }
-            reader.readInt();
-            _messages = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _messages.push(_x);
-                }
-                reader.readInt();
-                _chats = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _chats.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        _state = reader.tgReadObject();
-                        return new this({dialogs:_dialogs,
-	messages:_messages,
-	chats:_chats,
-	users:_users,
-	state:_state})
-                    }
-                }
-
-
-class FeaturedStickersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0x04ede3cf;
-    static SUBCLASS_OF_ID = 0x2614b722;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x04ede3cf;
-        this.SUBCLASS_OF_ID = 0x2614b722;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("cfe3ed04","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FeaturedStickers extends TLObject {
-    static CONSTRUCTOR_ID = 0xf89d88e5;
-    static SUBCLASS_OF_ID = 0x2614b722;
-
-    /**
-    Constructor for messages.FeaturedStickers: Instance of either FeaturedStickersNotModified, FeaturedStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf89d88e5;
-        this.SUBCLASS_OF_ID = 0x2614b722;
-
-        this.hash = args.hash;
-        this.sets = args.sets;
-        this.unread = args.unread;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e5889df8","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.unread.length),Buffer.concat(this.unread.map(x => readBufferFromBigInt(x,8,true,true))),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _sets;
-        let _unread;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _sets = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _sets.push(_x);
-            }
-            reader.readInt();
-            _unread = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.readLong();
-                _unread.push(_x);
-                }
-                return new this({hash:_hash,
-	sets:_sets,
-	unread:_unread})
-            }
-        }
-
-
-class RecentStickersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0x0b17f890;
-    static SUBCLASS_OF_ID = 0xf76f8683;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x0b17f890;
-        this.SUBCLASS_OF_ID = 0xf76f8683;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("90f8170b","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class RecentStickers extends TLObject {
-    static CONSTRUCTOR_ID = 0x22f3afb3;
-    static SUBCLASS_OF_ID = 0xf76f8683;
-
-    /**
-    Constructor for messages.RecentStickers: Instance of either RecentStickersNotModified, RecentStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x22f3afb3;
-        this.SUBCLASS_OF_ID = 0xf76f8683;
-
-        this.hash = args.hash;
-        this.packs = args.packs;
-        this.stickers = args.stickers;
-        this.dates = args.dates;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("b3aff322","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.packs.length),Buffer.concat(this.packs.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dates.length),Buffer.concat(this.dates.map(x => struct.pack('<i', x))),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _packs;
-        let _stickers;
-        let _dates;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _packs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _packs.push(_x);
-            }
-            reader.readInt();
-            _stickers = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _stickers.push(_x);
-                }
-                reader.readInt();
-                _dates = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.readInt();
-                    _dates.push(_x);
-                    }
-                    return new this({hash:_hash,
-	packs:_packs,
-	stickers:_stickers,
-	dates:_dates})
-                }
-            }
-
-
-class ArchivedStickers extends TLObject {
-    static CONSTRUCTOR_ID = 0x4fcba9c8;
-    static SUBCLASS_OF_ID = 0x7296d771;
-
-    /**
-    Constructor for messages.ArchivedStickers: Instance of ArchivedStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4fcba9c8;
-        this.SUBCLASS_OF_ID = 0x7296d771;
-
-        this.count = args.count;
-        this.sets = args.sets;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c8a9cb4f","hex"),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _sets;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        reader.readInt();
-        _sets = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _sets.push(_x);
-            }
-            return new this({count:_count,
-	sets:_sets})
-        }
-    }
-
-
-class StickerSetInstallResultSuccess extends TLObject {
-    static CONSTRUCTOR_ID = 0x38641628;
-    static SUBCLASS_OF_ID = 0x67cb3fe8;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x38641628;
-        this.SUBCLASS_OF_ID = 0x67cb3fe8;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("28166438","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class StickerSetInstallResultArchive extends TLObject {
-    static CONSTRUCTOR_ID = 0x35e410a8;
-    static SUBCLASS_OF_ID = 0x67cb3fe8;
-
-    /**
-    Constructor for messages.StickerSetInstallResult: Instance of either StickerSetInstallResultSuccess, StickerSetInstallResultArchive
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x35e410a8;
-        this.SUBCLASS_OF_ID = 0x67cb3fe8;
-
-        this.sets = args.sets;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a810e435","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _sets;
-        let _x;
-        let len;
-        reader.readInt();
-        _sets = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _sets.push(_x);
-            }
-            return new this({sets:_sets})
-        }
-    }
-
-
-class HighScores extends TLObject {
-    static CONSTRUCTOR_ID = 0x9a3bfd99;
-    static SUBCLASS_OF_ID = 0x6ccd95fd;
-
-    /**
-    Constructor for messages.HighScores: Instance of HighScores
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x9a3bfd99;
-        this.SUBCLASS_OF_ID = 0x6ccd95fd;
-
-        this.scores = args.scores;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("99fd3b9a","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.scores.length),Buffer.concat(this.scores.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _scores;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _scores = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _scores.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({scores:_scores,
-	users:_users})
-            }
-        }
-
-
-class FavedStickersNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0x9e8fa6d3;
-    static SUBCLASS_OF_ID = 0x8e736fb9;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x9e8fa6d3;
-        this.SUBCLASS_OF_ID = 0x8e736fb9;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d3a68f9e","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FavedStickers extends TLObject {
-    static CONSTRUCTOR_ID = 0xf37f2f16;
-    static SUBCLASS_OF_ID = 0x8e736fb9;
-
-    /**
-    Constructor for messages.FavedStickers: Instance of either FavedStickersNotModified, FavedStickers
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf37f2f16;
-        this.SUBCLASS_OF_ID = 0x8e736fb9;
-
-        this.hash = args.hash;
-        this.packs = args.packs;
-        this.stickers = args.stickers;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("162f7ff3","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.packs.length),Buffer.concat(this.packs.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _packs;
-        let _stickers;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _packs = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _packs.push(_x);
-            }
-            reader.readInt();
-            _stickers = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _stickers.push(_x);
-                }
-                return new this({hash:_hash,
-	packs:_packs,
-	stickers:_stickers})
-            }
-        }
-
-
-class FoundStickerSetsNotModified extends TLObject {
-    static CONSTRUCTOR_ID = 0x0d54b65d;
-    static SUBCLASS_OF_ID = 0x40df361;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x0d54b65d;
-        this.SUBCLASS_OF_ID = 0x40df361;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("5db6540d","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FoundStickerSets extends TLObject {
-    static CONSTRUCTOR_ID = 0x5108d648;
-    static SUBCLASS_OF_ID = 0x40df361;
-
-    /**
-    Constructor for messages.FoundStickerSets: Instance of either FoundStickerSetsNotModified, FoundStickerSets
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5108d648;
-        this.SUBCLASS_OF_ID = 0x40df361;
-
-        this.hash = args.hash;
-        this.sets = args.sets;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("48d60851","hex"),
-            struct.pack('<i', this.hash),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _hash;
-        let _sets;
-        let _x;
-        let len;
-        _hash = reader.readInt();
-        reader.readInt();
-        _sets = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _sets.push(_x);
-            }
-            return new this({hash:_hash,
-	sets:_sets})
-        }
-    }
-
-
-class SearchCounter extends TLObject {
-    static CONSTRUCTOR_ID = 0xe844ebff;
-    static SUBCLASS_OF_ID = 0xd6a7bfa2;
-
-    /**
-    Constructor for messages.SearchCounter: Instance of SearchCounter
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xe844ebff;
-        this.SUBCLASS_OF_ID = 0xd6a7bfa2;
-
-        this.inexact = args.inexact || null;
-        this.filter = args.filter;
-        this.count = args.count;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("ffeb44e8","hex"),
-            struct.pack('<I', (this.inexact === undefined || this.inexact === false || this.inexact === null) ? 0 : 2),
-            this.filter.getBytes(),
-            struct.pack('<i', this.count),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _inexact;
-        let _filter;
-        let _count;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _inexact = Boolean(flags & 2);
-        _filter = reader.tgReadObject();
-        _count = reader.readInt();
-        return new this({inexact:_inexact,
-	filter:_filter,
-	count:_count})
-    }
-}
-
-module.exports = {
-    Dialogs,
-    DialogsSlice,
-    DialogsNotModified,
-    Messages,
-    MessagesSlice,
-    ChannelMessages,
-    MessagesNotModified,
-    Chats,
-    ChatsSlice,
-    ChatFull,
-    AffectedHistory,
-    DhConfigNotModified,
-    DhConfig,
-    SentEncryptedMessage,
-    SentEncryptedFile,
-    StickersNotModified,
-    Stickers,
-    AllStickersNotModified,
-    AllStickers,
-    AffectedMessages,
-    StickerSet,
-    FoundGifs,
-    SavedGifsNotModified,
-    SavedGifs,
-    BotResults,
-    BotCallbackAnswer,
-    MessageEditData,
-    PeerDialogs,
-    FeaturedStickersNotModified,
-    FeaturedStickers,
-    RecentStickersNotModified,
-    RecentStickers,
-    ArchivedStickers,
-    StickerSetInstallResultSuccess,
-    StickerSetInstallResultArchive,
-    HighScores,
-    FavedStickersNotModified,
-    FavedStickers,
-    FoundStickerSetsNotModified,
-    FoundStickerSets,
-    SearchCounter,
-};

+ 0 - 383
src/lib/gramjs/tl/types/payments.js

@@ -1,383 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class PaymentForm extends TLObject {
-    static CONSTRUCTOR_ID = 0x3f56aea3;
-    static SUBCLASS_OF_ID = 0xa0483f19;
-
-    /**
-    Constructor for payments.PaymentForm: Instance of PaymentForm
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3f56aea3;
-        this.SUBCLASS_OF_ID = 0xa0483f19;
-
-        this.canSaveCredentials = args.canSaveCredentials || null;
-        this.passwordMissing = args.passwordMissing || null;
-        this.botId = args.botId;
-        this.invoice = args.invoice;
-        this.providerId = args.providerId;
-        this.url = args.url;
-        this.nativeProvider = args.nativeProvider || null;
-        this.nativeParams = args.nativeParams || null;
-        this.savedInfo = args.savedInfo || null;
-        this.savedCredentials = args.savedCredentials || null;
-        this.users = args.users;
-    }
-    getBytes() {
-        if (!((this.native_provider || this.native_provider!==null && this.native_params || this.native_params!==null) && (this.native_provider===null || this.native_provider===false && this.native_params===null || this.native_params===false)))
-	 throw new Error('native_provider, native_params paramaters must all be false-y or all true')
-        return Buffer.concat([
-            Buffer.from("a3ae563f","hex"),
-            struct.pack('<I', (this.canSaveCredentials === undefined || this.canSaveCredentials === false || this.canSaveCredentials === null) ? 0 : 4 | (this.passwordMissing === undefined || this.passwordMissing === false || this.passwordMissing === null) ? 0 : 8 | (this.nativeProvider === undefined || this.nativeProvider === false || this.nativeProvider === null) ? 0 : 16 | (this.nativeParams === undefined || this.nativeParams === false || this.nativeParams === null) ? 0 : 16 | (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo === null) ? 0 : 1 | (this.savedCredentials === undefined || this.savedCredentials === false || this.savedCredentials === null) ? 0 : 2),
-            struct.pack('<i', this.botId),
-            this.invoice.getBytes(),
-            struct.pack('<i', this.providerId),
-            TLObject.serializeBytes(this.url),
-            (this.nativeProvider === undefined || this.nativeProvider === false || this.nativeProvider ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.nativeProvider)],
-            (this.nativeParams === undefined || this.nativeParams === false || this.nativeParams ===null) ? Buffer.alloc(0) : [this.nativeParams.getBytes()],
-            (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo ===null) ? Buffer.alloc(0) : [this.savedInfo.getBytes()],
-            (this.savedCredentials === undefined || this.savedCredentials === false || this.savedCredentials ===null) ? Buffer.alloc(0) : [this.savedCredentials.getBytes()],
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _can_save_credentials;
-        let _password_missing;
-        let _bot_id;
-        let _invoice;
-        let _provider_id;
-        let _url;
-        let _native_provider;
-        let _native_params;
-        let _saved_info;
-        let _saved_credentials;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _can_save_credentials = Boolean(flags & 4);
-        _password_missing = Boolean(flags & 8);
-        _bot_id = reader.readInt();
-        _invoice = reader.tgReadObject();
-        _provider_id = reader.readInt();
-        _url = reader.tgReadString();
-        if (flags & 16) {
-            _native_provider = reader.tgReadString();
-        }
-        else {
-            _native_provider = null
-        }
-        if (flags & 16) {
-            _native_params = reader.tgReadObject();
-        }
-        else {
-            _native_params = null
-        }
-        if (flags & 1) {
-            _saved_info = reader.tgReadObject();
-        }
-        else {
-            _saved_info = null
-        }
-        if (flags & 2) {
-            _saved_credentials = reader.tgReadObject();
-        }
-        else {
-            _saved_credentials = null
-        }
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            return new this({canSaveCredentials:_can_save_credentials,
-	passwordMissing:_password_missing,
-	botId:_bot_id,
-	invoice:_invoice,
-	providerId:_provider_id,
-	url:_url,
-	nativeProvider:_native_provider,
-	nativeParams:_native_params,
-	savedInfo:_saved_info,
-	savedCredentials:_saved_credentials,
-	users:_users})
-        }
-    }
-
-
-class ValidatedRequestedInfo extends TLObject {
-    static CONSTRUCTOR_ID = 0xd1451883;
-    static SUBCLASS_OF_ID = 0x8f8044b7;
-
-    /**
-    Constructor for payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd1451883;
-        this.SUBCLASS_OF_ID = 0x8f8044b7;
-
-        this.id = args.id || null;
-        this.shippingOptions = args.shippingOptions || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("831845d1","hex"),
-            struct.pack('<I', (this.id === undefined || this.id === false || this.id === null) ? 0 : 1 | (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions === null) ? 0 : 2),
-            (this.id === undefined || this.id === false || this.id ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.id)],
-            (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.shippingOptions.length),Buffer.concat(this.shippingOptions.map(x => x.getBytes()))]),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _id;
-        let _shipping_options;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        if (flags & 1) {
-            _id = reader.tgReadString();
-        }
-        else {
-            _id = null
-        }
-        if (flags & 2) {
-            reader.readInt();
-            _shipping_options = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _shipping_options.push(_x);
-                }
-            }
-            else {
-                _shipping_options = null
-            }
-            return new this({id:_id,
-	shippingOptions:_shipping_options})
-        }
-    }
-
-
-class PaymentResult extends TLObject {
-    static CONSTRUCTOR_ID = 0x4e5f810d;
-    static SUBCLASS_OF_ID = 0x8ae16a9d;
-
-    /**
-    Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerificationNeeded
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4e5f810d;
-        this.SUBCLASS_OF_ID = 0x8ae16a9d;
-
-        this.updates = args.updates;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0d815f4e","hex"),
-            this.updates.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _updates;
-        let _x;
-        let len;
-        _updates = reader.tgReadObject();
-        return new this({updates:_updates})
-    }
-}
-
-
-class PaymentVerificationNeeded extends TLObject {
-    static CONSTRUCTOR_ID = 0xd8411139;
-    static SUBCLASS_OF_ID = 0x8ae16a9d;
-
-    /**
-    Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerificationNeeded
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xd8411139;
-        this.SUBCLASS_OF_ID = 0x8ae16a9d;
-
-        this.url = args.url;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("391141d8","hex"),
-            TLObject.serializeBytes(this.url),
-            ])
-        }
-    static fromReader(reader) {
-        let _url;
-        let _x;
-        let len;
-        _url = reader.tgReadString();
-        return new this({url:_url})
-    }
-}
-
-
-class PaymentReceipt extends TLObject {
-    static CONSTRUCTOR_ID = 0x500911e1;
-    static SUBCLASS_OF_ID = 0x590093c9;
-
-    /**
-    Constructor for payments.PaymentReceipt: Instance of PaymentReceipt
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x500911e1;
-        this.SUBCLASS_OF_ID = 0x590093c9;
-
-        this.date = args.date;
-        this.botId = args.botId;
-        this.invoice = args.invoice;
-        this.providerId = args.providerId;
-        this.info = args.info || null;
-        this.shipping = args.shipping || null;
-        this.currency = args.currency;
-        this.totalAmount = args.totalAmount;
-        this.credentialsTitle = args.credentialsTitle;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e1110950","hex"),
-            struct.pack('<I', (this.info === undefined || this.info === false || this.info === null) ? 0 : 1 | (this.shipping === undefined || this.shipping === false || this.shipping === null) ? 0 : 2),
-            struct.pack('<i', this.date),
-            struct.pack('<i', this.botId),
-            this.invoice.getBytes(),
-            struct.pack('<i', this.providerId),
-            (this.info === undefined || this.info === false || this.info ===null) ? Buffer.alloc(0) : [this.info.getBytes()],
-            (this.shipping === undefined || this.shipping === false || this.shipping ===null) ? Buffer.alloc(0) : [this.shipping.getBytes()],
-            TLObject.serializeBytes(this.currency),
-            readBufferFromBigInt(this.totalAmount,8,true,true),
-            TLObject.serializeBytes(this.credentialsTitle),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _date;
-        let _bot_id;
-        let _invoice;
-        let _provider_id;
-        let _info;
-        let _shipping;
-        let _currency;
-        let _total_amount;
-        let _credentials_title;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _date = reader.readInt();
-        _bot_id = reader.readInt();
-        _invoice = reader.tgReadObject();
-        _provider_id = reader.readInt();
-        if (flags & 1) {
-            _info = reader.tgReadObject();
-        }
-        else {
-            _info = null
-        }
-        if (flags & 2) {
-            _shipping = reader.tgReadObject();
-        }
-        else {
-            _shipping = null
-        }
-        _currency = reader.tgReadString();
-        _total_amount = reader.readLong();
-        _credentials_title = reader.tgReadString();
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            return new this({date:_date,
-	botId:_bot_id,
-	invoice:_invoice,
-	providerId:_provider_id,
-	info:_info,
-	shipping:_shipping,
-	currency:_currency,
-	totalAmount:_total_amount,
-	credentialsTitle:_credentials_title,
-	users:_users})
-        }
-    }
-
-
-class SavedInfo extends TLObject {
-    static CONSTRUCTOR_ID = 0xfb8fe43c;
-    static SUBCLASS_OF_ID = 0xad3cf146;
-
-    /**
-    Constructor for payments.SavedInfo: Instance of SavedInfo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xfb8fe43c;
-        this.SUBCLASS_OF_ID = 0xad3cf146;
-
-        this.hasSavedCredentials = args.hasSavedCredentials || null;
-        this.savedInfo = args.savedInfo || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3ce48ffb","hex"),
-            struct.pack('<I', (this.hasSavedCredentials === undefined || this.hasSavedCredentials === false || this.hasSavedCredentials === null) ? 0 : 2 | (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo === null) ? 0 : 1),
-            (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo ===null) ? Buffer.alloc(0) : [this.savedInfo.getBytes()],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _has_saved_credentials;
-        let _saved_info;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _has_saved_credentials = Boolean(flags & 2);
-        if (flags & 1) {
-            _saved_info = reader.tgReadObject();
-        }
-        else {
-            _saved_info = null
-        }
-        return new this({hasSavedCredentials:_has_saved_credentials,
-	savedInfo:_saved_info})
-    }
-}
-
-module.exports = {
-    PaymentForm,
-    ValidatedRequestedInfo,
-    PaymentResult,
-    PaymentVerificationNeeded,
-    PaymentReceipt,
-    SavedInfo,
-};

+ 0 - 51
src/lib/gramjs/tl/types/phone.js

@@ -1,51 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class PhoneCall extends TLObject {
-    static CONSTRUCTOR_ID = 0xec82e140;
-    static SUBCLASS_OF_ID = 0xd48afe4f;
-
-    /**
-    Constructor for phone.PhoneCall: Instance of PhoneCall
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xec82e140;
-        this.SUBCLASS_OF_ID = 0xd48afe4f;
-
-        this.phoneCall = args.phoneCall;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("40e182ec","hex"),
-            this.phoneCall.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _phone_call;
-        let _users;
-        let _x;
-        let len;
-        _phone_call = reader.tgReadObject();
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            return new this({phoneCall:_phone_call,
-	users:_users})
-        }
-    }
-
-module.exports = {
-    PhoneCall,
-};

+ 0 - 154
src/lib/gramjs/tl/types/photos.js

@@ -1,154 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class Photos extends TLObject {
-    static CONSTRUCTOR_ID = 0x8dca6aa5;
-    static SUBCLASS_OF_ID = 0x27cfb967;
-
-    /**
-    Constructor for photos.Photos: Instance of either Photos, PhotosSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x8dca6aa5;
-        this.SUBCLASS_OF_ID = 0x27cfb967;
-
-        this.photos = args.photos;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a56aca8d","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.photos.length),Buffer.concat(this.photos.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _photos;
-        let _users;
-        let _x;
-        let len;
-        reader.readInt();
-        _photos = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _photos.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({photos:_photos,
-	users:_users})
-            }
-        }
-
-
-class PhotosSlice extends TLObject {
-    static CONSTRUCTOR_ID = 0x15051f54;
-    static SUBCLASS_OF_ID = 0x27cfb967;
-
-    /**
-    Constructor for photos.Photos: Instance of either Photos, PhotosSlice
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x15051f54;
-        this.SUBCLASS_OF_ID = 0x27cfb967;
-
-        this.count = args.count;
-        this.photos = args.photos;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("541f0515","hex"),
-            struct.pack('<i', this.count),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.photos.length),Buffer.concat(this.photos.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _count;
-        let _photos;
-        let _users;
-        let _x;
-        let len;
-        _count = reader.readInt();
-        reader.readInt();
-        _photos = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _photos.push(_x);
-            }
-            reader.readInt();
-            _users = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _users.push(_x);
-                }
-                return new this({count:_count,
-	photos:_photos,
-	users:_users})
-            }
-        }
-
-
-class Photo extends TLObject {
-    static CONSTRUCTOR_ID = 0x20212ca8;
-    static SUBCLASS_OF_ID = 0xc292bd24;
-
-    /**
-    Constructor for photos.Photo: Instance of Photo
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x20212ca8;
-        this.SUBCLASS_OF_ID = 0xc292bd24;
-
-        this.photo = args.photo;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a82c2120","hex"),
-            this.photo.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _photo;
-        let _users;
-        let _x;
-        let len;
-        _photo = reader.tgReadObject();
-        reader.readInt();
-        _users = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _users.push(_x);
-            }
-            return new this({photo:_photo,
-	users:_users})
-        }
-    }
-
-module.exports = {
-    Photos,
-    PhotosSlice,
-    Photo,
-};

+ 0 - 248
src/lib/gramjs/tl/types/storage.js

@@ -1,248 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class FileUnknown extends TLObject {
-    static CONSTRUCTOR_ID = 0xaa963b05;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xaa963b05;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("053b96aa","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FilePartial extends TLObject {
-    static CONSTRUCTOR_ID = 0x40bc6f52;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x40bc6f52;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("526fbc40","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FileJpeg extends TLObject {
-    static CONSTRUCTOR_ID = 0x007efe0e;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x007efe0e;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("0efe7e00","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FileGif extends TLObject {
-    static CONSTRUCTOR_ID = 0xcae1aadf;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xcae1aadf;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("dfaae1ca","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FilePng extends TLObject {
-    static CONSTRUCTOR_ID = 0x0a4f63c0;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x0a4f63c0;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("c0634f0a","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FilePdf extends TLObject {
-    static CONSTRUCTOR_ID = 0xae1e508d;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xae1e508d;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8d501eae","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FileMp3 extends TLObject {
-    static CONSTRUCTOR_ID = 0x528a0677;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x528a0677;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("77068a52","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FileMov extends TLObject {
-    static CONSTRUCTOR_ID = 0x4b09ebbc;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x4b09ebbc;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bceb094b","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FileMp4 extends TLObject {
-    static CONSTRUCTOR_ID = 0xb3cea0e4;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0xb3cea0e4;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("e4a0ceb3","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-
-class FileWebp extends TLObject {
-    static CONSTRUCTOR_ID = 0x1081464c;
-    static SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    constructor() {
-        super();
-        this.CONSTRUCTOR_ID = 0x1081464c;
-        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
-
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4c468110","hex"),
-            ])
-        }
-    static fromReader(reader) {
-        let _x;
-        let len;
-        return new this({})
-    }
-}
-
-module.exports = {
-    FileUnknown,
-    FilePartial,
-    FileJpeg,
-    FileGif,
-    FilePng,
-    FilePdf,
-    FileMp3,
-    FileMov,
-    FileMp4,
-    FileWebp,
-};

+ 0 - 530
src/lib/gramjs/tl/types/updates.js

@@ -1,530 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class State extends TLObject {
-    static CONSTRUCTOR_ID = 0xa56c2a3e;
-    static SUBCLASS_OF_ID = 0x23df1a01;
-
-    /**
-    Constructor for updates.State: Instance of State
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa56c2a3e;
-        this.SUBCLASS_OF_ID = 0x23df1a01;
-
-        this.pts = args.pts;
-        this.qts = args.qts;
-        this.date = args.date;
-        this.seq = args.seq;
-        this.unreadCount = args.unreadCount;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("3e2a6ca5","hex"),
-            struct.pack('<i', this.pts),
-            struct.pack('<i', this.qts),
-            struct.pack('<i', this.date),
-            struct.pack('<i', this.seq),
-            struct.pack('<i', this.unreadCount),
-            ])
-        }
-    static fromReader(reader) {
-        let _pts;
-        let _qts;
-        let _date;
-        let _seq;
-        let _unread_count;
-        let _x;
-        let len;
-        _pts = reader.readInt();
-        _qts = reader.readInt();
-        _date = reader.readInt();
-        _seq = reader.readInt();
-        _unread_count = reader.readInt();
-        return new this({pts:_pts,
-	qts:_qts,
-	date:_date,
-	seq:_seq,
-	unreadCount:_unread_count})
-    }
-}
-
-
-class DifferenceEmpty extends TLObject {
-    static CONSTRUCTOR_ID = 0x5d75a138;
-    static SUBCLASS_OF_ID = 0x20482874;
-
-    /**
-    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x5d75a138;
-        this.SUBCLASS_OF_ID = 0x20482874;
-
-        this.date = args.date;
-        this.seq = args.seq;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("38a1755d","hex"),
-            struct.pack('<i', this.date),
-            struct.pack('<i', this.seq),
-            ])
-        }
-    static fromReader(reader) {
-        let _date;
-        let _seq;
-        let _x;
-        let len;
-        _date = reader.readInt();
-        _seq = reader.readInt();
-        return new this({date:_date,
-	seq:_seq})
-    }
-}
-
-
-class Difference extends TLObject {
-    static CONSTRUCTOR_ID = 0x00f49ca0;
-    static SUBCLASS_OF_ID = 0x20482874;
-
-    /**
-    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x00f49ca0;
-        this.SUBCLASS_OF_ID = 0x20482874;
-
-        this.newMessages = args.newMessages;
-        this.newEncryptedMessages = args.newEncryptedMessages;
-        this.otherUpdates = args.otherUpdates;
-        this.chats = args.chats;
-        this.users = args.users;
-        this.state = args.state;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("a09cf400","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newMessages.length),Buffer.concat(this.newMessages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newEncryptedMessages.length),Buffer.concat(this.newEncryptedMessages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUpdates.length),Buffer.concat(this.otherUpdates.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            this.state.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _new_messages;
-        let _new_encrypted_messages;
-        let _other_updates;
-        let _chats;
-        let _users;
-        let _state;
-        let _x;
-        let len;
-        reader.readInt();
-        _new_messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _new_messages.push(_x);
-            }
-            reader.readInt();
-            _new_encrypted_messages = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _new_encrypted_messages.push(_x);
-                }
-                reader.readInt();
-                _other_updates = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _other_updates.push(_x);
-                    }
-                    reader.readInt();
-                    _chats = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _chats.push(_x);
-                        }
-                        reader.readInt();
-                        _users = [];
-                        len = reader.readInt();
-                        for (let i=0;i<len;i++){
-                            _x = reader.tgReadObject();
-                            _users.push(_x);
-                            }
-                            _state = reader.tgReadObject();
-                            return new this({newMessages:_new_messages,
-	newEncryptedMessages:_new_encrypted_messages,
-	otherUpdates:_other_updates,
-	chats:_chats,
-	users:_users,
-	state:_state})
-                        }
-                    }
-
-
-class DifferenceSlice extends TLObject {
-    static CONSTRUCTOR_ID = 0xa8fb1981;
-    static SUBCLASS_OF_ID = 0x20482874;
-
-    /**
-    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa8fb1981;
-        this.SUBCLASS_OF_ID = 0x20482874;
-
-        this.newMessages = args.newMessages;
-        this.newEncryptedMessages = args.newEncryptedMessages;
-        this.otherUpdates = args.otherUpdates;
-        this.chats = args.chats;
-        this.users = args.users;
-        this.intermediateState = args.intermediateState;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("8119fba8","hex"),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newMessages.length),Buffer.concat(this.newMessages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newEncryptedMessages.length),Buffer.concat(this.newEncryptedMessages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUpdates.length),Buffer.concat(this.otherUpdates.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            this.intermediateState.getBytes(),
-            ])
-        }
-    static fromReader(reader) {
-        let _new_messages;
-        let _new_encrypted_messages;
-        let _other_updates;
-        let _chats;
-        let _users;
-        let _intermediate_state;
-        let _x;
-        let len;
-        reader.readInt();
-        _new_messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _new_messages.push(_x);
-            }
-            reader.readInt();
-            _new_encrypted_messages = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _new_encrypted_messages.push(_x);
-                }
-                reader.readInt();
-                _other_updates = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _other_updates.push(_x);
-                    }
-                    reader.readInt();
-                    _chats = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _chats.push(_x);
-                        }
-                        reader.readInt();
-                        _users = [];
-                        len = reader.readInt();
-                        for (let i=0;i<len;i++){
-                            _x = reader.tgReadObject();
-                            _users.push(_x);
-                            }
-                            _intermediate_state = reader.tgReadObject();
-                            return new this({newMessages:_new_messages,
-	newEncryptedMessages:_new_encrypted_messages,
-	otherUpdates:_other_updates,
-	chats:_chats,
-	users:_users,
-	intermediateState:_intermediate_state})
-                        }
-                    }
-
-
-class DifferenceTooLong extends TLObject {
-    static CONSTRUCTOR_ID = 0x4afe8f6d;
-    static SUBCLASS_OF_ID = 0x20482874;
-
-    /**
-    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x4afe8f6d;
-        this.SUBCLASS_OF_ID = 0x20482874;
-
-        this.pts = args.pts;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6d8ffe4a","hex"),
-            struct.pack('<i', this.pts),
-            ])
-        }
-    static fromReader(reader) {
-        let _pts;
-        let _x;
-        let len;
-        _pts = reader.readInt();
-        return new this({pts:_pts})
-    }
-}
-
-
-class ChannelDifferenceEmpty extends TLObject {
-    static CONSTRUCTOR_ID = 0x3e11affb;
-    static SUBCLASS_OF_ID = 0x29896f5d;
-
-    /**
-    Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x3e11affb;
-        this.SUBCLASS_OF_ID = 0x29896f5d;
-
-        this.final = args.final || null;
-        this.pts = args.pts;
-        this.timeout = args.timeout || null;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fbaf113e","hex"),
-            struct.pack('<I', (this.final === undefined || this.final === false || this.final === null) ? 0 : 1 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 2),
-            struct.pack('<i', this.pts),
-            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _final;
-        let _pts;
-        let _timeout;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _final = Boolean(flags & 1);
-        _pts = reader.readInt();
-        if (flags & 2) {
-            _timeout = reader.readInt();
-        }
-        else {
-            _timeout = null
-        }
-        return new this({final:_final,
-	pts:_pts,
-	timeout:_timeout})
-    }
-}
-
-
-class ChannelDifferenceTooLong extends TLObject {
-    static CONSTRUCTOR_ID = 0xa4bcc6fe;
-    static SUBCLASS_OF_ID = 0x29896f5d;
-
-    /**
-    Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa4bcc6fe;
-        this.SUBCLASS_OF_ID = 0x29896f5d;
-
-        this.final = args.final || null;
-        this.timeout = args.timeout || null;
-        this.dialog = args.dialog;
-        this.messages = args.messages;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("fec6bca4","hex"),
-            struct.pack('<I', (this.final === undefined || this.final === false || this.final === null) ? 0 : 1 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 2),
-            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
-            this.dialog.getBytes(),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _final;
-        let _timeout;
-        let _dialog;
-        let _messages;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _final = Boolean(flags & 1);
-        if (flags & 2) {
-            _timeout = reader.readInt();
-        }
-        else {
-            _timeout = null
-        }
-        _dialog = reader.tgReadObject();
-        reader.readInt();
-        _messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _messages.push(_x);
-            }
-            reader.readInt();
-            _chats = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _chats.push(_x);
-                }
-                reader.readInt();
-                _users = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _users.push(_x);
-                    }
-                    return new this({final:_final,
-	timeout:_timeout,
-	dialog:_dialog,
-	messages:_messages,
-	chats:_chats,
-	users:_users})
-                }
-            }
-
-
-class ChannelDifference extends TLObject {
-    static CONSTRUCTOR_ID = 0x2064674e;
-    static SUBCLASS_OF_ID = 0x29896f5d;
-
-    /**
-    Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x2064674e;
-        this.SUBCLASS_OF_ID = 0x29896f5d;
-
-        this.final = args.final || null;
-        this.pts = args.pts;
-        this.timeout = args.timeout || null;
-        this.newMessages = args.newMessages;
-        this.otherUpdates = args.otherUpdates;
-        this.chats = args.chats;
-        this.users = args.users;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4e676420","hex"),
-            struct.pack('<I', (this.final === undefined || this.final === false || this.final === null) ? 0 : 1 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 2),
-            struct.pack('<i', this.pts),
-            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newMessages.length),Buffer.concat(this.newMessages.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUpdates.length),Buffer.concat(this.otherUpdates.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _flags;
-        let _final;
-        let _pts;
-        let _timeout;
-        let _new_messages;
-        let _other_updates;
-        let _chats;
-        let _users;
-        let _x;
-        let len;
-        let flags = reader.readInt();
-
-        _final = Boolean(flags & 1);
-        _pts = reader.readInt();
-        if (flags & 2) {
-            _timeout = reader.readInt();
-        }
-        else {
-            _timeout = null
-        }
-        reader.readInt();
-        _new_messages = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _new_messages.push(_x);
-            }
-            reader.readInt();
-            _other_updates = [];
-            len = reader.readInt();
-            for (let i=0;i<len;i++){
-                _x = reader.tgReadObject();
-                _other_updates.push(_x);
-                }
-                reader.readInt();
-                _chats = [];
-                len = reader.readInt();
-                for (let i=0;i<len;i++){
-                    _x = reader.tgReadObject();
-                    _chats.push(_x);
-                    }
-                    reader.readInt();
-                    _users = [];
-                    len = reader.readInt();
-                    for (let i=0;i<len;i++){
-                        _x = reader.tgReadObject();
-                        _users.push(_x);
-                        }
-                        return new this({final:_final,
-	pts:_pts,
-	timeout:_timeout,
-	newMessages:_new_messages,
-	otherUpdates:_other_updates,
-	chats:_chats,
-	users:_users})
-                    }
-                }
-
-module.exports = {
-    State,
-    DifferenceEmpty,
-    Difference,
-    DifferenceSlice,
-    DifferenceTooLong,
-    ChannelDifferenceEmpty,
-    ChannelDifferenceTooLong,
-    ChannelDifference,
-};

+ 0 - 224
src/lib/gramjs/tl/types/upload.js

@@ -1,224 +0,0 @@
-/*! File generated by TLObjects' generator. All changes will be ERASED !*/
-const { TLObject } = require('../tlobject');
-const struct = require('python-struct');
-const { readBigIntFromBuffer, 
-        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
-
-
-class File extends TLObject {
-    static CONSTRUCTOR_ID = 0x096a18d5;
-    static SUBCLASS_OF_ID = 0x6c9bd728;
-
-    /**
-    Constructor for upload.File: Instance of either File, FileCdnRedirect
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x096a18d5;
-        this.SUBCLASS_OF_ID = 0x6c9bd728;
-
-        this.type = args.type;
-        this.mtime = args.mtime;
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("d5186a09","hex"),
-            this.type.getBytes(),
-            struct.pack('<i', this.mtime),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _type;
-        let _mtime;
-        let _bytes;
-        let _x;
-        let len;
-        _type = reader.tgReadObject();
-        _mtime = reader.readInt();
-        _bytes = reader.tgReadBytes();
-        return new this({type:_type,
-	mtime:_mtime,
-	bytes:_bytes})
-    }
-}
-
-
-class FileCdnRedirect extends TLObject {
-    static CONSTRUCTOR_ID = 0xf18cda44;
-    static SUBCLASS_OF_ID = 0x6c9bd728;
-
-    /**
-    Constructor for upload.File: Instance of either File, FileCdnRedirect
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xf18cda44;
-        this.SUBCLASS_OF_ID = 0x6c9bd728;
-
-        this.dcId = args.dcId;
-        this.fileToken = args.fileToken;
-        this.encryptionKey = args.encryptionKey;
-        this.encryptionIv = args.encryptionIv;
-        this.fileHashes = args.fileHashes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("44da8cf1","hex"),
-            struct.pack('<i', this.dcId),
-            TLObject.serializeBytes(this.fileToken),
-            TLObject.serializeBytes(this.encryptionKey),
-            TLObject.serializeBytes(this.encryptionIv),
-            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.fileHashes.length),Buffer.concat(this.fileHashes.map(x => x.getBytes())),
-            ])
-        }
-    static fromReader(reader) {
-        let _dc_id;
-        let _file_token;
-        let _encryption_key;
-        let _encryption_iv;
-        let _file_hashes;
-        let _x;
-        let len;
-        _dc_id = reader.readInt();
-        _file_token = reader.tgReadBytes();
-        _encryption_key = reader.tgReadBytes();
-        _encryption_iv = reader.tgReadBytes();
-        reader.readInt();
-        _file_hashes = [];
-        len = reader.readInt();
-        for (let i=0;i<len;i++){
-            _x = reader.tgReadObject();
-            _file_hashes.push(_x);
-            }
-            return new this({dcId:_dc_id,
-	fileToken:_file_token,
-	encryptionKey:_encryption_key,
-	encryptionIv:_encryption_iv,
-	fileHashes:_file_hashes})
-        }
-    }
-
-
-class WebFile extends TLObject {
-    static CONSTRUCTOR_ID = 0x21e753bc;
-    static SUBCLASS_OF_ID = 0x68f17f51;
-
-    /**
-    Constructor for upload.WebFile: Instance of WebFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0x21e753bc;
-        this.SUBCLASS_OF_ID = 0x68f17f51;
-
-        this.size = args.size;
-        this.mimeType = args.mimeType;
-        this.fileType = args.fileType;
-        this.mtime = args.mtime;
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("bc53e721","hex"),
-            struct.pack('<i', this.size),
-            TLObject.serializeBytes(this.mimeType),
-            this.fileType.getBytes(),
-            struct.pack('<i', this.mtime),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _size;
-        let _mime_type;
-        let _file_type;
-        let _mtime;
-        let _bytes;
-        let _x;
-        let len;
-        _size = reader.readInt();
-        _mime_type = reader.tgReadString();
-        _file_type = reader.tgReadObject();
-        _mtime = reader.readInt();
-        _bytes = reader.tgReadBytes();
-        return new this({size:_size,
-	mimeType:_mime_type,
-	fileType:_file_type,
-	mtime:_mtime,
-	bytes:_bytes})
-    }
-}
-
-
-class CdnFileReuploadNeeded extends TLObject {
-    static CONSTRUCTOR_ID = 0xeea8e46e;
-    static SUBCLASS_OF_ID = 0xf5ccf928;
-
-    /**
-    Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xeea8e46e;
-        this.SUBCLASS_OF_ID = 0xf5ccf928;
-
-        this.requestToken = args.requestToken;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("6ee4a8ee","hex"),
-            TLObject.serializeBytes(this.requestToken),
-            ])
-        }
-    static fromReader(reader) {
-        let _request_token;
-        let _x;
-        let len;
-        _request_token = reader.tgReadBytes();
-        return new this({requestToken:_request_token})
-    }
-}
-
-
-class CdnFile extends TLObject {
-    static CONSTRUCTOR_ID = 0xa99fca4f;
-    static SUBCLASS_OF_ID = 0xf5ccf928;
-
-    /**
-    Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile
-    */
-    constructor(args) {
-        super();
-        args = args || {}
-        this.CONSTRUCTOR_ID = 0xa99fca4f;
-        this.SUBCLASS_OF_ID = 0xf5ccf928;
-
-        this.bytes = args.bytes;
-    }
-    getBytes() {
-        return Buffer.concat([
-            Buffer.from("4fca9fa9","hex"),
-            TLObject.serializeBytes(this.bytes),
-            ])
-        }
-    static fromReader(reader) {
-        let _bytes;
-        let _x;
-        let len;
-        _bytes = reader.tgReadBytes();
-        return new this({bytes:_bytes})
-    }
-}
-
-module.exports = {
-    File,
-    FileCdnRedirect,
-    WebFile,
-    CdnFileReuploadNeeded,
-    CdnFile,
-};

+ 1418 - 0
static/api.tl

@@ -0,0 +1,1418 @@
+///////////////////////////////
+/////////////////// Layer cons
+///////////////////////////////
+
+//invokeAfterMsg#cb9f372d msg_id:long query:!X = X;
+//invokeAfterMsgs#3dc4b4f0 msg_ids:Vector<long> query:!X = X;
+//invokeWithLayer1#53835315 query:!X = X;
+//invokeWithLayer2#289dd1f6 query:!X = X;
+//invokeWithLayer3#b7475268 query:!X = X;
+//invokeWithLayer4#dea0d430 query:!X = X;
+//invokeWithLayer5#417a57ae query:!X = X;
+//invokeWithLayer6#3a64d54d query:!X = X;
+//invokeWithLayer7#a5be56d3 query:!X = X;
+//invokeWithLayer8#e9abd9fd query:!X = X;
+//invokeWithLayer9#76715a63 query:!X = X;
+//invokeWithLayer10#39620c41 query:!X = X;
+//invokeWithLayer11#a6b88fdf query:!X = X;
+//invokeWithLayer12#dda60d3c query:!X = X;
+//invokeWithLayer13#427c8ea2 query:!X = X;
+//invokeWithLayer14#2b9b08fa query:!X = X;
+//invokeWithLayer15#b4418b64 query:!X = X;
+//invokeWithLayer16#cf5f0987 query:!X = X;
+//invokeWithLayer17#50858a19 query:!X = X;
+//invokeWithLayer18#1c900537 query:!X = X;
+//invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer
+
+///////////////////////////////
+///////// Main application API
+///////////////////////////////
+
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+true#3fedd339 = True;
+
+vector#1cb5c415 {t:Type} # [ t ] = Vector t;
+
+error#c4b9f9bb code:int text:string = Error;
+
+null#56730bcc = Null;
+
+inputPeerEmpty#7f3b18ea = InputPeer;
+inputPeerSelf#7da07ec9 = InputPeer;
+inputPeerChat#179be863 chat_id:int = InputPeer;
+inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer;
+inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer;
+inputPeerUserFromMessage#17bae2e6 peer:InputPeer msg_id:int user_id:int = InputPeer;
+inputPeerChannelFromMessage#9c95f7bb peer:InputPeer msg_id:int channel_id:int = InputPeer;
+
+inputUserEmpty#b98886cf = InputUser;
+inputUserSelf#f7c1b13f = InputUser;
+inputUser#d8292816 user_id:int access_hash:long = InputUser;
+inputUserFromMessage#2d117597 peer:InputPeer msg_id:int user_id:int = InputUser;
+
+inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;
+
+inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
+inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;
+
+inputMediaEmpty#9664f57f = InputMedia;
+inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
+inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
+inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia;
+inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;
+inputMediaGifExternal#4843b0fd url:string q:string = InputMedia;
+inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaGame#d33f43f3 id:InputGame = InputMedia;
+inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
+inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia;
+inputMediaPoll#6b3765b poll:Poll = InputMedia;
+
+inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
+inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto;
+inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;
+
+inputGeoPointEmpty#e4c123d6 = InputGeoPoint;
+inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint;
+
+inputPhotoEmpty#1cd7bf0d = InputPhoto;
+inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;
+
+inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;
+inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;
+inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
+inputTakeoutFileLocation#29be5899 = InputFileLocation;
+inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;
+inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation;
+
+peerUser#9db1bc6d user_id:int = Peer;
+peerChat#bad0e5bb chat_id:int = Peer;
+peerChannel#bddde532 channel_id:int = Peer;
+
+storage.fileUnknown#aa963b05 = storage.FileType;
+storage.filePartial#40bc6f52 = storage.FileType;
+storage.fileJpeg#7efe0e = storage.FileType;
+storage.fileGif#cae1aadf = storage.FileType;
+storage.filePng#a4f63c0 = storage.FileType;
+storage.filePdf#ae1e508d = storage.FileType;
+storage.fileMp3#528a0677 = storage.FileType;
+storage.fileMov#4b09ebbc = storage.FileType;
+storage.fileMp4#b3cea0e4 = storage.FileType;
+storage.fileWebp#1081464c = storage.FileType;
+
+userEmpty#200250ba id:int = User;
+user#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+
+userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
+userProfilePhoto#ecd75d8c photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto;
+
+userStatusEmpty#9d05049 = UserStatus;
+userStatusOnline#edb93949 expires:int = UserStatus;
+userStatusOffline#8c703f was_online:int = UserStatus;
+userStatusRecently#e26f42f1 = UserStatus;
+userStatusLastWeek#7bf09fc = UserStatus;
+userStatusLastMonth#77ebc742 = UserStatus;
+
+chatEmpty#9ba2d800 id:int = Chat;
+chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
+chatForbidden#7328bdb id:int title:string = Chat;
+channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
+
+chatFull#1b7c9db3 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull;
+channelFull#2d895c74 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true can_set_location:flags.16?true has_scheduled:flags.19?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int pts:int = ChatFull;
+
+chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
+chatParticipantCreator#da13538a user_id:int = ChatParticipant;
+chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant;
+
+chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants;
+chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;
+
+chatPhotoEmpty#37c1011c = ChatPhoto;
+chatPhoto#475cdbd5 photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
+
+messageEmpty#83e5de54 id:int = Message;
+message#452c0e65 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> = Message;
+messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message;
+
+messageMediaEmpty#3ded6320 = MessageMedia;
+messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
+messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
+messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia;
+messageMediaUnsupported#9f84f49e = MessageMedia;
+messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
+messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
+messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
+messageMediaGame#fdb19008 game:Game = MessageMedia;
+messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
+messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia;
+messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
+
+messageActionEmpty#b6aef7b0 = MessageAction;
+messageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction;
+messageActionChatEditTitle#b5a1ce5a title:string = MessageAction;
+messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction;
+messageActionChatDeletePhoto#95e3fbef = MessageAction;
+messageActionChatAddUser#488a7337 users:Vector<int> = MessageAction;
+messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;
+messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;
+messageActionChannelCreate#95d2ac92 title:string = MessageAction;
+messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction;
+messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction;
+messageActionPinMessage#94bd38ed = MessageAction;
+messageActionHistoryClear#9fbab604 = MessageAction;
+messageActionGameScore#92a72876 game_id:long score:int = MessageAction;
+messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction;
+messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction;
+messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;
+messageActionScreenshotTaken#4792929b = MessageAction;
+messageActionCustomAction#fae69f56 message:string = MessageAction;
+messageActionBotAllowed#abe9affe domain:string = MessageAction;
+messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;
+messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;
+messageActionContactSignUp#f3f25f76 = MessageAction;
+
+dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
+dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
+
+photoEmpty#2331b22d id:long = Photo;
+photo#d07504a5 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> dc_id:int = Photo;
+
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
+photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
+photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
+
+geoPointEmpty#1117dd5f = GeoPoint;
+geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
+
+auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
+
+auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
+auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
+
+auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization;
+
+inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer;
+inputNotifyUsers#193b4417 = InputNotifyPeer;
+inputNotifyChats#4a95e84e = InputNotifyPeer;
+inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;
+
+inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings;
+
+peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;
+
+peerSettings#818426cd flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true = PeerSettings;
+
+wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
+
+inputReportReasonSpam#58dbcab8 = ReportReason;
+inputReportReasonViolence#1e22c78d = ReportReason;
+inputReportReasonPornography#2e59d922 = ReportReason;
+inputReportReasonChildAbuse#adf44ee3 = ReportReason;
+inputReportReasonOther#e1746d0a text:string = ReportReason;
+inputReportReasonCopyright#9b89f93a = ReportReason;
+inputReportReasonGeoIrrelevant#dbd4feed = ReportReason;
+
+userFull#edf17c12 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int = UserFull;
+
+contact#f911c994 user_id:int mutual:Bool = Contact;
+
+importedContact#d0028438 user_id:int client_id:long = ImportedContact;
+
+contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
+
+contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;
+
+contacts.contactsNotModified#b74ba9d2 = contacts.Contacts;
+contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts;
+
+contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;
+
+contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
+contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
+
+messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
+messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
+messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;
+
+messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.messagesSlice#c8edce1e flags:# inexact:flags.1?true count:int next_rate:flags.0?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.messagesNotModified#74535f21 count:int = messages.Messages;
+
+messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
+messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats;
+
+messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull;
+
+messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory;
+
+inputMessagesFilterEmpty#57e2f66c = MessagesFilter;
+inputMessagesFilterPhotos#9609a51c = MessagesFilter;
+inputMessagesFilterVideo#9fc00e65 = MessagesFilter;
+inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;
+inputMessagesFilterDocument#9eddf188 = MessagesFilter;
+inputMessagesFilterUrl#7ef0dd87 = MessagesFilter;
+inputMessagesFilterGif#ffc86587 = MessagesFilter;
+inputMessagesFilterVoice#50f5c392 = MessagesFilter;
+inputMessagesFilterMusic#3751b49e = MessagesFilter;
+inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter;
+inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter;
+inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter;
+inputMessagesFilterRoundVideo#b549da53 = MessagesFilter;
+inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter;
+inputMessagesFilterGeo#e7026d0d = MessagesFilter;
+inputMessagesFilterContacts#e062db83 = MessagesFilter;
+
+updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
+updateMessageID#4e90bfd6 id:int random_id:long = Update;
+updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update;
+updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update;
+updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update;
+updateChatParticipants#7761198 participants:ChatParticipants = Update;
+updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update;
+updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update;
+updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;
+updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
+updateEncryptedChatTyping#1710f156 chat_id:int = Update;
+updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update;
+updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;
+updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update;
+updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update;
+updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;
+updateUserBlocked#80ece81a user_id:int blocked:Bool = Update;
+updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
+updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
+updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
+updateUserPhone#12b9417b user_id:int phone:string = Update;
+updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update;
+updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update;
+updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;
+updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
+updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update;
+updateChannel#b6d45656 channel_id:int = Update;
+updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
+updateReadChannelInbox#330b5424 flags:# folder_id:flags.0?int channel_id:int max_id:int still_unread_count:int pts:int = Update;
+updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update;
+updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;
+updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update;
+updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
+updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
+updateStickerSets#43ae3dec = Update;
+updateSavedGifs#9375341e = Update;
+updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update;
+updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
+updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
+updateChannelPinnedMessage#98592475 channel_id:int id:int = Update;
+updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;
+updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update;
+updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update;
+updateReadFeaturedStickers#571d2742 = Update;
+updateRecentStickers#9a422c20 = Update;
+updateConfig#a229dd06 = Update;
+updatePtsChanged#3354678f = Update;
+updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update;
+updateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update;
+updatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update;
+updateBotWebhookJSON#8317c0c3 data:DataJSON = Update;
+updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update;
+updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update;
+updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update;
+updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update;
+updateLangPackTooLong#46560264 lang_code:string = Update;
+updateLangPack#56022f4d difference:LangPackDifference = Update;
+updateFavedStickers#e511996d = Update;
+updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update;
+updateContactsReset#7084a7be = Update;
+updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;
+updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;
+updateUserPinnedMessage#4c43da18 user_id:int id:int = Update;
+updateChatPinnedMessage#e10db349 chat_id:int id:int version:int = Update;
+updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
+updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
+updateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update;
+updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update;
+updatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update;
+updateNewScheduledMessage#39a51dfb message:Message = Update;
+updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;
+updateTheme#8216fba3 theme:Theme = Update;
+
+updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
+
+updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;
+updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference;
+updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;
+updates.differenceTooLong#4afe8f6d pts:int = updates.Difference;
+
+updatesTooLong#e317af7e = Updates;
+updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
+updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
+updateShort#78d4dec1 update:Update date:int = Updates;
+updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
+updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
+updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates;
+
+photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos;
+photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos;
+
+photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
+
+upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
+upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
+
+dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
+
+config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
+
+nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
+
+help.appUpdate#1da7158f flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string = help.AppUpdate;
+help.noAppUpdate#c45a6536 = help.AppUpdate;
+
+help.inviteText#18cb9f78 message:string = help.InviteText;
+
+encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat;
+encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat;
+encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat;
+encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat;
+encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat;
+
+inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat;
+
+encryptedFileEmpty#c21f497e = EncryptedFile;
+encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;
+
+inputEncryptedFileEmpty#1837c364 = InputEncryptedFile;
+inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;
+inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile;
+inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile;
+
+encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;
+encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;
+
+messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig;
+messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig;
+
+messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage;
+messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage;
+
+inputDocumentEmpty#72f0eaae = InputDocument;
+inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;
+
+documentEmpty#36f8c871 id:long = Document;
+document#9ba29cc1 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+
+help.support#17c6b5f6 phone_number:string user:User = help.Support;
+
+notifyPeer#9fd40bd8 peer:Peer = NotifyPeer;
+notifyUsers#b4c83b4c = NotifyPeer;
+notifyChats#c007cec3 = NotifyPeer;
+notifyBroadcasts#d612e8ef = NotifyPeer;
+
+sendMessageTypingAction#16bf744e = SendMessageAction;
+sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
+sendMessageRecordVideoAction#a187d66f = SendMessageAction;
+sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction;
+sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
+sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction;
+sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;
+sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;
+sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
+sendMessageChooseContactAction#628cbc6f = SendMessageAction;
+sendMessageGamePlayAction#dd6a8f48 = SendMessageAction;
+sendMessageRecordRoundAction#88f27fbc = SendMessageAction;
+sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction;
+
+contacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found;
+
+inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;
+inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey;
+inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey;
+inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey;
+inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey;
+inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey;
+inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey;
+inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey;
+
+privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;
+privacyKeyChatInvite#500e6dfa = PrivacyKey;
+privacyKeyPhoneCall#3d662b7b = PrivacyKey;
+privacyKeyPhoneP2P#39491cc8 = PrivacyKey;
+privacyKeyForwards#69ec56a3 = PrivacyKey;
+privacyKeyProfilePhoto#96151fed = PrivacyKey;
+privacyKeyPhoneNumber#d19ae46d = PrivacyKey;
+privacyKeyAddedByPhone#42ffd42b = PrivacyKey;
+
+inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;
+inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
+inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule;
+inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;
+inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueAllowChatParticipants#4c81c1ba chats:Vector<int> = InputPrivacyRule;
+inputPrivacyValueDisallowChatParticipants#d82363af chats:Vector<int> = InputPrivacyRule;
+
+privacyValueAllowContacts#fffe1bac = PrivacyRule;
+privacyValueAllowAll#65427b82 = PrivacyRule;
+privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule;
+privacyValueDisallowContacts#f888fa1a = PrivacyRule;
+privacyValueDisallowAll#8b73e763 = PrivacyRule;
+privacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule;
+privacyValueAllowChatParticipants#18be796b chats:Vector<int> = PrivacyRule;
+privacyValueDisallowChatParticipants#acae0690 chats:Vector<int> = PrivacyRule;
+
+account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;
+
+accountDaysTTL#b8d0afdf days:int = AccountDaysTTL;
+
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute;
+documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
+documentAttributeHasStickers#9801d2f7 = DocumentAttribute;
+
+messages.stickersNotModified#f1749a22 = messages.Stickers;
+messages.stickers#e4599bbd hash:int stickers:Vector<Document> = messages.Stickers;
+
+stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
+
+messages.allStickersNotModified#e86602c3 = messages.AllStickers;
+messages.allStickers#edfd405f hash:int sets:Vector<StickerSet> = messages.AllStickers;
+
+messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages;
+
+webPageEmpty#eb1477e8 id:long = WebPage;
+webPagePending#c586da1c id:long date:int = WebPage;
+webPage#fa64e172 flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document documents:flags.11?Vector<Document> cached_page:flags.10?Page = WebPage;
+webPageNotModified#85849473 = WebPage;
+
+authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;
+
+account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations;
+
+account.password#ad2641f8 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes = account.Password;
+
+account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;
+
+account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings;
+
+auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;
+
+receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage;
+
+chatInviteEmpty#69df3769 = ExportedChatInvite;
+chatInviteExported#fc2e05bc link:string = ExportedChatInvite;
+
+chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
+chatInvite#dfc2f58e flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:Photo participants_count:int participants:flags.4?Vector<User> = ChatInvite;
+
+inputStickerSetEmpty#ffb62b95 = InputStickerSet;
+inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
+inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
+inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
+
+stickerSet#eeb46f27 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize thumb_dc_id:flags.4?int count:int hash:int = StickerSet;
+
+messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
+
+botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+botInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = BotInfo;
+
+keyboardButton#a2fa4880 text:string = KeyboardButton;
+keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
+keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton;
+keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;
+keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;
+keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton;
+keyboardButtonGame#50f41ccf text:string = KeyboardButton;
+keyboardButtonBuy#afd93fbb text:string = KeyboardButton;
+keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;
+inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;
+
+keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
+
+replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;
+replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup;
+replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = ReplyMarkup;
+replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup;
+
+messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;
+messageEntityMention#fa04579d offset:int length:int = MessageEntity;
+messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;
+messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;
+messageEntityUrl#6ed02538 offset:int length:int = MessageEntity;
+messageEntityEmail#64e475c2 offset:int length:int = MessageEntity;
+messageEntityBold#bd610bc9 offset:int length:int = MessageEntity;
+messageEntityItalic#826f8b60 offset:int length:int = MessageEntity;
+messageEntityCode#28a20571 offset:int length:int = MessageEntity;
+messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;
+messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
+messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity;
+inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity;
+messageEntityPhone#9b69e34b offset:int length:int = MessageEntity;
+messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;
+messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;
+messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;
+messageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;
+
+inputChannelEmpty#ee8c1e86 = InputChannel;
+inputChannel#afeb712e channel_id:int access_hash:long = InputChannel;
+inputChannelFromMessage#2a286531 peer:InputPeer msg_id:int channel_id:int = InputChannel;
+
+contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer;
+
+messageRange#ae30253 min_id:int max_id:int = MessageRange;
+
+updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference;
+updates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
+updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
+
+channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;
+channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter;
+
+channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
+channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
+channelParticipantCreator#808d15a4 flags:# user_id:int rank:flags.0?string = ChannelParticipant;
+channelParticipantAdmin#ccbebbaf flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;
+channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
+
+channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
+channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;
+channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter;
+channelParticipantsBots#b0d1865b = ChannelParticipantsFilter;
+channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter;
+channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter;
+channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter;
+
+channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants;
+channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;
+
+channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant;
+
+help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService;
+
+foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif;
+foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif;
+
+messages.foundGifs#450a1c0a next_offset:int results:Vector<FoundGif> = messages.FoundGifs;
+
+messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs;
+messages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs;
+
+inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+
+inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;
+
+botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+
+botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;
+botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;
+
+messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;
+
+exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
+
+messageFwdHeader#ec338270 flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader;
+
+auth.codeTypeSms#72a3158c = auth.CodeType;
+auth.codeTypeCall#741cd3e3 = auth.CodeType;
+auth.codeTypeFlashCall#226ccefb = auth.CodeType;
+
+auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;
+auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
+auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
+auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
+
+messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
+
+messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;
+
+inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;
+
+inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM;
+
+messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs;
+
+topPeer#edcdc05b peer:Peer rating:double = TopPeer;
+
+topPeerCategoryBotsPM#ab661b5b = TopPeerCategory;
+topPeerCategoryBotsInline#148677e2 = TopPeerCategory;
+topPeerCategoryCorrespondents#637b7ed = TopPeerCategory;
+topPeerCategoryGroups#bd17a14a = TopPeerCategory;
+topPeerCategoryChannels#161d9628 = TopPeerCategory;
+topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory;
+topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory;
+topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory;
+
+topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers;
+
+contacts.topPeersNotModified#de266ef5 = contacts.TopPeers;
+contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;
+contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
+
+draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;
+draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;
+
+messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers;
+messages.featuredStickers#f89d88e5 hash:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;
+
+messages.recentStickersNotModified#b17f890 = messages.RecentStickers;
+messages.recentStickers#22f3afb3 hash:int packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers;
+
+messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers;
+
+messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult;
+messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult;
+
+stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered;
+stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered;
+
+maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords;
+
+inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia;
+inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia;
+
+game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game;
+
+inputGameID#32c3e77 id:long access_hash:long = InputGame;
+inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame;
+
+highScore#58fffcd0 pos:int user_id:int score:int = HighScore;
+
+messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores;
+
+textEmpty#dc3d824f = RichText;
+textPlain#744694e0 text:string = RichText;
+textBold#6724abc4 text:RichText = RichText;
+textItalic#d912a59c text:RichText = RichText;
+textUnderline#c12622c4 text:RichText = RichText;
+textStrike#9bf8bb95 text:RichText = RichText;
+textFixed#6c3f19b9 text:RichText = RichText;
+textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText;
+textEmail#de5a0dd6 text:RichText email:string = RichText;
+textConcat#7e6260d7 texts:Vector<RichText> = RichText;
+textSubscript#ed6a8504 text:RichText = RichText;
+textSuperscript#c7fb5e01 text:RichText = RichText;
+textMarked#34b8621 text:RichText = RichText;
+textPhone#1ccb966a text:RichText phone:string = RichText;
+textImage#81ccf4f document_id:long w:int h:int = RichText;
+textAnchor#35553762 text:RichText name:string = RichText;
+
+pageBlockUnsupported#13567e8a = PageBlock;
+pageBlockTitle#70abc3fd text:RichText = PageBlock;
+pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock;
+pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock;
+pageBlockHeader#bfd064ec text:RichText = PageBlock;
+pageBlockSubheader#f12bb6e1 text:RichText = PageBlock;
+pageBlockParagraph#467a0766 text:RichText = PageBlock;
+pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock;
+pageBlockFooter#48870999 text:RichText = PageBlock;
+pageBlockDivider#db20b188 = PageBlock;
+pageBlockAnchor#ce0d37b0 name:string = PageBlock;
+pageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock;
+pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock;
+pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock;
+pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock;
+pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock;
+pageBlockCover#39f23300 cover:PageBlock = PageBlock;
+pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock;
+pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockChannel#ef1751b5 channel:Chat = PageBlock;
+pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock;
+pageBlockKicker#1e148390 text:RichText = PageBlock;
+pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock;
+pageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock;
+pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock;
+pageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock;
+pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock;
+
+phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;
+phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;
+phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;
+phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;
+
+dataJSON#7d748d04 data:string = DataJSON;
+
+labeledPrice#cb296bf8 label:string amount:long = LabeledPrice;
+
+invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> = Invoice;
+
+paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge;
+
+postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress;
+
+paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo;
+
+paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials;
+
+webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+
+inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument;
+
+inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;
+inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;
+
+upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;
+
+payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;
+
+payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;
+
+payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;
+payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;
+
+payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;
+
+payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo;
+
+inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials;
+inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials;
+inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials;
+inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials;
+
+account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword;
+
+shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption;
+
+inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem;
+
+inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall;
+
+phoneCallEmpty#5366c915 id:long = PhoneCall;
+phoneCallWaiting#1b8f4ad1 flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;
+phoneCallRequested#87eabb53 flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCallAccepted#997c454a flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCall#8742ae7f flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;
+phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.5?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
+
+phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
+
+phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol;
+
+phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;
+
+upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile;
+upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile;
+
+cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey;
+
+cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig;
+
+langPackString#cad181f6 key:string value:string = LangPackString;
+langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString;
+langPackStringDeleted#2979eeb2 key:string = LangPackString;
+
+langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference;
+
+langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;
+
+channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;
+channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction;
+channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;
+
+channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
+
+channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults;
+
+channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter;
+
+popularContact#5ce14175 client_id:long importers:int = PopularContact;
+
+messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers;
+messages.favedStickers#f37f2f16 hash:int packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers;
+
+recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl;
+recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl;
+recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl;
+recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl;
+recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl;
+
+help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls;
+
+inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia;
+
+webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization;
+
+account.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations;
+
+inputMessageID#a676a322 id:int = InputMessage;
+inputMessageReplyTo#bad88395 id:int = InputMessage;
+inputMessagePinned#86872538 = InputMessage;
+
+inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;
+inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer;
+
+dialogPeer#e56dbf05 peer:Peer = DialogPeer;
+dialogPeerFolder#514519e2 folder_id:int = DialogPeer;
+
+messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;
+messages.foundStickerSets#5108d648 hash:int sets:Vector<StickerSetCovered> = messages.FoundStickerSets;
+
+fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
+
+inputClientProxy#75588b3f address:string port:int = InputClientProxy;
+
+help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData;
+help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector<Chat> users:Vector<User> = help.ProxyData;
+
+help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
+help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
+
+inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile;
+inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile;
+
+secureFileEmpty#64199744 = SecureFile;
+secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;
+
+secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;
+
+securePlainPhone#7d6099dd phone:string = SecurePlainData;
+securePlainEmail#21ec5a5f email:string = SecurePlainData;
+
+secureValueTypePersonalDetails#9d2a81e3 = SecureValueType;
+secureValueTypePassport#3dac6a00 = SecureValueType;
+secureValueTypeDriverLicense#6e425c4 = SecureValueType;
+secureValueTypeIdentityCard#a0d0744b = SecureValueType;
+secureValueTypeInternalPassport#99a48f23 = SecureValueType;
+secureValueTypeAddress#cbe31e26 = SecureValueType;
+secureValueTypeUtilityBill#fc36954e = SecureValueType;
+secureValueTypeBankStatement#89137c0d = SecureValueType;
+secureValueTypeRentalAgreement#8b883488 = SecureValueType;
+secureValueTypePassportRegistration#99e3806a = SecureValueType;
+secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType;
+secureValueTypePhone#b320aadb = SecureValueType;
+secureValueTypeEmail#8e3ca7ee = SecureValueType;
+
+secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;
+
+inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue;
+
+secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash;
+
+secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;
+secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
+secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;
+secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
+
+secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;
+
+account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;
+
+account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;
+
+help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo;
+help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo;
+
+savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact;
+
+account.takeout#4dba4501 id:long = account.Takeout;
+
+passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo;
+passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo;
+
+securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo;
+securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo;
+securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo;
+
+secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings;
+
+inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP;
+inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP;
+
+secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType;
+secureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType;
+
+help.passportConfigNotModified#bfb9f457 = help.PassportConfig;
+help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig;
+
+inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent;
+
+jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;
+
+jsonNull#3f6d7b68 = JSONValue;
+jsonBool#c7345e6a value:Bool = JSONValue;
+jsonNumber#2be0dfa4 value:double = JSONValue;
+jsonString#b71e767a value:string = JSONValue;
+jsonArray#f7444763 value:Vector<JSONValue> = JSONValue;
+jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;
+
+pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell;
+
+pageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow;
+
+pageCaption#6f747657 text:RichText credit:RichText = PageCaption;
+
+pageListItemText#b92fb6cd text:RichText = PageListItem;
+pageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem;
+
+pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem;
+pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem;
+
+pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle;
+
+page#ae891bec flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page;
+
+help.supportName#8c05f1c9 name:string = help.SupportName;
+
+help.userInfoEmpty#f3ae2eed = help.UserInfo;
+help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;
+
+pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;
+
+poll#d5529d06 id:long flags:# closed:flags.0?true question:string answers:Vector<PollAnswer> = Poll;
+
+pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true option:bytes voters:int = PollAnswerVoters;
+
+pollResults#5755785a flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int = PollResults;
+
+chatOnlines#f041e250 onlines:int = ChatOnlines;
+
+statsURL#47a971e0 url:string = StatsURL;
+
+chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true = ChatAdminRights;
+
+chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;
+
+inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper;
+inputWallPaperSlug#72091c80 slug:string = InputWallPaper;
+
+account.wallPapersNotModified#1c199183 = account.WallPapers;
+account.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.WallPapers;
+
+codeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings;
+
+wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings;
+
+autoDownloadSettings#d246fd47 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int = AutoDownloadSettings;
+
+account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings;
+
+emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword;
+emojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword;
+
+emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference;
+
+emojiURL#a575739d url:string = EmojiURL;
+
+emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage;
+
+fileLocationToBeDeprecated#bc7fc6cd volume_id:long local_id:int = FileLocation;
+
+folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder;
+
+inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer;
+
+folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;
+
+messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;
+
+urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult;
+urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult;
+urlAuthResultDefault#a9d6db1f = UrlAuthResult;
+
+channelLocationEmpty#bfb5ad8b = ChannelLocation;
+channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation;
+
+peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated;
+
+restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason;
+
+inputTheme#3c5693e9 id:long access_hash:long = InputTheme;
+inputThemeSlug#f5890df1 slug:string = InputTheme;
+
+themeDocumentNotModified#483d270c = Theme;
+theme#f7d90ce0 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document installs_count:int = Theme;
+
+account.themesNotModified#f41eb622 = account.Themes;
+account.themes#7f676421 hash:int themes:Vector<Theme> = account.Themes;
+
+---functions---
+
+invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
+invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
+initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
+invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
+invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
+invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
+invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
+
+auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
+auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
+auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
+auth.logOut#5717da40 = Bool;
+auth.resetAuthorizations#9fab0d1a = Bool;
+auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
+auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization;
+auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;
+auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;
+auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization;
+auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;
+auth.recoverPassword#4ea56e92 code:string = auth.Authorization;
+auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;
+auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;
+auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;
+
+account.registerDevice#68976c6f flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<int> = Bool;
+account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = Bool;
+account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;
+account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings;
+account.resetNotifySettings#db7e1747 = Bool;
+account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User;
+account.updateStatus#6628562c offline:Bool = Bool;
+account.getWallPapers#aabb1763 hash:int = account.WallPapers;
+account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool;
+account.checkUsername#2714d86c username:string = Bool;
+account.updateUsername#3e0bdd7c username:string = User;
+account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;
+account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
+account.deleteAccount#418d4e0b reason:string = Bool;
+account.getAccountTTL#8fc711d = AccountDaysTTL;
+account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool;
+account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode;
+account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User;
+account.updateDeviceLocked#38df3532 period:int = Bool;
+account.getAuthorizations#e320c158 = account.Authorizations;
+account.resetAuthorization#df77f3bc hash:long = Bool;
+account.getPassword#548a30f5 = account.Password;
+account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings;
+account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool;
+account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode;
+account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool;
+account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;
+account.getWebAuthorizations#182e6d6f = account.WebAuthorizations;
+account.resetWebAuthorization#2d01b9ef hash:long = Bool;
+account.resetWebAuthorizations#682d2594 = Bool;
+account.getAllSecureValues#b288bc7d = Vector<SecureValue>;
+account.getSecureValue#73665bc2 types:Vector<SecureValueType> = Vector<SecureValue>;
+account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue;
+account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool;
+account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm;
+account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
+account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;
+account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool;
+account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
+account.verifyEmail#ecba39db email:string code:string = Bool;
+account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout;
+account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
+account.confirmPasswordEmail#8fdf1920 code:string = Bool;
+account.resendPasswordEmail#7a7f2a15 = Bool;
+account.cancelPasswordEmail#c1cbd5b6 = Bool;
+account.getContactSignUpNotification#9f07c728 = Bool;
+account.setContactSignUpNotification#cff43f61 silent:Bool = Bool;
+account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates;
+account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper;
+account.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;
+account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool;
+account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool;
+account.resetWallPapers#bb3b9804 = Bool;
+account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings;
+account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool;
+account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document;
+account.createTheme#2b7ffd7f slug:string title:string document:InputDocument = Theme;
+account.updateTheme#3b8ea202 flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument = Theme;
+account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool;
+account.installTheme#7ae43737 flags:# dark:flags.0?true format:flags.1?string theme:flags.1?InputTheme = Bool;
+account.getTheme#8d9d742b format:string theme:InputTheme document_id:long = Theme;
+account.getThemes#285946f8 format:string hash:int = account.Themes;
+
+users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
+users.getFullUser#ca30a5b1 id:InputUser = UserFull;
+users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool;
+
+contacts.getContactIDs#2caa4a42 hash:int = Vector<int>;
+contacts.getStatuses#c4a353ee = Vector<ContactStatus>;
+contacts.getContacts#c023849f hash:int = contacts.Contacts;
+contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;
+contacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates;
+contacts.deleteByPhones#1013fd9e phones:Vector<string> = Bool;
+contacts.block#332b49fc id:InputUser = Bool;
+contacts.unblock#e54100bd id:InputUser = Bool;
+contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;
+contacts.search#11f812d8 q:string limit:int = contacts.Found;
+contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
+contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers;
+contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool;
+contacts.resetSaved#879537f1 = Bool;
+contacts.getSaved#82f1e39f = Vector<SavedContact>;
+contacts.toggleTopPeers#8514bdda enabled:Bool = Bool;
+contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
+contacts.acceptContact#f831a20f id:InputUser = Updates;
+contacts.getLocated#a356056 geo_point:InputGeoPoint = Updates;
+
+messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
+messages.getDialogs#a0ee3b73 flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs;
+messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
+messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
+messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
+messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;
+messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
+messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
+messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
+messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;
+messages.reportSpam#cf1592db peer:InputPeer = Bool;
+messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings;
+messages.report#bd82b658 peer:InputPeer id:Vector<int> reason:ReportReason = Bool;
+messages.getChats#3c6aa187 id:Vector<int> = messages.Chats;
+messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;
+messages.editChatTitle#dc452855 chat_id:int title:string = Updates;
+messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates;
+messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates;
+messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates;
+messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;
+messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig;
+messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat;
+messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat;
+messages.discardEncryption#edd923c5 chat_id:int = Bool;
+messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool;
+messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool;
+messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
+messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>;
+messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool;
+messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;
+messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers;
+messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers;
+messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia;
+messages.exportChatInvite#df7534c peer:InputPeer = ExportedChatInvite;
+messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
+messages.importChatInvite#6c50051c hash:string = Updates;
+messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
+messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult;
+messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
+messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;
+messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>;
+messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool;
+messages.migrateChat#15a3b8e3 chat_id:int = Updates;
+messages.searchGlobal#bf7225a4 flags:# folder_id:flags.0?int q:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
+messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool;
+messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document;
+messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs;
+messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs;
+messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;
+messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
+messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool;
+messages.sendInlineBotResult#220815b0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string schedule_date:flags.10?int = Updates;
+messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData;
+messages.editMessage#48f71778 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int = Updates;
+messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool;
+messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer;
+messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool;
+messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs;
+messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool;
+messages.getAllDrafts#6a3f8d65 = Updates;
+messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers;
+messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool;
+messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers;
+messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool;
+messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool;
+messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers;
+messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers;
+messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>;
+messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates;
+messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool;
+messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores;
+messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores;
+messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats;
+messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats;
+messages.getWebPage#32ca8f91 url:string hash:int = WebPage;
+messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;
+messages.reorderPinnedDialogs#3b1adf37 flags:# force:flags.0?true folder_id:int order:Vector<InputDialogPeer> = Bool;
+messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs;
+messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool;
+messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool;
+messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;
+messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates;
+messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers;
+messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
+messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
+messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory;
+messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages;
+messages.sendMultiMedia#cc0110cb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int = Updates;
+messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
+messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets;
+messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
+messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool;
+messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>;
+messages.clearAllDrafts#7e58ee9c = Bool;
+messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true peer:InputPeer id:int = Updates;
+messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
+messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
+messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
+messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL;
+messages.editChatAbout#def60797 peer:InputPeer about:string = Bool;
+messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;
+messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference;
+messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference;
+messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector<string> = Vector<EmojiLanguage>;
+messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL;
+messages.getSearchCounters#732eef00 peer:InputPeer filters:Vector<MessagesFilter> = Vector<messages.SearchCounter>;
+messages.requestUrlAuth#e33f5613 peer:InputPeer msg_id:int button_id:int = UrlAuthResult;
+messages.acceptUrlAuth#f729ea98 flags:# write_allowed:flags.0?true peer:InputPeer msg_id:int button_id:int = UrlAuthResult;
+messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool;
+messages.getScheduledHistory#e2c2685b peer:InputPeer hash:int = messages.Messages;
+messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector<int> = messages.Messages;
+messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates;
+messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates;
+
+updates.getState#edd4882a = updates.State;
+updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
+updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;
+
+photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto;
+photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo;
+photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>;
+photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;
+
+upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;
+upload.getFile#b15a9afc flags:# precise:flags.0?true location:InputFileLocation offset:int limit:int = upload.File;
+upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
+upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;
+upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile;
+upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector<FileHash>;
+upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector<FileHash>;
+upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector<FileHash>;
+
+help.getConfig#c4f9186b = Config;
+help.getNearestDc#1fb33026 = NearestDc;
+help.getAppUpdate#522d5a7d source:string = help.AppUpdate;
+help.getInviteText#4d392343 = help.InviteText;
+help.getSupport#9cdf08cd = help.Support;
+help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
+help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
+help.getCdnConfig#52029342 = CdnConfig;
+help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
+help.getProxyData#3d7758e1 = help.ProxyData;
+help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
+help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
+help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
+help.getAppConfig#98914110 = JSONValue;
+help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
+help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
+help.getSupportName#d360e72c = help.SupportName;
+help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
+help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
+
+channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
+channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
+channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory;
+channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool;
+channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;
+channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants;
+channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant;
+channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
+channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
+channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;
+channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;
+channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
+channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
+channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
+channels.updateUsername#3514b3de channel:InputChannel username:string = Bool;
+channels.joinChannel#24b524c5 channel:InputChannel = Updates;
+channels.leaveChannel#f836aa95 channel:InputChannel = Updates;
+channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
+channels.deleteChannel#c0111fe3 channel:InputChannel = Updates;
+channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink;
+channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;
+channels.getAdminedPublicChannels#f8b036af flags:# by_location:flags.0?true check_limit:flags.1?true = messages.Chats;
+channels.editBanned#72796912 channel:InputChannel user_id:InputUser banned_rights:ChatBannedRights = Updates;
+channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults;
+channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool;
+channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;
+channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool;
+channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;
+channels.getLeftChannels#8341ecc0 offset:int = messages.Chats;
+channels.getGroupsForDiscussion#f5dad378 = messages.Chats;
+channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
+channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates;
+channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool;
+channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates;
+
+bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
+bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
+
+payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm;
+payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt;
+payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;
+payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult;
+payments.getSavedInfo#227d824b = payments.SavedInfo;
+payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
+
+stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet;
+stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
+stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
+stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet;
+
+phone.getCallConfig#55451fa9 = DataJSON;
+phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
+phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;
+phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;
+phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
+
+langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
+langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
+langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference;
+langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;
+langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage;
+
+folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
+folders.deleteFolder#1c295881 folder_id:int = Updates;
+
+// LAYER 105

+ 113 - 0
static/schema.tl

@@ -0,0 +1,113 @@
+// Core types (no need to gen)
+
+//vector#1cb5c415 {t:Type} # [ t ] = Vector t;
+
+///////////////////////////////
+/// Authorization key creation
+///////////////////////////////
+
+resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ;
+
+p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data;
+p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;
+p_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data;
+p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;
+
+server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;
+server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;
+
+server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;
+
+client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;
+
+dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
+dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;
+dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;
+
+destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes;
+destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes;
+destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;
+
+---functions---
+
+req_pq#60469778 nonce:int128 = ResPQ;
+req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
+
+req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;
+
+set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;
+
+destroy_auth_key#d1435160 = DestroyAuthKeyRes;
+
+///////////////////////////////
+////////////// System messages
+///////////////////////////////
+
+---types---
+
+msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck;
+
+bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification;
+bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification;
+
+msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq;
+msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo;
+msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo;
+
+msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+
+msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq;
+
+//rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually
+
+rpc_error#2144ca19 error_code:int error_message:string = RpcError;
+
+rpc_answer_unknown#5e2ad36e = RpcDropAnswer;
+rpc_answer_dropped_running#cd78e586 = RpcDropAnswer;
+rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer;
+
+future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;
+future_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts;
+
+pong#347773c5 msg_id:long ping_id:long = Pong;
+
+destroy_session_ok#e22045fc session_id:long = DestroySessionRes;
+destroy_session_none#62d350c9 session_id:long = DestroySessionRes;
+
+new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession;
+
+//message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually
+//msg_container#73f1f8dc messages:vector<message> = MessageContainer; // parsed manually
+//msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container
+//gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually
+
+http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait;
+
+//ipPort ipv4:int port:int = IpPort;
+//help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector<ipPort> = help.ConfigSimple;
+
+ipPort#d433ad73 ipv4:int port:int = IpPort;
+ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort;
+accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector<IpPort> = AccessPointRule;
+help.configSimple#5a592a6c date:int expires:int rules:vector<AccessPointRule> = help.ConfigSimple;
+
+tlsClientHello blocks:vector<TlsBlock> = TlsClientHello;
+
+tlsBlockString data:string = TlsBlock;
+tlsBlockRandom length:int = TlsBlock;
+tlsBlockZero length:int = TlsBlock;
+tlsBlockDomain = TlsBlock;
+tlsBlockGrease seed:int = TlsBlock;
+tlsBlockScope entries:Vector<TlsBlock> = TlsBlock;
+
+---functions---
+
+rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer;
+
+get_future_salts#b921bd04 num:int = FutureSalts;
+
+ping#7abe77ec ping_id:long = Pong;
+ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;
+
+destroy_session#e7512126 session_id:long = DestroySessionRes;

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini